From f14439749926cca959747bb79fda10529520bd0b Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 7 Mar 2008 07:43:41 +0000 Subject: [PATCH] Join modifications from BR_Dev_For_4_0 tag V4_1_1. --- COPYING | 662 ++++--- DEPRECATED/configure.in.base | 11 +- Makefile.am | 4 +- bin/Makefile.am | 33 +- bin/NSparam.py | 4 +- bin/addToKillList.py | 23 +- bin/appli_clean.sh | 2 +- bin/appli_gen.py | 258 +++ bin/appli_install.sh | 7 +- bin/appliskel/CatalogResources.xml | 26 +- bin/appliskel/README | 4 +- bin/appliskel/SalomeApp.xml | 44 +- bin/appliskel/env.d/envSalome.sh | 3 +- bin/appliskel/getAppliPath.py | 35 + bin/appliskel/killCurrentPort | 10 +- bin/appliskel/runAppli | 13 +- bin/appliskel/runConsole | 2 +- bin/appliskel/runRemote.sh | 37 +- bin/appliskel/runSession | 7 +- bin/appliskel/runTests | 3 +- bin/appliskel/searchFreePort.sh | 2 +- bin/appliskel/setAppliPath.sh | 36 - bin/config_appli.xml | 20 + bin/envSalome.py | 18 +- bin/killSalome.py | 17 + bin/killSalomeWithPort.py | 39 +- bin/launchConfigureParser.py | 984 +++++++--- bin/launchSalome.py | 92 + bin/nameserver.py | 115 ++ bin/orbmodule.py | 50 +- bin/runNS.py | 99 ++ bin/runSalome | 48 +- bin/runSalome.csh | 2 +- bin/runSalome.ksh | 2 +- bin/runSalome.py | 616 +++---- bin/salomeConsole.py | 2 +- bin/salome_session.py | 2 +- bin/server.py | 96 + bin/setenv.py | 298 ++++ bin/shutdownSalome.py | 28 + bin/virtual_salome.py | 177 +- bin/waitContainers.py | 53 + bin/waitNS.py | 4 + bin/waitNS.sh | 9 + clean_configure | 4 + configure.ac | 117 +- doc/INSTALL.txt | 6 - doc/KERNEL_Services.txt | 4 +- doc/Makefile.am | 16 +- doc/README.cluster-CCRT | 63 + doc/SALOME_Application.txt | 53 +- doc/salome/Makefile.am | 11 +- 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 | 22 +- 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 +- .../sources/static/examples_Life_cycle.html | 232 +-- .../KERNEL/sources/static/examples_Study.html | 1580 ++++++++--------- .../tui/KERNEL/sources/static/mapping.html | 658 +++---- .../sources/static/overview_Kernel.html | 382 ++-- .../sources/static/overview_Life_Cycle.html | 180 +- .../sources/static/overview_Naming.html | 394 ++-- .../KERNEL/sources/static/overview_Study.html | 522 +++--- doc/salome/tui/Makefile.am | 42 +- doc/salome/unittests.dox | 207 +++ doc/salome/version.texi | 4 - idl/Calcium_Ports.idl | 81 + idl/DSC_Engines.idl | 404 +++++ idl/DSC_Engines.xml | 58 + idl/Makefile.am | 152 +- idl/Palm_Ports.idl | 71 + idl/SALOMEDS.idl | 110 +- idl/SALOMEDS_Attributes.idl | 118 +- idl/SALOME_Component.idl | 354 +++- idl/SALOME_Component.xml | 72 + idl/SALOME_ContainerManager.idl | 99 +- idl/SALOME_Exception.xml | 31 + idl/SALOME_ModuleCatalog.idl | 87 +- idl/SALOME_Ports.idl | 127 ++ idl/SALOME_Ports.xml | 39 + idl/SALOME_Registry.idl | 2 + idl/SALOME_Session.idl | 6 +- resources/CatalogResources.xml.in | 46 +- resources/KERNELCatalog.xml.in | 25 + resources/Makefile.am | 3 +- salome_adm/Makefile.am | 1 + salome_adm/unix/DEPRECATED/make_commence.in | 1 + salome_adm/unix/DEPRECATED/make_conclude.in | 32 +- salome_adm/unix/DEPRECATED/make_module.in | 14 +- salome_adm/unix/Doxyfile | 829 +++++++++ salome_adm/unix/F77config.h.in | 29 + salome_adm/unix/Makefile.am | 2 +- salome_adm/unix/SALOMEconfig.ref.in | 17 + salome_adm/unix/config_files/Makefile.am | 6 +- .../unix/config_files/ac_cc_warnings.m4 | 119 ++ .../unix/config_files/ac_cxx_depend_flag.m4 | 85 +- salome_adm/unix/config_files/check_Salome.m4 | 78 + salome_adm/unix/config_files/check_boost.m4 | 14 + salome_adm/unix/config_files/check_cas.m4 | 27 +- salome_adm/unix/config_files/check_cppunit.m4 | 12 +- salome_adm/unix/config_files/check_hdf5.m4 | 6 +- salome_adm/unix/config_files/check_htmlgen.m4 | 2 +- salome_adm/unix/config_files/check_java.m4 | 111 ++ salome_adm/unix/config_files/check_libxml.m4 | 58 + salome_adm/unix/config_files/check_mpi.m4 | 21 +- salome_adm/unix/config_files/check_omniorb.m4 | 35 +- salome_adm/unix/config_files/check_opengl.m4 | 195 -- salome_adm/unix/config_files/check_openmpi.m4 | 56 + salome_adm/unix/config_files/check_paco++.m4 | 61 + salome_adm/unix/config_files/check_qt.m4 | 182 -- salome_adm/unix/config_files/check_swig.m4 | 8 + salome_adm/unix/config_files/production.m4 | 81 +- salome_adm/unix/make_common_starter.am | 18 +- salome_adm/unix/pythonbe.py | 39 - salome_adm/unix/sstream.in | 225 +++ src/Basics/BasicsGenericDestructor.cxx | 9 +- src/Basics/BasicsGenericDestructor.hxx | 43 +- src/Batch/Batch_BatchManagerCatalog.cxx | 3 +- src/Batch/Batch_BatchManagerCatalog.hxx | 1 + src/Batch/Batch_Date.cxx | 2 +- src/Batch/Batch_Parametre.hxx | 2 +- src/Batch/Batch_PyVersatile.cxx | 6 +- src/Batch/Makefile.am | 26 +- src/Batch_SWIG/Makefile.am | 6 +- 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/Makefile.am | 3 +- src/Communication/MatrixClient.hxx | 4 +- src/Communication/MultiCommException.hxx | 5 +- src/Communication/ReceiverFactory.hxx | 4 +- src/Communication/Receivers.cxx | 2 +- src/Communication/SALOMEMultiComm.hxx | 4 +- src/Communication/SALOME_Comm_i.cxx | 2 +- src/Communication/SALOME_Comm_i.hxx | 30 +- .../SALOME_Communication.hxx} | 39 +- src/Communication/SALOME_Matrix_i.cxx | 2 +- src/Communication/SALOME_Matrix_i.hxx | 4 +- src/Communication/SenderFactory.hxx | 4 +- src/Communication_SWIG/Makefile.am | 6 +- src/Container/Component_i.cxx | 271 ++- src/Container/Container_i.cxx | 466 +++-- src/Container/Container_init_python.cxx | 4 +- src/Container/Container_init_python.hxx | 16 +- src/Container/Makefile.am | 53 +- src/Container/SALOME_ComponentPy.py | 14 +- src/Container/SALOME_Component_i.hxx | 55 +- src/Container/SALOME_Container.cxx | 83 +- .../SALOME_Container.hxx} | 40 +- src/Container/SALOME_Container.py | 10 +- src/Container/SALOME_ContainerManager.cxx | 564 ++++-- src/Container/SALOME_ContainerManager.hxx | 54 +- src/Container/SALOME_ContainerPy.py | 23 +- .../SALOME_Container_SignalsHandler.cxx | 2 +- src/Container/SALOME_Container_i.hxx | 29 +- src/Container/SALOME_FileRef_i.hxx | 6 +- src/Container/SALOME_FileTransfer_i.hxx | 6 +- src/Container/Salome_file_i.cxx | 1063 +++++++++++ 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 | 95 + src/DF/testDF.cxx | 311 ++++ src/DSC/DSC.dox | 49 + src/DSC/DSC_Basic/ConnectionManager_i.cxx | 130 ++ src/DSC/DSC_Basic/ConnectionManager_i.hxx | 100 ++ .../DSC_Basic/DSC_Basic.hxx} | 43 +- src/DSC/DSC_Basic/DSC_Callbacks.hxx | 74 + src/DSC/DSC_Basic/DSC_i.cxx | 46 + src/DSC/DSC_Basic/DSC_i.hxx | 171 ++ src/DSC/DSC_Basic/DSC_interface.cxx | 381 ++++ src/DSC/DSC_Basic/DSC_interface.hxx | 181 ++ src/DSC/DSC_Basic/Makefile.am | 92 + .../DSC_Basic/PortProperties_i.cxx} | 48 +- src/DSC/DSC_Basic/PortProperties_i.hxx | 60 + .../SALOME_ConnectionManagerServer.cxx | 67 + src/DSC/DSC_Python/Makefile.am | 81 + src/DSC/DSC_Python/calcium.i | 797 +++++++++ src/DSC/DSC_Python/dsccalcium.py | 71 + src/DSC/DSC_User/Basic/Makefile.am | 69 + .../DSC_User/Basic/basic_port_factory.cxx} | 48 +- src/DSC/DSC_User/Basic/basic_port_factory.hxx | 67 + .../Basic/data_short_port_provides.cxx | 94 + .../Basic/data_short_port_provides.hxx | 80 + .../DSC_User/Basic/data_short_port_uses.cxx | 66 + .../DSC_User/Basic/data_short_port_uses.hxx | 74 + src/DSC/DSC_User/DSC_Exception.hxx | 180 ++ .../DSC_User/Datastream/AdjacentFunctor.hxx | 114 ++ .../DSC_User/Datastream/AdjacentPredicate.hxx | 76 + src/DSC/DSC_User/Datastream/Calcium/Calcium.c | 280 +++ .../DSC_User/Datastream/Calcium/Calcium.cxx | 126 ++ .../DSC_User/Datastream/Calcium/Calcium.hxx | 17 + .../Calcium/CalciumCouplingPolicy.cxx | 112 ++ .../Calcium/CalciumCouplingPolicy.hxx | 479 +++++ .../Calcium/CalciumCxxInterface.hxx | 500 ++++++ .../Datastream/Calcium/CalciumException.hxx | 68 + .../Calcium/CalciumGenericProvidesPort.hxx | 216 +++ .../Calcium/CalciumGenericUsesPort.hxx | 67 + .../Datastream/Calcium/CalciumInterface.hxx | 246 +++ .../Datastream/Calcium/CalciumPortTraits.hxx | 101 ++ .../Calcium/CalciumProvidesPort.cxx | 14 + .../Calcium/CalciumProvidesPort.hxx | 40 + .../Datastream/Calcium/CalciumTypes.hxx | 209 +++ .../Calcium/CalciumTypes2CorbaTypes.cxx | 135 ++ .../Calcium/CalciumTypes2CorbaTypes.hxx | 62 + .../Calcium/CalciumTypesManipulator.hxx} | 44 +- .../Datastream/Calcium/Copy2CorbaSpace.hxx | 97 + .../Datastream/Calcium/Copy2UserSpace.hxx | 181 ++ .../Calcium/CorbaTypes2CalciumTypes.cxx | 134 ++ .../Calcium/CorbaTypes2CalciumTypes.hxx | 62 + .../DSC_User/Datastream/Calcium/Makefile.am | 132 ++ src/DSC/DSC_User/Datastream/Calcium/calcium.h | 761 ++++++++ .../DSC_User/Datastream/Calcium/calcium.hf | 103 ++ .../DSC_User/Datastream/Calcium/calciumP.h | 547 ++++++ .../Calcium/calcium_complex_port_uses.hxx | 50 + .../Calcium/calcium_destructors_port_uses.cxx | 37 + .../Calcium/calcium_double_port_uses.hxx | 50 + .../Calcium/calcium_integer_port_uses.hxx | 52 + .../Calcium/calcium_logical_port_uses.hxx | 50 + .../Calcium/calcium_port_factory.cxx | 73 + .../Calcium/calcium_port_factory.hxx | 61 + .../Calcium/calcium_provides_port.cxx | 10 + .../Calcium/calcium_provides_port.hxx | 48 + .../Calcium/calcium_real_port_uses.hxx | 51 + .../Calcium/calcium_repository_types.cxx | 41 + .../Calcium/calcium_string_port_uses.hxx | 50 + .../Datastream/Calcium/calcium_uses_port.cxx | 33 + .../Datastream/Calcium/calcium_uses_port.hxx | 43 + .../DSC_User/Datastream/Calcium/calciumf.c | 217 +++ src/DSC/DSC_User/Datastream/Calcium/fortoc.h | 20 + .../Datastream/Calcium/testInterpolation.cxx | 117 ++ .../Calcium/test_CalciumInterface.cxx | 34 + .../Calcium/test_DataIdContainer.cxx | 133 ++ src/DSC/DSC_User/Datastream/Calcium/version.h | 39 + src/DSC/DSC_User/Datastream/ConstTraits.hxx | 35 + .../Datastream/CorbaTypeManipulator.hxx | 468 +++++ .../DSC_User/Datastream/CouplingPolicy.hxx | 161 ++ src/DSC/DSC_User/Datastream/DataIdFilter.hxx | 356 ++++ src/DSC/DSC_User/Datastream/DisplayPair.hxx | 40 + .../DSC_User/Datastream/FindKeyPredicate.hxx | 78 + src/DSC/DSC_User/Datastream/GenericPort.hxx | 642 +++++++ .../Datastream/GenericProvidesPort.hxx | 26 + .../DSC_User/Datastream/GenericUsesPort.hxx | 146 ++ .../DSC_User/Datastream/IteratorTraits.hxx | 40 + src/DSC/DSC_User/Datastream/Makefile.am | 75 + src/DSC/DSC_User/Datastream/Palm/Makefile.am | 82 + .../Datastream/Palm/PalmCouplingPolicy.hxx | 195 ++ .../palm_data_seq_short_port_provides.hxx | 60 + .../Palm/palm_data_short_port_provides.hxx | 57 + .../Datastream/Palm/palm_port_factory.cxx | 53 + .../Datastream/Palm/palm_port_factory.hxx | 55 + .../Datastream/Palm/test_DataIdContainer.cxx | 123 ++ .../Datastream/ProcessTimeIntervalTraits.hxx | 68 + src/DSC/DSC_User/Datastream/fake.cc | 27 + .../Datastream/testAdjacentFunctor.cxx | 175 ++ .../Datastream/testAdjacentPredicate.cxx | 142 ++ src/DSC/DSC_User/Makefile.am | 97 + src/DSC/DSC_User/Superv_Component_i.cxx | 316 ++++ src/DSC/DSC_User/Superv_Component_i.hxx | 382 ++++ src/DSC/DSC_User/base_port.cxx | 18 + .../DSC_User/base_port.hxx} | 51 +- src/DSC/DSC_User/port_factory.hxx | 61 + src/DSC/DSC_User/provides_port.cxx | 32 + src/DSC/DSC_User/provides_port.hxx | 65 + src/DSC/DSC_User/test_DSC_Exception.cxx | 157 ++ src/DSC/DSC_User/uses_port.cxx | 28 + src/DSC/DSC_User/uses_port.hxx | 71 + src/DSC/Makefile.am | 32 + src/DSC/ParallelDSC/Makefile.am | 75 + src/DSC/ParallelDSC/ParallelDSC_i.cxx | 120 ++ src/DSC/ParallelDSC/ParallelDSC_i.hxx | 214 +++ src/GenericObj/SALOME_GenericObj_i.cc | 4 +- src/GenericObj/SALOME_GenericObj_i.hh | 2 +- src/HDFPersist/HDFascii.cc | 189 +- src/HDFPersist/HDFascii.hxx | 4 +- src/HDFPersist/HDFattrGetSize.c | 7 +- src/HDFPersist/HDFcontainerObject.cc | 4 +- src/HDFPersist/HDFcontainerObject.hxx | 6 +- src/HDFPersist/HDFdataset.cc | 4 +- src/HDFPersist/HDFdataset.hxx | 8 +- src/HDFPersist/HDFdatasetGetOrder.c | 2 +- src/HDFPersist/HDFdatasetWrite.c | 3 +- .../HDFexport.hxx} | 36 +- 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/HDFobjectIdentify.c | 4 +- src/HDFPersist/HDFobjectType.c | 1 - src/HDFPersist/Makefile.am | 21 +- src/HDFPersist/test1.c | 3 + src/KERNEL_PY/Help.py | 6 +- src/KERNEL_PY/Makefile.am | 4 +- src/KERNEL_PY/batchmode_salome.py | 34 +- src/KERNEL_PY/import_hook.py | 106 +- src/KERNEL_PY/kernel_shared_modules.py | 29 +- src/KERNEL_PY/omnipatch.py | 22 +- src/KERNEL_PY/salome.py | 50 +- src/KERNEL_PY/salome_iapp.py | 2 +- src/KERNEL_PY/salome_shared_modules.py | 32 +- src/KERNEL_PY/salome_study.py | 89 +- src/KERNEL_PY/salome_test.py | 427 ++--- src/Launcher/BatchLight_BatchManager.cxx | 296 +++ src/Launcher/BatchLight_BatchManager.hxx | 89 + src/Launcher/BatchLight_BatchManager_PBS.cxx | 475 +++++ src/Launcher/BatchLight_BatchManager_PBS.hxx | 64 + .../BatchLight_BatchManager_SLURM.cxx | 340 ++++ .../BatchLight_BatchManager_SLURM.hxx | 62 + src/Launcher/BatchLight_Job.cxx | 160 ++ src/Launcher/BatchLight_Job.hxx | 72 + src/Launcher/Makefile.am | 138 ++ src/Launcher/MpiImpl.cxx | 212 +++ src/Launcher/MpiImpl.hxx | 131 ++ src/Launcher/SALOME_Launcher.cxx | 286 +++ src/Launcher/SALOME_Launcher.hxx | 82 + .../SALOME_LauncherServer.cxx} | 63 +- src/LifeCycleCORBA/LifeCycleCORBA.py | 4 +- src/LifeCycleCORBA/Makefile.am | 25 +- .../SALOME_FileTransferCORBA.cxx | 10 +- .../SALOME_FileTransferCORBA.hxx | 12 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx | 126 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx | 29 +- .../Test/LifeCycleCORBATest.cxx | 13 +- src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py | 15 +- src/LifeCycleCORBA/TestContainerManager.cxx | 166 ++ src/LifeCycleCORBA/Test_LifeCycleCORBA.cxx | 6 - src/LifeCycleCORBA_SWIG/Makefile.am | 8 +- .../Test/LifeCycleCORBA_SWIGTest.py | 5 +- .../Test/TestLifeCycleCORBA_SWIG.py | 13 +- .../libSALOME_LifeCycleCORBA.i | 87 +- src/Logger/SALOME_Logger_Server.hxx | 18 +- src/Logger/SALOME_Logger_Server_main.cxx | 2 + src/Makefile.am | 28 +- src/ModuleCatalog/Makefile.am | 17 +- src/ModuleCatalog/SALOME_ModuleCatalog.hxx | 48 + .../SALOME_ModuleCatalog_Acomponent_impl.cxx | 15 +- .../SALOME_ModuleCatalog_Acomponent_impl.hxx | 35 +- .../SALOME_ModuleCatalog_Client.cxx | 2 - .../SALOME_ModuleCatalog_Handler.cxx | 1113 +++++++----- .../SALOME_ModuleCatalog_Handler.hxx | 203 +-- .../SALOME_ModuleCatalog_Parser.hxx | 43 +- .../SALOME_ModuleCatalog_Server.cxx | 23 +- .../SALOME_ModuleCatalog_impl.cxx | 275 ++- .../SALOME_ModuleCatalog_impl.hxx | 44 +- src/ModuleCatalog/TestModuleCatalog.py | 82 + src/ModuleGenerator/IDLparser.py | 5 +- src/NOTIFICATION_SWIG/Makefile.am | 12 +- src/NOTIFICATION_SWIG/NOTIFICATION.i | 4 + src/NOTIFICATION_SWIG/NOTIFICATION_Swig.hxx | 10 +- .../SALOME_NOTIFICATION_SWIG.hxx | 47 + .../NamingService_WaitForServerReadiness.cxx | 12 +- .../NamingService_WaitForServerReadiness.hxx | 10 +- src/NamingService/SALOME_NamingService.cxx | 322 ++-- src/NamingService/SALOME_NamingServicePy.py | 17 +- src/NamingService/ServiceUnreachable.hxx | 6 +- src/NamingService/Test/NamingServiceTest.cxx | 12 +- src/NamingService/Test/NamingServiceTest.hxx | 4 +- src/NamingService/Test/TestNamingService.py | 7 +- src/Notification/CosNotifyShorthands.h | 2 + src/Notification/Makefile.am | 4 +- src/Notification/NOTIFICATION.hxx | 17 +- src/Notification/NOTIFICATION_Consumer.cxx | 17 +- src/Notification/NOTIFICATION_Consumer.hxx | 14 +- src/Notification/NOTIFICATION_Supplier.hxx | 14 +- src/Notification/SALOME_NOTIFICATION.hxx | 47 + src/ParallelContainer/Makefile.am | 131 ++ .../Parallel_Salome_file_i.cxx | 361 ++++ .../Parallel_Salome_file_i.hxx | 76 + .../SALOME_ParallelComponent_i.cxx | 1138 ++++++++++++ .../SALOME_ParallelComponent_i.hxx | 204 +++ .../SALOME_ParallelContainerNodeDummy.cxx | 212 +++ .../SALOME_ParallelContainerNodeMpi.cxx | 254 +++ .../SALOME_ParallelContainerProxyDummy.cxx | 153 ++ .../SALOME_ParallelContainerProxyMpi.cxx | 161 ++ .../SALOME_ParallelContainerProxy_i.cxx | 43 + .../SALOME_ParallelContainerProxy_i.hxx | 44 + .../SALOME_ParallelContainer_i.cxx | 1068 +++++++++++ .../SALOME_ParallelContainer_i.hxx | 167 ++ src/Registry/Makefile.am | 3 +- src/Registry/RegistryConnexion.hxx | 16 +- src/Registry/RegistryService.cxx | 13 +- src/Registry/RegistryService.hxx | 21 +- src/Registry/SALOME_Registry.hxx | 48 + src/Registry/SALOME_Registry_Server.cxx | 9 +- src/ResourcesManager/Makefile.am | 12 +- .../SALOME_LoadRateManager.cxx | 70 +- .../SALOME_LoadRateManager.hxx | 7 +- .../SALOME_ResourcesCatalog_Handler.cxx | 522 +++--- .../SALOME_ResourcesCatalog_Handler.hxx | 38 +- .../SALOME_ResourcesCatalog_Parser.cxx | 62 +- .../SALOME_ResourcesCatalog_Parser.hxx | 14 +- .../SALOME_ResourcesManager.cxx | 673 +++++-- .../SALOME_ResourcesManager.hxx | 45 +- ...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 | 86 +- src/SALOMEDS/SALOMEDS.cdl | 59 - src/SALOMEDS/SALOMEDS.cxx | 37 +- src/SALOMEDS/SALOMEDS.hxx | 4 +- 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 | 6 +- 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 | 45 +- .../SALOMEDS_AttributeParameter_i.hxx | 4 +- .../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 | 7 +- .../SALOMEDS_AttributePythonObject_i.cxx | 10 +- .../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 | 59 + .../SALOMEDS_AttributeString.hxx} | 60 +- ...ype.jxx => SALOMEDS_AttributeString_i.cxx} | 46 +- .../SALOMEDS_AttributeString_i.hxx} | 38 +- .../SALOMEDS_AttributeStudyProperties.cxx | 70 +- .../SALOMEDS_AttributeStudyProperties.hxx | 8 +- .../SALOMEDS_AttributeStudyProperties_i.cxx | 72 +- .../SALOMEDS_AttributeStudyProperties_i.hxx | 2 +- .../SALOMEDS_AttributeTableOfInteger.cxx | 115 +- .../SALOMEDS_AttributeTableOfInteger.hxx | 2 +- .../SALOMEDS_AttributeTableOfInteger_i.cxx | 135 +- .../SALOMEDS_AttributeTableOfInteger_i.hxx | 2 +- .../SALOMEDS_AttributeTableOfReal.cxx | 113 +- .../SALOMEDS_AttributeTableOfReal.hxx | 2 +- .../SALOMEDS_AttributeTableOfReal_i.cxx | 128 +- .../SALOMEDS_AttributeTableOfReal_i.hxx | 2 +- .../SALOMEDS_AttributeTableOfString.cxx | 114 +- .../SALOMEDS_AttributeTableOfString.hxx | 2 +- .../SALOMEDS_AttributeTableOfString_i.cxx | 147 +- .../SALOMEDS_AttributeTableOfString_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTarget.cxx | 24 +- 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 | 129 +- 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 | 12 +- 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 | 7 +- src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx | 2 +- src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx | 8 +- src/SALOMEDS/SALOMEDS_Callback_i.hxx | 2 +- 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 | 6 +- src/SALOMEDS/SALOMEDS_Client.cxx | 21 +- src/SALOMEDS/SALOMEDS_ClientAttributes.hxx | 10 +- ...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_Defines.hxx | 47 + 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_Driver_i.cxx | 111 +- src/SALOMEDS/SALOMEDS_Driver_i.hxx | 88 +- 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_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_FlagsAttribute.cxx | 162 -- src/SALOMEDS/SALOMEDS_FlagsAttribute.hxx | 72 - src/SALOMEDS/SALOMEDS_GenericAttribute.cxx | 24 +- src/SALOMEDS/SALOMEDS_GenericAttribute.hxx | 6 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx | 42 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx | 16 +- 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_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_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_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 | 6 +- src/SALOMEDS/SALOMEDS_SComponent_i.cxx | 29 +- src/SALOMEDS/SALOMEDS_SComponent_i.hxx | 4 +- src/SALOMEDS/SALOMEDS_SObject.cxx | 63 +- src/SALOMEDS/SALOMEDS_SObject.hxx | 8 +- src/SALOMEDS/SALOMEDS_SObject_i.cxx | 71 +- src/SALOMEDS/SALOMEDS_SObject_i.hxx | 16 +- 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 | 15 +- src/SALOMEDS/SALOMEDS_Study.cxx | 178 +- src/SALOMEDS/SALOMEDS_Study.hxx | 10 +- src/SALOMEDS/SALOMEDS_StudyBuilder.cxx | 98 +- src/SALOMEDS/SALOMEDS_StudyBuilder.hxx | 9 +- src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx | 99 +- src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx | 13 +- src/SALOMEDS/SALOMEDS_StudyManager.cxx | 46 +- src/SALOMEDS/SALOMEDS_StudyManager.hxx | 2 +- src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 123 +- src/SALOMEDS/SALOMEDS_StudyManager_i.hxx | 23 +- .../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 | 319 ++-- src/SALOMEDS/SALOMEDS_Study_i.hxx | 30 +- 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_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 - src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx | 37 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder.hxx | 6 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx | 38 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx | 10 +- 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 | 6 +- src/SALOMEDS/SALOME_DriverPy.py | 4 +- src/SALOMEDS/Test/Makefile.am | 58 +- src/SALOMEDS/Test/SALOMEDSTest.cxx | 209 +-- src/SALOMEDS/Test/SALOMEDSTest.hxx | 151 +- .../Test/SALOMEDSTest_AttributeComment.cxx | 75 + .../Test/SALOMEDSTest_AttributeDrawable.cxx | 73 + .../Test/SALOMEDSTest_AttributeExpandable.cxx | 71 + .../SALOMEDSTest_AttributeExternalFileDef.cxx | 74 + .../Test/SALOMEDSTest_AttributeFileType.cxx | 74 + .../Test/SALOMEDSTest_AttributeFlags.cxx | 76 + .../Test/SALOMEDSTest_AttributeGraphic.cxx | 73 + .../Test/SALOMEDSTest_AttributeIOR.cxx | 69 + .../Test/SALOMEDSTest_AttributeInteger.cxx | 66 + .../Test/SALOMEDSTest_AttributeLocalID.cxx | 65 + .../Test/SALOMEDSTest_AttributeName.cxx | 73 + .../Test/SALOMEDSTest_AttributeOpened.cxx | 71 + .../Test/SALOMEDSTest_AttributeParameter.cxx | 146 ++ .../SALOMEDSTest_AttributePersistentRef.cxx | 73 + .../Test/SALOMEDSTest_AttributePixMap.cxx | 74 + .../SALOMEDSTest_AttributePythonObject.cxx | 74 + .../Test/SALOMEDSTest_AttributeReal.cxx | 65 + .../Test/SALOMEDSTest_AttributeSelectable.cxx | 71 + ...ALOMEDSTest_AttributeSequenceOfInteger.cxx | 127 ++ .../SALOMEDSTest_AttributeSequenceOfReal.cxx | 121 ++ .../SALOMEDSTest_AttributeStudyProperties.cxx | 113 ++ .../SALOMEDSTest_AttributeTableOfInteger.cxx | 190 ++ .../SALOMEDSTest_AttributeTableOfReal.cxx | 189 ++ .../SALOMEDSTest_AttributeTableOfString.cxx | 190 ++ .../Test/SALOMEDSTest_AttributeTarget.cxx | 89 + .../Test/SALOMEDSTest_AttributeTextColor.cxx | 74 + ...LOMEDSTest_AttributeTextHighlightColor.cxx | 74 + .../Test/SALOMEDSTest_AttributeTreeNode.cxx | 195 ++ .../Test/SALOMEDSTest_AttributeUserID.cxx | 70 + .../Test/SALOMEDSTest_ChildIterator.cxx | 79 + src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx | 70 + .../Test/SALOMEDSTest_SComponentIterator.cxx | 65 + src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx | 125 ++ src/SALOMEDS/Test/SALOMEDSTest_Study.cxx | 349 ++++ .../Test/SALOMEDSTest_StudyBuilder.cxx | 250 +++ .../Test/SALOMEDSTest_StudyManager.cxx | 168 ++ src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx | 149 ++ src/SALOMEDS/Test/TestSALOMEDS.cxx | 145 +- src/SALOMEDSClient/Makefile.am | 1 + src/SALOMEDSClient/SALOMEDSClient.hxx | 1 + .../SALOMEDSClient_AttributeString.hxx} | 35 +- .../SALOMEDSClient_AttributeTreeNode.hxx | 2 +- .../SALOMEDSClient_ClientFactory.hxx | 2 +- src/SALOMEDSClient/SALOMEDSClient_Study.hxx | 5 + .../SALOMEDSClient_definitions.hxx | 12 +- src/SALOMEDSImpl/Makefile.am | 23 +- .../SALOMEDSImpl_AttributeComment.cxx | 30 +- .../SALOMEDSImpl_AttributeComment.hxx | 37 +- .../SALOMEDSImpl_AttributeDrawable.cxx | 30 +- .../SALOMEDSImpl_AttributeDrawable.hxx | 40 +- .../SALOMEDSImpl_AttributeExpandable.cxx | 32 +- .../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 | 89 +- .../SALOMEDSImpl_AttributeParameter.hxx | 48 +- .../SALOMEDSImpl_AttributePersistentRef.cxx | 31 +- .../SALOMEDSImpl_AttributePersistentRef.hxx | 40 +- .../SALOMEDSImpl_AttributePixMap.cxx | 32 +- .../SALOMEDSImpl_AttributePixMap.hxx | 45 +- .../SALOMEDSImpl_AttributePythonObject.cxx | 60 +- .../SALOMEDSImpl_AttributePythonObject.hxx | 40 +- .../SALOMEDSImpl_AttributeReal.cxx | 49 +- .../SALOMEDSImpl_AttributeReal.hxx | 42 +- .../SALOMEDSImpl_AttributeReference.cxx | 50 +- .../SALOMEDSImpl_AttributeReference.hxx | 41 +- .../SALOMEDSImpl_AttributeSelectable.cxx | 33 +- .../SALOMEDSImpl_AttributeSelectable.hxx | 41 +- ...ALOMEDSImpl_AttributeSequenceOfInteger.cxx | 106 +- ...ALOMEDSImpl_AttributeSequenceOfInteger.hxx | 52 +- .../SALOMEDSImpl_AttributeSequenceOfReal.cxx | 107 +- .../SALOMEDSImpl_AttributeSequenceOfReal.hxx | 49 +- .../SALOMEDSImpl_AttributeString.cxx | 104 ++ .../SALOMEDSImpl_AttributeString.hxx | 60 + .../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 | 311 ++-- .../SALOMEDSImpl_AttributeTreeNode.hxx | 122 +- .../SALOMEDSImpl_AttributeUserID.cxx | 36 +- .../SALOMEDSImpl_AttributeUserID.hxx | 38 +- src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx | 31 +- 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 | 20 +- .../SALOMEDSImpl_OCAFApplication.cxx | 65 - 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 | 988 +++++------ src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx | 211 +-- .../SALOMEDSImpl_StudyBuilder.cxx | 574 +++--- .../SALOMEDSImpl_StudyBuilder.hxx | 88 +- src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.cxx | 39 +- src/SALOMEDSImpl/SALOMEDSImpl_StudyHandle.hxx | 38 +- .../SALOMEDSImpl_StudyManager.cxx | 683 ++++--- .../SALOMEDSImpl_StudyManager.hxx | 121 +- src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.cxx | 7 - src/SALOMEDSImpl/SALOMEDSImpl_TMPFile.hxx | 19 +- src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx | 242 ++- src/SALOMEDSImpl/SALOMEDSImpl_Tool.hxx | 25 +- .../SALOMEDSImpl_UseCaseBuilder.cxx | 239 ++- .../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 | 132 +- src/SALOMELocalTrace/BaseTraceCollector.cxx | 7 +- src/SALOMELocalTrace/BaseTraceCollector.hxx | 17 +- src/SALOMELocalTrace/FileTraceCollector.cxx | 3 +- src/SALOMELocalTrace/FileTraceCollector.hxx | 2 + src/SALOMELocalTrace/LocalTraceBufferPool.cxx | 29 +- src/SALOMELocalTrace/LocalTraceBufferPool.hxx | 4 +- src/SALOMELocalTrace/LocalTraceCollector.cxx | 4 +- src/SALOMELocalTrace/LocalTraceCollector.hxx | 2 + src/SALOMELocalTrace/Makefile.am | 6 +- src/SALOMELocalTrace/SALOME_LocalTrace.hxx | 48 + .../Test/TestSALOMELocalTrace.py | 5 +- src/SALOMELocalTrace/utilities.h | 8 +- .../SALOMETraceCollector.cxx | 8 +- .../SALOMETraceCollector.hxx | 18 +- .../TraceCollector_WaitForServerReadiness.hxx | 2 +- src/TOOLSDS/Makefile.am | 4 +- src/TOOLSDS/SALOMEDS_Tool.cxx | 218 ++- src/TOOLSDS/SALOMEDS_Tool.hxx | 19 +- src/TestContainer/Makefile.am | 6 +- src/TestContainer/SALOME_TestComponent_i.cxx | 12 +- src/TestContainer/SALOME_TestComponent_i.hxx | 4 +- src/TestContainer/TestComponentPy.py | 4 +- src/TestContainer/TestContainer.cxx | 4 +- src/UnitTests/UnitTests.py | 13 +- src/Utils/Makefile.am | 5 +- src/Utils/OpUtil.hxx | 14 +- .../SALOME_Utils.hxx} | 23 +- src/Utils/SALOME_utilities.py | 12 +- src/Utils/SalomeString.hxx | 4 +- src/Utils/Test/Makefile.am | 2 +- src/Utils/Utils_CommException.hxx | 4 +- src/Utils/Utils_CorbaException.hxx | 2 + src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx | 38 +- src/Utils/Utils_ExceptHandlers.hxx | 16 +- src/Utils/Utils_Identity.cxx | 47 +- src/Utils/Utils_Identity.hxx | 15 +- src/Utils/Utils_Identity.py | 18 +- src/Utils/Utils_Mutex.hxx | 16 +- src/Utils/Utils_ORB_INIT.cxx | 18 +- src/Utils/Utils_ORB_INIT.hxx | 19 +- src/Utils/Utils_SALOME_Exception.hxx | 24 +- src/Utils/Utils_SINGLETON.hxx | 2 + src/Utils/Utils_SignalsHandler.h | 50 + src/Utils/Utils_Timer.hxx | 4 +- 925 files changed, 50616 insertions(+), 28559 deletions(-) create mode 100644 bin/appli_gen.py create mode 100755 bin/appliskel/getAppliPath.py delete mode 100755 bin/appliskel/setAppliPath.sh create mode 100644 bin/config_appli.xml create mode 100755 bin/launchSalome.py create mode 100755 bin/nameserver.py create mode 100755 bin/runNS.py create mode 100755 bin/server.py create mode 100755 bin/setenv.py 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/README.cluster-CCRT 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 delete mode 100644 doc/salome/version.texi create mode 100644 idl/Calcium_Ports.idl create mode 100644 idl/DSC_Engines.idl create mode 100644 idl/DSC_Engines.xml create mode 100644 idl/Palm_Ports.idl create mode 100644 idl/SALOME_Component.xml create mode 100644 idl/SALOME_Exception.xml create mode 100644 idl/SALOME_Ports.idl create mode 100644 idl/SALOME_Ports.xml create mode 100644 salome_adm/unix/Doxyfile create mode 100644 salome_adm/unix/F77config.h.in create mode 100644 salome_adm/unix/config_files/ac_cc_warnings.m4 create mode 100644 salome_adm/unix/config_files/check_Salome.m4 create mode 100644 salome_adm/unix/config_files/check_java.m4 create mode 100644 salome_adm/unix/config_files/check_libxml.m4 delete mode 100644 salome_adm/unix/config_files/check_opengl.m4 create mode 100644 salome_adm/unix/config_files/check_openmpi.m4 create mode 100644 salome_adm/unix/config_files/check_paco++.m4 delete mode 100644 salome_adm/unix/config_files/check_qt.m4 delete mode 100644 salome_adm/unix/pythonbe.py create mode 100644 salome_adm/unix/sstream.in 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 rename src/{SALOMEDS/SALOMEDS_TextHighlightColorAttribute.jxx => Communication/SALOME_Communication.hxx} (60%) mode change 100644 => 100755 rename src/{SALOMEDS/SALOMEDS_TextColorAttribute.jxx => Container/SALOME_Container.hxx} (61%) mode change 100644 => 100755 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_Basic/ConnectionManager_i.cxx create mode 100644 src/DSC/DSC_Basic/ConnectionManager_i.hxx rename src/{SALOMEDS/SALOMEDS_TargetAttribute.jxx => DSC/DSC_Basic/DSC_Basic.hxx} (59%) mode change 100644 => 100755 create mode 100644 src/DSC/DSC_Basic/DSC_Callbacks.hxx create mode 100644 src/DSC/DSC_Basic/DSC_i.cxx create mode 100644 src/DSC/DSC_Basic/DSC_i.hxx create mode 100644 src/DSC/DSC_Basic/DSC_interface.cxx create mode 100644 src/DSC/DSC_Basic/DSC_interface.hxx create mode 100644 src/DSC/DSC_Basic/Makefile.am rename src/{SALOMEDS/SALOMEDS_LocalIDAttribute.jxx => DSC/DSC_Basic/PortProperties_i.cxx} (60%) create mode 100644 src/DSC/DSC_Basic/PortProperties_i.hxx create mode 100644 src/DSC/DSC_Basic/SALOME_ConnectionManagerServer.cxx 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/Basic/Makefile.am rename src/{SALOMEDS/SALOMEDS_DrawableAttribute.jxx => DSC/DSC_User/Basic/basic_port_factory.cxx} (56%) create mode 100644 src/DSC/DSC_User/Basic/basic_port_factory.hxx create mode 100644 src/DSC/DSC_User/Basic/data_short_port_provides.cxx create mode 100644 src/DSC/DSC_User/Basic/data_short_port_provides.hxx create mode 100644 src/DSC/DSC_User/Basic/data_short_port_uses.cxx create mode 100644 src/DSC/DSC_User/Basic/data_short_port_uses.hxx create mode 100644 src/DSC/DSC_User/DSC_Exception.hxx create mode 100644 src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx create mode 100644 src/DSC/DSC_User/Datastream/AdjacentPredicate.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/Calcium.c 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/CalciumCouplingPolicy.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumException.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumGenericUsesPort.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumTypes.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.hxx rename src/{SALOMEDS/SALOMEDS_IORAttribute.jxx => DSC/DSC_User/Datastream/Calcium/CalciumTypesManipulator.hxx} (53%) create mode 100644 src/DSC/DSC_User/Datastream/Calcium/Copy2CorbaSpace.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/Copy2UserSpace.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/Makefile.am create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium.h create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium.hf create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calciumP.h create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_complex_port_uses.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_destructors_port_uses.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_double_port_uses.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_logical_port_uses.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_real_port_uses.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_repository_types.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_string_port_uses.hxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_uses_port.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calcium_uses_port.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/Datastream/Calcium/testInterpolation.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/test_CalciumInterface.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/test_DataIdContainer.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/version.h create mode 100644 src/DSC/DSC_User/Datastream/ConstTraits.hxx create mode 100644 src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx create mode 100644 src/DSC/DSC_User/Datastream/CouplingPolicy.hxx create mode 100644 src/DSC/DSC_User/Datastream/DataIdFilter.hxx create mode 100644 src/DSC/DSC_User/Datastream/DisplayPair.hxx create mode 100644 src/DSC/DSC_User/Datastream/FindKeyPredicate.hxx create mode 100644 src/DSC/DSC_User/Datastream/GenericPort.hxx create mode 100644 src/DSC/DSC_User/Datastream/GenericProvidesPort.hxx create mode 100644 src/DSC/DSC_User/Datastream/GenericUsesPort.hxx create mode 100644 src/DSC/DSC_User/Datastream/IteratorTraits.hxx create mode 100644 src/DSC/DSC_User/Datastream/Makefile.am create mode 100644 src/DSC/DSC_User/Datastream/Palm/Makefile.am create mode 100644 src/DSC/DSC_User/Datastream/Palm/PalmCouplingPolicy.hxx create mode 100644 src/DSC/DSC_User/Datastream/Palm/palm_data_seq_short_port_provides.hxx create mode 100644 src/DSC/DSC_User/Datastream/Palm/palm_data_short_port_provides.hxx create mode 100644 src/DSC/DSC_User/Datastream/Palm/palm_port_factory.cxx create mode 100644 src/DSC/DSC_User/Datastream/Palm/palm_port_factory.hxx create mode 100644 src/DSC/DSC_User/Datastream/Palm/test_DataIdContainer.cxx create mode 100644 src/DSC/DSC_User/Datastream/ProcessTimeIntervalTraits.hxx create mode 100644 src/DSC/DSC_User/Datastream/fake.cc create mode 100644 src/DSC/DSC_User/Datastream/testAdjacentFunctor.cxx create mode 100644 src/DSC/DSC_User/Datastream/testAdjacentPredicate.cxx create mode 100644 src/DSC/DSC_User/Makefile.am create mode 100644 src/DSC/DSC_User/Superv_Component_i.cxx create mode 100644 src/DSC/DSC_User/Superv_Component_i.hxx create mode 100644 src/DSC/DSC_User/base_port.cxx rename src/{SALOMEDS/SALOMEDS_ExpandableAttribute.jxx => DSC/DSC_User/base_port.hxx} (57%) create mode 100644 src/DSC/DSC_User/port_factory.hxx create mode 100644 src/DSC/DSC_User/provides_port.cxx create mode 100644 src/DSC/DSC_User/provides_port.hxx create mode 100644 src/DSC/DSC_User/test_DSC_Exception.cxx create mode 100644 src/DSC/DSC_User/uses_port.cxx create mode 100644 src/DSC/DSC_User/uses_port.hxx create mode 100644 src/DSC/Makefile.am create mode 100644 src/DSC/ParallelDSC/Makefile.am create mode 100644 src/DSC/ParallelDSC/ParallelDSC_i.cxx create mode 100644 src/DSC/ParallelDSC/ParallelDSC_i.hxx rename src/{SALOMEDS/SALOMEDS_OpenedAttribute.jxx => HDFPersist/HDFexport.hxx} (55%) create mode 100644 src/Launcher/BatchLight_BatchManager.cxx create mode 100644 src/Launcher/BatchLight_BatchManager.hxx create mode 100644 src/Launcher/BatchLight_BatchManager_PBS.cxx create mode 100644 src/Launcher/BatchLight_BatchManager_PBS.hxx create mode 100644 src/Launcher/BatchLight_BatchManager_SLURM.cxx create mode 100644 src/Launcher/BatchLight_BatchManager_SLURM.hxx create mode 100644 src/Launcher/BatchLight_Job.cxx create mode 100644 src/Launcher/BatchLight_Job.hxx create mode 100644 src/Launcher/Makefile.am create mode 100644 src/Launcher/MpiImpl.cxx create mode 100644 src/Launcher/MpiImpl.hxx 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%) create mode 100644 src/LifeCycleCORBA/TestContainerManager.cxx create mode 100755 src/ModuleCatalog/SALOME_ModuleCatalog.hxx create mode 100755 src/ModuleCatalog/TestModuleCatalog.py create mode 100755 src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx create mode 100755 src/Notification/SALOME_NOTIFICATION.hxx create mode 100644 src/ParallelContainer/Makefile.am create mode 100644 src/ParallelContainer/Parallel_Salome_file_i.cxx create mode 100644 src/ParallelContainer/Parallel_Salome_file_i.hxx create mode 100644 src/ParallelContainer/SALOME_ParallelComponent_i.cxx create mode 100644 src/ParallelContainer/SALOME_ParallelComponent_i.hxx create mode 100644 src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx create mode 100644 src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx create mode 100644 src/ParallelContainer/SALOME_ParallelContainerProxyDummy.cxx create mode 100644 src/ParallelContainer/SALOME_ParallelContainerProxyMpi.cxx create mode 100644 src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx create mode 100644 src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx create mode 100644 src/ParallelContainer/SALOME_ParallelContainer_i.cxx create mode 100644 src/ParallelContainer/SALOME_ParallelContainer_i.hxx create mode 100755 src/Registry/SALOME_Registry.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 create mode 100644 src/SALOMEDS/SALOMEDS_AttributeString.cxx rename src/{CASCatch/CASCatch.hxx => SALOMEDS/SALOMEDS_AttributeString.hxx} (53%) rename src/SALOMEDS/{SALOMEDS_FileType.jxx => SALOMEDS_AttributeString_i.cxx} (59%) rename src/{SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx => SALOMEDS/SALOMEDS_AttributeString_i.hxx} (56%) 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 create mode 100755 src/SALOMEDS/SALOMEDS_Defines.hxx 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_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_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_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_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_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_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_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 create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeComment.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeDrawable.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeExternalFileDef.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeFileType.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeFlags.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeGraphic.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeIOR.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeInteger.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeLocalID.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeName.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeOpened.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeParameter.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributePersistentRef.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributePixMap.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributePythonObject.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeReal.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfReal.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeStudyProperties.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfInteger.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfString.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTarget.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTextHighlightColor.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_SComponentIterator.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_Study.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx create mode 100755 src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx rename src/{SALOMEDS/SALOMEDS_ExternalFileDef.jxx => SALOMEDSClient/SALOMEDSClient_AttributeString.hxx} (64%) create mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx create mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx delete mode 100644 src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.cxx create mode 100755 src/SALOMELocalTrace/SALOME_LocalTrace.hxx rename src/{SALOMEDS/SALOMEDS_OCAFApplication.jxx => Utils/SALOME_Utils.hxx} (69%) mode change 100644 => 100755 create mode 100644 src/Utils/Utils_SignalsHandler.h diff --git a/COPYING b/COPYING index d60c31a97..b1e3f5a26 100644 --- a/COPYING +++ b/COPYING @@ -1,221 +1,397 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. + Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. The precise terms and conditions for copying, distribution and -modification follow. +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. - GNU GENERAL PUBLIC LICENSE + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - a) You must cause the modified files to carry prominent notices + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, +identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of +on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. +entire whole, and thus to each and every part regardless of who wrote +it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or -collective works based on the Program. +collective works based on the Library. -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are +distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying -the Program or works based on it. +the Library or works based on it. - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to +You are not responsible for enforcing compliance by third parties with this License. - - 7. If, as a consequence of a court judgment or allegation of patent + + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. +refrain entirely from distribution of the Library. -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is +integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that @@ -225,116 +401,104 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in + + 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. NO WARRANTY - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Libraries - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. - + Copyright (C) - 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 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, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + 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 General Public License for more details. + 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 General Public License - along with this program; if not, write to the Free Software + 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 - Also add information on how to contact you by electronic and paper mail. -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if +school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. - , 1 April 1989 + , 1 April 1990 Ty Coon, President of Vice -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. +That's all there is to it! + + diff --git a/DEPRECATED/configure.in.base b/DEPRECATED/configure.in.base index 1567a6394..58c19e522 100644 --- a/DEPRECATED/configure.in.base +++ b/DEPRECATED/configure.in.base @@ -22,11 +22,15 @@ AC_CANONICAL_HOST PACKAGE=salome AC_SUBST(PACKAGE) -VERSION=3.2.0 +VERSION=3.2.1 AC_SUBST(VERSION) -XVERSION=0x030200 +XVERSION=0x030201 AC_SUBST(XVERSION) +# set up MODULE_NAME variable for dynamic construction of directories (resources, etc.) +MODULE_NAME=kernel +AC_SUBST(MODULE_NAME) + dnl dnl Initialize source and build root directories dnl @@ -412,8 +416,7 @@ else fi # make other build directories -for rep in salome_adm adm_local doc bin/salome include/salome lib${LIB_LOCATION_SUFFIX}/salome share/salome/resources idl -do +for rep in salome_adm adm_local doc bin/salome include/salome lib${LIB_LOCATION_SUFFIX}/salome share/salome/resources/${MODULE_NAME} idl # if test ! -d $rep ; then # eval mkdir $rep # fi diff --git a/Makefile.am b/Makefile.am index 7b025f034..63730a5e5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,6 +28,8 @@ if CORBA_GEN IDLDIR = idl endif +ACLOCAL_AMFLAGS = -I salome_adm/unix/config_files + SUBDIRS = $(IDLDIR) salome_adm src doc bin resources DIST_SUBDIRS= idl salome_adm src doc bin resources @@ -52,4 +54,4 @@ usr_docs: docs:usr_docs dev_docs: - (cd doc && $(MAKE) $(AM_MAKEFLAGS) dev_docs) \ No newline at end of file + (cd doc && $(MAKE) $(AM_MAKEFLAGS) dev_docs) diff --git a/bin/Makefile.am b/bin/Makefile.am index 2120709f6..b8086e529 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -51,31 +51,44 @@ dist_salomescript_SCRIPTS=\ createAppli.sh \ appli_install.sh \ appli_clean.sh \ + appli_gen.py \ virtual_salome.py \ + config_appli.xml \ launchConfigureParser.py \ showNS.py \ addToKillList.py \ - NSparam.py + NSparam.py \ + setenv.py \ + launchSalome.py \ + nameserver.py \ + server.py \ + waitNS.sh \ + waitNS.py \ + waitContainers.py \ + shutdownSalome.py EXTRA_DIST = appliskel dist-hook: rm -rf `find $(distdir)/appliskel -name CVS` -DISTCLEANFILES = $(top_builddir)/bin/@PACKAGE@/Makefile.am +DISTCLEANFILES = $(top_builddir)/bin/salome/Makefile.am clean-local: - rm -rf $(top_builddir)/bin/@PACKAGE@/appliskel - cd $(top_builddir)/bin/@PACKAGE@; \ + rm -rf $(top_builddir)/bin/salome/appliskel + cd $(top_builddir)/bin/salome; \ rm -f $(dist_salomescript_DATA) $(dist_salomescript_SCRIPTS) # This is an ugly target to avoid exploring the appliskel subdirectory. install-exec-local: - $(INSTALL) -d $(salomescriptdir) - $(RM) -rf $(salomescriptdir)/appliskel 1> /dev/null 2>&1 - cp -r $(srcdir)/appliskel $(salomescriptdir) - find $(salomescriptdir) -name CVS -prune -exec rm -rf {} \; + $(INSTALL) -d $(DESTDIR)$(salomescriptdir) + $(RM) -rf $(DESTDIR)$(salomescriptdir)/appliskel 1> /dev/null 2>&1 + cp -r $(srcdir)/appliskel $(DESTDIR)$(salomescriptdir) + find $(DESTDIR)$(salomescriptdir) -name CVS -prune -exec rm -rf {} \; uninstall-local: - find $(salomescriptdir)/appliskel -exec chmod +w {} \; - rm -rf $(salomescriptdir)/appliskel + if test -d $(DESTDIR)$(salomescriptdir)/appliskel; then \ + find $(DESTDIR)$(salomescriptdir)/appliskel -exec chmod +w {} ';' ; \ + rm -rf $(DESTDIR)$(salomescriptdir)/appliskel; \ + fi; + 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 390ac2aaa..537dfaf3d 100755 --- a/bin/addToKillList.py +++ b/bin/addToKillList.py @@ -20,6 +20,7 @@ # import os, sys, pickle, string, signal +from launchConfigureParser import verbose ########## adds to the kill list of SALOME one more process ########## @@ -43,7 +44,7 @@ def findFileDict(): except: pass pass - print "myport = ", my_port + if verbose(): print "myport = ", my_port return my_port def addToKillList(command_pid, command): @@ -60,11 +61,11 @@ def addToKillList(command_pid, command): already_in=0 for process_id in process_ids: - print process_id + 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 @@ -72,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(): @@ -111,5 +112,5 @@ def killList(): if __name__ == "__main__": - print sys.argv + if verbose(): print sys.argv addToKillList(sys.argv[1], sys.argv[2]) diff --git a/bin/appli_clean.sh b/bin/appli_clean.sh index c8cadf964..169a56622 100644 --- a/bin/appli_clean.sh +++ b/bin/appli_clean.sh @@ -20,4 +20,4 @@ # #clean appli -rm -rf bin lib share doc envd setAppliPath.sh searchFreePort.sh runAppli runConsole runSession env.d +rm -rf bin lib share doc env.d envd getAppliPath.py searchFreePort.sh runAppli runConsole runSession runRemote.sh runTests SalomeApp.xml *.pyc *~ .bashrc diff --git a/bin/appli_gen.py b/bin/appli_gen.py new file mode 100644 index 000000000..1ce244aca --- /dev/null +++ b/bin/appli_gen.py @@ -0,0 +1,258 @@ +#!/usr/bin/env python +"""Create a virtual Salome installation + +""" +usage="""usage: %prog [options] +Typical use is: + python appli_gen.py +Use with options: + python appli_gen.py --prefix= --config= +""" + +import os, glob, string, sys, re +import xml.sax +import optparse +import virtual_salome + +# --- names of tags in XML configuration file +appli_tag = "application" +prereq_tag = "prerequisites" +modules_tag = "modules" +module_tag = "module" +samples_tag = "samples" + +# --- names of attributes in XML configuration file +nam_att = "name" +path_att = "path" +gui_att = "gui" + +# ----------------------------------------------------------------------------- + +# --- xml reader for SALOME application configuration file + +class xml_parser: + def __init__(self, fileName ): + print "Configure parser: processing %s ..." % fileName + self.space = [] + self.config = {} + self.config["modules"] = [] + self.config["guimodules"] = [] + parser = xml.sax.make_parser() + parser.setContentHandler(self) + parser.parse(fileName) + pass + + def boolValue( self, str ): + if str in ("yes", "y", "1"): + return 1 + elif str in ("no", "n", "0"): + return 0 + else: + return str + pass + + def startElement(self, name, attrs): + self.space.append(name) + self.current = None + # --- if we are analyzing "prerequisites" element then store its "path" attribute + if self.space == [appli_tag, prereq_tag] and path_att in attrs.getNames(): + self.config["prereq_path"] = attrs.getValue( path_att ) + pass + # --- if we are analyzing "samples" element then store its "path" attribute + if self.space == [appli_tag, samples_tag] and path_att in attrs.getNames(): + self.config["samples_path"] = attrs.getValue( path_att ) + pass + # --- if we are analyzing "module" element then store its "name" and "path" attributes + elif self.space == [appli_tag,modules_tag,module_tag] and \ + nam_att in attrs.getNames() and \ + path_att in attrs.getNames(): + nam = attrs.getValue( nam_att ) + path = attrs.getValue( path_att ) + gui = 1 + if gui_att in attrs.getNames(): + gui = self.boolValue(attrs.getValue( gui_att )) + pass + self.config["modules"].append(nam) + self.config[nam]=path + if gui: + self.config["guimodules"].append(nam) + pass + pass + pass + + def endElement(self, name): + p = self.space.pop() + self.current = None + pass + + def characters(self, content): + pass + + def processingInstruction(self, target, data): + pass + + def setDocumentLocator(self, locator): + pass + + def startDocument(self): + self.read = None + pass + + def endDocument(self): + self.read = None + pass + +# ----------------------------------------------------------------------------- + +class params: + pass + +# ----------------------------------------------------------------------------- + +def install(prefix,config_file): + home_dir=os.path.abspath(os.path.expanduser(prefix)) + filename=os.path.abspath(os.path.expanduser(config_file)) + _config={} + try: + p = xml_parser(filename) + _config = p.config + except xml.sax.SAXParseException, inst: + print inst.getMessage() + print "Configure parser: parse error in configuration file %s" % filename + pass + except xml.sax.SAXException, inst: + print inst.args + print "Configure parser: error in configuration file %s" % filename + pass + except: + print "Configure parser: Error : can not read configuration file %s, check existence and rights" % filename + pass + + for cle in _config.keys(): + print cle, _config[cle] + pass + + for module in _config["modules"]: + print "--- add module ", module, _config[module] + options = params() + options.verbose=0 + options.clear=0 + options.prefix=home_dir + options.module=_config[module] + virtual_salome.link_module(options) + pass + + appliskel_dir=os.path.join(home_dir,'bin','salome','appliskel') + + for fn in ('envd', + 'getAppliPath.py', + 'searchFreePort.sh', + 'runRemote.sh', + 'runAppli', + 'runConsole', + 'runSession', + 'runTests', + '.bashrc', + ): + virtual_salome.symlink("./bin/salome/appliskel/"+fn,os.path.join(home_dir, fn)) + pass + + if filename != os.path.join(home_dir,"config_appli.xml"): + command = "cp -p " + filename + ' ' + os.path.join(home_dir,"config_appli.xml") + os.system(command) + pass + + virtual_salome.mkdir(os.path.join(home_dir,'env.d')) + if os.path.isfile(_config["prereq_path"]): + command='cp -p ' + _config["prereq_path"] + ' ' + os.path.join(home_dir,'env.d','envProducts.sh') + os.system(command) + pass + else: + print "WARNING: prerequisite file does not exist" + pass + + + f =open(os.path.join(home_dir,'env.d','configSalome.sh'),'w') + for module in _config["modules"]: + command='export '+ module + '_ROOT_DIR=${HOME}/${APPLI}\n' + f.write(command) + pass + if _config.has_key("samples_path"): + command='export DATA_DIR=' + _config["samples_path"] +'\n' + f.write(command) + pass + f.close() + + + f =open(os.path.join(home_dir,'env.d','configGUI.sh'),'w') + command = 'export SalomeAppConfig=${HOME}/${APPLI}\n' + f.write(command) + command = 'export SUITRoot=${HOME}/${APPLI}/share/salome\n' + f.write(command) + f.write('export DISABLE_FPE=1\n') + f.write('export MMGT_REENTRANT=1\n') + f.close() + + + f =open(os.path.join(home_dir,'SalomeApp.xml'),'w') + command=""" +
+ + + + + + + + + + + + 0: + f.write(_config["guimodules"][-1]) + f.write('"/>') + command=""" + + + +
+
+""" + f.write(command) + f.close() + + #Add default CatalogResources.xml file + f =open(os.path.join(home_dir,'CatalogResources.xml'),'w') + command=""" + + + +""" + f.write(command) + f.close() + +def main(): + parser = optparse.OptionParser(usage=usage) + + parser.add_option('--prefix', dest="prefix", default='.', + help="Installation directory (default .)") + + parser.add_option('--config', dest="config", default='config_appli.xml', + help="XML configuration file (default config_appli.xml)") + + options, args = parser.parse_args() + install(prefix=options.prefix,config_file=options.config) + pass + +# ----------------------------------------------------------------------------- + +if __name__ == '__main__': + main() + pass diff --git a/bin/appli_install.sh b/bin/appli_install.sh index 3e7c53f70..5e0dc418a 100644 --- a/bin/appli_install.sh +++ b/bin/appli_install.sh @@ -25,13 +25,13 @@ INSTALL_ROOT=${SALOME_ROOT}/Install APPLI_ROOT=`pwd` # --- clean appli -rm -rf bin lib share doc envd setAppliPath.sh searchFreePort.sh runAppli runConsole runSession env.d +rm -rf bin lib share doc envd getAppliPath.py searchFreePort.sh runAppli runConsole runSession env.d # --- install appli mkdir -p env.d ln -fs bin/salome/appliskel/envd . -ln -fs bin/salome/appliskel/setAppliPath.sh . +ln -fs bin/salome/appliskel/getAppliPath.py . ln -fs bin/salome/appliskel/searchFreePort.sh . ln -fs bin/salome/appliskel/runRemote.sh . ln -fs bin/salome/appliskel/runAppli . @@ -78,8 +78,7 @@ echo "export PYHELLO_ROOT_DIR=$APPLI_ROOT" >> env.d/configSalome.sh # --- GUI config -echo "export config_var=$APPLI_ROOT:$APPLI_ROOT/share/salome/resources" >> env.d/configGUI.sh -echo "export SUITRoot=$APPLI_ROOT/share/salome" >> env.d/configGUI.sh +echo "export config_var=$APPLI_ROOT:$APPLI_ROOT/share/salome/resources/gui" >> env.d/configGUI.sh # --- SAMPLES directory diff --git a/bin/appliskel/CatalogResources.xml b/bin/appliskel/CatalogResources.xml index 8caed2bfb..9e09ed5fc 100644 --- a/bin/appliskel/CatalogResources.xml +++ b/bin/appliskel/CatalogResources.xml @@ -1,28 +1,4 @@ - - - - - + diff --git a/bin/appliskel/README b/bin/appliskel/README index f3f283cb8..21ee467ac 100644 --- a/bin/appliskel/README +++ b/bin/appliskel/README @@ -57,7 +57,7 @@ SALOME internal run scripts envd Sets SALOME application environment, envd is sourced by other scripts. -setAppliPath.sh +getAppliPath.py Used by other scripts to define the Application Path. searchFreePort.sh @@ -90,7 +90,7 @@ CatalogRessources.xml SalomeApp.xml This file is similar to the default given - in ${GUI_ROOT_DIR}/share/salome/resources + in ${GUI_ROOT_DIR}/share/salome/resources/gui Proposal for env.d scripts diff --git a/bin/appliskel/SalomeApp.xml b/bin/appliskel/SalomeApp.xml index 6897b7136..7caea4e03 100644 --- a/bin/appliskel/SalomeApp.xml +++ b/bin/appliskel/SalomeApp.xml @@ -26,28 +26,28 @@
- - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + +
diff --git a/bin/appliskel/env.d/envSalome.sh b/bin/appliskel/env.d/envSalome.sh index 5a6c6c48e..ca620c35e 100644 --- a/bin/appliskel/env.d/envSalome.sh +++ b/bin/appliskel/env.d/envSalome.sh @@ -29,9 +29,8 @@ REPINST=/home/prascle/SALOME2/Install export KERNEL_ROOT_DIR=${REPINST}/KERNEL_V301 export GUI_ROOT_DIR=${REPINST}/GUI_V301 -#export SalomeAppConfig=${GUI_ROOT_DIR}/share/salome/resources +#export SalomeAppConfig=${GUI_ROOT_DIR}/share/salome/resources/gui export SalomeAppConfig=${HOME}/${APPLI} -export SUITRoot=${GUI_ROOT_DIR}/share/salome export GEOM_ROOT_DIR=${REPINST}/GEOM_V301 export MED_ROOT_DIR=${REPINST}/MED_V301 diff --git a/bin/appliskel/getAppliPath.py b/bin/appliskel/getAppliPath.py new file mode 100755 index 000000000..bac311da7 --- /dev/null +++ b/bin/appliskel/getAppliPath.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +import os + +def relpath(target, base): + """ Find relative path from base to target + if target== "/local/chris/appli" and base== "/local/chris" the result is appli + if target== /tmp/appli and base /local/chris the result is ../../tmp/appli + """ + target=target.split(os.path.sep) + base=base.split(os.path.sep) + for i in xrange(len(base)): + if base[i] != target[i]: + i=i-1 + #not in base + break + p=['..']*(len(base)-i-1)+target[i+1:] + if p == []: + return '.' + return os.path.join( *p ) + +def set_var(VAR, strpath): + """Set VAR environment variable """ + value = "%r" % strpath + shell = os.getenv('SHELL') + if shell and shell.endswith('csh'): + return "setenv %s %s" % (VAR, value) + else: + return "export %s=%s" % (VAR, value) + + +applipath=relpath(os.path.abspath(os.path.dirname(__file__)),os.path.abspath(os.getenv('HOME'))) + +#print set_var('APPLI', applipath) +print applipath diff --git a/bin/appliskel/killCurrentPort b/bin/appliskel/killCurrentPort index 5d0a547cc..c9f1e6c9d 100755 --- a/bin/appliskel/killCurrentPort +++ b/bin/appliskel/killCurrentPort @@ -2,7 +2,8 @@ # --- retrieve APPLI path, relative to $HOME, set ${APPLI} -. `dirname $0`/setAppliPath.sh +APPLI_HOME=`dirname $0` +export APPLI=`${APPLI_HOME}/getAppliPath.py` # --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) @@ -10,11 +11,10 @@ # --- find omniORB configuration relative to current session if any -myhost=`hostname` -fileOmniConfig=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg +fileOmniConfig=${HOME}/${APPLI}/.omniORB_last.cfg if [ -f $fileOmniConfig ]; then - OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg + OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_last.cfg export OMNIORB_CONFIG fi @@ -22,7 +22,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 e28e9c9d4..a18114dd6 100755 --- a/bin/appliskel/runAppli +++ b/bin/appliskel/runAppli @@ -4,30 +4,25 @@ APPLI_HOME=`dirname $0` # --- retrieve APPLI path, relative to $HOME, set ${APPLI} -. ${APPLI_HOME}/setAppliPath.sh +export APPLI=`${APPLI_HOME}/getAppliPath.py` # --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) . ${HOME}/${APPLI}/envd ${HOME}/${APPLI} -# --- define port for CORBA naming service - -. ${HOME}/${APPLI}/searchFreePort.sh -searchFreePort - # --- if mpi lam, start lam (seems safe to be done several times) -# arret manuel avec lamhalt +# (manual stop with lamhalt) if [ "$LAMBHOST" ]; then lamboot fi # --- run SALOME -# (default arguments defined in local salome.launch could be completed +# (default arguments defined in local SalomeApp.xml could be completed # 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/runConsole b/bin/appliskel/runConsole index c94a02fcf..73f5f5f88 100755 --- a/bin/appliskel/runConsole +++ b/bin/appliskel/runConsole @@ -4,7 +4,7 @@ APPLI_HOME=`dirname $0` # --- retrieve APPLI path, relative to $HOME, set ${APPLI} -. ${APPLI_HOME}/setAppliPath.sh +export APPLI=`${APPLI_HOME}/getAppliPath.py` # --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) diff --git a/bin/appliskel/runRemote.sh b/bin/appliskel/runRemote.sh index 3cbfbf55c..522b6ddd7 100755 --- a/bin/appliskel/runRemote.sh +++ b/bin/appliskel/runRemote.sh @@ -37,12 +37,14 @@ # $0 : ${APPLI}/runRemote.sh: from arg name, rebuild and export $APPLI variable # $1 : computer name for CORBA name service (where SALOME was launched) # $2 : port for CORBA name service -# $3 and following : local command to execute, with args +# $3 : working directory +# $4 and following : local command to execute, with args # # --- retrieve APPLI path, relative to $HOME, set ${APPLI} -. `dirname $0`/setAppliPath.sh +APPLI_HOME=`dirname $0` +export APPLI=`${APPLI_HOME}/getAppliPath.py` # --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) @@ -59,8 +61,35 @@ export NSPORT initref="NameService=corbaname::"$1":$2" echo "ORBInitRef $initref" > $OMNIORB_CONFIG +#go to the requested working directory if any +if test "x$3" != x; then + if test "x$3" = "x\$TEMPDIR"; then + #create a temp working dir and change to it + WDIR=`mktemp -d` && { + cd $WDIR + } + else + if test -d $3; then + #the dir exists, go to it + cd $3 + else + if test -a $3; then + # It's a file do nothing + echo $3 "is an existing file. Can't use it as a working directory" + else + #It does not exists, create it + mkdir -p $3 && { + cd $3 + } + fi + fi + fi +fi + # --- execute the command in the SALOME environment -shift 2 +shift 3 -${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/appliskel/runSession b/bin/appliskel/runSession index 69573bf10..446ee605a 100755 --- a/bin/appliskel/runSession +++ b/bin/appliskel/runSession @@ -9,7 +9,7 @@ APPLI_HOME=`dirname $0` # --- retrieve APPLI path, relative to $HOME, set ${APPLI} -. ${APPLI_HOME}/setAppliPath.sh +export APPLI=`${APPLI_HOME}/getAppliPath.py` # --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) @@ -17,11 +17,10 @@ APPLI_HOME=`dirname $0` # --- set omniORB configuration to current session if any -myhost=`hostname` -fileOmniConfig=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg +fileOmniConfig=${HOME}/${APPLI}/.omniORB_last.cfg if [ -f $fileOmniConfig ]; then - OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg + OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_last.cfg export OMNIORB_CONFIG # --- set environment variables for port and hostname of NamingService diff --git a/bin/appliskel/runTests b/bin/appliskel/runTests index e98c1e6aa..4eb9b6dba 100755 --- a/bin/appliskel/runTests +++ b/bin/appliskel/runTests @@ -2,7 +2,8 @@ # --- retrieve APPLI path, relative to $HOME, set ${APPLI} -. `dirname $0`/setAppliPath.sh +APPLI_HOME=`dirname $0` +export APPLI=`${APPLI_HOME}/getAppliPath.py` # --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...) diff --git a/bin/appliskel/searchFreePort.sh b/bin/appliskel/searchFreePort.sh index d63804500..a45eb4dea 100755 --- a/bin/appliskel/searchFreePort.sh +++ b/bin/appliskel/searchFreePort.sh @@ -41,7 +41,7 @@ searchFreePort() { local initref="NameService=corbaname::"`hostname`":$NSPORT" #echo "ORBInitRef $initref" > $OMNIORB_CONFIG echo "InitRef = $initref" > $OMNIORB_CONFIG - LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_${myhost}_last.cfg + LAST_RUNNING_CONFIG=${HOME}/${APPLI}/.omniORB_last.cfg export LAST_RUNNING_CONFIG rm ${LAST_RUNNING_CONFIG} ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG} diff --git a/bin/appliskel/setAppliPath.sh b/bin/appliskel/setAppliPath.sh deleted file mode 100755 index ccbd6b86a..000000000 --- a/bin/appliskel/setAppliPath.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# 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 -# - -# --- retrieve APPLI path, relative to $HOME, set ${APPLI} -# on sarge, "which" gives not allways the absolute path... - -comName=`which $0` -aa=${comName:0:1} -if test x$aa == x\/; then - mycom=${comName} -elif test x$aa == x\.; then - mycom=${PWD}/${comName:2} -else - mycom=${PWD}/${comName} -fi -APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '` -#echo $APPLI -export APPLI diff --git a/bin/config_appli.xml b/bin/config_appli.xml new file mode 100644 index 000000000..bd7799353 --- /dev/null +++ b/bin/config_appli.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/bin/envSalome.py b/bin/envSalome.py index 744ba08cb..1d0d61cb6 100755 --- a/bin/envSalome.py +++ b/bin/envSalome.py @@ -21,16 +21,24 @@ import os import sys +import setenv kernel_root=os.getenv("KERNEL_ROOT_DIR") sys.path[:0]=[kernel_root+"/bin/salome"] -import runSalome +#import runSalome -argv=sys.argv[1:] -sys.argv=[] +argv = sys.argv[1:] +sys.argv = argv[1:] -args, modules_list, modules_root_dir = runSalome.get_config() -runSalome.set_env(args, modules_list, modules_root_dir) +#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() +#runSalome.set_env(args, modules_list, modules_root_dir) +setenv.main(); os.execvp(argv[0],argv) diff --git a/bin/killSalome.py b/bin/killSalome.py index 2d93685ef..2f1388182 100755 --- a/bin/killSalome.py +++ b/bin/killSalome.py @@ -33,5 +33,22 @@ def killAllPorts(): killMyPort(mo.groups()[0]) pass + 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 + if __name__ == "__main__": killAllPorts() + diff --git a/bin/killSalomeWithPort.py b/bin/killSalomeWithPort.py index 2bfec7561..79c168279 100755 --- a/bin/killSalomeWithPort.py +++ b/bin/killSalomeWithPort.py @@ -20,15 +20,18 @@ # import os, sys, pickle, signal, commands +from launchConfigureParser import verbose def getPiDict(port,appname='salome',full=True): from Utils_Identity import getShortHostName - host = os.getenv("HOSTNAME") + # get hostname by special function in all cases to + # have always same result in lower case at win32 + host = getShortHostName() if not host: - host = os.getenv("HOST") + host = os.getenv("HOSTNAME") if not host: - host = getShortHostName() + host = os.getenv("HOST") filedict = [] filedict.append( os.getenv('USER') ) # user name @@ -46,7 +49,7 @@ def appliCleanOmniOrbConfig(port): """ remove omniorb config files related to the port in SALOME application: - ${HOME}/${APPLI}/.omniORB_${HOSTNAME}_${NSPORT}.cfg - - ${HOME}/${APPLI}/.omniORB_${HOSTNAME}_last.cfg + - ${HOME}/${APPLI}/.omniORB_last.cfg the last is removed only if the link points to the first file. """ from Utils_Identity import getShortHostName @@ -59,7 +62,7 @@ def appliCleanOmniOrbConfig(port): home='%s/%s'%(home,appli) hostname=getShortHostName() omniorb_config = '%s/.omniORB_%s_%s.cfg'%(home,hostname, str(port)) - last_running_config = '%s/.omniORB_%s_last.cfg'%(home, hostname) + last_running_config = '%s/.omniORB_last.cfg'%(home) if os.access(last_running_config,os.F_OK): pointedPath = os.readlink(last_running_config) if pointedPath[0] != '/': @@ -86,8 +89,9 @@ def killMyPort(port): pass if found: - cmd = 'pid=`ps -eo pid,command | egrep "[0-9] omniNames -start '+str(port)+'"` ; echo $pid > /tmp/logs/'+os.getenv('USER')+"/_"+port+'_Pid_omniNames.log' - a = os.system(cmd) + if not sys.platform == 'win32': + cmd = 'pid=`ps -eo pid,command | egrep "[0-9] omniNames -start '+str(port)+'"` ; echo $pid > /tmp/logs/'+os.getenv('USER')+"/_"+port+'_Pid_omniNames.log' + a = os.system(cmd) try: fpidomniNames=open('/tmp/logs/'+os.getenv('USER')+"/_"+port+'_Pid_omniNames.log') prc = fpidomniNames.read() @@ -96,8 +100,13 @@ def killMyPort(port): for field in prc.split(" ") : if field == "omniNames" : if pidfield != "egrep" : - print 'stop process '+pidfield+' : omniNames' - os.system('kill -9 '+pidfield) + if sys.platform == "win32": + import win32pm + print 'stop process '+pidfield+' : omniNames' + win32pm.killpid(int(pidfield),0) + else: + if verbose(): print 'stop process '+pidfield+' : omniNames' + os.system('kill -9 '+pidfield) pidfield = field except: pass @@ -108,11 +117,15 @@ def killMyPort(port): for process_id in process_ids: for pid, cmd in process_id.items(): - print "stop process %s : %s"% (pid, cmd[0]) + if verbose(): print "stop process %s : %s"% (pid, cmd[0]) try: - os.kill(int(pid),signal.SIGKILL) + if sys.platform == "win32": + import win32pm + win32pm.killpid(int(pid),0) + else: + os.kill(int(pid),signal.SIGKILL) except: - print " ------------------ process %s : %s not found"% (pid, cmd[0]) + if verbose(): print " ------------------ process %s : %s not found"% (pid, cmd[0]) pass pass except: @@ -125,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 f4bea5ff0..399c40ef7 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -2,34 +2,38 @@ # 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 +# 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 +# +# 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 +# +# 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 -# +# + import os, glob, string, sys, re import xml.sax +import optparse +import types -# names of tags in XML configuration file +# names of tags in XML configuration file doc_tag = "document" sec_tag = "section" par_tag = "parameter" -# names of attributes in XML configuration file +# names of attributes in XML configuration file nam_att = "name" val_att = "value" # certain values in XML configuration file ("launch" section) lanch_nam = "launch" +help_nam = "help" gui_nam = "gui" splash_nam = "splash" logger_nam = "logger" @@ -40,10 +44,13 @@ killall_nam = "killall" modules_nam = "modules" embedded_nam = "embedded" standalone_nam = "standalone" -containers_nam = "containers" key_nam = "key" +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) @@ -52,28 +59,47 @@ plugins_nam = "plugins" # values passed as arguments, NOT read from XML config file, but set from within this script appname_nam = "appname" port_nam = "port" -appname = "SalomeApp" +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, interp_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 -listKeys = ( containers_nam, embedded_nam, key_nam, modules_nam, standalone_nam, plugins_nam ) +listKeys = ( embedded_nam, key_nam, modules_nam, standalone_nam, plugins_nam ) -# return application version (uses GUI_ROOT_DIR (or KERNEL_ROOT_DIR in batch mode) +/bin/salome/VERSION) +### +# Get the application version +# Uses GUI_ROOT_DIR (or KERNEL_ROOT_DIR in batch mode) +/bin/salome/VERSION file +### def version(): - root_dir = os.environ.get( 'KERNEL_ROOT_DIR', '' ) # KERNEL_ROOT_DIR or "" if not found - root_dir = os.environ.get( 'GUI_ROOT_DIR', root_dir ) # GUI_ROOT_DIR or KERNEL_ROOT_DIR or "" if both not found - filename = root_dir+'/bin/salome/VERSION' - str = open( filename, "r" ).readline() # str = "THIS IS SALOME - SALOMEGUI VERSION: 3.0.0" - match = re.search( r':\s+([a-zA-Z0-9.]+)\s*$', str ) - if match : - return match.group( 1 ) + try: + filename = None + root_dir = os.environ.get( 'KERNEL_ROOT_DIR', '' ) # KERNEL_ROOT_DIR or "" if not found + if root_dir and os.path.exists( root_dir + "/bin/salome/VERSION" ): + filename = root_dir + "/bin/salome/VERSION" + root_dir = os.environ.get( 'GUI_ROOT_DIR', '' ) # GUI_ROOT_DIR "" if not found + if root_dir and os.path.exists( root_dir + "/bin/salome/VERSION" ): + filename = root_dir + "/bin/salome/VERSION" + if filename: + str = open( filename, "r" ).readline() # str = "THIS IS SALOME - SALOMEGUI VERSION: 3.0.0" + match = re.search( r':\s+([a-zA-Z0-9.]+)\s*$', str ) + if match : + return match.group( 1 ) + except: + pass return '' -# calculate and return configuration file id in order to unically identify it -# for example: for 3.1.0a1 the id is 301000101 +### +# Calculate and return configuration file unique ID +# For example: for SALOME version 3.1.0a1 the id is 300999701 +### def version_id( fname ): vers = fname.split(".") major = int(vers[0]) @@ -91,21 +117,30 @@ def version_id( fname ): ver = major ver = ver * 100 + minor ver = ver * 100 + release - ver = ver * 10000 + dev + ver = ver * 10000 + if dev > 0: ver = ver - 10000 + dev return ver -# get user configuration file name -def userFile(): +### +# Get user configuration file name +### +def userFile(appname): v = version() if not v: return "" # not unknown version - filename = "%s/.%src.%s" % (os.environ['HOME'], appname, v) + if sys.platform == "win32": + filename = "%s\%s.xml.%s" % (os.environ['HOME'], appname, v) + else: + filename = "%s/.%src.%s" % (os.environ['HOME'], appname, v) if os.path.exists(filename): return filename # user preferences file for the current version exists # initial id id0 = version_id( v ) # get all existing user preferences files - files = glob.glob( os.environ['HOME'] + "/." + appname + "rc.*" ) + if sys.platform == "win32": + files = glob.glob( os.environ['HOME'] + "\." + appname + ".xml.*" ) + else: + files = glob.glob( os.environ['HOME'] + "/." + appname + "rc.*" ) f2v = {} for file in files: match = re.search( r'\.%src\.([a-zA-Z0-9.]+)$'%appname, file ) @@ -118,31 +153,99 @@ def userFile(): last_version = ver last_file = file return last_file - + +# -- + +_verbose = None + +def verbose(): + global _verbose + # verbose has already been called + if _verbose is not None: + return _verbose + # first time + try: + from os import getenv + _verbose = int(getenv('SALOME_VERBOSE')) + except: + _verbose = 0 + pass + # + return _verbose + +def setVerbose(level): + global _verbose + _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 + # ----------------------------------------------------------------------------- -### xml reader for launch configuration file usage +### +# XML reader for launch configuration file usage +### section_to_skip = "" class xml_parser: def __init__(self, fileName, _opts ): - print "Configure parser: processing %s ..." % fileName + if verbose(): print "Configure parser: processing %s ..." % fileName self.space = [] self.opts = _opts self.section = section_to_skip 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 ): - if str in ("yes", "y", "1"): - return 1 - elif str in ("no", "n", "0"): - return 0 - else: - return str + strloc = str + if isinstance(strloc, types.UnicodeType): + strloc = strloc.encode().strip() + if isinstance(strloc, types.StringType): + strlow = strloc.lower() + if strlow in ("1", "yes", "y", "on", "true", "ok"): + return True + elif strlow in ("0", "no", "n", "off", "false", "cancel"): + return False + return strloc + pass + + def intValue( self, str ): + strloc = str + if isinstance(strloc, types.UnicodeType): + strloc = strloc.encode().strip() + if isinstance(strloc, types.StringType): + strlow = strloc.lower() + if strlow in ("1", "yes", "y", "on", "true", "ok"): + return 1 + elif strlow in ("0", "no", "n", "off", "false", "cancel"): + return 0 + else: + return string.atoi(strloc) + return strloc pass def startElement(self, name, attrs): @@ -177,10 +280,12 @@ class xml_parser: key = self.section + "_" + nam 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 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 @@ -210,236 +315,605 @@ class xml_parser: # ----------------------------------------------------------------------------- -### searching for launch configuration files -# the rule: -# - environment variable {'appname'+'Config'} (SalomeAppConfig) contains list of directories (';' as devider) -# - these directories contain 'appname'+'.xml' (SalomeApp.xml) configuration files -# - these files are analyzed beginning with the last one (last directory in the list) -# - if a key is found in next analyzed cofiguration file - it will be replaced -# - the last configuration file to be analyzed - ~/.'appname'+'rc' (~/SalomeApprc) (if it exists) -# - but anyway, if user specifies a certain option in a command line - it will replace the values -# - specified in configuration file(s) -# - once again the order of settings (next setting replaces the previous ones): -# - SalomeApp.xml files in directories specified by SalomeAppConfig env variable -# - .SalomeApprc file in user's catalogue -# - command line - -config_var = appname+'Config' -# set resources variables if not yet set -if os.getenv("GUI_ROOT_DIR"): - if not os.getenv("SUITRoot"): - os.environ["SUITRoot"] = os.getenv("GUI_ROOT_DIR") + "/share/salome" - if not os.getenv(config_var): - os.environ[config_var] = os.getenv("GUI_ROOT_DIR") + "/share/salome/resources" +booleans = { '1': True , 'yes': True , 'y': True , 'on' : True , 'true' : True , 'ok' : True, + '0': False, 'no' : False, 'n': False, 'off': False, 'false': False, 'cancel' : False } + +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 -else : - if not os.getenv("SUITRoot"): - os.environ["SUITRoot"] = "" - if not os.getenv(config_var): - os.environ[config_var] = "" - -dirs = os.environ[config_var] -dirs = re.split('[;|:]', dirs ) -dirs.reverse() # reverse order, like in "path" variable - FILO-style processing - -_opts = {} # assiciative array of options to be filled - -# SalomeApp.xml files in directories specified by SalomeAppConfig env variable -for dir in dirs: - filename = dir+'/'+appname+'.xml' - if not os.path.exists(filename): - print "Configure parser: Warning : could not find configuration file %s" % filename + +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: - p = xml_parser(filename, _opts) - _opts = p.opts - except: - print "Configure parser: Error : can not read configuration file %s" % filename - pass + value_conv = booleans[value.strip().lower()] + for attribute in args: + setattr(parser.values, attribute, value_conv) + except KeyError: + raise optparse.OptionValueError( + "option %s: invalid boolean value: %s (choose from %s)" + % (opt, value, boolean_choices)) + else: + for attribute in args: + setattr(parser.values, attribute, value) + +def CreateOptionParser (theAdditionalOptions=[]): + # GUI/Terminal. Default: GUI + help_str = "Launch without GUI (in the terminal mode)." + o_t = optparse.Option("-t", + "--terminal", + action="store_false", + 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", + action="store_true", + dest="gui", + help=help_str) + + # Show Desktop (inly in GUI mode). Default: True + help_str = "1 to activate GUI desktop [default], " + help_str += "0 to not activate GUI desktop (Session_Server starts, but GUI is not shown). " + help_str += "Ignored in the terminal mode." + o_d = optparse.Option("-d", + "--show-desktop", + metavar="<1/0>", + #type="choice", choices=boolean_choices, + type="string", + action="callback", callback=store_boolean, callback_args=('desktop',), + dest="desktop", + help=help_str) + help_str = "Do not activate GUI desktop (Session_Server starts, but GUI is not shown). " + help_str += "The same as --show-desktop=0." + o_o = optparse.Option("-o", + "--hide-desktop", + action="store_false", + dest="desktop", + help=help_str) + + # Use logger or log-file. Default: nothing. + help_str = "Redirect messages to the CORBA collector." + #o4 = optparse.Option("-l", "--logger", action="store_true", dest="logger", help=help_str) + o_l = optparse.Option("-l", + "--logger", + action="store_const", const="CORBA", + dest="log_file", + help=help_str) + help_str = "Redirect messages to the " + o_f = optparse.Option("-f", + "--log-file", + metavar="", + type="string", + action="store", + dest="log_file", + help=help_str) + + # Execute python scripts. Default: None. + help_str = "Python script(s) to be imported. Python scripts are imported " + help_str += "in the order of their appearance. In GUI mode python scripts " + help_str += "are imported in the embedded python interpreter of current study, " + help_str += "otherwise in an external python interpreter" + o_u = optparse.Option("-u", + "--execute", + metavar="", + type="string", + action="append", + dest="py_scripts", + help=help_str) + + # Configuration XML file. Default: $(HOME)/.SalomeApprc.$(version). + help_str = "Parse application settings from the " + help_str += "instead of default $(HOME)/.SalomeApprc.$(version)" + o_r = optparse.Option("-r", + "--resources", + metavar="", + type="string", + action="store", + dest="resources", + help=help_str) + + # Use own xterm for each server. Default: False. + help_str = "Launch each SALOME server in own xterm console" + o_x = optparse.Option("-x", + "--xterm", + action="store_true", + dest="xterm", + help=help_str) + + # Modules. Default: Like in configuration files. + help_str = "SALOME modules list (where , are the names " + help_str += "of SALOME modules which should be available in the SALOME session)" + o_m = optparse.Option("-m", + "--modules", + metavar="", + type="string", + action="append", + dest="modules", + help=help_str) + + # Embedded servers. Default: Like in configuration files. + help_str = "CORBA servers to be launched in the Session embedded mode. " + 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="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 : %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="callback", + dest="standalone", + callback=check_standalone, + help=help_str) + + # Kill with port. Default: False. + help_str = "Kill SALOME with the current port" + o_p = optparse.Option("-p", + "--portkill", + action="store_true", + dest="portkill", + help=help_str) + + # Kill all. Default: False. + help_str = "Kill all running SALOME sessions" + o_k = optparse.Option("-k", + "--killall", + action="store_true", + dest="killall", + help=help_str) + + # Additional python interpreters. Default: 0. + help_str = "The number of additional external python interpreters to run. " + help_str += "Each additional python interpreter is run in separate " + help_str += "xterm session with properly set SALOME environment" + o_i = optparse.Option("-i", + "--interp", + metavar="", + type="int", + action="store", + dest="interp", + help=help_str) + + # Splash. Default: True. + help_str = "1 to display splash screen [default], " + help_str += "0 to disable splash screen. " + help_str += "This option is ignored in the terminal mode. " + help_str += "It is also ignored if --show-desktop=0 option is used." + o_z = optparse.Option("-z", + "--splash", + metavar="<1/0>", + #type="choice", choices=boolean_choices, + type="string", + action="callback", callback=store_boolean, callback_args=('splash',), + dest="splash", + help=help_str) + + # Catch exceptions. Default: True. + help_str = "1 (yes,true,on,ok) to enable centralized exception handling [default], " + help_str += "0 (no,false,off,cancel) to disable centralized exception handling." + o_c = optparse.Option("-c", + "--catch-exceptions", + metavar="<1/0>", + #type="choice", choices=boolean_choices, + type="string", + action="callback", callback=store_boolean, callback_args=('catch_exceptions',), + dest="catch_exceptions", + help=help_str) + + # Print free port and exit + help_str = "Print free port and exit" + o_a = optparse.Option("--print-port", + action="store_true", + dest="print_port", default=False, + help=help_str) + + # Do not relink ${HOME}/.omniORB_last.cfg + help_str = "Do not save current configuration ${HOME}/.omniORB_last.cfg" + o_n = optparse.Option("--nosave-config", + action="store_false", + 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) + + # Print Naming service port into a user file. Default: False. + help_str = "Print Naming Service Port into a user file." + o_nspl = optparse.Option("--ns-port-log", + metavar="", + type="string", + action="store", + dest="ns_port_log_file", + 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 + o_x, # xterm + o_m, # Modules + o_e, # Embedded servers + o_s, # Standalone servers + o_p, # Kill with port + o_k, # Kill all + o_i, # Additional python interpreters + o_z, # Splash + o_c, # Catch exceptions + o_a, # Print free port and exit + o_n, # --nosave-config + o_pi, # Interactive python console + o_nspl] + + + #std_options = ["gui", "desktop", "log_file", "py_scripts", "resources", + # "xterm", "modules", "embedded", "standalone", + # "portkill", "killall", "interp", "splash", + # "catch_exceptions", "print_port", "save_config", "ns_port_log_file"] + + opt_list += theAdditionalOptions + + a_usage = "%prog [options] [STUDY_FILE]" + version_str = "Salome %s" % version() + pars = optparse.OptionParser(usage=a_usage, version=version_str, option_list=opt_list) + + return pars + +# ----------------------------------------------------------------------------- -# SalomeApprc file in user's catalogue -filename = userFile() -if filename and not os.path.exists(filename): - print "Configure parser: Warning : could not find user configuration file" -else: +### +# Get the environment +### + +# this attribute is obsolete +args = {} +#def get_env(): +#args = [] +def get_env(theAdditionalOptions=[], appname="SalomeApp"): + ### + # Collect launch configuration files: + # - The environment variable "Config" (SalomeAppConfig) which can + # define a list of directories (separated by ':' or ';' symbol) is checked + # - If the environment variable "Config" is not set, only + # ${GUI_ROOT_DIR}/share/salome/resources/gui is inspected + # - ${GUI_ROOT_DIR}/share/salome/resources/gui directory is always inspected + # so it is not necessary to put it in the "Config" variable + # - The directories which are inspected are checked for files ".xml" + # (SalomeApp.xml) which define SALOME configuration + # - These directories are analyzed beginning from the last one in the list, + # so the first directory listed in "Config" environment variable + # has higher priority: it means that if some configuration options + # is found in the next analyzed cofiguration file - it will be replaced + # - The last configuration file which is parsed is user configuration file + # situated in the home directory: "~/.rc[.]" (~/SalomeApprc.3.2.0) + # (if it exists) + # - Command line options have the highest priority and replace options + # specified in configuration file(s) + ### + + global args + config_var = appname+'Config' + + separator = ":" + if os.sys.platform == 'win32': + separator = ";" + + # check KERNEL_ROOT_DIR try: - p = xml_parser(filename, _opts) - _opts = p.opts + kernel_root_dir=os.environ["KERNEL_ROOT_DIR"] except: - print 'Configure parser: Error : can not read user configuration file' - -args = _opts - -# --- setting default values of keys if they were NOT set in config files --- -for aKey in listKeys: - if not args.has_key( aKey ): - args[aKey]=[] - -for aKey in boolKeys: - if not args.has_key( aKey ): - args[aKey]=0 - -if args[file_nam]: - afile=args[file_nam] - args[file_nam]=[afile] - -args[appname_nam] = appname - -### searching for my port - -my_port = 2809 -try: - file = open(os.environ["OMNIORB_CONFIG"], "r") - s = file.read() - while len(s): - l = string.split(s, ":") - if string.split(l[0], " ")[0] == "ORBInitRef" or string.split(l[0], " ")[0] == "InitRef" : - my_port = int(l[len(l)-1]) - pass - s = file.read() - pass -except: - pass + print """ + For each SALOME module, the environment variable _ROOT_DIR must be set. + KERNEL_ROOT_DIR is mandatory. + """ + sys.exit(1) + pass -args[port_nam] = my_port + ############################ + # parse command line options + pars = CreateOptionParser(theAdditionalOptions) + (cmd_opts, cmd_args) = pars.parse_args(sys.argv[1:]) + ############################ + + # Process --print-port option + if cmd_opts.print_port: + from runSalome import searchFreePort + searchFreePort({}) + print "port:%s"%(os.environ['NSPORT']) + sys.exit(0) + pass -# ----------------------------------------------------------------------------- + # set resources variable SalomeAppConfig if it is not set yet + dirs = [] + if os.getenv(config_var): + if sys.platform == 'win32': + dirs += re.split(';', os.getenv(config_var)) + else: + dirs += re.split('[;|:]', os.getenv(config_var)) + + if os.getenv("GUI_ROOT_DIR") and os.path.isdir( os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui" ): + dirs += [os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui"] + os.environ[config_var] = separator.join(dirs) -### command line options reader + dirs.reverse() # reverse order, like in "path" variable - FILO-style processing -def options_parser(line): - source = line - list = [] - for delimiter in [" ", ",", "="]: - for o in source: - list += string.split(o, delimiter) - pass - source = list - list = [] - pass + try: + dirs.remove('') # to remove empty dirs if the variable terminate by ":" or if there are "::" inside + except: + pass + + _opts = {} # associative array of options to be filled + + # parse SalomeApp.xml files in directories specified by SalomeAppConfig env variable + for dir in dirs: + #filename = dir+'/'+appname+'.xml' + filename = dir+'/'+salomeappname+'.xml' + if not os.path.exists(filename): + print "Configure parser: Warning : could not find configuration file %s" % filename + else: + try: + p = xml_parser(filename, _opts) + _opts = p.opts + except: + print "Configure parser: Error : can not read configuration file %s" % filename + pass - result = {} - i = 0 - while i < len(source): - if source[i][0] != '-': - key = None - elif source[i][1] == '-': - key = source[i][2] + # parse user configuration file + # It can be set via --resources= command line option + # or is given by default from ${HOME}/.rc. + # If user file for the current version is not found the nearest to it is used + user_config = cmd_opts.resources + if not user_config: + user_config = userFile(appname) + if not user_config or not os.path.exists(user_config): + print "Configure parser: Warning : could not find user configuration file" else: - key = source[i][1] - pass - - result[key] = [] - if key: - i += 1 - pass - while i < len(source) and source[i][0] != '-': - result[key].append(source[i]) - i += 1 - pass - pass - return result + try: + p = xml_parser(user_config, _opts) + _opts = p.opts + except: + print 'Configure parser: Error : can not read user configuration file' + user_config = "" -# ----------------------------------------------------------------------------- + args = _opts -### read command-line options : each arg given in command line supersedes arg from xml config file -cmd_opts = {} -try: - cmd_opts = options_parser(sys.argv[1:]) - kernel_root_dir=os.environ["KERNEL_ROOT_DIR"] -except: - cmd_opts["h"] = 1 - pass + args['user_config'] = user_config + #print "User Configuration file: ", args['user_config'] -### check all options are right - -opterror=0 -for opt in cmd_opts: - if not opt in ("h","g","l","f","x","m","e","s","c","p","k","t","i","r"): - print "Configure parser: Error : command line error : -%s" % opt - opterror=1 - -if opterror == 1: - cmd_opts["h"] = 1 - -if cmd_opts.has_key("h"): - print """USAGE: runSalome.py [options] - [command line options] : - --help or -h : print this help - --gui or -g : launching with GUI - --terminal -t : launching without gui (to deny --gui) - --logger or -l : redirect messages in a CORBA collector - --file=filename or -f=filename: redirect messages in a log file - --xterm or -x : execute servers in xterm console (messages appear in xterm windows) - --modules=module1,module2,... : salome module list (modulen is the name of Salome module to load) - or -m=module1,module2,... - --embedded=registry,study,moduleCatalog,cppContainer - or -e=registry,study,moduleCatalog,cppContainer - : embedded CORBA servers (default: registry,study,moduleCatalog,cppContainer) - : (logger,pyContainer,supervContainer can't be embedded - --standalone=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer - or -s=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer - : standalone CORBA servers (default: pyContainer,supervContainer) - --containers=cpp,python,superv: (obsolete) launching of containers cpp, python and supervision - or -c=cpp,python,superv : = get default from -e and -s - --portkill or -p : kill the salome with current port - --killall or -k : kill all salome sessions - --interp=n or -i=n : number of additional xterm to open, with session environment - -z : display splash screen - -r : disable centralized exception handling mechanism - - For each Salome module, the environment variable _ROOT_DIR must be set. - The module name () must be uppercase. - KERNEL_ROOT_DIR is mandatory. - """ - sys.exit(1) - pass + # set default values for options which are NOT set in config files + for aKey in listKeys: + if not args.has_key( aKey ): + args[aKey]=[] + + for aKey in boolKeys: + if not args.has_key( aKey ): + args[aKey]=0 + + if args[file_nam]: + afile=args[file_nam] + args[file_nam]=[afile] + + args[appname_nam] = appname -### apply command-line options to the arguments -for opt in cmd_opts: - if opt == 'g': - args[gui_nam] = 1 - elif opt == 'z': - args[splash_nam] = 1 - elif opt == 'r': - args[except_nam] = 1 - elif opt == 'l': - args[logger_nam] = 1 - elif opt == 'f': - args[file_nam] = cmd_opts['f'] - elif opt == 'x': - args[xterm_nam] = 1 - elif opt == 'i': - args[interp_nam] = cmd_opts['i'] - elif opt == 'm': - args[modules_nam] = cmd_opts['m'] - elif opt == 'e': - args[embedded_nam] = cmd_opts['e'] - elif opt == 's': - args[standalone_nam] = cmd_opts['s'] - elif opt == 'c': - args[containers_nam] = cmd_opts['c'] - elif opt == 'p': - args[portkill_nam] = 1 - elif opt == 'k': - args[killall_nam] = 1 + # get the port number + my_port = 2809 + try: + file = open(os.environ["OMNIORB_CONFIG"], "r") + s = file.read() + while len(s): + l = string.split(s, ":") + if string.split(l[0], " ")[0] == "ORBInitRef" or string.split(l[0], " ")[0] == "InitRef" : + my_port = int(l[len(l)-1]) + pass + s = file.read() pass - pass + except: + pass -# if --modules (-m) command line option is not given -# try SALOME_MODULES environment variable -if not cmd_opts.has_key( "m" ) and os.getenv( "SALOME_MODULES" ): - args[modules_nam] = re.split( "[:;,]", os.getenv( "SALOME_MODULES" ) ) - pass + args[port_nam] = my_port + + #################################################### + # apply command-line options to the arguments + # each option given in command line overrides the option from xml config file + # + # Options: gui, desktop, log_file, py_scripts, resources, + # xterm, modules, embedded, standalone, + # portkill, killall, interp, splash, + # 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: + args["session_gui"] = cmd_opts.desktop + args[splash_nam] = cmd_opts.desktop + if args["session_gui"]: + if cmd_opts.splash is not None: + args[splash_nam] = cmd_opts.splash + if len(cmd_args) > 0: + args["study_hdf"] = cmd_args[0] + else: + args["session_gui"] = False + args[splash_nam] = False -# 'terminal' must be processed in the end: to deny any 'gui' options -if 't' in cmd_opts: - args[gui_nam] = 0 - pass + # Logger/Log file + if cmd_opts.log_file is not None: + if cmd_opts.log_file == 'CORBA': + args[logger_nam] = True + else: + args[file_nam] = [cmd_opts.log_file] + + # Naming Service port log file + if cmd_opts.ns_port_log_file is not None: + args["ns_port_log_file"] = cmd_opts.ns_port_log_file + + # Python scripts + args[script_nam] = [] + if cmd_opts.py_scripts is not None: + listlist = cmd_opts.py_scripts + for listi in listlist: + args[script_nam] += re.split( "[:;,]", listi) + + # xterm + if cmd_opts.xterm is not None: args[xterm_nam] = cmd_opts.xterm + + # Modules + if cmd_opts.modules is not None: + args[modules_nam] = [] + listlist = cmd_opts.modules + for listi in listlist: + args[modules_nam] += re.split( "[:;,]", listi) + else: + # if --modules (-m) command line option is not given + # try SALOME_MODULES environment variable + if os.getenv( "SALOME_MODULES" ): + args[modules_nam] = re.split( "[:;,]", os.getenv( "SALOME_MODULES" ) ) + pass + + # Embedded + if cmd_opts.embedded is not None: + args[embedded_nam] = filter( lambda a: a.strip(), re.split( "[:;,]", cmd_opts.embedded ) ) + + # Standalone + if cmd_opts.standalone is not None: + 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 + if cmd_opts.killall is not None: args[killall_nam] = cmd_opts.killall + + # Interpreter + if cmd_opts.interp is not None: + args[interp_nam] = cmd_opts.interp + + # Exceptions + if cmd_opts.catch_exceptions is not None: + args[except_nam] = not cmd_opts.catch_exceptions + + # Relink config file + 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: + cmd = "args[\"%s\"] = cmd_opts.%s"%(add_opt.dest,add_opt.dest) + exec(cmd) + #################################################### + + # disable signals handling + if args[except_nam] == 1: + os.environ["NOT_INTERCEPT_SIGNALS"] = "1" + pass -# now modify SalomeAppConfig environment variable -dirs = re.split('[;|:]', os.environ[config_var] ) -for m in args[modules_nam]: - if m not in ["KERNEL", "GUI", ""] and os.getenv("%s_ROOT_DIR"%m): - dirs.append( os.getenv("%s_ROOT_DIR"%m) + "/share/salome/resources" ) -os.environ[config_var] = ":".join(dirs) + # now modify SalomeAppConfig environment variable + # to take into account the SALOME modules + if os.sys.platform == 'win32': + dirs = re.split('[;]', os.environ[config_var] ) + else: + dirs = re.split('[;|:]', os.environ[config_var] ) + for m in args[modules_nam]: + if m not in ["KERNEL", "GUI", ""] and os.getenv("%s_ROOT_DIR"%m): + d1 = os.getenv("%s_ROOT_DIR"%m) + "/share/salome/resources/" + m.lower() + d2 = os.getenv("%s_ROOT_DIR"%m) + "/share/salome/resources" + #if os.path.exists( "%s/%s.xml"%(d1, appname) ): + if os.path.exists( "%s/%s.xml"%(d1, salomeappname) ): + dirs.append( d1 ) + #elif os.path.exists( "%s/%s.xml"%(d2, appname) ): + elif os.path.exists( "%s/%s.xml"%(d2, salomeappname) ): + dirs.append( d2 ) + + # return arguments + os.environ[config_var] = separator.join(dirs) + #print "Args: ", args + return args diff --git a/bin/launchSalome.py b/bin/launchSalome.py new file mode 100755 index 000000000..08aea588a --- /dev/null +++ b/bin/launchSalome.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python + +import socket +import os +import sys +import shutil + +##################################################################### +def findFreePort(startPort, step) : + + currentPort = startPort; + if step < 1: + step = 1; + + serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM); + + portFound = 0; + while (portFound != 1 and currentPort < 65536): + try : + serversocket.bind((socket.gethostname(), currentPort)); + portFound = 1; + print str(currentPort) + ": " + "OK"; +# serversocket.shutdown(0); +# serversocket.close(); + except Exception, inst: + print str(currentPort) + ": " + str(inst.args); + currentPort = currentPort+step; + + + + + if (portFound != 1) : + currentPort = -1; + return currentPort; +##################################################################### + + + +## 1. Generate config file for omniORB: +# content: +# InitRef = NameService=corbaname::[HOST_NAME]:[PORT_NUMBER] + +freePort = findFreePort(2810, 1); +hostName = socket.gethostname(); + +if (len(sys.argv) > 1) and sys.argv[1] == "-nothing" : + print "port:" + str(freePort); + sys.exit(0) + + + + +if freePort < 0 : + print + print "Can't find a free port to launch omniNames" + print "Try to kill the running servers and then launch SALOME again." + print + sys.exit(0) + +else : + omniCfgFileContent = "InitRef = NameService=corbaname::" + str(hostName) + ":" + str(freePort); + omniCfgFilePath = os.environ.get('HOME') + "/" + ".omniORB_" + str(hostName) + "_" + str(freePort) + ".cfg"; + + omni_file = file(omniCfgFilePath,'w+'); + omni_file.write(omniCfgFileContent); + omni_file.write("\n"); + omni_file.close(); + + if (len(sys.argv) > 1) and sys.argv[1] == "--save-config" : + omniCfgCurrent = os.environ.get('HOME') + "/.omniORB_current.cfg"; + if os.name == "posix" : + #make a symbolic link + symlink(omniCfgFilePath, omniCfgCurrent); + else : + #copy the file + shutil.copy(omniCfgFilePath, omniCfgCurrent); + + omniCfgFilePath = omniCfgCurrent; + + + + + ## 2. Set the OMNIORB_CONFIG environment variable + os.environ['OMNIORB_CONFIG']=omniCfgFilePath; + + + ## 3. execute the file runSalome.py + runSalomePyFilePath = os.environ.get('KERNEL_ROOT_DIR') + "/bin/salome/runSalome.py"; + + if os.path.isfile(runSalomePyFilePath) : + execfile(runSalomePyFilePath); + diff --git a/bin/nameserver.py b/bin/nameserver.py new file mode 100755 index 000000000..dd03c51a3 --- /dev/null +++ b/bin/nameserver.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python + +import sys, os, re, socket +#import commands +from server import * +from Utils_Identity import getShortHostName + +# ----------------------------------------------------------------------------- + +class NamingServer(Server): + XTERM="" + USER=os.getenv('USER') + if USER is None: + USER='anonymous' + #os.system("mkdir -m 777 -p /tmp/logs") + LOGDIR="/tmp/logs/" + USER + + def initNSArgs(self): + if sys.platform == "win32": + # 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" + + 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") + 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 + self.CMD=['omniNames -start ' , aPort , ' -logdir ' , '\"' + upath + '\"'] + #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 + " &") + + print "... ok" + print "to list contexts and objects bound into the context with the specified name : showNS " + + + def initArgs(self): + Server.initArgs(self) + if sys.platform == "win32": + env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("PATH")] + else: + env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("LD_LIBRARY_PATH")] + 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. +# For using rsh it is necessary to have in the ${HOME} directory a .rhosts file +# Warning : on RedHat the file /etc/hosts contains by default a line like : +# 127.0.0.1 bordolex bordolex.paris1.matra-dtv.fr localhost.localdomain localhost +# (bordolex is the station name). omniNames on bordolex will be accessible from other +# computers only if the computer name is removed on that line like : +# 127.0.0.1 bordolex.paris1.matra-dtv.fr localhost.localdomain localhost + +# To start dynamically Containers on several computers you need to +# put in the ${OMNIORB_CONFIG} file a computer name instead of "localhost" +# example : ORBInitRef NameService=corbaname::dm2s0017 + +# If you need to use several omniNames running on the same computer, you have to : +#1. put in your ${OMNIORB_CONFIG} file a computer name and port number +# example : ORBInitRef NameService=corbaname::dm2s0017:1515 +#2. start omninames with this port number like in orbmodile.py +# example : omniNames -start 1515 -logdir ${BaseDir}/logs/${Username} & diff --git a/bin/orbmodule.py b/bin/orbmodule.py index 52012f91a..9f3c66324 100755 --- a/bin/orbmodule.py +++ b/bin/orbmodule.py @@ -15,51 +15,31 @@ # 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 * from omniORB import CORBA # Import the stubs for the Naming service import CosNaming - -# ----------------------------------------------------------------------------- - -class Server: - XTERM="/usr/bin/X11/xterm -iconic -e " - CMD="" - - def run(self): - commande=self.XTERM+self.CMD - print commande - ier=os.system(commande) - if ier:print "Commande failed" - -# ----------------------------------------------------------------------------- - -class NamingServer(Server): - XTERM="" - USER=os.getenv('USER') - if USER is None: - USER='anonymous' - os.system("mkdir -m 777 -p /tmp/logs") - LOGDIR="/tmp/logs/" + USER - os.system("mkdir -m 777 -p " + LOGDIR) - CMD="runNS.sh > " + LOGDIR + "/salomeNS.log 2>&1" +#from runNS import * # ----------------------------------------------------------------------------- class client: - def __init__(self): + def __init__(self,args=None): + #set GIOP message size for bug 10560: impossible to get field values in TUI mode + sys.argv.extend(["-ORBgiopMaxMsgSize", "104857600"]) ## = 100 * 1024 * 1024 # Initialise the ORB self.orb=CORBA.ORB_init(sys.argv, CORBA.ORB_ID) # Initialise the Naming Service - self.initNS() + self.initNS(args or {}) # -------------------------------------------------------------------------- - def initNS(self): + def initNS(self,args): # Obtain a reference to the root naming context obj = self.orb.resolve_initial_references("NameService") try: @@ -67,10 +47,10 @@ 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().run() + NamingServer(args).run() print "Searching Naming Service ", ncount=0 delta=0.1 @@ -159,16 +139,18 @@ class client: if nobj is None: print "%s exists but is not a %s" % (name,typobj) return nobj - def waitNSPID(self, theName, thePID, theTypObj = None): + + if sys.platform != "win32": + def waitNSPID(self, theName, thePID, theTypObj = None): aCount = 0 aDelta = 0.5 anObj = None 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 new file mode 100755 index 000000000..444760369 --- /dev/null +++ b/bin/runNS.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python + +#log files localization + +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"] +else: + os.environ["BaseDir"]="/tmp" + +os.environ["Username"]=os.environ["USER"] + +# kill OmniNames if exists + +#killall -q -9 omniNames + +# 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": + 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": + #import win32pm + #command = ['omniNames -start ' , aPort , ' -logdir ' , '\"' + upath + '\"'] + #os.system("start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\"" ) + command = "start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\"" + #print command + pid = win32pm.spawnpid( string.join(command, " "), -nc ) + process_id[pid]=command + else: + os.system("omniNames -start " + aPort + " -logdir " + upath + " &") + + 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. +# Others Containers are started with start_impl method of FactoryServer Container. +# For using rsh it is necessary to have in the ${HOME} directory a .rhosts file +# Warning : on RedHat the file /etc/hosts contains by default a line like : +# 127.0.0.1 bordolex bordolex.paris1.matra-dtv.fr localhost.localdomain localhost +# (bordolex is the station name). omniNames on bordolex will be accessible from other +# computers only if the computer name is removed on that line like : +# 127.0.0.1 bordolex.paris1.matra-dtv.fr localhost.localdomain localhost + +# To start dynamically Containers on several computers you need to +# put in the ${OMNIORB_CONFIG} file a computer name instead of "localhost" +# example : ORBInitRef NameService=corbaname::dm2s0017 + +# If you need to use several omniNames running on the same computer, you have to : +#1. put in your ${OMNIORB_CONFIG} file a computer name and port number +# example : ORBInitRef NameService=corbaname::dm2s0017:1515 +#2. start omninames with this port number in runNS.sh +# example : omniNames -start 1515 -logdir ${BaseDir}/logs/${Username} & diff --git a/bin/runSalome b/bin/runSalome index cf715b617..abc4c763b 100755 --- a/bin/runSalome +++ b/bin/runSalome @@ -1,52 +1,6 @@ #!/bin/bash -save_config=$1 - -searchFreePort() { - echo -n "Searching for a free port for naming service: " - export NSPORT=2810 - local limit=$NSPORT - let limit=limit+100 - while [ 1 ] - do - aRes=`netstat -ltn | grep -E :${NSPORT}` - if [ -z "$aRes" ]; then - echo ${NSPORT} - Ok - local myhost=`hostname` - export OMNIORB_CONFIG=${HOME}/.omniORB_${myhost}_${NSPORT}.cfg - local initref="NameService=corbaname::"`hostname`":$NSPORT" - export NSPORT - if [[ `python -c "import CORBA; print CORBA.ORB_ID"` == "omniORB4" ]]; then - echo "InitRef = $initref" > $OMNIORB_CONFIG - else - echo "ORBInitRef $initref" > $OMNIORB_CONFIG - fi - if [[ "$save_config" == "--save-config" ]] ; then - ln -sf $OMNIORB_CONFIG ${HOME}/.omniORB_current.cfg - export OMNIORB_CONFIG=${HOME}/.omniORB_current.cfg - fi - break - fi - echo -n "${NSPORT} " - if [[ $NSPORT -eq $limit ]] ; then - echo - echo "Can't find a free port to launch omniNames" - echo "Try to kill the running servers and then launch SALOME again." - exit - fi - let NSPORT=NSPORT+1 - done -} - -searchFreePort - -if [[ "$*" == "-nothing" ]]; then - echo "port:$NSPORT" -elif [ $# -ne 0 ] ; then - 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 9f0732b9c..f20b50794 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -21,217 +21,10 @@ import sys, os, string, glob, time, pickle import orbmodule - -process_id = {} - -# salome_subdir variable is used for composing paths like $KERNEL_ROOT_DIR/share/salome/resources, etc. -# before moving to SUIT-based gui, instead of salome_subdir there was args['appname'] used. -# but after - 'appname' = "SalomeApp", so using it in making the subdirectory is an error. -salome_subdir = "salome" - -# ----------------------------------------------------------------------------- - -def add_path(directory, variable_name): - """Function helper to add environment variables""" - if not os.environ.has_key(variable_name): - os.environ[variable_name] = "" - pass - if os.path.exists(directory): - newpath=[] - for _dir in os.environ[variable_name].split(":"): - if os.path.exists(_dir): - if not os.path.samefile(_dir, directory): - newpath.append(_dir) - else: - if os.path.abspath(_dir) != os.path.abspath(directory): - newpath.append(_dir) - pass - import string - newpath[:0] = [ directory ] - newpath = string.join(newpath,":") - os.environ[variable_name] = newpath - if variable_name == "PYTHONPATH": - sys.path[:0] = [directory] - -# ----------------------------------------------------------------------------- - -def get_config(): - """ - Get list of modules, paths. - - Read args from launch configure xml file and command line options. - Check variables _ROOT_DIR and set list of used modules. - Return args, modules_list, modules_root_dir - """ - - # read args from launch configure xml file and command line options - - import launchConfigureParser - args = launchConfigureParser.args - - # Check variables _ROOT_DIR - # and set list of used modules (without KERNEL) - - modules_list = [] - if args.has_key("modules"): - modules_list += args["modules"] - # KERNEL must be last in the list to locate it at the first place in PATH - if args["gui"] : - modules_list[:0] = ["GUI"] - modules_list[:0] = ["KERNEL"] - modules_list.reverse() - - modules_root_dir = {} - - to_remove_list=[] - for module in modules_list : - module_variable=module+"_ROOT_DIR" - if not os.environ.has_key(module_variable): - print "*******************************************************" - print "*" - print "* Environment variable",module_variable,"must be set" - print "* Module", module, "will be not available" - print "*" - print "********************************************************" - to_remove_list.append(module) - continue - pass - module_root_dir = os.environ[module_variable] - modules_root_dir[module]=module_root_dir - - for to_remove in to_remove_list: - modules_list.remove(to_remove) - - while "KERNEL" in modules_list: - modules_list.remove("KERNEL") - pass - - while "GUI" in modules_list: - modules_list.remove("GUI") - pass - - if "SUPERV" in modules_list and not 'superv' in args['standalone']: - args['standalone'].append("superv") - pass - - return args, modules_list, modules_root_dir - -# ----------------------------------------------------------------------------- - -def set_env(args, modules_list, modules_root_dir): - """Add to the PATH-variables modules specific paths""" - - python_version="python%d.%d" % sys.version_info[0:2] - modules_root_dir_list = [] - if args["gui"] : - modules_list = modules_list[:] + ["GUI"] - modules_list = modules_list[:] + ["KERNEL"] - for module in modules_list : - if modules_root_dir.has_key(module): - module_root_dir = modules_root_dir[module] - modules_root_dir_list[:0] = [module_root_dir] - add_path(os.path.join(module_root_dir,"lib",salome_subdir), - "LD_LIBRARY_PATH") - add_path(os.path.join(module_root_dir,"bin",salome_subdir), - "PATH") - if os.path.exists(module_root_dir + "/examples") : - add_path(os.path.join(module_root_dir,"examples"), - "PYTHONPATH") - pass - add_path(os.path.join(module_root_dir,"bin",salome_subdir), - "PYTHONPATH") - add_path(os.path.join(module_root_dir,"lib", - python_version,"site-packages", - salome_subdir), - "PYTHONPATH") - add_path(os.path.join(module_root_dir,"lib",salome_subdir), - "PYTHONPATH") - add_path(os.path.join(module_root_dir,"lib", - python_version,"site-packages", - salome_subdir, - "shared_modules"), - "PYTHONPATH") - pass - pass - - - os.environ["SALOMEPATH"]=":".join(modules_root_dir_list) - - # set trace environment variable - - if not os.environ.has_key("SALOME_trace"): - os.environ["SALOME_trace"]="local" - if args['file']: - os.environ["SALOME_trace"]="file:"+args['file'][0] - if args['logger']: - os.environ["SALOME_trace"]="with_logger" - - # set environment for SMESH plugins - - if "SMESH" in modules_list: - os.environ["SMESH_MeshersList"]="StdMeshers" - if not os.environ.has_key("SALOME_StdMeshersResources"): - os.environ["SALOME_StdMeshersResources"] \ - = modules_root_dir["SMESH"]+"/share/"+args["appname"]+"/resources" - pass - if args.has_key("SMESH_plugins"): - for plugin in args["SMESH_plugins"]: - plugin_root = "" - if os.environ.has_key(plugin+"_ROOT_DIR"): - plugin_root = os.environ[plugin+"_ROOT_DIR"] - else: - # workaround to avoid modifications of existing environment - if os.environ.has_key(plugin.upper()+"_ROOT_DIR"): - plugin_root = os.environ[plugin.upper()+"_ROOT_DIR"] - pass - pass - if plugin_root != "": - os.environ["SMESH_MeshersList"] \ - = os.environ["SMESH_MeshersList"]+":"+plugin - if not os.environ.has_key("SALOME_"+plugin+"Resources"): - os.environ["SALOME_"+plugin+"Resources"] \ - = plugin_root+"/share/"+args["appname"]+"/resources" - add_path(os.path.join(plugin_root,"lib",python_version, - "site-packages",salome_subdir), - "PYTHONPATH") - add_path(os.path.join(plugin_root,"lib",salome_subdir), - "PYTHONPATH") - add_path(os.path.join(plugin_root,"lib",salome_subdir), - "LD_LIBRARY_PATH") - add_path(os.path.join(plugin_root,"bin",salome_subdir), - "PYTHONPATH") - add_path(os.path.join(plugin_root,"bin",salome_subdir), - "PATH") - pass - pass - - # set environment for SUPERV module - os.environ["ENABLE_MACRO_NODE"]="1" - # set resources variables if not yet set - # Done now by launchConfigureParser.py - #if os.getenv("GUI_ROOT_DIR"): - #if not os.getenv("SUITRoot"): os.environ["SUITRoot"] = os.getenv("GUI_ROOT_DIR") + "/share/salome" - #if not os.getenv("SalomeAppConfig"): os.environ["SalomeAppConfig"] = os.getenv("GUI_ROOT_DIR") + "/share/salome/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["KERNEL"],"share", - salome_subdir,"resources") - os.environ["CSF_SALOMEDS_ResourcesDefaults"] \ - = os.path.join(modules_root_dir["KERNEL"],"share", - salome_subdir,"resources") - - if "GEOM" in modules_list: - print "GEOM OCAF Resources" - os.environ["CSF_GEOMDS_ResourcesDefaults"] \ - = os.path.join(modules_root_dir["GEOM"],"share", - salome_subdir,"resources") - print "GEOM Shape Healing Resources" - os.environ["CSF_ShHealingDefaults"] \ - = os.path.join(modules_root_dir["GEOM"],"share", - salome_subdir,"resources") +import setenv +from server import * +from launchConfigureParser import verbose +#process_id = {} move to server.py # ----------------------------------------------------------------------------- @@ -278,42 +71,12 @@ def kill_salome(args): killAllPorts() elif args['portkill']: givenPortKill(str(args['port'])) - + # ----------------------------------------------------------------------------- # # Definition des classes d'objets pour le lancement des Server CORBA # -class Server: - """Generic class for CORBA server launch""" - - def initArgs(self): - self.PID=None - self.CMD=[] - self.ARGS=[] - if self.args['xterm']: - self.ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-hold'] - - def __init__(self,args): - self.args=args - self.initArgs() - - - def run(self): - global process_id - myargs=self.ARGS - if self.args['xterm']: - # (Debian) send LD_LIBRARY_PATH to children shells (xterm) - env_ld_library_path=['env', 'LD_LIBRARY_PATH=' - + os.getenv("LD_LIBRARY_PATH")] - myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path - command = myargs + self.CMD - print "command = ", command - pid = os.spawnvp(os.P_NOWAIT, command[0], command) - process_id[pid]=self.CMD - self.PID = pid - - class InterpServer(Server): def __init__(self,args): self.args=args @@ -324,8 +87,12 @@ class InterpServer(Server): def run(self): global process_id command = self.CMD - #print "command = ", command - pid = os.spawnvp(os.P_NOWAIT, command[0], command) + print "INTERPSERVER::command = ", command + if sys.platform == "win32": + import win32pm + pid = win32pm.spawnpid( string.join(command, " "),'-nc' ) + else: + pid = os.spawnvp(os.P_NOWAIT, command[0], command) process_id[pid]=self.CMD self.PID = pid @@ -335,6 +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: self.SCMD1=['SALOME_ModuleCatalog_Server','-common'] self.SCMD2=[] home_dir=os.getenv('HOME') @@ -354,13 +124,25 @@ class CatalogServer(Server): module_root_dir=modules_root_dir[module] module_cata=module+"Catalog.xml" #print " ", module_cata - cata_path.extend( - glob.glob(os.path.join(module_root_dir, - "share",salome_subdir, - "resources",module_cata))) + if os.path.exists(os.path.join(module_root_dir, + "share",setenv.salome_subdir, + "resources",module.lower(), + module_cata)): + cata_path.extend( + glob.glob(os.path.join(module_root_dir, + "share",setenv.salome_subdir, + "resources",module.lower(), + module_cata))) + else: + cata_path.extend( + glob.glob(os.path.join(module_root_dir, + "share",setenv.salome_subdir, + "resources", + module_cata))) pass pass - self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2 + #self.CMD=self.SCMD1 + ['\"']+[string.join(cata_path,'\"::\"')] + ['\"'] + self.SCMD2 + self.CMD=self.SCMD1 + ['\"' + string.join(cata_path,'\"::\"') + '\"'] + self.SCMD2 # --- @@ -372,6 +154,14 @@ class SalomeDSServer(Server): # --- +class ConnectionManagerServer(Server): + def __init__(self,args): + self.args=args + self.initArgs() + self.CMD=['SALOME_ConnectionManagerServer'] + +# --- + class RegistryServer(Server): def __init__(self,args): self.args=args @@ -392,7 +182,10 @@ class ContainerPYServer(Server): def __init__(self,args): self.args=args self.initArgs() - self.CMD=['SALOME_ContainerPy.py','FactoryServerPy'] + if sys.platform == "win32": + self.CMD=[os.environ["PYTHONBIN"], '\"'+os.environ["KERNEL_ROOT_DIR"] + '/bin/salome/SALOME_ContainerPy.py'+'\"','FactoryServerPy'] + else: + self.CMD=['SALOME_ContainerPy.py','FactoryServerPy'] # --- @@ -400,6 +193,9 @@ class ContainerSUPERVServer(Server): def __init__(self,args): self.args=args self.initArgs() + # if sys.platform == "win32": +# self.CMD=[os.environ["KERNEL_ROOT_DIR"] + "/win32/" + os.environ["BIN_ENV"] + "/" + 'SALOME_Container' + ".exe",'SuperVisionContainer'] +# else: self.CMD=['SALOME_Container','SuperVisionContainer'] # --- @@ -408,7 +204,10 @@ class LoggerServer(Server): def __init__(self,args): self.args=args self.initArgs() - self.CMD=['SALOME_Logger_Server', 'logger.log'] + if sys.platform == "win32": + self.CMD=['SALOME_Logger_Server', os.environ["HOME"] + "/logger.log"]; + else: + self.CMD=['SALOME_Logger_Server', 'logger.log'] # --- @@ -416,7 +215,7 @@ 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'] @@ -441,19 +240,30 @@ class SessionServer(Server): self.SCMD2+=['CPP'] if 'pyContainer' in self.args['standalone'] or 'pyContainer' in self.args['embedded']: self.SCMD2+=['PY'] - if 'supervContainer' in self.args['containers'] or 'supervContainer' in self.args['standalone']: + if 'supervContainer' in self.args['standalone']: self.SCMD2+=['SUPERV'] if self.args['gui']: - self.SCMD2+=['GUI'] - if self.args['splash'] and self.args['gui']: - self.SCMD2+=['SPLASH'] + session_gui = True + if self.args.has_key('session_gui'): + session_gui = self.args['session_gui'] + if session_gui: + self.SCMD2+=['GUI'] + if self.args['splash']: + self.SCMD2+=['SPLASH'] + pass + if self.args['study_hdf'] is not None: + self.SCMD2+=['--study-hdf=%s'%self.args['study_hdf']] + pass + pass + pass if self.args['noexcepthandler']: self.SCMD2+=['noexcepthandler'] + if self.args.has_key('user_config'): + self.SCMD2+=['--resources=%s'%self.args['user_config']] if self.args.has_key('modules'): - self.SCMD2+=['--modules ('] - for mod in self.args['modules']: - self.SCMD2+=[mod + ':'] - self.SCMD2+=[')'] + self.SCMD2+=['--modules (%s)'%":".join(self.args['modules'])] + if self.args.has_key('pyscript') and len(self.args['pyscript']) > 0: + self.SCMD2+=['--pyscript=%s'%(",".join(self.args['pyscript']))] def setpath(self,modules_list,modules_root_dir): cata_path=[] @@ -467,22 +277,34 @@ class SessionServer(Server): module_root_dir=modules_root_dir[module] module_cata=module+"Catalog.xml" #print " ", module_cata - cata_path.extend( - glob.glob(os.path.join(module_root_dir,"share", - salome_subdir,"resources", - module_cata))) + if os.path.exists(os.path.join(module_root_dir, + "share",setenv.salome_subdir, + "resources",module.lower(), + module_cata)): + cata_path.extend( + glob.glob(os.path.join(module_root_dir,"share", + setenv.salome_subdir,"resources", + module.lower(),module_cata))) + else: + cata_path.extend( + glob.glob(os.path.join(module_root_dir,"share", + setenv.salome_subdir,"resources", + module_cata))) + pass if (self.args["gui"]) & ('moduleCatalog' in self.args['embedded']): - self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2 + #Use '::' instead ":" because drive path with "D:\" is invalid on windows platform + #self.CMD=self.SCMD1 + ['\"']+[string.join(cata_path,'\"::\"')] + ['\"'] + self.SCMD2 + self.CMD=self.SCMD1 + ['\"' + string.join(cata_path,'\"::\"') + '\"'] + self.SCMD2 else: self.CMD=self.SCMD1 + self.SCMD2 # --- -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']: @@ -508,10 +330,19 @@ class ContainerManagerServer(Server): module_root_dir=modules_root_dir[module] module_cata=module+"Catalog.xml" #print " ", module_cata - cata_path.extend( - glob.glob(os.path.join(module_root_dir,"share", - self.args['appname'],"resources", - module_cata))) + if os.path.exists(os.path.join(module_root_dir, + "share",setenv.salome_subdir, + "resources",module.lower(), + module_cata)): + cata_path.extend( + glob.glob(os.path.join(module_root_dir,"share", + setenv.salome_subdir,"resources", + module.lower(),module_cata))) + else: + cata_path.extend( + glob.glob(os.path.join(module_root_dir,"share", + setenv.salome_subdir,"resources", + module_cata))) pass pass if (self.args["gui"]) & ('moduleCatalog' in self.args['embedded']): @@ -526,7 +357,7 @@ class NotifyServer(Server): self.modules_root_dir=modules_root_dir myLogName = os.environ["LOGNAME"] self.CMD=['notifd','-c', - self.modules_root_dir["KERNEL"] +'/share/salome/resources/channel.cfg', + self.modules_root_dir["KERNEL"] +'/share/salome/resources/kernel/channel.cfg', '-DFactoryIORFileName=/tmp/'+myLogName+'_rdifact.ior', '-DChannelIORFileName=/tmp/'+myLogName+'_rdichan.ior', '-DReportLogFile=/tmp/'+myLogName+'_notifd.report', @@ -555,13 +386,25 @@ def startSalome(args, modules_list, modules_root_dir): """Launch all SALOME servers requested by args""" init_time = os.times() - print "startSalome ", args + if verbose(): print "startSalome ", args # # Initialisation ORB et Naming Service # - clt=orbmodule.client() + clt=orbmodule.client(args) + # Save Naming service port name into + # the file args["ns_port_log_file"] + if args.has_key('ns_port_log_file'): + home = os.environ['HOME'] + appli= os.environ.get("APPLI") + if appli is not None: + home='%s/%s'%(home,appli) + pass + file_name= '%s/%s'%(home, args["ns_port_log_file"]) + f = open(file_name, "w") + f.write(os.environ['NSPORT']) + f.close() # (non obligatoire) Lancement Logger Server # et attente de sa disponibilite dans le naming service @@ -575,10 +418,13 @@ def startSalome(args, modules_list, modules_root_dir): # Notify Server launch # - print "Notify Server to launch" + if verbose(): print "Notify Server to launch" - myServer=NotifyServer(args,modules_root_dir) - myServer.run() + if sys.platform != "win32": + print "Notify Server to launch" + + myServer=NotifyServer(args,modules_root_dir) + myServer.run() # Lancement Session Server (to show splash ASAP) # @@ -596,7 +442,10 @@ def startSalome(args, modules_list, modules_root_dir): if ('registry' not in args['embedded']) | (args["gui"] == 0) : myServer=RegistryServer(args) myServer.run() - clt.waitNSPID("/Registry",myServer.PID) + if sys.platform == "win32": + clt.waitNS("/Registry") + else: + clt.waitNSPID("/Registry",myServer.PID) # # Lancement Catalog Server, @@ -609,7 +458,10 @@ def startSalome(args, modules_list, modules_root_dir): cataServer.setpath(modules_list,modules_root_dir) cataServer.run() import SALOME_ModuleCatalog - clt.waitNSPID("/Kernel/ModulCatalog",cataServer.PID,SALOME_ModuleCatalog.ModuleCatalog) + if sys.platform == "win32": + clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog) + else: + clt.waitNSPID("/Kernel/ModulCatalog",cataServer.PID,SALOME_ModuleCatalog.ModuleCatalog) # # Lancement SalomeDS Server, @@ -621,16 +473,26 @@ def startSalome(args, modules_list, modules_root_dir): print "RunStudy" myServer=SalomeDSServer(args) myServer.run() - clt.waitNSPID("/myStudyManager",myServer.PID) + if sys.platform == "win32": + clt.waitNS("/myStudyManager") + else: + clt.waitNSPID("/myStudyManager",myServer.PID) # - # Lancement ContainerManagerServer + # Lancement LauncherServer # - myCmServer = ContainerManagerServer(args) + myCmServer = LauncherServer(args) myCmServer.setpath(modules_list,modules_root_dir) myCmServer.run() + # + # Launch ConnectionManagerServer + # + + myConnectionServer = ConnectionManagerServer(args) + myConnectionServer.run() + from Utils_Identity import getShortHostName @@ -647,10 +509,13 @@ 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']: + if ('cppContainer' in args['standalone']) | (args["gui"] == 0) : myServer=ContainerCPPServer(args) myServer.run() - clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",myServer.PID) + if sys.platform == "win32": + clt.waitNS("/Containers/" + theComputer + "/FactoryServer") + else: + clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",myServer.PID) # # Lancement Container Python local, @@ -661,7 +526,10 @@ def startSalome(args, modules_list, modules_root_dir): if 'pyContainer' in args['standalone']: myServer=ContainerPYServer(args) myServer.run() - clt.waitNSPID("/Containers/" + theComputer + "/FactoryServerPy",myServer.PID) + if sys.platform == "win32": + clt.waitNS("/Containers/" + theComputer + "/FactoryServerPy") + else: + clt.waitNSPID("/Containers/" + theComputer + "/FactoryServerPy",myServer.PID) # # Lancement Container Supervision local, @@ -672,8 +540,11 @@ def startSalome(args, modules_list, modules_root_dir): if 'supervContainer' in args['standalone']: myServer=ContainerSUPERVServer(args) myServer.run() - clt.waitNSPID("/Containers/" + theComputer + "/SuperVisionContainer",myServer.PID) - + if sys.platform == "win32": + clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer") + else: + clt.waitNSPID("/Containers/" + theComputer + "/SuperVisionContainer",myServer.PID) + # # Attente de la disponibilite du Session Server dans le Naming Service # @@ -688,10 +559,12 @@ def startSalome(args, modules_list, modules_root_dir): reload(SALOME) reload(SALOMEDS) import SALOME_Session_idl - session=clt.waitNSPID("/Kernel/Session",mySessionServ.PID,SALOME.Session) - + if sys.platform == "win32": + session=clt.waitNS("/Kernel/Session",SALOME.Session) + else: + session=clt.waitNSPID("/Kernel/Session",mySessionServ.PID,SALOME.Session) end_time = os.times() - print + if verbose(): print print "Start SALOME, elapsed time : %5.1f seconds"% (end_time[4] - init_time[4]) @@ -706,8 +579,7 @@ def startSalome(args, modules_list, modules_root_dir): try: if 'interp' in args: - if args['interp']: - nbaddi = int(args['interp'][0]) + nbaddi = args['interp'] except: import traceback traceback.print_exc() @@ -721,7 +593,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 # ----------------------------------------------------------------------------- @@ -732,6 +608,7 @@ def useSalome(args, modules_list, modules_root_dir): save list of process, give info to user, show registered objects in Naming Service. """ + global process_id clt=None try: @@ -741,7 +618,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 @@ -761,7 +638,7 @@ def useSalome(args, modules_list, modules_root_dir): pickle.dump(process_ids,fpid) fpid.close() - print """ + if verbose(): print """ Saving of the dictionary of Salome processes in %s To kill SALOME processes from a console (kill all sessions from all ports): python killSalome.py @@ -780,9 +657,36 @@ def useSalome(args, modules_list, modules_root_dir): # if clt != None: - print - print " --- registered objects tree in Naming Service ---" - clt.showNS() + if verbose(): + print + print " --- registered objects tree in Naming Service ---" + clt.showNS() + pass + + # run python scripts, passed via --execute option + toimport = [] + if args.has_key('pyscript'): + if args.has_key('gui') and args.has_key('session_gui'): + if not args['gui'] or not args['session_gui']: + toimport = args['pyscript'] + i = 0 + while i < len( toimport ) : + if toimport[ i ] == 'killall': + clt.showNS() + killAllPorts() + import sys + sys.exit(0) + else: + scrname = toimport[ i ] + if len(scrname) > 2 and (len(scrname) - string.rfind(scrname, ".py") == 3): + print 'executing',scrname + doexec = 'execfile(\"%s\")'%scrname + exec doexec + else: + print 'importing',scrname + doimport = 'import ' + scrname + exec doimport + i = i + 1 return clt @@ -793,7 +697,12 @@ def registerEnv(args, modules_list, modules_root_dir): Register args, modules_list, modules_root_dir in a file for further use, when SALOME is launched embedded in an other application. """ - fileEnv = '/tmp/' + os.getenv('USER') + "_" + str(args['port']) \ + if sys.platform == "win32": + fileEnv = os.getenv('TEMP') + else: + fileEnv = '/tmp/' + + fileEnv += os.getenv('USER') + "_" + str(args['port']) \ + '_' + args['appname'].upper() + '_env' fenv=open(fileEnv,'w') pickle.dump((args, modules_list, modules_root_dir),fenv) @@ -802,6 +711,104 @@ def registerEnv(args, modules_list, modules_root_dir): # ----------------------------------------------------------------------------- +def searchFreePort(args, save_config=1): + print "Searching for a free port for naming service:", + NSPORT=2810 + limit=NSPORT + limit=limit+10 + while 1: + import os + 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) + # + system('hostname > %s'%(tmp_file)) + f = open(tmp_file) + myhost = f.read() + myhost = myhost[:-1] + f.close() + + os.remove( tmp_file ); + + # + home = os.environ['HOME'] + appli=os.environ.get("APPLI") + if appli is not None: + home='%s/%s'%(home,appli) + pass + # + os.environ['OMNIORB_CONFIG'] = '%s/.omniORB_%s_%s.cfg'%(home, myhost, NSPORT) + initref = "NameService=corbaname::%s:%s"%(myhost, NSPORT) + os.environ['NSPORT'] = "%s"%(NSPORT) + os.environ['NSHOST'] = "%s"%(myhost) + 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() + args['port'] = os.environ['NSPORT'] + # + if save_config: + from os import system + 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 + print "%s"%(NSPORT), + if NSPORT == limit: + msg = "\n" + msg += "Can't find a free port to launch omniNames\n" + msg += "Try to kill the running servers and then launch SALOME again.\n" + raise msg + NSPORT=NSPORT+1 + pass + return + +# ----------------------------------------------------------------------------- + def no_main(): """Salome Launch, when embedded in other application""" fileEnv = os.environ["SALOME_LAUNCH_CONFIG"] @@ -809,6 +816,7 @@ def no_main(): args, modules_list, modules_root_dir = pickle.load(fenv) fenv.close() kill_salome(args) + searchFreePort(args, 0) clt = useSalome(args, modules_list, modules_root_dir) return clt @@ -816,9 +824,15 @@ def no_main(): def main(): """Salome launch as a main application""" - args, modules_list, modules_root_dir = get_config() + import sys + print "runSalome running on ",os.getenv('HOSTNAME') + args, modules_list, modules_root_dir = setenv.get_config() kill_salome(args) - set_env(args, modules_list, modules_root_dir) + save_config = True + if args.has_key('save_config'): + save_config = args['save_config'] + searchFreePort(args, save_config) + setenv.main() clt = useSalome(args, modules_list, modules_root_dir) return clt,args diff --git a/bin/salomeConsole.py b/bin/salomeConsole.py index c7875d06c..8a429ddf5 100755 --- a/bin/salomeConsole.py +++ b/bin/salomeConsole.py @@ -79,7 +79,7 @@ print sys.argv #sys.argv=sys.argv+['-ORBInitRef','NameService=IOR:010000000100000000000000010000000000000023000000010100000a0000006c6f63616c686f737400fa0a0b0000004e616d6553657276696365'] class client(orbmodule.client): - def initNS(self): + def initNS(self,args): # Obtain a reference to the root naming context obj = self.orb.resolve_initial_references("NameService") try: diff --git a/bin/salome_session.py b/bin/salome_session.py index d43e144a7..870b53bc4 100644 --- a/bin/salome_session.py +++ b/bin/salome_session.py @@ -63,7 +63,7 @@ def searchFreePort(): f = open(omniorb_config, "w") f.write("ORBInitRef NameService=corbaname::%s:%s\n"%(hostname, NSPORT)) f.close() - last_running_config = '%s/.omniORB_%s_last.cfg'%(home, hostname) + last_running_config = '%s/.omniORB_last.cfg'%(home, hostname) os.environ['LAST_RUNNING_CONFIG'] = last_running_config if os.access(last_running_config,os.F_OK): os.unlink(last_running_config) diff --git a/bin/server.py b/bin/server.py new file mode 100755 index 000000000..98b2ef95b --- /dev/null +++ b/bin/server.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python + +import os, sys, string +process_id = {} + +# ----------------------------------------------------------------------------- +# +# Definition des classes d'objets pour le lancement des Server CORBA +# + +class Server: + """Generic class for CORBA server launch""" + + def initArgs(self): + self.PID=None + self.CMD=[] + self.ARGS=[] + if self.args.get('xterm'): + self.ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-hold'] + + def __init__(self,args): + self.args=args + self.initArgs() + + + def run(self): + global process_id + myargs=self.ARGS + if self.args.get('xterm'): + # (Debian) send LD_LIBRARY_PATH to children shells (xterm) + env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + + 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": + 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) + 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 new file mode 100755 index 000000000..7e1b93d80 --- /dev/null +++ b/bin/setenv.py @@ -0,0 +1,298 @@ +#!/usr/bin/env python + +# 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 +# + +import sys, os, string, glob, time, pickle +import orbmodule +from launchConfigureParser import verbose + +# this file is extraction of set_env from runSalome.py +# for reusage in automated tests + +# salome_subdir variable is used for composing paths like $KERNEL_ROOT_DIR/share/salome/resources, etc. +# before moving to SUIT-based gui, instead of salome_subdir there was args['appname'] used. +# but after - 'appname' = "SalomeApp", so using it in making the subdirectory is an error. +salome_subdir = "salome" + + +# ----------------------------------------------------------------------------- + +def add_path(directory, variable_name): + """Function helper to add environment variables""" + if sys.platform == "win32": + splitsym = ";" + else: + splitsym = ":" + if not os.environ.has_key(variable_name): + os.environ[variable_name] = "" + pass + if os.path.exists(directory): + newpath=[] + for _dir in os.environ[variable_name].split(splitsym): + if os.path.exists(_dir): + if sys.platform != "win32": + if not os.path.samefile(_dir, directory): + newpath.append(_dir) + else: + newpath.append(_dir) + else: + if os.path.abspath(_dir) != os.path.abspath(directory): + newpath.append(_dir) + pass + import string + newpath[:0] = [ directory ] + newpath = string.join(newpath, splitsym) + os.environ[variable_name] = newpath + if variable_name == "PYTHONPATH": + sys.path[:0] = [directory] + +# ----------------------------------------------------------------------------- + +__lib__dir__ = None +def get_lib_dir(): + global __lib__dir__ + if __lib__dir__: return __lib__dir__ + import platform + if platform.architecture()[0] == "64bit": + if platform.machine() == "ia64": + __lib__dir__ = "lib" + else: + __lib__dir__ = "lib64" + else: + __lib__dir__ = "lib" + return __lib__dir__ + +# ----------------------------------------------------------------------------- + +def get_config(): + """ + Get list of modules, paths. + + Read args from launch configure xml file and command line options. + Check variables _ROOT_DIR and set list of used modules. + Return args, modules_list, modules_root_dir + """ + + # read args from launch configure xml file and command line options + + #*** Test additional option + #*** import optparse + #*** help_str = "Test options addition." + #*** o_j = optparse.Option("-j", "--join", action="store_true", dest="join", help=help_str) + + import launchConfigureParser + args = launchConfigureParser.get_env() + + #*** Test additional option + #*** args = launchConfigureParser.get_env([o_j]) + #*** if args.has_key("join"): print args["join"] + + # Check variables _ROOT_DIR + # and set list of used modules (without KERNEL) + + modules_list = [] + if args.has_key("modules"): + modules_list += args["modules"] + # KERNEL must be last in the list to locate it at the first place in PATH + if args["gui"] : + modules_list[:0] = ["GUI"] + modules_list[:0] = ["KERNEL"] + modules_list.reverse() + + modules_root_dir = {} + + to_remove_list=[] + for module in modules_list : + module_variable=module+"_ROOT_DIR" + if not os.environ.has_key(module_variable): + print "*******************************************************" + print "*" + print "* Environment variable",module_variable,"must be set" + print "* Module", module, "will be not available" + print "*" + print "********************************************************" + to_remove_list.append(module) + continue + pass + module_root_dir = os.environ[module_variable] + modules_root_dir[module]=module_root_dir + + for to_remove in to_remove_list: + modules_list.remove(to_remove) + + while "KERNEL" in modules_list: + modules_list.remove("KERNEL") + pass + + while "GUI" in modules_list: + modules_list.remove("GUI") + pass + + if "SUPERV" in modules_list and not 'supervContainer' in args['standalone']: + args['standalone'].append("supervContainer") + pass + + return args, modules_list, modules_root_dir + +# ----------------------------------------------------------------------------- + +def set_env(args, modules_list, modules_root_dir): + """Add to the PATH-variables modules specific paths""" + + 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"] + for module in modules_list : + if modules_root_dir.has_key(module): + module_root_dir = modules_root_dir[module] + modules_root_dir_list[:0] = [module_root_dir] + if sys.platform == "win32": + add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir), + "PATH") + else: + add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir), + "LD_LIBRARY_PATH") + add_path(os.path.join(module_root_dir,"bin",salome_subdir), + "PATH") + if os.path.exists(module_root_dir + "/examples") : + add_path(os.path.join(module_root_dir,"examples"), + "PYTHONPATH") + pass + add_path(os.path.join(module_root_dir,"bin",salome_subdir), + "PYTHONPATH") + # add lib before site-packages to load script instead of dll if any (win32 platform) + add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir), + "PYTHONPATH") + add_path(os.path.join(module_root_dir,get_lib_dir(), + python_version,"site-packages", + salome_subdir), + "PYTHONPATH") + add_path(os.path.join(module_root_dir,get_lib_dir(), + python_version,"site-packages", + salome_subdir, + "shared_modules"), + "PYTHONPATH") + pass + pass + + if sys.platform == 'win32': + os.environ["SALOMEPATH"]=";".join(modules_root_dir_list) + else: + os.environ["SALOMEPATH"]=":".join(modules_root_dir_list) + + # set trace environment variable + + if not os.environ.has_key("SALOME_trace"): + os.environ["SALOME_trace"]="local" + if args['file']: + os.environ["SALOME_trace"]="file:"+args['file'][0] + if args['logger']: + os.environ["SALOME_trace"]="with_logger" + + # set environment for SMESH plugins + + if "SMESH" in modules_list: + os.environ["SMESH_MeshersList"]="StdMeshers" + if not os.environ.has_key("SALOME_StdMeshersResources"): + os.environ["SALOME_StdMeshersResources"] \ + = modules_root_dir["SMESH"]+"/share/"+salome_subdir+"/resources/smesh" + pass + if args.has_key("SMESH_plugins"): + for plugin in args["SMESH_plugins"]: + plugin_root = "" + if os.environ.has_key(plugin+"_ROOT_DIR"): + plugin_root = os.environ[plugin+"_ROOT_DIR"] + else: + # workaround to avoid modifications of existing environment + if os.environ.has_key(plugin.upper()+"_ROOT_DIR"): + plugin_root = os.environ[plugin.upper()+"_ROOT_DIR"] + pass + pass + if plugin_root != "": + os.environ["SMESH_MeshersList"] \ + = os.environ["SMESH_MeshersList"]+":"+plugin + if not os.environ.has_key("SALOME_"+plugin+"Resources"): + os.environ["SALOME_"+plugin+"Resources"] \ + = plugin_root+"/share/"+salome_subdir+"/resources/"+plugin.lower() + add_path(os.path.join(plugin_root,get_lib_dir(),python_version, + "site-packages",salome_subdir), + "PYTHONPATH") + add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), + "PYTHONPATH") + + + 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") + add_path(os.path.join(plugin_root,"bin",salome_subdir), + "PYTHONPATH") + add_path(os.path.join(plugin_root,"bin",salome_subdir), + "PATH") + pass + pass + + # set environment for SUPERV module + os.environ["ENABLE_MACRO_NODE"]="1" + # set resources variables if not yet set + # Done now by launchConfigureParser.py + #if os.getenv("GUI_ROOT_DIR"): + #if not os.getenv("SalomeAppConfig"): os.environ["SalomeAppConfig"] = os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui" + + 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" + + # 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") + if verbose(): print "GEOM Shape Healing Resources" + os.environ["CSF_ShHealingDefaults"] \ + = os.path.join(modules_root_dir["GEOM"],"share", + salome_subdir,"resources","geom") + +# ----------------------------------------------------------------------------- + +def main(): + args, modules_list, modules_root_dir = get_config() + set_env(args, modules_list, modules_root_dir) + return args + +# ----------------------------------------------------------------------------- + +if __name__ == "__main__": + import user + args = main() 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 edbfbe193..4efd5979f 100644 --- a/bin/virtual_salome.py +++ b/bin/virtual_salome.py @@ -30,6 +30,10 @@ install module KERNEL in the current directory import sys, os, optparse, shutil,glob,fnmatch py_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1]) +verbose=0 + +# ----------------------------------------------------------------------------- + def mkdir(path): """Create a directory and all the intermediate directories if path does not exist""" if not os.path.exists(path): @@ -41,6 +45,8 @@ def mkdir(path): pass pass +# ----------------------------------------------------------------------------- + def symlink(src, dest): """Create a link if it does not exist""" if not os.path.exists(dest): @@ -53,6 +59,8 @@ def symlink(src, dest): pass pass +# ----------------------------------------------------------------------------- + def rmtree(dir): """Remove (recursive) a directory if it exists""" if os.path.exists(dir): @@ -65,53 +73,49 @@ def rmtree(dir): pass pass -def main(): - usage="""usage: %prog [options] -Typical use is: - python virtual_salome.py -v --prefix="." --module=/local/chris/SALOME2/RELEASES/Install/KERNEL_V3_1_0b1 -""" - parser = optparse.OptionParser(usage=usage) - - parser.add_option('-v', '--verbose', action='count', dest='verbose', - default=0, help="Increase verbosity") +# ----------------------------------------------------------------------------- - parser.add_option('--prefix', dest="prefix", default='.', - help="The base directory to install to (default .)") +__lib__dir__ = None +def get_lib_dir(): + global __lib__dir__ + if __lib__dir__: return __lib__dir__ + import platform + if platform.architecture()[0] == "64bit": + if platform.machine() == "ia64": + __lib__dir__ = "lib" + else: + __lib__dir__ = "lib64" + else: + __lib__dir__ = "lib" + return __lib__dir__ - parser.add_option('--module', dest="module", - help="The module directory to install in (mandatory)") +# ----------------------------------------------------------------------------- - parser.add_option('--clear', dest='clear', action='store_true', - help="Clear out the install and start from scratch") - - options, args = parser.parse_args() - global verbose +def link_module(options): if not options.module: print "Option module is mandatory" return - module_dir=options.module + module_dir=os.path.abspath(options.module) if not os.path.exists(module_dir): print "Module %s does not exist" % module_dir return home_dir = os.path.expanduser(options.prefix) - #module_dir="/local/chris/SALOME2/RELEASES/Install/KERNEL_V3_1_0b1" module_bin_dir=os.path.join(module_dir,'bin','salome') - module_lib_dir=os.path.join(module_dir,'lib','salome') - module_lib_py_dir=os.path.join(module_dir,'lib',py_version,'site-packages','salome') - module_lib_py_shared_dir=os.path.join(module_dir,'lib',py_version, + module_lib_dir=os.path.join(module_dir,get_lib_dir(),'salome') + module_lib_py_dir=os.path.join(module_dir,get_lib_dir(),py_version,'site-packages','salome') + module_lib_py_shared_dir=os.path.join(module_dir,get_lib_dir(),py_version, 'site-packages','salome','shared_modules') module_share_dir=os.path.join(module_dir,'share','salome','resources') module_doc_gui_dir=os.path.join(module_dir,'doc','salome','gui') module_doc_tui_dir=os.path.join(module_dir,'doc','salome','tui') module_doc_dir=os.path.join(module_dir,'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_dir=os.path.join(module_dir,'share','doc','salome') + 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') @@ -122,51 +126,97 @@ Typical use is: doc_gui_dir=os.path.join(home_dir,'doc','salome','gui') 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 if options.clear: rmtree(bin_dir) rmtree(lib_dir) + rmtree(lib_py_dir) rmtree(share_dir) rmtree(doc_dir) + rmtree(sharedoc_dir) pass #directory bin/salome : create it and link content - mkdir(bin_dir) - for fn in os.listdir(module_bin_dir): - # if os.path.splitext(fn)[1] not in (".pyc",".pyo"): #Compiled python are excluded - symlink(os.path.join(module_bin_dir, fn), os.path.join(bin_dir, fn)) + if os.path.exists(module_bin_dir): + mkdir(bin_dir) + for fn in os.listdir(module_bin_dir): + symlink(os.path.join(module_bin_dir, fn), os.path.join(bin_dir, fn)) + pass pass + else: + print module_bin_dir, " doesn't exist" + pass #directory lib/salome : create it and link content - mkdir(lib_dir) - for fn in os.listdir(module_lib_dir): - symlink(os.path.join(module_lib_dir, fn), os.path.join(lib_dir, fn)) - + if os.path.exists(module_lib_dir): + mkdir(lib_dir) + for fn in os.listdir(module_lib_dir): + symlink(os.path.join(module_lib_dir, fn), os.path.join(lib_dir, fn)) + pass + pass + else: + print module_lib_dir, " doesn't exist" + 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 os.path.splitext(fn)[1] not in (".pyc",".pyo"): #Compiled python are excluded - if os.path.split(fn)[1] != "shared_modules": + if not os.path.exists(module_lib_py_dir): + print "Python directory %s does not exist" % module_lib_py_dir + else: + 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 - pass - if os.path.exists(module_lib_py_shared_dir): - for fn in os.listdir(module_lib_py_shared_dir): - # if os.path.splitext(fn)[1] not in (".pyc",".pyo"): #Compiled python are excluded - symlink(os.path.join(module_lib_py_shared_dir, fn), os.path.join(lib_py_shared_dir, fn)) + 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 - else: - print module_lib_py_shared_dir, " doesn't exist" - 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): @@ -193,7 +243,34 @@ Typical use is: symlink(os.path.join(module_doc_tui_dir, fn), os.path.join(doc_tui_dir, fn)) pass pass + +# ----------------------------------------------------------------------------- + +def main(): + usage="""usage: %prog [options] +Typical use is: + python virtual_salome.py -v --prefix="." --module=/local/chris/SALOME2/RELEASES/Install/KERNEL_V3_1_0b1 +""" + parser = optparse.OptionParser(usage=usage) + + parser.add_option('-v', '--verbose', action='count', dest='verbose', + default=0, help="Increase verbosity") + + parser.add_option('--prefix', dest="prefix", default='.', + help="The base directory to install to (default .)") + + parser.add_option('--module', dest="module", + help="The module directory to install in (mandatory)") + + parser.add_option('--clear', dest='clear', action='store_true', + help="Clear out the install and start from scratch") + + options, args = parser.parse_args() + link_module(options) + pass +# ----------------------------------------------------------------------------- + if __name__ == '__main__': main() pass 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 0161290f1..4d28fad9f 100644 --- a/configure.ac +++ b/configure.ac @@ -4,25 +4,23 @@ # ================================================================ # #AC_PREREQ(2.59) -#AC_INIT(src) -AC_INIT([Salome2 Project], [3.2.0], [gboulant@CS], [salome]) +AC_INIT([Salome2 Project], [4.1.1], [paul.rascle@edf.fr], [SalomeKer]) # AC_CONFIG_AUX_DIR defines an alternative directory where to find the auxiliary # scripts such as config.guess, install-sh, ... AC_CONFIG_AUX_DIR(salome_adm/unix/config_files) AC_CANONICAL_HOST AC_CANONICAL_TARGET -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([tar-pax]) #AC_CONFIG_HEADER([config.h]) -PACKAGE=salome -AC_SUBST(PACKAGE) - -VERSION=3.2.0 -XVERSION=0x030200 -AC_SUBST(VERSION) +XVERSION=0x040101 AC_SUBST(XVERSION) +# set up MODULE_NAME variable for dynamic construction of directories (resources, etc.) +MODULE_NAME=kernel +AC_SUBST(MODULE_NAME) + echo echo --------------------------------------------- echo Initialize source and build root directories @@ -100,8 +98,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 --------------------------------------------- @@ -182,14 +180,6 @@ echo CHECK_HDF5 -echo -echo --------------------------------------------- -echo Testing OpenCascade -echo --------------------------------------------- -echo - -CHECK_CAS - # ---------------------------------------------------------------------------- # --- test corba @@ -240,20 +230,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 @@ -261,7 +250,7 @@ fi echo echo ============================================================ -echo testing optionnal products +echo testing parallel products echo ============================================================ echo @@ -273,6 +262,48 @@ echo CHECK_MPI +echo +echo --------------------------------------------- +echo checking if PaCO++ is requested by user +echo --------------------------------------------- +echo + +CHECK_PACO + +echo +echo ------------------------------------------------------------ +echo checking if parallel kernel extensions are requested by user +echo ------------------------------------------------------------ +echo + +AC_MSG_CHECKING(whether to enable parallel kernel extension) +AC_ARG_ENABLE(parallel_extension, + AC_HELP_STRING([--enable-parallel_extension], [parallel kernel extension = [no/yes] (default is no)]), + parallel_extension_ok=$enableval, + parallel_extension_ok=no) +if test "x$parallel_extension_ok" = "xyes" +then + if test "x$PaCO_ok" = "xno" + then + parallel_extension_ok=no + fi +fi + +if test "x$parallel_extension_ok" = "xyes" +then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + +AM_CONDITIONAL([WITH_PACO_PARALLEL], [test "x$parallel_extension_ok" = "xyes"]) + +echo +echo ============================================================ +echo testing optionnal products +echo ============================================================ +echo + echo echo --------------------------------------------- echo Testing Batch @@ -378,9 +409,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: @@ -388,7 +419,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 omniORBpy_ok boost_ok libxml_ok" if test x$corba_gen = xtrue; then echo --- CORBA mandatory products - default configuration: summary $corba_mandatory_products @@ -405,15 +436,12 @@ else fi echo -if test x$MPIREQUESTED = xyes; then - requested_products="mpi_ok" - echo --- products requested by user - summary $requested_products - check_fatal_error $requested_products - echo -fi +parallel_products="mpi_ok PaCO_ok parallel_extension_ok" +echo --- Kernel parallel extensions: +summary $parallel_products +echo -optional_products="cppunit_ok openpbs_ok lsf_ok" +optional_products="cppunit_ok openpbs_ok lsf_ok numpy_ok" echo --- Optional products: echo [" These products are optional because the KERNEL functions"] echo [" using them are built only if the products are detected."] @@ -490,7 +518,7 @@ AC_OUTPUT([ \ ./salome_adm/Makefile \ ./salome_adm/unix/Makefile \ ./salome_adm/unix/config_files/Makefile \ - ./Makefile \ + Makefile \ ./bin/Makefile \ ./bin/VERSION \ ./bin/runIDLparser \ @@ -510,13 +538,24 @@ 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 \ + ./src/DSC/DSC_User/Basic/Makefile \ + ./src/DSC/DSC_User/Datastream/Makefile \ + ./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/INSTALL.txt b/doc/INSTALL.txt index b02493eab..7c01e348c 100644 --- a/doc/INSTALL.txt +++ b/doc/INSTALL.txt @@ -109,7 +109,6 @@ 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 @@ -122,24 +121,19 @@ 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-??? -=================== =================================================== diff --git a/doc/KERNEL_Services.txt b/doc/KERNEL_Services.txt index b348fcad3..c848838ee 100644 --- a/doc/KERNEL_Services.txt +++ b/doc/KERNEL_Services.txt @@ -36,7 +36,7 @@ SALOME services access from a Python shell See SALOME_Application_ for detailed instructions to launch a Python interpreter with full acces to the SALOME environment and services. -.. _SALOME_Application: ./SALOME_Application.html +.. _SALOME_Application: ./SALOME_Application.txt You can use the embedded Python interpreter in Grahic User Interface, or an external interpreter, with:: @@ -160,7 +160,7 @@ SWIG is very similar). .. _FileTransferCORBA: ./tui/KERNEL/classSALOME__FileTransferCORBA.html -The following example shows how to transfer a file from a remote host to the +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, 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/README.cluster-CCRT b/doc/README.cluster-CCRT new file mode 100644 index 000000000..1c93650c5 --- /dev/null +++ b/doc/README.cluster-CCRT @@ -0,0 +1,63 @@ + +OverView +======== + +That describes how to start Salome without IHM in "terminal" mode. + +With that "terminal" mode Salome may be started in "Batch" mode. + +And one or more python scripts may be executed + +Warnings +======== + +The list of needed modules must be explicited with --modules option + +It is not possible to use embbedded components, so we must use --standalone option + +After the python script(s) listed in the --terminal option, ",killall" should +be added : so the processes of Salome will be killed after the execution of +the python script(s). + + +Examples +======== + +Sans IHM sans execution de script python (for interactive testing and developping) : +--------------------------------------------- + +runSalome --terminal --modules=KERNEL,MED,CALCULATOR,COMPONENT --containers=cpp,python --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall --logger + +Sans IHM avec execution de script(s) python : +--------------------------------------------- + +runSalome --terminal=CALCULATOR_TEST --modules=KERNEL,MED,CALCULATOR,COMPONENT --containers=cpp,python --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall --logger + +runSalome --terminal=CALCULATOR_TEST_WITHOUTIHM --modules=KERNEL,MED,CALCULATOR,COMPONENT --containers=cpp,python --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall --logger + +runSalome --terminal=CALCULATOR_TEST_STUDY_WITHOUTIHM --modules=KERNEL,MED,CALCULATOR,COMPONENT --containers=cpp,python --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall --logger + +runSalome --terminal=CALCULATOR_TEST_WITHOUTIHM,CALCULATOR_TEST_STUDY_WITHOUTIHM --modules=KERNEL,MED,CALCULATOR,COMPONENT --containers=cpp,python --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall --logger + +runSalome --terminal=CALCULATOR_TEST,killall --modules=KERNEL,MED,CALCULATOR,COMPONENT --containers=cpp,python --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall --logger +after the import of CALCULATOR_TEST, killall will be executed. + + +=================================================== +Example for starting Salome in Batch mode on CCRT : +=================================================== + +Create a shell file "runSalome.batch" with for example : +-------------------------------------------------------- +#BSUB -n 10 +#BSUB -o runSalome.log%J +#BSUB -c 0:10 +runSalome --terminal=CALCULATOR_TEST,killall --modules=KERNEL,MED,CALCULATOR,COMPONENT --containers=cpp,python --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall +exit + +Queue for execution that file (here runSalome.batch) : +-------------------------------------------------------------------- +bsub < runSalome.batch + +See the "bsub" documentation for details (or "man bsub") + diff --git a/doc/SALOME_Application.txt b/doc/SALOME_Application.txt index 736f50add..0abcaed1e 100644 --- a/doc/SALOME_Application.txt +++ b/doc/SALOME_Application.txt @@ -74,19 +74,29 @@ configure his own application. These files are described after, the list is: - CatalogResources.xml - SalomeApp.xml -Second way - one single virtual install directory -''''''''''''''''''''''''''''''''''''''''''''''''' - -The user must create an application directory in which he copies -appli_install.sh, appli_clean.sh and virtual_salome.py, -from ${KERNEL_ROOT_DIR}/bin/salome. - -appli_install.sh needs to be edited, to define a list of modules with their -install paths. -Then, the script appli_install.sh creates a virtual installation of SALOME -in the application directory (bin, lib, doc, share...), with, -for each file (executable, script, data,library, resources...), -symbolic links to the actual file. +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:: + + python /bin/salome/appli_gen.py --prefix= --config= + +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). General rules ------------- @@ -108,15 +118,12 @@ script is used by run scripts. 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. -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 by appli_install.sh (given it's parameters). Otherwise, the -scripts must be manually defined. - - - **The following is only an example proposed by createAppli.sh, - not working as it is**. + **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, @@ -180,11 +187,11 @@ Other configuration files SalomeApp.xml This file is similar to the default given - in ${GUI_ROOT_DIR}/share/salome/resources + in ${GUI_ROOT_DIR}/share/salome/resources/gui CatalogRessources.xml - This files describes all the computer the application can use. The given + 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:: diff --git a/doc/salome/Makefile.am b/doc/salome/Makefile.am index b1075e0b8..9f43889c1 100644 --- a/doc/salome/Makefile.am +++ b/doc/salome/Makefile.am @@ -30,7 +30,7 @@ SUBDIRSGUI= tui SUBDIRSTUI= tui index_html: - $(INSTALL) -d $(docdir); + $(INSTALL) -d $(DESTDIR)$(docdir); usr_docs: index_html list='$(SUBDIRSGUI)'; for subdir in $$list; do \ @@ -48,4 +48,11 @@ dev_docs: index_html info_TEXINFOS = Batch.texi install-data-local: html usr_docs - cp -rp $(top_builddir)/doc/salome/Batch.html $(docdir) + cp -rp $(top_builddir)/doc/salome/Batch.html $(DESTDIR)$(docdir) +uninstall-local: + rm -rf $(DESTDIR)$(docdir)/Batch.html + +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 0d95bda18..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,14 +77,16 @@ 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 \ @top_srcdir@/src/LifeCycleCORBA \ @top_srcdir@/src/NamingService \ @top_srcdir@/src/Notification \ - @top_srcdir@/src/Utils -FILE_PATTERNS = *.idl *.hxx *.cxx python_extension_must_be_here + @top_srcdir@/src/Utils \ + @top_srcdir@/src/DSC +FILE_PATTERNS = *.dox *.idl *.hxx *.cxx python_extension_must_be_here RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO @@ -95,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 @@ -123,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 = @@ -133,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/KERNEL/sources/static/examples_Life_cycle.html b/doc/salome/tui/KERNEL/sources/static/examples_Life_cycle.html index 8d36282f6..080112eb4 100755 --- a/doc/salome/tui/KERNEL/sources/static/examples_Life_cycle.html +++ b/doc/salome/tui/KERNEL/sources/static/examples_Life_cycle.html @@ -1,116 +1,116 @@ - - - - - - - - Main Page - - - - -   -
    - - - - - - - - -
    - - -
    -
    - -

    Examples

    - //There is a CXX example of LifeCycleCORBA using
    -

    -#include CORBA_CLIENT_HEADER(TestComponent)
    -#include "SALOME_NamingService.hxx"
    -#include "SALOME_LifeCycleCORBA.hxx"
    -
    -int main (int argc, char * argv[]){
    -  try {
    -      // Initializing omniORB
    -
          CORBA::ORB_var orb = CORBA::ORB_init(argc, -argv);
    -   
    -      // Obtain a reference -to the root POA
    -
          CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") -;
    -      PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) -;
    -   
    -      SALOME_NamingService _NS(orb) ;
    -
    -      SALOME_LifeCycleCORBA _LCC(&_NS) ;
    -
    -      Engines::Component_var myComponent = _LCC.FindOrLoad_Component("FactoryServerPy","TestComponentPy");
    -       if(!CORBA::is_nil(myComponent)){
    -          Engines::TestComponent_var -myConcreateComponent = TestComponent::_narrow(myComponent);
    -          //do something -what you like with the interface
    -          ...
    -
              return 0;
    -       }
    -    }
    -  catch(CORBA::COMM_FAILURE& ex){
    -      cout<<"Caught system exception COMM_FAILURE --- unable to contact the object.\n";
    -  }catch(CORBA::SystemException&){
    -      cout<<"Caught a CORBA::SystemException.\n";
    -  }catch(CORBA::Exception&){
    -      cout<<"Caught CORBA::Exception.\n";
    -  }catch(...){
    -      cout<<"Caught unknown exception.\n";
    -  }
    -  return 1;
    -}
    -
    -#The example may be rewritten on Python like this:
    -

    -from omniORB import CORBA
    -from SALOME_TestComponent import *
    -from SALOME_NamingServicePy import *
    -from LifeCycleCORBA import *
    -
    -try:
    -    orb = CORBA.ORB_init(sys.argv,CORBA.ORB_ID)
    -    _NS = SALOME_NamingService(orb)
    -    _LCC = SALOME_LifeCycleCORBA(orb)
    -
    -     myComponent = _LCC.FindOrLoadComponent("FactoryServerPy","TestComponentPy");
    -     myConcreatComponent = myComponent._narrow(TestComponent)
    -    if myConcreatComponent is not None :
    -        //do something what you like with the -interface
    -         ...
    -
            return 0
    -    }
    -except CosNaming.NamingContext.NotFound, e :
    -    print "Caught exception: Naming Service can't found Logger"
    -except CORBA.COMM_FAILURE, e:
    -    print "Caught CORBA::SystemException CommFailure"
    -except CORBA.SystemException, e:
    -    print "Caught CORBA::SystemException."
    -except CORBA.Exception, e:
    -    print "Caught CORBA::Exception."
    -except Exception, e:
    -    print "Caught unknown exception."
    -  
    -
    -
    - - + + + + + + + + Main Page + + + + +   +
    + + + + + + + + +
    + + +
    +
    + +

    Examples

    + //There is a CXX example of LifeCycleCORBA using
    +

    +#include CORBA_CLIENT_HEADER(TestComponent)
    +#include "SALOME_NamingService.hxx"
    +#include "SALOME_LifeCycleCORBA.hxx"
    +
    +int main (int argc, char * argv[]){
    +  try {
    +      // Initializing omniORB
    +
          CORBA::ORB_var orb = CORBA::ORB_init(argc, +argv);
    +   
    +      // Obtain a reference +to the root POA
    +
          CORBA::Object_var obj = orb->resolve_initial_references("RootPOA") +;
    +      PortableServer::POA_var poa = PortableServer::POA::_narrow(obj) +;
    +   
    +      SALOME_NamingService _NS(orb) ;
    +
    +      SALOME_LifeCycleCORBA _LCC(&_NS) ;
    +
    +      Engines::Component_var myComponent = _LCC.FindOrLoad_Component("FactoryServerPy","TestComponentPy");
    +       if(!CORBA::is_nil(myComponent)){
    +          Engines::TestComponent_var +myConcreateComponent = TestComponent::_narrow(myComponent);
    +          //do something +what you like with the interface
    +          ...
    +
              return 0;
    +       }
    +    }
    +  catch(CORBA::COMM_FAILURE& ex){
    +      cout<<"Caught system exception COMM_FAILURE +-- unable to contact the object.\n";
    +  }catch(CORBA::SystemException&){
    +      cout<<"Caught a CORBA::SystemException.\n";
    +  }catch(CORBA::Exception&){
    +      cout<<"Caught CORBA::Exception.\n";
    +  }catch(...){
    +      cout<<"Caught unknown exception.\n";
    +  }
    +  return 1;
    +}
    +
    +#The example may be rewritten on Python like this:
    +

    +from omniORB import CORBA
    +from SALOME_TestComponent import *
    +from SALOME_NamingServicePy import *
    +from LifeCycleCORBA import *
    +
    +try:
    +    orb = CORBA.ORB_init(sys.argv,CORBA.ORB_ID)
    +    _NS = SALOME_NamingService(orb)
    +    _LCC = SALOME_LifeCycleCORBA(orb)
    +
    +     myComponent = _LCC.FindOrLoadComponent("FactoryServerPy","TestComponentPy");
    +     myConcreatComponent = myComponent._narrow(TestComponent)
    +    if myConcreatComponent is not None :
    +        //do something what you like with the +interface
    +         ...
    +
            return 0
    +    }
    +except CosNaming.NamingContext.NotFound, e :
    +    print "Caught exception: Naming Service can't found Logger"
    +except CORBA.COMM_FAILURE, e:
    +    print "Caught CORBA::SystemException CommFailure"
    +except CORBA.SystemException, e:
    +    print "Caught CORBA::SystemException."
    +except CORBA.Exception, e:
    +    print "Caught CORBA::Exception."
    +except Exception, e:
    +    print "Caught unknown exception."
    +  
    +
    +
    + + diff --git a/doc/salome/tui/KERNEL/sources/static/examples_Study.html b/doc/salome/tui/KERNEL/sources/static/examples_Study.html index 31ccaffa5..859f6297f 100755 --- a/doc/salome/tui/KERNEL/sources/static/examples_Study.html +++ b/doc/salome/tui/KERNEL/sources/static/examples_Study.html @@ -1,790 +1,790 @@ - - - - - - - - Main Page - - - - -   -
    - - - - - - - - -
    - - -
    -
    - -

    Examples

    -
    -
    - -
          Interfaces:
    -
    -       SALOMEDS::Study
    -       SALOMEDS::StudyBuilder
    -       SALOMEDS::StudyManager
    -       SALOMEDS::SObject
    -      SALOMEDS::SComponent
    -       SALOMEDS::SComponentIterator
    -       SALOMEDS::ChildIterator
    -
          SALOMEDS::AttributeComment
    -      
    -
    -
    -
    -
    - -
          SALOMEDS::Study interface
    -
    - -

    -
    -
    -
    -
    SComponent FindComponent( -in string aComponentName )
    -
    - Find GEOMETRY component in the opened study by its name:

    -
    -     str= os.getenv("TmpDir")
    -     if str == None:
    -         str = "/tmp"
    -     file = str+"/test.hdf"
    -
    -     openedStudy=batchmode_geompy.myStudyManager.Open(file)
    -
    -     father = openedStudy.FindComponent("GEOM")
    -     if father is None:
    -          raise  RuntimeError, "Geom - component is not found!  Wrong study is opened."
    -
    -
    -
    - -
    SObject FindObject ( in string -anObjectName )
    -
    - Find the SObject of the box by its NameAttribute "box":
    -
    - -

    -
    - -
    box = openedStudy.FindObject("box")
    - if box is None :
    -     raise  RuntimeError, "box was not found! Wrong -study is opened."
    -
    -
    - SObject FindObjectID - ( in ID aObjectID -)
    - #result: "/User data/Case1".
    -
    Find - the SObject of the box by its ID "0:1:1:2":
    -
    -
    - -
    box =openedStudy.FindObjectID("0:1:1:2")
    -
    - -
    if box is None :
    -     raise  RuntimeError, "box was not found! Wrong -ID is used."
    -
    -
    - SObject FindObjectIOR - ( in ID  aObjectIOR -)
    -
    - Find the SObject of the result on imported MED file -by it's IOR:
    -
    - theResult = myVisu.ImportFile(medFile)
    - aSObj = myStudy.FindObjectIOR(theResult.GetID())
    -
    -
    - SObject - FindObjectByPath ( in string thePath )
    -
    - Find SObject by path to it:
    -
    - # create new auxiliary componen
    t
    - aComponent = myStudyBuilder.NewComponent("Virtual Component")
    -
    - # create auxiliary subtree
    - aPath = "/Virtual Component/Case1"
    - myStudyBuilder.AddDirectory(aPath)
    -
    - aSObj = myStudy.FindObjectByPath(aPath)
    -
    -
    - void SetContext ( in string thePath) / - string GetContext ()
    -
    - Set context of the study to the created case and get it for printing:
    -
    - aComponent = myStudyBuilder.NewComponent("User data")
    - anAttr = aBuilder.FindOrCreateAttribute(aComponent, "AttributeName")
    - anAttrName = anAttr._narrow(SALOMEDS.AttributeName)
    - anAttrName.SetValue("User data")
    -
    - #Add a new case 'Case1' to the component 'User data'
    - aBuilder.AddDirectory("/User data/Case1")
    -
    - #Set a study context to '/User data/Case1'
    - aStudy.SetContext("/User data/Case1")
    -
    - #Print the current study context
    - print aStudy.GetContext()
    -
    -
    #result: "/User data/Case1".

    -
    -
    - ChildIterator - NewChildIterator ( in SObject aSO )
    -
    - Import med file and print all mesh names that this file includes -(mesh is a child of the result of imported file):
    -
    - # define file name
    - aFileName = datadir + "fra.med"
    -
    - # import file in visu module and get result
    - theVisu = batchmode_visu.myVisu
    - aResult = theVisu.ImportFile(aFileName)
    - if aResult is None : raise RuntimeError, "Error"
    - else : print "OK"
    -  
    - # get current study and its' SObject        -
    - myLocalStudy = theVisu.GetCurrentStudy()
    - aSObj = myLocalStudy.FindObjectIOR(aResult.GetID())
    - if aSObj is None : raise RuntimeError, "Error"
    - else : print "OK"
    -
    - # create iterator by SObject of the current study
    - aMeshIter = myLocalStudy.NewChildIterator(aSObj);
    -
    - # iterating in the current study (with the help of created iterator) -to find all mesh names  
    - while aMeshIter.More() :
    -         aMeshSObj = aMeshIter.Value()
    -         aMeshIter.Next()
    -         anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
    -         if anAttr is None :
    -             aMeshSObj - = aMeshIter.Value()
    -             aMeshIter.Next()
    -             anAttr - = aMeshSObj.FindAttribute("AttributeName")[1]
    -         anAttr = anAttr._narrow(SALOMEDS.AttributeName);
    -         aMeshName = anAttr.Value()
    -         print "  ", aMeshName
    -
    -
    - SComponentIterator -NewComponentIterator ()
    -
    - Find the number an names of all components in the study:
    -
    - aCompItr = myStudy.NewComponentIterator()
    -
    - compNb = 0
    - while aCompItr.More():
    -     aComp = aCompItr.Value()
    -     aName = aComp.ComponentDataType()
    -     print "Component name = ", aName
    -     compNb += 1
    -     aCompItr.Next()
    -
    -
    - StudyBuilder -NewBuilder ()
    -
    -
    -
    - Create a new StudyBuilder (uses to add or modify an object in the -study ):
    -
    - myBuilder = myStudy.NewBuilder()
    -
    -
    - AttributeStudyProperties -GetProperties ()
    -
    - Get the attribute, which contains the properties of the study, and -change properties of the study by changing it:
    -
    - aProperties = myStudy.GetProperties()
    - if aProperties == None :
    -     raise  RuntimeError, "Can't create AttributeStudyProperties -attribute"
    - aProperties = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
    -
    - A = aProperties
    -
    - # print stydy properties
    - print "A.GetUserName()= ", A.GetUserName()
    - res,mm,hh,dd,mnth,yy=A.GetCreationDate()
    - print "A.GetCreationDate() = ", mm,hh,dd,mnth,yy
    - print "A.GetCreationMode() = ", A.GetCreationMode()
    - print "A.IsModified() = ", A.IsModified()
    - print "A.IsLocked() = ", A.IsLocked()
    -
    - # change the properties of the study
    - if A.IsLocked() == 0 :
    -     A.SetUserName("tester"); print 'A.SetUserName("tester"), -A.GetUserName() = ', A.GetUserName()
    -     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), -A.GetCreationDate() =', A.GetCreationDate()
    -     print "A.IsModified() = ", A.IsModified()
    - A.SetLocked(1)
    -
    -
    - boolean IsModified ()
    -
    - Find if study is modified:
    -
    - IsModified = myStudy.IsModified()
    -
    - if IsModified == 1:
    -     print "The study is modified and not saved"
    -
    -
    - boolean IsEmpty ()
    -
    - Find if study is empty:
    -
    - IsEmpty = myStudy.IsEmpty()
    -
    - if IsEmpty == 1:
    -     print "The study is empty"
    -
    -
    -
    -
    - -
    SALOMEDS::StudyBuilder -interface
    -
    -
    -
    -
    - SComponent -NewComponent ( in string ComponentDataType )
    -
    - Create Geometry SComponent:
    -
    - myBuilder = myStudy.NewBuilder()
    - father = myBuilder.NewComponent("GEOM")
    -
    -
    - void DefineComponentInstance ( in SComponent aComponent, -in Object ComponentIOR )

    -
    - Define the instance to the created geometry component:
    -
    - # find geom component
    - myLCC = batchmode_salome.lcc
    - geom = myLCC.FindOrLoadComponent("FactoryServer", "Geometry")
    - geom = geom._narrow(GEOM.GEOM_Gen)
    - geom.GetCurrentStudy(myStudyId)
    -
    - myBuilder = myStudy.NewBuilder()
    -
    - father = myBuilder.NewComponent("GEOM")
    - myBuilder.DefineComponentInstance(father,geom)
    -
    -
    - SObject -NewObject ( in SObject theFatherObject -)
    -
    - Create box and add it to study:
    -
    - from batchmode_geompy import *
    -
    - # create a box
    - box = geom.MakeBox(0,0,0,100,100,150)
    -
    - ior = orb.object_to_string(box)
    - box._set_Name(ior)     
    -
    - # create Geometry SComponent
    - father = myBuilder.NewComponent("GEOM")
    - A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName");
    - FName = A1._narrow(SALOMEDS.AttributeName)
    - FName.SetValue("Geometry")
    - myBuilder.DefineComponentInstance(father,geom)
    -
    - # add box to Study
    - myBuilder.NewCommand()
    - newObj = myBuilder.NewObject(father)
    - A1 = myBuilder.FindOrCreateAttribute(newObj, "AttributeIOR");
    - ObjIOR = A1._narrow(SALOMEDS.AttributeIOR)
    - ObjIOR.SetValue(ior)
    - A2 = myBuilder.FindOrCreateAttribute(newObj, "AttributeName");
    - ObjName = A2._narrow(SALOMEDS.AttributeName)
    - ObjName.SetValue("Common_operation")
    - id = newObj.GetID()
    - box._set_StudyShapeId(id)
    - myBuilder.CommitCommand()
    -
    -
    - void RemoveObject ( in SObject anObject )
    -
    - # Remove CutPlanes SObject from the StudyBuilder (delete cutplanes):
    -
    - SObj=myStudy.FindObjectIOR(cutplanes.GetID())
    - myBuilder = newStudy.NewBuilder()
    - myBuilder.RemoveObject(SObj)
    -
    -
    - void LoadWith ( in SComponent sco, in -Driver Engine -) raises (SALOME::SALOME_Exception)

    -
    - # Load Visu component:
    -
    - myBuilder = openedStudy.NewBuilder()
    - SCom=openedStudy.FindComponent("VISU")
    - myBuilder.LoadWith(SCom ,myVisu)
    -
    -
    - GenericAttribute -FindOrCreateAttribute ( in SObject anObject,  -in string aTypeOfAttribute)
    -
    - Create AttributeName attribute for created component an set value -to it:
    -
    - myBuilder = myStudy.NewBuilder()
    - aComponent = myBuilder.NewComponent("User data")
    -
    - anAttr = myBuilder.FindOrCreateAttribute(aComponent, "AttributeName")
    -
    - anAttrName = anAttr._narrow(SALOMEDS.AttributeName)
    - anAttrName.SetValue("User data")
    -
    -
    - boolean FindAttribute ( in SObject anObject, out GenericAttribute -anAttribute, in string aTypeOfAttribute )
    -
    -
    Find AttributeName attribute of the field and print the -field name:
    -
    - aFieldSObj  = myStudy.FindObject("Head, -")
    -
    - myStudyBuilder.FindAttribute( aFieldSObj, anAttr, "AttributeName")
    - if res == 0:
    -     raise  RuntimeError, "Error:  Attribute not -found"
    -
    - anAttr = anAttr._narrow(SALOMEDS.AttributeName);
    - aFieldName = anAttr.Value()
    - print "      ", aFieldName
    -
    -
    - void RemoveAttribute ( in SObject anObject, in -string aTypeOfAttribute )
    -
    -
    Remove AttributeSelectable attribute of the field SObject:
    -
    -
    aFieldSObj  = myStudy.FindObject("Head, -")
    -
    - myStudyBuilder.RemoveAttribute( aFieldSObj, "AttributeSelectable")
    -
    -
    -
    void Addreference ( in  SObject -anObject, in  SObject theReferencedObject -)

    -
    - Create a reference between created SObject and the existing field:
    -
    - aFieldSObj  = myStudy.FindObject("Head, -")
    - aNewSObj = myBuilder.NewObject(myVisu)
    -
    - myBuilder.Addreference(aFieldSObj, aNewSObj)
    -
    -
    -
    void -NewCommand ()
    -
    -
    Create new command wich containes actions for changing the -properties of the study:
    -
    -
    A = myStudy.GetProperties()
    - A = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
    -
    - myBuilder = myStudy.NewBuilder()
    -
    - myBuilder.NewCommand() # creates a new command
    -
    - # change the properties of the study
    - if A.IsLocked() == 0 :
    -     A.SetUserName("tester"); print 'A.SetUserName("tester"), -A.GetUserName() = ', A.GetUserName()
    -     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), -A.GetCreationDate() =', A.GetCreationDate()
    -     print "A.IsModified() = ", A.IsModified()
    - A.SetLocked(1)
    -
    -
    myBuilder.CommitCommand() # commits all actions declared -within the created command
    -
    -
    - void CommitCommand()
    -

    -
    See the end of the previous example
    -
    -
    - void AbortCommand ()

    -
    - Create new command wich containes actions for changing -the properties of the study, cancel all declared actions:
    -
    - A = myStudy.GetProperties()
    - A = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
    -
    - myBuilder = myStudy.NewBuilder()
    -
    - myBuilder.NewCommand() # creates a new command
    -
    - # change the properties of the study
    - if A.IsLocked() == 0 :
    -     A.SetUserName("tester"); print 'A.SetUserName("tester"), -A.GetUserName() = ', A.GetUserName()
    -     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), -A.GetCreationDate() =', A.GetCreationDate()
    -     print "A.IsModified() = ", A.IsModified()
    - A.SetLocked(1)
    -
    -
    myBuilder.AbortCommand() # abort all actions declared -within the created command
    -
    -
    - void Undo () raises (LockProtection) -,
    - void Redo () raises (LockProtection)
    -
    - Create new command wich containes actions for changing -the properties of the study,
    - cancel all declared actions and then redo it with the help of undo/redo -mechanism:

    -
    - A = myStudy.GetProperties()
    - A = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
    -
    - myBuilder = myStudy.NewBuilder()
    -
    - myBuilder.NewCommand() # creates a new command
    -
    - # change the properties of the study
    - if A.IsLocked() == 0 :
    -     A.SetUserName("tester"); print 'A.SetUserName("tester"), -A.GetUserName() = ', A.GetUserName()
    -     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), -A.GetCreationDate() =', A.GetCreationDate()
    -     print "A.IsModified() = ", A.IsModified()
    - A.SetLocked(1)
    -
    -
    myBuilder.CommitCommand() # commits all actions declared -within the created command
    -
    -
    myBuilder.Undo() # cancels all actions of the command
    -
    -
    myBuilder.Redo() # redoes all actions of the command
    -
    -
    -
    -
    -
    SALOMEDS::StudyManager -interface
    -
    -
    -
    -
    -
    Study -NewStudy ( in string study_name )
    -
    - Create the study with the name "Test_Study":

    -
    - myNewStudy = myStudyManager.NewStudy("Test_Study")
    -
    -
    - Study Open -( in URL -aStudyUrl ) raises (SALOME::SALOME_Exception)
    -
    - Open the study saved in the HDF file:
    -
    - file = 'saved_study.hdf'
    -
    - openedStudy=myStudyManager.Open(file)
    -
    - if openedStudy == None:
    -     raise  RuntimeError, "Can't open saved study!"
    -
    -
    - void Save (in Study aStudy, in boolean -theMultifile )
    -
    -
    Open study, import med file into it and save with the old -path and filename:
    -
    -
    file = "saved_study.hdf"
    - myMedFile ="medfile.med"
    -
    - openedStudy=myStudyManager.Open(file)
    -
    - myVisu.SetCurrentStudy(openedStudy)
    - myResult = myVisu.ImportFile(myMedFile)
    -
    - myStudyManager.Save(openedStudy, 0)
    -
    -
    - void SaveAs ( in URL -aUrl, in  Study aStudy, - 
    in boolean theMultifile -)
    -
    - Open study from the file and resave it in several files (using -Multifile option while saving)
    -
    -
    file = "saved_study.hdf"
    - newfile = "resaved_study.hdf"
    -
    - openedStudy=myStudyManager.Open(file)
    - myStudyManager.SaveAs(newfile, openedStudy, 1)
    -
    -
    - void Close ( in  Study aStudy )

    -
    - Close just opened study:
    -
    - file = "saved_study.hdf"
    -
    - openedStudy=myStudyManager.Open(file)
    - myStudyManager.Close(openedStudy)
    -
    -
    -
    - -
    SALOMEDS::SObject interface
    -
    -
    -
    -
    - ID GetID ()
    -
    - Create new SObject and get its ID:
    -
    - mySObj = myBuilder.NewObject(myFather)
    -
    - myID =  mySObj.GetID()
    -
    -
    - SComponent -GetFatherComponent ()
    -
    - Get father component of the SObject:
    -
    - myFather = mySObj.GetFatherComponent();
    -
    -
    - boolean FindAttribute ( out GenericAttribute anAttribute, -in string aTypeOfAttribute )
    -
    - Find the AttributeName attribute of the field:
    -
    - aFieldSObj  = myStudy.FindObject("Head, -")
    -
    - res = aFieldSObj.FindAttribute( anAttr, "AttributeName")
    - if res == 0:
    -     raise  RuntimeError, "Error:  Attribute not -found"
    -
    -
    - ListOfAttributes -GetAllAttributes ()
    -
    - Get list of all attributes of the SObject, find the number of attributes:
    -
    - attrs = mySObj.GetAllAttributes()
    - aLen = len(attrs) # number of attributes
    -
    -
    -
    -
    - -
    SALOMEDS::SComponent interface
    -
    -
    -
    -
    - string ComponentDataType ()
    -
    - Print names of all components wich -the study contains:
    -
    - aCompItr = myStudy.NewComponentIterator()
    -
    - while aCompItr.More():
    -     aComp = aCompItr.Value()
    -     aName = aComp.ComponentDataType()
    -     print "Component name = ", aName
    -     aCompItr.Next()
    -
    -
    - Other methods are inherited.
    -
    -
    -
    -
    - -
    SALOMEDS::SComponentIterator - interface
    -
    -
    -
    -
    - boolean More (), void Next (), SComponent Value -()
    -
    - See another -example
    -
    -   
    -
    - -
    SALOMEDS::ChildIterator - interface
    -
    -
    -
    -
    - boolean More () , void Next (), SObject Value ()
    -
    - Print all mesh names of imported MED file with the help of ChildIterator:
    -
    - aResult = myVisu.ImportFile("MedFile.med")
    -        
    - myStudy = theVisu.GetCurrentStudy()
    - aSObj = myLocalStudy.FindObjectIOR(aResult.GetID())
    -
    - aMeshIter = myLocalStudy.NewChildIterator(aSObj);  # creating new -child iterator
    -
    - while aMeshIter.More() :               -                      -           # check if one more -child level exists.
    -         aMeshSObj = aMeshIter.Value() -                  -         # returns the SObject corresponding -to the current object found by the iterator.  
    -         aMeshIter.Next()     -                      -                      -   # passes the iterator to the next level.
    -         anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
    -         if anAttr is None :
    -                 -aMeshSObj = aMeshIter.Value()
    -               -  aMeshIter.Next()
    -                 -anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
    -         anAttr = anAttr._narrow(SALOMEDS.AttributeName);
    -         aMeshName = anAttr.Value()
    -         print "  ", aMeshName
    -
    -
    -
    - -
    SALOMEDS::AttributeComment - interface
    -
    -
    -
    - string Value (),  void SetValue ( in string value )
    -
    - Find the AttributeComment attribute of the "Head" field in the study, -print it, then change it to "My Comment" string:
    -
    - aFieldSObj  = myStudy.FindObject("Head, -")
    - anAttr = aFieldSObj.FindAttribute("AttributeComment")[1]
    -                     -anAttr = anAttr._narrow(SALOMEDS.AttributeComment);
    -                     -aFieldComment = anAttr.Value()
    -
    - print "AttributeComment", anAttr
    -
    - anAttr.SetValue ("My Comment")
    - -
    
    - 
    - - + + + + + + + + Main Page + + + + +   +
    + + + + + + + + +
    + + +
    +
    + +

    Examples

    +
    +
    + +
          Interfaces:
    +
    +       SALOMEDS::Study
    +       SALOMEDS::StudyBuilder
    +       SALOMEDS::StudyManager
    +       SALOMEDS::SObject
    +      SALOMEDS::SComponent
    +       SALOMEDS::SComponentIterator
    +       SALOMEDS::ChildIterator
    +
          SALOMEDS::AttributeComment
    +      
    +
    +
    +
    +
    + +
          SALOMEDS::Study interface
    +
    + +

    +
    +
    +
    +
    SComponent FindComponent( +in string aComponentName )
    +
    + Find GEOMETRY component in the opened study by its name:

    +
    +     str= os.getenv("TmpDir")
    +     if str == None:
    +         str = "/tmp"
    +     file = str+"/test.hdf"
    +
    +     openedStudy=batchmode_geompy.myStudyManager.Open(file)
    +
    +     father = openedStudy.FindComponent("GEOM")
    +     if father is None:
    +          raise  RuntimeError, "Geom + component is not found!  Wrong study is opened."
    +
    +
    +
    + +
    SObject FindObject ( in string +anObjectName )
    +
    + Find the SObject of the box by its NameAttribute "box":
    +
    + +

    +
    + +
    box = openedStudy.FindObject("box")
    + if box is None :
    +     raise  RuntimeError, "box was not found! Wrong +study is opened."
    +
    +
    + SObject FindObjectID + ( in ID aObjectID +)
    + #result: "/User data/Case1".
    +
    Find + the SObject of the box by its ID "0:1:1:2":
    +
    +
    + +
    box =openedStudy.FindObjectID("0:1:1:2")
    +
    + +
    if box is None :
    +     raise  RuntimeError, "box was not found! Wrong +ID is used."
    +
    +
    + SObject FindObjectIOR + ( in ID  aObjectIOR +)
    +
    + Find the SObject of the result on imported MED file +by it's IOR:
    +
    + theResult = myVisu.ImportFile(medFile)
    + aSObj = myStudy.FindObjectIOR(theResult.GetID())
    +
    +
    + SObject + FindObjectByPath ( in string thePath )
    +
    + Find SObject by path to it:
    +
    + # create new auxiliary componen
    t
    + aComponent = myStudyBuilder.NewComponent("Virtual Component")
    +
    + # create auxiliary subtree
    + aPath = "/Virtual Component/Case1"
    + myStudyBuilder.AddDirectory(aPath)
    +
    + aSObj = myStudy.FindObjectByPath(aPath)
    +
    +
    + void SetContext ( in string thePath) / + string GetContext ()
    +
    + Set context of the study to the created case and get it for printing:
    +
    + aComponent = myStudyBuilder.NewComponent("User data")
    + anAttr = aBuilder.FindOrCreateAttribute(aComponent, "AttributeName")
    + anAttrName = anAttr._narrow(SALOMEDS.AttributeName)
    + anAttrName.SetValue("User data")
    +
    + #Add a new case 'Case1' to the component 'User data'
    + aBuilder.AddDirectory("/User data/Case1")
    +
    + #Set a study context to '/User data/Case1'
    + aStudy.SetContext("/User data/Case1")
    +
    + #Print the current study context
    + print aStudy.GetContext()
    +
    +
    #result: "/User data/Case1".

    +
    +
    + ChildIterator + NewChildIterator ( in SObject aSO )
    +
    + Import med file and print all mesh names that this file includes +(mesh is a child of the result of imported file):
    +
    + # define file name
    + aFileName = datadir + "fra.med"
    +
    + # import file in visu module and get result
    + theVisu = batchmode_visu.myVisu
    + aResult = theVisu.ImportFile(aFileName)
    + if aResult is None : raise RuntimeError, "Error"
    + else : print "OK"
    +  
    + # get current study and its' SObject        +
    + myLocalStudy = theVisu.GetCurrentStudy()
    + aSObj = myLocalStudy.FindObjectIOR(aResult.GetID())
    + if aSObj is None : raise RuntimeError, "Error"
    + else : print "OK"
    +
    + # create iterator by SObject of the current study
    + aMeshIter = myLocalStudy.NewChildIterator(aSObj);
    +
    + # iterating in the current study (with the help of created iterator) +to find all mesh names  
    + while aMeshIter.More() :
    +         aMeshSObj = aMeshIter.Value()
    +         aMeshIter.Next()
    +         anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
    +         if anAttr is None :
    +             aMeshSObj + = aMeshIter.Value()
    +             aMeshIter.Next()
    +             anAttr + = aMeshSObj.FindAttribute("AttributeName")[1]
    +         anAttr = anAttr._narrow(SALOMEDS.AttributeName);
    +         aMeshName = anAttr.Value()
    +         print "  ", aMeshName
    +
    +
    + SComponentIterator +NewComponentIterator ()
    +
    + Find the number an names of all components in the study:
    +
    + aCompItr = myStudy.NewComponentIterator()
    +
    + compNb = 0
    + while aCompItr.More():
    +     aComp = aCompItr.Value()
    +     aName = aComp.ComponentDataType()
    +     print "Component name = ", aName
    +     compNb += 1
    +     aCompItr.Next()
    +
    +
    + StudyBuilder +NewBuilder ()
    +
    +
    +
    + Create a new StudyBuilder (uses to add or modify an object in the +study ):
    +
    + myBuilder = myStudy.NewBuilder()
    +
    +
    + AttributeStudyProperties +GetProperties ()
    +
    + Get the attribute, which contains the properties of the study, and +change properties of the study by changing it:
    +
    + aProperties = myStudy.GetProperties()
    + if aProperties == None :
    +     raise  RuntimeError, "Can't create AttributeStudyProperties +attribute"
    + aProperties = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
    +
    + A = aProperties
    +
    + # print stydy properties
    + print "A.GetUserName()= ", A.GetUserName()
    + res,mm,hh,dd,mnth,yy=A.GetCreationDate()
    + print "A.GetCreationDate() = ", mm,hh,dd,mnth,yy
    + print "A.GetCreationMode() = ", A.GetCreationMode()
    + print "A.IsModified() = ", A.IsModified()
    + print "A.IsLocked() = ", A.IsLocked()
    +
    + # change the properties of the study
    + if A.IsLocked() == 0 :
    +     A.SetUserName("tester"); print 'A.SetUserName("tester"), +A.GetUserName() = ', A.GetUserName()
    +     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), +A.GetCreationDate() =', A.GetCreationDate()
    +     print "A.IsModified() = ", A.IsModified()
    + A.SetLocked(1)
    +
    +
    + boolean IsModified ()
    +
    + Find if study is modified:
    +
    + IsModified = myStudy.IsModified()
    +
    + if IsModified == 1:
    +     print "The study is modified and not saved"
    +
    +
    + boolean IsEmpty ()
    +
    + Find if study is empty:
    +
    + IsEmpty = myStudy.IsEmpty()
    +
    + if IsEmpty == 1:
    +     print "The study is empty"
    +
    +
    +
    +
    + +
    SALOMEDS::StudyBuilder +interface
    +
    +
    +
    +
    + SComponent +NewComponent ( in string ComponentDataType )
    +
    + Create Geometry SComponent:
    +
    + myBuilder = myStudy.NewBuilder()
    + father = myBuilder.NewComponent("GEOM")
    +
    +
    + void DefineComponentInstance ( in SComponent aComponent, +in Object ComponentIOR )

    +
    + Define the instance to the created geometry component:
    +
    + # find geom component
    + myLCC = batchmode_salome.lcc
    + geom = myLCC.FindOrLoadComponent("FactoryServer", "Geometry")
    + geom = geom._narrow(GEOM.GEOM_Gen)
    + geom.GetCurrentStudy(myStudyId)
    +
    + myBuilder = myStudy.NewBuilder()
    +
    + father = myBuilder.NewComponent("GEOM")
    + myBuilder.DefineComponentInstance(father,geom)
    +
    +
    + SObject +NewObject ( in SObject theFatherObject +)
    +
    + Create box and add it to study:
    +
    + from batchmode_geompy import *
    +
    + # create a box
    + box = geom.MakeBox(0,0,0,100,100,150)
    +
    + ior = orb.object_to_string(box)
    + box._set_Name(ior)     
    +
    + # create Geometry SComponent
    + father = myBuilder.NewComponent("GEOM")
    + A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName");
    + FName = A1._narrow(SALOMEDS.AttributeName)
    + FName.SetValue("Geometry")
    + myBuilder.DefineComponentInstance(father,geom)
    +
    + # add box to Study
    + myBuilder.NewCommand()
    + newObj = myBuilder.NewObject(father)
    + A1 = myBuilder.FindOrCreateAttribute(newObj, "AttributeIOR");
    + ObjIOR = A1._narrow(SALOMEDS.AttributeIOR)
    + ObjIOR.SetValue(ior)
    + A2 = myBuilder.FindOrCreateAttribute(newObj, "AttributeName");
    + ObjName = A2._narrow(SALOMEDS.AttributeName)
    + ObjName.SetValue("Common_operation")
    + id = newObj.GetID()
    + box._set_StudyShapeId(id)
    + myBuilder.CommitCommand()
    +
    +
    + void RemoveObject ( in SObject anObject )
    +
    + # Remove CutPlanes SObject from the StudyBuilder (delete cutplanes):
    +
    + SObj=myStudy.FindObjectIOR(cutplanes.GetID())
    + myBuilder = newStudy.NewBuilder()
    + myBuilder.RemoveObject(SObj)
    +
    +
    + void LoadWith ( in SComponent sco, in +Driver Engine +) raises (SALOME::SALOME_Exception)

    +
    + # Load Visu component:
    +
    + myBuilder = openedStudy.NewBuilder()
    + SCom=openedStudy.FindComponent("VISU")
    + myBuilder.LoadWith(SCom ,myVisu)
    +
    +
    + GenericAttribute +FindOrCreateAttribute ( in SObject anObject,  +in string aTypeOfAttribute)
    +
    + Create AttributeName attribute for created component an set value +to it:
    +
    + myBuilder = myStudy.NewBuilder()
    + aComponent = myBuilder.NewComponent("User data")
    +
    + anAttr = myBuilder.FindOrCreateAttribute(aComponent, "AttributeName")
    +
    + anAttrName = anAttr._narrow(SALOMEDS.AttributeName)
    + anAttrName.SetValue("User data")
    +
    +
    + boolean FindAttribute ( in SObject anObject, out GenericAttribute +anAttribute, in string aTypeOfAttribute )
    +
    +
    Find AttributeName attribute of the field and print the +field name:
    +
    + aFieldSObj  = myStudy.FindObject("Head, -")
    +
    + myStudyBuilder.FindAttribute( aFieldSObj, anAttr, "AttributeName")
    + if res == 0:
    +     raise  RuntimeError, "Error:  Attribute not +found"
    +
    + anAttr = anAttr._narrow(SALOMEDS.AttributeName);
    + aFieldName = anAttr.Value()
    + print "      ", aFieldName
    +
    +
    + void RemoveAttribute ( in SObject anObject, in +string aTypeOfAttribute )
    +
    +
    Remove AttributeSelectable attribute of the field SObject:
    +
    +
    aFieldSObj  = myStudy.FindObject("Head, -")
    +
    + myStudyBuilder.RemoveAttribute( aFieldSObj, "AttributeSelectable")
    +
    +
    +
    void Addreference ( in  SObject +anObject, in  SObject theReferencedObject +)

    +
    + Create a reference between created SObject and the existing field:
    +
    + aFieldSObj  = myStudy.FindObject("Head, -")
    + aNewSObj = myBuilder.NewObject(myVisu)
    +
    + myBuilder.Addreference(aFieldSObj, aNewSObj)
    +
    +
    +
    void +NewCommand ()
    +
    +
    Create new command wich containes actions for changing the +properties of the study:
    +
    +
    A = myStudy.GetProperties()
    + A = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
    +
    + myBuilder = myStudy.NewBuilder()
    +
    + myBuilder.NewCommand() # creates a new command
    +
    + # change the properties of the study
    + if A.IsLocked() == 0 :
    +     A.SetUserName("tester"); print 'A.SetUserName("tester"), +A.GetUserName() = ', A.GetUserName()
    +     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), +A.GetCreationDate() =', A.GetCreationDate()
    +     print "A.IsModified() = ", A.IsModified()
    + A.SetLocked(1)
    +
    +
    myBuilder.CommitCommand() # commits all actions declared +within the created command
    +
    +
    + void CommitCommand()
    +

    +
    See the end of the previous example
    +
    +
    + void AbortCommand ()

    +
    + Create new command wich containes actions for changing +the properties of the study, cancel all declared actions:
    +
    + A = myStudy.GetProperties()
    + A = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
    +
    + myBuilder = myStudy.NewBuilder()
    +
    + myBuilder.NewCommand() # creates a new command
    +
    + # change the properties of the study
    + if A.IsLocked() == 0 :
    +     A.SetUserName("tester"); print 'A.SetUserName("tester"), +A.GetUserName() = ', A.GetUserName()
    +     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), +A.GetCreationDate() =', A.GetCreationDate()
    +     print "A.IsModified() = ", A.IsModified()
    + A.SetLocked(1)
    +
    +
    myBuilder.AbortCommand() # abort all actions declared +within the created command
    +
    +
    + void Undo () raises (LockProtection) +,
    + void Redo () raises (LockProtection)
    +
    + Create new command wich containes actions for changing +the properties of the study,
    + cancel all declared actions and then redo it with the help of undo/redo +mechanism:

    +
    + A = myStudy.GetProperties()
    + A = aProperties._narrow(SALOMEDS.AttributeStudyProperties)
    +
    + myBuilder = myStudy.NewBuilder()
    +
    + myBuilder.NewCommand() # creates a new command
    +
    + # change the properties of the study
    + if A.IsLocked() == 0 :
    +     A.SetUserName("tester"); print 'A.SetUserName("tester"), +A.GetUserName() = ', A.GetUserName()
    +     A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), +A.GetCreationDate() =', A.GetCreationDate()
    +     print "A.IsModified() = ", A.IsModified()
    + A.SetLocked(1)
    +
    +
    myBuilder.CommitCommand() # commits all actions declared +within the created command
    +
    +
    myBuilder.Undo() # cancels all actions of the command
    +
    +
    myBuilder.Redo() # redoes all actions of the command
    +
    +
    +
    +
    +
    SALOMEDS::StudyManager +interface
    +
    +
    +
    +
    +
    Study +NewStudy ( in string study_name )
    +
    + Create the study with the name "Test_Study":

    +
    + myNewStudy = myStudyManager.NewStudy("Test_Study")
    +
    +
    + Study Open +( in URL +aStudyUrl ) raises (SALOME::SALOME_Exception)
    +
    + Open the study saved in the HDF file:
    +
    + file = 'saved_study.hdf'
    +
    + openedStudy=myStudyManager.Open(file)
    +
    + if openedStudy == None:
    +     raise  RuntimeError, "Can't open saved study!"
    +
    +
    + void Save (in Study aStudy, in boolean +theMultifile )
    +
    +
    Open study, import med file into it and save with the old +path and filename:
    +
    +
    file = "saved_study.hdf"
    + myMedFile ="medfile.med"
    +
    + openedStudy=myStudyManager.Open(file)
    +
    + myVisu.SetCurrentStudy(openedStudy)
    + myResult = myVisu.ImportFile(myMedFile)
    +
    + myStudyManager.Save(openedStudy, 0)
    +
    +
    + void SaveAs ( in URL +aUrl, in  Study aStudy, + 
    in boolean theMultifile +)
    +
    + Open study from the file and resave it in several files (using +Multifile option while saving)
    +
    +
    file = "saved_study.hdf"
    + newfile = "resaved_study.hdf"
    +
    + openedStudy=myStudyManager.Open(file)
    + myStudyManager.SaveAs(newfile, openedStudy, 1)
    +
    +
    + void Close ( in  Study aStudy )

    +
    + Close just opened study:
    +
    + file = "saved_study.hdf"
    +
    + openedStudy=myStudyManager.Open(file)
    + myStudyManager.Close(openedStudy)
    +
    +
    +
    + +
    SALOMEDS::SObject interface
    +
    +
    +
    +
    + ID GetID ()
    +
    + Create new SObject and get its ID:
    +
    + mySObj = myBuilder.NewObject(myFather)
    +
    + myID =  mySObj.GetID()
    +
    +
    + SComponent +GetFatherComponent ()
    +
    + Get father component of the SObject:
    +
    + myFather = mySObj.GetFatherComponent();
    +
    +
    + boolean FindAttribute ( out GenericAttribute anAttribute, +in string aTypeOfAttribute )
    +
    + Find the AttributeName attribute of the field:
    +
    + aFieldSObj  = myStudy.FindObject("Head, -")
    +
    + res = aFieldSObj.FindAttribute( anAttr, "AttributeName")
    + if res == 0:
    +     raise  RuntimeError, "Error:  Attribute not +found"
    +
    +
    + ListOfAttributes +GetAllAttributes ()
    +
    + Get list of all attributes of the SObject, find the number of attributes:
    +
    + attrs = mySObj.GetAllAttributes()
    + aLen = len(attrs) # number of attributes
    +
    +
    +
    +
    + +
    SALOMEDS::SComponent interface
    +
    +
    +
    +
    + string ComponentDataType ()
    +
    + Print names of all components wich +the study contains:
    +
    + aCompItr = myStudy.NewComponentIterator()
    +
    + while aCompItr.More():
    +     aComp = aCompItr.Value()
    +     aName = aComp.ComponentDataType()
    +     print "Component name = ", aName
    +     aCompItr.Next()
    +
    +
    + Other methods are inherited.
    +
    +
    +
    +
    + +
    SALOMEDS::SComponentIterator + interface
    +
    +
    +
    +
    + boolean More (), void Next (), SComponent Value +()
    +
    + See another +example
    +
    +   
    +
    + +
    SALOMEDS::ChildIterator + interface
    +
    +
    +
    +
    + boolean More () , void Next (), SObject Value ()
    +
    + Print all mesh names of imported MED file with the help of ChildIterator:
    +
    + aResult = myVisu.ImportFile("MedFile.med")
    +        
    + myStudy = theVisu.GetCurrentStudy()
    + aSObj = myLocalStudy.FindObjectIOR(aResult.GetID())
    +
    + aMeshIter = myLocalStudy.NewChildIterator(aSObj);  # creating new +child iterator
    +
    + while aMeshIter.More() :               +                      +           # check if one more +child level exists.
    +         aMeshSObj = aMeshIter.Value() +                  +         # returns the SObject corresponding +to the current object found by the iterator.  
    +         aMeshIter.Next()     +                      +                      +   # passes the iterator to the next level.
    +         anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
    +         if anAttr is None :
    +                 +aMeshSObj = aMeshIter.Value()
    +               +  aMeshIter.Next()
    +                 +anAttr = aMeshSObj.FindAttribute("AttributeName")[1]
    +         anAttr = anAttr._narrow(SALOMEDS.AttributeName);
    +         aMeshName = anAttr.Value()
    +         print "  ", aMeshName
    +
    +
    +
    + +
    SALOMEDS::AttributeComment + interface
    +
    +
    +
    + string Value (),  void SetValue ( in string value )
    +
    + Find the AttributeComment attribute of the "Head" field in the study, +print it, then change it to "My Comment" string:
    +
    + aFieldSObj  = myStudy.FindObject("Head, -")
    + anAttr = aFieldSObj.FindAttribute("AttributeComment")[1]
    +                     +anAttr = anAttr._narrow(SALOMEDS.AttributeComment);
    +                     +aFieldComment = anAttr.Value()
    +
    + print "AttributeComment", anAttr
    +
    + anAttr.SetValue ("My Comment")
    + +
    
    + 
    + + diff --git a/doc/salome/tui/KERNEL/sources/static/mapping.html b/doc/salome/tui/KERNEL/sources/static/mapping.html index 21ead079f..f3f0a3f53 100755 --- a/doc/salome/tui/KERNEL/sources/static/mapping.html +++ b/doc/salome/tui/KERNEL/sources/static/mapping.html @@ -1,329 +1,329 @@ - - - - - - Main Page - - - -  -
    - - - - - -
    -
    -
    - -

    -Mapping of IDL definitions to Python language.

    - -

    -Introduction

    -SALOME is a distributed client/server application using the Common -Object Request Broker Architecture (CORBA). CORBA architecture uses the -Interface Definition Language (IDL), which specifies interfaces between -CORBA objects. So with help of IDL CORBA's language independence is ensured -. Because interfaces described in IDL can be mapped to the most of currently -used programming languages, CORBA applications and components are thus -independent of the language(s) used to implement them. In other words, -a client written in C++ can communicate with a server written in Java, -which in turn can communicate with another server written in COBOL, and -so forth. -

    One important thing to remember about IDL is that it is not an implementation -language. That is, applications can't be written in IDL. The sole purpose -of IDL is to define interfaces; providing implementations for these interfaces -is performed using some other language. -

    This page contains an abridged reference manual for mapping of IDL definitions -to Python language. It will be useful for Python programmers who are not -familiar with IDL language. All examples are taken from SALOME source -files. The complete version of Python Language Mapping Specification can -be found here. -
      -

    CONTENTS: -

    -
    - -

    -Using Scoped Names

    -Python implements a module concept that is similar to the IDL scoping mechanisms, -except that it does not allow for nested modules. In addition, Python requires -each object to be implemented in a module; globally visible objects are -not supported. -

    Because of these constraints, scoped names are translated into Python -using the following rules: -

    • An IDL module mapped into a Python module. Modules containing modules -are mapped to packages (i.e., directories with an __init__ module -containing all definitions excluding the nested modules). An implementation -can chose to map toplevel definitions (including the module CORBA) to modules -in an implementationdefined package, to allow concurrent installations -of different CORBA runtime libraries. In that case, the implementation -must provide additional modules so that toplevel modules can be used without -importing them from a package. -

    • For all other scopes, a Python class is introduced that contains all -the definitions inside this scope. -

    • Other global definitions (except modules) appear in a module whose -name is implementation dependent. Implementations are encouraged to use -the name of the IDL file when defining the name of that module. -

    For instance, -

    -
    module SALOMEDS {
    - interface StudyManager {
    -  void  Close(in Study aStudy);
    - };
    -};
    -
    -would introduce a module SALOMEDS.py, which contains the following definitions: -
    -
    # module SALOMEDS.py
    -class StudyManager:
    -  def _Close(self,aStudy):
    -   pass #interfaces are discussed later
    -
    -To avoid conflicts, IDL names that are also Python identifiers are prefixed -with an underscore (‘_’). -

    Back to the contents -

    -

    -Mapping for Template and Array Types

    -Both the bounded and the unbounded string type of IDL are mapped to the -Python string type. Wide strings are represented by an implementation-defined -type with the following properties: -

    • For the wide string X and the integer n, X[n] returns the nth character, -which is a wide string of length 1. -

    • len(X) returns the number of characters of wide string X. -

    • CORBA.wstr(c) returns a wide character with the code point c in an -implementation-defined encoding. -

    • X+Y returns the concatenation of wide strings X and Y. -

    • CORBA.word(CORBA.wstr(c)) == c -

    The sequence template is mapped to sequence objects (e.g., tuples or -lists). Applications should not assume that values of a sequence type are -mutable. Sequences and arrays of octets and characters are mapped to the -string type for efficiency reasons. -

    For example, given the IDL definitions -

    -
    module SALOMEDS {
    -  typedef sequence <string> StringSeq;
    -   
    -   interface AttributeTableOfInteger : GenericAttribute {
    -
    -    void SetRowTitles(in StringSeq theTitles) raises(IncorrectArgumentLength);
    - };
    -};
    -
    -a client could invoke the operation -
    -
    print My_AttributeTableOfInteger.SetRowTitles(["X","F"])
    -
    -Array types are mapped like sequence templates. The application in this -example also expects an IncorrectArgumentLength exception if it passes -sequences that violate the bounds constraint or arrays of wrong size. -

    Another example with arrays. The following IDL definition -

    -
    module SALOMEDS {
    - typedef sequence<GenericAttribute> ListOfAttributes;
    - interface SObject {
    -  ListOfAttributes     GetAllAttributes();
    - };
    -};
    -
    -is equal to -
    -
    import SALOMEDS
    -
    -attributes=[]
    - 
    -attributes = My_SObject.GetAllAttributes()
    -
    -length = len(attributes)
    -
    -print "Attributes number = ", length
    -print attributes
    -
    -Back to the contents -

    -

    -Mapping for Objects and Operations

    -A CORBA object reference is represented as a Python object at run-time. -This object provides all the operations that are available on the interface -of the object. Although this specification does not mandate the use of -classes for stub objects, the following discussion uses classes to indicate -the interface. -

    The nil object is represented by None. -

    If an operation expects parameters of the IDL Object type, any Python -object representing an object reference might be passed as actual argument. -

    If an operation expects a parameter of an abstract interface, either -an object implementing that interface, or a value supporting this interface -may be passed as actual argument. The semantics of abstract values then -define whether the argument is passed by value or by reference. -

    Operations of an interface map to methods available on the object references. -Parameters with a parameter attribute of in or inout are -passed from left to right tothe method, skipping out parameters. -The return value of a method depends on the number of out parameters -and the return type. If the operation returns a value, this value forms -the first result value. All inout or out parameters -form consecutive result values. The method result depends then on -the number of result values: -

    • If there is no result value, the method returns None. -

    • If there is exactly one result value, it is returned as a single -value. -

    • If there is more than one result value, all of them are packed -into a tuple, and this tuple is returned. -

    Assuming the IDL definition -

    -
    module SALOMEDS{
    - interface StudyBuilder{
    -  boolean FindAttribute  ( in SObject anObject, 
    -                           out GenericAttribute anAttribute, 
    -                           in string aTypeOfAttribute );
    - };
    -};
    -
    -a client could write -
    -
    from SALOMEDS import StudyBuilder;
    -my_StudyBuilder=...
    -  
    -  res,A=my_StudyBuilder.FindAttribute(Sobj, "AttributeSequenceOfReal")
    -
    -In this example A corresponds to the return value anAttribute -and res to the boolean return value. -

    If an interface defines an attribute name, for example, the attribute -is mapped into an operation _get_name. If the attribute is not readonly, -there is an additional operation _set_name. -

    The IDL definition -

    -
    module SALOMEDS{
    - interface Study{
    -  attribute string Name;
    - };
    -};
    -
    -is equal to the following -
    -
    from SALOMEDS import Study
    -My_Study=...
    -  Name=My_Study._get_name();
    -  Name=My_Study._set_name();
    -
    -Back to the contents -

    -

    -Narrowing Object References

    -Python objects returned from CORBA operations or pseudo-operations (such -as string_to_object) might have a dynamic type, which is more specific -than the static type as defined in the operation signature. -

    Since there is no efficient and reliable way of automatically creating -the most specific type, explicit narrowing is necessary. To narrow an object -reference A to an interface class AttributeSequenceOfReal, -the client can use the following operation -

    -
    A = A._narrow(SALOMEDS.AttributeSequenceOfReal)
    -
    -Back to the contents -

    -

    -Mapping for Exceptions

    -An IDL exception is translated into a Python class derived from CORBA.UserException. -System exceptions are derived from CORBA.SystemException. Both base classes -are derived from CORBA.Exception. The parameters of the exception are mapped -in the same way as the fields of a struct definition. When raising an exception, -a new instance of the class is created; the constructor expects the exception -parameters. For example, the definition -
    -
    module SALOMEDS{
    - interface StudyBuilder{
    -  exception LockProtection {};
    -  void CommitCommand() raises(LockProtection);
    - };
    -};
    -
    -could be used caught as -
    -
    from SALOMEDS import StudyBuilder;
    -my_StudyBuilder=...
    -try:
    -  my_StudyBuilder.CommitCommand();
    -except StudyBuilder.LockProtection,value:
    -  print "Error! Study is locked for modifications"
    -
    - -


    Back to the contents -

    -

    -Mapping for Enumeration Types

    -An enumeration is mapped into a number of constant objects in the name -space where the enumeration is defined. An application may only test for -equivalence of two enumeration values, and not assume that they behave -like numbers. For example, the definition -
    -
    module VISU {
    - interface PrsObject{
    - 
    -  enum PrsObjType{ TCURVE, TTABLE, TMESH, TCONTAINER,
    -                   TSCALARMAP, TISOSURFACE, TDEFORMEDSHAPE,
    -                   TCUTPLANES, TVECTORS };
    - };
    -};
    -
    -introduces the objects -
    -
    from VISU import PrsObject
    -VISU.PrsObjType.TCURVE,VISU.PrsObjType.TTABLE,VISU.PrsObjType.TMESH,VISU.PrsObjType.TCONTAINER,
    -VISU.PrsObjType.TSCALARMAP,VISU.PrsObjType.TISOSURFACE,VISU.PrsObjType.TDEFORMEDSHAPE,VISU.PrsObjType.TCUTPLANES,
    -VISU.PrsObjType.TVECTORS
    -
    -Back to the contents -

    -

    -Mapping for Structured Types

    -An IDL struct definition is mapped into a Python class or type. For each -field in the struct, there is a corresponding attribute in the class with -the same name as the field. The constructor of the class expects the field -values, from left to right. For example, the IDL definition -
    -
    struct SDate {
    -               short Second;
    -               short Minute;
    -               short Hour;
    -               short Day;
    -               short Month;
    -               short Year;
    -             };
    -
    -could be used in the Python statements -
    -
    Date=SDate(30, 12, 15, 26, 1, 79)
    -print Date.Second,Date.Minute,Date.Hour,Date.Day,Date.Month,Date.Year
    -
    - -
    -Back to the contents
    - - - - + + + + + + Main Page + + + +  +
    + + + + + +
    +
    +
    + +

    +Mapping of IDL definitions to Python language.

    + +

    +Introduction

    +SALOME is a distributed client/server application using the Common +Object Request Broker Architecture (CORBA). CORBA architecture uses the +Interface Definition Language (IDL), which specifies interfaces between +CORBA objects. So with help of IDL CORBA's language independence is ensured +. Because interfaces described in IDL can be mapped to the most of currently +used programming languages, CORBA applications and components are thus +independent of the language(s) used to implement them. In other words, +a client written in C++ can communicate with a server written in Java, +which in turn can communicate with another server written in COBOL, and +so forth. +

    One important thing to remember about IDL is that it is not an implementation +language. That is, applications can't be written in IDL. The sole purpose +of IDL is to define interfaces; providing implementations for these interfaces +is performed using some other language. +

    This page contains an abridged reference manual for mapping of IDL definitions +to Python language. It will be useful for Python programmers who are not +familiar with IDL language. All examples are taken from SALOME source +files. The complete version of Python Language Mapping Specification can +be found here. +
      +

    CONTENTS: +

    +
    + +

    +Using Scoped Names

    +Python implements a module concept that is similar to the IDL scoping mechanisms, +except that it does not allow for nested modules. In addition, Python requires +each object to be implemented in a module; globally visible objects are +not supported. +

    Because of these constraints, scoped names are translated into Python +using the following rules: +

    • An IDL module mapped into a Python module. Modules containing modules +are mapped to packages (i.e., directories with an __init__ module +containing all definitions excluding the nested modules). An implementation +can chose to map toplevel definitions (including the module CORBA) to modules +in an implementationdefined package, to allow concurrent installations +of different CORBA runtime libraries. In that case, the implementation +must provide additional modules so that toplevel modules can be used without +importing them from a package. +

    • For all other scopes, a Python class is introduced that contains all +the definitions inside this scope. +

    • Other global definitions (except modules) appear in a module whose +name is implementation dependent. Implementations are encouraged to use +the name of the IDL file when defining the name of that module. +

    For instance, +

    +
    module SALOMEDS {
    + interface StudyManager {
    +  void  Close(in Study aStudy);
    + };
    +};
    +
    +would introduce a module SALOMEDS.py, which contains the following definitions: +
    +
    # module SALOMEDS.py
    +class StudyManager:
    +  def _Close(self,aStudy):
    +   pass #interfaces are discussed later
    +
    +To avoid conflicts, IDL names that are also Python identifiers are prefixed +with an underscore (‘_’). +

    Back to the contents +

    +

    +Mapping for Template and Array Types

    +Both the bounded and the unbounded string type of IDL are mapped to the +Python string type. Wide strings are represented by an implementation-defined +type with the following properties: +

    • For the wide string X and the integer n, X[n] returns the nth character, +which is a wide string of length 1. +

    • len(X) returns the number of characters of wide string X. +

    • CORBA.wstr(c) returns a wide character with the code point c in an +implementation-defined encoding. +

    • X+Y returns the concatenation of wide strings X and Y. +

    • CORBA.word(CORBA.wstr(c)) == c +

    The sequence template is mapped to sequence objects (e.g., tuples or +lists). Applications should not assume that values of a sequence type are +mutable. Sequences and arrays of octets and characters are mapped to the +string type for efficiency reasons. +

    For example, given the IDL definitions +

    +
    module SALOMEDS {
    +  typedef sequence <string> StringSeq;
    +   
    +   interface AttributeTableOfInteger : GenericAttribute {
    +
    +    void SetRowTitles(in StringSeq theTitles) raises(IncorrectArgumentLength);
    + };
    +};
    +
    +a client could invoke the operation +
    +
    print My_AttributeTableOfInteger.SetRowTitles(["X","F"])
    +
    +Array types are mapped like sequence templates. The application in this +example also expects an IncorrectArgumentLength exception if it passes +sequences that violate the bounds constraint or arrays of wrong size. +

    Another example with arrays. The following IDL definition +

    +
    module SALOMEDS {
    + typedef sequence<GenericAttribute> ListOfAttributes;
    + interface SObject {
    +  ListOfAttributes     GetAllAttributes();
    + };
    +};
    +
    +is equal to +
    +
    import SALOMEDS
    +
    +attributes=[]
    + 
    +attributes = My_SObject.GetAllAttributes()
    +
    +length = len(attributes)
    +
    +print "Attributes number = ", length
    +print attributes
    +
    +Back to the contents +

    +

    +Mapping for Objects and Operations

    +A CORBA object reference is represented as a Python object at run-time. +This object provides all the operations that are available on the interface +of the object. Although this specification does not mandate the use of +classes for stub objects, the following discussion uses classes to indicate +the interface. +

    The nil object is represented by None. +

    If an operation expects parameters of the IDL Object type, any Python +object representing an object reference might be passed as actual argument. +

    If an operation expects a parameter of an abstract interface, either +an object implementing that interface, or a value supporting this interface +may be passed as actual argument. The semantics of abstract values then +define whether the argument is passed by value or by reference. +

    Operations of an interface map to methods available on the object references. +Parameters with a parameter attribute of in or inout are +passed from left to right tothe method, skipping out parameters. +The return value of a method depends on the number of out parameters +and the return type. If the operation returns a value, this value forms +the first result value. All inout or out parameters +form consecutive result values. The method result depends then on +the number of result values: +

    • If there is no result value, the method returns None. +

    • If there is exactly one result value, it is returned as a single +value. +

    • If there is more than one result value, all of them are packed +into a tuple, and this tuple is returned. +

    Assuming the IDL definition +

    +
    module SALOMEDS{
    + interface StudyBuilder{
    +  boolean FindAttribute  ( in SObject anObject, 
    +                           out GenericAttribute anAttribute, 
    +                           in string aTypeOfAttribute );
    + };
    +};
    +
    +a client could write +
    +
    from SALOMEDS import StudyBuilder;
    +my_StudyBuilder=...
    +  
    +  res,A=my_StudyBuilder.FindAttribute(Sobj, "AttributeSequenceOfReal")
    +
    +In this example A corresponds to the return value anAttribute +and res to the boolean return value. +

    If an interface defines an attribute name, for example, the attribute +is mapped into an operation _get_name. If the attribute is not readonly, +there is an additional operation _set_name. +

    The IDL definition +

    +
    module SALOMEDS{
    + interface Study{
    +  attribute string Name;
    + };
    +};
    +
    +is equal to the following +
    +
    from SALOMEDS import Study
    +My_Study=...
    +  Name=My_Study._get_name();
    +  Name=My_Study._set_name();
    +
    +Back to the contents +

    +

    +Narrowing Object References

    +Python objects returned from CORBA operations or pseudo-operations (such +as string_to_object) might have a dynamic type, which is more specific +than the static type as defined in the operation signature. +

    Since there is no efficient and reliable way of automatically creating +the most specific type, explicit narrowing is necessary. To narrow an object +reference A to an interface class AttributeSequenceOfReal, +the client can use the following operation +

    +
    A = A._narrow(SALOMEDS.AttributeSequenceOfReal)
    +
    +Back to the contents +

    +

    +Mapping for Exceptions

    +An IDL exception is translated into a Python class derived from CORBA.UserException. +System exceptions are derived from CORBA.SystemException. Both base classes +are derived from CORBA.Exception. The parameters of the exception are mapped +in the same way as the fields of a struct definition. When raising an exception, +a new instance of the class is created; the constructor expects the exception +parameters. For example, the definition +
    +
    module SALOMEDS{
    + interface StudyBuilder{
    +  exception LockProtection {};
    +  void CommitCommand() raises(LockProtection);
    + };
    +};
    +
    +could be used caught as +
    +
    from SALOMEDS import StudyBuilder;
    +my_StudyBuilder=...
    +try:
    +  my_StudyBuilder.CommitCommand();
    +except StudyBuilder.LockProtection,value:
    +  print "Error! Study is locked for modifications"
    +
    + +


    Back to the contents +

    +

    +Mapping for Enumeration Types

    +An enumeration is mapped into a number of constant objects in the name +space where the enumeration is defined. An application may only test for +equivalence of two enumeration values, and not assume that they behave +like numbers. For example, the definition +
    +
    module VISU {
    + interface PrsObject{
    + 
    +  enum PrsObjType{ TCURVE, TTABLE, TMESH, TCONTAINER,
    +                   TSCALARMAP, TISOSURFACE, TDEFORMEDSHAPE,
    +                   TCUTPLANES, TVECTORS };
    + };
    +};
    +
    +introduces the objects +
    +
    from VISU import PrsObject
    +VISU.PrsObjType.TCURVE,VISU.PrsObjType.TTABLE,VISU.PrsObjType.TMESH,VISU.PrsObjType.TCONTAINER,
    +VISU.PrsObjType.TSCALARMAP,VISU.PrsObjType.TISOSURFACE,VISU.PrsObjType.TDEFORMEDSHAPE,VISU.PrsObjType.TCUTPLANES,
    +VISU.PrsObjType.TVECTORS
    +
    +Back to the contents +

    +

    +Mapping for Structured Types

    +An IDL struct definition is mapped into a Python class or type. For each +field in the struct, there is a corresponding attribute in the class with +the same name as the field. The constructor of the class expects the field +values, from left to right. For example, the IDL definition +
    +
    struct SDate {
    +               short Second;
    +               short Minute;
    +               short Hour;
    +               short Day;
    +               short Month;
    +               short Year;
    +             };
    +
    +could be used in the Python statements +
    +
    Date=SDate(30, 12, 15, 26, 1, 79)
    +print Date.Second,Date.Minute,Date.Hour,Date.Day,Date.Month,Date.Year
    +
    + +
    +Back to the contents
    + + + + diff --git a/doc/salome/tui/KERNEL/sources/static/overview_Kernel.html b/doc/salome/tui/KERNEL/sources/static/overview_Kernel.html index 144d3c341..7f64f4369 100755 --- a/doc/salome/tui/KERNEL/sources/static/overview_Kernel.html +++ b/doc/salome/tui/KERNEL/sources/static/overview_Kernel.html @@ -1,191 +1,191 @@ - - - - - - Main Page - - - -  -
    - - - - - - -
    -
    -
    - - -

    General overview -

    -

    Table of contents

    - - -
    -

    1. Introduction

    -

    The kernel corresponds to the minimal set of services required for the use of SALOME components (Supervisor, IAPP). -The kernel is also used by application software components (solver) and their container. -The kernel is associated to a unique user who can launch only one kernel at once. -The kernel is launched and destroyed by voluntary actions of the user. These functions are realized via the -use of scripts.

    -

    The list of the kernel services related to communication issues is:

    -
      -
    • The Naming service
    • -
    • The Session service
    • -
    • The Life Cycle service
    • -
    • The Registry service
    • -
    • The Notification service
    • -
    -

    This list is enlarged with CORBA independent services :

    - -
      -
    • The module catalog service
    • -
    • The Data Type Catalog service
    • -
    • The resource catalog service
    • -
    -

    SALOME kernel module also encapsulates the Engine -Back to the contents -

    2. Basic principles

    -

    The SALOME user's desktop is a process on a machine. This process includes:

    -
      -
    • A graphic interface (based on Qt),
    • -
    • A text interface (Python interpreter),
    • -
    • A 3D visualization window shared by components.
    • -
    -

    SALOME Modules decompose into an interface (widgets GUI, text mode TUI, 3D visualization V3D) and -an engine.

    -

    The description of a module and its components is obtained by consulting the module catalog.

    -

    The interface is dynamically loaded in the process of the SALOME user's desktop. The engine is a CORBA -server launched either on the local machine or on the distant machine.

    -

    The engine (CORBA server) is created by a factory (or container). -This factory is also a CORBA server. Several containers can be present on a machine. -Some containers are specialized for types of components requiring a specific management. -For example, a specific container is required for components performing parallel calculations. -The engine includes at least a dynamically linked library in the container process. -This library is the implementation of the CORBA server associated to the engine. -If the engine is built from a pre-existent executable code, the library is simply a wrapper of the encapsulated code. -It launches the code in a separate process. Wherever possible, the code is included into the dynamic library. -

    The container is one of the kernel services. If one needs to create a container on a distant machine, one creates a process resuming a part of the kernel services. The kernel can create other containers on distant machines via the trader (rsh). All the containers and the kernel share the same CORBA naming service with which they register.

    -

    The user reaches the functions of various SALOME'S components, either in graphic interactive mode (GUI) or in command mode ( TUI), via a Python interpreter.

    -Back to the contents - -

    3. Services and features of the SALOME kernel module

    -

    This section gives a brief overview of the services composing the kernel module. - The Life Cycle and Naming - services are described in separate chapters of this reference manual.

    - -

    3.1 Session service

    -

    SALOME session describes the period starting from the kernel creation and - ending with its destruction. During this period the user can connect the session - and disconnect from it without ending this session. One connection log could - be written. A priori, no information resulting from another (past) session can - be used by the current session.

    -

    Implementation of this service in SALOME application is provided by the class -Session encapsulated in the package -SALOME.

    - -

    3.2 Registry service

    -

    The active component registry should contain:

    - -
      -
    • The list of the active components
    • -
    • The list of the active containers during a SALOME session.
    • -
    -

    It should allow the state of a session. It also should allow to know if session can be stopped.

    -

    The API reference for this service is not included in the current version of the reference manual.

    - -

    3.3 Notification service

    -

    The notification service is a kernel function which allows exchanging of events between CORBA objects.

    -

    In comparison with traditional CORBA event service, SALOME notification service allows to:

    -
      -
    • Filter the events,
    • -
    • Structure the events,
    • -
    • Establish quality policies of services,
    • -
    • Subscribe to various event channels.
    • -
    -

    The API reference for this service is not included in the current version of the reference - manual.

    - -

    3.4 Module catalog service

    -

    There are two module catalogs in SALOME application:

    -
      -
    • General module catalog : This first catalog is common to all SALOME users once the the platform is installed (for example for a particular company or a service). This catalog will be managed by the integrator or the administrator of the platform, -
    • Personal module catalog : A specific catalog for every user (possibly empty). This catalog should notably allow the developers to test a new component before integrating it into the general catalog. -
    -

    The objective of these two module catalogs is to:

    -
      -
    • List the available modules; -
    • Allow the addition, the modification and the deletion of a module in catalogs; -
    • Look for a module and\or a service fulfilling some given criteria (in catalogs); -
    -

    Implementation of this service in SALOME application is provided by two classes -ModuleCatalogand AComponent encapsulated in the package -SALOME_ModuleCatalog.

    - -

    3.5 Data type catalog

    - -

    The data exchanged between components services have definite types. During description of input, output, and -configuration parameters of components in the module catalog, the -definition of the parameters types is taken from data type catalog. During the editing of execution of -graphs, it is necessary to check that the connections output-input parameters are of compatible -types.

    -

    The data types correspond to CORBA object classes, including attributes and access methods (defined by their IDL). -These types can be created by specialization of generic data types.

    -

    The purpose of the data type catalog is to:

    -
      -
    • List the available data types in the catalog; -
    • Browse the type hierarchy to check the compatibility of types (specialized output toward generic input); -
    • Allow the addition, the modification and the deletion of a data type in the catalog; -
    -

    The API reference for this service is not included in the current version of the reference - manual.

    -

    3.6 Resource catalog

    - -

    This catalog describes machines, possible types of container on a machine, resources of machines... This catalog is used by the SALOME LifeCycle service.

    -

    The API reference for this service is not included in the current version of the reference - manual.

    - -

    3.7 Engine

    -

    The engine represents a shared library which can be dynamically loaded by a container. The container can load this library, -given an interface name and an implementation -name. The container dynamically resolves an extern_C function in the library, -which constructs the CORBA Engine servant object.

    -

    The SALOME engine in - the current version of the application is implemented - as Engines package of interfaces. It encapsulates two classes: Component, Container.

    -

    The API refernce for Engines package can be found here. -

    -

    3.7.1 Component class

    -

    This class is used for interaction between the container and the component and between the components inside the container. -

    -

    The API reference for this class can be found here.

    - -

    3.7.2 Container class

    -

    This class provides a set of methods which are necessary for definition of the process of loading and registration of new components in SALOME application.

    -

    The API reference for this class can be found here.

    - -Back to the contents - - + + + + + + Main Page + + + +  +
    + + + + + + +
    +
    +
    + + +

    General overview +

    +

    Table of contents

    + + +
    +

    1. Introduction

    +

    The kernel corresponds to the minimal set of services required for the use of SALOME components (Supervisor, IAPP). +The kernel is also used by application software components (solver) and their container. +The kernel is associated to a unique user who can launch only one kernel at once. +The kernel is launched and destroyed by voluntary actions of the user. These functions are realized via the +use of scripts.

    +

    The list of the kernel services related to communication issues is:

    +
      +
    • The Naming service
    • +
    • The Session service
    • +
    • The Life Cycle service
    • +
    • The Registry service
    • +
    • The Notification service
    • +
    +

    This list is enlarged with CORBA independent services :

    + +
      +
    • The module catalog service
    • +
    • The Data Type Catalog service
    • +
    • The resource catalog service
    • +
    +

    SALOME kernel module also encapsulates the Engine +Back to the contents +

    2. Basic principles

    +

    The SALOME user's desktop is a process on a machine. This process includes:

    +
      +
    • A graphic interface (based on Qt),
    • +
    • A text interface (Python interpreter),
    • +
    • A 3D visualization window shared by components.
    • +
    +

    SALOME Modules decompose into an interface (widgets GUI, text mode TUI, 3D visualization V3D) and +an engine.

    +

    The description of a module and its components is obtained by consulting the module catalog.

    +

    The interface is dynamically loaded in the process of the SALOME user's desktop. The engine is a CORBA +server launched either on the local machine or on the distant machine.

    +

    The engine (CORBA server) is created by a factory (or container). +This factory is also a CORBA server. Several containers can be present on a machine. +Some containers are specialized for types of components requiring a specific management. +For example, a specific container is required for components performing parallel calculations. +The engine includes at least a dynamically linked library in the container process. +This library is the implementation of the CORBA server associated to the engine. +If the engine is built from a pre-existent executable code, the library is simply a wrapper of the encapsulated code. +It launches the code in a separate process. Wherever possible, the code is included into the dynamic library. +

    The container is one of the kernel services. If one needs to create a container on a distant machine, one creates a process resuming a part of the kernel services. The kernel can create other containers on distant machines via the trader (rsh). All the containers and the kernel share the same CORBA naming service with which they register.

    +

    The user reaches the functions of various SALOME'S components, either in graphic interactive mode (GUI) or in command mode ( TUI), via a Python interpreter.

    +Back to the contents + +

    3. Services and features of the SALOME kernel module

    +

    This section gives a brief overview of the services composing the kernel module. + The Life Cycle and Naming + services are described in separate chapters of this reference manual.

    + +

    3.1 Session service

    +

    SALOME session describes the period starting from the kernel creation and + ending with its destruction. During this period the user can connect the session + and disconnect from it without ending this session. One connection log could + be written. A priori, no information resulting from another (past) session can + be used by the current session.

    +

    Implementation of this service in SALOME application is provided by the class +Session encapsulated in the package +SALOME.

    + +

    3.2 Registry service

    +

    The active component registry should contain:

    + +
      +
    • The list of the active components
    • +
    • The list of the active containers during a SALOME session.
    • +
    +

    It should allow the state of a session. It also should allow to know if session can be stopped.

    +

    The API reference for this service is not included in the current version of the reference manual.

    + +

    3.3 Notification service

    +

    The notification service is a kernel function which allows exchanging of events between CORBA objects.

    +

    In comparison with traditional CORBA event service, SALOME notification service allows to:

    +
      +
    • Filter the events,
    • +
    • Structure the events,
    • +
    • Establish quality policies of services,
    • +
    • Subscribe to various event channels.
    • +
    +

    The API reference for this service is not included in the current version of the reference + manual.

    + +

    3.4 Module catalog service

    +

    There are two module catalogs in SALOME application:

    +
      +
    • General module catalog : This first catalog is common to all SALOME users once the the platform is installed (for example for a particular company or a service). This catalog will be managed by the integrator or the administrator of the platform, +
    • Personal module catalog : A specific catalog for every user (possibly empty). This catalog should notably allow the developers to test a new component before integrating it into the general catalog. +
    +

    The objective of these two module catalogs is to:

    +
      +
    • List the available modules; +
    • Allow the addition, the modification and the deletion of a module in catalogs; +
    • Look for a module and\or a service fulfilling some given criteria (in catalogs); +
    +

    Implementation of this service in SALOME application is provided by two classes +ModuleCatalogand AComponent encapsulated in the package +SALOME_ModuleCatalog.

    + +

    3.5 Data type catalog

    + +

    The data exchanged between components services have definite types. During description of input, output, and +configuration parameters of components in the module catalog, the +definition of the parameters types is taken from data type catalog. During the editing of execution of +graphs, it is necessary to check that the connections output-input parameters are of compatible +types.

    +

    The data types correspond to CORBA object classes, including attributes and access methods (defined by their IDL). +These types can be created by specialization of generic data types.

    +

    The purpose of the data type catalog is to:

    +
      +
    • List the available data types in the catalog; +
    • Browse the type hierarchy to check the compatibility of types (specialized output toward generic input); +
    • Allow the addition, the modification and the deletion of a data type in the catalog; +
    +

    The API reference for this service is not included in the current version of the reference + manual.

    +

    3.6 Resource catalog

    + +

    This catalog describes machines, possible types of container on a machine, resources of machines... This catalog is used by the SALOME LifeCycle service.

    +

    The API reference for this service is not included in the current version of the reference + manual.

    + +

    3.7 Engine

    +

    The engine represents a shared library which can be dynamically loaded by a container. The container can load this library, +given an interface name and an implementation +name. The container dynamically resolves an extern_C function in the library, +which constructs the CORBA Engine servant object.

    +

    The SALOME engine in + the current version of the application is implemented + as Engines package of interfaces. It encapsulates two classes: Component, Container.

    +

    The API refernce for Engines package can be found here. +

    +

    3.7.1 Component class

    +

    This class is used for interaction between the container and the component and between the components inside the container. +

    +

    The API reference for this class can be found here.

    + +

    3.7.2 Container class

    +

    This class provides a set of methods which are necessary for definition of the process of loading and registration of new components in SALOME application.

    +

    The API reference for this class can be found here.

    + +Back to the contents + + diff --git a/doc/salome/tui/KERNEL/sources/static/overview_Life_Cycle.html b/doc/salome/tui/KERNEL/sources/static/overview_Life_Cycle.html index 659c2ab24..f1a1fb8af 100755 --- a/doc/salome/tui/KERNEL/sources/static/overview_Life_Cycle.html +++ b/doc/salome/tui/KERNEL/sources/static/overview_Life_Cycle.html @@ -1,90 +1,90 @@ - - - - - - Life Cycle service Description - - - - - - -  -
    - - - - - - -
    -
    -
    - - -

    Life Cycle service Description

    -

    Introduction

    -

    The objective of this document is to give the users of SALOME - application a brief overview of the Life Cycle service implemented in SALOME. - A complete version of the LifeCycle service specification edited by the Object Management Group, Inc.(OMG) can be found here. -

    -

    Table of contents

    - -
    - -

    1. Overview

    - -

    Life Cycle service defines services and conventions for creating, deleting, copying and moving objects. -Because CORBA-based environments support distributed objects, the Life Cycle service defines conventions that allow clients to perform -life cycle operations on objects in different locations. This overview describes the life cycle problem for distributed object systems.

    -
    - - -

    2. SALOME Life Cycle service description

    -

    The SALOME Life Cycle service represents a partial implementation of the CORBA LifeCycle service.

    -

    From general point of view, the SALOME Life Cycle service allows to find or load with the help of a given container a definte SALOME component with its further -initialization and registration in the Naming service.

    -

    Container - it's a certain engine realizing the mechanism of loading a SALOME module.

    -

    Component - it's a certain abstract shell wrapping SALOME modules, performing all operations concerned with their initialization and registration.

    -

    From the point of view of the service user, the Life Cycle provides a set of functions allowing to :

    -
      -
    • Locate a machine (more generally a container) by a logical set of required features (of both container and - machine);
    • -
    • Load components on the obtained containers;
    • -
    • Create a container;
    • -
    • Obtain the container containing a given component;
    • -
    • Treat the list of the active components;
    • -
    • Treat the list of the available containers.
    • -
    - - - -

    The SALOME Life Cycle is a CORBA server. This server at its initialization is registered with the naming service.

    -

    The Life Cycle service is invoked to find a container and use it to load a -component. It supplies, as parameters, the type of container and the machine features required for loading -a given component. -

    -

    The Life Cycle service then returns a CORBA reference of a launched container.

    -

    Containers are launched on demand depending on components to be loaded. The Life Cycle service manages loading of containers.

    -

    When there is no launched container matching the request the Life Cycle service invokes loading of the correct type of container on a correct machine via a rsh type command.

    -

    The Life Cycle service interrogates containers to have information about the dynamic state of the machine (load). It contains (and update) the state of the active containers.

    -

    The Life Cycle service can implement a loading strategy for new containers on new machines, depending on the state of the already launched containers.

    -

    The Life Cycle service can stop containers at the end of session on -demand.

    - -

    In SALOME platform the Life Cycle service is implemented in SALOME_Life CycleCORBA class. The API refernce for the methods of this class -can be found here.

    -Back to the contents -
    - - -
    - - - + + + + + + Life Cycle service Description + + + + + + +  +
    + + + + + + +
    +
    +
    + + +

    Life Cycle service Description

    +

    Introduction

    +

    The objective of this document is to give the users of SALOME + application a brief overview of the Life Cycle service implemented in SALOME. + A complete version of the LifeCycle service specification edited by the Object Management Group, Inc.(OMG) can be found here. +

    +

    Table of contents

    + +
    + +

    1. Overview

    + +

    Life Cycle service defines services and conventions for creating, deleting, copying and moving objects. +Because CORBA-based environments support distributed objects, the Life Cycle service defines conventions that allow clients to perform +life cycle operations on objects in different locations. This overview describes the life cycle problem for distributed object systems.

    +
    + + +

    2. SALOME Life Cycle service description

    +

    The SALOME Life Cycle service represents a partial implementation of the CORBA LifeCycle service.

    +

    From general point of view, the SALOME Life Cycle service allows to find or load with the help of a given container a definte SALOME component with its further +initialization and registration in the Naming service.

    +

    Container - it's a certain engine realizing the mechanism of loading a SALOME module.

    +

    Component - it's a certain abstract shell wrapping SALOME modules, performing all operations concerned with their initialization and registration.

    +

    From the point of view of the service user, the Life Cycle provides a set of functions allowing to :

    +
      +
    • Locate a machine (more generally a container) by a logical set of required features (of both container and + machine);
    • +
    • Load components on the obtained containers;
    • +
    • Create a container;
    • +
    • Obtain the container containing a given component;
    • +
    • Treat the list of the active components;
    • +
    • Treat the list of the available containers.
    • +
    + + + +

    The SALOME Life Cycle is a CORBA server. This server at its initialization is registered with the naming service.

    +

    The Life Cycle service is invoked to find a container and use it to load a +component. It supplies, as parameters, the type of container and the machine features required for loading +a given component. +

    +

    The Life Cycle service then returns a CORBA reference of a launched container.

    +

    Containers are launched on demand depending on components to be loaded. The Life Cycle service manages loading of containers.

    +

    When there is no launched container matching the request the Life Cycle service invokes loading of the correct type of container on a correct machine via a rsh type command.

    +

    The Life Cycle service interrogates containers to have information about the dynamic state of the machine (load). It contains (and update) the state of the active containers.

    +

    The Life Cycle service can implement a loading strategy for new containers on new machines, depending on the state of the already launched containers.

    +

    The Life Cycle service can stop containers at the end of session on +demand.

    + +

    In SALOME platform the Life Cycle service is implemented in SALOME_Life CycleCORBA class. The API refernce for the methods of this class +can be found here.

    +Back to the contents +
    + + +
    + + + diff --git a/doc/salome/tui/KERNEL/sources/static/overview_Naming.html b/doc/salome/tui/KERNEL/sources/static/overview_Naming.html index ae24ab54d..8af6b10ec 100755 --- a/doc/salome/tui/KERNEL/sources/static/overview_Naming.html +++ b/doc/salome/tui/KERNEL/sources/static/overview_Naming.html @@ -1,197 +1,197 @@ - - - - - - Naming Service Description - - - -  -
    - - - - - - -
    -
    -
    - - -

    Naming Service Description

    -
    -

    Introduction

    -

    This page contains an abridged version of the Naming Service specification - edited by the Object Management Group, Inc.(OMG). The objective of this document is to give the users of SALOME - application a brief overview of the Naming Service implemented in SALOME. - A complete version of this document can be found here. -

    -
    -

    Table of contents

    - - -
    - -

    1. Overview

    -

    This chapter presents the OMG Naming Service and explains how the Naming Service can be used to decouple clients and servers by -providing an external reference exchange mechanism. The chapter also covers how to solve the bootstrapping problem for clients and -servers by controlling their configuration. -

    - -

    In practice, copying stringified references from a server to all its clients is clumsy and does not scale. The Naming Service provides a way -for servers to advertise references under a name, and for clients to retrieve them. The advantages are: -

    -
      -
    • Clients and servers can use meaningful names instead of having to deal with stringified references.
    • -
    • By changing a reference in the service without changing its name, you can transparently direct clients to a different object.
    • -
    • The Naming Service solves the bootstrapping problem because it provides a fixed point for clients and servers to rendezvous.
    • -
    -

    The Naming Service is much like a white pages phone book. Given a name, it - returns an object reference.

    - -

    The terminology used in description of NamigService is the following:

    - -
      -
    • A name-to-IOR association is called by a name binding.
    • -
    • Each binding identifies exactly one object reference, but an object reference - may be bound more than once (have more than one name).
    • -
    • A naming context is an object that contains name bindings. - The names within a context must be unique. Naming contexts can contain bindings - to other naming contexts, so naming contexts can form graphs. Binding contexts - in other contexts creates a naming graph — a directed graph with nodes - and labeled edges where the nodes are contexts. A naming graph allows more - complex names to reference an object. Given a context in a naming graph, a - sequence of names can reference an object. This sequence of names (called - a compound name) defines a path in the naming graph to navigate the - resolution process. Figure 1-1 shows an example of a naming graph.
    • -
    • Binding a name to a context means to add a name–IOR pair to a context.
    • -
    • Resolving a name means to look for a name in a context and to obtain the - IOR bound under that name.
    • -
    - - -
    -

    Figure 1-1 A Naming Graph

    - Back to the contents -
    - -

    2. SALOME Naming Service

    - -

    2.1 Introduction

    -

    The SALOME Naming Service is a kernel function which supplies a name directory - hierarchy for pointing out CORBA objects. This name directory hierarchy allows, - from symbolic names, to dynamically find the references of distributed SALOME - objects, without information about their location. SALOME objects which can - be reached via the naming service are:

    - -
      -
    • The kernel services
    • -
    • Containers -
    • SALOME components instances -
    -

    The name directory hierarchy in SALOME represents a graph of directories containing - symbolic associations name-reference on objects. (It has been described in the - previous section)

    - -

    2.2 Definitions

    -
    -
    Directory
    -
    Context of names containing symbolic associations name-reference on objects.


    -
    "/"
    -
    Character used in SALOME to separate two names of a directory


    -
    Access path
    -
    List of names (separated by "/" character representing the path to be followed - in the graph to reach an association name-reference (the last name in the sequence).
    -
    -
    Note:An object can be referenced by several symbolic names - in one or several directories.
    - -

    2.3 Partition of SALOME name directory hierarchy

    -

    The hierarchical organization of the SALOME name directory is not completely frozen . -Because the framework allows the simultaneous opening of several studies, the following levels are determined:

    -
     
    - /Kernel
    - /Container/
    -	       /Component	
    -
    - -

    2.4 SALOME name directory persistence

    -

    During a SALOME session, stopping a server in charge of the Naming Service - doesn't imply the loss of the contents of the SALOME name directory hierarchy. - A backup file is produced and can be used to restart the Naming Service. So, - one can recover the state of the SALOME name directory hierarchy at restart - time. During such breakdown, every call to any function of the Naming Service - invokes an exception of type Unreachable service.

    - -

    2.5 SALOME Naming Service features

    -

    Usage and administration of the name directory hierarchy is realized by means of the following functions:

    -
      -
    • Recording and recovering of the reference of an object
    • -
    • Searching for a symbolic name
    • -
    • Creating of a directory, reading and modifying of the current directory
    • -
    • Destructing of a symbolic name and a diredtory
    • -
    -

    The access path used in these functions can be defined, either from the root, or from any -directory of SALOME name directory hierarchy.

    - -

    In SALOME there is s standard interface of Naming Service, and any user can - use it for binding and finding objects. How to use it, it's possible to find - in any CORBA documentation. However in SALOME there is an additional layer which - hides calls to standard interface.

    -

    The precise API reference for these functions you can find here.

    -

    Here is a short list of public methods which are used for working with the SALOME Naming Service:

    -
    -

    Register

    -
    Method which register object reference in the naming service with given name. It makes assignment between IOR and stringified name. -Then it's possible to get object reference from name using "Resolve" method.
    -

    -

    Resolve

    -
    Try to obtain object reference from name. It's necessary before publishing - IOR in the Naming Service by Register method.
    -

    -

    Find

    -
    The purpose of this method is to research a name from the current directory - of the naming service. Then if there is occurrence the naming service changes - directory to go to the directory where last occurrence is found.
    -

    -

    CreateDirectory

    -
    This method allows to create one or several directories in the current directory
    -

    -

    ChangeDirectory

    -
    Moves the current directory. The current directory is moved to the root directory if the input parameter Name is "/".
    -

    -

    CurrentDirectory

    -
    Method allowing to get the current directory.
    -

    -

    list

    -
    Method allowing to list and print the whole context beginning from the current context.
    -

    -

    list_directory

    -
    Method to get all contexts contained in the current directory.
    -

    -

    DestroyName

    -
    Destroys a symbolic name-object reference association.
    -

    -

    DestroyDirectory

    -
    Destroys an empty directory.
    -
    - -Back to the contents -
    - - + + + + + + Naming Service Description + + + +  +
    + + + + + + +
    +
    +
    + + +

    Naming Service Description

    +
    +

    Introduction

    +

    This page contains an abridged version of the Naming Service specification + edited by the Object Management Group, Inc.(OMG). The objective of this document is to give the users of SALOME + application a brief overview of the Naming Service implemented in SALOME. + A complete version of this document can be found here. +

    +
    +

    Table of contents

    + + +
    + +

    1. Overview

    +

    This chapter presents the OMG Naming Service and explains how the Naming Service can be used to decouple clients and servers by +providing an external reference exchange mechanism. The chapter also covers how to solve the bootstrapping problem for clients and +servers by controlling their configuration. +

    + +

    In practice, copying stringified references from a server to all its clients is clumsy and does not scale. The Naming Service provides a way +for servers to advertise references under a name, and for clients to retrieve them. The advantages are: +

    +
      +
    • Clients and servers can use meaningful names instead of having to deal with stringified references.
    • +
    • By changing a reference in the service without changing its name, you can transparently direct clients to a different object.
    • +
    • The Naming Service solves the bootstrapping problem because it provides a fixed point for clients and servers to rendezvous.
    • +
    +

    The Naming Service is much like a white pages phone book. Given a name, it + returns an object reference.

    + +

    The terminology used in description of NamigService is the following:

    + +
      +
    • A name-to-IOR association is called by a name binding.
    • +
    • Each binding identifies exactly one object reference, but an object reference + may be bound more than once (have more than one name).
    • +
    • A naming context is an object that contains name bindings. + The names within a context must be unique. Naming contexts can contain bindings + to other naming contexts, so naming contexts can form graphs. Binding contexts + in other contexts creates a naming graph — a directed graph with nodes + and labeled edges where the nodes are contexts. A naming graph allows more + complex names to reference an object. Given a context in a naming graph, a + sequence of names can reference an object. This sequence of names (called + a compound name) defines a path in the naming graph to navigate the + resolution process. Figure 1-1 shows an example of a naming graph.
    • +
    • Binding a name to a context means to add a name–IOR pair to a context.
    • +
    • Resolving a name means to look for a name in a context and to obtain the + IOR bound under that name.
    • +
    + + +
    +

    Figure 1-1 A Naming Graph

    + Back to the contents +
    + +

    2. SALOME Naming Service

    + +

    2.1 Introduction

    +

    The SALOME Naming Service is a kernel function which supplies a name directory + hierarchy for pointing out CORBA objects. This name directory hierarchy allows, + from symbolic names, to dynamically find the references of distributed SALOME + objects, without information about their location. SALOME objects which can + be reached via the naming service are:

    + +
      +
    • The kernel services
    • +
    • Containers +
    • SALOME components instances +
    +

    The name directory hierarchy in SALOME represents a graph of directories containing + symbolic associations name-reference on objects. (It has been described in the + previous section)

    + +

    2.2 Definitions

    +
    +
    Directory
    +
    Context of names containing symbolic associations name-reference on objects.


    +
    "/"
    +
    Character used in SALOME to separate two names of a directory


    +
    Access path
    +
    List of names (separated by "/" character representing the path to be followed + in the graph to reach an association name-reference (the last name in the sequence).
    +
    +
    Note:An object can be referenced by several symbolic names + in one or several directories.
    + +

    2.3 Partition of SALOME name directory hierarchy

    +

    The hierarchical organization of the SALOME name directory is not completely frozen . +Because the framework allows the simultaneous opening of several studies, the following levels are determined:

    +
     
    + /Kernel
    + /Container/
    +	       /Component	
    +
    + +

    2.4 SALOME name directory persistence

    +

    During a SALOME session, stopping a server in charge of the Naming Service + doesn't imply the loss of the contents of the SALOME name directory hierarchy. + A backup file is produced and can be used to restart the Naming Service. So, + one can recover the state of the SALOME name directory hierarchy at restart + time. During such breakdown, every call to any function of the Naming Service + invokes an exception of type Unreachable service.

    + +

    2.5 SALOME Naming Service features

    +

    Usage and administration of the name directory hierarchy is realized by means of the following functions:

    +
      +
    • Recording and recovering of the reference of an object
    • +
    • Searching for a symbolic name
    • +
    • Creating of a directory, reading and modifying of the current directory
    • +
    • Destructing of a symbolic name and a diredtory
    • +
    +

    The access path used in these functions can be defined, either from the root, or from any +directory of SALOME name directory hierarchy.

    + +

    In SALOME there is s standard interface of Naming Service, and any user can + use it for binding and finding objects. How to use it, it's possible to find + in any CORBA documentation. However in SALOME there is an additional layer which + hides calls to standard interface.

    +

    The precise API reference for these functions you can find here.

    +

    Here is a short list of public methods which are used for working with the SALOME Naming Service:

    +
    +

    Register

    +
    Method which register object reference in the naming service with given name. It makes assignment between IOR and stringified name. +Then it's possible to get object reference from name using "Resolve" method.
    +

    +

    Resolve

    +
    Try to obtain object reference from name. It's necessary before publishing + IOR in the Naming Service by Register method.
    +

    +

    Find

    +
    The purpose of this method is to research a name from the current directory + of the naming service. Then if there is occurrence the naming service changes + directory to go to the directory where last occurrence is found.
    +

    +

    CreateDirectory

    +
    This method allows to create one or several directories in the current directory
    +

    +

    ChangeDirectory

    +
    Moves the current directory. The current directory is moved to the root directory if the input parameter Name is "/".
    +

    +

    CurrentDirectory

    +
    Method allowing to get the current directory.
    +

    +

    list

    +
    Method allowing to list and print the whole context beginning from the current context.
    +

    +

    list_directory

    +
    Method to get all contexts contained in the current directory.
    +

    +

    DestroyName

    +
    Destroys a symbolic name-object reference association.
    +

    +

    DestroyDirectory

    +
    Destroys an empty directory.
    +
    + +Back to the contents +
    + + diff --git a/doc/salome/tui/KERNEL/sources/static/overview_Study.html b/doc/salome/tui/KERNEL/sources/static/overview_Study.html index f4c278363..0526536e9 100755 --- a/doc/salome/tui/KERNEL/sources/static/overview_Study.html +++ b/doc/salome/tui/KERNEL/sources/static/overview_Study.html @@ -1,261 +1,261 @@ - - - - - - Main Page - - - -  -
    - - - - - - -
    -
    -
    - - -

    General overview -

    -
    -

    Table of contents

    - -

    1. Introduction

    -

    In SALOME application the Study module is used for management (creation, saving - etc.) of studies. In the framework of the platform, a study represents a working - document allowing to manage the data produced by various components which are - integarted into SALOME.
    -

    -

    2. Representation of the study

    -

    The study represents a set of objects that we will call Study Objects or SObjects. - The study can be represented as a tree, every node of that tree containing a - SObject. SObjects in the study can be values or references towards data of calculation, - graphs of calculation, trees of construction of detail(room), results. Every - SOject of the study is characterised by a unique identifier in the study.

    -

    The study allows to describe the following relations:

    -
      -
    • The link between the transient and persistent values of an SObject.
    • -
    • The relations between the SObjects produced by different components.
    • -
    • The relations between the SObjects produced by the same component.
    • -
    • The link between an object and its user name.
    • -
    • The access to the definition of the component which produce an object of - the study.
    • -
    • The access to instance of the component (if this one exists) which has produced - this SObject of the study.
    • -
    - -

    Every SObject in the study contains a set of attributes. These attributes represent - a set of definitions associated to that object, they can contain values or corba - references towards the data contained in the internal data structure of a component.

    -

    As the structure of the study is tree-like it is possible to associate sub-objects - to objects.

    -

    As particular object, the study contains Component Data which are labels associated to the component -which produce data in the study. It is to this object that we can associate attributes containing ID which -we shall allow to identify the type of the component and also its instance. Objects produced by a -component will be sub-objects of the coresponding Data Component.

    -

    For example Component Data GEOM will contain the data produced by the component - Geom.

    - - - - - -
    GEOM contains the data produced by the component GEOM. The component MESH - contains a SObject Mesh_1 wich refers to the SObject identified - by ID4 corresponding to Geometrie_1.
    -

    We distinguish two forms of the study, the study opened in a session SALOME and the study in the -persistent format. These two formats are described in the following sections

    -

    2.1 Study in transient format

    -

    The representation of the study in memory will be based on the document OCAF (supplied by OCC). -The document OCAF can be seen as a tree, every node of that tree is identified by a tag representing an integer value.

    -

    The exploration of the tree from the root to a node supplies a sequence of tags which establishes a -unique identifier ID. ID represents a character string containing the sequence of tags separated by -one ':'.

    -

    For example 0:1:12:4

    -

    To every node we can associate a set of attributes.

    -

    The attributes which the study can contain can be of the following types:

    -
      -
    • All standard attributes supplied by OCC (package TdataStd) which allow to define (integers, -real, strings, identifiers, references etc.)
    • -
    • Attributes which contain CORBA references.
    • -
    • Attributes which contain the path HDF to reach the persistent datum. (Cf. the following chapter)
    • -
    -

    Remark: it is the study which takes care to build the attributes from the values which are passed to it, so -an attribute is always in a study, and it knows the study object to which it is attached.

    -

    Example of a Study Object as a set of various attributes.

    - -

    2.2 Study in persistent format

    -

    To store a study HDF format is used, this tool allows to represent persistent data in the form of a tree.

    -

    Under the root of the persistent document, you can find a set of nodes:

    -
      -
    • The first node contains the skeleton of the study. The skeleton consists of the identifiers of the -objects, as well as the references among them.
    • -
    • There is also one node for every component which has produced data during this SALOME session. Under each of these -node there are values of the data produced by this component.
    • -
    -

    2.3 Link between transient and persistent formats

    -

    It will be possible to complete the definition of one object in the study by associating to it an attribute -HDFPath which will contain the path to the persistent data.

    - -

    Back to the contents

    -

    3. Services and features of the study

    -

    The Study in SALOME application possess a wide functionality. This functionality is provided by a set of classes which are described -below. -

    3.1 Study class

    -

    The purpose of the Study class is to manage the data produced by various components - of SALOME platform. Most of the Study operations are handled by the StudyManager - and the StudyBuilder. What - is left in the Study class are elementary inquiries. A Study is explored by - a set of tools, mainly iterators , which are described further.

    -

    Nevertheless, the Study class contains a set of methods providing:

    - -
      -
    • management of study properties -
    • search for SObjects. -
    • search for SComponents -
    • creation of a new StudyBuilder, ComponentIterator, ChildIterator etc. -
    -

    The API reference for this class can be found here.

    -

    3.2 StudyBuilder class

    -

    StudyBuilder supplies basic services to edit the study. The edition of the study is made by the -component. Every component will use the basic services of the StudyBuilder allowing to write and publish objects.

    -

    StudyBulder provides the following functionality:

    -
      -
    • creation, modification or deletetion of SObjects in the study
    • -
    • creation or removal of SComponents
    • -
    • undo/redo functionality. For that purpose it supplies the methods NewCommand, - CommitCommand, AbortCommand.
    • -
    -

    The API reference for this class can be found here.

    -

    3.3 StudyManager class

    -

    The purpose of the Manager is to manipulate Studies. Since SALOME is a multi-document - application during a working session you can operate as many stadies as you - wishes to create.

    -

    For that purpose StudyManager provides the following functionality:

    -
      -
    • creation, opening, closing and saving studies
    • -
    • navigation through a set of studies present in the current working session
    • -
    • copy/paste of the objects in the study functionality.
    • -
    -

    The API reference for this class can be found here.

    -

    3.4 SObject class

    -

    The objects in the study are built by the StudyBuilder. -The SObject class provides methods for elementary inquiries, like getting an object ID or its attribuites.

    -

    The API reference for this class can be found here.

    -

    3.5 SComponent class

    -

    The SComponent class establishes in the study a permanent assocition to the components -integrated into SALOME platform. The SComponent interface is a specialization of the SObject - class. It inherits the most of its methods from the SObject class which are used for management of the SComponents.

    -

    The API reference for this class can be found here.

    -

    3.6 ChildIterator class

    -

    It is one of the tools destined for exploration of the study. This class contains a set of methods allowing to get -the access to all identified objects which are sons of another identifiedobject.

    -

    The API reference for this class can be found here.

    -

    3.7 SComponentIterator

    -

    This is the second tool destined for exploration of the study. This interface contains the methods allowing to iterate over all SComponents in the list. - The search is started from the first SComponent in the list.

    -

    The API reference for this class can be found here.

    - -

    3.8 GenericAttribute class

    -

    GenericAttribute represents a base class for all attributes which can be assigned to the SObjects created in the study. All attribute classes - derive from this classe and inherit its methods.

    -

    The API reference for this class can be found here.

    - -

    In SALOME application a SObject can possess the following attributes:

    - - - - - -
    - -
    -

    3.9 UseCaseBuilder class

    -

    UseCase in the study represents a user-defined subtree, containing all or some of the objects which currently exist -in the study. The UseCaseBuilder class contains a set of methods used for management (creation, deletion etc) of this sub-tree in the study.

    -

    The API reference for this class can be found here.

    - -

    3.10 UseCaseIterator

    -

    This class represents an exploration tool for the UseCase. It contains a set of methods used for iteration over the objects in the UseCase.

    -

    The API reference for this class can be found here.

    - -

    3.11 Callback class

    -

    The StudyBuilder can be created with the method NewBuilder. While invocation of this method a new object of the class - Callback is created and this object is assigned to the newly created Builder as callback which should be called - when adding and removing the objects.

    -

    The API reference for this class can be found here.

    - -

    3.12 Driver class

    - -

    This class represents a common tool for all components integrated into SALOME - application, that allows them to communicate with the study. It contains a set - of methods which can be called by any component and which provide the following - functionality: -

      -
    • publishing in the study of the objects created by a definite component
    • -
    • saving/loading of the data created by a definite component. These methods - are called by the StudyManager when loading/saving a study containing the - data created by a definite component.
    • -
    • transforming of the transient references into persistant references (or - vice versa) of the SObjects when saving (or loading) a study
    • -
    • copy/paste common functionality. These methods can be called by any component - in order to copy/paste its object created in the study
    • -
    -

    The API reference for this class can be found here.

    -

    Back to the contents

    - - + + + + + + Main Page + + + +  +
    + + + + + + +
    +
    +
    + + +

    General overview +

    +
    +

    Table of contents

    + +

    1. Introduction

    +

    In SALOME application the Study module is used for management (creation, saving + etc.) of studies. In the framework of the platform, a study represents a working + document allowing to manage the data produced by various components which are + integarted into SALOME.
    +

    +

    2. Representation of the study

    +

    The study represents a set of objects that we will call Study Objects or SObjects. + The study can be represented as a tree, every node of that tree containing a + SObject. SObjects in the study can be values or references towards data of calculation, + graphs of calculation, trees of construction of detail(room), results. Every + SOject of the study is characterised by a unique identifier in the study.

    +

    The study allows to describe the following relations:

    +
      +
    • The link between the transient and persistent values of an SObject.
    • +
    • The relations between the SObjects produced by different components.
    • +
    • The relations between the SObjects produced by the same component.
    • +
    • The link between an object and its user name.
    • +
    • The access to the definition of the component which produce an object of + the study.
    • +
    • The access to instance of the component (if this one exists) which has produced + this SObject of the study.
    • +
    + +

    Every SObject in the study contains a set of attributes. These attributes represent + a set of definitions associated to that object, they can contain values or corba + references towards the data contained in the internal data structure of a component.

    +

    As the structure of the study is tree-like it is possible to associate sub-objects + to objects.

    +

    As particular object, the study contains Component Data which are labels associated to the component +which produce data in the study. It is to this object that we can associate attributes containing ID which +we shall allow to identify the type of the component and also its instance. Objects produced by a +component will be sub-objects of the coresponding Data Component.

    +

    For example Component Data GEOM will contain the data produced by the component + Geom.

    + + + + + +
    GEOM contains the data produced by the component GEOM. The component MESH + contains a SObject Mesh_1 wich refers to the SObject identified + by ID4 corresponding to Geometrie_1.
    +

    We distinguish two forms of the study, the study opened in a session SALOME and the study in the +persistent format. These two formats are described in the following sections

    +

    2.1 Study in transient format

    +

    The representation of the study in memory will be based on the document OCAF (supplied by OCC). +The document OCAF can be seen as a tree, every node of that tree is identified by a tag representing an integer value.

    +

    The exploration of the tree from the root to a node supplies a sequence of tags which establishes a +unique identifier ID. ID represents a character string containing the sequence of tags separated by +one ':'.

    +

    For example 0:1:12:4

    +

    To every node we can associate a set of attributes.

    +

    The attributes which the study can contain can be of the following types:

    +
      +
    • All standard attributes supplied by OCC (package TdataStd) which allow to define (integers, +real, strings, identifiers, references etc.)
    • +
    • Attributes which contain CORBA references.
    • +
    • Attributes which contain the path HDF to reach the persistent datum. (Cf. the following chapter)
    • +
    +

    Remark: it is the study which takes care to build the attributes from the values which are passed to it, so +an attribute is always in a study, and it knows the study object to which it is attached.

    +

    Example of a Study Object as a set of various attributes.

    + +

    2.2 Study in persistent format

    +

    To store a study HDF format is used, this tool allows to represent persistent data in the form of a tree.

    +

    Under the root of the persistent document, you can find a set of nodes:

    +
      +
    • The first node contains the skeleton of the study. The skeleton consists of the identifiers of the +objects, as well as the references among them.
    • +
    • There is also one node for every component which has produced data during this SALOME session. Under each of these +node there are values of the data produced by this component.
    • +
    +

    2.3 Link between transient and persistent formats

    +

    It will be possible to complete the definition of one object in the study by associating to it an attribute +HDFPath which will contain the path to the persistent data.

    + +

    Back to the contents

    +

    3. Services and features of the study

    +

    The Study in SALOME application possess a wide functionality. This functionality is provided by a set of classes which are described +below. +

    3.1 Study class

    +

    The purpose of the Study class is to manage the data produced by various components + of SALOME platform. Most of the Study operations are handled by the StudyManager + and the StudyBuilder. What + is left in the Study class are elementary inquiries. A Study is explored by + a set of tools, mainly iterators , which are described further.

    +

    Nevertheless, the Study class contains a set of methods providing:

    + +
      +
    • management of study properties +
    • search for SObjects. +
    • search for SComponents +
    • creation of a new StudyBuilder, ComponentIterator, ChildIterator etc. +
    +

    The API reference for this class can be found here.

    +

    3.2 StudyBuilder class

    +

    StudyBuilder supplies basic services to edit the study. The edition of the study is made by the +component. Every component will use the basic services of the StudyBuilder allowing to write and publish objects.

    +

    StudyBulder provides the following functionality:

    +
      +
    • creation, modification or deletetion of SObjects in the study
    • +
    • creation or removal of SComponents
    • +
    • undo/redo functionality. For that purpose it supplies the methods NewCommand, + CommitCommand, AbortCommand.
    • +
    +

    The API reference for this class can be found here.

    +

    3.3 StudyManager class

    +

    The purpose of the Manager is to manipulate Studies. Since SALOME is a multi-document + application during a working session you can operate as many stadies as you + wishes to create.

    +

    For that purpose StudyManager provides the following functionality:

    +
      +
    • creation, opening, closing and saving studies
    • +
    • navigation through a set of studies present in the current working session
    • +
    • copy/paste of the objects in the study functionality.
    • +
    +

    The API reference for this class can be found here.

    +

    3.4 SObject class

    +

    The objects in the study are built by the StudyBuilder. +The SObject class provides methods for elementary inquiries, like getting an object ID or its attribuites.

    +

    The API reference for this class can be found here.

    +

    3.5 SComponent class

    +

    The SComponent class establishes in the study a permanent assocition to the components +integrated into SALOME platform. The SComponent interface is a specialization of the SObject + class. It inherits the most of its methods from the SObject class which are used for management of the SComponents.

    +

    The API reference for this class can be found here.

    +

    3.6 ChildIterator class

    +

    It is one of the tools destined for exploration of the study. This class contains a set of methods allowing to get +the access to all identified objects which are sons of another identifiedobject.

    +

    The API reference for this class can be found here.

    +

    3.7 SComponentIterator

    +

    This is the second tool destined for exploration of the study. This interface contains the methods allowing to iterate over all SComponents in the list. + The search is started from the first SComponent in the list.

    +

    The API reference for this class can be found here.

    + +

    3.8 GenericAttribute class

    +

    GenericAttribute represents a base class for all attributes which can be assigned to the SObjects created in the study. All attribute classes + derive from this classe and inherit its methods.

    +

    The API reference for this class can be found here.

    + +

    In SALOME application a SObject can possess the following attributes:

    + + + + + +
    + +
    +

    3.9 UseCaseBuilder class

    +

    UseCase in the study represents a user-defined subtree, containing all or some of the objects which currently exist +in the study. The UseCaseBuilder class contains a set of methods used for management (creation, deletion etc) of this sub-tree in the study.

    +

    The API reference for this class can be found here.

    + +

    3.10 UseCaseIterator

    +

    This class represents an exploration tool for the UseCase. It contains a set of methods used for iteration over the objects in the UseCase.

    +

    The API reference for this class can be found here.

    + +

    3.11 Callback class

    +

    The StudyBuilder can be created with the method NewBuilder. While invocation of this method a new object of the class + Callback is created and this object is assigned to the newly created Builder as callback which should be called + when adding and removing the objects.

    +

    The API reference for this class can be found here.

    + +

    3.12 Driver class

    + +

    This class represents a common tool for all components integrated into SALOME + application, that allows them to communicate with the study. It contains a set + of methods which can be called by any component and which provide the following + functionality: +

      +
    • publishing in the study of the objects created by a definite component
    • +
    • saving/loading of the data created by a definite component. These methods + are called by the StudyManager when loading/saving a study containing the + data created by a definite component.
    • +
    • transforming of the transient references into persistant references (or + vice versa) of the SObjects when saving (or loading) a study
    • +
    • copy/paste common functionality. These methods can be called by any component + in order to copy/paste its object created in the study
    • +
    +

    The API reference for this class can be found here.

    +

    Back to the contents

    + + diff --git a/doc/salome/tui/Makefile.am b/doc/salome/tui/Makefile.am index 8d0902dbc..794840fc4 100644 --- a/doc/salome/tui/Makefile.am +++ b/doc/salome/tui/Makefile.am @@ -25,12 +25,16 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am -EXTRA_DIST = $(srcdir)/KERNEL $(srcdir)/pythfilter.py +EXTRA_DIST = pythfilter.py dist-hook: + cp -rf $(srcdir)/KERNEL $(distdir) + if test -d "KERNEL"; then \ + find "KERNEL" -name "*.*" -exec cp -rf {} $(distdir)/KERNEL ';' ; \ + fi rm -rf `find $(distdir) -name CVS` -usr_docs: +KERNEL/main.html:../main.dox cp -fr $(srcdir)/KERNEL/* ./INPUT; \ cd ./INPUT; \ pwd; ls;\ @@ -48,12 +52,34 @@ 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; + +usr_docs:KERNEL/main.html + if test -d "KERNEL"; then b=; else b="$(srcdir)/"; fi; \ + cp -fr $(srcdir)/KERNEL/sources/static/*.* $(DESTDIR)$(docdir); \ + cp -fr $(srcdir)/KERNEL/sources/ $(DESTDIR)$(docdir); \ + find $$b"KERNEL" -name "*.*" -exec cp -rf {} $(DESTDIR)$(docdir) ';' ; \ + cp -fr $(srcdir)/KERNEL/HTML/ $(DESTDIR)$(docdir); \ + cp -f $(srcdir)/pythfilter.py $(DESTDIR)$(docdir); \ + cp -fr $(srcdir)/KERNEL/exemple/ $(DESTDIR)$(docdir); + +uninstall-local: + chmod +w $(DESTDIR)$(docdir)/sources + chmod +w $(DESTDIR)$(docdir)/sources/static + chmod +w $(DESTDIR)$(docdir)/HTML + chmod +w $(DESTDIR)$(docdir)/exemple + rm -rf $(DESTDIR)$(docdir)/pythfilter.py + find $(DESTDIR)$(docdir) -name "*.html" -type f -exec rm -rf {} \; + find $(DESTDIR)$(docdir) -name "*.jpg" -type f -exec rm -rf {} \; + find $(DESTDIR)$(docdir) -name "*.map" -type f -exec rm -rf {} \; + find $(DESTDIR)$(docdir) -name "*.md5" -type f -exec rm -rf {} \; + find $(DESTDIR)$(docdir) -name "*.png" -type f -exec rm -rf {} \; + find $(DESTDIR)$(docdir) -name "*.gif" -type f -exec rm -rf {} \; + find $(DESTDIR)$(docdir) -name "*.css" -type f -exec rm -rf {} \; + find $(DESTDIR)$(docdir) -name "*.js*" -type f -exec rm -rf {} \; + rm -rf $(DESTDIR)$(docdir)/sources + rm -rf $(DESTDIR)$(docdir)/HTML + rm -rf $(DESTDIR)$(docdir)/exemple + rm -rf $(DESTDIR)$(docdir)/*.in 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/doc/salome/version.texi b/doc/salome/version.texi deleted file mode 100644 index f9a81011e..000000000 --- a/doc/salome/version.texi +++ /dev/null @@ -1,4 +0,0 @@ -@set UPDATED 31 May 2006 -@set UPDATED-MONTH May 2006 -@set EDITION 3.2.0 -@set VERSION 3.2.0 diff --git a/idl/Calcium_Ports.idl b/idl/Calcium_Ports.idl new file mode 100644 index 000000000..ee381a491 --- /dev/null +++ b/idl/Calcium_Ports.idl @@ -0,0 +1,81 @@ +// 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 : SALOME_Ports.idl +// Author : Eric Fayolle, EDF + +#ifndef _CALCIUM_PORTS_IDL_ +#define _CALCIUM_PORTS_IDL_ + +#include "SALOME_Ports.idl" + +module Ports { + + module Calcium_Ports { + + const long UNLIMITED_STORAGE_LEVEL = -70; + enum DependencyType { UNDEFINED_DEPENDENCY, TIME_DEPENDENCY, ITERATION_DEPENDENCY }; + enum DateCalSchem { TI_SCHEM, TF_SCHEM , ALPHA_SCHEM}; + enum InterpolationSchem { L0_SCHEM, L1_SCHEM }; + enum ExtrapolationSchem { UNDEFINED_EXTRA_SCHEM, E0_SCHEM, E1_SCHEM}; + + // enum DisconnectDirective {UNDEFINED_DIRECTIVE,CONTINUE,STOP}; + typedef boolean DisconnectDirective; + const DisconnectDirective stop = FALSE; + const DisconnectDirective cont = TRUE; + + interface Calcium_Port : Ports::Data_Port, Ports::PortProperties { + void disconnect(in DisconnectDirective mode); + }; + + typedef sequence seq_long; + typedef sequence seq_float; + typedef sequence seq_double; + typedef sequence seq_string; + typedef sequence seq_boolean; + typedef seq_float seq_complex; + + interface Calcium_Integer_Port : Calcium_Port { + void put (in seq_long data, in double time, in long tag); + }; + + interface Calcium_Real_Port : Calcium_Port { + void put (in seq_float data, in double time, in long tag); + }; + + interface Calcium_Double_Port : Calcium_Port { + void put (in seq_double data, in double time, in long tag); + }; + + interface Calcium_String_Port : Calcium_Port { + void put (in seq_string data, in double time, in long tag); + }; + + interface Calcium_Logical_Port : Calcium_Port { + void put (in seq_boolean data, in double time, in long tag); + }; + + interface Calcium_Complex_Port : Calcium_Port { + void put (in seq_complex data, in double time, in long tag); + }; + + }; +}; + +#endif diff --git a/idl/DSC_Engines.idl b/idl/DSC_Engines.idl new file mode 100644 index 000000000..25c6ec7eb --- /dev/null +++ b/idl/DSC_Engines.idl @@ -0,0 +1,404 @@ +// 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 : DSC_Engines.idl +// Author : Andre RIBES, EDF +// $Header: + +#ifndef _DSC_ENGINES_IDL_ +#define _DSC_ENGINES_IDL_ + +#include "SALOME_Component.idl" +#include "SALOME_Ports.idl" + +/*! \file + This is a package that contains IDL interfaces that permits to add + a dynamic port model to the SALOME object model. + */ +module Engines { + + /*! \brief Interface of a DSC component. + + This interface defines the operations needed to add a component model with dynamic port + declaration to the SALOME object model. A component is a black box that interacts with + other components only by his ports. A port represents a connection point for the component. + In this model, a port is a CORBA interface, so a CORBA object. + + There is two ways for a component to interact with a port type : + - It implements the port : it means "the component provides an implementation of the + interface of the port". We design this kind of port as "provides ports". It provides an + interface to other components. + - It needs to use an object that provides the port interface. We say that the component uses this + port type. It is represented by a "uses" port. A uses port can be connected with a provides port + of the same interface type. When the connection is done, a component can use the "uses port" to use the + interface provided by the "provides port". + + The interface DSC implements the component interface that containes the operations that are needed + to manage declarations into a component and connections between ports. + + These operations are logicaly divided in two parts : + - First part permits to add an get ports of a component. + - Second part permits to connect/disconnect ports. + */ + interface DSC : Engines::Component { + +/*--------------------------------------------------------------------------------------------*/ +/*-------------------------------------- Types Part ------------------------------------------*/ + + /*! + This sequence is a uses port. It's a sequence since a uses port can be + connected with x provides port. Sometimes this kind of uses port is called multiple port. + At this programming level, the user has to deal with the sequence. In the DSC_user + layer, the user only deals with one pointer. + */ + typedef sequence uses_port; + + /*! + This enumeration is used when the connection of a port (uses or provides) + is changed. This information is for the component's user code. + */ + enum Message {AddingConnection, + RemovingConnection, + ApplicationError}; + + /*! + This exception is raised when a port's name is gived before + it is added to the component. + */ + exception PortNotDefined {}; + + /*! + This exception is raised if you try to add a port with the same + name than a previous defined port. + */ + exception PortAlreadyDefined {}; + + /*! + This exception is raised when you try to use a port that is not connected. + */ + exception PortNotConnected {}; + + /*! + This exception is raised if the type of the provides port is bad. + This exception contains a string that gives what type is expected + and the type that the operation received. + */ + exception BadPortType { + string expected; + string received; + }; + + /*! + Port's reference is Nil ! + */ + exception NilPort {}; + + /*! + Port's reference is not the right reference. + */ + exception BadPortReference {}; + + /*! + Object porperty is not good for the port + */ + exception BadProperty {}; + + +/*--------------------------------------------------------------------------------------------*/ +/*-------------------------------------- Operation Part --------------------------------------*/ + + /*! + This operation adds a provides port to the component. + + \param ref port's Corba reference. + \param provides_port_name port's name. + \param port_prop port's property object. + + \exception PortAlreadyDefined + \exception NilPort + \exception BadProperty + + \note Notice that the name of the port is unique on a component. So if there is + a uses port that has the same name, the PortAlreadyDefined exception will be throw. + Also notice that each port as an object property that is associated with. + */ + void add_provides_port(in Ports::Port ref, + in string provides_port_name, + in Ports::PortProperties port_prop) raises(PortAlreadyDefined, + NilPort, + BadProperty); + + /*! + This operation adds a uses port to the component. + + \param repository_id port's Corba repository id. + Eg : IDL:toto.tata/MODULE/INTERFACE_NAME:1.0 + \param uses_port_name port's name. + \param port_prop port's property object. + + \exception PortAlreadyDefined + \exception BadProperty + + \note Notice that the name of the port is unique on the component. So if there is + a provides port that has the same name, the PortAlreadyDefined exception will be throw. + Also notice that each port as an object property that is associated with. + */ + void add_uses_port(in string repository_id, + in string uses_port_name, + in Ports::PortProperties port_prop) raises(PortAlreadyDefined, + BadProperty); + + /*! + This operation is used to get a provides port of the component. + It can be used by the framework or the component himself. + + If it's the framework that wants the port, the reference has to be gived + even if the port is not connected (boolean connection_error to false). + Contrary, if it's the component that wants the port, the port is given + in most of cases only if it is connected (boolean connection_error to true). + Notice that you can choose the behaviour that you want. + + \param provides_port_name port's name. + \param connection_error true if you want to wait that the port is connected with + an another port. + \return port's Corba reference. + + \exception PortNotDefined + \exception PortNotConnected + \exception BadPortType + + */ + Ports::Port get_provides_port(in string provides_port_name, + in boolean connection_error) raises(PortNotDefined, + PortNotConnected, + BadPortType); + + /*! + This operation is used to get a uses port of the component. + It can be used by the framework or the component himself. + Actually, only the user layer of the component will use this operation. + A uses port could be obtained if and only if the uses port is connected. The sequence + contains all the connections since a uses port can have multiple connections. + + There is a system of callbacks to prevent the user code that there is a new + (or a deletion) of a connection (see DSC_Callbacks class). + + \param uses_port_name port's name. + \return uses port's sequence. + + \exception PortNotDefined + \exception PortNotConnected + \exception BadPortType + + \see DSC_Callbacks + */ + uses_port get_uses_port(in string uses_port_name) raises(PortNotDefined, + PortNotConnected, + BadPortType); + + + /*! + This operation connects a provides port with a uses port. + + \param provides_port_name provides port's name. + + \exception PortNotDefined + + \note Notice that the provides doesn't uses port names or component reference. + */ + void connect_provides_port(in string provides_port_name) raises(PortNotDefined); + + /*! + This operation connects a uses port with a provides port. + + \param uses_port_name uses port's name. + \param provides_port_ref provides port's Corba reference. + + \exception PortNotDefined + \exception BadPortType + \exception NilPort + */ + void connect_uses_port(in string uses_port_name, + in Ports::Port provides_port_ref) raises(PortNotDefined, + BadPortType, + NilPort); + /*! + This operation tests if a port is connected. You can test + a uses port or a provides port. + + \param port_name port's name. + \return true if the uses port is connected. + + \exception PortNotDefined + */ + boolean is_connected(in string port_name) raises(PortNotDefined); + + /*! + This operation disconnects a uses port to a provides port. + + \param provides_port_name provides port's name. + \param message state associated with the disconnection. + + \exception PortNotDefined + \exception PortNotConnected + */ + void disconnect_provides_port(in string provides_port_name, + in Engines::DSC::Message message) raises(PortNotDefined, + PortNotConnected); + + /*! + This operation disconnects a provides port to a uses port. + + \param uses_port_name uses port's name. + \param provides_port_ref CORBA reference of the provides port. + \param message state associated with the disconnection. + + \exception PortNotDefined + \exception PortNotConnected + \exception BadPortReference + */ + void disconnect_uses_port(in string uses_port_name, + in Ports::Port provides_port_ref, + in Engines::DSC::Message message) raises(PortNotDefined, + PortNotConnected, + BadPortReference); + /*! + This operation permits to get port's property object. + + \param port_name port's name. + \return properties object's CORBA reference. + + \exception PortNotDefined + */ + Ports::PortProperties get_port_properties(in string port_name) raises(PortNotDefined); + + }; + + /*! \brief Interface of the ConnectionManager. + It is a helper object for connection operations. + The ConnectionManager is used like other services of SALOME (e.g ContainerManager). + */ + interface ConnectionManager { + + /*! + The Id gived to the disconnect method is bad. + */ + exception BadId {}; + + /*! + A connection Id. It's unique. + */ + typedef short connectionId; + + /*! + This operation connects a uses port with a provides port. + + \param uses_component The component that have the uses port. + \param uses_port_name uses port's name. + \param provides_component The component that have the provides port. + \param provides_port_name provides port's name. + + \exception Engines::DSC::PortNotDefined + \exception Engines::DSC::BadPortType + \exception Engines::DSC::NilPort + + \return the id of the connection that the ConnectionManager will use + to release this connection when the framework (or a user script, ...) + will call ConnectionManager::disconnect. + */ + connectionId connect(in Engines::DSC uses_component, + in string uses_port_name, + in Engines::DSC provides_component, + in string provides_port_name) raises(Engines::DSC::PortNotDefined, + Engines::DSC::BadPortType, + Engines::DSC::NilPort); + + /*! + This operation releases a connection that has been previously created by + the ConnectionManager. + + \param id The id of the connection previously gived by the connect operation + of the ConnectionManager. + \param message state associated with the disconnection. + + \exception Engines::ConnectionManager::BadId + */ + void disconnect(in connectionId id, + 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(); + }; + +/*--------------------------------------------------------------------------------------------*/ + + /*! \brief Interface of the Superv_Component. + This interface is a DSC component that contains services for the SALOME module SUPERV. + This interface contains methods that are only in local (so they are described + and explained in the implementation class Superv_Component_i). These methods give access + to data-oriented ports provided by default by SALOME's kernel. + */ + interface Superv_Component : Engines::DSC { + + /*! + The SUPERV module call this method before starting the service. Thus the service + can add is dynamics ports before it is started. + + \param service_name service's name. + \return true if the service is correctly initialised. + */ + boolean init_service(in string service_name); + }; + +/*--------------------------------------------------------------------------------------------*/ + + /*! \brief Interface of a Parallel_DSC component. + This interface defines the operations needed to add a paco++ port + into a parallel DSC component. + */ + interface Parallel_DSC : Engines::Superv_Component, Engines::Parallel_Component { + + /*! + This operation gives the proxy node of a paco++ port to all the nodes. + Only a node of the parallel component is going to add a proxy object + with an internal method. + + \param ref provides proxy port's reference. + \param provides_port_name provides port's name. + + \see Engines_ParallelDSC_i::add_parallel_provides_proxy_port + */ + void set_paco_proxy(in Object ref, + in string provides_port_name, + in Ports::PortProperties port_prop); + + }; +}; + +#endif diff --git a/idl/DSC_Engines.xml b/idl/DSC_Engines.xml new file mode 100644 index 000000000..a4d5603b6 --- /dev/null +++ b/idl/DSC_Engines.xml @@ -0,0 +1,58 @@ + + + + + + Engines + + DSC + + connect_provides_port + distributed + + + connect_uses_port + distributed + + + + Parallel_DSC + + set_paco_proxy + distributed + + + + Superv_Component + + init_service + distributed + + + + diff --git a/idl/Makefile.am b/idl/Makefile.am index a09c9c622..9ff37591d 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -26,6 +26,12 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am +if WITH_PACO_PARALLEL +MAKEFLAGS = -j1 +endif + +AM_CXXFLAGS = -fPIC + BASEIDL_FILES = \ SALOME_Exception.idl \ SALOME_Comm.idl \ @@ -41,7 +47,11 @@ BASEIDL_FILES = \ SALOME_GenericObj.idl \ SALOME_Session.idl \ SALOME_TestModuleCatalog.idl \ - nstest.idl + nstest.idl \ + DSC_Engines.idl \ + SALOME_Ports.idl \ + Calcium_Ports.idl \ + Palm_Ports.idl MPIIDL_FILES = \ SALOME_MPIObject.idl \ @@ -54,7 +64,8 @@ if MPI_IS_OK endif # all the idl files are needed for make dist -EXTRA_DIST= $(BASEIDL_FILES) $(MPIIDL_FILES) +EXTRA_DIST= $(BASEIDL_FILES) $(MPIIDL_FILES) \ + SALOME_Component.xml DSC_Engines.xml SALOME_Ports.xml # This variable defines the files to be installed salomeidl_DATA = $(IDL_FILES) @@ -78,7 +89,19 @@ BASEIDL_SOURCES =\ SALOME_GenericObjSK.cc \ SALOME_SessionSK.cc \ SALOME_TestModuleCatalogSK.cc \ - nstestSK.cc + nstestSK.cc \ + DSC_EnginesSK.cc \ + SALOME_PortsSK.cc \ + Calcium_PortsSK.cc \ + Palm_PortsSK.cc + +DYNIDL_SRCS = \ + 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 \ @@ -90,41 +113,136 @@ if MPI_IS_OK IDL_SOURCES += $(MPIIDL_SOURCES) endif -BUILT_SOURCES = $(IDL_SOURCES) -lib_LTLIBRARIES = libSalomeIDLKernel.la -nodist_libSalomeIDLKernel_la_SOURCES = $(BUILT_SOURCES) -libSalomeIDLKernel_la_CPPFLAGS =\ - -I$(top_builddir)/salome_adm/unix \ - -I$(top_builddir)/idl \ - @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ +STATIDL_SOURCES=$(BASEIDL_SOURCES) +if MPI_IS_OK + STATIDL_SOURCES += $(MPIIDL_SOURCES) +endif + +$(DYNIDL_SRCS) : $(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_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_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 + +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 \ + SALOME_PortsPaCO.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_Exception.xml SALOME_Component.xml DSC_Engines.xml SALOME_Ports.xml +endif + +idldir = $(prefix)/idl/salome +nodist_idl_DATA = ${XML} ${IDL_PACO} +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 + +lib_LTLIBRARIES = libSalomeIDLKernel.la $(PAR_LIB) + +nodist_libSalomeIDLKernel_la_SOURCES = $(IDL_SOURCES) $(DYNIDL_SRCS) +libSalomeIDLKernel_la_CPPFLAGS =-I$(top_builddir)/salome_adm/unix \ + -I$(top_builddir)/idl \ + @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ libSalomeIDLKernel_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeIDLKernel_la_LIBADD = @CORBA_LIBS@ +nodist_libSalomeParallelIDLKernel_la_SOURCES = $(PAR) $(GEN_PACO) +libSalomeParallelIDLKernel_la_CPPFLAGS =-I$(top_builddir)/idl \ + @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \ + @PACO_INCLUDES@ +libSalomeParallelIDLKernel_la_LDFLAGS = -no-undefined -version-info=0:0:0 +libSalomeParallelIDLKernel_la_LIBADD = libSalomeIDLKernel.la @PACO_LIBS@ + # These variables defines the building process of CORBA files OMNIORB_IDL = @OMNIORB_IDL@ OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_builddir)/salome/idl -IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_builddir)/salome/idl +IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -Wba -I$(top_builddir)/salome/idl IDLPYFLAGS = @IDLPYFLAGS@ # potential problem on parallel make on the following - multiple outputs SUFFIXES = .idl .hh SK.cc .idlSK.cc: $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< -.idl.hh: - $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< +SK.cc.hh: + +#Dummy rule to replace the following one (for parallel make) +#.idl.hh: +# $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< +%PaCO.h %PaCO.cc : %.idl %.xml + @PACO_IDL@ -I $(srcdir):@PACOPATH@/idl $^ omniORB4 0 install-exec-local: $(IDL_FILES:%=$(top_srcdir)/idl/%) - $(INSTALL) -d $(pkgpythondir) + $(INSTALL) -d $(DESTDIR)$(salomepythondir) ls $^ | while read file; do \ - $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(pkgpythondir) $$file ; \ + $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \ done # uninstall-local removes too much, but it works in distcheck uninstall-local: - rm -rf $(pkgpythondir)/* + rm -rf $(DESTDIR)$(salomepythondir)/* mostlyclean-local: -rm -f *.hh *.cc .depidl @@ -145,3 +263,5 @@ mostlyclean-local: -include .depidl +CLEANFILES = *PaCO* *.h + diff --git a/idl/Palm_Ports.idl b/idl/Palm_Ports.idl new file mode 100644 index 000000000..3e1b0bc60 --- /dev/null +++ b/idl/Palm_Ports.idl @@ -0,0 +1,71 @@ +// 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 : SALOME_Ports.idl +// Author : André RIBES, EDF + +#ifndef _PALM_PORTS_IDL_ +#define _PALM_PORTS_IDL_ + +#include "SALOME_Ports.idl" + +/*! \file + This file contains IDL palm ports declations. +*/ + +module Ports { + + module Palm_Ports { + + /*! \brief Interface of a short for palm. + */ + interface Palm_Data_Short_Port : Ports::Data_Port { + + /*! + This operation permits to transmit a short. + + \param data the short transmitted. + \param time time associated to the short. + \param tag tag associated to the short. + */ + void put (in short data, in long time, in long tag); + }; + + /*! + It is a sequence of short for palm ports. + */ + typedef sequence seq_short; + + /*! \brief Interface of a sequence of short port. + */ + interface Palm_Data_Seq_Short_Port : Ports::Data_Port { + /*! + This operation permits to transmit a sequence of short. + + \param data the sequence transmitted. + \param time time associated to the data. + \param tag tag associated to the data. + */ + void put (in seq_short data, in long time, in long tag); + }; + + }; +}; + +#endif diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 52f4e1022..6fd42cd02 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -23,10 +23,6 @@ // Author : Yves FRICAUD // $Header$ -/*! \mainpage - \image html Application-About.png -*/ - /*! \file SALOMEDS.idl This file contains a set of interfaces used for creation, managment and modification of the %Study @@ -173,7 +169,7 @@ during each working session. \param aComponentName It's a string value in the Comment Attribute of the Component, which is looked for, defining the data type of this Component. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ SComponent FindComponent (in string aComponentName); /*! @@ -186,7 +182,7 @@ during each working session. \param anObjectName String parameter defining the name of the object \return The obtained %SObject -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ SObject FindObject (in string anObjectName); @@ -234,14 +230,14 @@ during each working session. Sets the context of the %Study. \param thePath String parameter defining the context of the study. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetContext(in string thePath); /*! Gets the context of the %Study. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ string GetContext(); @@ -283,7 +279,7 @@ during each working session. \return A new %StudyBuilder. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ StudyBuilder NewBuilder() ; @@ -297,7 +293,7 @@ during each working session. Returns the attriubte, which contains the properties of this study. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ AttributeStudyProperties GetProperties(); @@ -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 */ @@ -400,7 +402,31 @@ during each working session. \param thePID is a process ID of the caller \param isLocal is set True if the Study is launched locally with the caller */ - long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + + +/*! + Marks this Study as being locked by the given locker. The lock status can be checked by method IsStudyLocked + \param theLockerID identifies a locker of the study can be for ex. IOR of the engine that locks the study. +*/ + void SetStudyLock(in string theLockerID); + +/*! + Returns True if the Study was marked locked. +*/ + boolean IsStudyLocked(); + +/*! + Marks this Study as being unlocked by the given locker. The lock status can be checked by method IsStudyLocked + \param theLockerID identifies a locker of the study can be for ex. IOR of the engine that unlocks the study. +*/ + void UnLockStudy(in string theLockerID); + +/*! + Returns the list iof IDs of the Study's lockers. +*/ + ListOfStrings GetLockerID(); + }; @@ -429,7 +455,7 @@ during each working session. Creates a new %SComponent \param ComponentDataType Data type of the %SComponent which will be created. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ SComponent NewComponent(in string ComponentDataType) raises(LockProtection); @@ -452,7 +478,7 @@ during each working session. \param theFatherObject The father %SObject under which this one should be created. \return New %SObject -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ @@ -485,7 +511,7 @@ during each working session. /*! Loads a %SComponent. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void LoadWith (in SComponent sco, in Driver Engine) raises (SALOME::SALOME_Exception); @@ -502,7 +528,7 @@ during each working session. \param anObject The %SObject corresponding to the attribute which is looked for. \param aTypeOfAttribute Type of the attribute. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ GenericAttribute FindOrCreateAttribute(in SObject anObject, @@ -526,7 +552,7 @@ during each working session. \param anObject The %SObject corresponding to the attribute. \param aTypeOfAttribute Type of the attribute. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void RemoveAttribute(in SObject anObject, in string aTypeOfAttribute) raises(LockProtection); @@ -550,7 +576,7 @@ during each working session. Adds a directory in the %Study. \param theName String parameter defining the name of the directory. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void AddDirectory(in string theName) raises(LockProtection); @@ -577,7 +603,7 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin Creates a new command which can contain several different actions. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void NewCommand(); // command management @@ -587,7 +613,7 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void CommitCommand() raises(LockProtection); // command management @@ -599,7 +625,7 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin Cancels all actions declared within the command. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void AbortCommand(); // command management /*! \brief Undolimit @@ -613,7 +639,7 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void Undo() raises (LockProtection); @@ -623,21 +649,21 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin \exception LockProtection This exception is raised, when trying to perform this command a study, which is protected for modifications. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void Redo() raises (LockProtection); /*! Returns True if at this moment there are any actions which can be canceled. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ boolean GetAvailableUndos(); /*! Returns True if at this moment there are any actions which can be redone. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ boolean GetAvailableRedos(); @@ -684,13 +710,25 @@ 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. \param study_name String parameter defining the name of the study -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ Study NewStudy(in string study_name); @@ -701,7 +739,7 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin \param aStudyUrl The path to the study \warning This method doesn't activate the corba objects. Only a component can do it. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ Study Open (in URL aStudyUrl) raises (SALOME::SALOME_Exception); @@ -716,7 +754,7 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin \param theMultiFile If this parameter is True the study will be saved in several files. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ boolean Save(in Study aStudy, in boolean theMultiFile); @@ -733,7 +771,7 @@ Searches for a definite %SObject with a definite GUID and returns True if it fin \param aStudy The study which will be saved \param theMultiFile If this parameter is True the study will be saved in several files. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ boolean SaveAs(in URL aUrl, // if the file already exists in Study aStudy, @@ -818,7 +856,7 @@ Gets the list of open studies \param thePID is a process ID of the caller \param isLocal is set True if the StudyManager is launched locally with the caller */ - long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); }; @@ -880,7 +918,7 @@ Gets the list of open studies \param aTypeOfAttribute String value defining the type of the required attribute of the given %SObject. \return True if it finds an attribute of a definite type of the given %SObject as well as the discovered attribute. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ boolean FindAttribute(out GenericAttribute anAttribute, in string aTypeOfAttribute); @@ -894,7 +932,7 @@ Gets the list of open studies \return The list of all attributes of the given %SObject. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ ListOfAttributes GetAllAttributes(); @@ -935,7 +973,7 @@ Gets the list of open studies \param thePID is a process ID of the caller \param isLocal is set True if the SObject is launched locally with the caller */ - long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); }; @@ -972,7 +1010,7 @@ Gets the list of open studies \param thePID is a process ID of the caller \param isLocal is set True if the GenericAttribute is launched locally with the caller */ - long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); + long long GetLocalImpl(in string theHostname, in long thePID, out boolean isLocal); }; @@ -1026,7 +1064,7 @@ Moves the iterator to the next %SComponent in the list. /*! Returns the %SComponent corresponding to the current %SComponent found by the iterator. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ SComponent Value(); @@ -1189,7 +1227,7 @@ can be called by any component and which provide the following functionality: \param isMultiFile If the value of this boolean parameter is True, the data will be saved in several files. \return A byte stream TMPFile that contains all saved data -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ @@ -1204,7 +1242,7 @@ can be called by any component and which provide the following functionality: \param isMultiFile If the value of this boolean parameter is True, the data will be saved in several files. \return A byte stream TMPFile that will contain all saved data -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ TMPFile SaveASCII(in SComponent theComponent, in string theURL, in boolean isMultiFile); diff --git a/idl/SALOMEDS_Attributes.idl b/idl/SALOMEDS_Attributes.idl index 461d8dbc2..6e50fb52f 100644 --- a/idl/SALOMEDS_Attributes.idl +++ b/idl/SALOMEDS_Attributes.idl @@ -69,13 +69,13 @@ module SALOMEDS /*! Returns the value of this attribute. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ double Value(); /*! Sets the value of this attribute. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetValue(in double value); @@ -91,13 +91,13 @@ module SALOMEDS /*! Returns the value of this attribute -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ long Value(); /*! Sets the value of this attribute -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetValue(in long value); }; @@ -123,7 +123,7 @@ module SALOMEDS \param value A real number added to the sequence. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void Add (in double value); /*! @@ -138,7 +138,7 @@ module SALOMEDS \param index The index of the given real number. \param value The value of another real number. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void ChangeValue(in long index, in double value); @@ -147,13 +147,13 @@ module SALOMEDS in the sequence of real numbers stored in the Attribute. \param index The index of the given real number. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ double Value(in short index); /*! Returns the length of the sequence of real numbers stored in the Attribute. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ long Length(); @@ -179,7 +179,7 @@ module SALOMEDS Adds to the end of the sequence an integer number. \param value An integer number added to the sequence. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void Add (in long value); @@ -188,7 +188,7 @@ module SALOMEDS from the sequence of integer numbers stored in the Attribute. \param index The index of the given integer number. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void Remove(in long index); @@ -204,13 +204,13 @@ module SALOMEDS in the sequence of integer numbers stored in the Attribute. \param index The index of the given integer number. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ long Value(in short index); /*! Returns the length of the sequence of integer numbers stored in the Attribute. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ long Length(); @@ -229,7 +229,7 @@ module SALOMEDS /*! Returns the value of this attribute -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ string Value(); /*! @@ -237,7 +237,7 @@ module SALOMEDS \param value This parameter defines the value of this attribute. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetValue(in string value); }; @@ -254,14 +254,32 @@ module SALOMEDS /*! Returns the value of this attribute -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ string Value(); /*! Sets the value of this attribute \param value This string parameter defines the value of this attribute - a description of a %SObject. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. +*/ + void SetValue(in string value); + }; + //========================================================================== +/*! \brief String attribute + + This attribute stores a string value containing arbitrary information. +*/ + //========================================================================== + interface AttributeString : GenericAttribute + { +/*! + Returns the value of this attribute +*/ + string Value(); +/*! + Sets the value of this attribute + \param value This string parameter defines the value of this attribute. */ void SetValue(in string value); }; @@ -277,14 +295,14 @@ module SALOMEDS /*! Returns the value of this attribute -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ string Value(); /*! Sets the value of this attribute \param value This parameter defines the value of this attribute - IOR of a %SObject. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetValue(in string value); }; @@ -300,14 +318,14 @@ module SALOMEDS /*! Returns the value of this attribute -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ string Value(); /*! Sets the value of this attribute \param value This parameter defines the value of this attribute. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetValue(in string value); }; @@ -322,12 +340,12 @@ module SALOMEDS { /*! Returns the value of this attribute -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ string Value(); /*! Sets the value of this attribute -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetValue(in string value); }; @@ -342,12 +360,12 @@ module SALOMEDS { /*! Returns the value of this attribute -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ string Value(); /*! Sets the value of this attribute -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetValue(in string value); }; @@ -369,7 +387,7 @@ module SALOMEDS /*! Returns TRUE if the item is drawable (as it is by default) and FALSE if it isn't. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ boolean IsDrawable(); @@ -378,7 +396,7 @@ Sets the item to be drawable. \param value If the value of this boolean parameter is TRUE (default) the item will be drawable. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetDrawable(in boolean value); @@ -397,7 +415,7 @@ Sets the item to be drawable. Returns TRUE if the item is selectable (as it is by default) and FALSE if it isn't. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ boolean IsSelectable(); @@ -406,7 +424,7 @@ Sets the item to be selectable \param value If the value of this parameter is TRUE (the default) the item will be set as selectable. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetSelectable(in boolean value); @@ -425,7 +443,7 @@ Sets the item to be selectable /*! Returns TRUE if this item is expandable even when it has no children. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ boolean IsExpandable(); @@ -433,7 +451,7 @@ Sets the item to be selectable \param value If the value of this boolean parameter is TRUE, this item will be set as expandable. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetExpandable(in boolean value); @@ -482,7 +500,7 @@ Sets the item to be selectable /*! Returns TRUE if this item is open (its children are visible) and FALSE if it isn't. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ boolean IsOpened(); @@ -492,7 +510,7 @@ Sets the item to be selectable \param value If the value of this boolean parameter is TRUE this item will be set as open, and as closed if FALSE. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetOpened(in boolean value); @@ -508,7 +526,7 @@ Sets the item to be selectable /*! Returns the color of an item. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ Color TextColor(); @@ -517,7 +535,7 @@ Sets the item to be selectable \param value This parameter defines the color of the item. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetTextColor(in Color value); @@ -536,7 +554,7 @@ Sets the item to be selectable -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ Color TextHighlightColor(); @@ -544,7 +562,7 @@ Sets the item to be selectable Sets the highlight color of an item. \param value This parameter defines the highlight color of the item. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetTextHighlightColor(in Color value); @@ -564,7 +582,7 @@ Sets the item to be selectable /*! Returns the name of the icon in the format of a string. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ string GetPixMap(); @@ -572,7 +590,7 @@ Sets the item to be selectable Sets the name of the icon. \param value This string parameter defines the name of the icon. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetPixMap(in string value); @@ -585,7 +603,7 @@ Sets the item to be selectable tree whith its own structure and identifier. The quantity of such trees with different identifiers can be arbitrary. -
    See also an example of usage of the methods of this interface in batchmode of %SALOME application. +
    See also an example of usage of the methods of this interface in batchmode of %SALOME application. */ //========================================================================== @@ -673,7 +691,7 @@ Sets the item to be selectable /*! Deletes a tree node. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void Remove(); @@ -716,7 +734,7 @@ Sets the item to be selectable /*! Returns the value of this attribute. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ long Value(); /*! @@ -724,7 +742,7 @@ Sets the item to be selectable \param value This parameter defines the local ID which will be set. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetValue(in long value); }; @@ -740,13 +758,13 @@ Sets the item to be selectable /*! Returns the value of this attribute -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ string Value(); /*! Sets the value of this attribute -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void SetValue(in string value); }; @@ -765,7 +783,7 @@ Sets the item to be selectable /*! Adds a %SObject to the list of %SObjects which refer to this %SObject. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void Add(in SObject anObject); @@ -776,7 +794,7 @@ Sets the item to be selectable /*! Deletes a %SObject from the list of %SObjects which refer to this %SObject. -
    See also an example of this method usage in batchmode of %SALOME application. +
    See also an example of this method usage in batchmode of %SALOME application. */ void Remove(in SObject anObject); @@ -787,7 +805,7 @@ Sets the item to be selectable This attribute allows to store a table of integers (indexing from 1 like in CASCADE) and string titles of this table, of each row, of each column. -
    See also an example of usage of these methods in batchmode of %SALOME application. +
    See also an example of usage of these methods in batchmode of %SALOME application. */ //========================================================================== @@ -946,7 +964,7 @@ Sets the item to be selectable This attribute allows to store a table of reals (indexing from 1 like in CASCADE) and string titles of this table, of each row, of each column. -
    See also an example of usage of these methods in batchmode of %SALOME application. +
    See also an example of usage of these methods in batchmode of %SALOME application. */ //========================================================================== @@ -1096,7 +1114,7 @@ Sets the item to be selectable This attribute allows to store a table of strings (indexing from 1 like in CASCADE) and string titles of this table, of each row, of each column. -
    See also an example of usage of these methods in batchmode of %SALOME application. +
    See also an example of usage of these methods in batchmode of %SALOME application. */ //========================================================================== @@ -1245,7 +1263,7 @@ Sets the item to be selectable This attribute allows to store study properties: user name, creation date, creation mode, modified flag, locked flag. -
    See also an example of usage of these methods in batchmode of %SALOME application. +
    See also an example of usage of these methods in batchmode of %SALOME application. */ //========================================================================== diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index 5503ed3f2..0619ebfa0 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 @@ -81,8 +84,8 @@ module Engines >0 otherwise (== study id) \return a loaded component */ - Component create_component_instance(in string componentName, - in long studyId); + Engines::Component create_component_instance(in string componentName, + in long studyId); /*! Finds a servant instance of a component @@ -129,10 +132,20 @@ module Engines */ readonly attribute string name ; + /*! + working directory of the %container + */ + readonly attribute string workingdir ; + + /*! + name of the %container log file (this has been set by the launcher) + */ + attribute string logfilename ; + /*! Shutdown the Container process. */ - oneway void Shutdown(); + void Shutdown(); /*! Returns the hostname of the container @@ -159,6 +172,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 +191,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 +296,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 +429,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 +639,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 new file mode 100644 index 000000000..2b65d9058 --- /dev/null +++ b/idl/SALOME_Component.xml @@ -0,0 +1,72 @@ + + + + + + Engines + + Container + + ping + distributed + + + create_component_instance + distributed + + + load_component_Library + distributed + + + + Component + + 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 e2999e9e8..8d2258cf5 100644 --- a/idl/SALOME_ContainerManager.idl +++ b/idl/SALOME_ContainerManager.idl @@ -27,31 +27,84 @@ 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; + string workingdir; + + // PaCO specific informations + string parallelLib; + long nb_component_nodes; }; /*! - Type to transmit list of machines. + exception thrown if a computer is not found in the catalog */ - typedef sequence MachineList; + exception NotFound {}; + + enum policy {P_FIRST,P_CYCL,P_BEST}; + typedef policy ResPolicy; /*! - exception thrown if a computer is not found in the catalog + Structure used for Salome Batch Job parameters */ - exception NotFound {}; +struct BatchParameters +{ + string batch_directory; // Where batch command will be launched + // and log files will be created + string expected_during_time; // Time for the batch + // has to be like this : hh:mm + string mem; // Minimum of memory needed + // has to be like : 32gb or 512mb + + long nb_proc; // Number of processors requested +}; + +/*! \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 BatchParameters batch_params, + 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 @@ -61,15 +114,43 @@ struct MachineParameters Container FindOrStartContainer( in MachineParameters params, in MachineList possibleComputers); - string FindBest(in MachineList possibleComputers); + /*! + This operation launches a PaCO++ container. + + \param Description of the container resquested. + \param List of computers ressources. + + \return Container's CORBA reference. + */ + Container FindOrStartParallelContainer( in MachineParameters params, + in MachineList possibleComputers); + + Container StartContainer( in MachineParameters params, + 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/idl/SALOME_Exception.xml b/idl/SALOME_Exception.xml new file mode 100644 index 000000000..33d565323 --- /dev/null +++ b/idl/SALOME_Exception.xml @@ -0,0 +1,31 @@ + + + + + + diff --git a/idl/SALOME_ModuleCatalog.idl b/idl/SALOME_ModuleCatalog.idl index 27f81b0f6..dfc8764f6 100644 --- a/idl/SALOME_ModuleCatalog.idl +++ b/idl/SALOME_ModuleCatalog.idl @@ -64,19 +64,10 @@ This struct contains fields defining the parameter of the service. DATASTREAM_ITERATIVE } ; - enum DataStreamType { - DATASTREAM_UNKNOWN, - DATASTREAM_INTEGER, - DATASTREAM_FLOAT, - DATASTREAM_DOUBLE, - DATASTREAM_STRING, - DATASTREAM_BOOLEAN - } ; - struct ServicesDataStreamParameter { - DataStreamType Parametertype; /*! 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. */ @@ -140,16 +165,26 @@ List of path prefixes */ typedef sequence PathPrefixes; +/*! +Implementation type +*/ + enum ImplType { + SO, /* component implemented as a dynamic library loadable with dlopen */ + PY, /* component implemented as a python module loadable with import */ + EXE /* component implemented as an executable */ + } ; + /*! Description of a component */ - struct Component + struct ComponentDef { ComponentType type; string name; string username; boolean multistudy; - boolean implementationType; + ImplType implementationType; + string implname; string icon; string constraint; ListOfDefInterface interfaces; @@ -290,9 +325,14 @@ Gets the icone of the component (for IAPP) readonly attribute string component_icone; /*! -Gets the implementation type of the component : C++ or Python (for IAPP) +Gets the implementation type of the component : C++ (dyn lib), Python (module) or executable */ - readonly attribute boolean implementation_type; + readonly attribute ImplType implementation_type; +/*! +Gets the implementation name of the component : name of the dyn lib or the python module or the executable +if the default naming scheme is not convenient. +*/ + readonly attribute string implementation_name; } ; /*! \brief %Module catalog interface @@ -303,6 +343,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 +392,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_Ports.idl b/idl/SALOME_Ports.idl new file mode 100644 index 000000000..eac841f90 --- /dev/null +++ b/idl/SALOME_Ports.idl @@ -0,0 +1,127 @@ +// 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 : SALOME_Ports.idl +// Author : Andre RIBES, EDF +// $Header: + +#ifndef _SALOME_PORTS_IDL_ +#define _SALOME_PORTS_IDL_ + +/*! \file + This file contains the IDL declarations of the kind of ports provided by the + SALOME component model. + */ + +module Ports { + + /*! \brief Interface of a DSC Port. + This interface defines a Port. + A port is a CORBA interface. + */ + interface Port {}; + + /*! \brief Interface of a Control_Port. + This interface defines a Control Port. When a component uses a control port, + it says that the service associated to the provides port can be started. + + \note Currently Control_Port can not employed since it is not recognized + by the supervisor. But this type can be used to classified the port. + */ + interface Control_Port : Ports::Port {}; + + /*! \brief Interface a Data_Port. + This interface defines a Data Port. + A Data Port is a port that transmit data between two components. + + Each Data Port has a Put operation for the emitter and a Get operation + for the receiver. + + \note Data_Port is currently empty but it permits to identified + the behaviour of a port. + */ + interface Data_Port : Ports::Port {}; + + /*! \brief Data_And_Control_Port. + This interface defines a combination of a Control_Port and a Data_Port. + + \note Like Control_Port, Data_And_Control_Port can not employed since it is + not recognized by the supervisor. But this type can be used to classified the port. + */ + interface Data_And_Control_Port : Ports::Port {}; + + /*! + This exception indicates that the property doesn't not exist. + */ + exception NotDefined {}; + + /*! + This exception indicates that the given value to the property is not + of a good type. + */ + exception BadType {}; + + /*! + This exception indicates that the given value to the property is not + authorized. + */ + exception BadValue {}; + + /*! \brief Interface of a PortProperties. + This interface permits to set and get properties + associated to a port. Each uses or provides port have a + PortProperties object. But this object could be empty. + */ + interface PortProperties { + + /*! + This operation permits to set a value of a property. + + \param name property's name. + \param value value of the property. + + \exception Ports::BadType + \exception Ports::NotDefined + */ + void set_property(in string name, in any value) raises (Ports::BadType, + Ports::BadValue, + Ports::NotDefined); + + /*! + This operation permits to get property's value. + + \param name property's name. + \return value of the property. + + \exception Ports::NotDefined + */ + any get_property(in string name) raises (Ports::NotDefined); + }; + + /*! \brief Interface of a basic datastream short port + This interface defines a Data_Port that transmit a CORBA::Short. + This interface can be seen as an example of an integration of + a port in the DSC_User programming model. + */ + interface Data_Short_Port : Ports::Data_Port { + void put(in short data); + }; +}; + +#endif diff --git a/idl/SALOME_Ports.xml b/idl/SALOME_Ports.xml new file mode 100644 index 000000000..1c917bb61 --- /dev/null +++ b/idl/SALOME_Ports.xml @@ -0,0 +1,39 @@ + + + + + + Ports + + Port + + + Control_Port + + + 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 9a96d8b5f..041df52a7 100644 --- a/idl/SALOME_Session.idl +++ b/idl/SALOME_Session.idl @@ -15,7 +15,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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // // // @@ -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..11e6b6e26 100644 --- a/resources/CatalogResources.xml.in +++ b/resources/CatalogResources.xml.in @@ -1,48 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/resources/KERNELCatalog.xml.in b/resources/KERNELCatalog.xml.in index 02afa4055..8986273ce 100644 --- a/resources/KERNELCatalog.xml.in +++ b/resources/KERNELCatalog.xml.in @@ -8,6 +8,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 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/Makefile.am b/salome_adm/Makefile.am index 7ae83a6fc..5fa052423 100644 --- a/salome_adm/Makefile.am +++ b/salome_adm/Makefile.am @@ -17,3 +17,4 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # SUBDIRS = unix +AUTOMAKE_OPTIONS=filename-length-max=255 diff --git a/salome_adm/unix/DEPRECATED/make_commence.in b/salome_adm/unix/DEPRECATED/make_commence.in index 55199bf36..7b0ac2043 100644 --- a/salome_adm/unix/DEPRECATED/make_commence.in +++ b/salome_adm/unix/DEPRECATED/make_commence.in @@ -9,6 +9,7 @@ SHELL=@SHELL@ HAVE_SSTREAM=@HAVE_SSTREAM@ +MODULE_NAME=@MODULE_NAME@ LIBS=@LIBS@ LIBSFORBIN=@LIBS@ diff --git a/salome_adm/unix/DEPRECATED/make_conclude.in b/salome_adm/unix/DEPRECATED/make_conclude.in index 9583f49d4..bbecd612d 100644 --- a/salome_adm/unix/DEPRECATED/make_conclude.in +++ b/salome_adm/unix/DEPRECATED/make_conclude.in @@ -14,14 +14,14 @@ @CORBA@ # transform idl reference in appropriate obj file -LIB_CLIENT_SRC = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX)) +LIB_CLIENT_SRC = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX)) $(LIB_CLIENT_IDL:%.idl=%DynSK.cc) LIB_SERVER_SRC = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_CXX)) LIB_MOC_SRC = $(LIB_MOC:%.h=%_moc.cxx) LIB_SRC+=$(LIB_MOC_SRC) LIB_SWIG_SRC = $(SWIG_DEF:%.i=%_wrap.cxx) LIB_DEP= $(LIB_SRC) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(LIB_SWIG_SRC) -LIB_CLIENT_OBJ = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ)) +LIB_CLIENT_OBJ = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ)) $(LIB_CLIENT_IDL:%.idl=%DynSK.o) LIB_SERVER_OBJ = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ)) @@ -75,13 +75,13 @@ $(LIB): $(LIB_OBJ) @$(LT) --mode=link $(CXX) -shared -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS) # transform idl reference in appropriate obj file -BIN_CLIENT_SRC = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX)) +BIN_CLIENT_SRC = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX)) $(BIN_CLIENT_IDL:%.idl=%DynSK.cc) BIN_SERVER_SRC = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_CXX)) BIN_MOC_SRC = $(BIN_MOC:%.h=%_moc.cxx) BIN_SRC+=$(BIN_MOC_SRC) BIN_DEP=$(BIN:%=%.cxx) $(BIN_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC) -BIN_CLIENT_OBJ = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ)) +BIN_CLIENT_OBJ = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ)) $(BIN_CLIENT_IDL:%.idl=%DynSK.o) BIN_SERVER_OBJ = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ)) # transform c file in appropriate libtool obj file (.c) BIN_OBJ_C = $(patsubst %.c, %.o, $(filter %.c, $(BIN_SRC))) @@ -164,11 +164,11 @@ RESOURCES_FILES ?= $(RESOURCES_FILES_ALL) resources: resources-po resources-cp -resources-po: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm) +resources-po: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm) -resources-cp: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%) +resources-cp: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%) -$(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%): $(top_builddir)/share/salome/resources/% : % +$(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%): $(top_builddir)/share/salome/resources/$(MODULE_NAME)/% : % cp -fr $< $@; # Make installation directories if they don't exist. @@ -228,19 +228,19 @@ $(EXPORT_SHAREDPYSCRIPTS:%=install-%): install-%: % # generic rule to install .qm files : install-qm: resources - $(INSTALL) -d $(datadir)/resources - @for f in X $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm); do \ + $(INSTALL) -d $(datadir)/resources/$(MODULE_NAME) + @for f in X $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm); do \ if test $$f != X; then \ - ($(INSTALL_DATA) $$f $(datadir)/resources/. || exit 1); \ + ($(INSTALL_DATA) $$f $(datadir)/resources/$(MODULE_NAME)/. || exit 1); \ fi; \ done # generic rule to install resources files (png, ini ...): install-res: resources - $(INSTALL) -d $(datadir)/resources - @for f in X $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%); do \ + $(INSTALL) -d $(datadir)/resources/$(MODULE_NAME) + @for f in X $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%); do \ if test $$f != X; then \ - ($(INSTALL_DATA) $$f $(datadir)/resources/. || exit 1); \ + ($(INSTALL_DATA) $$f $(datadir)/resources/$(MODULE_NAME)/. || exit 1); \ fi; \ done @@ -291,7 +291,7 @@ uninstall: # Uninstall qm files @for f in X $(PO_FILES:%.po=%.qm); do \ if test $$f != X; then \ - $(LT_UNINSTALL) $(datadir)/resources/$$f ; \ + $(LT_UNINSTALL) $(datadir)/resources/$(MODULE_NAME)/$$f ; \ fi; \ done @@ -336,7 +336,7 @@ clean: mostlyclean # distclean: clean #remove qm file ! - -$(RM) $(PO_FILES:%.po=%.qm) $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm) + -$(RM) $(PO_FILES:%.po=%.qm) $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm) #remove include files -$(RM) $(DEST_HEADERS) -$(RM) $(DISTCLEAN) *.bak *.old *.new .dep* @@ -383,7 +383,7 @@ distclean: clean %_wrap.cxx : %.i $(SWIG) $(SWIG_FLAGS) -o $@ $< -$(top_builddir)/share/salome/resources/%.qm: %.po +$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%.qm: %.po $(MSG2QM) $< $@ ; \ #------------------------------------------------------------------------------ diff --git a/salome_adm/unix/DEPRECATED/make_module.in b/salome_adm/unix/DEPRECATED/make_module.in index bb26129cb..2231eed78 100644 --- a/salome_adm/unix/DEPRECATED/make_module.in +++ b/salome_adm/unix/DEPRECATED/make_module.in @@ -56,9 +56,9 @@ resources: resources-cp (cd $$d && $(MAKE) $@) || exit 1; \ done -resources-cp: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%) +resources-cp: $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%) -$(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%): $(top_builddir)/share/salome/resources/% : % +$(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%): $(top_builddir)/share/salome/resources/$(MODULE_NAME)/% : % cp -fr $< $@; #data: @@ -104,15 +104,15 @@ distclean: clean @@SETX@; for d in $(SUBDIRS); do \ (cd $$d && $(MAKE) $@) || exit 1; \ done - -$(RM) $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%) + -$(RM) $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%) -$(RM) Makefile install-resources: resources-cp # one resources directory for all salome modules - $(INSTALL) -d $(datadir)/resources - @for f in X $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/%); do \ + $(INSTALL) -d $(datadir)/resources/$(MODULE_NAME) + @for f in X $(RESOURCES_FILES:%=$(top_builddir)/share/salome/resources/$(MODULE_NAME)/%); do \ if test $$f != X; then \ - ($(INSTALL_DATA) $$f $(datadir)/resources/. || exit 1); \ + ($(INSTALL_DATA) $$f $(datadir)/resources/$(MODULE_NAME)/. || exit 1); \ fi; \ done @@ -120,7 +120,7 @@ install-resources: resources-cp uninstall-resources: @for f in X $(RESOURCES_FILES); do \ if test $$f != X; then \ - $(LT_UNINSTALL) $(datadir)/resources/$$f ; \ + $(LT_UNINSTALL) $(datadir)/resources/$(MODULE_NAME)/$$f ; \ fi; \ done diff --git a/salome_adm/unix/Doxyfile b/salome_adm/unix/Doxyfile new file mode 100644 index 000000000..df82af032 --- /dev/null +++ b/salome_adm/unix/Doxyfile @@ -0,0 +1,829 @@ +# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# + +# Doxyfile 1.2.8.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, +# German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, +# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish. + +OUTPUT_LANGUAGE = English + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these class will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. It is allowed to use relative paths in the argument list. + +STRIP_FROM_PATH = + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a class diagram (in Html and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. + +CLASS_DIAGRAMS = YES + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = YES + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower case letters. If set to YES upper case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# users are adviced to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explict @brief command for a brief description. + +JAVADOC_AUTOBRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# reimplements. + +INHERIT_DOCS = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consist of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. +# For instance some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = /home01/prascle/devSalome/rootsrc + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +FILE_PATTERNS = *idl *.cxx *.hxx *.hh *.h *.c *.cc *.py + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. + +INPUT_FILTER = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse. + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = /home01/prascle/devSalome/doc/html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the Html help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript and frames is required (for instance Netscape 4.0+ +# or Internet explorer 4.0+). + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = /home01/prascle/devSalome/doc/latex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimised for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assigments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tagfiles. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermedate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO + +# The CGI_NAME tag should be the name of the CGI script that +# starts the search engine (doxysearch) with the correct parameters. +# A script with this name will be generated by doxygen. + +CGI_NAME = + +# The CGI_URL tag should be the absolute URL to the directory where the +# cgi binaries are located. See the documentation of your http daemon for +# details. + +CGI_URL = + +# The DOC_URL tag should be the absolute URL to the directory where the +# documentation is located. If left blank the absolute path to the +# documentation, with file:// prepended to it, will be used. + +DOC_URL = + +# The DOC_ABSPATH tag should be the absolute path to the directory where the +# documentation is located. If left blank the directory on the local machine +# will be used. + +DOC_ABSPATH = + +# The BIN_ABSPATH tag must point to the directory where the doxysearch binary +# is installed. + +BIN_ABSPATH = + +# The EXT_DOC_PATHS tag can be used to specify one or more paths to +# documentation generated for other projects. This allows doxysearch to search +# the documentation for these projects as well. + +EXT_DOC_PATHS = diff --git a/salome_adm/unix/F77config.h.in b/salome_adm/unix/F77config.h.in new file mode 100644 index 000000000..670ac5756 --- /dev/null +++ b/salome_adm/unix/F77config.h.in @@ -0,0 +1,29 @@ +/*---------------------------------------------------------------------------------- + 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +------------------------------------------------------------------------------------*/ + + +#ifndef F77_FUNC + +#define F77_FUNC(name,NAME) @F77_FUNC_NAME@ +#define F77_FUNC_(name,NAME) @F77_FUNC_NAME_@ + +#endif + diff --git a/salome_adm/unix/Makefile.am b/salome_adm/unix/Makefile.am index 195941b70..b2d2a9a5f 100644 --- a/salome_adm/unix/Makefile.am +++ b/salome_adm/unix/Makefile.am @@ -33,6 +33,7 @@ DEPRECATED_FILES=\ # rules for install and build (see make_common_starter.am) salomeadmux_DATA = SALOMEconfig.h.in +salomeinclude_DATA = SALOMEconfig.h BUILT_SOURCES=SALOMEconfig.h SALOMEconfig.h.in mostlyclean-local: @@ -53,5 +54,4 @@ SALOMEconfig.h: $(top_builddir)/salome_adm/unix/SALOMEconfig.ref # The deprecated files are deprecated for the KERNEL but not for the # related modules (GUI, MED, ...), for now. Some files have to be installed. dist_salomeadmux_DATA=\ - pythonbe.py \ $(DEPRECATED_FILES) diff --git a/salome_adm/unix/SALOMEconfig.ref.in b/salome_adm/unix/SALOMEconfig.ref.in index 22372e97a..78688bd88 100644 --- a/salome_adm/unix/SALOMEconfig.ref.in +++ b/salome_adm/unix/SALOMEconfig.ref.in @@ -54,4 +54,21 @@ /* A path to a ssh-like command */ #define SSH "@SSH@" +// This is only to suppress warning messages with defines redefined (cause of omniORB that exports these names) +#ifdef PACKAGE_BUGREPORT +#undef PACKAGE_BUGREPORT +#endif +#ifdef PACKAGE_NAME +#undef PACKAGE_NAME +#endif +#ifdef PACKAGE_STRING +#undef PACKAGE_STRING +#endif +#ifdef PACKAGE_TARNAME +#undef PACKAGE_TARNAME +#endif +#ifdef PACKAGE_VERSION +#undef PACKAGE_VERSION +#endif + #endif diff --git a/salome_adm/unix/config_files/Makefile.am b/salome_adm/unix/config_files/Makefile.am index 31675283a..09742ebfe 100644 --- a/salome_adm/unix/config_files/Makefile.am +++ b/salome_adm/unix/config_files/Makefile.am @@ -68,11 +68,10 @@ 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 +79,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/ac_cc_warnings.m4 b/salome_adm/unix/config_files/ac_cc_warnings.m4 new file mode 100644 index 000000000..9f3aa1a7f --- /dev/null +++ b/salome_adm/unix/config_files/ac_cc_warnings.m4 @@ -0,0 +1,119 @@ +dnl Copyright (C) 2003 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 +dnl Synopsis : AC_CC_WARNINGS([ANSI]) +dnl +dnl Version : 1.1 (2000/12/31) +dnl +dnl Author : Ville Laurikari +dnl +dnl Description : +dnl +dnl Enables a reasonable set of warnings for the C compiler. +dnl Optionally, if the first argument is nonempty, turns on +dnl flags which enforce and/or enable proper ANSI C if such +dnl flags are known to the compiler used. +dnl +dnl Currently this macro knows about GCC, Solaris C compiler, +dnl Digital Unix C compiler, C for AIX Compiler, HP-UX C +dnl compiler, and IRIX C compiler. + +AC_DEFUN([AC_CC_WARNINGS], [ + ansi=$1 + if test -z "$ansi"; then + msg="for C compiler warning flags" + else + msg="for C compiler warning and ANSI conformance flags" + fi + AC_CACHE_CHECK($msg, ac_cv_prog_cc_warnings, [ + if test -n "$CC"; then + cat > conftest.c <&1 | grep "Xc.*strict ANSI C" > /dev/null 2>&1 && + $CC -c -v -Xc conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="-v" + else + ac_cv_prog_cc_warnings="-v -Xc" + fi + + dnl HP-UX C compiler + elif $CC > /dev/null 2>&1 && + $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="+w1" + else + ac_cv_prog_cc_warnings="+w1 -Aa" + fi + + dnl Digital Unix C compiler + elif ! $CC > /dev/null 2>&1 && + $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos" + else + ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1" + fi + + dnl C for AIX Compiler + elif $CC > /dev/null 2>&1 | grep AIX > /dev/null 2>&1 && + $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" + else + ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi" + fi + + dnl IRIX C compiler + elif $CC -fullwarn -ansi -ansiE > /dev/null 2>&1 && + test -f conftest.o; then + if test -z "$ansi"; then + ac_cv_prog_cc_warnings="-fullwarn" + else + ac_cv_prog_cc_warnings="-fullwarn -ansi -ansiE" + fi + + fi + rm -f conftest.* + fi + if test -n "$ac_cv_prog_cc_warnings"; then + CFLAGS="$CFLAGS $ac_cv_prog_cc_warnings" + CXXFLAGS="$CXXFLAGS $ac_cv_prog_cc_warnings" + else + ac_cv_prog_cc_warnings="unknown" + fi + ]) +]) diff --git a/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 b/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 index 9dc8b0fd3..372fa9f7e 100644 --- a/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 +++ b/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 @@ -35,6 +35,87 @@ ac_cv_depend_flag, echo "conftest.o: conftest.c" > conftest.verif echo "int main() { return 0; }" > conftest.c +f77int="F77INT32" +case $host_os in + irix5.* | irix6.* | osf4.* | osf5.* | linux* ) + + linux64="true" +# porting on intel processor 64 bits + expr "$host_os" : 'linux' >/dev/null && ( test ! x"$host_cpu" = x"x86_64" && test ! x"$host_cpu" = x"ia64" ) && linux64="false" + if test ! x"$linux64" = "xfalse" ; then + echo "$as_me:$LINENO: checking for 64bits integers size in F77/F90" >&5 +echo $ECHO_N "checking for 64bits integers size in F77/F90... $ECHO_C" >&6 + # Check whether --enable-int64 or --disable-int64 was given. +if test "${enable_int64+set}" = set; then + enableval="$enable_int64" + +fi; + case "X-$enable_int64" in + X-no) + echo "$as_me:$LINENO: result: \"disabled\"" >&5 +echo "${ECHO_T}\"disabled\"" >&6 + SUFFIXES="_32" + ;; + *) + echo "$as_me:$LINENO: result: \"enabled\"" >&5 +echo "${ECHO_T}\"enabled\"" >&6 + SUFFIXES="" + f77int="F77INT64" + ;; + esac + fi + ;; + *) + ;; +esac + +case $host_os in + linux*) +# porting on intel processor 64 bits: if 64 bits processor, by default compilation in 64 bits + if test x"$linux64" = x"true"; then \ + MACHINE="PCLINUX64${SUFFIXES}"; + CFLAGS=" -D_OCC64 ${CXXFLAGS}"; + CXXFLAGS=" -D_OCC64 ${CXXFLAGS}";\ + else \ + MACHINE=PCLINUX; \ + fi + ;; + hpux*) + MACHINE=HP9000 + ;; + aix4.*) + MACHINE=RS6000 + host_os_novers=aix4.x + ;; + irix5.*) + MACHINE="IRIX64${SUFFIXES}" + host_os_novers=irix5.x + ;; + irix6.*) + MACHINE="IRIX64${SUFFIXES}" + host_os_novers=irix6.x + ;; + osf4.*) + MACHINE="OSF1${SUFFIXES}" + host_os_novers=osf4.x + ;; + osf5.*) + MACHINE="OSF1${SUFFIXES}" + host_os_novers=osf5.x + ;; + solaris2.*) + MACHINE=SUN4SOL2 + host_os_novers=solaris2.x + ;; + uxpv*) + MACHINE=VPP5000 + ;; + *) + MACHINE= + host_os_novers=$host_os + ;; +esac + dnl Evolution portage sur CCRT/osf system case $host_os in osf*) @@ -44,14 +125,14 @@ dnl on utilise donc gnu pour generer les dependances. DEPCXX=g++ DEPCXXFLAGS="-Wno-deprecated" DIFFFLAGS="-w" - MACHINE="OSF1" +dnl MACHINE="OSF1" ;; *) DEPCC=${CC-cc} DEPCXX=${CXX-c++} DEPCXXFLAGS="\${CXXFLAGS}" DIFFFLAGS="-b -B" - MACHINE="PCLINUX" +dnl MACHINE="PCLINUX" ;; esac C_DEPEND_FLAG= diff --git a/salome_adm/unix/config_files/check_Salome.m4 b/salome_adm/unix/config_files/check_Salome.m4 new file mode 100644 index 000000000..ff12fd6c3 --- /dev/null +++ b/salome_adm/unix/config_files/check_Salome.m4 @@ -0,0 +1,78 @@ +# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +#------------------------------------------------------------ +# Check availability of Salome binary distribution +# +# Author : Marc Tajchman (CEA, 2002) +#------------------------------------------------------------ + +AC_DEFUN([CHECK_SALOME],[ + +AC_CHECKING(for Salome) + +Salome_ok=no + +AC_ARG_WITH(salome, + --with-salome=DIR root directory path of SALOME installation, + SALOME_DIR="$withval",SALOME_DIR="") + +if test "x$SALOME_DIR" == "x" ; then + +# no --with-salome-dir option used + + if test "x$SALOME_ROOT_DIR" != "x" ; then + + # SALOME_ROOT_DIR environment variable defined + SALOME_DIR=$SALOME_ROOT_DIR + + else + + # search Salome binaries in PATH variable + AC_PATH_PROG(TEMP, libMEDMEM_Swig.py) + if test "x$TEMP" != "x" ; then + SALOME_BIN_DIR=`dirname $TEMP` + SALOME_DIR=`dirname $SALOME_BIN_DIR` + fi + + fi +# +fi + +if test -f ${SALOME_DIR}/bin/libMEDMEM_Swig.py ; then + Salome_ok=yes + AC_MSG_RESULT(Using Salome distribution in ${SALOME_DIR}) + + if test "x$SALOME_ROOT_DIR" == "x" ; then + SALOME_ROOT_DIR=${SALOME_DIR} + fi + if test "x$SALOME_SITE_DIR" == "x" ; then + SALOME_SITE_DIR=${SALOME_ROOT_DIR} + fi + AC_SUBST(SALOME_ROOT_DIR) + AC_SUBST(SALOME_SITE_DIR) + +else + AC_MSG_WARN("Cannot find compiled Salome distribution") +fi + +AC_MSG_RESULT(for Salome: $Salome_ok) + +])dnl + diff --git a/salome_adm/unix/config_files/check_boost.m4 b/salome_adm/unix/config_files/check_boost.m4 index 0298be6ee..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 @@ -68,6 +73,14 @@ if test "x${BOOSTDIR}" != "x" ; then boost_include_dir_ok=no) fi +BOOST_PROGRAM_OPTIONS_LIB=no +if test "x${boost_include_dir_ok}" = "xyes" ; then + AC_CHECK_FILE(${BOOSTDIR}/include/boost/program_options.hpp, + BOOST_PROGRAM_OPTIONS_LIB=yes, + BOOST_PROGRAM_OPTIONS_LIB=no) +fi +AC_MSG_RESULT(for boost program_options tool: $BOOST_PROGRAM_OPTIONS_LIB) + if test "x${boost_include_dir_ok}" = "xyes" ; then AC_TRY_COMPILE([#include ], [boost::shared_ptr(new int)], @@ -137,6 +150,7 @@ AC_MSG_RESULT(for boost: $boost_ok) AC_SUBST(BOOST_CPPFLAGS) AC_SUBST(BOOST_LIBSUFFIX) AC_SUBST(BOOST_LIBS) +AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) AC_LANG_RESTORE diff --git a/salome_adm/unix/config_files/check_cas.m4 b/salome_adm/unix/config_files/check_cas.m4 index 2db76b875..ab2ba319d 100644 --- a/salome_adm/unix/config_files/check_cas.m4 +++ b/salome_adm/unix/config_files/check_cas.m4 @@ -107,6 +107,7 @@ else occ_ok=yes OCC_VERSION_MAJOR=0 OCC_VERSION_MINOR=0 + OCC_VERSION_MAINTENANCE=0 ff=$CASROOT/inc/Standard_Version.hxx if test -f $ff ; then grep "define OCC_VERSION_MAJOR" $ff > /dev/null @@ -117,6 +118,10 @@ else if test $? = 0 ; then OCC_VERSION_MINOR=`grep "define OCC_VERSION_MINOR" $ff | awk '{i=3 ; print $i}'` fi + grep "define OCC_VERSION_MAINTENANCE" $ff > /dev/null + if test $? = 0 ; then + OCC_VERSION_MAINTENANCE=`grep "define OCC_VERSION_MAINTENANCE" $ff | awk '{i=3 ; print $i}'` + fi fi fi @@ -135,10 +140,21 @@ dnl cascade headers CPPFLAGS_old="$CPPFLAGS" case $host_os in linux*) - CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DLIN -DLINTEL -DCSFDB -DNO_CXX_EXCEPTION -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -DHAVE_WOK_CONFIG_H -I$CASROOT/inc" + CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DOCC_VERSION_MINOR=$OCC_VERSION_MINOR -DOCC_VERSION_MAINTENANCE=$OCC_VERSION_MAINTENANCE -DLIN -DLINTEL -DCSFDB -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -DHAVE_WOK_CONFIG_H" + + OCC_VERSION_STRING="$OCC_VERSION_MAJOR.$OCC_VERSION_MINOR.$OCC_VERSION_MAINTENANCE" + case $OCC_VERSION_STRING in + [[0-5]].* | 6.0.* | 6.1.0) # catch versions < 6.1.1 + CAS_CPPFLAGS="$CAS_CPPFLAGS -DNO_CXX_EXCEPTION" + ;; + *) + CAS_CPPFLAGS="$CAS_CPPFLAGS -DOCC_CONVERT_SIGNALS" + ;; + esac + CAS_CPPFLAGS="$CAS_CPPFLAGS -I$CASROOT/inc" ;; osf*) - CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DLIN -DLINTEL -DCSFDB -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -DHAVE_WOK_CONFIG_H -I$CASROOT/inc" + CAS_CPPFLAGS="-DOCC_VERSION_MAJOR=$OCC_VERSION_MAJOR -DOCC_VERSION_MINOR=$OCC_VERSION_MINOR -DOCC_VERSION_MAINTENANCE=$OCC_VERSION_MAINTENANCE -DLIN -DLINTEL -DCSFDB -DNo_exception -DHAVE_CONFIG_H -DHAVE_LIMITS_H -DHAVE_WOK_CONFIG_H -I$CASROOT/inc" ;; esac CPPFLAGS="$CPPFLAGS $CAS_CPPFLAGS" @@ -171,11 +187,10 @@ if test "x$occ_ok" = xyes ; then AC_CACHE_VAL(salome_cv_lib_occ,[ AC_TRY_LINK( -#include +#include , size_t size; - const Standard_CString aName="toto"; - Standard_Type myST(aName) ; - myST.Find(aName);, + TCollection_AsciiString aStr ("toto"); + aStr.Capitalize();, eval "salome_cv_lib_occ=yes",eval "salome_cv_lib_occ=no") ]) occ_ok="$salome_cv_lib_occ" diff --git a/salome_adm/unix/config_files/check_cppunit.m4 b/salome_adm/unix/config_files/check_cppunit.m4 index 9de130c26..e78b4fa24 100644 --- a/salome_adm/unix/config_files/check_cppunit.m4 +++ b/salome_adm/unix/config_files/check_cppunit.m4 @@ -24,10 +24,17 @@ if test -z "$CPPUNITHOME"; then exits_ok=no if test "x$exits_ok" = "xno"; then for d in /usr/local /usr ; do - AC_CHECK_FILE(${d}/lib/libcppunit.so,exits_ok=yes,exits_ok=no) + AC_CHECK_FILE(${d}/lib64/libcppunit.so,exits_ok=yes,exits_ok=no) + if test "x$exits_ok" = "xyes"; then + CPPUNITHOME=$d + AC_MSG_RESULT(libcppunit.so detected in $d/lib64) + break + fi + AC_CHECK_FILE(${d}/lib/libcppunit.so,exits_ok=yes,exits_ok=no) if test "x$exits_ok" = "xyes"; then CPPUNITHOME=$d AC_MSG_RESULT(libcppunit.so detected in $d/lib) + break fi done fi @@ -62,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_hdf5.m4 b/salome_adm/unix/config_files/check_hdf5.m4 index 4d200e8f3..9cc52b321 100644 --- a/salome_adm/unix/config_files/check_hdf5.m4 +++ b/salome_adm/unix/config_files/check_hdf5.m4 @@ -42,6 +42,7 @@ hdf5_ok=no LOCAL_INCLUDES="" LOCAL_LIBS="" +LOCAL_RLIBS="" if test -z $HDF5HOME then @@ -53,6 +54,7 @@ else LOCAL_LIBS="" else LOCAL_LIBS="-L$HDF5HOME/lib" + LOCAL_RLIBS="-R$HDF5HOME/lib" fi fi @@ -79,8 +81,8 @@ fi if test "x$hdf5_ok" = "xyes" then HDF5_INCLUDES="$LOCAL_INCLUDES" - HDF5_LIBS="$LOCAL_LIBS -lhdf5" - HDF5_MT_LIBS="$LOCAL_LIBS -lhdf5" + HDF5_LIBS="$LOCAL_LIBS -lhdf5 $LOCAL_RLIBS" + HDF5_MT_LIBS="$LOCAL_LIBS -lhdf5 $LOCAL_RLIBS" fi AC_MSG_RESULT(for hdf5: $hdf5_ok) 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_java.m4 b/salome_adm/unix/config_files/check_java.m4 new file mode 100644 index 000000000..c03e9f7ff --- /dev/null +++ b/salome_adm/unix/config_files/check_java.m4 @@ -0,0 +1,111 @@ +dnl Copyright (C) 2003 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_JAVA],[ +dnl AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl +dnl AC_REQUIRE([AC_PROG_CPP])dnl + +AC_CHECKING(for JAVA) + +JAVA_INCLUDES="" +JAVA_LIBS="" +JAVA_LDPATH="" + +java_ok=no + +if test -z $JAVAHOME +then + AC_MSG_WARN(define JAVAHOME variable to use Java) +else + java_ok=yes +fi + +if test "x$java_ok" = "xyes" +then + AC_EXEEXT + AC_CHECK_PROG(JAVA, java$EXEEXT,found) + if test "x$JAVA" = "x" + then + java_ok=no + fi + + AC_CHECK_PROG(JAVAC, javac$EXEEXT,found) + if test "x$JAVAC" = "x" + then + java_ok=no + fi +fi + +if test "x$java_ok" = "xyes" +then + version=`$JAVA -version 2>&1 | grep "java version"` + case "$version" in + *1.1.*) + AC_MSG_RESULT(using jdk1.1 version - jdk1.4 required) + java_ok=no;; + *1.2*) + AC_MSG_RESULT(using jdk1.2 version - jdk1.4 required) + java_ok=no;; + *1.3*) + AC_MSG_RESULT(using jdk1.3 version - jdk1.4 required) + java_ok=no;; + *1.4*) + AC_MSG_RESULT(using jdk1.4 version) ;; + esac +fi + +if test "x$java_ok" = "xyes" +then +dnl java headers + LOCAL_INCLUDES=" -I${JAVAHOME}/include -I${JAVAHOME}/include/linux" + CPPFLAGS_old="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES" + AC_CHECK_HEADER(jni.h,java_ok=yes ,java_ok=no) + + CPPFLAGS="$CPPFLAGS_old" +fi + +if test "x$java_ok" = "xyes" +then +dnl libjava library + LOCAL_LIBS="-L${JAVAHOME}/jre/lib/i386 -ljava -L${JAVAHOME}/jre/lib/i386/client -ljvm -lverify" + LIBS_old="$LIBS" + LIBS="$LIBS $LOCAL_LIBS" + + AC_CHECK_LIB(jvm,JNI_CreateJavaVM,java_ok=yes,java_ok=no) + + LIBS="$LIBS_old" +fi + +if test "x$java_ok" = "xyes" +then + JAVA_INCLUDES="$LOCAL_INCLUDES" + JAVA_LIBS="$LOCAL_LIBS" +fi + +AC_SUBST(JAVA_INCLUDES) +AC_SUBST(JAVA_LIBS) +AC_SUBST(JAVA_LDPATH) + +AC_MSG_RESULT(for java: $java_ok) + +])dnl +dnl 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..7c0da3565 --- /dev/null +++ b/salome_adm/unix/config_files/check_libxml.m4 @@ -0,0 +1,58 @@ +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" + if test "x$LIBXML_DIR" = "x/usr" + then + LOCAL_LIBS="-lxml2" + else + LOCAL_LIBS="-L$LIBXML_DIR/lib -lxml2" + fi +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 392a70aa0..7818bc85f 100644 --- a/salome_adm/unix/config_files/check_omniorb.m4 +++ b/salome_adm/unix/config_files/check_omniorb.m4 @@ -17,7 +17,7 @@ AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_PATH_PROG(OMNIORB_IDL, omniidl) -if test "xOMNIORB_IDL" = "x" +if test "x$OMNIORB_IDL" = "x" then omniORB_ok=no AC_MSG_RESULT(omniORB binaries not in PATH variable) @@ -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 @@ -101,15 +101,15 @@ then fi -dnl omniORB_ok=yes - if test "x$omniORB_ok" = "xyes" then if test "x$OMNIORB_LIB" = "x/usr/lib" then OMNIORB_LDFLAGS="" + OMNIORB_RFLAGS="" else OMNIORB_LDFLAGS="-L$OMNIORB_LIB" + OMNIORB_RFLAGS="-R$OMNIORB_LIB" fi LIBS_old=$LIBS @@ -153,6 +153,7 @@ then OMNIORB_LIBS="$OMNIORB_LIBS -lCOS${OMNIORB_VERSION}" OMNIORB_LIBS="$OMNIORB_LIBS -lCOSDynamic${OMNIORB_VERSION}" OMNIORB_LIBS="$OMNIORB_LIBS -lomnithread" + OMNIORB_LIBS="$OMNIORB_LIBS ${OMNIORB_RFLAGS}" if test $OMNIORB_VERSION = 3 ; then OMNIORB_LIBS="$OMNIORB_LIBS -ltcpwrapGK" fi @@ -187,8 +188,8 @@ fi if test "x$omniORB_ok" = "xyes" then - OMNIORB_IDLCXXFLAGS="-nf -I${OMNIORB_ROOT}/idl" - OMNIORB_IDLPYFLAGS_1='-bpythonbe -p ${top_srcdir}/salome_adm/unix' + OMNIORB_IDLCXXFLAGS="-Wba -nf -I${OMNIORB_ROOT}/idl" + OMNIORB_IDLPYFLAGS_1='-bpython' OMNIORB_IDLPYFLAGS_2=" -I${OMNIORB_ROOT}/idl" OMNIORB_IDLPYFLAGS=${OMNIORB_IDLPYFLAGS_1}${OMNIORB_IDLPYFLAGS_2} @@ -214,15 +215,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_opengl.m4 b/salome_adm/unix/config_files/check_opengl.m4 deleted file mode 100644 index 8a56e0f54..000000000 --- a/salome_adm/unix/config_files/check_opengl.m4 +++ /dev/null @@ -1,195 +0,0 @@ -dnl Copyright (C) 2003 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_OPENGL],[ -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_CPP])dnl -AC_REQUIRE([AC_LINKER_OPTIONS])dnl - -AC_LANG_SAVE -AC_LANG_CPLUSPLUS - -AC_ARG_WITH(opengl, - [AC_HELP_STRING([--with-opengl=DIR],[root directory path of OpenGL installation])], - [opengl_dir="$withval"], - [dirs="/usr/lib${LIB_LOCATION_SUFFIX} /usr/local/lib${LIB_LOCATION_SUFFIX} /opt/graphics/OpenGL/lib${LIB_LOCATION_SUFFIX} /usr/openwin/lib${LIB_LOCATION_SUFFIX} /usr/X11R6/lib${LIB_LOCATION_SUFFIX}"])dnl - -AC_CHECKING(for OpenGL) -AC_CHECKING(for OpenGL headers) - -OGL_INCLUDES="" -OGL_LIBS="" - -GL_LIB_PATH="" -GLU_LIB_PATH="" - -OpenGL_ok=no -OpenGL_libs_ok=no -OpenGL_headers_ok=no - -dnl openGL headers -# by default -if test "x${opengl_dir}" != "x" ; then - AC_MSG_RESULT(for opengl_dir: $opengl_dir) - AC_CHECK_HEADER([${opengl_dir}/include/GL/gl.h], - [OpenGL_headers_ok=yes; OGL_INCLUDES="-I${opengl_dir}/include"], - [OpenGL_headers_ok=no]) - if test "x${OpenGL_headers_ok}" = "xyes" ; then - AC_CHECKING(for default OpenGL library) - if test "x${opengl_dir}" = "x/usr" ; then - OGL_LIBS="" - else - OGL_LIBS="-L${opengl_dir}/lib" - fi - LDFLAGS_old="$LDFLAGS" - LDFLAGS="$LDFLAGS $OGL_LIBS" - AC_CHECK_LIB([GL], - [glBegin], - [OpenGL_libs_ok=yes], - [OpenGL_libs_ok=no]) - if test "x${OpenGL_libs_ok}" = "xyes" ; then - AC_TRY_LINK([], - [], - [OpenGL_libs_ok=yes ; OpenGL_ok=yes; OGL_LIBS="$OGL_LIBS -lGL"], - [OpenGL_libs_ok=no]) - fi - LDFLAGS="$LDFLAGS_old" - fi -fi - -if test "x${OpenGL_headers_ok}" = "xno" ; then - AC_CHECK_HEADER(GL/gl.h, - [OpenGL_headers_ok=yes], - [OpenGL_headers_ok=no]) -fi - -# under SunOS ? -if test "x${OpenGL_headers_ok}" = "xno" ; then - AC_CHECK_HEADERS(/usr/openwin/share/include/GL/glxmd.h, - [OpenGL_headers_ok=yes; OGL_INCLUDES="-I/usr/openwin/share/include/"], - [OpenGL_headers_ok=no]) -fi - -# under IRIX ? -if test "x${OpenGL_headers_ok}" = "xno" ; then - AC_CHECK_HEADERS(/opt/graphics/OpenGL/include/GL/glxmd.h, - [OpenGL_headers_ok=yes; OGL_INCLUDES="-I/opt/graphics/OpenGL/include"], - [OpenGL_headers_ok=no]) -fi - -# some linux OpenGL servers hide the includes in /usr/X11R6/include/GL -if test "x${OpenGL_headers_ok}" = "xno" ; then - AC_CHECK_HEADERS(/usr/X11R6/include/GL/gl.h, - [OpenGL_headers_ok=yes; OGL_INCLUDES="-I/usr/X11R6/include"], - [OpenGL_headers_ok=no]) -fi - -if test "x${OpenGL_headers_ok}" = "xyes" ; then - AC_CHECKING(for OpenGL library) - for idir in $dirs; do - if test -r "${idir}/libGL.so"; then - AC_MSG_RESULT(in ${idir}) - if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then - GL_LIB_PATH="" - else - GL_LIB_PATH="-L${idir}" - fi - break - fi - # under IRIX ? - if test -r "${idir}/libGL.sl"; then - AC_MSG_RESULT(in ${idir}) - if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then - GL_LIB_PATH="" - else - GL_LIB_PATH="-L${idir}" - fi - break - fi - done - LDFLAGS_old="${LDFLAGS}" - LDFLAGS="${LDFLAGS} ${GL_LIB_PATH}" - AC_CHECK_LIB([GL], - [glBegin], - [OpenGL_libs_ok=yes], - [OpenGL_libs_ok=no]) - if test "x${OpenGL_libs_ok}" = "xyes" ; then - AC_TRY_LINK([], - [], - [OpenGL_libs_ok=yes ; OGL_LIBS="${OGL_LIBS} ${GL_LIB_PATH} -lGL"], - [OpenGL_libs_ok=no]) - fi - LDFLAGS="$LDFLAGS_old" -fi - -if test "x${OpenGL_libs_ok}" = "xyes" ; then - for idir in $dirs; do - if test -r "${idir}/libGLU.so"; then - AC_MSG_RESULT(in ${idir}) - if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then - GLU_LIB_PATH="" - else - GLU_LIB_PATH="-L${idir}" - fi - break - fi - # under IRIX ? - if test -r "${idir}/libGLU.sl"; then - AC_MSG_RESULT(in ${idir}) - if test "x${idir}" = "x/usr/lib${LIB_LOCATION_SUFFIX}" ; then - GLU_LIB_PATH="" - else - GLU_LIB_PATH="-L${idir}" - fi - break - fi - done - LDFLAGS_old="${LDFLAGS}" - LDFLAGS="${LDFLAGS} ${OGL_LIBS} ${GLU_LIB_PATH}" - AC_CHECK_LIB([GLU], - [gluBeginSurface], - [OpenGL_libs_ok=yes], - [OpenGL_libs_ok=no]) - if test "x${OpenGL_libs_ok}" = "xyes" ; then - AC_TRY_LINK([], - [], - [OpenGL_libs_ok=yes ; OGL_LIBS="${OGL_LIBS} ${GLU_LIB_PATH} -lGLU"], - [OpenGL_libs_ok=no]) - fi - LDFLAGS="$LDFLAGS_old" -fi - -if test "x${OpenGL_headers_ok}" = "xyes" ; then - if test "x${OpenGL_libs_ok}" = "xyes" ; then - OpenGL_ok=yes - fi -fi - -AC_MSG_RESULT(for OpenGL_headers_ok: $OpenGL_headers_ok) -AC_MSG_RESULT(for OpenGL_libs_ok: $OpenGL_libs_ok) -AC_MSG_RESULT(for OpenGL_ok: $OpenGL_ok) - -AC_SUBST(OGL_INCLUDES) -AC_SUBST(OGL_LIBS) - -AC_LANG_RESTORE - -])dnl 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_paco++.m4 b/salome_adm/unix/config_files/check_paco++.m4 new file mode 100644 index 000000000..b4759b245 --- /dev/null +++ b/salome_adm/unix/config_files/check_paco++.m4 @@ -0,0 +1,61 @@ +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.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl +dnl File : check_paco++.m4 +dnl Author : André RIBES (EDF) +dnl Module : KERNEL + +AC_DEFUN([CHECK_PACO],[ +PaCO_ok=yes + +AC_ARG_WITH(paco, + [AC_HELP_STRING([--with-paco=DIR],[root directory path of PaCO++ installation])], + WITHPACO="yes",WITHPACO="no") + +if test "x$WITHPACO" = "xyes"; +then + PACOPATH=$withval + PACO_INCLUDES="-I${PACOPATH}/include" + PACO_LIBS="-L${PACOPATH}/lib -lPaCO" + dnl a basic test to be sure that PaCO++ + dnl is correctly installed. + AC_CHECK_PROG(PACO_IDL, PaCOIdlTool, yes, no, ${PACOPATH}/bin) + if test "x$PACO_IDL" = "xno"; + then + PaCO_ok=no + AC_MSG_RESULT(PaCO++ binary not in ${PACOPATH}) + fi +else + PaCO_ok=no +fi + +AC_MSG_CHECKING(for PaCO++) +if test "x$PaCO_ok" = "xyes" +then + AC_MSG_RESULT([yes]) + PACO_IDL=${PACOPATH}/bin/PaCOIdlTool + AC_SUBST(PACO_IDL) + AC_SUBST(PACOPATH) + AC_SUBST(PACO_INCLUDES) + AC_SUBST(PACO_LIBS) +else + AC_MSG_RESULT([no]) +fi +])dnl +dnl diff --git a/salome_adm/unix/config_files/check_qt.m4 b/salome_adm/unix/config_files/check_qt.m4 deleted file mode 100644 index ab5348319..000000000 --- a/salome_adm/unix/config_files/check_qt.m4 +++ /dev/null @@ -1,182 +0,0 @@ -dnl Copyright (C) 2003 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_QT],[ -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_CXX])dnl -AC_REQUIRE([AC_PROG_CPP])dnl -AC_REQUIRE([AC_PROG_CXXCPP])dnl -AC_REQUIRE([CHECK_OPENGL])dnl -AC_REQUIRE([AC_LINKER_OPTIONS])dnl - -AC_CHECKING(for Qt) - -if test "x$OpenGL_ok" != "xyes" ; then - AC_MSG_WARN(Qt needs OpenGL correct configuration, check configure output) -fi - -qt_ok=yes - -AC_LANG_SAVE -AC_LANG_CPLUSPLUS - -if test "x$QTDIR" = "x" -then - AC_MSG_RESULT(please define QTDIR variable) - qt_ok=no -else - AC_MSG_RESULT(QTDIR is $QTDIR) - qt_inc_ok=no - QTINC="" - AC_CHECK_FILE(${QTDIR}/include/qt3/qglobal.h,QTINC="/qt3",QTINC="") - QT_VERS=`grep "QT_VERSION_STR" ${QTDIR}/include${QTINC}/qglobal.h | sed -e 's%^#define QT_VERSION_STR\([[:space:]]*\)%%g' -e 's%\"%%g'` - AC_MSG_RESULT(Qt version is $QT_VERS) - QT_VERS="Qt_"`echo $QT_VERS | sed -e 's%\"%%g' -e 's%\.%_%g'` -fi - -if test "x$qt_ok" = "xyes" -then - if test -f ${QTDIR}/bin/moc - then - MOC=${QTDIR}/bin/moc - else - AC_PATH_PROG(MOC, moc) - fi - if test "x$MOC" = "x" - then - qt_ok=no - AC_MSG_RESULT(moc qt-compiler not in PATH variable) - else - qt_ok=yes - AC_MSG_RESULT(moc found) - fi -fi - -if test "x$qt_ok" = "xyes" -then - if test -f ${QTDIR}/bin/uic - then - UIC=${QTDIR}/bin/uic - else - AC_PATH_PROG(UIC, uic) - fi - if test "x$UIC" = "x" - then - qt_ok=no - AC_MSG_RESULT(uic qt-interface compiler not in PATH variable) - else - qt_ok=yes - AC_MSG_RESULT(uic found) - fi -fi - -AC_SUBST(QTDIR) -QT_ROOT=$QTDIR - -if test "x$qt_ok" = "xyes" -then - CPPFLAGS_old=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I$QTDIR/include${QTINC}" - - AC_LANG_CPLUSPLUS - AC_CHECK_HEADER(qaction.h,qt_ok=yes ,qt_ok=no) - - CPPFLAGS=$CPPFLAGS_old - - AC_MSG_CHECKING(include of qt headers) - - if test "x$qt_ok" = "xno" - then - AC_MSG_RESULT(qt headers not found, or too old qt version, in $QTDIR/include) - AC_MSG_RESULT(QTDIR environment variable may be wrong) - else - AC_MSG_RESULT(yes) - QT_INCLUDES="-I${QT_ROOT}/include${QTINC} -DQT_THREAD_SUPPORT -DQT_CLEAN_NAMESPACE" - QT_MT_INCLUDES="-I${QT_ROOT}/include${QTINC} -DQT_THREAD_SUPPORT -DQT_CLEAN_NAMESPACE" - fi -fi - -if test "x$qt_ok" = "xyes" -then - AC_MSG_CHECKING(linking qt library) - LIBS_old=$LIBS - if test "x$QTDIR" = "x/usr" - then - LIBS="$LIBS -lqt-mt $OGL_LIBS" - else - LIBS="$LIBS -L$QTDIR/lib${LIB_LOCATION_SUFFIX} -lqt-mt $OGL_LIBS" - fi - - CXXFLAGS_old=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $QT_INCLUDES" - - AC_CACHE_VAL(salome_cv_lib_qt,[ - AC_TRY_LINK( -#include -, int n; - char **s; - QApplication a(n, s); - a.exec();, - eval "salome_cv_lib_qt=yes",eval "salome_cv_lib_qt=no") - ]) - qt_ok="$salome_cv_lib_qt" - - if test "x$qt_ok" = "xno" - then - AC_MSG_RESULT(unable to link with qt library) - AC_MSG_RESULT(QTDIR environment variable may be wrong) - else - AC_MSG_RESULT(yes) - if test "x$QTDIR" = "x/usr" - then - QT_LIBS=" -lqt-mt" - QT_MT_LIBS=" -lqt-mt" - else - QT_LIBS="-L$QTDIR/lib${LIB_LOCATION_SUFFIX} -lqt-mt" - QT_MT_LIBS="-L$QTDIR/lib${LIB_LOCATION_SUFFIX} -lqt-mt" - fi - fi - - LIBS=$LIBS_old - CXXFLAGS=$CXXFLAGS_old - -fi - -AC_SUBST(MOC) -AC_SUBST(UIC) - -AC_SUBST(QT_ROOT) -AC_SUBST(QT_INCLUDES) -AC_SUBST(QT_MT_INCLUDES) -AC_SUBST(QT_LIBS) -AC_SUBST(QT_MT_LIBS) -AC_SUBST(QT_VERS) - -AC_LANG_RESTORE - -AC_MSG_RESULT(for Qt: $qt_ok) - -# Save cache -AC_CACHE_SAVE - -])dnl -dnl diff --git a/salome_adm/unix/config_files/check_swig.m4 b/salome_adm/unix/config_files/check_swig.m4 index db9d234e9..08668fb56 100644 --- a/salome_adm/unix/config_files/check_swig.m4 +++ b/salome_adm/unix/config_files/check_swig.m4 @@ -24,6 +24,7 @@ AC_DEFUN([CHECK_SWIG],[ AC_REQUIRE([CHECK_PYTHON])dnl swig_ok=yes +numpy_ok=no AC_ARG_WITH(swig, [AC_HELP_STRING([--with-swig=EXEC],[swig executable])], @@ -57,6 +58,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 + numpy_ok=yes + 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/production.m4 b/salome_adm/unix/config_files/production.m4 index 8157d677d..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_ " @@ -103,4 +86,4 @@ fi ]) # AC_DISABLE_DEBUG - set the default flag to --disable-debug -AC_DEFUN([AC_DISABLE_DEBUG], [AC_ENABLE_DEBUG(no)]) \ No newline at end of file +AC_DEFUN([AC_DISABLE_DEBUG], [AC_ENABLE_DEBUG(no)]) diff --git a/salome_adm/unix/make_common_starter.am b/salome_adm/unix/make_common_starter.am index 220be3f5e..f54d8f4f2 100644 --- a/salome_adm/unix/make_common_starter.am +++ b/salome_adm/unix/make_common_starter.am @@ -7,24 +7,28 @@ # # Standard directory for installation -salomeincludedir = $(includedir)/@PACKAGE@ -libdir = $(prefix)/lib@LIB_LOCATION_SUFFIX@/@PACKAGE@ -bindir = $(prefix)/bin/@PACKAGE@ +salomeincludedir = $(includedir)/salome +libdir = $(prefix)/lib@LIB_LOCATION_SUFFIX@/salome +bindir = $(prefix)/bin/salome salomescriptdir = $(bindir) +salomepythondir = $(pythondir)/salome +salomepyexecdir = $(pyexecdir)/salome + # Directory for installing idl files -salomeidldir = $(prefix)/idl/@PACKAGE@ +salomeidldir = $(prefix)/idl/salome # Directory for installing resource files -salomeresdir = $(prefix)/share/@PACKAGE@/resources +salomeresdir = $(prefix)/share/salome/resources/@MODULE_NAME@ # Directories for installing admin files 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 +sharedpkgpythondir =$(salomepythondir)/shared_modules # Documentation directory -docdir = $(datadir)/doc/@PACKAGE@ +docdir = $(datadir)/doc/salome diff --git a/salome_adm/unix/pythonbe.py b/salome_adm/unix/pythonbe.py deleted file mode 100644 index 403e5cf09..000000000 --- a/salome_adm/unix/pythonbe.py +++ /dev/null @@ -1,39 +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 -# - -pymodule_template = """\ -# DO NOT EDIT THIS FILE! -# -# Python module @module@ generated by omniidl - -import omnipatch -omnipatch.updateModule("@module@") - -# ** 1. Stub files contributing to this module - -# ** 2. Sub-modules - -# ** 3. End""" - -import omniidl_be.python -omniidl_be.python.pymodule_template=pymodule_template - -def run(tree, args): - omniidl_be.python.run(tree, args) - diff --git a/salome_adm/unix/sstream.in b/salome_adm/unix/sstream.in new file mode 100644 index 000000000..323bbed45 --- /dev/null +++ b/salome_adm/unix/sstream.in @@ -0,0 +1,225 @@ +/* This is part of libio/iostream, providing -*- C++ -*- input/output. +Copyright (C) 2000 Free Software Foundation + +This file is part of the GNU IO Library. This library 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 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this library; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +As a special exception, if you link this library with files +compiled with a GNU compiler to produce an executable, this does not cause +the resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why +the executable file might be covered by the GNU General Public License. */ + +/* Written by Magnus Fromreide (magfr@lysator.liu.se). */ + +#ifndef __SSTREAM__ +#define __SSTREAM__ + +#include +#include +#include + +namespace std +{ + class stringbuf : public streambuf + { + public: + typedef char char_type; + typedef int int_type; + typedef streampos pos_type; + typedef streamoff off_type; + + explicit stringbuf(int which=ios::in|ios::out) : + streambuf(which), buf(), mode(static_cast(which)), + rpos(0), bufsize(1) + { } + + explicit stringbuf(const std::string &s, int which=ios::in|ios::out) : + streambuf(which), buf(s), mode(static_cast(which)), + bufsize(1) + { + if(mode & ios::in) + { + setg(&defbuf, &defbuf + bufsize, &defbuf + bufsize); + } + if(mode & ios::out) + { + setp(&defbuf, &defbuf + bufsize); + } + rpos = (mode & ios::ate ? s.size() : 0); + } + + std::string str() const + { + const_cast(this)->sync(); // Sigh, really ugly hack + return buf; + }; + + void str(const std::string& s) + { + buf = s; + if(mode & ios::in) + { + gbump(egptr() - gptr()); + } + if(mode & ios::out) + { + pbump(pbase() - pptr()); + } + rpos = (mode & ios::ate ? s.size() : 0); + } + + protected: + inline virtual int sync(); + inline virtual int overflow(int = EOF); + inline virtual int underflow(); + private: + std::string buf; + ios::open_mode mode; + std::string::size_type rpos; + streamsize bufsize; + char defbuf; + }; + + class stringstreambase : virtual public ios { + protected: + stringbuf __my_sb; + public: + std::string str() const + { + return dynamic_cast(_strbuf)->str(); + } + void str(const std::string& s) + { + clear(); + dynamic_cast(_strbuf)->str(s); + } + + stringbuf* rdbuf() + { + return &__my_sb; + } + protected: + stringstreambase(int which) : + __my_sb(which) + { + init (&__my_sb); + } + + stringstreambase(const std::string& s, int which) : + __my_sb(s, which) + { + init (&__my_sb); + } + }; + + class istringstream : public stringstreambase, public istream { + public: + istringstream(int which=ios::in) : + stringstreambase(which) + { } + + istringstream(const std::string& s, int which=ios::in) : + stringstreambase(s, which) + { } + }; + + class ostringstream : public stringstreambase, public ostream { + public: + ostringstream(int which=ios::out) : + stringstreambase(which) + { } + + ostringstream(const std::string& s, int which=ios::out) : + stringstreambase(s, which) + { } + }; + + class stringstream : public stringstreambase, public iostream { + public: + stringstream(int which=ios::in|ios::out) : + stringstreambase(which) + { } + + stringstream(const std::string &s, int which=ios::in|ios::out) : + stringstreambase(s, which) + { } + }; +} + +inline int std::stringbuf::sync() +{ + if((mode & ios::out) == 0) + return EOF; + + streamsize n = pptr() - pbase(); + if(n) + { + buf.replace(rpos, std::string::npos, pbase(), n); + if(buf.size() - rpos != n) + return EOF; + rpos += n; + pbump(-n); + gbump(egptr() - gptr()); + } + return 0; +} + +inline int std::stringbuf::overflow(int ch) +{ + if((mode & ios::out) == 0) + return EOF; + + streamsize n = pptr() - pbase(); + + if(n && sync()) + return EOF; + + if(ch != EOF) + { + std::string::size_type oldSize = buf.size(); + + buf.replace(rpos, std::string::npos, ch); + if(buf.size() - oldSize != 1) + return EOF; + ++rpos; + } + return 0; +} + +inline int std::stringbuf::underflow() +{ + sync(); + if((mode & ios::in) == 0) + { + return EOF; + } + if(rpos >= buf.size()) + { + return EOF; + } + + std::string::size_type n = egptr() - eback(); + std::string::size_type s; + + s = buf.copy(eback(), n, rpos); + pbump(pbase() - pptr()); + gbump(eback() - gptr()); + int res = (0377 & buf[rpos]); + rpos += s; + return res; +} + +#endif /* not __STRSTREAM__ */ diff --git a/src/Basics/BasicsGenericDestructor.cxx b/src/Basics/BasicsGenericDestructor.cxx index 04469b9c0..9c1e21300 100644 --- a/src/Basics/BasicsGenericDestructor.cxx +++ b/src/Basics/BasicsGenericDestructor.cxx @@ -37,9 +37,12 @@ using namespace std; void HouseKeeping(); std::list PROTECTED_DELETE::_objList; -//CCRT -pthread_mutex_t PROTECTED_DELETE::_listMutex = PTHREAD_MUTEX_INITIALIZER ; -//pthread_mutex_t PROTECTED_DELETE::_listMutex ; +#ifndef WNT +pthread_mutex_t PROTECTED_DELETE::_listMutex; +#else +pthread_mutex_t PROTECTED_DELETE::_listMutex = + PTHREAD_MUTEX_INITIALIZER; +#endif std::list *GENERIC_DESTRUCTOR::Destructors = 0; static bool atExitSingletonDone = false ; diff --git a/src/Basics/BasicsGenericDestructor.hxx b/src/Basics/BasicsGenericDestructor.hxx index 3435c7e4b..9ccbb1749 100644 --- a/src/Basics/BasicsGenericDestructor.hxx +++ b/src/Basics/BasicsGenericDestructor.hxx @@ -29,6 +29,24 @@ #ifndef _BASICGENERICDESTRUCTOR_HXX_ #define _BASICGENERICDESTRUCTOR_HXX_ +#ifdef WNT + #if defined BASICS_EXPORTS + #if defined WIN32 + #define BASICS_EXPORT __declspec( dllexport ) + #else + #define BASICS_EXPORT + #endif + #else + #if defined WIN32 + #define BASICS_EXPORT __declspec( dllimport ) + #else + #define BASICS_EXPORT + #endif + #endif +#else + #define BASICS_EXPORT +#endif + #include #include #include @@ -37,20 +55,6 @@ #include #include -#if defined BASICS_EXPORTS -#if defined WIN32 -#define BASICS_EXPORT __declspec( dllexport ) -#else -#define BASICS_EXPORT -#endif -#else -#if defined WNT -#define BASICS_EXPORT __declspec( dllimport ) -#else -#define BASICS_EXPORT -#endif -#endif - //#define _DEVDEBUG_ #ifdef _DEVDEBUG_ @@ -79,7 +83,7 @@ */ // ============================================================================ -class PROTECTED_DELETE +class BASICS_EXPORT PROTECTED_DELETE { public: static void deleteInstance(PROTECTED_DELETE *anObject); @@ -111,14 +115,14 @@ private: */ // ============================================================================ -class GENERIC_DESTRUCTOR +class BASICS_EXPORT GENERIC_DESTRUCTOR { public : - BASICS_EXPORT static std::list *Destructors; + static std::list *Destructors; virtual ~GENERIC_DESTRUCTOR() {}; - BASICS_EXPORT static const int Add(GENERIC_DESTRUCTOR &anObject); - BASICS_EXPORT virtual void operator()(void) = 0; + static const int Add(GENERIC_DESTRUCTOR &anObject); + virtual void operator()(void) = 0; }; // ============================================================================ @@ -142,7 +146,6 @@ public : template class DESTRUCTOR_OF : public GENERIC_DESTRUCTOR { - public: /*! Programs the destruction at the end of the process, of the object anObject. diff --git a/src/Batch/Batch_BatchManagerCatalog.cxx b/src/Batch/Batch_BatchManagerCatalog.cxx index 82c63ff12..07bcd0048 100644 --- a/src/Batch/Batch_BatchManagerCatalog.cxx +++ b/src/Batch/Batch_BatchManagerCatalog.cxx @@ -37,6 +37,7 @@ namespace Batch { pthread_mutex_t BatchManagerCatalog::_mutex = PTHREAD_MUTEX_INITIALIZER; std::map * BatchManagerCatalog::_p_catalog = 0; + BatchManagerCatalog BatchManagerCatalog::theCatalog; // Constructeur BatchManagerCatalog::BatchManagerCatalog() @@ -47,7 +48,7 @@ namespace Batch { // Destructeur BatchManagerCatalog::~BatchManagerCatalog() { - // Nothing to do + delete BatchManagerCatalog::_p_catalog; } // Functor diff --git a/src/Batch/Batch_BatchManagerCatalog.hxx b/src/Batch/Batch_BatchManagerCatalog.hxx index 62917faa4..81ab713ec 100644 --- a/src/Batch/Batch_BatchManagerCatalog.hxx +++ b/src/Batch/Batch_BatchManagerCatalog.hxx @@ -53,6 +53,7 @@ namespace Batch { virtual std::string __repr__() const; protected: + static BatchManagerCatalog theCatalog; static std::map * _p_catalog; static pthread_mutex_t _mutex; diff --git a/src/Batch/Batch_Date.cxx b/src/Batch/Batch_Date.cxx index 0ec1166ef..a657696ac 100644 --- a/src/Batch/Batch_Date.cxx +++ b/src/Batch/Batch_Date.cxx @@ -60,7 +60,7 @@ namespace Batch { _sec = p_tm->tm_sec; } else { - char c; +// char c; // istringstream ist(s); // ist >> _day >> c // >> _month >> c diff --git a/src/Batch/Batch_Parametre.hxx b/src/Batch/Batch_Parametre.hxx index 125611351..bd9a9f294 100644 --- a/src/Batch/Batch_Parametre.hxx +++ b/src/Batch/Batch_Parametre.hxx @@ -54,7 +54,7 @@ namespace Batch { Parametre(); // Constructeur par recopie - Parametre::Parametre(const Parametre & PM); + Parametre(const Parametre & PM); // Operateur de recherche dans la map Versatile & operator [] (const string &); diff --git a/src/Batch/Batch_PyVersatile.cxx b/src/Batch/Batch_PyVersatile.cxx index 395634bbf..f38132ca2 100644 --- a/src/Batch/Batch_PyVersatile.cxx +++ b/src/Batch/Batch_PyVersatile.cxx @@ -27,12 +27,12 @@ * */ -#include #include #include "Batch_TypeMismatchException.hxx" #include "Batch_ListIsFullException.hxx" #include "Batch_InvalidArgumentException.hxx" #include "Batch_PyVersatile.hxx" +#include namespace Batch { @@ -93,7 +93,7 @@ namespace Batch { if (_maxsize != 1) { // une liste obj = PyList_New(0); for(Versatile::const_iterator it=begin(); it!=end(); it++) { - char ch[2] = {0, 0}; +// char ch[2] = {0, 0}; string st; Couple cp; // PyObject * tuple; @@ -137,7 +137,7 @@ namespace Batch { } } else { // un scalaire - char ch[2] = {0, 0}; +// char ch[2] = {0, 0}; string st; Couple cp; // PyObject * tuple; diff --git a/src/Batch/Makefile.am b/src/Batch/Makefile.am index 095173c50..0ec62e54c 100644 --- a/src/Batch/Makefile.am +++ b/src/Batch/Makefile.am @@ -59,7 +59,7 @@ LIB_INCLUDES = \ Batch_PyVersatile.hxx \ Batch_RunTimeException.hxx \ Batch_StringType.hxx \ - Batch_TypeMismatchException.hxx + Batch_TypeMismatchException.hxx LIB_SRC = \ @@ -91,13 +91,14 @@ LIB_SRC = \ Batch_PyVersatile.cxx \ Batch_RunTimeException.cxx \ Batch_StringType.cxx \ - Batch_TypeMismatchException.cxx + Batch_TypeMismatchException.cxx LIB_CPPFLAGS = \ - @PYTHON_INCLUDES@ \ + ${PYTHON_INCLUDES} \ -I$(srcdir)/../Basics \ - -I$(srcdir)/../SALOMELocalTrace + -I$(srcdir)/../SALOMELocalTrace \ + -I$(top_builddir)/salome_adm/unix LIB_LIBADD = \ ../SALOMELocalTrace/libSALOMELocalTrace.la \ @@ -183,8 +184,8 @@ LIB_SRC += \ Batch_JobInfo_LSF.cxx \ Batch_Job_LSF.cxx -LIB_CPPFLAGS += @LSF_INCLUDES@ -LIB_LIBADD += @LSF_LIBDIR@ @LSF_LIBS@ +LIB_CPPFLAGS += ${LSF_INCLUDES} +LIB_LIBADD += ${LSF_LIBDIR} ${LSF_LIBS} endif @@ -199,15 +200,6 @@ salomeinclude_HEADERS = $(LIB_INCLUDES) # lib_LTLIBRARIES = libSalomeBatch.la libSalomeBatch_la_SOURCES = $(LIB_SRC) -libSalomeBatch_la_CPPFLAGS = \ - @PYTHON_INCLUDES@ \ - -I$(srcdir)/../Basics \ - -I$(srcdir)/../SALOMELocalTrace \ - -I$(top_builddir)/salome_adm/unix \ - $(LIB_CPPFLAGS) - +libSalomeBatch_la_CPPFLAGS = ${LIB_CPPFLAGS} libSalomeBatch_la_LDFLAGS = -no-undefined -version-info=0:0:0 -libSalomeBatch_la_LIBADD = \ - ../SALOMELocalTrace/libSALOMELocalTrace.la \ - ../Basics/libSALOMEBasics.la \ - $(LIB_LIBADD) +libSalomeBatch_la_LIBADD = $(LIB_LIBADD) diff --git a/src/Batch_SWIG/Makefile.am b/src/Batch_SWIG/Makefile.am index 71154d513..9fceccda1 100644 --- a/src/Batch_SWIG/Makefile.am +++ b/src/Batch_SWIG/Makefile.am @@ -55,8 +55,8 @@ BUILT_SOURCES = swig_wrap.cpp SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../Batch SWIG_SOURCES = libBatch_Swig.i libBatch_Swig_exception.i libBatch_Swig_typemap.i -pkgpython_PYTHON = libBatch_Swig.py -pkgpyexec_LTLIBRARIES = _libBatch_Swig.la +salomepython_PYTHON = libBatch_Swig.py +salomepyexec_LTLIBRARIES = _libBatch_Swig.la _libBatch_Swig_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES) _libBatch_Swig_la_CPPFLAGS = @PYTHON_INCLUDES@ -I$(srcdir) -I$(srcdir)/../Batch _libBatch_Swig_la_LDFLAGS = -module @@ -83,4 +83,4 @@ CLEANFILES = swig_wrap.cpp dist_salomescript_SCRIPTS = Batch_test.py # You don't need to specify libBatch_Swig.py. It is automatically -# installed by means of the swig target pkgpython_PYTHON. +# installed by means of the swig target salomepython_PYTHON. 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/Makefile.am b/src/Communication/Makefile.am index 61024dcba..b33cdbb0a 100644 --- a/src/Communication/Makefile.am +++ b/src/Communication/Makefile.am @@ -31,7 +31,8 @@ salomeinclude_HEADERS = \ MultiCommException.hxx \ SALOME_Comm_i.hxx \ MatrixClient.hxx \ - SALOME_Matrix_i.hxx + SALOME_Matrix_i.hxx \ + SALOME_Communication.hxx # Scripts to be installed diff --git a/src/Communication/MatrixClient.hxx b/src/Communication/MatrixClient.hxx index 2d4a7427b..c26d6a751 100644 --- a/src/Communication/MatrixClient.hxx +++ b/src/Communication/MatrixClient.hxx @@ -19,10 +19,12 @@ #ifndef __MATRIXCLIENT_HXX__ #define __MATRIXCLIENT_HXX__ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Comm) -class MatrixClient +class COMMUNICATION_EXPORT MatrixClient { public: static double *getValue(SALOME::Matrix_ptr distMat, int& columnSize, int& rowSize); diff --git a/src/Communication/MultiCommException.hxx b/src/Communication/MultiCommException.hxx index 38054547c..a6d4277bb 100644 --- a/src/Communication/MultiCommException.hxx +++ b/src/Communication/MultiCommException.hxx @@ -20,10 +20,11 @@ #ifndef _MULTICOMMEXCEPTION_HXX_ #define _MULTICOMMEXCEPTION_HXX_ -#include +#include +#include -class MultiCommException { +class COMMUNICATION_EXPORT MultiCommException { private: std::string _message; public: diff --git a/src/Communication/ReceiverFactory.hxx b/src/Communication/ReceiverFactory.hxx index 2bf964845..453430e66 100644 --- a/src/Communication/ReceiverFactory.hxx +++ b/src/Communication/ReceiverFactory.hxx @@ -20,6 +20,8 @@ #ifndef _RECEIVERFACTORY_HXX_ #define _RECEIVERFACTORY_HXX_ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Comm) #include "MultiCommException.hxx" @@ -28,7 +30,7 @@ This class internally builds a receiver associated with the sender given. It also performs transfert completely and clean up the objects. This is the only class used client side of an array. */ -class ReceiverFactory +class COMMUNICATION_EXPORT ReceiverFactory { public: static double *getValue(SALOME::SenderDouble_ptr sender,long &size)throw(MultiCommException); diff --git a/src/Communication/Receivers.cxx b/src/Communication/Receivers.cxx index f785ffaf3..0117680f4 100644 --- a/src/Communication/Receivers.cxx +++ b/src/Communication/Receivers.cxx @@ -17,7 +17,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "poa.h" +#include "omniORB4/poa.h" #include "utilities.h" using namespace std; diff --git a/src/Communication/SALOMEMultiComm.hxx b/src/Communication/SALOMEMultiComm.hxx index 208dbbd8e..52b43168c 100644 --- a/src/Communication/SALOMEMultiComm.hxx +++ b/src/Communication/SALOMEMultiComm.hxx @@ -20,6 +20,8 @@ #ifndef _SALOMEMULTICOMM_HXX_ #define _SALOMEMULTICOMM_HXX_ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Comm) @@ -27,7 +29,7 @@ Class is designed to ease the use of multi communication.\n Simply inherite from it your servant class you want to emit data with senders. */ -class SALOMEMultiComm : public virtual POA_SALOME::MultiCommClass { +class COMMUNICATION_EXPORT SALOMEMultiComm : public virtual POA_SALOME::MultiCommClass { protected: SALOME::TypeOfCommunication _type; public: diff --git a/src/Communication/SALOME_Comm_i.cxx b/src/Communication/SALOME_Comm_i.cxx index c22771c90..02f7e68fd 100644 --- a/src/Communication/SALOME_Comm_i.cxx +++ b/src/Communication/SALOME_Comm_i.cxx @@ -21,7 +21,7 @@ #ifndef WNT #include #endif -#include "poa.h" +#include "omniORB4/poa.h" #include "omnithread.h" #include "Utils_SINGLETON.hxx" #include "Utils_ORB_INIT.hxx" diff --git a/src/Communication/SALOME_Comm_i.hxx b/src/Communication/SALOME_Comm_i.hxx index 8274cefd7..6664fc4c0 100644 --- a/src/Communication/SALOME_Comm_i.hxx +++ b/src/Communication/SALOME_Comm_i.hxx @@ -20,6 +20,8 @@ #ifndef _SALOME_COMM_I_HXX_ #define _SALOME_COMM_I_HXX_ +#include + #ifdef HAVE_MPI2 #include "mpi.h" #endif @@ -34,8 +36,8 @@ Generic servant class for senders that factorizes all the common methods and attributes necessary to senders. All servant classes for senders have to inheritate from it. */ -class SALOME_Sender_i : public virtual POA_SALOME::Sender, - public PortableServer::RefCountServantBase { +class COMMUNICATION_EXPORT SALOME_Sender_i : public virtual POA_SALOME::Sender +{ protected: /*! Pointer to the generic array to transmit*/ const void *_tabToSend; @@ -58,7 +60,7 @@ public: virtual ~SALOME_Sender_i() {} }; -class SALOME_SenderDouble_i : public virtual POA_SALOME::SenderDouble, +class COMMUNICATION_EXPORT SALOME_SenderDouble_i : public virtual POA_SALOME::SenderDouble, public virtual SALOME_Sender_i { public: @@ -69,7 +71,7 @@ public: static SALOME_SenderDouble_i *find(SALOME::SenderDouble_ptr pCorba); }; -class SALOME_SenderInt_i : public virtual POA_SALOME::SenderInt, +class COMMUNICATION_EXPORT SALOME_SenderInt_i : public virtual POA_SALOME::SenderInt, public virtual SALOME_Sender_i { public: @@ -82,7 +84,7 @@ public: /*! Servant class for CORBA sender for double* when no copy of array _tabToSend is required, that is to say double and CORBA::Double are binary equal. */ -class SALOME_CorbaDoubleNCSender_i : public POA_SALOME::CorbaDoubleNCSender, +class COMMUNICATION_EXPORT SALOME_CorbaDoubleNCSender_i : public POA_SALOME::CorbaDoubleNCSender, public SALOME_SenderDouble_i { public: @@ -95,7 +97,7 @@ public: /*! Servant class for CORBA sender for double* when copy of array _tabToSend is required, that is to say double and CORBA::Double are NOT binary equal. */ -class SALOME_CorbaDoubleCSender_i : public POA_SALOME::CorbaDoubleCSender, +class COMMUNICATION_EXPORT SALOME_CorbaDoubleCSender_i : public POA_SALOME::CorbaDoubleCSender, public SALOME_SenderDouble_i { public: @@ -107,7 +109,7 @@ public: /*! Servant class for CORBA sender for int* when no copy of array _tabToSend is required, that is to say int and CORBA::Long are binary equal. */ -class SALOME_CorbaLongNCSender_i : public POA_SALOME::CorbaLongNCSender, +class COMMUNICATION_EXPORT SALOME_CorbaLongNCSender_i : public POA_SALOME::CorbaLongNCSender, public SALOME_SenderInt_i { public: @@ -120,7 +122,7 @@ public: /*! Servant class for CORBA sender for int* when copy of array _tabToSend is required, that is to say int and CORBA::Long are NOT binary equal. */ -class SALOME_CorbaLongCSender_i : public POA_SALOME::CorbaLongCSender, +class COMMUNICATION_EXPORT SALOME_CorbaLongCSender_i : public POA_SALOME::CorbaLongCSender, public SALOME_SenderInt_i { public: @@ -137,7 +139,7 @@ public: /*! Servant class of sender using MPI2. */ -class SALOME_MPISender_i : public virtual POA_SALOME::MPISender, +class COMMUNICATION_EXPORT SALOME_MPISender_i : public virtual POA_SALOME::MPISender, public virtual SALOME_Sender_i { private: @@ -168,7 +170,7 @@ private: static void* myThread(void *args); }; -class SALOME_MPISenderDouble_i : public POA_SALOME::MPISenderDouble, +class COMMUNICATION_EXPORT SALOME_MPISenderDouble_i : public POA_SALOME::MPISenderDouble, public SALOME_SenderDouble_i, public SALOME_MPISender_i { @@ -176,7 +178,7 @@ public: SALOME_MPISenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false); }; -class SALOME_MPISenderInt_i : public POA_SALOME::MPISenderInt, +class COMMUNICATION_EXPORT SALOME_MPISenderInt_i : public POA_SALOME::MPISenderInt, public SALOME_SenderInt_i, public SALOME_MPISender_i { @@ -190,7 +192,7 @@ public: /*! Servant class of sender using Sockets. */ -class SALOME_SocketSender_i : public virtual POA_SALOME::SocketSender, +class COMMUNICATION_EXPORT SALOME_SocketSender_i : public virtual POA_SALOME::SocketSender, public virtual SALOME_Sender_i { private: @@ -217,7 +219,7 @@ private: std::string inetAddress(); }; -class SALOME_SocketSenderDouble_i : public POA_SALOME::SocketSenderDouble, +class COMMUNICATION_EXPORT SALOME_SocketSenderDouble_i : public POA_SALOME::SocketSenderDouble, public SALOME_SenderDouble_i, public SALOME_SocketSender_i { @@ -225,7 +227,7 @@ public: SALOME_SocketSenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false); }; -class SALOME_SocketSenderInt_i : public POA_SALOME::SocketSenderInt, +class COMMUNICATION_EXPORT SALOME_SocketSenderInt_i : public POA_SALOME::SocketSenderInt, public SALOME_SenderInt_i, public SALOME_SocketSender_i { diff --git a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.jxx b/src/Communication/SALOME_Communication.hxx old mode 100644 new mode 100755 similarity index 60% rename from src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.jxx rename to src/Communication/SALOME_Communication.hxx index 1320ad1d9..93c11cc56 --- a/src/SALOMEDS/SALOMEDS_TextHighlightColorAttribute.jxx +++ b/src/Communication/SALOME_Communication.hxx @@ -1,5 +1,3 @@ -// 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 // @@ -17,24 +15,33 @@ // 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_TextHighlightColorAttribute.jxx -// Author : Yves FRICAUD +// File : SALOME_Communication.hxx +// Author : Alexander A. BORODIN // Module : SALOME -// $Header$ -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include +#ifndef _SALOME_COMMIUNICATION_HXX_ +#define _SALOME_COMMIUNICATION_HXX_ + +#ifdef WNT + #if defined COMMUNICATION_EXPORTS + #if defined WIN32 + #define COMMUNICATION_EXPORT __declspec( dllexport ) + #else + #define COMMUNICATION_EXPORT + #endif + #else + #if defined WIN32 + #define COMMUNICATION_EXPORT __declspec( dllimport ) + #else + #define COMMUNICATION_EXPORT + #endif + #endif +#else + #define COMMUNICATION_EXPORT #endif -#ifndef _SALOMEDS_TextHighlightColorAttribute_HeaderFile -#include "SALOMEDS_TextHighlightColorAttribute.hxx" + #endif diff --git a/src/Communication/SALOME_Matrix_i.cxx b/src/Communication/SALOME_Matrix_i.cxx index 49271c046..1ea94aff2 100644 --- a/src/Communication/SALOME_Matrix_i.cxx +++ b/src/Communication/SALOME_Matrix_i.cxx @@ -35,7 +35,7 @@ SALOME_Matrix_i::~SALOME_Matrix_i() SALOME::SenderDouble_ptr SALOME_Matrix_i::getData() { - return SenderFactory::buildSender(_type,_tabToSend,_nbOfRow*_nbOfColumn,_ownTabToSend); + return SenderFactory::buildSender(_type,_tabToSend,_nbOfRow*_nbOfColumn,false); } CORBA::Long SALOME_Matrix_i::getSizeOfColumn() diff --git a/src/Communication/SALOME_Matrix_i.hxx b/src/Communication/SALOME_Matrix_i.hxx index 3b3d33af7..26e8729a8 100644 --- a/src/Communication/SALOME_Matrix_i.hxx +++ b/src/Communication/SALOME_Matrix_i.hxx @@ -24,8 +24,8 @@ #include CORBA_SERVER_HEADER(SALOME_Comm) #include "SALOMEMultiComm.hxx" -class SALOME_Matrix_i : public virtual POA_SALOME::Matrix, - public PortableServer::RefCountServantBase { +class SALOME_Matrix_i : public virtual POA_SALOME::Matrix +{ private: const double *_tabToSend; int _nbOfRow; diff --git a/src/Communication/SenderFactory.hxx b/src/Communication/SenderFactory.hxx index d8d61f28e..86aa74875 100644 --- a/src/Communication/SenderFactory.hxx +++ b/src/Communication/SenderFactory.hxx @@ -20,6 +20,8 @@ #ifndef _SENDERFACTORY_HXX_ #define _SENDERFACTORY_HXX_ +#include + #include "MultiCommException.hxx" #include #include CORBA_SERVER_HEADER(SALOME_Comm) @@ -32,7 +34,7 @@ class SALOME_SenderInt_i; /*! This class implements the factory pattern of GoF by making a sender by giving an array and a communicator.It completely hides the type of sender from the user. */ -class SenderFactory +class COMMUNICATION_EXPORT SenderFactory { public: static SALOME::SenderDouble_ptr buildSender(SALOMEMultiComm &multiCommunicator,const double *tab,long lgr,bool ownTab=false) throw(MultiCommException); diff --git a/src/Communication_SWIG/Makefile.am b/src/Communication_SWIG/Makefile.am index 30907c8d4..9dd1946a5 100644 --- a/src/Communication_SWIG/Makefile.am +++ b/src/Communication_SWIG/Makefile.am @@ -56,8 +56,8 @@ SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../Communication SWIG_SOURCES = libSALOME_Comm.i -pkgpython_PYTHON = libSALOME_Comm.py -pkgpyexec_LTLIBRARIES = _libSALOME_Comm.la +salomepython_PYTHON = libSALOME_Comm.py +salomepyexec_LTLIBRARIES = _libSALOME_Comm.la _libSALOME_Comm_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES) _libSALOME_Comm_la_CPPFLAGS =\ @PYTHON_INCLUDES@ \ @@ -97,4 +97,4 @@ CLEANFILES = swig_wrap.cpp # (see LifeCycleCORBA_SWIG for an example) # It's not needed to specify libSALOME_Comm.py. It is -# automaticaly installed through the swig target pkgpython_PYTHON. +# automaticaly installed through the swig target salomepython_PYTHON. diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 0e6a5c0ab..cfeeefc9b 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -45,6 +45,7 @@ #else #include int SIGUSR11 = 1000; +#include #endif @@ -62,10 +63,10 @@ bool Engines_Component_i::_isMultiInstance = false; */ //============================================================================= -Engines_Component_i::Engines_Component_i() +Engines_Component_i::Engines_Component_i():_myConnexionToRegistry(0), _notifSupplier(0) { //ASSERT(0); - INFOS("Default Constructor..."); + MESSAGE("Default Constructor, not for normal use..."); } //============================================================================= @@ -73,7 +74,7 @@ Engines_Component_i::Engines_Component_i() * Standard Constructor for generic Component, used in derived class * Connection to Registry and Notification * \param orb Object Request broker given by Container - * \parap poa Portable Object Adapter from Container (normally root_poa) + * \param poa Portable Object Adapter from Container (normally root_poa) * \param contId container CORBA id inside the server * \param instanceName unique instance name for this object (see Container_i) * \param interfaceName component class name @@ -90,12 +91,14 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, _instanceName(instanceName), _interfaceName(interfaceName), _myConnexionToRegistry(0), + _notifSupplier(0), _ThreadId(0) , _ThreadCpuUsed(0) , _Executed(false) , _graphName("") , _nodeName(""), - _studyId(-1) + _studyId(-1), + _CanceledThread(false) { MESSAGE("Component constructor with instanceName "<< _instanceName); //SCRUTE(pd_refCount); @@ -116,7 +119,7 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, * Standard constructor for parallel component * Connection Notification (no connection to Registry !) * \param orb Object Request broker given by Container - * \parap poa Portable Object Adapter from Container (normally root_poa) + * \param poa Portable Object Adapter from Container (normally root_poa) * \param contId container CORBA id inside the server * \param instanceName unique instance name for this object (see Container_i) * \param interfaceName component class name @@ -135,12 +138,14 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, _instanceName(instanceName), _interfaceName(interfaceName), _myConnexionToRegistry(0), + _notifSupplier(0), _ThreadId(0) , _ThreadCpuUsed(0) , _Executed(false) , _graphName("") , _nodeName(""), - _studyId(-1) + _studyId(-1), + _CanceledThread(false) { _orb = CORBA::ORB::_duplicate(orb); _poa = PortableServer::POA::_duplicate(poa); @@ -161,6 +166,8 @@ Engines_Component_i::~Engines_Component_i() { MESSAGE("Component destructor"); Engines_Container_i::decInstanceCnt(_interfaceName); + if(_myConnexionToRegistry)delete _myConnexionToRegistry; + if(_notifSupplier)delete _notifSupplier; } //============================================================================= @@ -207,8 +214,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 } //============================================================================= @@ -233,7 +245,6 @@ void Engines_Component_i::destroy() delete _myConnexionToRegistry; _myConnexionToRegistry = 0 ; _poa->deactivate_object(*_id) ; - CORBA::release(_poa) ; delete(_id) ; //SCRUTE(pd_refCount); _thisObj->_remove_ref(); @@ -251,7 +262,7 @@ void Engines_Component_i::destroy() Engines::Container_ptr Engines_Component_i::GetContainerRef() { // MESSAGE("Engines_Component_i::GetContainerRef"); - CORBA::Object_ptr o = _poa->id_to_reference(*_contId) ; + CORBA::Object_var o = _poa->id_to_reference(*_contId) ; return Engines::Container::_narrow(o); } @@ -333,7 +344,7 @@ bool Engines_Component_i::Kill_impl() #ifndef WNT if ( _ThreadId > 0 && pthread_self() != _ThreadId ) { - RetVal = Killer( _ThreadId , 0 ) ; + RetVal = Killer( _ThreadId , SIGUSR2 ) ; _ThreadId = (pthread_t ) -1 ; } @@ -356,11 +367,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 ; @@ -388,11 +407,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 @@ -427,11 +454,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 ) @@ -567,8 +602,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); @@ -616,7 +658,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: "<SetCurCpu() ; + if ( theEngines_Component ) + theEngines_Component->SetCurCpu() ; } //============================================================================= @@ -766,6 +828,23 @@ long Engines_Component_i::CpuUsed() return cpu ; } +void CallCancelThread() +{ + if ( theEngines_Component ) + theEngines_Component->CancelThread() ; +} + +//============================================================================= +/*! + * C++ method: + */ +//============================================================================= + +void Engines_Component_i::CancelThread() +{ + _CanceledThread = true; +} + //============================================================================= /*! * C++ method: Send message to event channel @@ -775,7 +854,7 @@ long Engines_Component_i::CpuUsed() void Engines_Component_i::sendMessage(const char *event_type, const char *message) { - _notifSupplier->Send(graphName(), nodeName(), event_type, message); + _notifSupplier->Send(_graphName.c_str(), _nodeName.c_str(), event_type, message); } //============================================================================= @@ -802,7 +881,7 @@ Engines::TMPFile* Engines_Component_i::DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean isPublished, CORBA::Boolean& isValidScript) { - char* aScript = "def RebuildData(theStudy): pass"; + const char* aScript = "def RebuildData(theStudy): pass"; char* aBuffer = new char[strlen(aScript)+1]; strcpy(aBuffer, aScript); CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer; @@ -811,3 +890,163 @@ Engines::TMPFile* Engines_Component_i::DumpPython(CORBA::Object_ptr theStudy, isValidScript = true; return aStreamFile._retn(); } + +Engines::Salome_file_ptr +Engines_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. + _Service_file_map_it = _Input_Service_file_map.find(service_name); + if (_Service_file_map_it == _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_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::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 f957f4dae..41e2b5b61 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -30,12 +30,11 @@ #include #include #include -#include #ifndef WNT +#include #include #include #else -#include "../../adm/win32/SALOME_WNT.hxx" #include #include int SIGUSR1 = 1000; @@ -43,16 +42,18 @@ int SIGUSR1 = 1000; #include "utilities.h" #include -#ifndef WNT +//#ifndef WNT #include CORBA_SERVER_HEADER(SALOME_Component) -#else -#include -#endif +#include CORBA_SERVER_HEADER(SALOME_Exception) +//#else +//#include +//#endif #include // must be before Python.h ! #include "SALOME_Container_i.hxx" #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" @@ -73,7 +74,7 @@ char ** _ArgV ; extern "C" {void ActSigIntHandler() ; } #ifndef WNT -extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; } + extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; } #else extern "C" {void SigIntHandler( int ) ; } #endif @@ -102,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_ptr poa, + char *containerName , int argc , char* argv[], - bool activAndRegist, - bool isServantAloneInProcess - ) : + bool activAndRegist, + bool isServantAloneInProcess + ) : _numInstance(0),_isServantAloneInProcess(isServantAloneInProcess) { _pid = (long)getpid(); @@ -119,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 ] ) @@ -154,17 +161,18 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, { _id = _poa->activate_object(this); _NS = new SALOME_NamingService(); - _NS->init_orb( CORBA::ORB::_duplicate(_orb) ) ; + _NS->init_orb( _orb ) ; CORBA::Object_var obj=_poa->id_to_reference(*_id); Engines::Container_var pCont - = Engines::Container::_narrow(obj); + = Engines::Container::_narrow(obj); + _remove_ref(); _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 @@ -178,22 +186,33 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, SCRUTE(myCommand); if (!_isSupervContainer) - { - Py_ACQUIRE_NEW_THREAD; + { #ifdef WNT - // mpv: this is temporary solution: there is a unregular crash if not - Sleep(2000); - PyRun_SimpleString("import sys\n"); - // first element is the path to Registry.dll, but it's wrong - PyRun_SimpleString("sys.path = sys.path[1:]\n"); + + PyEval_AcquireLock(); + PyThreadState *myTstate = PyThreadState_New(KERNEL_PYTHON::_interp); + PyThreadState *myoldTstate = PyThreadState_Swap(myTstate); +#else + Py_ACQUIRE_NEW_THREAD; #endif - PyRun_SimpleString("import SALOME_Container\n"); - PyRun_SimpleString((char*)myCommand.c_str()); - Py_RELEASE_NEW_THREAD; - } + +#ifdef WNT + // 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"); +#endif + 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()); + CORBA::Object_var obref=aFileTransfer->_this(); + _fileTransfer = Engines::fileTransfer::_narrow(obref); + aFileTransfer->_remove_ref(); } } @@ -207,6 +226,8 @@ Engines_Container_i::~Engines_Container_i() { MESSAGE("Container_i::~Container_i()"); delete _id; + if(_NS) + delete _NS; } //============================================================================= @@ -220,6 +241,35 @@ char* Engines_Container_i::name() return CORBA::string_dup(_containerName.c_str()) ; } +//============================================================================= +/*! + * CORBA attribute: Container working directory + */ +//============================================================================= + +char* Engines_Container_i::workingdir() +{ + char wd[256]; + getcwd (wd,256); + return CORBA::string_dup(wd) ; +} + +//============================================================================= +/*! + * CORBA attribute: Container log file name + */ +//============================================================================= + +char* Engines_Container_i::logfilename() +{ + return CORBA::string_dup(_logfilename.c_str()) ; +} + +void Engines_Container_i::logfilename(const char* name) +{ + _logfilename=name; +} + //============================================================================= /*! * CORBA method: Get the hostName of the Container (without domain extensions) @@ -267,15 +317,23 @@ void Engines_Container_i::ping() void Engines_Container_i::Shutdown() { MESSAGE("Engines_Container_i::Shutdown()"); + + /* For each component contained in this container + * tell it to self-destroy + */ + std::map::iterator itm; + for (itm = _listInstances_map.begin(); itm != _listInstances_map.end(); itm++) + itm->second->destroy(); + _NS->Destroy_FullDirectory(_containerName.c_str()); + _NS->Destroy_Name(_containerName.c_str()); //_remove_ref(); //_poa->deactivate_object(*_id); if(_isServantAloneInProcess) { MESSAGE("Effective Shutdown of container Begins..."); - LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); - bp1->deleteInstance(bp1); - _orb->shutdown(0); + if(!CORBA::is_nil(_orb)) + _orb->shutdown(0); } } @@ -307,33 +365,28 @@ Engines_Container_i::load_component_Library(const char* componentName) _numInstanceMutex.lock(); // lock to be alone // (see decInstanceCnt, finalize_removal)) - if (_toRemove_map[impl_name]) _toRemove_map.erase(impl_name); - if (_library_map[impl_name]) + if (_toRemove_map.count(impl_name) != 0) _toRemove_map.erase(impl_name); + if (_library_map.count(impl_name) != 0) { MESSAGE("Library " << impl_name << " already loaded"); _numInstanceMutex.unlock(); return true; } +#ifndef WNT void* handle; -#if defined( WNT ) - handle = dlopen( impl_name.c_str() , 0 ) ; -//#elif defined( __osf1__ ) -// handle = dlopen( impl_name.c_str() , RTLD_NOW ) ; -#else handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ; +#else + HINSTANCE handle; + handle = LoadLibrary( impl_name.c_str() ); #endif + if ( handle ) - { + { _library_map[impl_name] = handle; _numInstanceMutex.unlock(); return true; - } - else - { - INFOS("Can't load shared library : " << impl_name); - INFOS("error dlopen: " << dlerror()); - } + } _numInstanceMutex.unlock(); // --- try import Python component @@ -344,7 +397,7 @@ Engines_Container_i::load_component_Library(const char* componentName) INFOS("Supervision Container does not support Python Component Engines"); return false; } - if (_library_map[aCompName]) + if (_library_map.count(aCompName) != 0) { return true; // Python Component, already imported } @@ -355,19 +408,25 @@ 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); + Py_XDECREF(result); SCRUTE(ret); Py_RELEASE_NEW_THREAD; if (ret) // import possible: Python component - { - _library_map[aCompName] = (void *)pyCont; // any non O value OK - 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 ) ; + _listInstances_map[instanceName] = iobject; } return iobject._retn(); } @@ -443,17 +504,17 @@ Engines_Container_i::create_component_instance(const char*genericRegisterName, #else string impl_name = genericRegisterName +string("Engine.dll"); #endif - void* handle = _library_map[impl_name]; - if ( !handle ) + if (_library_map.count(impl_name) == 0) { - INFOS("shared library " << impl_name <<"must be loaded before instance"); + INFOS("shared library " << impl_name <<" must be loaded before creating instance"); return Engines::Component::_nil() ; } else { + void* handle = _library_map[impl_name]; iobject = createInstance(genericRegisterName, - handle, - studyId); + handle, + studyId); return iobject._retn(); } } @@ -471,7 +532,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(); @@ -480,13 +541,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(); @@ -508,7 +569,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() ; @@ -530,7 +591,9 @@ void Engines_Container_i::remove_impl(Engines::Component_ptr component_i) ASSERT(! CORBA::is_nil(component_i)); string instanceName = component_i->instanceName() ; MESSAGE("unload component " << instanceName); + _numInstanceMutex.lock() ; // lock to be alone (stl container write) _listInstances_map.erase(instanceName); + _numInstanceMutex.unlock() ; component_i->destroy() ; _NS->Destroy_Name(instanceName.c_str()); } @@ -552,12 +615,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(); @@ -613,7 +676,9 @@ Engines_Container_i::createFileRef(const char* origFileName) Engines::Container_var pCont = Engines::Container::_narrow(obj); fileRef_i* aFileRef = new fileRef_i(pCont, origFileName); theFileRef = Engines::fileRef::_narrow(aFileRef->_this()); + _numInstanceMutex.lock() ; // lock to be alone (stl container write) _fileRef_map[origName] = theFileRef; + _numInstanceMutex.unlock() ; } theFileRef = Engines::fileRef::_duplicate(_fileRef_map[origName]); @@ -637,6 +702,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 @@ -662,59 +757,59 @@ 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; - void* handle = _library_map[impl_name]; - if ( !handle ) + if (_library_map.count(impl_name) == 0) { - INFOS("shared library " << impl_name <<"must be loaded before instance"); + INFOS("shared library " << impl_name <<" must be loaded before creating instance"); return Engines::Component::_nil() ; } else { // --- find a registered instance in naming service, or create + void* handle = _library_map[impl_name]; 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(); } } @@ -742,8 +837,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 @@ -758,16 +853,20 @@ Engines_Container_i::createInstance(string genericRegisterName, const char *, const char *) ; - FACTORY_FUNCTION Component_factory - = (FACTORY_FUNCTION) dlsym(handle, factory_name.c_str()); +#ifndef WNT + FACTORY_FUNCTION Component_factory = (FACTORY_FUNCTION)dlsym( handle, factory_name.c_str() ); +#else + FACTORY_FUNCTION Component_factory = (FACTORY_FUNCTION)GetProcAddress( (HINSTANCE)handle, factory_name.c_str() ); +#endif - char *error ; - if ( (error = dlerror() ) != NULL) - { - INFOS("Can't resolve symbol: " + factory_name); - SCRUTE(error); + if ( !Component_factory ) + { + INFOS( "Can't resolve symbol: " + factory_name ); +#ifndef WNT + SCRUTE( dlerror() ); +#endif return Engines::Component::_nil() ; - } + } // --- create instance @@ -784,27 +883,31 @@ 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(); + // --- get reference & servant from id CORBA::Object_var obj = _poa->id_to_reference(*id); 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 //SCRUTE(servant->pd_refCount); + _numInstanceMutex.lock() ; // lock to be alone (stl container write) _listInstances_map[instanceName] = iobject; _cntInstances_map[aGenRegisterName] += 1; + _numInstanceMutex.unlock() ; SCRUTE(aGenRegisterName); SCRUTE(_cntInstances_map[aGenRegisterName]); //SCRUTE(servant->pd_refCount); @@ -832,6 +935,8 @@ Engines_Container_i::createInstance(string genericRegisterName, void Engines_Container_i::decInstanceCnt(string genericRegisterName) { + if(_cntInstances_map.count(genericRegisterName)==0) + return; string aGenRegisterName =genericRegisterName; MESSAGE("Engines_Container_i::decInstanceCnt " << aGenRegisterName); ASSERT(_cntInstances_map[aGenRegisterName] > 0); @@ -842,7 +947,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); @@ -897,6 +1002,11 @@ void ActSigIntHandler() perror("SALOME_Container main ") ; exit(0) ; } + if ( sigaction( SIGUSR2 , &SigIntAct, NULL ) ) + { + perror("SALOME_Container main ") ; + exit(0) ; + } //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 : @@ -914,11 +1024,12 @@ void ActSigIntHandler() } void SetCpuUsed() ; +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 : @@ -941,28 +1052,36 @@ void SigIntHandler(int what , { ActSigIntHandler() ; if ( siginfo->si_signo == SIGUSR1 ) - { - SetCpuUsed() ; - } + { + SetCpuUsed() ; + } + else if ( siginfo->si_signo == SIGUSR2 ) + { + 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 ; @@ -973,23 +1092,22 @@ 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 ; } } #endif - diff --git a/src/Container/Container_init_python.cxx b/src/Container/Container_init_python.cxx index d3d511712..bea28a668 100644 --- a/src/Container/Container_init_python.cxx +++ b/src/Container/Container_init_python.cxx @@ -27,7 +27,9 @@ // $Header$ #include -#include +#ifndef WNT + #include +#endif #include "utilities.h" diff --git a/src/Container/Container_init_python.hxx b/src/Container/Container_init_python.hxx index 156adb1e5..dcdaed6e1 100644 --- a/src/Container/Container_init_python.hxx +++ b/src/Container/Container_init_python.hxx @@ -29,6 +29,8 @@ #ifndef _CONTAINER_INIT_PYTHON_HXX_ #define _CONTAINER_INIT_PYTHON_HXX_ +#include + #include // must be before Python.h ! #include @@ -45,20 +47,6 @@ // - There is no need of C Lock protection of the sequence. -#if defined CONTAINER_EXPORTS -#if defined WIN32 -#define CONTAINER_EXPORT __declspec( dllexport ) -#else -#define CONTAINER_EXPORT -#endif -#else -#if defined WNT -#define CONTAINER_EXPORT __declspec( dllimport ) -#else -#define CONTAINER_EXPORT -#endif -#endif - #define Py_ACQUIRE_NEW_THREAD \ PyEval_AcquireLock(); \ PyThreadState *myTstate = PyThreadState_New(KERNEL_PYTHON::_interp); \ diff --git a/src/Container/Makefile.am b/src/Container/Makefile.am index 1241d4a4f..a7cbd05da 100644 --- a/src/Container/Makefile.am +++ b/src/Container/Makefile.am @@ -41,7 +41,9 @@ salomeinclude_HEADERS = \ SALOME_FileTransfer_i.hxx \ SALOME_FileRef_i.hxx \ SALOME_ContainerManager.hxx \ - Container_init_python.hxx + Container_init_python.hxx \ + SALOME_Container.hxx \ + Salome_file_i.hxx # Scripts to be installed dist_salomescript_DATA =\ @@ -62,8 +64,8 @@ dist_salomescript_SCRIPTS=\ COMMON_CPPFLAGS=\ @PYTHON_INCLUDES@ \ @MPI_INCLUDES@ \ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \ - @QT_MT_INCLUDES@ \ + @HDF5_INCLUDES@ \ + -I$(srcdir)/../Batch \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ @@ -71,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 =\ @@ -84,10 +87,12 @@ COMMON_LIBS =\ ../Utils/libOpUtil.la \ ../SALOMELocalTrace/libSALOMELocalTrace.la \ ../Basics/libSALOMEBasics.la \ + ../HDFPersist/libSalomeHDFPersist.la \ + ../Batch/libSalomeBatch.la \ $(top_builddir)/idl/libSalomeIDLKernel.la\ - @PYTHON_LIBS@ \ @MPI_LIBS@ \ - @CORBA_LIBS@ + @CORBA_LIBS@ \ + $(PYTHON_LIBS) # # =============================================================== @@ -100,8 +105,9 @@ libSalomeContainer_la_SOURCES=\ Container_i.cxx \ SALOME_FileTransfer_i.cxx \ SALOME_FileRef_i.cxx \ + Container_init_python.cxx \ SALOME_ContainerManager.cxx \ - Container_init_python.cxx + Salome_file_i.cxx libSalomeContainer_la_CPPFLAGS =\ $(COMMON_CPPFLAGS) @@ -113,13 +119,19 @@ libSalomeContainer_la_LDFLAGS =\ libSalomeContainer_la_LIBADD =\ $(COMMON_LIBS) +if WITH_PACO_PARALLEL +libSalomeContainer_la_CPPFLAGS += -DWITH_PACO_PARALLEL @PACO_INCLUDES@ +libSalomeContainer_la_LIBADD += @PACO_LIBS@ +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 @@ -127,20 +139,25 @@ SALOME_Container_SOURCES =\ SALOME_Container_CPPFLAGS =\ $(COMMON_CPPFLAGS) - -SALOME_Container_LDADD =\ +SALOME_Container_LDADD = \ libSalomeContainer.la \ - $(COMMON_LIBS) \ - ../Basics/libSALOMEBasics.la + $(HDF5_LIBS) \ + $(MPI_LIBS) \ + $(CORBA_LIBS) \ + $(PYTHON_LIBS) +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 + $(HDF5_LIBS) \ + $(MPI_LIBS) \ + $(CORBA_LIBS) \ + $(PYTHON_LIBS) diff --git a/src/Container/SALOME_ComponentPy.py b/src/Container/SALOME_ComponentPy.py index babcbb297..5d071b8e4 100755 --- a/src/Container/SALOME_ComponentPy.py +++ b/src/Container/SALOME_ComponentPy.py @@ -72,6 +72,7 @@ class SALOME_ComponentPy_i (Engines__POA.Component): self._myConnexionToRegistry = 0 self._graphName = '' self._nodeName = '' + self._serviceName = '' self._ThreadId = 0 self._StartUsed = 0 self._ThreadCpuUsed = 0 @@ -82,7 +83,9 @@ class SALOME_ComponentPy_i (Engines__POA.Component): myMachine=getShortHostName() Component_path = self._containerName + "/" + self._instanceName MESSAGE( 'SALOME_ComponentPy_i Register' + str( Component_path ) ) - naming_service.Register(self._this(), Component_path) + id_o = poa.activate_object(self) + compo_o = poa.id_to_reference(id_o) + naming_service.Register(compo_o, Component_path) # Add componentinstance to registry obj = naming_service.Resolve('/Registry') @@ -144,15 +147,16 @@ class SALOME_ComponentPy_i (Engines__POA.Component): def destroy(self): MESSAGE( "SALOME_ComponentPy_i::destroy" ) - self._poa.deactivate_object(self) - CORBA.release(self._poa) + id = self._poa.servant_to_id(self) + self._poa.deactivate_object(id) #------------------------------------------------------------------------- def GetContainerRef(self): MESSAGE( "SALOME_ComponentPy_i::GetContainerRef" ) - corbaObj_ptr = self._poa.id_to_reference(self._contId) - return corbaObj_ptr._narrow(Engines.Container) + #corbaObj_ptr = self._poa.id_to_reference(self._contId) + #return corbaObj_ptr._narrow(Engines.Container) + return self._contId._narrow(Engines.Container) #------------------------------------------------------------------------- diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index 3d988b4a4..03234c307 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -29,6 +29,10 @@ #ifndef _SALOME_COMPONENT_I_HXX_ #define _SALOME_COMPONENT_I_HXX_ +#include + +#include + #include #include #include @@ -38,30 +42,16 @@ #include #include #include -#include #include CORBA_SERVER_HEADER(SALOME_Component) #include "NOTIFICATION.hxx" +#include "Salome_file_i.hxx" class RegistryConnexion; class Engines_Container_i; -#if defined CONTAINER_EXPORTS -#if defined WIN32 -#define CONTAINER_EXPORT __declspec( dllexport ) -#else -#define CONTAINER_EXPORT -#endif -#else -#if defined WNT -#define CONTAINER_EXPORT __declspec( dllimport ) -#else -#define CONTAINER_EXPORT -#endif -#endif - class CONTAINER_EXPORT Engines_Component_i: public virtual POA_Engines::Component, - public virtual PortableServer::RefCountServantBase + public virtual PortableServer::ServantBase { public: Engines_Component_i(); @@ -107,7 +97,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(); @@ -126,6 +128,12 @@ public: bool Killer( pthread_t ThreadId , int signum ); void SetCurCpu() ; 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 @@ -135,8 +143,8 @@ protected: std::string _instanceName ; std::string _interfaceName ; - CORBA::ORB_ptr _orb; - PortableServer::POA_ptr _poa; + CORBA::ORB_var _orb; + PortableServer::POA_var _poa; PortableServer::ObjectId * _id; PortableServer::ObjectId * _contId; Engines_Component_i * _thisObj ; @@ -144,6 +152,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 ; @@ -157,6 +175,7 @@ private: long _StartUsed ; long _ThreadCpuUsed ; bool _Executed ; + bool _CanceledThread ; }; #endif diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index 0415c2141..39812040d 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -35,8 +35,11 @@ #include #include #include -#include -#include +#ifndef WNT +# include +# include +#endif + #ifndef WNT #include @@ -59,19 +62,75 @@ 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 ) ; ORB_INIT &init = *SINGLETON_::Instance() ; ASSERT(SINGLETON_::IsAlreadyExisting()); - CORBA::ORB_ptr orb = init(0 , 0 ) ; - + CORBA::ORB_ptr orb = init(argc , argv ) ; + // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); INFOS_COMPILATION; BEGIN_OF(argv[0]); @@ -109,9 +168,9 @@ int main(int argc, char* argv[]) // add new container to the kill list #ifndef WNT - ostrstream aCommand ; + stringstream aCommand ; aCommand << "addToKillList.py " << getpid() << " SALOME_Container" << ends ; - system(aCommand.str()); + system(aCommand.str().c_str()); #endif Engines_Container_i * myContainer @@ -127,7 +186,17 @@ int main(int argc, char* argv[]) #endif HandleServerSideSignals(orb); - + + if (!isSupervContainer) + { + PyGILState_STATE gstate = PyGILState_Ensure(); + //Delete python container that destroy orb from python (pyCont._orb.destroy()) + Py_Finalize(); + } + else + { + orb->destroy(); + } } catch(CORBA::SystemException&) { diff --git a/src/SALOMEDS/SALOMEDS_TextColorAttribute.jxx b/src/Container/SALOME_Container.hxx old mode 100644 new mode 100755 similarity index 61% rename from src/SALOMEDS/SALOMEDS_TextColorAttribute.jxx rename to src/Container/SALOME_Container.hxx index 739fc44e4..4d3ff13a0 --- a/src/SALOMEDS/SALOMEDS_TextColorAttribute.jxx +++ b/src/Container/SALOME_Container.hxx @@ -1,5 +1,3 @@ -// 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 // @@ -17,24 +15,34 @@ // 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 : SALOME_Container.hxx +// Author : Alexander A. BORODIN // Module : SALOME -// $Header$ -#ifndef _Standard_GUID_HeaderFile -#include -#endif -#ifndef _TDF_Attribute_HeaderFile -#include -#endif -#ifndef _TDF_RelocationTable_HeaderFile -#include +#ifndef _SALOME_Container_HXX_ +#define _SALOME_Container_HXX_ + +#ifdef WNT + #if defined CONTAINER_EXPORTS + #if defined WIN32 + #define CONTAINER_EXPORT __declspec( dllexport ) + #else + #define CONTAINER_EXPORT + #endif + #else + #if defined WIN32 + #define CONTAINER_EXPORT __declspec( dllimport ) + #else + #define CONTAINER_EXPORT + #endif + #endif +#else + #define CONTAINER_EXPORT #endif -#ifndef _SALOMEDS_TextColorAttribute_HeaderFile -#include "SALOMEDS_TextColorAttribute.hxx" + #endif + diff --git a/src/Container/SALOME_Container.py b/src/Container/SALOME_Container.py index 026b9b7da..179150954 100644 --- a/src/Container/SALOME_Container.py +++ b/src/Container/SALOME_Container.py @@ -32,17 +32,14 @@ import os import sys import string from omniORB import CORBA, PortableServer -# import SALOMEDS before other SALOME modules -# (if not, incomplete import done by SALOME module: no load of SALOMEDS_attributes) import SALOMEDS import Engines, Engines__POA -reload(Engines) -reload(Engines__POA) from SALOME_NamingServicePy import * from SALOME_ComponentPy import * from SALOME_utilities import * from Utils_Identity import getShortHostName +from launchConfigureParser import verbose #============================================================================= @@ -61,12 +58,15 @@ class SALOME_Container_i: self._orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) self._poa = self._orb.resolve_initial_references("RootPOA") self._containerName = containerName - print "SALOME_Container.SALOME_Container_i : _containerName ",self._containerName + if verbose(): print "SALOME_Container.SALOME_Container_i : _containerName ",self._containerName #self._naming_service = SALOME_NamingServicePy_i(self._orb) self._container = self._orb.string_to_object(containerIORStr) #------------------------------------------------------------------------- + def __del__(self ): + self._orb.destroy() + def import_component(self, componentName): MESSAGE( "SALOME_Container_i::import_component" ) ret=0 diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 61aa660fc..dd6ee5a30 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -26,11 +26,20 @@ #endif #include #include "Utils_CorbaException.hxx" +#include "Batch_Date.hxx" + +#ifdef WITH_PACO_PARALLEL +#include "PaCO++.h" +#endif #define TIME_OUT_TO_LAUNCH_CONT 21 using namespace std; +vector SALOME_ContainerManager::_batchLaunchedContainers; + +vector::iterator SALOME_ContainerManager::_batchLaunchedContainersIter; + const char *SALOME_ContainerManager::_ContainerManagerNameInNS = "/ContainerManager"; @@ -43,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); @@ -80,8 +87,6 @@ SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb) SALOME_ContainerManager::~SALOME_ContainerManager() { MESSAGE("destructor"); - delete _NS; - delete _ResManager; } //============================================================================= @@ -94,10 +99,11 @@ 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() has already been done at creation + //_remove_ref(); } //============================================================================= @@ -109,20 +115,51 @@ void SALOME_ContainerManager::Shutdown() void SALOME_ContainerManager::ShutdownContainers() { MESSAGE("ShutdownContainers"); - _NS->Change_Directory("/Containers"); - vector vec = _NS->list_directory_recurs(); - 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)); + } + } + 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++){ 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(); - } - else MESSAGE("ShutdownContainers: no container ref for " << (*iter)); + try + { + cont->Shutdown(); + } + catch(CORBA::SystemException& e) + { + INFOS("CORBA::SystemException ignored : " << e); + } + catch(CORBA::Exception&) + { + INFOS("CORBA::Exception ignored."); + } + catch(...) + { + INFOS("Unknown exception ignored."); + } + } + else + MESSAGE("ShutdownContainers: no container ref for " << (*iter)); } + } } //============================================================================= @@ -138,18 +175,65 @@ 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; MESSAGE("Container doesn't exist try to launch it ..."); - MESSAGE("SALOME_ContainerManager::FindOrStartContainer " << + + return StartContainer(params,possibleComputers,Engines::P_FIRST); + +} + +//============================================================================= +/*! CORBA Method: + * Start a suitable Container in a list of machines + * \param params Machine Parameters required for the container + * \param possibleComputers list of machines usable for start + */ +//============================================================================= + +Engines::Container_ptr +SALOME_ContainerManager:: +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)]; + Engines::Container_ptr ret = Engines::Container::_nil(); + + MESSAGE("SALOME_ContainerManager::StartContainer " << possibleComputers.length()); - //vector vector; - string theMachine=_ResManager->FindBest(possibleComputers); + + string theMachine; + try{ + switch(policy){ + case Engines::P_FIRST: + theMachine=_ResManager->FindFirst(possibleComputers); + break; + case Engines::P_CYCL: + theMachine=_ResManager->FindNext(possibleComputers); + break; + case Engines::P_BEST: + theMachine=_ResManager->FindBest(possibleComputers); + break; + } + } + catch( const SALOME_Exception &ex ){ + MESSAGE(ex.what()); + return Engines::Container::_nil(); + } + + //If the machine name is localhost use the real name + if(theMachine == "localhost") + theMachine=GetHostname(); + MESSAGE("try to launch it on " << theMachine); // Get Id for container: a parallel container registers in Naming Service @@ -162,114 +246,273 @@ FindOrStartContainer(const Engines::MachineParameters& params, id = GetIdForContainer(); string command; - if(theMachine=="") - { - MESSAGE("SALOME_ContainerManager::FindOrStartContainer : " << - "no possible computer"); - return Engines::Container::_nil(); - } + if(theMachine==""){ + MESSAGE("SALOME_ContainerManager::StartContainer : " << + "no possible computer"); + return Engines::Container::_nil(); + } else if(theMachine==GetHostname()) - { - command=_ResManager->BuildCommandToLaunchLocalContainer(params,id); - } + command=_ResManager->BuildCommandToLaunchLocalContainer(params,id); else - command = - _ResManager->BuildCommandToLaunchRemoteContainer(theMachine,params,id); + command = _ResManager->BuildCommandToLaunchRemoteContainer(theMachine,params,id); _ResManager->RmTmpFile(); - int status=system(command.c_str()); - if (status == -1) - { - MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " << - "(system command status -1)"); - return Engines::Container::_nil(); - } - else if (status == 217) + + //check if an entry exists in Naming service + if(params.isMPI) { - MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " << - "(system command status 217)"); - return Engines::Container::_nil(); + 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) ) { - int count=TIME_OUT_TO_LAUNCH_CONT; - while ( CORBA::is_nil(ret) && count ) - { + // unregister the registered container if it exists + _NS->Destroy_Name(containerNameInNS.c_str()); + // unregister component instances ??? + //Engines::Container_var cont=Engines::Container::_narrow(obj); + } + + //redirect stdout and stderr in a file + string logFilename="/tmp/"+_NS->ContainerName(params)+"_"+GetHostname()+"_"+getenv( "USER" )+".log" ; + command += " > " + logFilename + " 2>&1 &"; + + // launch container with a system call + int status=system(command.c_str()); + if (status == -1){ + MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " << + "(system command status -1)"); + return Engines::Container::_nil(); + } + else if (status == 217){ + MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " << + "(system command status 217)"); + return Engines::Container::_nil(); + } + else{ + int count=TIME_OUT_TO_LAUNCH_CONT; + MESSAGE("count = "<BuildContainerNameForNS(params,theMachine.c_str()); - SCRUTE(containerNameInNS); - CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str()); - ret=Engines::Container::_narrow(obj); - } - if ( CORBA::is_nil(ret) ) - { - MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed"); - } - return ret; + count-- ; + if ( count != 10 ) + MESSAGE( count << ". Waiting for container on " << theMachine); + + CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str()); + ret=Engines::Container::_narrow(obj); } + + if ( CORBA::is_nil(ret) ) + { + MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed"); + } + else + { + logFilename=":"+logFilename; + logFilename="@"+GetHostname()+logFilename; + logFilename=getenv( "USER" )+logFilename; + ret->logfilename(logFilename.c_str()); + } + + return ret; + } } //============================================================================= -/*! - * +/*! CORBA Method: + * Start a suitable Container in a list of machines + * \param params Machine Parameters required for the container + * \param possibleComputers list of machines usable for start */ //============================================================================= -Engines::MachineList * +Engines::Container_ptr SALOME_ContainerManager:: -GetFittingResources(const Engines::MachineParameters& params, - const char *componentName) +StartContainer(const Engines::MachineParameters& params, + Engines::ResPolicy policy, + const Engines::CompoList& componentList) { - 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; + Engines::MachineList_var possibleComputers = _ResManager->GetFittingResources(params,componentList); + return StartContainer(params,possibleComputers,policy); +} + +#ifdef WITH_PACO_PARALLEL +//============================================================================= +/*! CORBA Method: + * Find or Start a suitable PaCO++ Parallel Container in a list of machines. + * \param params Machine Parameters required for the container + * \param possibleComputers list of machines usable for find or start + * + * \return CORBA container reference. + */ +//============================================================================= +Engines::Container_ptr +SALOME_ContainerManager:: +FindOrStartParallelContainer(const Engines::MachineParameters& params_const, + const Engines::MachineList& possibleComputers) +{ + CORBA::Object_var obj; + PaCO::InterfaceManager_var proxy; + Engines::Container_ptr ret = Engines::Container::_nil(); + Engines::MachineParameters params(params_const); + + // Step 1 : Try to find a suitable container + // Currently not as good as could be since + // we have to verified the number of nodes of the container + // if a user tell that. + ret = FindContainer(params, possibleComputers); + + if(CORBA::is_nil(ret)) { + // Step 2 : Starting a new parallel container + INFOS("[FindOrStartParallelContainer] Starting a parallel container"); + + // Step 2.1 : Choose a computer + string theMachine = _ResManager->FindFirst(possibleComputers); + if(theMachine == "") { + INFOS("[FindOrStartParallelContainer] !!!!!!!!!!!!!!!!!!!!!!!!!!"); + INFOS("[FindOrStartParallelContainer] No possible computer found"); + INFOS("[FindOrStartParallelContainer] !!!!!!!!!!!!!!!!!!!!!!!!!!"); } + else { + INFOS("[FindOrStartParallelContainer] on machine : " << theMachine); + string command; + if(theMachine == GetHostname()) { + // Step 3 : starting parallel container proxy + params.hostname = CORBA::string_dup(theMachine.c_str()); + Engines::MachineParameters params_proxy(params); + try { + command = _ResManager->BuildCommandToLaunchLocalParallelContainer("SALOME_ParallelContainerProxy", params_proxy, "xterm"); + } + catch(const SALOME_Exception & ex){ + MESSAGE(ex.what()); + return Engines::Container::_nil(); + } + // LaunchParallelContainer uses this value to know if it launches the proxy or the nodes + params_proxy.nb_component_nodes = 0; + obj = LaunchParallelContainer(command, params_proxy, _NS->ContainerName(params)); + ret = Engines::Container::_narrow(obj); + proxy = PaCO::InterfaceManager::_narrow(obj); + + // Step 4 : starting parallel container nodes + command = _ResManager->BuildCommandToLaunchLocalParallelContainer("SALOME_ParallelContainerNode", params, "xterm"); + string name = _NS->ContainerName(params) + "Node"; + LaunchParallelContainer(command, params, name); + // Step 5 : connecting nodes and the proxy to actually create a parallel container + try { + for (int i = 0; i < params.nb_component_nodes; i++) { + + char buffer [5]; +#ifndef WNT + snprintf(buffer,5,"%d",i); +#else + _snprintf(buffer,5,"%d",i); +#endif + string name_cont = name + string(buffer); + + string theNodeMachine(CORBA::string_dup(params.hostname)); + string containerNameInNS = _NS->BuildContainerNameForNS(name_cont.c_str(),theNodeMachine.c_str()); + int count = TIME_OUT_TO_LAUNCH_CONT; + obj = _NS->Resolve(containerNameInNS.c_str()); + while (CORBA::is_nil(obj) && count) { + INFOS("[FindOrStartParallelContainer] CONNECTION FAILED !!!!!!!!!!!!!!!!!!!!!!!!"); +#ifndef WNT + sleep(1) ; +#else + Sleep(1000); +#endif + count-- ; + obj = _NS->Resolve(containerNameInNS.c_str()); + } - // MESSAGE("Machine list length "<length(vec.size()); - for(unsigned int i=0;ideploy(); + } + proxy->start(); + } + catch(CORBA::SystemException& e) + { + INFOS("Caught CORBA::SystemException. : " << e); + } + catch(PortableServer::POA::ServantAlreadyActive&) + { + INFOS("Caught CORBA::ServantAlreadyActiveException"); + } + catch(CORBA::Exception&) + { + INFOS("Caught CORBA::Exception."); + } + catch(std::exception& exc) + { + INFOS("Caught std::exception - "<FindBest(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); } //============================================================================= @@ -314,6 +557,97 @@ FindContainer(const Engines::MachineParameters& params, return Engines::Container::_nil(); } +//============================================================================= +/*! This method launches the parallel container. + * It will may be placed on the ressources manager. + * + * \param command to launch + * \param container's parameters + * \param name of the container + * + * \return CORBA container reference + */ +//============================================================================= +CORBA::Object_ptr +SALOME_ContainerManager::LaunchParallelContainer(const std::string& command, + const Engines::MachineParameters& params, + const std::string& name) +{ + CORBA::Object_ptr obj = CORBA::Object::_nil(); + string containerNameInNS; + MESSAGE("[LaunchParallelContainer] : command to launch..."); + MESSAGE(command); + if (params.nb_component_nodes == 0) { + INFOS("[LaunchParallelContainer] launching the proxy of the parallel container"); + int status = system(command.c_str()); + if (status == -1) { + INFOS("[LaunchParallelContainer] failed : system command status -1"); + } + else if (status == 217) { + INFOS("[LaunchParallelContainer] failed : system command status 217"); + } + + int count = TIME_OUT_TO_LAUNCH_CONT; + string theMachine(CORBA::string_dup(params.hostname)); + containerNameInNS = _NS->BuildContainerNameForNS((char*) name.c_str(),theMachine.c_str()); + + INFOS("[LaunchParallelContainer] Waiting for Parallel Container proxy on " << theMachine); + while (CORBA::is_nil(obj) && count) { +#ifndef WNT + sleep(1) ; +#else + Sleep(1000); +#endif + count-- ; + obj = _NS->Resolve(containerNameInNS.c_str()); + } + } + else { + INFOS("[LaunchParallelContainer] launching the nodes of the parallel container"); + int status = system(command.c_str()); + if (status == -1) { + INFOS("[LaunchParallelContainer] failed : system command status -1"); + } + else if (status == 217) { + INFOS("[LaunchParallelContainer] failed : system command status 217"); + } + // We are waiting all the nodes + for (int i = 0; i < params.nb_component_nodes; i++) { + obj = CORBA::Object::_nil(); + int count = TIME_OUT_TO_LAUNCH_CONT; + + // Name of the node + char buffer [5]; +#ifndef WNT + snprintf(buffer,5,"%d",i); +#else + _snprintf(buffer,5,"%d",i); +#endif + + string name_cont = name + string(buffer); + + // I don't like this... + string theMachine(CORBA::string_dup(params.hostname)); + containerNameInNS = _NS->BuildContainerNameForNS((char*) name_cont.c_str(),theMachine.c_str()); + cerr << "[LaunchContainer] Waiting for Parllel Container node " << containerNameInNS << " on " << theMachine << endl; + while (CORBA::is_nil(obj) && count) { +#ifndef WNT + sleep(1) ; +#else + Sleep(1000); +#endif + count-- ; + obj = _NS->Resolve(containerNameInNS.c_str()); + } + } + } + + if ( CORBA::is_nil(obj) ) { + INFOS("[LaunchParallelContainer] failed"); + } + return obj; +} + //============================================================================= /*! * Get Id for container: a parallel container registers in Naming Service @@ -332,3 +666,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 82492f71e..34888f98c 100644 --- a/src/Container/SALOME_ContainerManager.hxx +++ b/src/Container/SALOME_ContainerManager.hxx @@ -20,6 +20,8 @@ #ifndef __SALOME_CONTAINERMANAGER_HXX__ #define __SALOME_CONTAINERMANAGER_HXX__ +#include + #include #include CORBA_CLIENT_HEADER(SALOME_Component) #include CORBA_CLIENT_HEADER(SALOME_ContainerManager) @@ -30,44 +32,42 @@ class SALOME_NamingService; -#if defined CONTAINER_EXPORTS -#if defined WIN32 -#define CONTAINER_EXPORT __declspec( dllexport ) -#else -#define CONTAINER_EXPORT -#endif -#else -#if defined WNT -#define CONTAINER_EXPORT __declspec( dllimport ) -#else -#define CONTAINER_EXPORT -#endif -#endif - class CONTAINER_EXPORT SALOME_ContainerManager: - public POA_Engines::ContainerManager, - public PortableServer::RefCountServantBase + public POA_Engines::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 FindOrStartContainer(const Engines::MachineParameters& params, const Engines::MachineList& possibleComputer); - Engines::MachineList * - GetFittingResources(const Engines::MachineParameters& params, - const char *componentName); + Engines::Container_ptr + StartContainer(const Engines::MachineParameters& params, + const Engines::MachineList& possibleComputer, + Engines::ResPolicy policy); + + Engines::Container_ptr + StartContainer(const Engines::MachineParameters& params, + Engines::ResPolicy policy, + const Engines::CompoList& componentList); - char* FindBest(const Engines::MachineList& possibleComputers); + Engines::Container_ptr + GiveContainer(const Engines::MachineParameters& params, + Engines::ResPolicy policy, + const Engines::CompoList& componentList); void Shutdown(); void ShutdownContainers(); static const char *_ContainerManagerNameInNS; + // Parallel extension + Engines::Container_ptr + FindOrStartParallelContainer(const Engines::MachineParameters& params, + const Engines::MachineList& possibleComputer); protected: Engines::Container_ptr FindContainer(const Engines::MachineParameters& params, @@ -77,11 +77,23 @@ protected: FindContainer(const Engines::MachineParameters& params, const char *theMachine); + // Parallel extension + CORBA::Object_ptr + LaunchParallelContainer(const std::string& command, + 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 6eb0110bc..1694bc79d 100755 --- a/src/Container/SALOME_ContainerPy.py +++ b/src/Container/SALOME_ContainerPy.py @@ -31,7 +31,7 @@ import os import sys import string -import omnipatch # PAL10310 + from omniORB import CORBA, PortableServer import SALOMEDS import Engines, Engines__POA @@ -40,6 +40,7 @@ from SALOME_ComponentPy import * from SALOME_utilities import * from Utils_Identity import getShortHostName +from launchConfigureParser import verbose #============================================================================= @@ -61,7 +62,7 @@ class SALOME_ContainerPy_i (Engines__POA.Container): Container_path = "/Containers/" + myMachine + "/" + containerName #self._containerName = containerName self._containerName = Container_path - print "container name ",self._containerName + if verbose(): print "container name ",self._containerName naming_service = SALOME_NamingServicePy_i(self._orb) self._naming_service = naming_service @@ -140,10 +141,10 @@ class SALOME_ContainerPy_i (Engines__POA.Container): self._numInstance = self._numInstance +1 instanceName = nameToRegister + "_inst_" + `self._numInstance` - component=__import__(componentName) - factory=getattr(component,componentName) - comp_i=factory(self._orb, self._poa, self._this(), self._containerName, - instanceName, nameToRegister) + component=__import__(componentName) + factory=getattr(component,componentName) + comp_i=factory(self._orb, self._poa, self._this(), self._containerName, + instanceName, nameToRegister) MESSAGE( "SALOME_ContainerPy_i::instance : component created") comp_o = comp_i._this() @@ -170,9 +171,9 @@ class SALOME_ContainerPy_i (Engines__POA.Container): MESSAGE( "SALOME_Container_i::import_component" ) ret=0 try: - print "try import ",componentName - __import__(componentName) - print "import ",componentName," successful" + if verbose(): print "try import ",componentName + module=__import__(componentName) + if verbose(): print "import ",componentName," successful" ret=1 except: import traceback @@ -309,15 +310,19 @@ class SALOME_ContainerPy_i (Engines__POA.Container): #============================================================================= #initialise the ORB and find the root POA +print "Starting ",sys.argv[1] orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) poa = orb.resolve_initial_references("RootPOA") +print "ORB and POA initialized" #create an instance of SALOME_ContainerPy_i and a Container reference #containerName = "FactoryServerPy" MESSAGE( str(sys.argv) ) containerName = sys.argv[1] cpy_i = SALOME_ContainerPy_i(orb, poa, containerName) +print "SALOME_ContainerPy_i instance created ",cpy_i cpy_o = cpy_i._this() +print "SALOME_ContainerPy_i instance activated ",cpy_o #activate the POA poaManager = poa._get_the_POAManager() diff --git a/src/Container/SALOME_Container_SignalsHandler.cxx b/src/Container/SALOME_Container_SignalsHandler.cxx index bc233e4ab..cb1117ed7 100644 --- a/src/Container/SALOME_Container_SignalsHandler.cxx +++ b/src/Container/SALOME_Container_SignalsHandler.cxx @@ -19,7 +19,7 @@ #include -#include +#include #include "utilities.h" // CCRT porting diff --git a/src/Container/SALOME_Container_i.hxx b/src/Container/SALOME_Container_i.hxx index 14d51c5df..153b381f8 100644 --- a/src/Container/SALOME_Container_i.hxx +++ b/src/Container/SALOME_Container_i.hxx @@ -29,6 +29,8 @@ #ifndef _SALOME_CONTAINER_I_HXX_ #define _SALOME_CONTAINER_I_HXX_ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Component) @@ -45,29 +47,14 @@ class SALOME_NamingService; - -#if defined CONTAINER_EXPORTS -#if defined WIN32 -#define CONTAINER_EXPORT __declspec( dllexport ) -#else -#define CONTAINER_EXPORT -#endif -#else -#if defined WNT -#define CONTAINER_EXPORT __declspec( dllimport ) -#else -#define CONTAINER_EXPORT -#endif -#endif - class CONTAINER_EXPORT Engines_Container_i: public virtual POA_Engines::Container, - public virtual PortableServer::RefCountServantBase + public virtual PortableServer::ServantBase { public: Engines_Container_i(); Engines_Container_i(CORBA::ORB_ptr orb, - PortableServer::POA_var poa, + PortableServer::POA_ptr poa, char * containerName , int argc, char* argv[], bool activAndRegist = true, @@ -96,6 +83,10 @@ public: virtual void ping(); char* name(); + char* workingdir(); + char* logfilename(); + void logfilename(const char* name); + virtual void Shutdown(); char* getHostName(); CORBA::Long getPID(); @@ -105,7 +96,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 @@ -138,12 +129,14 @@ protected: SALOME_NamingService *_NS ; std::string _library_path; std::string _containerName; + std::string _logfilename; CORBA::ORB_var _orb; PortableServer::POA_var _poa; PortableServer::ObjectId * _id ; 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_FileRef_i.hxx b/src/Container/SALOME_FileRef_i.hxx index 0856bb1c1..3e32964a5 100644 --- a/src/Container/SALOME_FileRef_i.hxx +++ b/src/Container/SALOME_FileRef_i.hxx @@ -26,15 +26,17 @@ #ifndef _SALOME_FILEREF_I_HXX_ #define _SALOME_FILEREF_I_HXX_ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Component) #include #include -class fileRef_i: +class CONTAINER_EXPORT fileRef_i: public virtual POA_Engines::fileRef, - public virtual PortableServer::RefCountServantBase + public virtual PortableServer::ServantBase { public: fileRef_i(); diff --git a/src/Container/SALOME_FileTransfer_i.hxx b/src/Container/SALOME_FileTransfer_i.hxx index 8141bbc8a..f35a5582d 100644 --- a/src/Container/SALOME_FileTransfer_i.hxx +++ b/src/Container/SALOME_FileTransfer_i.hxx @@ -27,14 +27,16 @@ #ifndef _SALOME_FILETRANSFER_I_HXX_ #define _SALOME_FILETRANSFER_I_HXX_ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Component) #include #include -class fileTransfer_i: +class CONTAINER_EXPORT fileTransfer_i: public virtual POA_Engines::fileTransfer, - public virtual PortableServer::RefCountServantBase + public virtual PortableServer::ServantBase { public: fileTransfer_i(); diff --git a/src/Container/Salome_file_i.cxx b/src/Container/Salome_file_i.cxx new file mode 100644 index 000000000..a098c06f9 --- /dev/null +++ b/src/Container/Salome_file_i.cxx @@ -0,0 +1,1063 @@ +// 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); + delete aBlock; + } + 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..b1337871f --- /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_var _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..3cfe5585d --- /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..f06c02a41 --- /dev/null +++ b/src/DF/Makefile.am @@ -0,0 +1,95 @@ +# 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 local variable defines the list of dependant libraries common to all target in this package. +COMMON_LIBS =\ + ../HDFPersist/libSalomeHDFPersist.la \ + @HDF5_LIBS@ + +# +# =============================================================== +# 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 \ + $(HDF5_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 new file mode 100644 index 000000000..2f7f089c9 --- /dev/null +++ b/src/DSC/DSC_Basic/ConnectionManager_i.cxx @@ -0,0 +1,130 @@ +// 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 : ConnectionManager_i.cxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#include "ConnectionManager_i.hxx" +#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"; + CORBA::Object_var obref = _this(); + _remove_ref(); + ns->Register(obref, ConnectionManagerNameInNS); + delete ns; + + current_id = 0; + pthread_mutex_init(&mutex, NULL); +} + +ConnectionManager_i::~ConnectionManager_i() {} + +Engines::ConnectionManager::connectionId +ConnectionManager_i::connect(Engines::DSC_ptr uses_component, + const char* uses_port_name, + Engines::DSC_ptr provides_component, + const char* provides_port_name) +{ + + 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); + + // Creating a new connection id. + // We use a mutex for multithreaded applications. + pthread_mutex_lock(&mutex); + Engines::ConnectionManager::connectionId rtn_id = current_id; + current_id += 1; + pthread_mutex_unlock(&mutex); + + // Creating a new structure containing connection's infos. + connection_infos * infos = new connection_infos(); + infos->uses_component = Engines::DSC::_duplicate(uses_component); + infos->uses_port_name = uses_port_name; + infos->provides_component = Engines::DSC::_duplicate(provides_component); + infos->provides_port_name = provides_port_name; + infos->provides_port = Ports::Port::_duplicate(p_port); + + // Adding the new connection into the map. + ids[rtn_id] = infos; + + return rtn_id; +} + +void +ConnectionManager_i::disconnect(Engines::ConnectionManager::connectionId id, + Engines::DSC::Message message) +{ + int err=0; + // Connection id exist ? + ids_it = ids.find(id); + if (ids_it == ids.end()) + throw Engines::ConnectionManager::BadId(); + + // TODO + // We need to catch exceptions if one of these disconnect operation fails. + connection_infos * infos = ids[id]; + try + { + infos->provides_component->disconnect_provides_port(infos->provides_port_name.c_str(), + message); + } + 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 new file mode 100644 index 000000000..7696fc676 --- /dev/null +++ b/src/DSC/DSC_Basic/ConnectionManager_i.hxx @@ -0,0 +1,100 @@ +// 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 : ConnectionManager_i.hxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#ifndef _CONNECTION_MANAGER_I_HXX_ +#define _CONNECTION_MANAGER_I_HXX_ + +#include + +#include +#include +#include + +#include +#include CORBA_SERVER_HEADER(DSC_Engines) + +/*! \class ConnectionManager_i + * \brief This class implements the interface Engines::ConnectionManager. + */ +class DSC_BASIC_EXPORT ConnectionManager_i : + public virtual POA_Engines::ConnectionManager +{ + public : + ConnectionManager_i(CORBA::ORB_ptr orb); + virtual ~ConnectionManager_i(); + + /*! + * CORBA method : connect two ports of two components. + * \see Engines::ConnectionManager::connect + */ + Engines::ConnectionManager::connectionId connect(Engines::DSC_ptr uses_component, + const char* uses_port_name, + Engines::DSC_ptr provides_component, + const char* provides_port_name); + + /*! + * CORBA method : releases a connection performed with + * ConnectionManager_i::connect. + * + * \see Engines::ConnectionManager::disconnect + */ + void disconnect(Engines::ConnectionManager::connectionId id, + 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_var uses_component; + std::string uses_port_name; + Engines::DSC_var provides_component; + std::string provides_port_name; + Ports::Port_var provides_port; + }; + + typedef std::map ids_type; + typedef std::map::iterator ids_it_type; + + ids_type ids; + ids_it_type ids_it; + + int current_id; + pthread_mutex_t mutex; + protected: + CORBA::ORB_var _orb; +}; + +#endif diff --git a/src/SALOMEDS/SALOMEDS_TargetAttribute.jxx b/src/DSC/DSC_Basic/DSC_Basic.hxx old mode 100644 new mode 100755 similarity index 59% rename from src/SALOMEDS/SALOMEDS_TargetAttribute.jxx rename to src/DSC/DSC_Basic/DSC_Basic.hxx index 514c1372a..0efc1a2e2 --- a/src/SALOMEDS/SALOMEDS_TargetAttribute.jxx +++ b/src/DSC/DSC_Basic/DSC_Basic.hxx @@ -1,5 +1,3 @@ -// 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 // @@ -17,27 +15,34 @@ // 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_TargetAttribute.jxx -// Author : Yves FRICAUD +// File : DSC_Basic.hxx +// Author : Natalia ERMOLAYEVA // 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 +#ifndef _DSC_Basic_HXX_ +#define _DSC_Basic_HXX_ + +#ifdef WNT + #if defined DSC_BASIC_EXPORTS + #if defined WIN32 + #define DSC_BASIC_EXPORT __declspec( dllexport ) + #else + #define DSC_BASIC_EXPORT + #endif + #else + #if defined WIN32 + #define DSC_BASIC_EXPORT __declspec( dllimport ) + #else + #define DSC_BASIC_EXPORT + #endif + #endif +#else + #define DSC_BASIC_EXPORT #endif -#ifndef _SALOMEDS_TargetAttribute_HeaderFile -#include "SALOMEDS_TargetAttribute.hxx" + #endif + diff --git a/src/DSC/DSC_Basic/DSC_Callbacks.hxx b/src/DSC/DSC_Basic/DSC_Callbacks.hxx new file mode 100644 index 000000000..ffdf57d76 --- /dev/null +++ b/src/DSC/DSC_Basic/DSC_Callbacks.hxx @@ -0,0 +1,74 @@ +// 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 : DSC_Callbacks.hxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#ifndef _DSC_CALLBACKS_HXX_ +#define _DSC_CALLBACKS_HXX_ + +#include + +#include +#include CORBA_SERVER_HEADER(DSC_Engines) + +/*! \class DSC_Callbacks + * \brief This is an abstract class that defines methods that the component + * uses to prevent the component user code that the state of the component has changed. + * Currently only port's connection modifications are signaled. + */ +class DSC_BASIC_EXPORT DSC_Callbacks +{ + public: + DSC_Callbacks() {} + virtual ~DSC_Callbacks() {} + + /*! + * This method is used by the component when the number of connection + * on a provides port changes. This information helps the user code to detect + * operation on its ports. + * + * + * \param provides_port_name the name of the provides name that has changed. + * \param connection_nbr the new number of connection on the provides port. + * \param message contains informations about the modification of the port. + */ + virtual void provides_port_changed(const char* provides_port_name, + int connection_nbr, + const Engines::DSC::Message message) = 0; + + /*! + * This method is used by the component when the number of connection + * on a uses port changes. This information helps the user code to detect + * operation on its ports. + * + * + * \param uses_port_name the name of the uses name that has changed. + * \param new_uses_port the new sequence representing the uses port. + * \param message contains informations about the modification of the port. + */ + virtual void uses_port_changed(const char* uses_port_name, + Engines::DSC::uses_port * new_uses_port, + const Engines::DSC::Message message) = 0; +}; + +#endif diff --git a/src/DSC/DSC_Basic/DSC_i.cxx b/src/DSC/DSC_Basic/DSC_i.cxx new file mode 100644 index 000000000..bf67a554c --- /dev/null +++ b/src/DSC/DSC_Basic/DSC_i.cxx @@ -0,0 +1,46 @@ +// 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 : DSC_i.cxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#include "DSC_i.hxx" + +Engines_DSC_i:: +Engines_DSC_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName, + bool notif) : Engines_Component_i(orb, + poa, + contId, + instanceName, + interfaceName) +{ +#ifdef _DEBUG_ + std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl; +#endif +} + +Engines_DSC_i::~Engines_DSC_i() {} + diff --git a/src/DSC/DSC_Basic/DSC_i.hxx b/src/DSC/DSC_Basic/DSC_i.hxx new file mode 100644 index 000000000..6a495f9ce --- /dev/null +++ b/src/DSC/DSC_Basic/DSC_i.hxx @@ -0,0 +1,171 @@ +// 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 : DSC_i.hxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#ifndef _DSC_I_HXX_ +#define _DSC_I_HXX_ + +#include + +#include +#include +#include +#include + +#include "SALOME_Component_i.hxx" +#include "DSC_interface.hxx" + +/*! \class Engines_DSC_i + * \brief This class implements the interface Engines::DSC + * + * The implementation of methods are performed by the class Engines_DSC_interface. + */ +class DSC_BASIC_EXPORT Engines_DSC_i: + public Engines_Component_i, // keyword virtual is not use to be able to + // call the right Engines_Component_i constructor. + // If virtual is used, a derived class of Engines_DSC_i + // will have to call the right Engines_Component_i constructor. + public virtual POA_Engines::DSC, + public Engines_DSC_interface +{ +public: + Engines_DSC_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName, + bool notif = false); + + virtual ~Engines_DSC_i(); + + /*! + * \see Engines::DSC::add_provides_port + */ + virtual void add_provides_port(Ports::Port_ptr ref, + const char* provides_port_name, + Ports::PortProperties_ptr port_prop) + throw (Engines::DSC::PortAlreadyDefined, + Engines::DSC::NilPort, + Engines::DSC::BadProperty) { + Engines_DSC_interface::add_provides_port(ref, + provides_port_name, + port_prop); + } + + /*! + * \see Engines::DSC::add_uses_port + */ + virtual void add_uses_port(const char* repository_id, + const char* uses_port_name, + Ports::PortProperties_ptr port_prop) + throw (Engines::DSC::PortAlreadyDefined, + Engines::DSC::BadProperty) { + Engines_DSC_interface::add_uses_port(repository_id, + uses_port_name, + port_prop); + } + + /*! + * \see Engines::DSC::get_provides_port + */ + virtual Ports::Port_ptr get_provides_port(const char* provides_port_name, + const CORBA::Boolean connection_error) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected) { + return Engines_DSC_interface::get_provides_port(provides_port_name, + connection_error); + } + + /*! + * \see Engines::DSC::get_uses_port + */ + virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected) { + return Engines_DSC_interface::get_uses_port(uses_port_name); + } + + /*! + * \see Engines::DSC::connect_provides_port + */ + virtual void connect_provides_port(const char* provides_port_name) + throw (Engines::DSC::PortNotDefined) { + Engines_DSC_interface::connect_provides_port(provides_port_name); + } + + /*! + * \see Engines::DSC::connect_uses_port + */ + 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) { + Engines_DSC_interface::connect_uses_port(uses_port_name, + provides_port_ref); + } + + /*! + * \see Engines::DSC::is_connected + */ + virtual CORBA::Boolean is_connected(const char* port_name) + throw (Engines::DSC::PortNotDefined) { + return Engines_DSC_interface::is_connected(port_name); + } + + /*! + * \see Engines::DSC::disconnect_provides_port + */ + virtual void disconnect_provides_port(const char* provides_port_name, + const Engines::DSC::Message message) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected) { + Engines_DSC_interface::disconnect_provides_port(provides_port_name, + message); + } + + /*! + * \see Engines::DSC::disconnect_uses_port + */ + 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) { + Engines_DSC_interface::disconnect_uses_port(uses_port_name, + provides_port_ref, + message); + } + + /*! + * \see Engines::DSC::get_port_properties + */ + virtual Ports::PortProperties_ptr get_port_properties(const char* port_name) + throw (Engines::DSC::PortNotDefined) { + return Engines_DSC_interface::get_port_properties(port_name); + } +}; + +#endif diff --git a/src/DSC/DSC_Basic/DSC_interface.cxx b/src/DSC/DSC_Basic/DSC_interface.cxx new file mode 100644 index 000000000..399a62c22 --- /dev/null +++ b/src/DSC/DSC_Basic/DSC_interface.cxx @@ -0,0 +1,381 @@ +// 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 : DSC_interface.cxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#include +#include "DSC_interface.hxx" + +Engines_DSC_interface::Engines_DSC_interface() {} + +Engines_DSC_interface::~Engines_DSC_interface() +{ + my_ports_it = my_ports.begin(); + for(;my_ports_it != my_ports.end();my_ports_it++) + delete my_ports_it->second; + +} + +void +Engines_DSC_interface::add_provides_port(Ports::Port_ptr ref, + const char* provides_port_name, + Ports::PortProperties_ptr port_prop) +throw (Engines::DSC::PortAlreadyDefined, + Engines::DSC::NilPort, + Engines::DSC::BadProperty) +{ + // Method args test + assert(provides_port_name); + if (CORBA::is_nil(ref)) + throw Engines::DSC::NilPort(); + if (CORBA::is_nil(port_prop)) + throw Engines::DSC::BadProperty(); + + my_ports_it = my_ports.find(provides_port_name); + if (my_ports_it == my_ports.end()) { + // Creating a new port provides + port_t * new_port = new port_t(); + new_port->type = provides; + new_port->connection_nbr = 0; + new_port->provides_port_ref = Ports::Port::_duplicate(ref); + new_port->port_prop = Ports::PortProperties::_duplicate(port_prop); + + // Port into the port's map + my_ports[provides_port_name] = new_port; + } + else + throw Engines::DSC::PortAlreadyDefined(); +} + +void +Engines_DSC_interface::add_uses_port(const char* repository_id, + const char* uses_port_name, + Ports::PortProperties_ptr port_prop) +throw (Engines::DSC::PortAlreadyDefined, + Engines::DSC::BadProperty) +{ + // Method args test + // Note : We can't be shure that repository id + // is a correct CORBA id. + assert(repository_id); + assert(uses_port_name); + if (CORBA::is_nil(port_prop)) + throw Engines::DSC::BadProperty(); + + my_ports_it = my_ports.find(uses_port_name); + if (my_ports_it == my_ports.end()) { + // Creating a new uses port + port_t * new_port = new port_t(); + new_port->type = uses; + new_port->connection_nbr = 0; + new_port->uses_port_refs.length(0); + new_port->repository_id = repository_id; + new_port->port_prop = Ports::PortProperties::_duplicate(port_prop); + + // Port into port's map + my_ports[uses_port_name] = new_port; + } + else + throw Engines::DSC::PortAlreadyDefined(); +} + +Ports::Port_ptr +Engines_DSC_interface::get_provides_port(const char* provides_port_name, + const CORBA::Boolean connection_error) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected, + Engines::DSC::BadPortType) +{ + // Method arg test + assert(provides_port_name); + + Ports::Port_ptr rtn_port = Ports::Port::_nil(); +// std::cout << "---- DSC_Interface : MARK 1 ---- Recherche de : " << provides_port_name << "----" << std::endl; +// ports::iterator it; +// std::cout << "----> "; +// for(it=my_ports.begin();it!=my_ports.end();++it) +// std::cout << "|"<<(*it).first<<"|, "; +// std::cout << std::endl; + + // Searching the port + my_ports_it = my_ports.find(provides_port_name); + if (my_ports_it == my_ports.end()) + throw Engines::DSC::PortNotDefined(); + if (my_ports[provides_port_name]->type != provides) { + Engines::DSC::BadPortType BPT; + BPT.expected = CORBA::string_dup("Expected a provides port"); + BPT.received = CORBA::string_dup((std::string("Received a uses/none port : ")+provides_port_name).c_str()); + throw BPT; + } + + if (my_ports[provides_port_name]->connection_nbr == 0 && connection_error) + throw Engines::DSC::PortNotConnected(); + + rtn_port = Ports::Port::_duplicate(my_ports[provides_port_name]->provides_port_ref); + return rtn_port; +} + +Engines::DSC::uses_port * +Engines_DSC_interface::get_uses_port(const char* uses_port_name) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected, + Engines::DSC::BadPortType) +{ + // Method arg test + assert(uses_port_name); + + Engines::DSC::uses_port * rtn_port = NULL; + + // Searching the uses port + my_ports_it = my_ports.find(uses_port_name); + if (my_ports_it == my_ports.end()) + throw Engines::DSC::PortNotDefined(); + if (my_ports[uses_port_name]->type != uses){ + Engines::DSC::BadPortType BPT; + BPT.expected = CORBA::string_dup("Expected a uses port"); + BPT.received = CORBA::string_dup((std::string("Received a provides/none port : ")+uses_port_name).c_str()); + std::cout << "---- DSC_Interface : MARK 1 ---- exception : " << uses_port_name << "----" << std::endl; + throw BPT; + } + + // Is the port connected ? + if (my_ports[uses_port_name]->connection_nbr > 0) { + rtn_port = new Engines::DSC::uses_port(my_ports[uses_port_name]->uses_port_refs); + } + else + { + std::cout << "---- DSC_Interface : MARK 2 ---- exception : " << uses_port_name << "----" << std::endl; + throw Engines::DSC::PortNotConnected(); + } + + return rtn_port; +} + +void +Engines_DSC_interface::connect_provides_port(const char* provides_port_name) + throw (Engines::DSC::PortNotDefined) +{ + // Method arg test + assert(provides_port_name); + + // Searching the provides port + my_ports_it = my_ports.find(provides_port_name); + if (my_ports_it == my_ports.end()) + throw Engines::DSC::PortNotDefined(); + if (my_ports[provides_port_name]->type != provides) + throw Engines::DSC::PortNotDefined(); + + + // Adding a new connection + my_ports[provides_port_name]->connection_nbr += 1; + // User code is informed + provides_port_changed(provides_port_name, + my_ports[provides_port_name]->connection_nbr, + Engines::DSC::AddingConnection + ); +} + +void +Engines_DSC_interface::connect_uses_port(const char* uses_port_name, + Ports::Port_ptr provides_port_ref) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::BadPortType, + Engines::DSC::NilPort) +{ + // Method arg test + assert(uses_port_name); + + if (CORBA::is_nil(provides_port_ref)) + throw Engines::DSC::NilPort(); + + // Searching the uses port + my_ports_it = my_ports.find(uses_port_name); + if (my_ports_it == my_ports.end()) + throw Engines::DSC::PortNotDefined(); + if (my_ports[uses_port_name]->type != uses) { + Engines::DSC::BadPortType BPT; + BPT.expected = CORBA::string_dup("Expected a uses port"); + BPT.received = CORBA::string_dup((std::string("Received a provides/none port : ")+uses_port_name).c_str()); + throw BPT; + } + + // repository_id test + const char * repository_id = my_ports[uses_port_name]->repository_id.c_str(); + if (provides_port_ref->_is_a(repository_id)) + { + // Adding provides port into the uses port sequence + CORBA::ULong lgth = my_ports[uses_port_name]->uses_port_refs.length(); + my_ports[uses_port_name]-> + uses_port_refs.length(lgth + 1); + my_ports[uses_port_name]->uses_port_refs[lgth] = + Ports::Port::_duplicate(provides_port_ref); + + // Adding a new connection + my_ports[uses_port_name]->connection_nbr += 1; + // User code is informed + uses_port_changed(uses_port_name, + new Engines::DSC::uses_port(my_ports[uses_port_name]->uses_port_refs), + Engines::DSC::AddingConnection); + } + else { + Engines::DSC::BadPortType BPT; + BPT.expected = CORBA::string_dup("Expected ..."); + BPT.received = CORBA::string_dup((std::string("Received an incorrect repository id type ")+ + repository_id).c_str()); + throw BPT; + } + +} + +CORBA::Boolean +Engines_DSC_interface::is_connected(const char* port_name) + throw (Engines::DSC::PortNotDefined) +{ + CORBA::Boolean rtn = false; + + // Method arg test + assert(port_name); + + my_ports_it = my_ports.find(port_name); + if (my_ports_it == my_ports.end()) + throw Engines::DSC::PortNotDefined(); + + // Is it connected ? + if (my_ports[port_name]->connection_nbr > 0) + rtn = true; + + return rtn; +} + +void +Engines_DSC_interface::disconnect_provides_port(const char* provides_port_name, + const Engines::DSC::Message message) +throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected) +{ + // Method args test + assert(provides_port_name); + + my_ports_it = my_ports.find(provides_port_name); + if (my_ports_it == my_ports.end()) + throw Engines::DSC::PortNotDefined(); + if (my_ports[provides_port_name]->type != provides) + throw Engines::DSC::PortNotDefined(); + + // Is it connected ? + if (my_ports[provides_port_name]->connection_nbr > 0) + { + my_ports[provides_port_name]->connection_nbr -= 1; + provides_port_changed(provides_port_name, + my_ports[provides_port_name]->connection_nbr, + message); + } + else + throw Engines::DSC::PortNotConnected(); +} + +void +Engines_DSC_interface::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) +{ + // Method args test + assert(uses_port_name); + + my_ports_it = my_ports.find(uses_port_name); + if (my_ports_it == my_ports.end()) + throw Engines::DSC::PortNotDefined(); + if (my_ports[uses_port_name]->type != uses) + throw Engines::DSC::PortNotDefined(); + + if (CORBA::is_nil(provides_port_ref)) + throw Engines::DSC::BadPortReference(); + + // Is it connected ? + if (my_ports[uses_port_name]->connection_nbr > 0) { + CORBA::Long port_index = -1; + CORBA::ULong seq_length = my_ports[uses_port_name]->uses_port_refs.length(); + for(int i = 0; i < seq_length; i++) + { + if (my_ports[uses_port_name]->uses_port_refs[i]->_is_equivalent(provides_port_ref)) + { + port_index = i; + break; + } + } + if (port_index == -1) + throw Engines::DSC::BadPortReference(); + + my_ports[uses_port_name]->connection_nbr -= 1; + Engines::DSC::uses_port * new_uses_port = + new Engines::DSC::uses_port(); + new_uses_port->length(seq_length - 1); + + int index_ancien = 0; + int index_nouveau = 0; + for(;index_ancien < seq_length;) { + if (index_ancien == port_index) + { + // Rien a faire ! + // On ne change pas le index du nouveau tableau + index_ancien += 1; + } + else + { + (*new_uses_port)[index_nouveau] = my_ports[uses_port_name]->uses_port_refs[index_ancien]; + index_ancien += 1; + index_nouveau += 1; + } + } + + // New uses port's sequence + my_ports[uses_port_name]->uses_port_refs = *new_uses_port; + + // The user code is informed + uses_port_changed(uses_port_name, + new_uses_port, + message); + } + else + throw Engines::DSC::PortNotConnected(); +} + +Ports::PortProperties_ptr +Engines_DSC_interface::get_port_properties(const char* port_name) + throw (Engines::DSC::PortNotDefined) +{ + Ports::PortProperties_ptr rtn_properties = Ports::PortProperties::_nil(); + + // Method arg test + assert(port_name); + + my_ports_it = my_ports.find(port_name); + if (my_ports_it == my_ports.end()) + throw Engines::DSC::PortNotDefined(); + + rtn_properties = Ports::PortProperties::_duplicate(my_ports[port_name]->port_prop); + return rtn_properties; +} diff --git a/src/DSC/DSC_Basic/DSC_interface.hxx b/src/DSC/DSC_Basic/DSC_interface.hxx new file mode 100644 index 000000000..5bf5712d2 --- /dev/null +++ b/src/DSC/DSC_Basic/DSC_interface.hxx @@ -0,0 +1,181 @@ +// 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 : DSC_interface.hxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#ifndef _DSC_INTERFACE_HXX_ +#define _DSC_INTERFACE_HXX_ + +#include +#include +#include +#include + +#include "DSC_Callbacks.hxx" + +/*! \class Engines_DSC_interface + * \brief This class implements the interface Engines::DSC + * + * This class is used by the sequential DSC implementation + * and the parallel DSC implementation. + */ +class Engines_DSC_interface: + public DSC_Callbacks +{ +public: + Engines_DSC_interface(); + virtual ~Engines_DSC_interface(); + + /*! + * \see Engines::DSC::add_provides_port + */ + virtual void add_provides_port(Ports::Port_ptr ref, + const char* provides_port_name, + Ports::PortProperties_ptr port_prop) + throw (Engines::DSC::PortAlreadyDefined, + Engines::DSC::NilPort, + Engines::DSC::BadProperty); + + /*! + * \see Engines::DSC::add_uses_port + */ + virtual void add_uses_port(const char* repository_id, + const char* uses_port_name, + Ports::PortProperties_ptr port_prop) + throw (Engines::DSC::PortAlreadyDefined, + Engines::DSC::BadProperty); + + /*! + * \see Engines::DSC::get_provides_port + */ + 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); + + /*! + * \see Engines::DSC::get_uses_port + */ + virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected, + Engines::DSC::BadPortType); + + /*! + * \see Engines::DSC::connect_provides_port + * + * \note This method uses Callbacks mechanism to inform the provides + * port how much uses ports are connected with. Currently, the provides + * port doesn't know its uses ports references. It's framework or application role + * to manage connections between ports. + */ + virtual void connect_provides_port(const char* provides_port_name) + throw (Engines::DSC::PortNotDefined); + + /*! + * \see Engines::DSC::connect_uses_port + * + * \note This method uses Callbacks mechanism to inform the uses + * port how much provides ports are connected with. + */ + 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); + + /*! + * \see Engines::DSC::is_connected + */ + virtual CORBA::Boolean is_connected(const char* port_name) + throw (Engines::DSC::PortNotDefined); + + /*! + * \see Engines::DSC::disconnect_provides_port + * + * \note This method uses Callbacks mechanism to inform the provides + * port how much uses ports are connected with. Currently, the provides + * port doesn't know its uses ports references. It's framework or application role + * to manage connections between ports. + */ + virtual void disconnect_provides_port(const char* provides_port_name, + const Engines::DSC::Message message) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected); + + /*! + * \see Engines::DSC::disconnect_uses_port + * + * + * \note This method uses Callbacks mechanism to inform the uses + * port how much provides ports are connected with. + * + * \warning The new sequence of the uses port is sended by the callback. + * The old sequence is not destoyed. Is uses port user's role to destroy + * the sequence. + */ + 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); + + /*! + * \see Engines::DSC::get_port_properties + */ + virtual Ports::PortProperties_ptr get_port_properties(const char* port_name) + throw (Engines::DSC::PortNotDefined); + +protected: + + /*-------------------------------------------------*/ + /* Definition des types pour le stockage des ports */ + + enum port_type {uses, provides, none}; + + struct port_t { + port_type type; + int connection_nbr; + + // Specifique aux uses port + Engines::DSC::uses_port uses_port_refs; + std::string repository_id; + + // Specifique aux provides port; + Ports::Port_var provides_port_ref; + + Ports::PortProperties_var port_prop; + }; + + typedef std::map ports; + + /*-------------------------------------------------*/ + /*-------------------------------------------------*/ + + ports my_ports; + ports::iterator my_ports_it; +}; + +#endif diff --git a/src/DSC/DSC_Basic/Makefile.am b/src/DSC/DSC_Basic/Makefile.am new file mode 100644 index 000000000..07946f3c1 --- /dev/null +++ b/src/DSC/DSC_Basic/Makefile.am @@ -0,0 +1,92 @@ +# 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) +# Module : KERNEL + +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + +# +# =============================================================== +# Header to be installed +# =============================================================== +# +# header files +salomeinclude_HEADERS = ConnectionManager_i.hxx \ + DSC_Callbacks.hxx \ + DSC_i.hxx \ + DSC_interface.hxx \ + PortProperties_i.hxx \ + DSC_Basic.hxx +# +# =============================================================== +# Local definitions +# =============================================================== +# + +# This local variable defines the list of CPPFLAGS common to all target in this package. +COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \ + -I$(top_srcdir)/src/Notification \ + -I$(top_srcdir)/src/SALOMELocalTrace \ + -I$(top_srcdir)/src/Basics \ + -I$(top_srcdir)/src/NamingService \ + -I$(top_srcdir)/src/Utils \ + -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 = $(top_builddir)/src/Container/libSalomeContainer.la \ + @CORBA_LIBS@ + +# +# =============================================================== +# Libraries targets +# =============================================================== +# +lib_LTLIBRARIES = libSalomeDSCContainer.la + +libSalomeDSCContainer_la_SOURCES = DSC_i.cxx \ + DSC_interface.cxx \ + PortProperties_i.cxx + +libSalomeDSCContainer_la_CXXFLAGS = $(COMMON_CPPFLAGS) + +libSalomeDSCContainer_la_LIBADD = $(COMMON_LIBS) + +libSalomeDSCContainer_la_LDFLAGS = -no-undefined -version-info=0:0:0 + +# +# =============================================================== +# Executables targets +# =============================================================== +# +bin_PROGRAMS = SALOME_ConnectionManagerServer + +SALOME_ConnectionManagerServer_SOURCES = SALOME_ConnectionManagerServer.cxx \ + ConnectionManager_i.cxx + +SALOME_ConnectionManagerServer_CXXFLAGS = $(COMMON_CPPFLAGS) + +SALOME_ConnectionManagerServer_LDADD = $(top_builddir)/idl/libSalomeIDLKernel.la \ + $(top_builddir)/src/NamingService/libSalomeNS.la \ + $(top_builddir)/src/SALOMELocalTrace/libSALOMELocalTrace.la diff --git a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx b/src/DSC/DSC_Basic/PortProperties_i.cxx similarity index 60% rename from src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx rename to src/DSC/DSC_Basic/PortProperties_i.cxx index 91665a49e..a4a0947a7 100644 --- a/src/SALOMEDS/SALOMEDS_LocalIDAttribute.jxx +++ b/src/DSC/DSC_Basic/PortProperties_i.cxx @@ -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 @@ -21,23 +19,29 @@ // // // -// File : SALOMEDS_LocalIDAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ +// File : PortProperties_i.cxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#include "PortProperties_i.hxx" + +PortProperties_i::PortProperties_i() {} + +PortProperties_i::~PortProperties_i() {} + +void +PortProperties_i::set_property(const char * name, const CORBA::Any& value) + throw (Ports::NotDefined, Ports::BadType) +{ + // Default case, the object has no properties. + throw Ports::NotDefined(); +} + +CORBA::Any* +PortProperties_i::get_property(const char* name) + throw (Ports::NotDefined) +{ + // Default case, the object has no properties. + throw Ports::NotDefined(); +} -#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/DSC/DSC_Basic/PortProperties_i.hxx b/src/DSC/DSC_Basic/PortProperties_i.hxx new file mode 100644 index 000000000..90d2132ce --- /dev/null +++ b/src/DSC/DSC_Basic/PortProperties_i.hxx @@ -0,0 +1,60 @@ +// 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 : PortProperties_i.hxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#ifndef _PORTPROPERTIES_I_HXX_ +#define _PORTPROPERTIES_I_HXX_ + +#include + +#include +#include CORBA_SERVER_HEADER(SALOME_Ports) + +/*! \class PortProperties_i + * \brief This class implements the interface Ports::PortProperties. + */ +class DSC_BASIC_EXPORT PortProperties_i: + public virtual POA_Ports::PortProperties +{ + public: + PortProperties_i(); + virtual ~PortProperties_i(); + + /*! + * CORBA method : set a value to a property + * \see Ports::PortProperties::set_property + */ + virtual void set_property(const char * name, + const CORBA::Any& value) + throw (Ports::NotDefined, Ports::BadType); + + /*! + * CORBA method : get the value of a property + * \see Ports::PortProperties::get_property + */ + virtual CORBA::Any* get_property(const char* name) + throw (Ports::NotDefined); +}; + +#endif diff --git a/src/DSC/DSC_Basic/SALOME_ConnectionManagerServer.cxx b/src/DSC/DSC_Basic/SALOME_ConnectionManagerServer.cxx new file mode 100644 index 000000000..ba33a7b96 --- /dev/null +++ b/src/DSC/DSC_Basic/SALOME_ConnectionManagerServer.cxx @@ -0,0 +1,67 @@ +// 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 : SALOME_ConnectionManagerServer.cxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#include "ConnectionManager_i.hxx" +#include "utilities.h" +#include + +using namespace std; + +int main(int argc, char* argv[]) +{ + PortableServer::POA_var root_poa; + PortableServer::POAManager_var pman; + CORBA::Object_var obj; + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + 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(); + + // We create a ConnectionManager. + // It is automatically added to the RootPOA into its constructor. + new ConnectionManager_i(orb); + + pman->activate(); + orb->run(); + orb->destroy(); + }catch(CORBA::SystemException&){ + MESSAGE("Caught CORBA::SystemException."); + }catch(PortableServer::POA::WrongPolicy&){ + MESSAGE("Caught CORBA::WrongPolicyException."); + }catch(PortableServer::POA::ServantAlreadyActive&){ + MESSAGE("Caught CORBA::ServantAlreadyActiveException"); + }catch(CORBA::Exception&){ + MESSAGE("Caught CORBA::Exception."); + }catch(std::exception& exc){ + MESSAGE("Caught std::exception - "< +#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. + + PyObject* (*handleCxxSystemException)(const CORBA::SystemException& ex); + // Sets the Python exception state to reflect the given C++ system + // exception. Always returns NULL. The caller must hold the Python + // interpreter lock. +}; + + 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 + + + +/* + * 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. + */ + +%{ + +#ifdef WITH_NUMPY +/* With Numpy */ +#include + +typedef PyArrayObject ArrayObject; + +/* 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"; +} + +/* +For documentation only : numpy typecodes + +enum NPY_TYPECHAR { NPY_BOOLLTR = '?', + NPY_BYTELTR = 'b', + NPY_UBYTELTR = 'B', + NPY_SHORTLTR = 'h', + NPY_USHORTLTR = 'H', + NPY_INTLTR = 'i', + NPY_UINTLTR = 'I', + NPY_LONGLTR = 'l', + NPY_ULONGLTR = 'L', + NPY_LONGLONGLTR = 'q', + NPY_ULONGLONGLTR = 'Q', + NPY_FLOATLTR = 'f', + NPY_DOUBLELTR = 'd', + NPY_LONGDOUBLELTR = 'g', + NPY_CFLOATLTR = 'F', + NPY_CDOUBLELTR = 'D', + NPY_CLONGDOUBLELTR = 'G', + NPY_OBJECTLTR = 'O', + NPY_STRINGLTR = 'S', + NPY_STRINGLTR2 = 'a', + NPY_UNICODELTR = 'U', + NPY_VOIDLTR = 'V', + NPY_CHARLTR = 'c', + + NPY_INTPLTR = 'p', + NPY_UINTPLTR = 'P', + + NPY_GENBOOLLTR ='b', + NPY_SIGNEDLTR = 'i', + NPY_UNSIGNEDLTR = 'u', + NPY_FLOATINGLTR = 'f', + NPY_COMPLEXLTR = 'c' +}; +*/ + +/* Given a Numeric typecode, return a string describing the type. + */ +char* typecode_string(int typecode) { + char* type_names[] = {"bool","byte","unsigned byte","short", + "unsigned short","int","unsigned int","long","unsigned long", + "longlong","unsigned longlong", + "float","double","long double","complex float","complex double","complex long double", + "object","string","unicode","void","ntypes","notype","char","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; +} + +#else +/* Without Numpy */ +typedef PyObject ArrayObject; + +#endif +%} + +%include "carrays.i" + +%array_class(int, intArray); +%array_class(float, floatArray); +%array_class(double, doubleArray); + +/* special struct to handle string arrays */ +%inline %{ +struct stringArray +{ + stringArray(int nelements,int size=0) { + nelem=nelements; + data= new char*[nelements]; + for(int i=0;idata; +%#else + SWIG_exception(SWIG_TypeError, "type* expected"); +%#endif + } +} +%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 *eval}; +%apply float* IN_ARRAY3 {float *eval}; +%apply double* IN_ARRAY3 {double *eval}; + +/* Specific typemap for complex */ +%typemap(in) float* ecpval + (ArrayObject* array=NULL, int is_new_object) { + int size[1] = {-1}; + if ((SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,0)) == -1) + { +%#ifdef WITH_NUMPY + array = obj_to_array_contiguous_allow_conversion($input, PyArray_CFLOAT, &is_new_object); + if (!array || !require_dimensions(array,1) || !require_size(array,size,1)) SWIG_fail; + $1 = (float*) array->data; +%#else + SWIG_exception(SWIG_TypeError, "complex array expected"); +%#endif + } +} +%typemap(freearg) float* ecpval { + if (is_new_object$argnum && array$argnum) Py_DECREF(array$argnum); +} +/* End of Specific typemap for complex */ + +/* array of strings on input */ +%typemap(in) char** eval + (ArrayObject* array=NULL, int is_new_object) { + int size[1] = {-1}; + stringArray* sarray; + if ((SWIG_ConvertPtr($input, (void **) &sarray, $descriptor(stringArray *),0)) == -1) + { +%#ifdef WITH_NUMPY + array = obj_to_array_contiguous_allow_conversion($input, PyArray_STRING, &is_new_object); + if (!array || !require_dimensions(array,1) || !require_size(array,size,1)) SWIG_fail; + $1 = (char**) malloc(array_size(array,0)*sizeof(char*)); + for(int i=0;idata + i* array->strides[0]; +%#else + SWIG_exception(SWIG_TypeError, "string array expected"); +%#endif + } + else + { + $1=sarray->data; + } +} + +%typemap(freearg) char** eval { + if (array$argnum) free($1); + if (is_new_object$argnum && array$argnum) Py_DECREF(array$argnum); +} +/* End of array of strings on input */ + +/* inplace typemaps + This typemap can be used for input/output array objects. + It accepts swig carray objects or numpy contiguous objects. +*/ + +%define TYPEMAP_INPLACE3(type,typecode) +%typemap(in) type* INPLACE_ARRAY3 (ArrayObject* temp=NULL) { + if ((SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,0)) == -1) + { +%#ifdef WITH_NUMPY + temp = obj_to_array_no_conversion($input,typecode); + if (!temp || !require_contiguous(temp)) SWIG_fail; + $1 = (type*) temp->data; +%#else + SWIG_exception(SWIG_TypeError, "type* expected"); +%#endif + } +} +%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}; + +/* typemap for complex inout */ +%typemap(in) float* lcpval + (ArrayObject* temp=NULL) { + if ((SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,0)) == -1) + { +%#ifdef WITH_NUMPY + temp = obj_to_array_no_conversion($input,PyArray_CFLOAT); + if (!temp || !require_contiguous(temp)) SWIG_fail; + $1 = (float*) temp->data; +%#else + SWIG_exception(SWIG_TypeError, "complex array expected"); +%#endif + } +} +/* End of typemap for complex inout */ + +/* typemap for array of strings on input/output */ +%typemap(in) char** lval + (ArrayObject* temp=NULL) { + stringArray* sarray; + if ((SWIG_ConvertPtr($input, (void **) &sarray, $descriptor(stringArray *) ,0)) == -1) + { +%#ifdef WITH_NUMPY + temp = obj_to_array_no_conversion($input,PyArray_STRING); + if (!temp || !require_contiguous(temp)) SWIG_fail; + $1 = (char**) malloc(array_size(temp,0)*sizeof(char*)); + for(int i=0;idata+i*temp->strides[0]; +%#else + SWIG_exception(SWIG_TypeError, "string array expected"); +%#endif + } + else + { + $1=sarray->data; + } +} +%typemap(freearg) char** lval { + if (temp$argnum) free($1); +} +/* End of typemap for array of strings on input/output */ + +%typemap(in) CORBA::Boolean +{ + $1=(CORBA::Boolean)PyInt_AsLong($input); +} + +%define CORBAPTR(type) +%typemap(in) type##_ptr +{ + Py_BEGIN_ALLOW_THREADS + try + { + CORBA::Object_var obj = api->pyObjRefToCxxObjRef($input,0); + $1 = type##::_narrow(obj); + } + catch(...) + { + Py_BLOCK_THREADS + PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr"); + } + Py_END_ALLOW_THREADS +} +%typemap(freearg) type##_ptr { + CORBA::release($1); +} +%enddef + +CORBAPTR(CORBA::ORB) +CORBAPTR(Ports::PortProperties) +CORBAPTR(Ports::Port) +CORBAPTR(Engines::Container) +CORBAPTR(PortableServer::POA) + +%typemap(out) Ports::Port_ptr +{ + $result = api->cxxObjRefToPyObjRef($1, 1); + //All output Ports::Port_ptr variables are duplicated by security. Need to release them for python . Explanation ?? + CORBA::release($1); +} + +%typemap(out) Ports::PortProperties_ptr, Engines::Salome_file_ptr +{ + $result = api->cxxObjRefToPyObjRef($1, 1); +} + +%typemap(out) Engines::DSC::uses_port * +{ + $result = PyList_New($1->length()); + for (CORBA::ULong i=0; i < $1->length() ; i++) + PyList_SetItem($result,i,api->cxxObjRefToPyObjRef((*$1)[i], 1)); + //delete the copy (created by new) of uses port sequence + delete $1; +} + +/* + * Exception section + */ +// a general exception handler +%exception { + Py_BEGIN_ALLOW_THREADS + try { + $action + } + catch(Engines::DSC::PortNotDefined& _e) { + Py_BLOCK_THREADS + PyErr_SetString(PyExc_ValueError,"Port not defined"); + return NULL; + } + catch(Engines::DSC::PortNotConnected& _e) { + Py_BLOCK_THREADS + PyErr_SetString(PyExc_ValueError,"Port not connected"); + return NULL; + } + catch(Engines::DSC::BadPortType& _e) { + Py_BLOCK_THREADS + PyErr_SetString(PyExc_ValueError,"Bad port type"); + return NULL; + } + catch (SALOME_Exception &e) { + Py_BLOCK_THREADS + PyErr_SetString(PyExc_RuntimeError,e.what()); + return NULL; + } + catch (SALOME::SALOME_Exception &e) { + Py_BLOCK_THREADS + PyErr_SetString(PyExc_RuntimeError,e.details.text); + return NULL; + } + catch (const CORBA::SystemException& e) { + Py_BLOCK_THREADS + return api->handleCxxSystemException(e); + } + catch(...) { + Py_BLOCK_THREADS + PyErr_SetString(PyExc_ValueError,"Unknown exception"); + return NULL; + } + Py_END_ALLOW_THREADS +} + +/* + * 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); + +// Interface for Salome_file + Engines::Salome_file_ptr getInputFileToService(const char* service_name, const char* Salome_file_name); + void checkInputFilesToService(const char* service_name); + Engines::Salome_file_ptr setInputFileToService(const char* service_name, const char* Salome_file_name); + Engines::Salome_file_ptr getOutputFileToService(const char* service_name, const char* Salome_file_name); + void checkOutputFilesToService(const char* service_name); + Engines::Salome_file_ptr setOutputFileToService(const char* service_name, const char* Salome_file_name); +// End of Interface for Salome_file + +// DSC interface for python components + virtual void add_provides_port(Ports::Port_ptr ref, const char* provides_port_name, Ports::PortProperties_ptr port_prop); + virtual void add_uses_port(const char* repository_id, const char* uses_port_name, Ports::PortProperties_ptr port_prop); + virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name); +// End of DSC interface for python components + + + + %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); + +%ignore CPMESSAGE; +%include "calciumP.h" + +int cp_cd(Superv_Component_i *component,char *name); + +int cp_een(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,int *eval); +int cp_edb(Superv_Component_i *component,int dep,double t,int n,char *nom,int nval,double *eval); +int cp_ere(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,float *eval); +int cp_ecp(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,float *ecpval); +int cp_elo(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,int *eval); +int cp_ech(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,char** eval,int strSize); + + +int cp_len(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval); +int cp_ldb(Superv_Component_i *component,int dep,double *ti,double *tf,int *niter,char *nom,int nmax,int *nval,double *lval); +int cp_lre(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval); +int cp_lcp(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lcpval); +int cp_llo(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval); +int cp_lch(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,char** lval,int strSize); + +int cp_fin(Superv_Component_i *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..48836d661 --- /dev/null +++ b/src/DSC/DSC_Python/dsccalcium.py @@ -0,0 +1,71 @@ +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) + + def setInputFileToService(self,service_name,Salome_file_name): + return self.proxy.setInputFileToService(service_name,Salome_file_name) + + def checkInputFilesToService(self,service_name): + return self.proxy.checkInputFilesToService(service_name) + + def getInputFileToService(self,service_name,Salome_file_name): + return self.proxy.getInputFileToService(service_name,Salome_file_name) + + def setOutputFileToService(self,service_name,Salome_file_name): + return self.proxy.setOutputFileToService(service_name,Salome_file_name) + + def getOutputFileToService(self,service_name,Salome_file_name): + return self.proxy.getOutputFileToService(service_name,Salome_file_name) + + def checkOutputFilesToService(self,service_name): + return self.proxy.checkOutputFilesToService(service_name) + diff --git a/src/DSC/DSC_User/Basic/Makefile.am b/src/DSC/DSC_User/Basic/Makefile.am new file mode 100644 index 000000000..e1128c174 --- /dev/null +++ b/src/DSC/DSC_User/Basic/Makefile.am @@ -0,0 +1,69 @@ +# 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) +# Module : KERNEL + +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + +# +# =============================================================== +# Header to be installed +# =============================================================== +# +# header files +salomeinclude_HEADERS = basic_port_factory.hxx \ + data_short_port_provides.hxx \ + data_short_port_uses.hxx + +# +# =============================================================== +# Local definitions +# =============================================================== +# + +# This local variable defines the list of CPPFLAGS common to all target in this package. +COMMON_CPPFLAGS= -I$(top_builddir)/idl \ + -I$(top_srcdir)/src/DSC/DSC_Basic \ + -I$(top_srcdir)/src/DSC/DSC_User \ + -I$(top_builddir)/salome_adm/unix \ + @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ + +# This local variable defines the list of dependant libraries common to all target in this package. +COMMON_LIBS = + +# +# =============================================================== +# Libraries targets +# =============================================================== +# + +lib_LTLIBRARIES = libSalomeDSCSupervBasic.la + +libSalomeDSCSupervBasic_la_SOURCES = basic_port_factory.cxx \ + data_short_port_uses.cxx \ + data_short_port_provides.cxx + +libSalomeDSCSupervBasic_la_CXXFLAGS = $(COMMON_CPPFLAGS) + +libSalomeDSCSupervBasic_la_LDFLAGS = -no-undefined -version-info=0:0:0 + diff --git a/src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx b/src/DSC/DSC_User/Basic/basic_port_factory.cxx similarity index 56% rename from src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx rename to src/DSC/DSC_User/Basic/basic_port_factory.cxx index c7c9b6bf0..4d7d4a75d 100644 --- a/src/SALOMEDS/SALOMEDS_DrawableAttribute.jxx +++ b/src/DSC/DSC_User/Basic/basic_port_factory.cxx @@ -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 @@ -21,23 +19,29 @@ // // // -// File : SALOMEDS_DrawableAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ +// File : basic_port_factory.cxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#include "basic_port_factory.hxx" + +basic_port_factory::basic_port_factory() {} + +basic_port_factory::~basic_port_factory() {} + +provides_port * +basic_port_factory::create_data_servant(string type) { + provides_port * rtn_port = NULL; + if (type == "short") { + rtn_port = new data_short_port_provides(); + } + return rtn_port; +} -#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 +uses_port * +basic_port_factory::create_data_proxy(string type) { + uses_port * rtn_port = NULL; + if (type == "short") + rtn_port = new data_short_port_uses(); + return rtn_port; +} diff --git a/src/DSC/DSC_User/Basic/basic_port_factory.hxx b/src/DSC/DSC_User/Basic/basic_port_factory.hxx new file mode 100644 index 000000000..8407c217b --- /dev/null +++ b/src/DSC/DSC_User/Basic/basic_port_factory.hxx @@ -0,0 +1,67 @@ +// 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 : basic_port_factory.hxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#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" + +using namespace std; + +/*! \class basic_port_factory + * \brief This class is an example of factory for DSC_User ports. + * + * This class implements the methods to be able + * to be used by Superv_Component_i. + * It builds basic ports. + */ +class basic_port_factory : + public port_factory +{ + public: + basic_port_factory(); + virtual ~basic_port_factory(); + + /*! + * This method creates a provides port of Basic ports. + * + * \param type the basic port's type. + * \return a pointer of the provides port. + */ + virtual provides_port * create_data_servant(string type); + + /*! + * This method creates a uses port of Basic ports. + * + * \param type the basic port's type. + * \return a pointer of the uses port. + */ + virtual uses_port * create_data_proxy(string type); +}; + +#endif + diff --git a/src/DSC/DSC_User/Basic/data_short_port_provides.cxx b/src/DSC/DSC_User/Basic/data_short_port_provides.cxx new file mode 100644 index 000000000..5b204d41f --- /dev/null +++ b/src/DSC/DSC_User/Basic/data_short_port_provides.cxx @@ -0,0 +1,94 @@ +// 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 : data_short_port_provides.cxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#include "data_short_port_provides.hxx" + +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() { + 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() { + 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 +data_short_port_provides::get_port_ref() { + return this->_this(); +} diff --git a/src/DSC/DSC_User/Basic/data_short_port_provides.hxx b/src/DSC/DSC_User/Basic/data_short_port_provides.hxx new file mode 100644 index 000000000..51ae3afd9 --- /dev/null +++ b/src/DSC/DSC_User/Basic/data_short_port_provides.hxx @@ -0,0 +1,80 @@ +// 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 : data_short_port_provides.hxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#ifndef _DATA_SHORT_PORT_PROVIDES_HXX_ +#define _DATA_SHORT_PORT_PROVIDES_HXX_ + +#include + +#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 + * the basic port policy. + */ +class data_short_port_provides : + public virtual POA_Ports::Data_Short_Port, + public virtual provides_port +{ + public : + data_short_port_provides(); + virtual ~data_short_port_provides(); + + /*! + * This method implements the CORBA method of the interface. + * \see Ports::Data_Short_Port::put + */ + virtual void put(CORBA::Short data); + + /*! + * This method is used by the component to get + * the last value received. + * + * \return the last value received (default 0). + */ + virtual CORBA::Short get(); + + /*! + * This method gives the port CORBA reference. + * + * \return port's CORBA reference. + */ + virtual Ports::Port_ptr get_port_ref(); + + 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 new file mode 100644 index 000000000..e67b38dff --- /dev/null +++ b/src/DSC/DSC_User/Basic/data_short_port_uses.cxx @@ -0,0 +1,66 @@ +// 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 : data_short_port_uses.cxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#include "data_short_port_uses.hxx" +#include +using namespace std; + +data_short_port_uses::data_short_port_uses() { + _my_ports = NULL; +} + +data_short_port_uses::~data_short_port_uses() {} + +const char * +data_short_port_uses::get_repository_id() { + return "IDL:Ports/Data_Short_Port:1.0"; +} + +void +data_short_port_uses::put(CORBA::Short data) { +// if (!CORBA::is_nil(_my_port)) +// _my_port->put(data); + if (!_my_ports) + cerr << "data_short_port_uses::put is NULL" << endl; + else + { + for(int i = 0; i < _my_ports->length(); i++) + { + Ports::Data_Short_Port_ptr port = Ports::Data_Short_Port::_narrow((*_my_ports)[i]); + port->put(data); + } + } +} + +void +data_short_port_uses::uses_port_changed(Engines::DSC::uses_port * new_uses_port, + const Engines::DSC::Message message) +{ + if (_my_ports) + delete _my_ports; + + cerr << "data_short_port_uses::uses_port_changed" << endl; + _my_ports = new Engines::DSC::uses_port(*new_uses_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 new file mode 100644 index 000000000..abe8f8e7c --- /dev/null +++ b/src/DSC/DSC_User/Basic/data_short_port_uses.hxx @@ -0,0 +1,74 @@ +// 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 : data_short_port_uses.hxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#ifndef _DATA_SHORT_PORT_USES_HXX_ +#define _DATA_SHORT_PORT_USES_HXX_ + +#include "uses_port.hxx" +#include "SALOME_Ports.hh" + +/*! \class data_short_port_uses + * \brief This class a port that sends a CORBA short with + * the basic port policy. + */ +class data_short_port_uses : + public virtual uses_port +{ + public : + data_short_port_uses(); + virtual ~data_short_port_uses(); + + /*! + * This method is used by the component to get + * port's CORBA repository id + * + * \return port's CORBA repository id + */ + virtual const char * get_repository_id(); + + /*! + * This method is used by the component to send + * a short value to all the provides ports connected. + * + * \param data the short sended. + */ + virtual void put(CORBA::Short data); + + /*! + * This method is a callback for be aware of modification + * of the port's connections. + * + * \param new_uses_port the new uses port's sequence. + * \param message message associated to the modification. + */ + virtual void uses_port_changed(Engines::DSC::uses_port * new_uses_port, + const Engines::DSC::Message message); + + private : + Engines::DSC::uses_port * _my_ports; +}; + +#endif + diff --git a/src/DSC/DSC_User/DSC_Exception.hxx b/src/DSC/DSC_User/DSC_Exception.hxx new file mode 100644 index 000000000..46bd5ab03 --- /dev/null +++ b/src/DSC/DSC_User/DSC_Exception.hxx @@ -0,0 +1,180 @@ +// 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 : DSC_Exception.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL + +#ifndef DSC_EXCEPTION_HXX +#define DSC_EXCEPTION_HXX + +#include "Utils_SALOME_Exception.hxx" +#include +#include +#include +#include + +#include "utilities.h" + +#ifndef WNT +extern "C" +{ +#endif +#include +#ifndef WNT +} +#endif + + +#ifdef _DEBUG_ +# ifdef __GNUC__ +# define LOC(message) (message), __FILE__ , __LINE__ , __FUNCTION__ +# else +# define LOC(message) (message), __FILE__, __LINE__ +# endif +#else +# define LOC(message) (message) +#endif + + +#ifndef SWIG +/** + * Class OSS is useful when streaming data through a function + * that expect a string as parameter + */ +class OSS +{ +private: + std::ostringstream oss_; + +public: + explicit OSS() : oss_() {} + + template + OSS & operator<<(T obj) + { + oss_ << obj; + return *this; + } + + operator std::string() + { + return oss_.str(); + } + + // Surtout ne pas écrire le code suivant: + // car oss_.str() renvoie une string temporaire + // operator const char*() + // { + // return oss_.str().c_str(); + // } + +}; /* end class OSS */ +#endif + + +// Cette fonction provient de Utils_SALOME_Exception +// Solution pas très élégante mais contrainte par les manques de la classe SALOME_Exception +const char *makeText( const char *text, const char *fileName, const unsigned int lineNumber); + +struct DSC_Exception : public SALOME_Exception { + + // Attention, en cas de modification des paramètres par défaut + // il est necessaire de les repporter dans la macro DSC_EXCEPTION ci-dessous + // Le constructeur de la SALOME_Exception demande une chaine non vide + // Du coup on est obliger de la désallouer avant d'y mettre la notre + // car le what n'est pas virtuel donc il faut que le contenu de SALOME_Exception::_text + // soit utilisable. + // Ne pas mettre lineNumber=0 à cause du calcul log dans la SALOME_Exception si fileName est défini + DSC_Exception( const std::string & text, + const char *fileName="", + const unsigned int lineNumber=0, + const char *funcName="" ): + SALOME_Exception(text.c_str()) , + _dscText(text), + _filefuncName(setFileFuncName(fileName?fileName:"",funcName?funcName:"")), + _lineNumber(lineNumber), + _exceptionName("DSC_Exception") + { + // Mise en cohérence avec l'exception SALOME (à revoir) + delete [] ((char*)SALOME_Exception::_text); + if (! _filefuncName.empty() ) + SALOME_Exception::_text = makeText(text.c_str(),_filefuncName.c_str(),lineNumber) ; + else + SALOME_Exception::_text = makeText(text.c_str(),0,lineNumber) ; + + OSS oss ; + oss << _exceptionName ; + if (!_filefuncName.empty() ) oss << " in " << _filefuncName; + if (_lineNumber) oss << " [" << _lineNumber << "]"; + oss << " : " << _dscText; + _what = oss; + } + + virtual const char* what( void ) const throw () + { + return _what.c_str() ; + } + + // L'opérateur = de SALOME_Exception n'est pas défini + // problème potentiel concernant la recopie de son pointeur _text + + // Le destructeur de la SALOME_Exception devrait être virtuel + // sinon pb avec nos attributs de type pointeur. + virtual ~DSC_Exception(void) throw() {}; + + virtual const std::string & getExceptionName() const {return _exceptionName;}; + +private: + + std::string setFileFuncName(const char * fileName, const char * funcName) { + ASSERT(fileName); + ASSERT(funcName); + OSS oss; + if ( strcmp(fileName,"") ) + oss << fileName << "##" << funcName; + + return oss; + }; + + //DSC_Exception(void) {}; +protected: + std::string _dscText; + std::string _filefuncName; + std::string _exceptionName; + int _lineNumber; + std::string _what; +}; + +#define DSC_EXCEPTION(Derived) struct Derived : public DSC_Exception { \ + Derived ( const std::string & text, const char *fileName="", const unsigned int lineNumber=0, const char *funcName="" \ + ) : DSC_Exception(text,fileName,lineNumber,funcName) { \ + _exceptionName = #Derived; \ + } \ + virtual ~Derived(void) throw();\ +};\ + +//Sert à eviter le problème d'identification RTTI des exceptions +//Crée un unique typeInfo pour tous les bibliothèques composants SALOME +//dans un fichier cxx +#define DSC_EXCEPTION_CXX(NameSpace,Derived) NameSpace::Derived::~Derived(void) throw() {}; + +#endif /* DSC_EXCEPTION_HXX */ diff --git a/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx b/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx new file mode 100644 index 000000000..214ccc097 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx @@ -0,0 +1,114 @@ +// 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 : AdjacentFunctor.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-24 16:30:34 +0100 (mer, 24 jan 2007) $ +// Id : $Id$ + + +#ifndef _ADJACENT_FUNCTOR_HXX_ +#define _ADJACENT_FUNCTOR_HXX_ + +#include "ConstTraits.hxx" +// Pour affichage +#include "DisplayPair.hxx" +// + +// Suppose que le container est trié +template < typename T > struct AdjacentFunctor { + + typedef typename ConstTrait::NonConstType TNoConst; + const T & _minValue; + T _maxValue; + TNoConst _max; + TNoConst _min; + bool _minFound,_maxFound,_equal; + + AdjacentFunctor(const T& value):_minValue(value),_maxValue(value), + _minFound(false),_maxFound(false), + _equal(false) {} + + // 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 + } + + + /* + if ( v1 < _minValue) { + std::cout << "EE1: _min : " << _min << std::endl; + _min=v1;_minFound=true; + std::cout << "AdjacentFunctor: _minFound : " <<_min << ", _minValue " << _minValue << std::endl; + } else if ( v1 > _maxValue ) { + _max=v1;_maxFound=true; + std::cout << "AdjacentFunctor: _maxFound : " <<_max << ", _maxValue " << _maxValue << std::endl; + } else { + _equal= true; + std::cout << "AdjacentFunctor: _equal : " << v1<< ", _minValue " << _minValue << ", _maxValue " << _maxValue << std::endl; + return true; + } // end if + */ + + //std::cout << "AdjacentFunctor: _minFound : " <<_min << ", _maxFound " << _max << std::endl; + return ( _minFound && _maxFound ); + } + + void setMaxValue(const T & value) {_maxValue = value;} + 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; + } + void reset() { _minFound = false; _maxFound = false; _equal = false; }; +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/AdjacentPredicate.hxx b/src/DSC/DSC_User/Datastream/AdjacentPredicate.hxx new file mode 100644 index 000000000..538343e26 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/AdjacentPredicate.hxx @@ -0,0 +1,76 @@ +// 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 : AdjacentPredicate.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + +#ifndef __ADJACENT_PREDICATE__ +#define __ADJACENT_PREDICATE__ + +#include +#include +#include "DisplayPair.hxx" + +template < typename T > +struct AdjacentPredicate : public std::binary_function < T, T, bool > +{ + T _value; + AdjacentPredicate(const T& value):_value(value){} + bool operator()(const T &v1, const T& v2) const { + return (v1 <= _value ) && (_value < v2) ; + } +}; + +// Pour les MAPs avec une clef sous forme de pair +template +struct AdjacentPredicate< std::pair, T3 > > : + public std::binary_function < std::pair, T3 >, + std::pair, T3 >, bool > +{ + std::pair _value; + AdjacentPredicate(const std::pair & value):_value(value){ + std::cout << "1-Initializing with value " << _value << std::endl; + } + bool operator()( const std::pair, T3 > & v1, + const std::pair, T3 > v2) const { + std::cout << "1-> :" << v1 << "," << v2 << " " << std::endl; + return (v1.first <= _value ) && (_value < v2.first) ; + } +}; + +template +struct AdjacentPredicate< std::pair > : public std::binary_function < std::pair, std::pair, bool > +{ + T1 _value; + AdjacentPredicate(const T1 & value):_value(value){ + std::cout << "2-Initializing with value " << _value << std::endl; + } + bool operator()( const std::pair & v1, const std::pair& v2) const { + std::cout << "2-> :" << &(v1.first) << "," << &(v2.first) << " " << std::endl; + return (v1.first <= _value ) && (_value < v2.first) ; + } +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/Calcium.c b/src/DSC/DSC_User/Datastream/Calcium/Calcium.c new file mode 100644 index 000000000..cba14ca11 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/Calcium.c @@ -0,0 +1,280 @@ +/* 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 : Calcium.c */ +/* Author : Eric Fayolle (EDF) */ +/* Module : KERNEL */ +/* Id : $Id$ */ + +#include "calcium.h" +#include +#include +#include + +// Interface C de SalomeCalcium + +typedef int InfoType; +typedef char bool; + +/* INTERFACES DE LECTURE en 0 copie */ + +/* Definition des méthodes calcium étendues en 0 copie */ +/* Le buffer est alloué par le port pas par l'utilisateur */ +/* Remarquer le type ** de data */ +/* L'utilisateur devra appeler ecp_..._free pour désallouer le buffer interne */ +/* Attention en cas de lectures multiples : le buffer retourné est le même */ +/* Attention si les niveaux sont actifs le buffer peut être supprimé automatiquement par calcium. */ + +#define CALCIUM_EXT_LECT_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \ + InfoType ecp_##_name (void * component, int mode, \ + _timeType * ti, _timeType * tf, int * i, \ + char * nomvar, int bufferLength, \ + int * nRead, _type _qual ** data ) { \ + size_t _nRead; \ + long _i=*i; \ + \ + /* std::cerr << "-------- CalciumInterface(C Part) MARK 1 ------------------" << std::endl; */ \ + InfoType info = ecp_lecture_##_typeName (component, mode, ti, tf, &_i, \ + nomvar, bufferLength, &_nRead, \ + data ); \ + /* std::cout << "-------- CalciumInterface(C Part), Valeur de data : " << std::endl; */ \ + /* std::cout << "Ptr :" << *data << std::endl; */ \ + /* for (int j=0; j<_nRead;++j) */ \ + /* printf("--- Valeur de data[%d] : %d \n",j,(*data)[j]); */ \ + /* std::cout << "Ptr :" << *data << std::endl; */ \ + /* */ \ + /* std::cerr << "-------- CalciumInterface(C Part) MARK 2 ------------------" << std::endl; */ \ + if(mode == CP_SEQUENTIEL) \ + *i = _i; \ + *nRead=_nRead; \ + /* std::cerr << "-------- CalciumInterface(C Part) MARK 3 ------------------" << std::endl; */ \ + \ + return info; \ + }; \ + void ecp_##_name##_free ( _type _qual * data) { \ + ecp_lecture_##_typeName##_free(data); \ + }; + +#define STAR * +CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int,); +CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,); +CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,); +/* CALCIUM_EXT_LECT_INTERFACE_C_(llo,float,bool,bool,); */ +CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,); +/* CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]); */ + + + +/* INTERFACES DE LECTURE avec recopie */ + +#define CALCIUM_LECT_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \ + InfoType cp_##_name (void * component, int mode, \ + _timeType * ti, _timeType * tf, int * i, \ + char * nomvar, int bufferLength, \ + int * nRead, _type _qual * data ) { \ + size_t _nRead; \ + long _i=*i; \ + fflush(stdout); \ + fflush(stderr); \ + fprintf(stderr,"Beginning of cp_" #_name " : %s %d %f\n",nomvar,*i,*ti); \ + \ + if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; \ + \ + InfoType info = ecp_lecture_##_typeName (component, mode, ti, tf, &_i, \ + nomvar, bufferLength, &_nRead, \ + &data ); \ + if(mode == CP_SEQUENTIEL) \ + *i = _i; \ + *nRead=_nRead; \ + fprintf(stderr,"End of cp_" #_name " : %s %d \n",nomvar,*i); \ + fflush(stdout); \ + fflush(stderr); \ + \ + return info; \ + }; \ + void cp_##_name##_free ( _type _qual * data) { \ + ecp_lecture_##_typeName##_free(data); \ + }; + + + +InfoType cp_lch(void * component, int mode, float * ti, float * tf, int * i, + char * nomvar, int bufferLength, int * nRead, + char ** data, int strSize) { + + size_t _nRead; + long _i=*i; + fflush(stdout);fflush(stderr); + fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti); + + if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; + + InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, + nomvar, bufferLength, &_nRead, + &data);/*, strSize );*/ + if(mode == CP_SEQUENTIEL) + *i = _i; + *nRead=_nRead; + fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i); + fflush(stdout);fflush(stderr); + + return info; +}; + +InfoType cp_llo(void * component, int mode, float * ti, float * tf, int * i, + char * nomvar, int bufferLength, int * nRead, + int * data ) { + + bool *dLogique=NULL; + size_t _nRead; + long _i=*i; + int j; + fflush(stdout);fflush(stderr); + fprintf(stderr,"Beginning of cpllo: %s %d %f\n",nomvar,*i,*ti); + + if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; + + dLogique = (bool *) malloc(bufferLength * sizeof(int)); + + InfoType info = ecp_lecture_bool (component, mode, ti, tf, &_i, + nomvar, bufferLength, &_nRead, + &dLogique); + if(mode == CP_SEQUENTIEL) + *i = _i; + *nRead=_nRead; + + for ( j=0; j<_nRead; ++j) data[j] = dLogique[j]; + free(dLogique); + + fprintf(stderr,"End of cpllo: %s %d \n",nomvar,*i); + fflush(stdout);fflush(stderr); + + return info; +}; + + +/* Definition des méthodes calcium standard */ + +CALCIUM_LECT_INTERFACE_C_(len,float,int,int,); +CALCIUM_LECT_INTERFACE_C_(lre,float,float,float,); +CALCIUM_LECT_INTERFACE_C_(ldb,double,double,double,); +/* CALCIUM_LECT_INTERFACE_C_(llo,float,bool,bool,); */ +CALCIUM_LECT_INTERFACE_C_(lcp,float,float,cplx,); +#define STAR * +/* CALCIUM_LECT_INTERFACE_C_(lch,float,char,STAR); */ + + +/* INTERFACES DE DÉBUT ET DE FIN DE COUPLAGE */ + +InfoType cp_cd (void * component, char * instanceName) { + /* TODO : Trouver le nom de l'instance SALOME*/ + if (instanceName) strcpy(instanceName,"UNDEFINED"); + return CPOK; +} +InfoType cp_fin (void * component, int code) { + /* TODO : gérer avec les callbacks des ports DSC */ + + InfoType info = ecp_fin_(component,code); + + return info; +} + + +/* INTERFACES D'ECRITURE */ + +#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \ + InfoType cp_##_name (void * component, int mode, \ + _timeType t, int i, \ + char * nomvar, int nbelem, \ + _type _qual * data ) { \ + \ + /*long _i=i;*/ \ + fflush(stdout); \ + fflush(stderr); \ + fprintf(stderr,"Beginning of cp_" #_name " : %s %d %f\n",nomvar,i,t); \ + if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; \ + \ + InfoType info = ecp_ecriture_##_typeName (component, mode, &t, i, \ + nomvar, nbelem, \ + data ); \ + fprintf(stderr,"End of cp_" #_name " : %s %d \n",nomvar,i); \ + fflush(stdout); \ + fflush(stderr); \ + \ + return info; \ + }; \ + + + +InfoType cp_ech(void * component, int mode, float t, int i, + char * nomvar, int nbelem, + char ** data, int strSize) { + + /*long _i=i;*/ + fflush(stdout);fflush(stderr); + fprintf(stderr,"Beginning of cp_ech: %s %d %f\n",nomvar,i,t); + if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; + + InfoType info = ecp_ecriture_str (component, mode, &t, i, + nomvar, nbelem, + data);/*, strSize );*/ + fprintf(stderr,"End of cp_ech: %s %d \n",nomvar,i); + fflush(stdout); + fflush(stderr); + + return info; +}; + +InfoType cp_elo(void * component, int mode, float t, int i, + char * nomvar, int nbelem, + int * data ) { + + /*long _i=i;*/ + bool * dLogique = NULL; + int j=0; + fflush(stdout);fflush(stderr); + fprintf(stderr,"Beginning of cpelo: %s %d %f\n",nomvar,i,t); + if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; + + dLogique = (bool *) malloc(nbelem * sizeof(int)); + for (j=0; j +#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 if(std::string(type)=="CALCIUM_string") + { + dynamic_cast(port)->setDependencyType(depend); + } + else if(std::string(type)=="CALCIUM_logical") + { + dynamic_cast(port)->setDependencyType(depend); + } + else if(std::string(type)=="CALCIUM_complex") + { + 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.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx new file mode 100644 index 000000000..2a18b69e3 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx @@ -0,0 +1,112 @@ +// 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 : CalciumCouplingPolicy.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Id : $Id$ + +#include "CalciumCouplingPolicy.hxx" + +CalciumCouplingPolicy::CalciumCouplingPolicy():_dependencyType(CalciumTypes::UNDEFINED_DEPENDENCY), + _storageLevel(CalciumTypes::UNLIMITED_STORAGE_LEVEL), + _dateCalSchem(CalciumTypes::TI_SCHEM), + _interpolationSchem(CalciumTypes::L1_SCHEM), + _extrapolationSchem(CalciumTypes::UNDEFINED_EXTRA_SCHEM), + _alpha(0.0),_deltaT(CalciumTypes::EPSILON), + _disconnectDirective(CalciumTypes::UNDEFINED_DIRECTIVE){}; + +void CalciumCouplingPolicy::setDependencyType (CalciumTypes::DependencyType dependencyType) {_dependencyType=dependencyType;} +CalciumTypes::DependencyType CalciumCouplingPolicy::getDependencyType () const { return _dependencyType;} + +void CalciumCouplingPolicy::setStorageLevel (size_t storageLevel) { + if ( storageLevel < 1 && (storageLevel != CalciumTypes::UNLIMITED_STORAGE_LEVEL) ) + throw CalciumException(CalciumTypes::CPRENA,LOC("Un niveau < 1 n'est pas autorisé")); + _storageLevel = storageLevel; +} +size_t CalciumCouplingPolicy::getStorageLevel () const {return _storageLevel;} +void CalciumCouplingPolicy::setDateCalSchem (CalciumTypes::DateCalSchem dateCalSchem) { + if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) + throw CalciumException(CalciumTypes::CPITVR,LOC("Il est impossible de positionner un schéma temporel sur un port qui n'est pas en dépendance temporelle")); + _dateCalSchem = dateCalSchem; +} + +CalciumTypes::DateCalSchem CalciumCouplingPolicy::getDateCalSchem () const { return _dateCalSchem; } + +void CalciumCouplingPolicy::setAlpha(double alpha) { + if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) + throw CalciumException(CalciumTypes::CPITVR,LOC("Il est impossible de positionner alpha sur un port qui n'est pas en dépendance temporelle")); + + if ( 0 <= alpha <= 1 ) _alpha = alpha; + else + throw CalciumException(CalciumTypes::CPRENA,LOC("Le paramètre alpha doit être compris entre [0,1]")); +} + +double CalciumCouplingPolicy::getAlpha() const { return _alpha; } + +void CalciumCouplingPolicy::setDeltaT(double deltaT ) { + if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) + throw CalciumException(CalciumTypes::CPITVR,LOC("Le paramètre deltaT sur un port qui n'est pas en dépendance temporelle n'a pas de sens")); + if ( 0 <= deltaT <= 1 ) _deltaT = deltaT; + else + throw(CalciumException(CalciumTypes::CPRENA,LOC("Le paramètre deltaT doit être compris entre [0,1]"))); +} +double CalciumCouplingPolicy::getDeltaT() const {return _deltaT;} + +void CalciumCouplingPolicy::setInterpolationSchem (CalciumTypes::InterpolationSchem interpolationSchem) { + if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) + throw CalciumException(CalciumTypes::CPITVR,LOC("Le paramètre InterpolationSchem sur un port qui n'est pas en dépendance temporelle n'a pas de sens")); + _interpolationSchem=interpolationSchem; +} + +void CalciumCouplingPolicy::setExtrapolationSchem (CalciumTypes::ExtrapolationSchem extrapolationSchem) { + if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY ) + throw CalciumException(CalciumTypes::CPITVR,LOC("Le paramètre ExtrapolationSchem sur un port qui n'est pas en dépendance temporelle n'a pas de sens")); +_extrapolationSchem=extrapolationSchem; +} + +CalciumTypes::InterpolationSchem CalciumCouplingPolicy::getInterpolationSchem () const { return _interpolationSchem; }; +CalciumTypes::ExtrapolationSchem CalciumCouplingPolicy::getExtrapolationSchem () const { return _extrapolationSchem; }; + + +CalciumCouplingPolicy::TimeType +CalciumCouplingPolicy::getEffectiveTime(CalciumCouplingPolicy::TimeType ti, + CalciumCouplingPolicy::TimeType tf) { + if ( _dateCalSchem == CalciumTypes::TI_SCHEM ) return ti; + if ( _dateCalSchem == CalciumTypes::TF_SCHEM ) return tf; + + //CalciumTypes::ALPHA_SCHEM + return tf*_alpha + ti*(1-_alpha); +} + +void CalciumCouplingPolicy::disconnect(bool provideLastGivenValue) { + + if (provideLastGivenValue) { + std::cout << "-------- CalciumCouplingPolicy::disconnect CP_CONT ------------------" << std::endl; + _disconnectDirective = CalciumTypes::CONTINUE; + } else { + std::cout << "-------- CalciumCouplingPolicy::disconnect CP_ARRET ------------------" << std::endl; + _disconnectDirective = CalciumTypes::STOP; + } + + //Wakeup get data if any + wakeupWaiting(); +} diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx new file mode 100644 index 000000000..1fe1c0e5b --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx @@ -0,0 +1,479 @@ +// 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 : CalciumCouplingPolicy.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Id : $Id$ + +#ifndef __CALCIUM_COUPLING_POLICY__ +#define __CALCIUM_COUPLING_POLICY__ + +#include +#include + +#include "DisplayPair.hxx" +#include "CouplingPolicy.hxx" +#include "AdjacentFunctor.hxx" +#include +#include +#include +#include "CalciumTypes.hxx" +#include "CalciumException.hxx" + +class CalciumCouplingPolicy : public CouplingPolicy { + + +public: + + template class InternalDataIdContainer; + template friend class InternalDataIdContainer; + template friend class BoundedDataIdProcessor; + template friend class EraseDataIdProcessor; + template friend class DisconnectProcessor; + + typedef CalciumTypes::DependencyType DependencyType; + typedef CalciumTypes::DateCalSchem DateCalSchem; + typedef CalciumTypes::InterpolationSchem InterpolationSchem; + typedef CalciumTypes::ExtrapolationSchem ExtrapolationSchem; + typedef CalciumTypes::DisconnectDirective DisconnectDirective; + +private: + + DependencyType _dependencyType; + size_t _storageLevel; + DateCalSchem _dateCalSchem; + InterpolationSchem _interpolationSchem; + ExtrapolationSchem _extrapolationSchem; + double _alpha; + double _deltaT; + DisconnectDirective _disconnectDirective; + +public: + CalciumCouplingPolicy(); + + void setDependencyType (DependencyType dependencyType); + DependencyType getDependencyType () const; + + void setStorageLevel (size_t storageLevel); + size_t getStorageLevel () const; + + void setDateCalSchem (DateCalSchem dateCalSchem); + DateCalSchem getDateCalSchem () const; + + void setAlpha(double alpha); + double getAlpha() const ; + + void setDeltaT(double deltaT ); + double getDeltaT() const ; + + void setInterpolationSchem (InterpolationSchem interpolationSchem); + void setExtrapolationSchem (ExtrapolationSchem extrapolationSchem); + InterpolationSchem getInterpolationSchem () const ; + ExtrapolationSchem getExtrapolationSchem () const ; + + // Classe DataId rassemblant les paramètres de la méthode PORT::put + // qui identifient l'instance d'une donnée pour Calcium + // Rem : Le DataId doit pouvoir être une key dans une map stl + typedef double TimeType; + typedef long TagType; + typedef std::pair< TimeType , TagType > DataId; + typedef InternalDataIdContainer < TimeType , TagType > DataIdContainer; + typedef std::vector< DataId >::iterator iterator; + + template + struct InternalDataIdContainer; + + inline TimeType getTime(const DataId &dataId) const { return dataId.first;} + inline TagType getTag (const DataId &dataId) const { return dataId.second;} + + template struct BoundedDataIdProcessor; + //template struct BoundedDataIdProcessor; + template struct EraseDataIdProcessor; + template struct DisconnectProcessor; + + // Renvoie isEqual si le dataId attendu est trouvé dans storedDataIds : + // - l'itérateur wDataIt1 pointe alors sur ce dataId + // Renvoie isBounded si le dataId attendu n'est pas trouvé mais encadrable et + // que la politique de couplage gére ce cas de figure + // - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first + // Le container doit être associatif + template < typename AssocContainer > + bool isDataIdConveniant( AssocContainer & storedDatas, + const typename AssocContainer::key_type & expectedDataId, + bool & isEqual, bool & isBounded, + typename AssocContainer::iterator & wDataIt1) const; + + TimeType getEffectiveTime(TimeType ti, TimeType tf); + + void disconnect(bool provideLastGivenValue); + +}; //Fin de CalciumCouplingPolicy + + + +//************* DEFINITION DES METHODES ET OBJETS TEMPLATES *************// + + + +// Définition du container de DataId pour répondre au concept +// de mode de couplage +template +struct CalciumCouplingPolicy::InternalDataIdContainer : public std::vector< std::pair< T_TIME,T_TAG> > { + typedef std::vector < DataId > DataIdVect; + + InternalDataIdContainer(const DataId & dataId, + const CalciumCouplingPolicy & policy + ):std::vector< std::pair< T_TIME,T_TAG> >() { + // Ignore les paramètres qui ne sont pas en rapport avec le type de dépendance + switch (policy._dependencyType) { + case CalciumTypes::TIME_DEPENDENCY: + this->push_back(DataId(dataId.first,0)); + break; + case CalciumTypes::ITERATION_DEPENDENCY: + this->push_back(DataId(0,dataId.second)); + break; + default: + throw(CalciumException(CalciumTypes::CPIT,LOC("The dependency type must be set by setDependencyType before calling DataIdContainer contructor"))); + break; + } + }; +}; + + +template +struct CalciumCouplingPolicy::BoundedDataIdProcessor{ + BoundedDataIdProcessor(const CouplingPolicy & couplingPolicy) {}; + template < typename Iterator, typename DataId > + void inline apply(typename iterator_t::value_type & data, + const DataId & dataId, + const Iterator & it1) const { + typedef typename iterator_t::value_type value_type; + std::cout << "-------- Calcium Generic BoundedDataIdProcessor.apply() called " << std::endl; + + } +}; + + +template +struct CalciumCouplingPolicy::BoundedDataIdProcessor< + DataManipulator, + typename boost::enable_if< boost::is_float< typename DataManipulator::InnerType> >::type > { + + const CalciumCouplingPolicy & _couplingPolicy; + + BoundedDataIdProcessor(const CalciumCouplingPolicy &couplingPolicy): + _couplingPolicy(couplingPolicy) {}; + + // Méthode implémentant l'interpolation temporelle + template < typename MapIterator > + void inline apply (typename iterator_t::value_type & data, + const DataId & dataId, const MapIterator & it1) const { + + typedef typename iterator_t::value_type value_type; + typedef typename DataManipulator::InnerType InnerType; + typedef typename DataManipulator::Type Type; + + 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); + + if ( timeDiff == 0.0 || _couplingPolicy._interpolationSchem == CalciumTypes::L0_SCHEM ) { + std::copy(InIt1,InIt1+dataSize,OutIt); + } else { + + boost::lambda::placeholder1_type _1; + boost::lambda::placeholder2_type _2; + // OLD: REM : Pour des buffers de type int + // OLD: le compilo indiquera warning: converting to `long int' from `Double' + std::transform(InIt1,InIt1+dataSize,InIt2,OutIt, + ( _1 - _2 ) * coeff + _2 ); +// for(size_t i =0; i < dataSize3; ++i) { +// OutIt[i]=(InIt1[i] - InIt2[i]) * coeff + InIt2[i]; +// } + + } +#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; + + } +}; + +// Renvoie isEqual si le dataId attendu est trouvé dans storedDataIds : +// - l'itérateur wDataIt1 pointe alors sur ce dataId +// Renvoie isBounded si le dataId attendu n'est pas trouvé mais encadrable et +// que la politique de couplage gére ce cas de figure +// - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first +// Le container doit être associatif +template < typename AssocContainer > +bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, const typename AssocContainer::key_type & expectedDataId, + bool & isEqual, bool & isBounded, typename AssocContainer::iterator & wDataIt1) const { + + // Rem : le type key_type == DataId + typedef typename AssocContainer::key_type key_type; + 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; + + // Rem 1 : + // L'algo adjacent_find ne peut être utilisé avec l'AdjacentPredicate + // - si la table contient un seul élément l'algorithme adjacent_find retourne end() + // que se soit l'élément attendu ou non + // - si la table contient deux éléments dont le dernier est celui recherché + // l'algorithme adjacent_find retourne end() aussi + // d'ou la necessité d'effectuer un find avant ou d'écrire un algorithme ad hoc + + // Rem 2 : + // + // L'algo find_if ne peut être utilisé car il recopie l'AdjacentFunctor + // qui ne peut alors pas mémoriser ses états précédents + // + + // Un codage en reverse serait plus efficace + typename AssocContainer::iterator prev = storedDatas.begin(); + 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++; + } + + isEqual = af.isEqual(); + + // On considère qu'il n'est pas possible d'encadrer en dépendance itérative, + // on se veut pas calculer d'interpolation. + if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY) isBounded = af.isBounded(); + + if ( isEqual ) wDataIt1 = current; + else + if (isBounded) wDataIt1 = prev; + else + wDataIt1 = storedDatas.end(); + +#ifdef _DEBUG_ + std::cout << "-------- isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl; +#endif + + return isEqual || isBounded; +} + +// TODO :PAS ENCORE TESTE AVEC UN NIVEAU POSITIONNE +// Supprime les DataId et les données associées +// du container associatif quand le nombre +// de données stockées dépasse le niveau CALCIUM. +// Cette méthode est appelée de GenericPort::get et GenericPort::next +// TODO : Elle devrait également être appelée dans GenericPort::Put +// mais il faut étudier les interactions avec GenericPort::Get et GenericPort::next +template < typename DataManipulator > +struct CalciumCouplingPolicy::EraseDataIdProcessor { + + CalciumCouplingPolicy &_couplingPolicy; + + EraseDataIdProcessor(CalciumCouplingPolicy &couplingPolicy): + _couplingPolicy(couplingPolicy) {}; + + template < typename Container > + void apply(Container & storedDatas, + typename Container::iterator & wDataIt1 ) const { + + typedef typename Container::key_type key_type; + 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; + + size_t storedDatasSize = storedDatas.size(); + long s = storedDatasSize - _couplingPolicy._storageLevel; + if (s > 0 ) { + size_t dist=distance(storedDatas.begin(),wDataIt1); + for (int i=0; i +struct CalciumCouplingPolicy::DisconnectProcessor { + + const CalciumCouplingPolicy & _couplingPolicy; + + DisconnectProcessor(const CalciumCouplingPolicy & couplingPolicy): + _couplingPolicy(couplingPolicy) {}; + + template < typename Container, typename DataId > + bool apply(Container & storedDatas, + const DataId & expectedDataId, + typename Container::iterator & wDataIt1 ) const { + + typedef typename Container::key_type key_type; + typedef typename Container::value_type value_type; + typedef typename Container::iterator iterator; + + // Pas de traitement particulier a effectuer +#ifdef _DEBUG_ + std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK1 ("<< _couplingPolicy._disconnectDirective<<") --------" << std::endl; +#endif + if ( (_couplingPolicy._disconnectDirective) == (CalciumTypes::UNDEFINED_DIRECTIVE) ) return false; + +#ifdef _DEBUG_ + std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK2 --------" << std::endl; +#endif + + // TODO : Ds GenericPort::next il faut convertir en CPSTOPSEQ + if ( _couplingPolicy._disconnectDirective == CalciumTypes::CP_ARRET ) + throw(CalciumException(CalciumTypes::CPINARRET,LOC(OSS()<< "La directive CP_ARRET" + << " provoque l'interruption de toute lecture de données"))); +#ifdef _DEBUG_ + std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK3 --------" << std::endl; +#endif + + + // S'il n'y a plus de données indique que l'on a pas pu effectuer de traitement + // TODO : Dans la gestion des niveaux il faut peut être interdire un niveau == 0 + if ( storedDatas.empty() ) + throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "La directive CP_CONT" + << " est active mais aucune donnée n'est disponible."))); + + // expectedDataId n'a ni été trouvé dans storedDataIds ni encadré mais il se peut + // qu'en mode itératif il ne soit pas plus grand que le plus grand DataId stocké auquel + // cas on doit renvoyer une expection car on n'est plus connecté et on ne pourra jamais + // fournir de données pour ce dataId. +#ifdef _DEBUG_ + std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK4 " << expectedDataId <<" --------" << std::endl; +#endif + + // >= 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 < +#include +#include +#include "Superv_Component_i.hxx" +#include "CalciumException.hxx" +#include "CalciumTypes.hxx" +#include "CalciumGenericUsesPort.hxx" +#include "Copy2UserSpace.hxx" +#include "Copy2CorbaSpace.hxx" +#include "CalciumPortTraits.hxx" + +#include + +//#define _DEBUG_ + +template +struct IsSameType { + static const bool value = false; +}; +template +struct IsSameType { + static const bool value = true; +}; + + + +namespace CalciumInterface { + + /********************* INTERFACE DE DECONNEXION *****************/ + + static void + ecp_fin (Superv_Component_i & component, bool provideLastGivenValue) + { + std::vector usesPortNames; + std::vector::const_iterator it; + component.get_uses_port_names(usesPortNames); + + //récupérer le type de réel du port est un peu difficile + //car l'interface nous donne aucune indication + + // uses_port *myUsesPort; + calcium_uses_port* myCalciumUsesPort; + + for (it=usesPortNames.begin(); it != usesPortNames.end(); ++it) { + try { + + myCalciumUsesPort= + component.Superv_Component_i::get_port< calcium_uses_port >((*it).c_str()); + +// component.Superv_Component_i::get_port(myUsesPort,(*it).c_str()); +// 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 " +// << *it << " en port de type calcium_uses_port." )); + + 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 + // On continue à traiter la deconnexion des autres ports uses + } catch (...) { + throw (CalciumException(CalciumTypes::CPATAL,"Exception innatendue")); + // En fonction du mode de gestion des erreurs throw; + } + } + } + + + /********************* INTERFACES DE DESALLOCATION *****************/ + + // Uniquement appelé par l'utilisateur s'il utilise la 0 copie + // ( pointeur de données data==NULL à l'appel de ecp_lecture ) + // Une désallocation aura lieu uniquement si un buffer intermédiaire + // était necessaire (type utilisateur et corba diffférent) + // La propriété du buffer est rendue à CORBA sinon + template static void + ecp_free ( T1 * dataPtr ) + { + 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 ); + } + + + /********************* INTERFACES DE LECTURE *****************/ + + // T1 est le type de données + template static void + ecp_lecture ( Superv_Component_i & component, + CalciumTypes::DependencyType dependencyType, + double & ti, + double const & tf, + long & i, + const string & nomVar, + size_t bufferLength, + size_t & nRead, + T1 * &data ) + { + ecp_lecture (component,dependencyType,ti,tf, + i,nomVar,bufferLength,nRead,data); + + } + + // T1 est le type de données + // T2 est un de type Calcium permettant de sélectionner le port correspondant + // T1 et T2 sont dissociés pour discriminer le cas des nombres complexes + // -> Les données des nombres complexes sont de type float mais + // le port à utiliser est le port cplx + template static void + ecp_lecture ( Superv_Component_i & component, + CalciumTypes::DependencyType dependencyType, + double & ti, + double const & tf, + long & i, + const string & nomVar, + size_t bufferLength, + size_t & nRead, + T1 * &data ) + { + + assert(&component); + + typedef typename ProvidesPortTraits::PortType PortType; + typedef typename PortType::DataManipulator DataManipulator; + typedef typename DataManipulator::Type CorbaDataType; // Attention != T1 + typedef typename DataManipulator::InnerType InnerType; + + CorbaDataType corbaData; + +#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)); + } + + // mode == mode du port + CalciumTypes::DependencyType portDependencyType = port->getDependencyType(); + + if ( portDependencyType == CalciumTypes::UNDEFINED_DEPENDENCY ) + throw CalciumException(CalciumTypes::CPIT, + LOC(OSS()<<"Le mode de dépendance de la variable " + << nomVar << " est indéfini.")); + + if ( ( portDependencyType != dependencyType ) && + ( dependencyType != CalciumTypes::SEQUENCE_DEPENDENCY ) ) + throw CalciumException(CalciumTypes::CPITVR, + LOC(OSS()<<"Le mode de dépendance de la variable " + << nomVar << ": " << portDependencyType + << " ne correspond pas au mode demandé.")); + + + 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 ) { + if ( bufferLength != 0 ) { + MESSAGE("bufferLength devrait valoir 0 pour l'utilisation du mode sans copie (data==NULL)"); + } + 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 T1 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 : + // DataManipulator::delete_data(corbaData); + // old : Dans les deux cas la structure CORBA n'est plus utile + // old : Si !IsSameType::value l'objet CORBA est détruit avec son contenu + // old : Dans l'autre cas seul la coquille CORBA est détruite + // L'utilisateur devra appeler ecp_free (version modifiée) qui déterminera s'il est necessaire + // de désallouer un buffer intermédiaire ( types différents) ou de rendre la propriété + } 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; + } + + + /********************* INTERFACES D'ECRITURE *****************/ + + template static void + ecp_ecriture ( Superv_Component_i & component, + CalciumTypes::DependencyType dependencyType, + double const & t, + long const & i, + const string & nomVar, + size_t bufferLength, + T1 & data ) { + ecp_ecriture (component,dependencyType,t,i,nomVar,bufferLength,data); + } + + template static void + ecp_ecriture ( Superv_Component_i & component, + CalciumTypes::DependencyType dependencyType, + double const & t, + long const & i, + const string & nomVar, + size_t bufferLength, + T1 & data ) + { + + assert(&component); + + //typedef typename StarTrait::NonStarType T; + typedef typename UsesPortTraits::PortType PortType; + typedef typename ProvidesPortTraits::PortType ProvidesPortType; + typedef typename ProvidesPortType::DataManipulator DataManipulator; + // Verifier que l'on peut définir UsesPortType::DataManipulator + // typedef typename PortType::DataManipulator DataManipulator; + 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)); + } + + // mode == mode du port + // On pourrait créer la méthode CORBA dans le mode de Couplage CALCIUM. + // et donc ajouter cette cette méthode uniquement dans l'IDL calcium ! + +// CalciumTypes::DependencyType portDependencyType; +// try { +// portDependencyType = port->getDependencyType(); +// std::cout << "-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl; +// } catch ( const DSC_Exception & ex ) { +// std::cerr << ex.what() << std::endl;; +// throw (CalciumException(CalciumTypes::CPIT,ex)); +// } + + if ( dependencyType == CalciumTypes::UNDEFINED_DEPENDENCY ) + throw CalciumException(CalciumTypes::CPIT, + LOC(OSS()<<"Le mode de dépendance demandé pour la variable " + << nomVar << " est indéfini.")); + + if ( dependencyType == CalciumTypes::SEQUENCE_DEPENDENCY ) + throw CalciumException(CalciumTypes::CPIT, + LOC(OSS()<<"Le mode de dépendance SEQUENCE_DEPENDENCY pour la variable " + << nomVar << " est impossible en écriture.")); + + // Il faudrait que le port provides génère une exception si le mode donnée n'est pas + // le bon. La seule façon de le faire est d'envoyer -1 en temps si on n'est en itération + // et vice-versa pour informer les provides port du mode dans lequel on est. Sinon il faut + // modifier l'interface IDL pour y ajouter un mode de dépendance ! + // ----> +// if ( portDependencyType != dependencyType ) +// throw CalciumException(CalciumTypes::CPITVR, +// LOC(OSS()<<"Le mode de dépendance de la variable " +// << nomVar << " ne correspond pas au mode demandé.")); + + + if ( bufferLength < 1 ) + throw CalciumException(CalciumTypes::CPNTNULL, + LOC(OSS()<<"Le buffer a envoyer est de taille nulle ")); + + +#ifdef _DEBUG_ + std::cout << "-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl; +#endif + CorbaDataType corbaData; + + + // Si les types Utilisateurs et CORBA sont différents + // il faut effectuer une recopie sinon on utilise directement le + // buffer data pour constituer la séquence + // TODO : + // - Attention en mode asynchrone il faudra eventuellement + // faire une copie des données même si elles sont de même type. + // - OLD : En cas de collocalisation (du port provide et du port uses) + // OLD : il est necessaire d'effectuer une recopie du buffer car la + // OLD : séquence est envoyée au port provide par une référence sur + // OLD : la séquence locale. Or la méthode put récupère le buffer directement + // OLD : qui est alors le buffer utilisateur. Il pourrait alors arriver que : + // OLD : * Le recepteur efface le buffer emetteur + // OLD : * Le port lui-même efface le buffer de l'ulisateur ! + // OLD : Cette copie est effectuée dans GenericPortUses::put + // OLD : en fonction de la collocalisation ou non. + // - OLD :En cas de connection multiples d'un port uses distant vers plusieurs port provides + // OLD : collocalisés les ports provides partagent la même copie de la donnée ! + // OLD : Il faut effectuer une copie dans le port provides. + // OLD : Cette copie est effectuée dans GenericPortUses::put + // OLD : en fonction de la collocalisation ou non. + Copy2CorbaSpace::value >::apply(corbaData,data,bufferLength); + + //TODO : GERER LES EXCEPTIONS ICI : ex le port n'est pas connecté + if ( dependencyType == CalciumTypes::TIME_DEPENDENCY ) { + 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 ) { + 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 (cas de la recopie) + delete corbaData; + +#ifdef _DEBUG_ + std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl; +#endif + + return; + } + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumException.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumException.hxx new file mode 100644 index 000000000..7ace0984a --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumException.hxx @@ -0,0 +1,68 @@ +// 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 : CalciumException.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-06 17:20:28 +0100 (mar, 06 fév 2007) $ +// Id : $Id$ + +#ifndef CALCIUM_EXCEPTION_HXX +#define CALCIUM_EXCEPTION_HXX + +#include "DSC_Exception.hxx" +#include "CalciumTypes.hxx" +#include + +struct CalciumException : public DSC_Exception { + + CalciumException( const CalciumTypes::InfoType info, + const std::string & text, + const char *fileName, + const unsigned int lineNumber, + const char *funcName): + DSC_Exception(text,fileName,lineNumber,funcName), + _info(info),_exceptionName("CalciumException") + {}; + + + CalciumException( const CalciumTypes::InfoType info, + const std::string & text ): + DSC_Exception(text),_info(info),_exceptionName("CalciumException") + {}; + + CalciumException(CalciumTypes::InfoType info, const DSC_Exception & ex ): + DSC_Exception(ex),_info(info),_exceptionName("CalciumException") + {}; + + virtual ~CalciumException() throw() {}; + CalciumTypes::InfoType getInfo() const { return _info;} + void setInfo(CalciumTypes::InfoType info) {_info=info;} + virtual const std::string & getExceptionName() const {return _exceptionName;}; + +protected: + CalciumTypes::InfoType _info; + std::string _exceptionName; +}; + + +#endif /* CALCIUM_EXCEPTION_HXX */ diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx new file mode 100644 index 000000000..b419e3869 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx @@ -0,0 +1,216 @@ +// 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 : CalciumGenericProvidesPort.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Id : $Id$ + +#ifndef _CALCIUM_GENERIC_PROVIDES_PORT_HXX_ +#define _CALCIUM_GENERIC_PROVIDES_PORT_HXX_ + +#include "PortProperties_i.hxx" + +#include "calcium_provides_port.hxx" + +#include "GenericProvidesPort.hxx" +#include "CalciumCouplingPolicy.hxx" + +#include "CorbaTypes2CalciumTypes.hxx" +#include "CalciumTypes2CorbaTypes.hxx" + +#include "DSC_Exception.hxx" +#include + +// +// Cette macro CPP remplace une déclaration : template +// mais permet surtout de générer différentes classes (dont le nom est spécifié par specificPortName ) +// +// Variante: Creer un trait qui à partir de CorbaInterface déduit CorbaDataManipulator +// et simplifier la classe +// +// L'utilisation conjointe du paramètre ... et de __VA_ARGS__ au lieu d'un 'CorbaDataManipulator' permet +// d'invoquer la macro avec un troisième token contenant une virgule +// (qui est considéré comme un séparateur d'argument par le PP ) + +#define CALCIUM_GENERIC_PROVIDES_PORT_HXX(specificPortName,CorbaInterface,...) \ + class specificPortName : public virtual CorbaInterface , \ + public virtual POA_Ports::PortProperties, \ + public GenericProvidesPort< __VA_ARGS__ , CalciumCouplingPolicy, calcium_provides_port > { \ + public : \ + typedef __VA_ARGS__ DataManipulator; \ + typedef DataManipulator::Type CorbaDataType; \ + typedef GenericPort< DataManipulator , \ + CalciumCouplingPolicy > Port; \ + \ + virtual ~ specificPortName (); \ + \ + inline void disconnect(bool provideLastGivenValue) { \ + Port::disconnect(provideLastGivenValue); \ + } \ + inline void setDependencyType(CalciumTypes::DependencyType dependencyType) { \ + Port::setDependencyType(dependencyType); \ + } \ + inline CalciumTypes::DependencyType getDependencyType () const { \ + return Port::getDependencyType(); \ + } \ + inline void setStorageLevel (size_t storageLevel) { \ + Port::setStorageLevel(storageLevel); \ + } \ + inline size_t getStorageLevel () const { \ + return Port::getStorageLevel(); \ + } \ + inline void setDateCalSchem (CalciumTypes::DateCalSchem dateCalSchem) { \ + Port::setDateCalSchem (dateCalSchem); \ + } \ + inline CalciumTypes::DateCalSchem getDateCalSchem () const { \ + return Port::getDateCalSchem (); \ + } \ + inline void setAlpha(double alpha) { \ + Port::setAlpha(alpha); \ + } \ + inline double getAlpha() const { \ + return Port::getAlpha(); \ + } \ + inline void setDeltaT(double deltaT ) { \ + Port::setDeltaT(deltaT); \ + } \ + inline double getDeltaT() const { \ + return Port::getDeltaT(); \ + } \ + inline void setInterpolationSchem (CalciumTypes::InterpolationSchem interpolationSchem) { \ + Port::setInterpolationSchem(interpolationSchem); \ + } \ + inline void setExtrapolationSchem (CalciumTypes::ExtrapolationSchem extrapolationSchem) { \ + Port::setExtrapolationSchem(extrapolationSchem); \ + } \ + inline CalciumTypes::InterpolationSchem getInterpolationSchem() const { \ + return Port::getInterpolationSchem(); \ + } \ + inline CalciumTypes::ExtrapolationSchem getExtrapolationSchem() const { \ + return Port::getExtrapolationSchem(); \ + } \ + \ + inline void put( DataManipulator::CorbaInType data, \ + CORBA::Double time, CORBA::Long tag) { \ + Port::put(data, time, tag); \ + } \ + \ + inline Ports::Port_ptr get_port_ref() { \ + return _this(); \ + } \ + \ + Ports::PortProperties_ptr get_port_properties() { \ + return POA_Ports::PortProperties::_this(); \ + } \ + \ + virtual void set_property(const char * name, const CORBA::Any& value) \ + throw (Ports::NotDefined, Ports::BadType, Ports::BadValue); \ + \ + virtual CORBA::Any* get_property(const char* name) \ + throw (Ports::NotDefined); \ + \ + virtual void provides_port_changed(int connection_nbr, \ + const Engines::DSC::Message message) { \ + if ( !connection_nbr && (message == Engines::DSC::RemovingConnection) ) \ + { \ + disconnect(false); \ + } \ + } \ + }; \ + + + + +#define CALCIUM_GENERIC_PROVIDES_PORT_CXX(specificPortName) \ + \ + specificPortName::~specificPortName(void) {}; \ + \ + void specificPortName::set_property(const char * name, const CORBA::Any& value) \ + throw (Ports::NotDefined, Ports::BadType, Ports::BadValue) { \ + \ + const std::string key(name); \ + CORBA::Long sl; \ + CORBA::Double alpha,delta; \ + Ports::Calcium_Ports::DependencyType dt; \ + Ports::Calcium_Ports::DateCalSchem dcs; \ + Ports::Calcium_Ports::InterpolationSchem is; \ + Ports::Calcium_Ports::ExtrapolationSchem es; \ + bool ok=false; \ + \ + try { \ + \ + if (key == "StorageLevel" ) \ + {if ( ok=(value >>= sl) ) Port::setStorageLevel(sl);} \ + else if (key == "Alpha" ) \ + {if ( ok=(value >>= alpha) ) Port::setAlpha(alpha);} \ + else if (key == "DeltaT" ) \ + {if ( ok=(value >>= delta) ) Port::setDeltaT(delta);} \ + else if (key == "DependencyType" ) \ + {if ( ok=( value >>= dt) ) Port::setDependencyType(dependencyType[dt]);} \ + else if (key == "DateCalSchem" ) \ + {if ( ok=(value >>= dcs) ) \ + Port::setDateCalSchem(dateCalSchem[dcs]);} \ + else if (key == "InterpolationSchem") \ + {if ( ok=(value >>= is) ) \ + Port::setInterpolationSchem(interpolationSchem[is]);} \ + else if (key == "ExtrapolationSchem") \ + {if ( ok=(value >>= es) ) \ + Port::setExtrapolationSchem(extrapolationSchem[es]);} \ + else \ + throw Ports::NotDefined(); \ + if (!ok) throw Ports::BadType(); \ + \ + } catch ( const DSC_Exception & ex ) { \ + \ + std::cerr << ex.what() << std::endl; \ + throw Ports::BadValue(); \ + } \ + } \ + \ + \ + CORBA::Any* specificPortName::get_property(const char* name) \ + throw (Ports::NotDefined) { \ + const std::string key(name); \ + CORBA::Any* value=new CORBA::Any; \ + if (key == "StorageLevel" ) \ + { (*value) <<= static_cast(Port::getStorageLevel()); } \ + else if (key == "Alpha" ) \ + { *value <<= (CORBA::Double) Port::getAlpha();} \ + else if (key == "DeltaT" ) \ + { *value <<= (CORBA::Double) Port::getDeltaT();} \ + else if (key == "DependencyType" ) \ + { *value <<= corbaDependencyType[Port::getDependencyType()];} \ + else if (key == "DateCalSchem" ) \ + { *value <<= corbaDateCalSchem[Port::getDateCalSchem()];} \ + else if (key == "InterpolationSchem") \ + { *value <<= corbaInterpolationSchem[Port::getInterpolationSchem()];} \ + else if (key == "ExtrapolationSchem") \ + { *value <<= corbaExtrapolationSchem[Port::getExtrapolationSchem()];} \ + else { \ + delete value; \ + throw Ports::NotDefined(); \ + } \ + return value; \ + }; + + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericUsesPort.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericUsesPort.hxx new file mode 100644 index 000000000..a71b9f547 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericUsesPort.hxx @@ -0,0 +1,67 @@ +// 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 : CalciumGenericUsesPort.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Id : $Id$ + +#ifndef _CALCIUM_GENERIC_USES_PORT_HXX_ +#define _CALCIUM_GENERIC_USES_PORT_HXX_ + +#include "GenericUsesPort.hxx" +#include "calcium_uses_port.hxx" + +template +class CalciumGenericUsesPort : public GenericUsesPort +{ +public : + virtual ~CalciumGenericUsesPort() {}; + void disconnect(bool provideLastGivenValue); + +}; + + +template +void +CalciumGenericUsesPort< DataManipulator,CorbaPortType, repositoryName >::disconnect(bool provideLastGivenValue ) { + + typedef typename CorbaPortType::_ptr_type CorbaPortTypePtr; + + if (!this->_my_ports) + throw DSC_Exception(LOC("There is no connected provides port to communicate with.")); + + for(int i = 0; i < this->_my_ports->length(); i++) { + CorbaPortTypePtr port = CorbaPortType::_narrow((*this->_my_ports)[i]); + try { + std::cerr << "-------- CalciumGenericUsesPort<>::disconnect: "<< i << std::endl; + + port->disconnect(provideLastGivenValue); + } catch(const CORBA::SystemException& ex){ + std::cerr << "Can't call disconnect on provides port " << i << std::endl; + } + } + +} + + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx new file mode 100644 index 000000000..504d3b256 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx @@ -0,0 +1,246 @@ +// 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 : CalciumInterface.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $ +// Id : $Id$ + +#ifndef _CALCIUM_INTERFACE_HXX_ +#define _CALCIUM_INTERFACE_HXX_ + +//Interface C++ +#include "CalciumCxxInterface.hxx" + +#include "CalciumException.hxx" +#include "CalciumTypes.hxx" + +#include + +//#define _DEBUG_ + +#ifdef _DEBUG_ +#define DEBTRACE(msg) {std::cerr< struct CalTimeType { + typedef float TimeType; +}; + +template <> struct CalTimeType { + typedef double TimeType; +}; + +// Définition de ecp_fin +extern "C" CalciumTypes::InfoType +ecp_fin_ (void * component, int code) { + + Superv_Component_i * _component = static_cast(component); + + bool provideLastGivenValue = false; + if (code == CalciumTypes::CP_CONT ) provideLastGivenValue = true; + + try { + CalciumInterface::ecp_fin( *_component, + provideLastGivenValue); + } catch ( const CalciumException & ex) { //tester l'arrêt par exception + DEBTRACE( ex.what() ); + return ex.getInfo(); + } + return CalciumTypes::CPOK; +}; + + +// Définition de ecp_lecture_... , ecp_ecriture_..., ecp_free_... +#define CALCIUM_C2CPP_INTERFACE_(_name,_type,_qual) \ + extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \ + CalTimeType< _type _qual >::TimeType * ti, \ + CalTimeType< _type _qual >::TimeType * tf, long * i, \ + const char * const nomvar, size_t bufferLength, \ + size_t * nRead, _type _qual ** data ) { \ + Superv_Component_i * _component = static_cast(component); \ + double _ti=*ti; \ + double _tf=*tf; \ + size_t _nRead=0; \ + size_t _bufferLength=bufferLength; \ + CalciumTypes::DependencyType _dependencyType= \ + static_cast(dependencyType); \ + \ + if ( IsSameType< _name , cplx >::value ) _bufferLength*=2; \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \ + try { \ + CalciumInterface::ecp_lecture< _type, _name >( *_component, \ + _dependencyType, \ + _ti, _tf, *i, \ + nomvar, \ + _bufferLength, _nRead, *data); \ + } catch ( const CalciumException & ex) { \ + DEBTRACE( ex.what() ); \ + return ex.getInfo(); \ + } \ + if ( IsSameType< _name , cplx >::value ) { *nRead=_nRead/2; \ + 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); \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \ + return CalciumTypes::CPOK; \ + }; \ + \ + \ + extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) { \ + CalciumInterface::ecp_free< _type, _name >(data); \ + }; \ + \ + \ + extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \ + CalTimeType< _type _qual >::TimeType *t, \ + long i, \ + const char * const nomvar, size_t bufferLength, \ + _type _qual * data ) { \ + Superv_Component_i * _component = static_cast(component); \ + /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ \ + double _t=*t; \ + size_t _bufferLength=bufferLength; \ + if ( IsSameType< _name , cplx >::value ) _bufferLength=_bufferLength*2; \ + 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);*/ \ + std::string essai(nomvar); \ + DEBTRACE( "----------->-" << nomvar ) \ + CalciumInterface::ecp_ecriture< _type, _name >( *_component, \ + static_cast(dependencyType), \ + _t,i,nomvar,_bufferLength,*data); \ + } catch ( const CalciumException & ex) { \ + std::cerr << ex.what() << std::endl; \ + return ex.getInfo(); \ + } \ + DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) \ + return CalciumTypes::CPOK; \ + }; \ + + + +#define STAR * +// Le premier argument est utilisée : +// - comme suffixe dans la définition des noms ecp_lecture_ ecp_ecriture_ ecp_free_ +// - comme second argument template à l'appel de la méthode C++ correspondante +// ( le port correspondant est alors obtenu par un trait) +// Le second argument est utilisée : +// - pour typer le paramètre data de la procédure générée +// - pour déduire le type des paramètres t, ti tf via un trait +// - comme premier paramètre template à l'appel de la méthode C++ correspondante +CALCIUM_C2CPP_INTERFACE_(int,int,); +CALCIUM_C2CPP_INTERFACE_(float,float, ); +CALCIUM_C2CPP_INTERFACE_(double,double,); +CALCIUM_C2CPP_INTERFACE_(bool,bool,); +CALCIUM_C2CPP_INTERFACE_(cplx,float,); +CALCIUM_C2CPP_INTERFACE_(str,char*,); + +// INTERFACE C/CPP pour les chaines de caractères +// Le paramètre supplémentaire strsize n'étant pas utilisé +// j'utilise la génération par la macro CALCIUM_C2CPP_INTERFACE_(str,char*,); +// TODO : vérifier ecp_free pour ce type particulier +// extern "C" CalciumTypes::InfoType ecp_lecture_str (void * component, int dependencyType, +// float * ti, float * tf, long * i, +// const char * const nomvar, size_t bufferLength, +// size_t * nRead, char ** *data, size_t strsize ) { + +// Superv_Component_i * _component = static_cast(component); +// double _ti=*ti; +// double _tf=*tf; +// size_t _nRead=0; +// size_t _bufferLength=bufferLength; +// CalciumTypes::DependencyType _dependencyType= +// static_cast(dependencyType); + +// // - GERER POINTEUR NULL : NOTHING TODO +// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.) + +// DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) +// try { +// CalciumInterface::ecp_lecture< char*, char* >( *_component, +// _dependencyType, +// _ti, _tf, *i, +// nomvar, +// _bufferLength, _nRead, *data); +// } catch ( const CalciumException & ex) { +// DEBTRACE( ex.what() ); +// return ex.getInfo(); +// } + +// *nRead = _nRead; + +// if (_dependencyType == CalciumTypes::CP_SEQUENTIEL ) +// *ti=(float)(_ti); + +// DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) ; + +// return CalciumTypes::CPOK; +// }; + + +// extern "C" void ecp_lecture_str_free (char** data) { +// CalciumInterface::ecp_free< char*, char* >(data); +// }; + + +// extern "C" CalciumTypes::InfoType ecp_ecriture_str (void * component, int dependencyType, +// float *t, long i, +// const char * const nomvar, size_t bufferLength, +// char ** data, int strsize ) { + +// Superv_Component_i * _component = static_cast(component); +// /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ +// double _t=*t; +// size_t _bufferLength=bufferLength; + +// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.) + +// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) +// try { +// std::string essai(nomvar); +// DEBTRACE( "----------->-" << nomvar ) +// CalciumInterface::ecp_ecriture< char*, char* >( *_component, +// static_cast(dependencyType), +// _t,i,nomvar,_bufferLength,*data); +// } catch ( const CalciumException & ex) { +// std::cerr << ex.what() << std::endl; +// return ex.getInfo(); +// } +// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) +// return CalciumTypes::CPOK; +// }; + + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx new file mode 100644 index 000000000..d05cc440d --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx @@ -0,0 +1,101 @@ +// 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 : CalciumPortTraits.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#ifndef _PORT_TRAITS_HXX_ +#define _PORT_TRAITS_HXX_ + +#include "Superv_Component_i.hxx" + +// PROVIDES PORT TRAITS +struct UnknownProvidesPortType {}; +template struct ProvidesPortTraits { + typedef UnknownProvidesPortType PortType; +}; +template <> struct ProvidesPortTraits { + typedef calcium_integer_port_provides PortType; +}; +template <> struct ProvidesPortTraits { + typedef calcium_integer_port_provides PortType; +}; +template <> struct ProvidesPortTraits { + typedef calcium_real_port_provides PortType; +}; +template <> struct ProvidesPortTraits { + typedef calcium_double_port_provides PortType; +}; +template <> struct ProvidesPortTraits { + typedef calcium_logical_port_provides PortType; +}; +// Définition du type cplx pour disciminer ce type de port +// de celui du float +struct cplx {}; +template <> struct ProvidesPortTraits { + typedef calcium_complex_port_provides PortType; +}; +// Défénition du type str pour obtenir le type de port +// correspondant +struct str {}; +template <> struct ProvidesPortTraits { + typedef calcium_string_port_provides PortType; +}; + template <> struct ProvidesPortTraits { + typedef calcium_string_port_provides PortType; + }; + +template < typename T > struct StarTrait { typedef T NonStarType; }; +template < typename T > struct StarTrait< T * > { typedef T NonStarType; }; + + +// USES PORT TRAITS +struct UnknownUsesPortType {}; +template struct UsesPortTraits { + typedef UnknownUsesPortType PortType; +}; +template <> struct UsesPortTraits { + typedef calcium_integer_port_uses PortType; +}; +template <> struct UsesPortTraits { + typedef calcium_integer_port_uses PortType; +}; +template <> struct UsesPortTraits { + typedef calcium_real_port_uses PortType; +}; +template <> struct UsesPortTraits { + typedef calcium_double_port_uses PortType; +}; +template <> struct UsesPortTraits { + typedef calcium_string_port_uses PortType; +}; +template <> struct UsesPortTraits { + typedef calcium_logical_port_uses PortType; +}; +template <> struct UsesPortTraits { + typedef calcium_complex_port_uses PortType; +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx new file mode 100644 index 000000000..6ada79b9a --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx @@ -0,0 +1,14 @@ +#include "CalciumProvidesPort.hxx" + + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_integer_port_provides) + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_real_port_provides) + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_double_port_provides) + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_complex_port_provides) + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_logical_port_provides) + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_string_port_provides) diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx new file mode 100644 index 000000000..e22288f6a --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx @@ -0,0 +1,40 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $ +// Id : $Id$ + +#ifndef _CALCIUM_PORT_PROVIDES_HXX_ +#define _CALCIUM_PORT_PROVIDES_HXX_ + +#include + +#include "Calcium_Ports.hh" +#include "CalciumGenericProvidesPort.hxx" +#include "CalciumCouplingPolicy.hxx" + + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_integer_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Integer_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_real_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Real_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_double_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Double_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_complex_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Complex_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_logical_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Logical_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_string_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_String_Port, \ + seq_u_manipulation ) \ + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes.hxx new file mode 100644 index 000000000..987ed26b1 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes.hxx @@ -0,0 +1,209 @@ +// 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 : CalciumTypes.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#ifndef __CALCIUM_TYPES__ +#define __CALCIUM_TYPES__ + +namespace CalciumTypes { + + + const float EPSILON = 1.e-6; + + + /* Type de dependance des variables */ + const int CP_TEMPS = 40; + const int CP_ITERATION = 41; + const int CP_SEQUENTIEL = 42; + /* Mode de dependance inconnu */ + const int CPIT = 6; + + /* Directive de continuation d'une instance */ + const int CP_CONT = 20; + const int CP_ARRET = 21; + + /* Type d'interpolation */ + const int CP_LINEAIRE = 100; + const int CP_ESCALIER = 101; + + + /* Repere dans cycle de temps */ + const int TI = 110; + const int TF = 111; + + + /* Niveaux */ + const int CP_ILLIMITE = -70; + const int CP_AUTESP = -71; + + + + typedef int InfoType ; + const int UNLIMITED_STORAGE_LEVEL = CP_ILLIMITE; + typedef enum {UNDEFINED_DEPENDENCY=CPIT,TIME_DEPENDENCY=CP_TEMPS, + ITERATION_DEPENDENCY=CP_ITERATION, + // TYPE uniquement utilisé ds CalciumInterface + SEQUENCE_DEPENDENCY =CP_SEQUENTIEL + } DependencyType; + typedef enum {TI_SCHEM=TI,TF_SCHEM=TF,ALPHA_SCHEM} DateCalSchem; + typedef enum {L0_SCHEM=CP_ESCALIER,L1_SCHEM=CP_LINEAIRE} InterpolationSchem; + typedef enum {UNDEFINED_EXTRA_SCHEM,E0_SCHEM,E1_SCHEM} ExtrapolationSchem; + typedef enum {UNDEFINED_DIRECTIVE=0,CONTINUE=CP_CONT,STOP=CP_ARRET} DisconnectDirective; + + /* Codes d'erreur */ + + /* Pas d'erreur */ + const int CPOK = 0; + + /* Emetteur inconnu */ + const int CPERIU = 1; + + /* Nom de variable inconnu */ + const int CPNMVR = 2; + + /* Type entree/sortie incompatible */ + const int CPIOVR = 3; + + /* Type inconnu */ + const int CPTP = 4; + + /* Type de variable incompatible */ + const int CPTPVR = 5; + + /* Mode de dependance inconnu */ + // Déclaré au dessus + // const int CPIT = 6; + + /* Mode dependance incompatible */ + const int CPITVR = 7; + + /* Requete non autorisee */ + const int CPRENA = 8; + + /* Type de deconnexion incorrect */ + const int CPDNTP = 9; + + /* Directive de deconnexion incorrecte */ + const int CPDNDI = 10; + + /* Nom de code inconnu */ + const int CPNMCD = 11; + + /* Nom d'instance inconnu */ + const int CPNMIN = 12; + + /* Attente */ + const int CPATTENTE = 13; + + /* Blocage */ + const int CPBLOC = 14; + + /* Nombre de valeurs transmises egal a zero */ + const int CPNTNULL = 15; + + /* Longueur de variable insuffisante */ + const int CPLGVR = 16; + + /* L'instance doit s'arreter */ + const int CPSTOP = 17; + + /* Arret anormal */ + const int CPATAL = 18; + + /* Coupleur absent */ + const int CPNOCP = 19; + + /* Variable sortante non connectee */ + const int CPCTVR = 20; + + /* Nombre de pas a executer egal a zero */ + const int CPPASNULL = 21; + + /* Machine inconnue */ + const int CPMACHINE = 22; + + /* COUPLAGE_GROUPE non positionnee */ + const int CPGRNU = 23; + + /* Groupe d'instances incorrect */ + const int CPGRIN = 24; + + /* Fin du fichier d'entree */ + const int CPFINFICH = 25; + + /* Erreur de format dans un fichier */ + const int CPERRFICH = 26; + + /* Requete d'avance de n pas annulee */ + /* par passage en mode NORMAL */ + const int CPNORERR = 27; + + /* Coupleur en mode NORMAL pour une */ + /* requete RUN_N_PAS ou DEF_* */ + const int CPRUNERR = 28; + + /* Option inconnue */ + const int CPOPT = 29; + + /* Valeur d'option inconnue */ + const int CPVALOPT = 30; + + /* Ecriture impossible par effacement */ + const int CPECREFF = 31; + + /* Lecture d'une variable non connectee */ + /* ou n'appartenant pas a un lien VAS */ + /* ou VAV s'il s'agit d'une sortante */ + const int CPLIEN = 32; + + /* Lecture d'une variable d'une instance*/ + /* deconnectee avec directive CP_ARRET */ + const int CPINARRET = 33; + + /* Les lectures sequentielles ne pourront plus */ + /* etre satisfaites : instance productrice arretee */ + const int CPSTOPSEQ = 34; + + /* Erreur dans la chaine de declaration */ + const int CPDECL = 35; + + /* Erreur dans l'execution de l'instance ajoutee */ + const int CPINEXEC = 36; + + /* Erreur PVM */ + // const int CPPVM = 37; + // const int CPCOM = 37; + /* Erreur detectee au niveau de l'int CPERRINST = 38; + + /* Mode d'execution non defini */ + // const int CPMODE = 39; + + /* Instance deconnectee */ + const int CPINSTDEC = 40; + +} +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx new file mode 100644 index 000000000..5f7dcc18b --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx @@ -0,0 +1,135 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $ +// Id : $Id$ + +#include "CalciumTypes2CorbaTypes.hxx" +#include + +using namespace std; + +CORBA_DATE_CAL_SCHEM::CORBA_DATE_CAL_SCHEM() : map() +{ + map & + table = ( map & ) *this ; + +table[CalciumTypes::TI_SCHEM ] = Ports::Calcium_Ports::TI_SCHEM ; +table[CalciumTypes::TF_SCHEM ] = Ports::Calcium_Ports::TF_SCHEM ; +table[CalciumTypes::ALPHA_SCHEM ] = Ports::Calcium_Ports::ALPHA_SCHEM ; +} + + +Ports::Calcium_Ports::DateCalSchem CORBA_DATE_CAL_SCHEM::operator[]( const CalciumTypes::DateCalSchem &c ) const +{ + map &table = (map&)*this ; + assert( table.find( (CalciumTypes::DateCalSchem)c ) != table.end() ) ; + return table[ (CalciumTypes::DateCalSchem)c ] ; +} + +const CORBA_DATE_CAL_SCHEM corbaDateCalSchem ; + + + +CORBA_DEPENDENCY_TYPE::CORBA_DEPENDENCY_TYPE() : map() +{ + map & + table = ( map & ) *this ; + +table[CalciumTypes::TIME_DEPENDENCY ] = Ports::Calcium_Ports::TIME_DEPENDENCY ; +table[CalciumTypes::ITERATION_DEPENDENCY ] = Ports::Calcium_Ports::ITERATION_DEPENDENCY ; +table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ; + + +#ifdef _DEBUG_ +std::cerr << "CORBA_DEPENDENCY_TYPE() : table["< & + table = (map& ) *this ; + +#ifdef _DEBUG_ +std::cerr << "CORBA_DEPENDENCY_TYPE() : ::operator["< () +{ + map & + table = ( map & ) *this ; + + table[CalciumTypes::L0_SCHEM ] = Ports::Calcium_Ports::L0_SCHEM ; + table[CalciumTypes::L1_SCHEM ] = Ports::Calcium_Ports::L1_SCHEM ; +} + + +Ports::Calcium_Ports::InterpolationSchem CORBA_INTERPOLATION_SCHEM::operator[]( const CalciumTypes::InterpolationSchem &c ) const +{ + map &table = + (map& ) *this ; + + assert( table.find( (CalciumTypes::InterpolationSchem)c ) != table.end() ) ; + return table[ (CalciumTypes::InterpolationSchem)c ] ; +} + +const CORBA_INTERPOLATION_SCHEM corbaInterpolationSchem ; + + + +CORBA_EXTRAPOLATION_SCHEM::CORBA_EXTRAPOLATION_SCHEM() : map () +{ + map & + table = ( map & ) *this ; + + table[CalciumTypes::E0_SCHEM ] = Ports::Calcium_Ports::E0_SCHEM ; + table[CalciumTypes::E1_SCHEM ] = Ports::Calcium_Ports::E1_SCHEM ; + table[CalciumTypes::UNDEFINED_EXTRA_SCHEM ] = Ports::Calcium_Ports::UNDEFINED_EXTRA_SCHEM ; +} + + +Ports::Calcium_Ports::ExtrapolationSchem CORBA_EXTRAPOLATION_SCHEM::operator[]( const CalciumTypes::ExtrapolationSchem &c ) const +{ + map &table = + (map& ) *this ; + + assert( table.find( (CalciumTypes::ExtrapolationSchem)c ) != table.end() ) ; + return table[ (CalciumTypes::ExtrapolationSchem)c ] ; +} + +const CORBA_EXTRAPOLATION_SCHEM corbaExtrapolationSchem ; diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.hxx new file mode 100644 index 000000000..9f1d1f5b6 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.hxx @@ -0,0 +1,62 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $ +// Id : $Id$ + +#ifndef _CALCIUMTYPES_TO_CORBATYPES_HXX_ +#define _CALCIUMTYPES_TO_CORBATYPES_HXX_ + +#include "Calcium_Ports.hh" +#include "CalciumTypes.hxx" + +#include +#include + + +class CORBA_DATE_CAL_SCHEM : public std::map +{ +public : + + CORBA_DATE_CAL_SCHEM(); + Ports::Calcium_Ports::DateCalSchem operator[]( const CalciumTypes::DateCalSchem &c ) const; +}; + + +extern const CORBA_DATE_CAL_SCHEM corbaDateCalSchem ; + +class CORBA_DEPENDENCY_TYPE : public std::map +{ +public : + + CORBA_DEPENDENCY_TYPE(); + Ports::Calcium_Ports::DependencyType operator[]( const CalciumTypes::DependencyType &c ) const; +}; + +extern const CORBA_DEPENDENCY_TYPE corbaDependencyType ; + +class CORBA_INTERPOLATION_SCHEM : public std::map +{ +public : + + CORBA_INTERPOLATION_SCHEM(); + Ports::Calcium_Ports::InterpolationSchem operator[]( const CalciumTypes::InterpolationSchem &c ) const; +} ; + +extern const CORBA_INTERPOLATION_SCHEM corbaInterpolationSchem ; + +class CORBA_EXTRAPOLATION_SCHEM : public std::map +{ +public : + + CORBA_EXTRAPOLATION_SCHEM(); + Ports::Calcium_Ports::ExtrapolationSchem operator[]( const CalciumTypes::ExtrapolationSchem &c ) const; +} ; + +extern const CORBA_EXTRAPOLATION_SCHEM corbaExtrapolationSchem ; + + +#endif diff --git a/src/SALOMEDS/SALOMEDS_IORAttribute.jxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypesManipulator.hxx similarity index 53% rename from src/SALOMEDS/SALOMEDS_IORAttribute.jxx rename to src/DSC/DSC_User/Datastream/Calcium/CalciumTypesManipulator.hxx index 415f1006f..cf9585bf3 100644 --- a/src/SALOMEDS/SALOMEDS_IORAttribute.jxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypesManipulator.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 @@ -21,24 +19,26 @@ // // // -// File : SALOMEDS_IORAttribute.jxx -// Module : SALOME +// File : CalciumTypesManipulator.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL + +#ifndef _CALCIUM_TYPES_MANIPULATOR_HXX_ +#define _CALCIUM_TYPES_MANIPULATOR_HXX_ + +//Cette classe n'est pas necessaire pour l'instant. +#include "Calcium_Ports.hh" + +template struct CalciumTypesManipulator : + public seq_u_manipulation { + static bool needInterpolation=true; +} + +template struct CalciumTypesManipulator : + public seq_u_manipulation { + static bool needInterpolation=true; +} -#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/DSC/DSC_User/Datastream/Calcium/Copy2CorbaSpace.hxx b/src/DSC/DSC_User/Datastream/Calcium/Copy2CorbaSpace.hxx new file mode 100644 index 000000000..21f338497 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/Copy2CorbaSpace.hxx @@ -0,0 +1,97 @@ +// 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 : Copy2CorbaSpace.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-07 18:26:44 +0100 (mer, 07 fév 2007) $ +// Id : $Id$ + +#ifndef _COPY_TO_CORBA_SPACE_HXX_ +#define _COPY_TO_CORBA_SPACE_HXX_ + +#include +#include +#include "CalciumPortTraits.hxx" + +template +struct Copy2CorbaSpace { + + template + static void apply( T1 * & corbaData, T2 & data, size_t nRead){ + + typedef typename ProvidesPortTraits::PortType PortType; + //typedef typename UsesPortTraits::PortType PortType; + typedef typename PortType::DataManipulator DataManipulator; + typedef typename DataManipulator::InnerType InnerType; + +#ifdef _DEBUG_ + std::cerr << "-------- Copy2CorbaSpace 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 + + } +}; + +// Cas ou il faut effectuer une recopie +template <> struct +Copy2CorbaSpace { + + template + static void apply( T1 * & corbaData, T2 & data, size_t nRead){ + + typedef typename ProvidesPortTraits::PortType PortType; + // typedef typename UsesPortTraits::PortType PortType; + typedef typename PortType::DataManipulator DataManipulator; + typedef typename DataManipulator::InnerType InnerType; + + corbaData = DataManipulator::create(nRead); + InnerType * dataPtr = DataManipulator::getPointer(corbaData,false); + +#ifdef _DEBUG_ + std::cerr << "-------- Copy2CorbaSpace MARK 1 --(dataPtr : " << + dataPtr<<")----------------" << std::endl; +#endif + // Attention : Pour les chaines ou tout autre object complexe il faut utiliser une recopie profonde ! + std::copy(&data,&data+nRead,dataPtr); + +#ifdef _DEBUG_ + std::cerr << "-------- Copy2CorbaSpace MARK 2 --(nRead: "< MARK 3 : " ; + std::copy(dataPtr,dataPtr+nRead,std::ostream_iterator(std::cout," ")); + std::cout << std::endl; + std::cerr << "-------- Copy2CorbaSpace MARK 4 --(data : " < +#include +#include "CalciumPortTraits.hxx" + +#include + +//Les demandes de copies vers l'espace utilisateur +//proviennent d'une procédure de lecture + +//Cas du zero copie +template +struct Copy2UserSpace{ + + template + static void apply( T1 * & data, T2 & corbaData, size_t nRead ){ + + // La ligne suivante appelle à un commentaire + // dans le cas de char *, cf CalciumPortTraits.hxx 'char *' vs 'str' + typedef typename ProvidesPortTraits::PortType PortType; + typedef typename PortType::DataManipulator DataManipulator; + typedef typename DataManipulator::InnerType InnerType; + + // Devient propriétaire des données contenues dans la structure CORBA + // (allouées par allocbuff() pour une séquence) + // Le client est propriétaire des données. + // Il doit cependant être attentif au fait que s'il les modifie, + // une nouvelle demande de lecture lui fournira les données modifiées. + // TODO : ? Si plusieurs lecteurs demandent la même donnée ? + // ? qui devient le propriétaire? --> normalement le premier car + // ensuite la séquence n'est plus propriétaire. + // NO: Le port devrait resté propriétaire du contenu de la séquence + // NO: L'utilisateur doit de toute les façons utiliser les données reçues en + // NO: lecture seulement car si une nouvelle demande de lecture est formulée + // NO: pour ces données, les eventuelles modifications seraient visibles ! + // YES : La solution de donner la propriété à l'utilisateur est convenable car si + // le port déréférence ces données (garbage collecteur, niveau) le buffer + // reste disponible à l'ulisateur en lecture et écriture + // Le problème est que la donnée CORBA stockée par le port est maintenant vide (cf CORBA BOOK) + // du coup quid d'une nouvelle demande de lecture : A TESTER + InnerType * dataPtr = DataManipulator::getPointer(corbaData,true); + + // Cette ligne poserait uun problème dans la méthode appelante, si elle + // ne testait pas que les types utilisateurs et CORBA sont identiques : + // ex : InnerType == Corba::Long et d'un T == int + // C'est l'objet de la procédure suivante + data = dataPtr; + + // En zero copie l'utilisateur doit appeler ecp_free ( cas ou un buffer intermédiaire + // a été alloué pour cause de typage différent xor necessité de désalouer le buffer alloué par CORBA) + // L'utilisateur doit cependant être attentif au fait qu'après désallocation, si la donnée + // est toujours estampillée dans le port une nouvelle lecture pour cette estampille + // rendrait un buffer vide. + } +}; + +// Cas où il faut effectuer une recopie +template <> +struct Copy2UserSpace { + + //Recopie le contenu de la donnée CORBA dans le buffer utilisateur de longueur nRead + template + static void apply( T1 * &data, T2 & corbaData, size_t nRead){ + + // La ligne suivante appelle à un commentaire + // dans le cas de char *, cf CalciumPortTraits.hxx 'char *' vs 'str' + typedef typename ProvidesPortTraits::PortType PortType; + typedef typename PortType::DataManipulator DataManipulator; + typedef typename DataManipulator::InnerType InnerType; + + +#ifdef _DEBUG_ + InnerType * dataPtr = NULL; + // Affiche la valeur du pointeur de la structure corba + // et les pointeurs contenus le cas échéant + dataPtr = DataManipulator::getPointer(corbaData,false); + std::cerr << "-------- Copy2UserSpace MARK 1a --dataPtr("<(std::cerr," ")); + for (int i=0; i< DataManipulator::size(corbaData); ++i) + fprintf(stderr,"pointer[%d]=%p ",i, dataPtr[i]); + std::cerr << std::endl; + + T1 * tmpData = data; + std::cerr << "-------- Copy2UserSpace MARK 1b --data("<(std::cerr," ")); + for (int i=0; i< DataManipulator::size(corbaData); ++i) + fprintf(stderr,"pointer[%d]=%p ",i, tmpData[i]); + std::cerr << std::endl; +#endif + + // Pour les types pointeurs et ref il faut effectuer une recopie profonde. + // On la délègue au manipulateur de données. + + // Recopie des données dans le buffer allouée par l'utilisateur + // OU + // Recopie des données dans le buffer allouée par la méthode appelante (ex: lecture) + // dans le cas d'une demande utilisateur 0 copie mais que types utilisateurs et CORBA incompatibles. + + //std::copy(dataPtr,dataPtr+nRead,data); + DataManipulator::copy(corbaData,data,nRead); + +#ifdef _DEBUG_ + tmpData = data; + std::cerr << "-------- Copy2UserSpace MARK 1c --data("<(std::cerr," ")); + for (int i=0; i< DataManipulator::size(corbaData); ++i) + fprintf(stderr,"pointer[%d]=%p ",i, tmpData[i]); + std::cerr << std::endl; +#endif + + } + +}; + + +// Désallocation des buffers si necessaire +template +struct DeleteTraits { + template + static void apply(T * dataPtr) { + + typedef typename ProvidesPortTraits::PortType PortType; + typedef typename PortType::DataManipulator DataManipulator; + //typedef typename DataManipulator::Type DataType; // Attention != T + + // 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::relPointer(dataPtr); + // TODO : Il convient cependant de rendre la propriété du buffer à la séquence CORBA + // TODO : PB : On n'a plus de référence sur la séquence. + // TODO : Modifier l'API ecp_free pour indiquer le dataId associé ? + // TODO : ??VERIF accès concurrent à la séquence stockée ?? suppression simultanée ? + + } +}; + +// Désalocation du buffer intermédiaire +// dans le cas de types utilisateur/CORBA différents +template <> +struct DeleteTraits{ + + template + static void apply(T * dataPtr) { delete[] dataPtr; } + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx b/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx new file mode 100644 index 000000000..8ae28c91c --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.cxx @@ -0,0 +1,134 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $ +// Id : $Id$ + +#include "CorbaTypes2CalciumTypes.hxx" +#include + +using namespace std; + +DATE_CAL_SCHEM::DATE_CAL_SCHEM() : map() +{ + map & + table = ( map & ) *this ; + +table[Ports::Calcium_Ports::TI_SCHEM ] = CalciumTypes::TI_SCHEM ; +table[Ports::Calcium_Ports::TF_SCHEM ] = CalciumTypes::TF_SCHEM ; +table[Ports::Calcium_Ports::ALPHA_SCHEM ] = CalciumTypes::ALPHA_SCHEM ; +} + + +CalciumTypes::DateCalSchem DATE_CAL_SCHEM::operator[]( const Ports::Calcium_Ports::DateCalSchem &c ) const +{ + map &table = (map&)*this ; + assert( table.find( (Ports::Calcium_Ports::DateCalSchem)c ) != table.end() ) ; + return table[ (Ports::Calcium_Ports::DateCalSchem)c ] ; +} + +const DATE_CAL_SCHEM dateCalSchem ; + + + +DEPENDENCY_TYPE::DEPENDENCY_TYPE() : map() +{ + map & + table = ( map & ) *this ; + +table[Ports::Calcium_Ports::TIME_DEPENDENCY ] = CalciumTypes::TIME_DEPENDENCY ; +table[Ports::Calcium_Ports::ITERATION_DEPENDENCY ] = CalciumTypes::ITERATION_DEPENDENCY ; +table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ; + + +#ifdef _DEBUG_ +std::cerr << "DEPENDENCY_TYPE() : table["< &table = (map&)*this ; + +#ifdef _DEBUG_ +std::cerr << "DEPENDENCY_TYPE() : ::operator["< () +{ + map & + table = ( map & ) *this ; + + table[Ports::Calcium_Ports::L0_SCHEM ] = CalciumTypes::L0_SCHEM ; + table[Ports::Calcium_Ports::L1_SCHEM ] = CalciumTypes::L1_SCHEM ; +} + + +CalciumTypes::InterpolationSchem INTERPOLATION_SCHEM::operator[]( const Ports::Calcium_Ports::InterpolationSchem &c ) const +{ + map &table = + (map& ) *this ; + + assert( table.find( (Ports::Calcium_Ports::InterpolationSchem)c ) != table.end() ) ; + return table[ (Ports::Calcium_Ports::InterpolationSchem)c ] ; +} + +const INTERPOLATION_SCHEM interpolationSchem ; + + + +EXTRAPOLATION_SCHEM::EXTRAPOLATION_SCHEM() : map () +{ + map & + table = ( map & ) *this ; + + table[Ports::Calcium_Ports::E0_SCHEM ] = CalciumTypes::E0_SCHEM ; + table[Ports::Calcium_Ports::E1_SCHEM ] = CalciumTypes::E1_SCHEM ; + table[Ports::Calcium_Ports::UNDEFINED_EXTRA_SCHEM ] = CalciumTypes::UNDEFINED_EXTRA_SCHEM ; +} + + +CalciumTypes::ExtrapolationSchem EXTRAPOLATION_SCHEM::operator[]( const Ports::Calcium_Ports::ExtrapolationSchem &c ) const +{ + map &table = + (map& ) *this ; + + assert( table.find( (Ports::Calcium_Ports::ExtrapolationSchem)c ) != table.end() ) ; + return table[ (Ports::Calcium_Ports::ExtrapolationSchem)c ] ; +} + +const EXTRAPOLATION_SCHEM extrapolationSchem ; diff --git a/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.hxx b/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.hxx new file mode 100644 index 000000000..c9701863b --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CorbaTypes2CalciumTypes.hxx @@ -0,0 +1,62 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $ +// Id : $Id$ + +#ifndef _CORBATYPES_TO_CALCIUMTYPES_HXX_ +#define _CORBATYPES_TO_CALCIUMTYPES_HXX_ + +#include "Calcium_Ports.hh" +#include "CalciumTypes.hxx" + +#include +#include + + +class DATE_CAL_SCHEM : public std::map +{ +public : + + DATE_CAL_SCHEM(); + CalciumTypes::DateCalSchem operator[]( const Ports::Calcium_Ports::DateCalSchem &c ) const; +}; + + +extern const DATE_CAL_SCHEM dateCalSchem ; + +class DEPENDENCY_TYPE : public std::map +{ +public : + + DEPENDENCY_TYPE(); + CalciumTypes::DependencyType operator[]( const Ports::Calcium_Ports::DependencyType &c ) const; +}; + +extern const DEPENDENCY_TYPE dependencyType ; + +class INTERPOLATION_SCHEM : public std::map +{ +public : + + INTERPOLATION_SCHEM(); + CalciumTypes::InterpolationSchem operator[]( const Ports::Calcium_Ports::InterpolationSchem &c ) const; +} ; + +extern const INTERPOLATION_SCHEM interpolationSchem ; + +class EXTRAPOLATION_SCHEM : public std::map +{ +public : + + EXTRAPOLATION_SCHEM(); + CalciumTypes::ExtrapolationSchem operator[]( const Ports::Calcium_Ports::ExtrapolationSchem &c ) const; +} ; + +extern const EXTRAPOLATION_SCHEM extrapolationSchem ; + + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/Makefile.am b/src/DSC/DSC_User/Datastream/Calcium/Makefile.am new file mode 100644 index 000000000..3bdabe92a --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/Makefile.am @@ -0,0 +1,132 @@ +# 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 + +# +# =============================================================== +# Header to be installed +# =============================================================== +# +# header files +salomeinclude_HEADERS = calcium_port_factory.hxx \ + CorbaTypes2CalciumTypes.hxx \ + CalciumTypes2CorbaTypes.hxx \ + CalciumGenericProvidesPort.hxx \ + calcium_uses_port.hxx \ + CalciumGenericUsesPort.hxx \ + calcium_provides_port.hxx \ + CalciumProvidesPort.hxx \ + calcium_integer_port_uses.hxx \ + calcium_real_port_uses.hxx \ + calcium_double_port_uses.hxx \ + calcium_string_port_uses.hxx \ + calcium_logical_port_uses.hxx \ + calcium_complex_port_uses.hxx \ + CalciumCouplingPolicy.hxx \ + CalciumException.hxx \ + CalciumTypes.hxx \ + CalciumCxxInterface.hxx \ + CalciumInterface.hxx \ + Copy2UserSpace.hxx \ + Copy2CorbaSpace.hxx \ + CalciumPortTraits.hxx \ + calcium.h \ + Calcium.hxx \ + calciumP.h \ + version.h \ + calcium.hf + +EXTRA_DIST=fortoc.h +# +# =============================================================== +# 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/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 +# =============================================================== +# +noinst_LTLIBRARIES = libSalomeCalcium.la + +libSalomeCalcium_la_SOURCES = calcium_port_factory.cxx \ + calcium_uses_port.cxx \ + calcium_provides_port.cxx\ + calcium_repository_types.cxx \ + CalciumCouplingPolicy.cxx \ + CorbaTypes2CalciumTypes.cxx \ + CalciumTypes2CorbaTypes.cxx \ + CalciumProvidesPort.cxx \ + Calcium.cxx \ + calcium_destructors_port_uses.cxx + +libSalomeCalcium_la_CXXFLAGS = $(COMMON_CPPFLAGS) + +libSalomeCalcium_la_LDFLAGS = -no-undefined -version-info=0:0:0 + +AM_CFLAGS = -fexceptions +lib_LTLIBRARIES = libCalciumC.la +libCalciumC_la_SOURCES = Calcium.c Calcium.cxx calciumf.c +libCalciumC_la_CXXFLAGS = $(COMMON_CPPFLAGS) + +# +# =============================================================== +# Executables targets +# =============================================================== +# +noinst_PROGRAMS = test_DataIdContainer +## testInterpolation +## testInterpolation_SOURCES = testInterpolation.cxx +## testInterpolation_CXXFLAGS = -I/usr/include + +test_DataIdContainer_SOURCES = test_DataIdContainer.cxx + +test_DataIdContainer_CXXFLAGS = $(COMMON_CPPFLAGS) + +test_DataIdContainer_LDADD = libSalomeCalcium.la $(top_builddir)/src/Utils/libOpUtil.la + +test_DataIdContainer_LDFLAGS = $(COMMON_LIBS) + diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium.h b/src/DSC/DSC_User/Datastream/Calcium/calcium.h new file mode 100644 index 000000000..b90d5499f --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium.h @@ -0,0 +1,761 @@ +/* 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 : calcium.h + * Author : Eric Fayolle (EDF) + * Module : KERNEL + */ + +/* Outils d'Aide au Couplage de Code de Calcul : $Id$ */ + +#ifndef __CALCIUM_H +#define __CALCIUM_H + +#include +#include + +#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) +#define CPNeedPrototype 1 +#else +#define CPNeedPrototype 0 +#endif + + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +/* */ +/* */ +/* Fonctions de connexion */ +/* */ +/* */ +extern int cp_cd( +/* ----- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + char * /* S Nom de l instance appelante*/ +#endif +); + + +/* */ +/* */ +/* Fonction de deconnexion */ +/* */ +/* */ +extern int cp_fin( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Directive de continuation */ + /* CP_CONT ou CP_ARRET */ +#endif +); + + + +/* */ +/* */ +/* Fonctions de lecture bloquante */ +/* */ +/* */ +extern int cp_len( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + float * /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + float * /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration a lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + int * /* S Tableau d'entiers pour stocker les */ + /* valeurs lues */ +#endif +); + +extern int cp_lre( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + float * /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + float * /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration a lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + float * /* S Tableau de flottants pour stocker les */ + /* valeurs lues */ +#endif +); + +extern int cp_ldb( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + double* /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + double* /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration a lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + double* /* S Tableau de doubles pour stocker les */ + /* valeurs lues */ +#endif +); + +extern int cp_lcp( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + float * /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + float * /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + float * /* S Tableau de flottants pour stocker les */ + /* valeurs lues (dimension = 2 * le nombre */ + /* de valeurs lues) */ +#endif +); + +extern int cp_llo( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + float * /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + float * /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration a lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + int * /* S Tableau d 'entier pour stocker les */ + /* valeurs lues (remplace le logiques) */ +#endif +); + +extern int cp_lch( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + float * /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + float * /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration a lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + char *[]/* S Tableau de chaines pour stocker les */ + /* valeurs lues (remplace le logiques) */, + int /* E Taille des chaines du tablaeu */ +#endif +); + + + +/* */ +/* */ +/* Fonctions de lecture non bloquantes */ +/* */ +/* */ +extern int cp_nlen( +/* ------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + float * /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + float * /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration a lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + int * /* S Tableau d'entiers pour stocker les */ + /* valeurs lues */ +#endif +); + +extern int cp_nlre( +/* ------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + float * /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + float * /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration a lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + float * /* S Tableau de flottants pour stocker les */ + /* valeurs lues */ +#endif +); + +extern int cp_nldb( +/* ------- */ + +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + double */* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + double */* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration a lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + double* /* S Tableau de doubles pour stocker les */ + /* valeurs lues */ +#endif +); + +extern int cp_nlcp( +/* ------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + float * /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + float * /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + float * /* S Tableau de flottants pour stocker les */ + /* valeurs lues (dimension = 2 * le nombre */ + /* de valeurs lues) */ +#endif +); + +extern int cp_nllo( +/* ------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + float * /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + float * /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration a lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + int * /* S Tableau d 'entier pour stocker les */ + /* valeurs lues (remplace le logiques) */ +#endif +); + +extern int cp_nlch( +/* ------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance ou de lecture */ + /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */, + float * /* E/S Borne inf de l'intervalle de lecture */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + float * /* E Borne Sup de l'intervalle de lecture */, + int * /* E/S Pas d'iteration a lire */ + /* Retourne le pas lu dans le cas de */ + /* lecture sequentielle */, + char * /* E Nom de la variable a lire */, + int /* E Nombre max de valeurs a lire */, + int * /* S Nombre de valeurs rellement lues */, + char *[]/* S Tableau de chaines pour stocker les */ + /* valeurs lues (remplace le logiques) */, + int /* E Taille des chaines du tablaeu */ +#endif +); + + + + +/* */ +/* */ +/* Fonctions d'ecriture */ +/* */ +/* */ + +extern int cp_een( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance */ + /* CP_TEMPS, CP_ITERATION */, + float /* E Pas de temps a ecrire */, + int /* E Pas d'iteration a ecrire */, + char * /* E Nom de la variable a ecrire */, + int /* E Nombre de valeurs a ecrire */, + int * /* E Tableau d'entiers a ecrire */ +#endif +); + +extern int cp_ere( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance */ + /* CP_TEMPS, CP_ITERATION */, + float /* E Pas de temps a ecrire */, + int /* E Pas d'iteration a ecrire */, + char * /* E Nom de la variable a ecrire */, + int /* E Nombre de valeurs a ecrire */, + float * /* E Tableau de flottants a ecrire */ +#endif +); + +extern int cp_edb( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance */ + /* CP_TEMPS, CP_ITERATION */, + double /* E Pas de temps a ecrire */, + int /* E Pas d'iteration a ecrire */, + char * /* E Nom de la variable a ecrire */, + int /* E Nombre de valeurs a ecrire */, + double* /* E Tableau de doubles a ecrire */ +#endif +); + +extern int cp_ecp( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance */ + /* CP_TEMPS, CP_ITERATION */, + float /* E Pas de temps a ecrire */, + int /* E Pas d'iteration a ecrire */, + char * /* E Nom de la variable a ecrire */, + int /* E Nombre de valeurs a ecrire */, + float * /* E Tableau de flottants a ecrire */ + /* (dimension = 2 * le nombre de valeurs */ + /* a ecrire */ +#endif +); + +extern int cp_elo( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance */ + /* CP_TEMPS, CP_ITERATION */, + float /* E Pas de temps a ecrire */, + int /* E Pas d'iteration a ecrire */, + char * /* E Nom de la variable a ecrire */, + int /* E Nombre de valeurs a ecrire */, + int * /* E Tableau d'entiers a ecrire */ +#endif +); + +extern int cp_ech( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Type de dependance */ + /* CP_TEMPS, CP_ITERATION */, + float /* E Pas de temps a ecrire */, + int /* E Pas d'iteration a ecrire */, + char * /* E Nom de la variable a ecrire */, + int /* E Nombre de valeurs a ecrire */, + char *[]/* E Tableau de chaines a ecrire */, + int /* E Taille des chaines a ecrire */ +#endif +); + + + + +/* */ +/* */ +/* Fonctions de fin de pas */ +/* */ +/* */ +extern int cp_aufp( +/* ------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */ +#endif +); + +extern int cp_infp( +/* ------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */ +#endif +); + +extern int cp_fini( +/* ------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Tous les pas <= a cette valeur */ + /* seront oublies par le coupleur */ +#endif +); + +extern int cp_fint( +/* ------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + float /* E Tous les pas <= a cette valeur */ + /* seront oublies par le coupleur */ +#endif +); + + + +/* */ +/* */ +/* Fonctions d'effacement */ +/* */ +/* */ +extern int cp_effi( +/* ------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + char * /* E Nom de la variable a effacer */, + int /* E Tous les pas >= a cette valeurt */ + /* seront effaces par le coupleur */ +#endif +); + + +extern int cp_efft( +/* ------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + char * /* E Nom de la variable a effacer */, + float /* E Tous les pas >= a cette valeur */ + /* seront effaces par le coupleur */ +#endif +); + + + +/* */ +/* */ +/* Fonctions de mode d'execution */ +/* */ +/* */ +extern int cp_pause( +/* -------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */ +#endif +); + +extern int cp_run( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */ +#endif +); + +extern int cp_npas( +/* ------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Nombre de pas a executer */ +#endif +); + + + +/* */ +/* */ +/* Fonctions de configuration dynamique */ +/* */ +/* */ +extern int cp_dfcode( +/* -------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + char * /* E Declaration du code */ +#endif +); + +extern int cp_dfinst( +/* -------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + char * /* E Declaration de l'instance */ +#endif +); + +extern int cp_dflien( +/* -------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + char * /* E Declaration du lien */ +#endif +); + + + +/* */ +/* */ +/* Fonctions d'interrogation */ +/* */ +/* */ +extern int cp_ivers( +/* -------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + char * /* S Repertoire ACCC */, + char * /* S Repertoire ACCC */ +#endif +); + + +extern int cp_icd( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Longueur du tableau passe en parametre */, + int * /* S Nombre de codes retournes */, + char *[]/* S Tableau contenant les noms des codes */ +#endif +); + +extern int cp_iincd( +/* -------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + char * /* E Nom du code dont on veut les instances */, + int /* E Longueur du tableau passe en parametre */, + int * /* S Nombre d'instances retournees */, + char *[]/* S Tableau contenant les noms des instances */ +#endif +); + +extern int cp_ivr( +/* ------ */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Longueur des tableaux passes en parametre */, + int * /* S Nombre de variables retournees */, + char *[]/* S Tableau contenant les noms des instances */, + char *[]/* S Tableau contenant les noms des variables */ +#endif +); + +extern int cp_ivrcd( +/* -------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + char * /* E Nom du code dont on veut les variables */, + int /* E Longueur des tableaux passes en parametre */, + int * /* S Nombre de variables retournees */, + char *[]/* S Tableau contenant les noms des variables */ +#endif +); + +extern int cp_ivrin( +/* -------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + char * /* E Nom de l'instance dont on veut la liste */ + /* des variables */, + char * /* S Nom du code pere de l'instance */, + int /* E Longueur du tableau pour les variables */ + /* entrantes */, + int /* E Longueur du tableau pour les variables */ + /* sortantes */, + int * /* S Nombre de variables entrantes retournees */, + int * /* S Nombre de variables sortantes retournees */, + char *[]/* S Tableau contenant les noms des variables */ + /* entrantes */, + char *[]/* S Tableau contenant les noms des variables */ + /* sortantes */ +#endif +); + +extern int cp_icavr( +/* -------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + char * /* E Nom de l'instance contenant la variable */, + char * /* E Nom local de la variable */, + int * /* S Sens de la variable */, + int * /* S Dependance de la variable */, + int * /* S Type de la variable */, + int /* E Longueur des tableaux permettant de */ + /* recueillir les pas de temps et d'iteration*/, + int * /* S Nombre de codes retournes */, + float * /* S Tableau contenant les pas de temps */, + int * /* S Tableau contenant les pas d'iterations */ +#endif +); + +extern int cp_ilien( +/* -------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + char * /* E Nom global de la variable */, + int /* E Longueur des tableaux pour les noms des */ + /* instances et des variables */, + int * /* S Nombre de variables participant au lien */, + char *[]/* S Tableau contenant les noms des instances */, + char *[]/* S Tableau contenant les noms des variables */, + int * /* S Type du lien */, + int * /* S Niveau du lien */, + int * /* S Tableau des parametres d'interpolation */ + /* des variables entrantes */, + float * /* S Tableau des valeurs de delta utilisees */ + /* pour les variables entrantes */, + int * /* S Tableau des parametres d'extrapolation */ + /* des variables entrantes */ +#endif +); + + + +/* */ +/* */ +/* Fonctions de manipulation d'options */ +/* */ +/* */ +extern int cp_setopt( +/* --------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Numero identifiant l'option a modifier */, + int /* E Valeur a donner a l'option */ +#endif +); + +extern int cp_getopt( +/* --------- */ +#if CPNeedPrototype + void * component /* Pointeur de type Superv_Component_i* sur le */ + /* composant SALOME Supervisable */, + int /* E Numero identifiant l'option a consulter */, + int * /* S Valeur recupereee de l'option */ +#endif +); + + + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium.hf b/src/DSC/DSC_User/Datastream/Calcium/calcium.hf new file mode 100644 index 000000000..00715c037 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium.hf @@ -0,0 +1,103 @@ +C Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +C CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +C +C This library is free software; you can redistribute it and/or +C modify it under the terms of the GNU Lesser General Public +C License as published by the Free Software Foundation; either +C version 2.1 of the License. +C +C This library is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +C Lesser General Public License for more details. +C +C You should have received a copy of the GNU Lesser General Public +C License along with this library; if not, write to the Free Software +C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +C +C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +C +C +C +C File : version.h +C Author : Eric Fayolle (EDF) +C Module : KERNEL +C +C Outils d'Aide au Couplage de Code de Calcul : $Id$ + + INTEGER CP_ENTIER, CP_REEL, CP_DREEL, CP_COMPLEXE, + . CP_LOGIQUE, CP_CHAINE, + . ENTIER,REEL,DREEL,COMPLEXE,LOGIQUE,CHAINE, + . CP_NORMALE, CP_ANORMALE, + . CP_CONT, CP_ARRET, + . CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL, + . CP_IN, CP_OUT, + . IN, OUT, + . CP_ILLIMITE, CP_AUTESP, + . CP_LINEAIRE, CP_ESCALIER, CP_AUCUNE, + . CP_ROUTE, CP_ERREURS, + . CP_ROUTE_NORMAL, CP_ROUTE_DIRECT, + . CP_AUTO, CP_BLOCAGE, CP_MANUEL, + . CP_ATTENTE, CP_IMMEDIATE + INTEGER CPLVAV, CPLVAF, CPLVAS, CPLCAV, CPLFAV, + . VARIABLE_LEN, CODE_LEN, INSTANCE_LEN, + . CPOK, CPEIU, CPNMVR, CPIOVR, CPTP, CPTPVR, + . CPIT, CPITVR, CPRENA, CPDNTP, CPDNDI, + . CPNMCD, CPNMIN, CPATTENTE, CPBLOC, CPNTNULL, + . CPLGVR, CPSTOP, CPATAL, CPNOCP, CPCTVR, + . CPPASNULL, CPMACHINE, CPGRNU, CPGRIN, + . CPFINFICH, CPERRFICH, CPNORERR, CPRUNERR, + . CPOPT, CPVALOPT, CPECREFF, CPLIEN, CPINARRET, + . CPSTOPSEQ, CPDECL, CPINEXEC, CPPVM, CPERRINST + + PARAMETER (VARIABLE_LEN = 144 , + . CODE_LEN = 72 , + . INSTANCE_LEN = 72) + + PARAMETER (CP_NORMALE = 10, CP_ANORMALE = 11) + + PARAMETER (CP_CONT = 20, CP_ARRET = 21) + + PARAMETER (CP_ENTIER = 30, CP_REEL = 31, + . CP_DREEL = 32, CP_COMPLEXE = 33, + . CP_LOGIQUE = 34, CP_CHAINE = 35) + + PARAMETER (ENTIER = 30, REEL = 31, + . DREEL = 32, COMPLEXE = 33, + . LOGIQUE = 34, CHAINE = 35) + + PARAMETER (CP_TEMPS= 40, CP_ITERATION = 41, + . CP_SEQUENTIEL = 42) + + PARAMETER (CP_IN = 50, CP_OUT = 51) + PARAMETER (IN = 50, OUT = 51) + + PARAMETER (CP_ILLIMITE = -70, CP_AUTESP = -71) + + PARAMETER (CP_LINEAIRE = 100, CP_ESCALIER = 101, CP_AUCUNE = 121) + + PARAMETER (CP_ROUTE = 131, CP_ERREURS = 132) + + PARAMETER (CP_ROUTE_NORMAL = 133, CP_ROUTE_DIRECT = 134) + + PARAMETER (CP_AUTO = 135, CP_BLOCAGE = 136, CP_MANUEL = 137) + + PARAMETER (CP_ATTENTE = 24, CP_IMMEDIATE = 141) + + PARAMETER (CPLVAV = 151, CPLVAF = 152, CPLVAS = 153, + . CPLCAV = 154, CPLFAV = 155) + + PARAMETER (CPOK = 0 , CPEIU = 1 , CPNMVR = 2, + . CPIOVR = 3 , CPTP = 4 , CPTPVR = 5, + . CPIT = 6 , CPITVR = 7 , CPRENA = 8, + . CPDNTP = 9 , CPDNDI = 10, CPNMCD = 11, + . CPNMIN = 12, CPATTENTE = 13, CPBLOC = 14, + . CPNTNULL = 15, CPLGVR = 16, CPSTOP = 17, + . CPATAL = 18, CPNOCP = 19, CPCTVR = 20, + . CPPASNULL = 21, CPMACHINE = 22, CPGRNU = 23, + . CPGRIN = 24, CPFINFICH = 25, CPERRFICH = 26, + . CPNORERR = 27, CPRUNERR = 28, CPOPT = 29, + . CPVALOPT = 30, CPECREFF = 31, CPLIEN = 32, + . CPINARRET = 33, CPSTOPSEQ = 34, CPDECL = 35, + . CPINEXEC = 36, CPPVM = 37, CPERRINST = 38) + diff --git a/src/DSC/DSC_User/Datastream/Calcium/calciumP.h b/src/DSC/DSC_User/Datastream/Calcium/calciumP.h new file mode 100644 index 000000000..447851d4f --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calciumP.h @@ -0,0 +1,547 @@ +/* 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 : calciumP.h + * Author : Eric Fayolle (EDF) + * Module : KERNEL + */ + +/* Outils d'Aide au Couplage de Code de Calcul : $Id$ */ +#ifndef __CONST_H +#define __CONST_H + +#ifndef TrueOrFalse +#define TrueOrFalse int +#define TRUE 1 +#define FALSE 0 +#endif + +/* Definition d'un type de donnes pour le stockage du */ +/* des pas de temps */ +#ifdef CRAY +#define Temps float +#define FORMAT_TEMPS "%lf" +#else +#define Temps double +#define FORMAT_TEMPS "%lg" +#endif + +/* Precision relative pour tests d'egalite sur les temps */ +#define EPSILON 1.e-6 + +/* Tailles utilisees lors des transmissions des noms */ +#define VERSION_LEN 144 +#define CODE_LEN 72 +#define VARIABLE_LEN 144 +#define INSTANCE_LEN 72 +#define DRIVER_LEN 72 + + +/* Tailles maximums */ +#define ARCHI_LEN 64 +#define ENV_VAR_LEN 256 +#define ACCC_LEN 256 +#define PVM_LEN 256 +#define USER_LEN 256 +#define MACHINE_LEN 256 +#define COMMAND_LEN 256 +#define MAX_LEN 256 +#define FICHIER_LEN 256 + +/* Nombre de lignes dans une page du fichier erreur * + * de trace */ +#define NB_LIGNE_ERREUR 45 +#define NB_LIGNE_TRACE 45 + + + +/* Type d'arret d'une instance */ +#define CP_NORMALE 10 +#define CP_ANORMALE 11 + +/* Directive de continuation d'une instance */ +#define CP_CONT 20 +#define CP_ARRET 21 + +/* Etat d'une instance */ +#define CP_INITIAL 22 +#define CP_NON_CONNECTE 23 +#define CP_ATTENTE 24 +#define CP_EXECUTION 25 +#define CP_DECONNECTE 26 +#define CP_TERMINE 27 + +/* Type de variables */ +#define CP_ENTIER 30 +#define CP_REEL 31 +#define CP_DREEL 32 +#define CP_COMPLEXE 33 +#define CP_LOGIQUE 34 +#define CP_CHAINE 35 + +/* Type de dependance des variables */ +#define CP_TEMPS 40 +#define CP_ITERATION 41 +#define CP_SEQUENTIEL 42 + +/* Send des variables */ +#define CP_IN 50 +#define CP_OUT 51 + +/* Type des instances */ +#define CP_NORMAL 60 +#define CP_ESPION 62 + +/* Niveaux */ +#define CP_ILLIMITE -70 +#define CP_AUTESP -71 + +/* Mode de trace */ +#define CP_SANS 80 +#define CP_SUCCINCT 81 +#define CP_DETAILLE 82 + + +/* Mode d'execution */ +/* La valeur CP_NORMAL definie pour les types */ +/* est aussi utilisee */ +#define CP_PAUSE 91 + + +/* Type d'interpolation */ +#define CP_LINEAIRE 100 +#define CP_ESCALIER 101 + + +/* Repere dans cycle de temps */ +#define TI 110 +#define TF 111 + +/* Mode de nettoyage des donnees d'un lien */ +#define CP_TOUTES 120 +#define CP_AUCUNE 121 +#define CP_PAS 122 + +/* Options configurables */ +#define CP_ROUTE 131 +#define CP_ERREURS 132 + +/* Valeurs pour l'option CP_ROUTE */ +#define CP_ROUTE_NORMAL 133 +#define CP_ROUTE_DIRECT 134 + +/* Valeurs pour l'option Comportement en cas d'erreur */ +#define CP_AUTO 135 +#define CP_BLOCAGE 136 +#define CP_MANUEL 137 + +/* Type de requete de lecture */ +/* La valeur CP_ATTENTE define pour l'etat d'une */ +/* instance est aussi utilisee */ +#define CP_IMMEDIATE 141 + +/* Definition des types de lien */ +#define CPLVAV 151 +#define CPLVAF 152 +#define CPLVAS 153 +#define CPLCAV 154 +#define CPLFAV 155 + +/* Codes des entetes des messages (Evenemet *) */ +#define ERREUR 1000 +#define CONNEXION 1001 +#define EMISSION 1002 +#define DECONNEXION 1003 +#define LECTURE_VARIABLE 1004 +#define ECRITURE_VARIABLE 1005 +#define FIN_DE_PAS 1006 +#define AUIN_FIN_DE_PAS 1007 +#define EFFACEMENT 1008 +#define MODE_EXEC 1009 +#define RUN_N_PAS 1010 +#define DEF_CODE 1011 +#define DEF_INSTANCE 1012 +#define DEF_LIEN 1013 +#define DEM_VERSION 1014 +#define SET_OPTION 1015 +#define DEM_OPTION 1016 +#define DEM_CODES 1017 +#define DEM_INSTS_DE_CODE 1018 +#define DEM_VARIABLES 1019 +#define DEM_VARS_DE_CODE 1020 +#define DEM_VARS_DE_INST 1021 +#define DEM_CARS_DE_VARIABLE 1022 +#define DEM_CARS_DE_LIEN 1023 +#define ENV_VALEURS_VARIABLE 1024 +#define ENV_OPTION 1025 +#define ENV_CODES 1026 +#define ENV_INSTS_DE_CODE 1027 +#define ENV_VARIABLES 1028 +#define ENV_VARS_DE_CODE 1029 +#define ENV_VARS_DE_INST 1030 +#define ENV_CARS_DE_VARIABLE 1031 +#define ENV_CARS_DE_LIEN 1032 +#define ENV_TOPOLOGY 1033 +#define R_ENV_TOPOLOGY 1034 +#define ENV_MACHINE 1035 +#define R_ENV_MACHINE 1036 +#define ENV_CODE 1037 +#define R_ENV_CODE 1038 +#define ENV_INSTANCE 1039 +#define R_ENV_INSTANCE 1040 +#define ENV_VAR 1041 +#define R_ENV_VAR 1042 +#define ENV_LIEN 1043 +#define R_ENV_LIEN 1044 +#define ENV_ATTRIBUTS 1045 +#define R_ENV_ATTRIBUTS 1046 +#define ENV_VDATA 1047 +#define R_ENV_VDATA 1048 + + + + + + + + + +/* Message PVM */ +#define P_HOST_DELETE 2000 +#define P_TASK_EXIT 2001 + + + + + +/* Codes d'erreur */ + +/* Pas d'erreur */ +#define CPOK 0 + +/* Emetteur inconnu */ +#define CPERIU 1 + +/* Nom de variable inconnu */ +#define CPNMVR 2 + +/* Type entree/sortie incompatible */ +#define CPIOVR 3 + +/* Type inconnu */ +#define CPTP 4 + +/* Type de variable incompatible */ +#define CPTPVR 5 + +/* Mode de dependance inconnu */ +#define CPIT 6 + +/* Mode dependance incompatible */ +#define CPITVR 7 + +/* Requete non autorisee */ +#define CPRENA 8 + +/* Type de deconnexion incorrect */ +#define CPDNTP 9 + +/* Directive de deconnexion incorrecte */ +#define CPDNDI 10 + +/* Nom de code inconnu */ +#define CPNMCD 11 + +/* Nom d'instance inconnu */ +#define CPNMIN 12 + +/* Attente */ +#define CPATTENTE 13 + +/* Blocage */ +#define CPBLOC 14 + +/* Nombre de valeurs transmises egal a zero */ +#define CPNTNULL 15 + +/* Longueur de variable insuffisante */ +#define CPLGVR 16 + +/* L'instance doit s'arreter */ +#define CPSTOP 17 + +/* Arret anormal */ +#define CPATAL 18 + +/* Coupleur abscent */ +#define CPNOCP 19 + +/* Variable sortante non connectee */ +#define CPCTVR 20 + +/* Nombre de pas a executer egal a zero */ +#define CPPASNULL 21 + +/* Machine inconnue */ +#define CPMACHINE 22 + +/* COUPLAGE_GROUPE non positionnee */ +#define CPGRNU 23 + +/* Groupe d'instances incorrect */ +#define CPGRIN 24 + +/* Fin du fichier d'entree */ +#define CPFINFICH 25 + +/* Erreur de format dans un fichier */ +#define CPERRFICH 26 + +/* Requete d'avance de n pas annullee */ +/* par passage en mode NORMAL */ +#define CPNORERR 27 + +/* Coupleur en mode NORMAL pour une */ +/* requete RUN_N_PAS ou DEF_* */ +#define CPRUNERR 28 + +/* Option inconnue */ +#define CPOPT 29 + +/* Valeur d'option inconnue */ +#define CPVALOPT 30 + +/* Ecriture impossible par effacement */ +#define CPECREFF 31 + +/* Lecture d'une variable non connectee */ +/* ou n'appartenant pas a un lien VAS */ +/* ou VAV s'il s'agit d'une sortante */ +#define CPLIEN 32 + +/* Lecture d'une variable d'une instance*/ +/* deconnectee avec directive CP_ARRET */ +#define CPINARRET 33 + +/* Les lectures sequentielles ne pourront plus */ +/* etre satisfaites : instance productrice arretee */ +#define CPSTOPSEQ 34 + +/* Erreur dans la chaine de declaration */ +#define CPDECL 35 + +/* Erreur dans l'execution de l'instance ajoutee */ +#define CPINEXEC 36 + +/* Erreur PVM */ +#define CPPVM 37 + +/* Erreur detectee au niveau de l'interface de couplage */ +#define CPERRINST 38 + + +/* IDM : les deux define suivants ont ete rajoutes a la main*/ + +/* Erreur de mode d'execution non defini */ +#define CPMODE 39 + +/* Erreur d'instance deconnectee */ +#define CPINSTDEC 40 + +/* Codes des evenements pour le fichier de trace */ + +/* Debut du couplage */ +#define DEBUT_COUPLAGE 0 + +/* Fin du couplage */ +#define FIN_COUPLAGE 1 + +/* Execution d'une instance par Oacc */ +#define EXEC 2 + +/* Connexion d'une instance */ +#define CPCD 3 + +/* Permission d'emettre accordee a l'instance */ +#define CPALLOW 4 + +/* Requete d'ecriture */ +#define CPECRI 5 + +/* Requete de lecture */ +#define DEB_LECT 6 + +/* Envoi des donnees suite a une requete de lecture */ +#define FIN_LECT 7 + +/* Deconnexion d'une instance */ +#define CPFIN 8 + +/* Requete de fin de pas */ +#define CPFINP 9 + +/* Requete d'autorisation de fin de pas */ +#define CPAUFP 10 + +/* Requete d'interdiction de fin de pas */ +#define CPINFP 11 + +/* Requete d'effacement */ +#define CPEFF 12 + +/* Signal d'arret d'une instance */ +#define STOP 13 + +/* Avis de blocage suite a une requete de lecture */ +#define BLOCAGE 14 + +/* Requete de passage en mode pause */ +#define CPPAUSE 15 + +/* Requete de passage en mode normal */ +#define CPNORMAL 16 + +/* Requete d'execution de n pas */ +#define CPNPAS 17 + +/* Requete de definition d'un code */ +#define CPADCD 18 + +/* Requete de definition d'une instance */ +#define CPADINCD 19 + +/* Requete de definition d'un lien */ +#define CPADLN 20 + +/* Requete d'identification de version */ +#define CPIVERS 21 + +/* Requete de demande de la liste des codes */ +#define CPICD 22 + +/* Requete de demande des instances d'un code */ +#define CPIINCD 23 + +/* Requete de demande de la liste des variables globales*/ +#define CPIVR 24 + +/* Requete de demande des variables d'un code */ +#define CPIVRCD 25 + +/* Requete de demande des variables d'une instance */ +#define CPIVRIN 26 + +/* Requete de demande d'info sur une variable globale */ +#define CPICAVR 27 + +/* Requete de demande des caracteristiques d'un lien */ +#define CPIILIEN 28 + +/* Requete de modification d'une option */ +#define CPSETOPT 29 + +/* Requete de consultation d'une option */ +#define CPGETOPT 30 + +/* Terminaison d'une tache PVM */ +#define TASK_EXIT 31 + +/* Deconnexion d'une machine */ +#define HOST_DELETE 32 + + +#ifdef PRG_MAIN +/* Fichier principal de la bibliotheque de couplage */ + + +char * CPMESSAGE[] = { + "Pas d'erreur", + "Emetteur inconnu", + "Nom de la variable inconnu", + "Code entree/sortie differents dans le coupleur et dans le code", + "Type de variable inconnu", + "Types de variable differents dans le coupleur et dans le code", + "Mode de dependance inconnu", + "Modes de dependance differents dans le coupleur et dans le code", + "Requete non autorisee", + "Type de deconnexion incorrect", + "Directive de deconnexion incorrecte", + "Nom de code inconnu", + "Nom d'instance inconnu", + "Requete en attente", + "Cas de blocage", + "Nombre de valeurs transmises egal a zero", + "Longueur de variable insuffisante", + "L'instance doit s'arreter", + "Arret anormal d'une instance", + "Coupleur abscent, execution manuelle", + "Variable sortante non connectee", + "Nombre de pas a executer egal a zero", + "Machine non declaree", + "La variable d'environnement COUPLAGE_GROUPE n'est pas positionnee", + "Le groupe d'instances indique par COUPLAGE_GROUPE est incorrect", + "Fin du fichier d'entree", + "Erreur de format dans le fichier d'entree", + "Requete annulee a cause du passage en mode NORMAL", + "Le coupleur est en mode d'execution normal", + "Option inconnue", + "Valeur d'option incorrecte", + "Ecriture impossible a cause d'une requete d'effacement", + "Lecture d'une variable incorrectement connectee", + "Lecture d'une variable d'une instance deconnectee avec CP_ARRET", + "Lectures sequentielles plus satisfaites", + "Erreur dans la chaine de declaration", + "Erreur dans le lancement de l'instance ajoutee", + "Erreur PVM", + "Erreur detectee au niveau de l'instance", + }; + +#else + +extern char * CPMESSAGE[]; + +#endif + + +/* Type de variables */ +#define ENTIER 30 +#define REEL 31 +#define DREEL 32 +#define COMPLEXE 33 +#define LOGIQUE 34 +#define CHAINE 35 + +/* Macro minuscule majuscule */ +#define TOUPPER(string) \ +{\ + int i, number = strlen(string);\ + for (i = 0; i < number; i++) string[i] = toupper(string[i]); \ +} + +/* Macro inferieur */ +#define INF(a,b) (a <= b ? a : b) + +/* Macro superieur */ +#define SUP(a,b) (a >= b ? a : b) + + +#endif + diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_complex_port_uses.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_complex_port_uses.hxx new file mode 100644 index 000000000..8cb99e959 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_complex_port_uses.hxx @@ -0,0 +1,50 @@ +// 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 : calcium_complex_port_uses.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#ifndef _CALCIUM_COMPLEX_PORT_USES_HXX_ +#define _CALCIUM_COMPLEX_PORT_USES_HXX_ + +#include "Calcium_Ports.hh" +#include "GenericUsesPort.hxx" + +extern char _repository_Calcium_Complex_Port_name[]; + +class calcium_complex_port_uses : + public virtual CalciumGenericUsesPort< seq_u_manipulation, + Ports::Calcium_Ports::Calcium_Complex_Port, + _repository_Calcium_Complex_Port_name + > +{ + public : + + virtual ~calcium_complex_port_uses(); + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_destructors_port_uses.cxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_destructors_port_uses.cxx new file mode 100644 index 000000000..10a27414d --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_destructors_port_uses.cxx @@ -0,0 +1,37 @@ +// 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 : calcium_destructors_port_uses.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +#include "calcium_integer_port_uses.hxx" +#include "calcium_real_port_uses.hxx" +#include "calcium_double_port_uses.hxx" +#include "calcium_string_port_uses.hxx" +#include "calcium_logical_port_uses.hxx" +#include "calcium_complex_port_uses.hxx" + +calcium_real_port_uses::~calcium_real_port_uses(void) {}; +calcium_double_port_uses::~calcium_double_port_uses(void) {}; +calcium_integer_port_uses::~calcium_integer_port_uses(void) {}; +calcium_logical_port_uses::~calcium_logical_port_uses(void) {}; +calcium_complex_port_uses::~calcium_complex_port_uses(void) {}; +calcium_string_port_uses::~calcium_string_port_uses(void) {}; diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_double_port_uses.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_double_port_uses.hxx new file mode 100644 index 000000000..93837508d --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_double_port_uses.hxx @@ -0,0 +1,50 @@ +// 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 : calcium_double_port_uses.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#ifndef _CALCIUM_DOUBLE_PORT_USES_HXX_ +#define _CALCIUM_DOUBLE_PORT_USES_HXX_ + +#include "Calcium_Ports.hh" +#include "CalciumGenericUsesPort.hxx" + +extern char _repository_Calcium_Double_Port_name[]; + +class calcium_double_port_uses : + public virtual CalciumGenericUsesPort< seq_u_manipulation, + Ports::Calcium_Ports::Calcium_Double_Port, + _repository_Calcium_Double_Port_name + > +{ + public : + + virtual ~calcium_double_port_uses(); + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx new file mode 100644 index 000000000..3216a20f4 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx @@ -0,0 +1,52 @@ +// 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 : calcium_integer_port_uses.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#ifndef _CALCIUM_INTEGER_PORT_USES_HXX_ +#define _CALCIUM_INTEGER_PORT_USES_HXX_ + +#include + +#include "Calcium_Ports.hh" +#include "CalciumGenericUsesPort.hxx" + +extern char _repository_Calcium_Integer_Port_name[]; + +class calcium_integer_port_uses : + public virtual CalciumGenericUsesPort< seq_u_manipulation, + Ports::Calcium_Ports::Calcium_Integer_Port, + _repository_Calcium_Integer_Port_name + > +{ + public : + + virtual ~calcium_integer_port_uses(); + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_logical_port_uses.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_logical_port_uses.hxx new file mode 100644 index 000000000..6aa8a398d --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_logical_port_uses.hxx @@ -0,0 +1,50 @@ +// 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 : calcium_logical_port_uses.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#ifndef _CALCIUM_LOGICAL_PORT_USES_HXX_ +#define _CALCIUM_LOGICAL_PORT_USES_HXX_ + +#include "Calcium_Ports.hh" +#include "CalciumGenericUsesPort.hxx" + +extern char _repository_Calcium_Logical_Port_name[]; + +class calcium_logical_port_uses : + public virtual CalciumGenericUsesPort< seq_u_manipulation, + Ports::Calcium_Ports::Calcium_Logical_Port, + _repository_Calcium_Logical_Port_name + > +{ + public : + + virtual ~calcium_logical_port_uses(); + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx new file mode 100644 index 000000000..504945a57 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx @@ -0,0 +1,73 @@ +// 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 : calcium_port_factory.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + +#include "calcium_port_factory.hxx" + +calcium_port_factory::calcium_port_factory() {} + +calcium_port_factory::~calcium_port_factory() {} + +provides_port * +calcium_port_factory::create_data_servant(string type) { + provides_port * rtn_port = NULL; + + if ( type == "integer") + rtn_port = new calcium_integer_port_provides(); + if ( type == "real") + rtn_port = new calcium_real_port_provides(); + if ( type == "double") + rtn_port = new calcium_double_port_provides(); + if ( type == "string") + rtn_port = new calcium_string_port_provides(); + if ( type == "logical") + rtn_port = new calcium_logical_port_provides(); + if ( type == "complex") + rtn_port = new calcium_complex_port_provides(); + + return rtn_port; +} + +uses_port * +calcium_port_factory::create_data_proxy(string type) { + uses_port * rtn_port = NULL; + + if ( type == "integer") + rtn_port = new calcium_integer_port_uses(); + if ( type == "real") + rtn_port = new calcium_real_port_uses(); + if ( type == "double") + rtn_port = new calcium_double_port_uses(); + if ( type == "string") + rtn_port = new calcium_string_port_uses(); + if ( type == "logical") + rtn_port = new calcium_logical_port_uses(); + if ( type == "complex") + rtn_port = new calcium_complex_port_uses(); + + return rtn_port; +} diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx new file mode 100644 index 000000000..6cb050411 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_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 : calcium_port_factory.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:36:05 +0100 (jeu, 01 mar 2007) $ +// Id : $Id$ + + +#ifndef _CALCIUM_PORT_FACTORY_HXX_ +#define _CALCIUM_PORT_FACTORY_HXX_ + +#include "port_factory.hxx" +#include "uses_port.hxx" +#include "provides_port.hxx" +#include + +#include "CalciumProvidesPort.hxx" + +#include "calcium_integer_port_uses.hxx" +#include "calcium_real_port_uses.hxx" +#include "calcium_double_port_uses.hxx" +#include "calcium_string_port_uses.hxx" +#include "calcium_logical_port_uses.hxx" +#include "calcium_complex_port_uses.hxx" + +using namespace std; + +class calcium_port_factory : + public port_factory +{ + public: + calcium_port_factory(); + virtual ~calcium_port_factory(); + + virtual provides_port * create_data_servant(string type); + virtual uses_port * create_data_proxy(string type); +}; + +#endif + diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.cxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.cxx new file mode 100644 index 000000000..6f34c26b7 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.cxx @@ -0,0 +1,10 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (Wed, 28 Feb 2007) $ +// Id : $Id$ + +#include "calcium_provides_port.hxx" + +calcium_provides_port::calcium_provides_port() {} + +calcium_provides_port::~calcium_provides_port() {} diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.hxx new file mode 100644 index 000000000..52bf881e8 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_provides_port.hxx @@ -0,0 +1,48 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (Wed, 28 Feb 2007) $ +// Id : $Id$ + +#ifndef _CALCIUM_PROVIDES_PORT_HXX_ +#define _CALCIUM_PROVIDES_PORT_HXX_ + +#include "provides_port.hxx" +#include "CalciumTypes.hxx" + +class calcium_provides_port : public provides_port +{ +public : + + typedef CalciumTypes::DependencyType DependencyType; + typedef CalciumTypes::DateCalSchem DateCalSchem; + typedef CalciumTypes::InterpolationSchem InterpolationSchem; + typedef CalciumTypes::ExtrapolationSchem ExtrapolationSchem; + typedef CalciumTypes::DisconnectDirective DisconnectDirective; + + calcium_provides_port(); + virtual ~calcium_provides_port(); + + virtual void setDependencyType (DependencyType dependencyType) =0; + virtual DependencyType getDependencyType () const =0; + + virtual void setStorageLevel (size_t storageLevel) =0; + virtual size_t getStorageLevel () const =0; + + virtual void setDateCalSchem (DateCalSchem dateCalSchem) =0; + virtual DateCalSchem getDateCalSchem () const =0; + + virtual void setAlpha(double alpha) =0; + virtual double getAlpha() const =0; + + virtual void setDeltaT(double deltaT ) =0; + virtual double getDeltaT() const =0; + + virtual void setInterpolationSchem (InterpolationSchem interpolationSchem) =0; + virtual void setExtrapolationSchem (ExtrapolationSchem extrapolationSchem) =0; + virtual InterpolationSchem getInterpolationSchem () const =0; + virtual ExtrapolationSchem getExtrapolationSchem () const =0; + +}; + +#endif + diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_real_port_uses.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_real_port_uses.hxx new file mode 100644 index 000000000..057fe38b5 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_real_port_uses.hxx @@ -0,0 +1,51 @@ +// 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 : calcium_real_port_uses.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#ifndef _CALCIUM_REAL_PORT_USES_HXX_ +#define _CALCIUM_REAL_PORT_USES_HXX_ + +#include "Calcium_Ports.hh" +#include "CalciumGenericUsesPort.hxx" + + +extern char _repository_Calcium_Real_Port_name[]; + +class calcium_real_port_uses : + public virtual CalciumGenericUsesPort< seq_u_manipulation, + Ports::Calcium_Ports::Calcium_Real_Port, + _repository_Calcium_Real_Port_name + > +{ + public : + + virtual ~calcium_real_port_uses(); + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_repository_types.cxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_repository_types.cxx new file mode 100644 index 000000000..b5d4cf838 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_repository_types.cxx @@ -0,0 +1,41 @@ +// 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 : calcium_repository_types.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + +#include "calcium_integer_port_uses.hxx" +#include "calcium_real_port_uses.hxx" +#include "calcium_double_port_uses.hxx" +#include "calcium_complex_port_uses.hxx" +#include "calcium_logical_port_uses.hxx" +#include "calcium_string_port_uses.hxx" + +char _repository_Calcium_Integer_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0"; +char _repository_Calcium_Real_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"; +char _repository_Calcium_Double_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"; +char _repository_Calcium_Complex_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Complex_Port:1.0"; +char _repository_Calcium_Logical_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Logical_Port:1.0"; +char _repository_Calcium_String_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_String_Port:1.0"; diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_string_port_uses.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_string_port_uses.hxx new file mode 100644 index 000000000..1a9f81955 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_string_port_uses.hxx @@ -0,0 +1,50 @@ +// 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 : calcium_string_port_uses.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#ifndef _CALCIUM_STRING_PORT_USES_HXX_ +#define _CALCIUM_STRING_PORT_USES_HXX_ + +#include "Calcium_Ports.hh" +#include "CalciumGenericUsesPort.hxx" + +extern char _repository_Calcium_String_Port_name[]; + +class calcium_string_port_uses : + public virtual CalciumGenericUsesPort< seq_u_manipulation, + Ports::Calcium_Ports::Calcium_String_Port, + _repository_Calcium_String_Port_name + > +{ + public : + + virtual ~calcium_string_port_uses(); + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_uses_port.cxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_uses_port.cxx new file mode 100644 index 000000000..3a2d61f2d --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_uses_port.cxx @@ -0,0 +1,33 @@ +// 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 : calcium_uses_port.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#include "calcium_uses_port.hxx" + +calcium_uses_port::calcium_uses_port() {} + +calcium_uses_port::~calcium_uses_port() {} diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_uses_port.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_uses_port.hxx new file mode 100644 index 000000000..14fa4b025 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_uses_port.hxx @@ -0,0 +1,43 @@ +// 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 : calcium_uses_port.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#ifndef _CALCIUM_USES_PORT_HXX_ +#define _CALCIUM_USES_PORT_HXX_ + +#include "uses_port.hxx" + +class calcium_uses_port : public uses_port +{ +public : + calcium_uses_port(); + virtual ~calcium_uses_port(); + virtual void disconnect (bool provideLastGivenValue) {}; +}; + +#endif + 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..557e1ed1a --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calciumf.c @@ -0,0 +1,217 @@ +#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(cpllo,CPLLO)(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,"CPLLO: %s %f %f\n",cnom,*ti,*tf); + *err=cp_llo((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); + fprintf(stderr,"End of CPLLO: %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(cplcp,CPLCP)(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,"CPLCP: %s %f %f \n",cnom, *ti,*tf); + *err=cp_lcp((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); + fprintf(stderr,"End of CPLCP: %s %f %f \n",cnom,*ti,*tf); + free_str1(cnom); +} + +void F_FUNC(cplch,CPLCH)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom), + int *max,int *n, char *tab,int *err STR_PLEN(nom) STR_PLEN(tab) ) +{ + char **tabChaine=NULL; + int index=0; + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + fprintf(stderr,"CPLCH: %s %f %f \n",cnom, *ti,*tf); + + tabChaine = (char **) malloc(sizeof(char *) * (*max)); + for (index = 0; index < *max; index++) + tabChaine[index] = (char *) malloc(sizeof(char) * (STR_LEN(tab)+1)); + + *err=cp_lch((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tabChaine,STR_LEN(tab)); + + for (index = 0; index < *n; index++) + strcpy(&tab[index * STR_LEN(tab)], tabChaine[index]); + + fprintf(stderr,"End of CPLCH: %s %f %f \n",cnom,*ti,*tf); + if (tabChaine != (char **) NULL) { + for (index = 0; index < *n; index++) + free(tabChaine[index]); + free(tabChaine); + } + free_str1(cnom); +} + +void F_FUNC(cpech,CPECH)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, char *tab,int *err + STR_PLEN(nom) STR_PLEN(tab)) +{ + char ** tabChaine=NULL; + int index=0,index2=0; + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + fprintf(stderr,"CPECH: %s %f \n",cnom, *ti); + + tabChaine = (char **) malloc(sizeof(char *) * *n); + for (index = 0; index < *n; index++) { + + tabChaine[index] = (char *) malloc(sizeof(char) * (STR_LEN(tab) + 1)); + strncpy(tabChaine[index],&tab[STR_LEN(tab) * index],STR_LEN(tab)); + tabChaine[index][STR_LEN(tab)]='\0'; + for (index2 = STR_LEN(tab) - 1; index2 >= 0; index2--) { + if ( tabChaine[index][index2] == ' ' || + tabChaine[index][index2] == '\0' ) + tabChaine[index][index2]='\0'; + } + } + + *err=cp_ech((void *)*compo,*dep,*ti,*iter,cnom,*n,tabChaine,STR_LEN(tab) ); + + fprintf(stderr,"End of CPECH: %s %f \n",cnom, *ti); + if (tabChaine != (char **) NULL) { + for (index = 0; index < *n; index++) + free(tabChaine[index]); + + free(tabChaine); + } + 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(cpecp,CPECP)(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,"CPECP: %s %f \n",cnom, *ti); + *err=cp_ecp((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); + fprintf(stderr,"End of CPECP: %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(cpelo,CPELO)(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,"CPELO: %s %f %d\n",cnom, *ti,*iter); + *err=cp_elo((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); + fprintf(stderr,"End of CPELO: %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/Calcium/testInterpolation.cxx b/src/DSC/DSC_User/Datastream/Calcium/testInterpolation.cxx new file mode 100644 index 000000000..114560db8 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/testInterpolation.cxx @@ -0,0 +1,117 @@ +// 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 : testInterpolation.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + +#include + +#include +#include +#include +#include +#include +#include + +struct MyRand { + static const double MAXVALUE = 150.0; + MyRand() { srand(getpid()); } + int operator()() const { + return 1+(int) ( MAXVALUE *rand()/(RAND_MAX +1.0)); + } +}; + +int main() { + + typedef long Type; + typedef double TimeType; + const int dataSize1=20; + const int dataSize2=30; + const int dataSize3=std::min< size_t >(dataSize1,dataSize2); + std::vector vect1(dataSize1),vect2(dataSize2),vect3(dataSize3),vect4(dataSize3); + MyRand myRand; + + //TEST1 + std::generate(vect1.begin(),vect1.end(),myRand); + std::cout << "Vecteur1 généré aléatoirement :" << std::endl; + std::copy(vect1.begin(),vect1.end(),std::ostream_iterator(std::cout," ")); + std::cout<< std::endl; + + std::generate(vect2.begin(),vect2.end(),myRand); + std::cout << "Vecteur2 généré aléatoirement :" << std::endl; + std::copy(vect2.begin(),vect2.end(),std::ostream_iterator(std::cout," ")); + std::cout<< std::endl; + + std::vector::iterator + InIt1=vect1.begin(), + InIt2=vect2.begin(), + OutIt1=vect3.begin(), + OutIt2=vect4.begin(); + + TimeType t = 2.4; + TimeType t2 = 3.4; + TimeType t1 = 1.1; + TimeType deltaT = t2-t1; + TimeType coeff = (t2-t)/deltaT; + + // Calcul avec Lambda + boost::lambda::placeholder1_type _1; + boost::lambda::placeholder2_type _2; + + std::transform(InIt1,InIt1+dataSize3,InIt2,OutIt1, ( _1 - _2 ) * coeff + _2 ); + + std::cout << "Vecteur3 calculé :" << std::endl; + std::copy(vect3.begin(),vect3.end(),std::ostream_iterator(std::cout," ")); + std::cout<< std::endl; + + //Calcul sans Lambda + // ERREUR : il faut produire une binary pas avec compose2 + // std::transform(InIt1,InIt1+dataSize3,InIt2,OutIt2, + // //std::minus(), + // __gnu_cxx::compose2(std::minus(), + // // __gnu_cxx::identity(), + // std::bind2nd( std::multiplies(), 1. ), + // std::bind2nd( std::multiplies(), 1.1 ) ) + // ); + // InIt2 =vect2.begin(); + // OutIt2=vect4.begin(); + + // std::transform(InIt2,InIt2+dataSize3,OutIt2,OutIt2, + // std::plus() ); + + // Calcul direct + InIt1=vect1.begin(); InIt2=vect2.begin();OutIt2=vect4.begin(); + for(int i =0; i < dataSize3; ++i) { +// *OutIt2=(*InIt1 - *InIt2) * coeff + *InIt2; +// ++InIt1;++InIt2;++OutIt2; + OutIt2[i]=(InIt1[i] - InIt2[i]) * coeff + InIt2[i]; + } + + std::cout << "Vecteur4 calculé :" << std::endl; + std::copy(vect4.begin(),vect4.end(),std::ostream_iterator(std::cout," ")); + std::cout<< std::endl; + +}; + diff --git a/src/DSC/DSC_User/Datastream/Calcium/test_CalciumInterface.cxx b/src/DSC/DSC_User/Datastream/Calcium/test_CalciumInterface.cxx new file mode 100644 index 000000000..d3bc8dc1e --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/test_CalciumInterface.cxx @@ -0,0 +1,34 @@ +// 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 : test_CalciumInterface.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-06 10:44:23 +0100 (mar, 06 fév 2007) $ +// Id : $Id$ + +//Permet de vérifier la syntaxe du fichier .hxx à la compilation +#include "CalciumInterface.hxx" + +int main(void) { + return 0; +} diff --git a/src/DSC/DSC_User/Datastream/Calcium/test_DataIdContainer.cxx b/src/DSC/DSC_User/Datastream/Calcium/test_DataIdContainer.cxx new file mode 100644 index 000000000..4cee34b94 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/test_DataIdContainer.cxx @@ -0,0 +1,133 @@ +// 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 : test_DataIdContainer.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 15:07:46 +0100 (jeu, 01 mar 2007) $ +// Id : $Id$ + +#include "CalciumCouplingPolicy.hxx" + +#include "CalciumProvidesPort.hxx" +#include "CalciumException.hxx" + +using namespace CalciumTypes; + +class TEST1 : public CalciumCouplingPolicy { +public: + int ret; + TEST1() { + + ret=0; + + CORBA::Long time=1,tag=1; + typedef CalciumCouplingPolicy::DataIdContainer DataIdContainer; + typedef CalciumCouplingPolicy::DataId DataId; + + DataId dataId(time,tag); //potentiellement avec un troisième paramètre + try { + DataIdContainer dataIds(dataId,*this); + + DataIdContainer::iterator dataIdIt = dataIds.begin(); + + if (!dataIds.empty()) + for (;dataIdIt != dataIds.end();++dataIdIt) { + std::cout << "(*dataIdIt) must be equal to given dataId parameter : " << *dataIdIt; + std::cout << " == " << dataId << " : " << (ret = (*dataIdIt == dataId)) << std::endl; + } + } catch(const CalciumException & ex) { + ret=1; + std::cout << ex.what() << std::endl; + } + + } +}; + +class TEST2 : public CalciumCouplingPolicy { + +public: + int ret; + TEST2() { + + // Doit filtrer le mode de dépendance temporel car le mode est + // défini itératif + ret=0; + + CORBA::Long time=1,tag=1; + typedef CalciumCouplingPolicy::DataIdContainer DataIdContainer; + typedef CalciumCouplingPolicy::DataId DataId; + + DataId dataId(time,tag); //potentiellement avec un troisième paramètre + setDependencyType(ITERATION_DEPENDENCY); + DataIdContainer dataIds(dataId,*this); + + + DataIdContainer::iterator dataIdIt = dataIds.begin(); + + if (!dataIds.empty()) + for (;dataIdIt != dataIds.end();++dataIdIt) { + std::cout << "(*dataIdIt) must be equal to given dataId parameter : " << *dataIdIt ; + std::cout << " == " << DataId(0,tag) << " : " << (ret = (*dataIdIt == DataId(0,tag))) << std::endl; + + } + } +}; + + +class TEST3 : public CalciumCouplingPolicy { +public: + int ret; + + TEST3() { + + // Doit filtrer le mode de dépendance temporel car le mode est + // défini itératif + ret=0; + + CORBA::Long time=1,tag=1; + typedef CalciumCouplingPolicy::DataIdContainer DataIdContainer; + typedef CalciumCouplingPolicy::DataId DataId; + + DataId dataId(time,tag); //potentiellement avec un troisième paramètre + setDependencyType(TIME_DEPENDENCY); + DataIdContainer dataIds(dataId,*this); + + + DataIdContainer::iterator dataIdIt = dataIds.begin(); + + if (!dataIds.empty()) + for (;dataIdIt != dataIds.end();++dataIdIt) { + std::cout << "(*dataIdIt) must be equal to given dataId parameter : " << *dataIdIt ; + std::cout << " == " << DataId(time,0) << " : " << (ret = (*dataIdIt == DataId(time,0))) << std::endl; + + } + } +}; + +int main() { + TEST1 test1; + TEST2 test2; + TEST3 test3; + return !test1.ret+!test2.ret+!test3.ret; +}; + diff --git a/src/DSC/DSC_User/Datastream/Calcium/version.h b/src/DSC/DSC_User/Datastream/Calcium/version.h new file mode 100644 index 000000000..93bf87600 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/version.h @@ -0,0 +1,39 @@ +/* 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 : version.h + * Author : Eric Fayolle (EDF) + * Module : KERNEL + */ + +/* Outils d'Aide au Couplage de Code de Calcul : $Id$ */ +#ifndef __VERSION_H +#define __VERSION_H + +/* Constantes servant a memoriser les repertoires des versions */ +/* de CALCIUM et de PVM ayant servi a la generation d'un */ +/* executable */ + +#define ACCC_REP "/home/fayolle/CALCIUM3.0" +#define PVM_REP "/home/fayolle/pvm3" + +#endif + diff --git a/src/DSC/DSC_User/Datastream/ConstTraits.hxx b/src/DSC/DSC_User/Datastream/ConstTraits.hxx new file mode 100644 index 000000000..5def97f9e --- /dev/null +++ b/src/DSC/DSC_User/Datastream/ConstTraits.hxx @@ -0,0 +1,35 @@ +// 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 : ConstTraits.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + +#ifndef _CONST_TRAITS_HXX_ +#define _CONST_TRAITS_HXX_ + +template < typename T > struct ConstTrait { typedef T NonConstType; }; +template < typename T > struct ConstTrait < const T > { typedef T NonConstType; }; + +#endif diff --git a/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx b/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx new file mode 100644 index 000000000..c0adc1853 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx @@ -0,0 +1,468 @@ +// 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 : CorbaTypeManipulator.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-07 18:26:44 +0100 (mer, 07 fév 2007) $ +// Id : $Id$ + +#ifndef _CORBA_TYPE_MANIPULATION_HXX_ +#define _CORBA_TYPE_MANIPULATION_HXX_ + +#include +#include +#include + + +// Classes manipulation +// ------------------- +// +// Ces différentes classes permettent d'unifier la manipulation des +// différents types de données dans un port datastream +// Les données sont maniées par valeur ou par pointeur +// pour éviter les recopies de gros volume de données + +// Les classes présentes quatre méthodes : +// - clone +// - get_data +// - delete_data +// - dump +// et +// trois types : +// - Type : Le type CORBA de la donnée manipulée +// - InType : Le mapping CORBA pour un paramètre IN du type manipulé +// - InnerType : Type interne des valeurs d'un type contenant + +// Cette classe permet de manipuler des types CORBA +// any, struct, union et sequence (utiliser plutôt les seq_manipulator) +// Ces types sont manipulés par pointeur. +// Les données reçues de CORBA sont systématiquement +// dupliquées pour être conservées. +// Quelque soit le type de donnée, les données sont considérées +// comme une donnée unique (retour de size() == 1) +template +class user_type_manipulation +{ +public: + typedef T * Type; + // correspond au mapping corba des type any, struct, + // union, séquence en paramètre IN + typedef const T & CorbaInType; + typedef T InnerType; + + // Operation de recuperation des donnees venant de l'ORB et + // creation d'une copie (memoire spécialement allouee) + static inline Type get_data(CorbaInType data) { + return new T(data); + } + + // Pb si ownerShip == True car appel par l'utilisateur de relPointer ! + static inline InnerType * const getPointer(Type data, bool ownerShip = false) { + return data; + } + + static inline void relPointer(InnerType * dataPtr) { + delete dataPtr; + } + + // Operation de clonage : par defaut, creation d'une copie en memoire allouee pour l'occasion + static inline Type clone(Type data) { + return new T (* data); + } + static inline Type clone(CorbaInType data) { + return new T (data); + } + + // Operation de création + static inline Type create (size_t size=1) { + return new T(); + } + + // Operation de destruction d'une donnee + static inline void delete_data(Type data) { + delete data; + } + + // Renvoie la taille de la donnée + static inline size_t size(Type data) { + return 1; + } + + // Dump de l'objet pour deboguage: neant car on ne connait pas sa structure + static inline void dump (CorbaInType data) {} +}; + + +// Gére les types CORBA atomiques ('Int', 'Char', 'Float', ...) +// Gére les types enums +// Gére les références d'objets CORBA +// Ces types sont manipulés par valeur +// Les méthodes getPointer ... ne devrait pas être utilisée +// pour ce types de données +template +class atom_manipulation +{ +public: + typedef T Type; + // correspond au mapping corba des types simples en paramètre IN + typedef T CorbaInType; + typedef T InnerType; + + + // Operation de recuperation des donnees venant de l'ORB : une copie par affectation simple + static inline Type get_data(CorbaInType data) { + return data; + } + + static inline InnerType * const getPointer(Type & data, bool getOwnerShip = false) { +// InnerType * ptr; +// if (getOwnerShip) { +// ptr =new InnerType[1];*ptr=data; +// return ptr; +// } else +// return &data; + return &data; + } + +// static inline void relPointer(InnerType * dataPtr) { +// return; +// delete[] dataPtr; +// } + +// Je ne sais pas comment l'implémenter sans faire +// d'allocation heap +//static inline InnerType * allocPointer(size_t size=1) { +// return new InnerType[1]; + //} + + // Operation de clonage : une copie par affectation simple + static inline Type clone(Type data) { + return data; + } + + // Inutile car Type == CorbaInType + // static inline Type clone(CorbaInType data) { + // return data; + // } + + // Operation de création +// static inline Type create(size_t size=1,InnerType * data=NULL, +// bool giveOwnerShip=false) { +// Type dummy; +// if (dataPtr) +// return *data; +// else +// return dummy; +// } + + // Operation de destruction d'une donnee: rien a faire car pas de memoire a liberer + static inline void delete_data(Type data) {} + // Renvoie la taille de la donnée + + static inline size_t size(Type data) { + return 1; + } + + // Dump de l'objet pour deboguage : Affiche la donnee + static void inline dump (CorbaInType data) { + std::cerr << "[atom_manipulation] Data : " << data << std::endl; + } +}; + + +// Gére un type sequence de taille illimitee (Unbounded) +// Ces types sont manipulés par pointeur +template +class seq_u_manipulation { + +public: + typedef seq_T * Type; // Type de donnée abstrait manipulé par GenericPort::Put,Get,.. + typedef const seq_T & CorbaInType; // Mapping corba de la séquence en paramètre IN + typedef elem_T InnerType; // Il n'existe pas dans CORBA de seq_T::elem_T + // C'est la raison d'être du second paramètre template de seq_u_mani + + // Operation de recuperation des donnees venant de l'ORB + // Remarque : On a un paramètre d'entrée de type const seq_T & + // et en sortie un seq_T * + static inline Type get_data(CorbaInType data) { + CORBA::Long len = data.length(); + CORBA::Long max = data.maximum(); + // Récupère et devient propriétaire des données reçues dans la séquence. + // La séquence (mais pas le buffer) sera désallouée au retour + // de la méthode GenericPort::put (car le mapping CORBA de ce type IN est : const seq & ) + + // OLD : On ne teste pas si le flag release de la séquence est à true ou false + // OLD : ( pour des séquences de chaines ou d'objrefs ) + // OLD : -> Si on est collocalisé le port uses doit créer une copie pour éviter la modification + // OLD : du contenu de la séquence lorsque l'utilisateur modifie ses données dans son programme (0 copie) + + // Le flag release() de la séquence est à false si elle n'est pas propriétaire du buffer + // En collocalité c'est le cas (on évite ici la copie réalisée auparavant dans le port uses). + + // ATTENTION TESTER p194 si le pointeur est null (release flag==false) + // -> La séquence n'était pas propriétaire des données ! +#ifdef _DEBUG_ + std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1 ------------------" << std::endl; +#endif + if ( data.release() ) { + InnerType * p_data = const_cast(data).get_buffer(true); + + // Crée une nouvelle sequence propriétaire des données du buffer (pas de recopie) + // Les données de la séquence seront automatiquement désallouées par appel à la méthode freebuf + // dans le destructeur de la séquence (cf delete_data). +#ifdef _DEBUG_ + std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(0 copy) bis ------"<< p_data <<"------------" << std::endl; +#endif + + return new seq_T (max, len, p_data, true); + } +#ifdef _DEBUG_ + std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(recopie) bis ------"<< &data <<"------------" << std::endl; +#endif + // Crée une nouvelle sequence propriétaire des données du buffer (avec recopie) + return new seq_T(data); + + } + + static inline size_t size(Type data) { + return data->length(); + } + + // Operation de destruction d'une donnee + static inline void delete_data(Type data) { + //La séquence est détruite par appel à son destructeur + //Ce destructeur prend en compte la nécessité de détruire ou non + //les données contenues en fonction de son flag interne release() + delete data; + } + + // Operation de clonage : par defaut creation d'une copie en memoire allouee pour l'occasion + // Utilisation du constructeur du type seq_T + static inline Type clone(Type data) { + return new seq_T (*data) ; + } + static inline Type clone(CorbaInType data) { + return new seq_T (data); + } + + // Permet d'obtenir un pointeur sur le buffer de la séquence + // si ownerShip=True, la séquence n'est plus propriétaire du buffer et est + // détruite (mais pas le buffer !) + static inline InnerType * const getPointer(Type data, bool ownerShip = false) { + InnerType * p_data; + if (ownerShip) { + p_data = data->get_buffer(true); + delete_data(data); + } else + p_data = data->get_buffer(false); + return p_data; + } + + // Permet de désallouer le buffer dont on détient le pointeur par appel + // à la méthode getPointer avec ownerShip=True si la séquence contenante + // à été détruite. + static inline void relPointer(InnerType * dataPtr) { + seq_T::freebuf(dataPtr); + } + + // Permet d'allouer un buffer compatible avec le type séquence + static inline InnerType * allocPointer(size_t size ) { + return seq_T::allocbuf(size); + } + + // Operation de création de la séquence corba soit + // - Vide et de taille size + // - Utilisant les données du pointeur *data de taille size + // (généralement pas de recopie qlq soit l'ownership ) + // data doit avoir été alloué par allocPointer si giveOwnerShip = true + static inline Type create(size_t size, InnerType * const data = NULL, + bool giveOwnerShip = false ) { + Type tmp; + if (!data) { + tmp = new seq_T(); + tmp->length(size); + } else { + tmp = new seq_T(size,size,data,giveOwnerShip); + } + return tmp; + } + + // Copie le contenu de la séquence dans le buffer idata de taille isize + // pour les types non pointeur + template + static inline void copy( Type data, T * const idata, size_t isize ) { + + InnerType *dataPtr = getPointer(data,false); + + for (int i = 0; i< isize; ++i) + idata[i]=dataPtr[i]; + + // Ce mode de recopie ne permet pas la conversion de type (ex int -> CORBA::Long + //OLD: Type tmp = new seq_T(isize,isize,idata,false); + //OLD: // giveOwnerShip == false -> seul le contenu du buffer data est détruit et remplacé + //OLD: // par celui de data dans l'affectation suivante : + //OLD: // ---> ATTENTION SI LA TAILLE DU BUFFER EST TROP PETITE, QUE FAIT CORBA ! + //OLD: // corruption mémoire + //OLD: // Cependant ce cas devrait pas arrivé (on s'assure dans les couches supérieures + //OLD: // de la taille correcte du buffer de recopie) + //OLD: // Si giveOwnerShip était == true -> le buffer et son contenu serait détruit puis une + //OLD: // allocation de la taille du buffer de data serait effectué avant la copie des données + //OLD: // tmp = data; + } + + // Copie le contenu de la séquence de char* dans le buffer idata de taille isize + static inline void copy( Type data, char* * const idata, size_t isize ) { + + char* *dataPtr = getPointer(data,false); + + // Si idata[i] n'a pas été alloué suffisament grand, + // il y a corruption de la mémoire + for (int i = 0; i< isize; ++i) + strcpy(idata[i],dataPtr[i]); + } + + // Dump de l'objet pour deboguage + static void inline dump (CorbaInType data) { + // Affiche la longueur des donnees + std::cerr << "[seq_u_manipulation] Data length: " << data.length() << std::endl; + // Affiche la longueur des donnees + std::cerr << "[seq_u_manipulation] Data max: " << data.maximum() << std::endl; + } +}; + + +// TODO : Vérifier la conformité de l'implémentation par rapport +// au type unbounded + +// Gére un type sequence de taille limitée (bounded) +// Ces types sont manipulés par pointeur +// Cette classe diffère de la seq_u_manipulation +// par la signature du constructeur de la séquence +// utilisé dans le methode get_data +template +class seq_b_manipulation { + +public: + typedef seq_T * Type; + typedef const seq_T & CorbaInType; + typedef elem_T InnerType; + + + // Operation de recuperation des donnees venant de l'ORB + // Sans opération de notre part, ces données seraient perdues + // au retour de la méthode put de GenericPort. + // Remarque : On a un paramètre d'entrée de type const seq_T & + // et en sortie un seq_T * + static inline Type get_data(CorbaInType data) { + CORBA::Long len = data.length(); + // Récupère et devient propriétaire des données reçues dans la séquence + // la séquence sera désalloué (mais pas le buffer) + // au retour de la méthode put (car mapping de type IN : const seq & ) + if ( data.release() ) { + InnerType * p_data = const_cast(data).get_buffer(true); + + // Crée une nouvelle sequence propriétaire des données du buffer (généralement pas de recopie) + // Les données seront automatiquement désallouées par appel interne à la méthode freebuf + // lors de la destruction de l'objet par appel à delete_data. +#ifdef _DEBUG_ + std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Pas de Duplication -----------" << std::endl; +#endif + return new seq_T (len, p_data, true); + } +#ifdef _DEBUG_ + std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Duplication pour en devenir propriétaire -----------" << std::endl; +#endif + // Crée une nouvelle sequence propriétaire des données du buffer (avec recopie) + return new seq_T(data); + + } + + static inline size_t size(Type data) { + return data->length(); + } + + // Operation de clonage : par defaut creation d'une copie en memoire allouee pour l'occasion + // Utilisation du constructeur du type seq_T + static inline Type clone(Type data) { + return new seq_T (* data); + } + static inline Type clone(CorbaInType data) { + return new seq_T (data); + } + + // Operation de destruction d'une donnee CORBA + static inline void delete_data(Type data) { + delete data; + } + + // Récupère un pointeur sur les données de type InnerType contenue dans la séquence + // si ownership=True, l'utilisateur devra appeler relPointer + // si ownership=False, l'utilisateur devra appeler delete_data sur la séquence contenante + static inline InnerType * const getPointer(Type data, bool getOwnerShip = false) { + InnerType * p_data; + if (getOwnerShip) { + p_data = data->get_buffer(true); + delete_data(data); + } else + p_data = data->get_buffer(false); + return p_data; + } + + // Permet de désallouer le buffer dont on détient le pointeur par appel + // à la méthode getPointer avec ownerShip=True si la séquence contenante + // à été détruite. + static inline void relPointer(InnerType * dataPtr) { + seq_T::freebuf(dataPtr); + } + + // Permet d'allouer un buffer pour la séquence + static inline InnerType * allocPointer(size_t size ) { + return seq_T::allocbuf(size); + } + + // Operation de création du type corba soit + // - Vide et de taille size + // - Utilisant les données du pointeur *data de taille size + // (généralement pas de recopie qlq soit l'ownership ) + // data doit avoir été alloué par allocPointer si giveOwnerShip = true + static inline Type create(size_t size, InnerType * const data = NULL, + bool giveOwnerShip = false ) { + Type tmp; + if (!data) { + tmp = new seq_T(); + tmp->length(size); + } else { + tmp = new seq_T(size,data,giveOwnerShip); + } + return tmp; + } + + + // Dump de l'objet pour deboguage + static inline void dump (CorbaInType data) { + // Affiche la longueur des donnees + std::cerr << "[seq_b_manipulation] Data length: " << data.length() << std::endl; + } +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/CouplingPolicy.hxx b/src/DSC/DSC_User/Datastream/CouplingPolicy.hxx new file mode 100644 index 000000000..2ed03762c --- /dev/null +++ b/src/DSC/DSC_User/Datastream/CouplingPolicy.hxx @@ -0,0 +1,161 @@ +// 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 : CouplingPolicy.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#ifndef _COUPLING_POLICY_HXX_ +#define _COUPLING_POLICY_HXX_ + +#include "IteratorTraits.hxx" +#include "FindKeyPredicate.hxx" +#include +#include +#include + +// La politique de couplage doit définir +// 1) le type DataId qui identifie une instance de données +// 2) Un container de DataId appelé DataIdContainer et son itérateur +// 3) Un constructeur de DataIdContainer qui initialise le container à partir d'un DataId + +////////// Le DataId ////////////// +// COUPLING_POLICY::DataId +// est construit par DataId(T1 time,T2 tag) +// +// COUPLING_POLICY::DataIdContainer +// qui défini +// les types : DataIdContainer::iterator +// les méthodes : begin(), end(), empty() +// COUPLING_POLICY::DataIdContainer::iterator +// qui défini +// les méthodes : != , == , ++() , ()++, *(), = + +// COUPLING_POLICY::DataTable +// std::map< DataId, DataType> DataTable; + +// Définir void COUPLING_POLICY::DataIdContainer(const DataId &, CouplingPolicy & ) +// qui initialise le container à partir d'un DataId + +// Opérateur d'affichage d'un dataId (les types doivent être affichables) + + +class CouplingPolicy { + +public: + + // Renvoie isEqual si le dataId attendu est trouvé dans storedDataIds : + // - l'itérateur wDataIt1 pointe alors sur ce dataId + // Cette méthode doit être redéfini dans le mode de couplage s'il veut gérer + // le cas d'un dataId damandé non trouvé mais encadrable + // par deux autres dataIds. La méthode renvoie alors isBounded== true et : + // - l'itérateur wDataIt1 doit être tel que : + // wDataIt1->first < wdataId < (wDataIt1+1)->first + template < typename Container > + bool isDataIdConveniant(Container & storedDatas, + const typename Container::key_type & expectedDataId, + bool & isEqual , bool & isBounded, + typename Container::iterator & wDataIt1 ) const { + typedef typename Container::key_type key_type; + typedef typename Container::value_type value_type; + typedef typename Container::iterator iterator; + isBounded = false; + FindKeyPredicate fkp(expectedDataId); + wDataIt1 = std::find_if(storedDatas.begin(),storedDatas.end(),fkp); + isEqual = (wDataIt1 != storedDatas.end()); + std::cout << "-------- Generic isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl; + return isEqual || isBounded; + } + + + // Méthode Vide déclarée ici pour définir son nom dans GenericPort + // Elle profite à tous les modes de couplages n'implémentant pas + // de comportement particulier dans la méthode get pour + // le cas d'une demande de dataId inexistant mais encadré par deux autres + template + struct BoundedDataIdProcessor{ + BoundedDataIdProcessor(const CouplingPolicy & couplingPolicy) {}; + template < typename Iterator, typename DataId > + void inline apply(typename iterator_t::value_type & data, + const DataId & dataId, + const Iterator & it1) const { + typedef typename iterator_t::value_type value_type; + std::cout << "-------- Generic BoundedDataIdProcessor.apply() called " << std::endl; + + } + }; + + // Supprime un DataId et ses données associées + // du container + // Cette méthode utilisée dans GenericPort::Get + // peut être surchargée pour par exemple + // conserver un historique. + template + struct EraseDataIdProcessor { + + EraseDataIdProcessor(CouplingPolicy couplingPolicy) {}; + + template < typename Container > + void apply(Container & storedDatas, + typename Container::iterator & wDataIt1 ) const { + typedef typename Container::key_type key_type; + typedef typename Container::value_type value_type; + typedef typename Container::iterator iterator; + + std::cout << "-------- Generic eraseDataId called " << std::endl; + } + }; + + // Lorsque cette méthode est appelée l'expectedDataId n'a pas été trouvé + // et n'est pas non plus encadrée (en mode temporel) + // Si l'on effectue pas de traitement particulier la méthode renvoie false + // Si le port a reçu une directive STOP une exception est levée + // Si le port a reçu une directive CONTINUE, on localise l'expected + template < typename DataManipulator > + struct DisconnectProcessor { + + DisconnectProcessor(const CouplingPolicy & couplingPolicy) {}; + + template < typename Container, typename DataId > + bool apply(Container & storedDatas, + const DataId & expectedDataId, + typename Container::iterator & wDataIt1 ) const { + typedef typename Container::key_type key_type; + typedef typename Container::value_type value_type; + typedef typename Container::iterator iterator; + + std::cout << "-------- Generic DisconnectProcessor called " << std::endl; + return true; + } + }; + + // Permet de réveiller les méthodes d'un GenericPort en attente + // depuis une CouplingPolicy + virtual void wakeupWaiting(){}; + + virtual ~CouplingPolicy() {} + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/DataIdFilter.hxx b/src/DSC/DSC_User/Datastream/DataIdFilter.hxx new file mode 100644 index 000000000..91853d713 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/DataIdFilter.hxx @@ -0,0 +1,356 @@ +// 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 : DataIdFilter.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +/* Module Filtre + * ------------- + * + * Implemente les fonctions de filtrage et conversion d'un port de DATASTREAM + * + * Rappel des fonctions du Filtrage: + * -------------------------------- + * + * Dans une communication de type DATASTREAM, le destinataire indique à l'avance la liste + * des instances qu'il veut recevoir, c'est à dire celles qui lui sont nécessaires. + * Il indique pour cela la liste des 'times' et la liste des 'tags' qui + * caractérisent les instances désirées. + * Ces deux listes sont indépendantes. Toute instance dont les paramètres 'time' et + * 'tag' figurent dans la liste des 'times' et respectivement dans la liste des + * 'tags' est désirée par le destinataire. + * Par la suite, une telle instance sera acceptée par le port-DATASTREAM. Les autres + * seront rejetées. + * + * Le filtrage consiste à limiter les valeurs possibles du paramètre TIME ou TAG (un + * entier). La liste des valeurs possibles est décrite sous la forme d'une liste de + * valeurs ou de séquences arithmétiques de valeurs. + * Exemple: + * La liste 1; 3; 30:34; 40:50:2 autorise les valeurs 1 et 3 et toutes les valeurs + * comprises entre 30 et 34 inclus et toutes les valeurs de la séquence 40 à 50 + * inclus par pas de 2, c'est à dire 40, 42, ... 50. + * On appelle règle élémentaire de filtrage celle spécifiant un élément de la liste + * des valeurs autorisées: soit une seule valeur, soit une séquence de valeurs. Une + * séquence de valeurs est spécifiée par sa valeur de départ, sa valeur de fin et + * son pas. Le filtrage est donc défini par une suite de règles de filtrage. + * La fonction élémentaire de configuration du filtrage sert à spécifier une règle + * de filtrage. + * + * Rappels des fonctions de conversion: + * ----------------------------------- + * + * La conversion est intimement liée au filtrage car seules les valeurs passant le + * filtre sont converties. La conversion n'est pas obligatoire. Une valeur de TIME ou TAG + * entrante peut ne pas être convertie. Elle garde alors sa valeur et est gardée + * telle quelle pour l'objet destinataire. + * DATASTREAM peut associer une règle de conversion à chaque règle élémentaire de + * filtrage. + * La conversion consiste à changer: + * - un valeur de TIME ou TAG en une valeur différente + * - une séquence de valeurs en une autre séquence de valeurs de même taille + * (ex: 30:40 en 300:400:10) + * Mais la conversion permet aussi de transformer: + * - une valeur de TIME ou TAG unique en une séquence de valeurs (les données entrantes sont + * alors duppliquées et à chaque fois que l'objet destinataire réclame une donnée + * de la séquence, il reçoit en fait une copie de la donnée reçue une seule fois) + * + * - une séquence de valeurs en une valeur unique (alors, chaque donnée entrante + * associée à un TIME ou TAG de la séquence correspond à une donnée unique pour le + * destinataire: seule la dernière reçue est la donnée valide) + * + */ + +#include +#include + +// Pour l'utilisation de "vector" de la STL +using namespace std; + +// Classe filtre_elementaire +// +// Implémente une structure de donnée décrivant un filtre élémentaire +// sur le paramètre TIME ou TAG; c'est +// - soit une valeur entière unique +// - soit une séquence arithmétique de valeurs +// +class filtre_elementaire +{ +public: + int len; // Longueur de séquence ou 1 pour une valeur unique + int debut; // Début de la séquence ou valeur pour une valeur unique + int fin; // Fin de la séquence + int pas; // Pas de la séquence + + // Constructeur par défaut + filtre_elementaire() {} + + // Création d'un filtre élémentaire pour une valeur unique + filtre_elementaire(int valeur) + { + this->len = 1; + this->debut = valeur; + } + + // Création d'un filtre élémentaire pour une séquence de valeurs entières + // Le pas par défaut est 1 + filtre_elementaire (int _debut, int _fin, int _pas=1) + { + this->debut = _debut; + this->len = (_fin - _debut) / _pas; + if (this->len > 0) + { + this->fin = _debut + _pas * this->len; // Calcule la vrai borne de fin + this->pas = _pas; + this->len += 1; // Compte les bornes et non les intervalles + } + else // erreur de spécification: on ne prend que la première valeur + this->len = 1; + } + + // Constructeur par copie + filtre_elementaire (filtre_elementaire &_f) + { + this->len = _f.len; + this->debut = _f.debut; + this->fin = _f.fin; + this->pas = _f.pas; + } +}; + +// Classe filtre_conversion +// +// Implémente le filtrage et la conversion du paramètre TIME ou TAG +// des données reçues par un port DATASTREAM. +// +// Mode d'emploi: +// 1) Création d'un objet +// 2) Configuration de cet objet par passage de paramètres +// de filtage et de conversion +// 3) A la création d'un port DATASTREAM, on passe au constructeur +// deux objets 'filtre_conversion', l'un pour le TIME, l'autre pour le TAG. +// 4) A l'utilisation du port DATASTREAM, celui-ci appelle la méthode +// "applique_filtre_conversion" pour opérer +// +class filtre_conversion +{ +private: + // Structure de données décrivant une conversion élémentaire: + // un filtre élementaire + // et un pointeur éventuel vers les paramètres de conversion associés + class conversion_elementaire + { + public : + // Data + filtre_elementaire filtre; + filtre_elementaire * p_convers; + + // Constructeur + conversion_elementaire() {} + + // Constructeur par copie d'un objet non modifie (const) + conversion_elementaire (const conversion_elementaire& _ce) + { + *this = _ce; + } + // Remarque: le Constructeur par copie d'un objet existe par defaut mais sans le modificateur 'const' + // et l'emploi d'un objet comme element dans un vecteur oblige d'avoir un tel const-copy-constructor. + }; + + // Données de configuration de filtrage et conversion: + // une table de filtres élémentaires + // avec leurs données de conversion associées éventuelles + vector config; + +public: + // Constructeur: juste une allocation mémoire initiale + filtre_conversion() {} + + // Destructeur: + // réclamer la mémoire utilisée par tous les éléments du vecteur config + ~filtre_conversion() + { + vector::iterator i; + for (i = this->config.begin(); i != this->config.end(); i ++) + { + delete (*i).p_convers; + } + } + + // Configuration partielle par ajout d'un filtre élémentaire + bool config_elementaire (filtre_elementaire& _f) + { +// cout << "ajout config_elementaire 1 " << this << endl; + conversion_elementaire conv_elem; + + conv_elem.filtre = _f; + conv_elem.p_convers = NULL; + + // Ajoute cette conversion/filtrage elementaire a la liste + this->config.push_back (conv_elem); + +// vector::iterator i; +// cout << "liste apres ajout:" << endl; +// for (i = this->config.begin(); i != this->config.end(); i ++) +// { +// cout << "config elem " << endl; +// cout << "filtre: len, debut, fin, pas " << (*i).filtre.len << " " << (*i).filtre.debut << " " << (*i).filtre.fin << " " << (*i).filtre.pas << endl; +// } + + return true; + } + + // Configuration partielle par ajout d'un filtre élémentaire + // et sa conversion associée + // + // Retourne false si les param de conversion sont incompatibles avec le filtre élémentaire. + // La configuration partielle est alors refusée. + // + bool config_elementaire (filtre_elementaire& _f, filtre_elementaire& _conv) + { +// cout << "ajout config_elementaire 2 " << this << endl; + + if (_f.len == 1 || _conv.len == 1 || _f.len == _conv.len) + { + conversion_elementaire conv_elem; + conv_elem.filtre = _f; + conv_elem.p_convers = new filtre_elementaire(_conv); + + // Ajoute cette conversion/filtrage elementaire a la liste + this->config.push_back (conv_elem); + +// vector::iterator i; +// cout << "liste apres ajout:" << endl; +// for (i = this->config.begin(); i != this->config.end(); i ++) +// { +// cout << "config elem " << endl; +// cout << "filtre: len, debut, fin, pas " << (*i).filtre.len << " " << (*i).filtre.debut << " " << (*i).filtre.fin << " " << (*i).filtre.pas << endl; +// } + + return true; + } + else + { + // Filtre et conversion incompatibles + return false; + } + } + + // applique_filtre_conversion: Opération du filtre et de la conversion + template T applique_filtre_conversion (T valeur_initiale, vector& liste_conversions) const; +}; + + + +// filtre_conversion::applique_filtre_conversion: Opération du filtre et de la conversion +// +// Etant donné une valeur entière (de TIME ou de TAG), cette méthode détermine : +// - si cette valeur passe le filtre +// - dans le cas où une conversion existe, la liste des valeurs de conversion +// qui correspondent à la valeur initiale +// +// Dans tous les cas, cette méthode retourne une liste de valeurs. +// Dans le cas où il n'y a pas de conversion, cette liste a une longueur 1 +// et ne contient que la valeur initiale. +// +// Paramètre d'entrée : la valeur initiale (integer) +// +// Paramètre de sortie : la liste des valeurs après conversion (vector) +// +// Valeur de retour : la longueur de la liste +// si cette longueur est 0, c'est que la valeur initiale ne passe pas le filtre +// +template +T filtre_conversion::applique_filtre_conversion (T valeur_initiale, vector& liste_conversions) const +{ + // Part d'une liste vierge + liste_conversions.clear(); + +// cout << "config applique_filtre_conversion " << this << endl; + + // Balaye tous les éléments de configuration + // et cherche pour chacun d'eux si la valeur initiale est présente parmi les valeurs filtrées + + // Pour tous les éléments de configuration du filtrage/conversion + vector::const_iterator i; + for (i = config.begin(); i != config.end(); i ++) + { + +// cout << "config elem " << endl; +// cout << "filtre: len, debut, fin, pas " << (*i).filtre.len << " " << (*i).filtre.debut << " " << (*i).filtre.fin << " " << (*i).filtre.pas << endl; + + bool si_passe_filtre = false; + + // Si la longueur du filtre est 1 + if ((*i).filtre.len == 1) { + // Si la valeur initiale correspond à la valeur du filtre + if ((*i).filtre.debut == valeur_initiale) + si_passe_filtre = true; + } else { + // Si la valeur initiale est dans la séquence des valeurs du filtre + // la valeur est comprise dans les bornes [debut,fin] + // et sa distance du début de la séquence est modulo le pas + if ( ((*i).filtre.fin - valeur_initiale >= 0) == (valeur_initiale - (*i).filtre.debut >= 0) + && (valeur_initiale - (*i).filtre.debut) % (*i).filtre.pas == 0 ) { + si_passe_filtre = true; + } + } + + // Si la valeur initiale passe le filtre + if (si_passe_filtre) { + // cout << "config: filtre passe " << endl; + + // Si il y a une conversion à effectuer + if ((*i).p_convers != NULL) { + + // Si la longueur du filtre est 1 + if ((*i).filtre.len == 1) { + + // Si la longueur des paramètres de conversion est aussi 1 + if ((*i).p_convers->len == 1) { + // Ajoute la valeur de conversion à la liste des valeurs après conversion + liste_conversions.push_back ((*i).p_convers->debut); + } else { + // Ajoute la séquence de conversion à la liste des valeurs après conversion + for (int s = (*i).p_convers->debut; s != (*i).p_convers->fin; s += (*i).p_convers->pas) { + liste_conversions.push_back (s); + } + liste_conversions.push_back ((*i).p_convers->fin); + } + + } else { + // Le filtre est une séquence qui est convertie en une autre séquence de même longueur + // Choisit la valeur au rang désiré dans la séquence de conversion + int rang = (valeur_initiale - (*i).filtre.debut) / (*i).filtre.pas; + + int valeur_convertie = (*i).p_convers->debut + rang * (*i).p_convers->pas; + + // Ajoute cette valeur à la liste des valeurs après conversion + liste_conversions.push_back (valeur_convertie); + } + } else { + // Ajoute la valeur initiale telle-quelle à la liste des valeurs après conversion + liste_conversions.push_back (valeur_initiale); + } + } + } + + return liste_conversions.size(); +} diff --git a/src/DSC/DSC_User/Datastream/DisplayPair.hxx b/src/DSC/DSC_User/Datastream/DisplayPair.hxx new file mode 100644 index 000000000..a268bef1c --- /dev/null +++ b/src/DSC/DSC_User/Datastream/DisplayPair.hxx @@ -0,0 +1,40 @@ +// 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 : DisplayPair.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + +#ifndef __DISPLAY_PAIR__ +#define __DISPLAY_PAIR__ + +#include + +template std::ostream & operator <<(std::ostream & os, const std::pair & p) +{ os << "(" << p.first << "," << p.second << ")"; + return os; +}; + + +#endif diff --git a/src/DSC/DSC_User/Datastream/FindKeyPredicate.hxx b/src/DSC/DSC_User/Datastream/FindKeyPredicate.hxx new file mode 100644 index 000000000..26c49e678 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/FindKeyPredicate.hxx @@ -0,0 +1,78 @@ +// 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 : FindKeyPredicate.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + +#ifndef __FIND_KEY_PREDICATE__ +#define __FIND_KEY_PREDICATE__ + +#include +#include +#include "DisplayPair.hxx" + +template < typename T > +struct FindKeyPredicate : public std::unary_function < T, bool > +{ + T _value; + FindKeyPredicate(const T& value):_value(value){} + inline bool operator()(const T &v1, const T& v2) const { + std::cout << "FindKeyPredicate Generic -> :" << &(v1.first) << std::endl; + return ( v1 == _value ); + } +}; + +// Pour les MAPs avec une clef sous forme de pair +// template +// struct FindKeyPredicate< std::pair, T3 > > : +// public std::binary_function < std::pair, T3 >, +// std::pair, T3 >, bool > +// { +// std::pair _value; +// FindKeyPredicate(const std::pair & value):_value(value){ +// std::cout << "1-Initializing with value " << _value << std::endl; +// } +// bool operator()( const std::pair, T3 > & v1, +// const std::pair, T3 > v2) const { +// std::cout << "1-> :" << v1 << "," << v2 << " " << std::endl; +// return (v1.first <= _value ) && (_value < v2.first) ; +// } +// }; + +template +struct FindKeyPredicate< std::pair > : public std::unary_function < std::pair, bool > +{ + T1 _value; + FindKeyPredicate(const T1 & value):_value(value){ + std::cout << "FindKeyPredicate 2-Initializing with value " << _value << std::endl; + } + + inline bool operator()( const std::pair & v1) const { + std::cout << "FindKeyPredicate 2-> :" << v1.first << std::endl; + return v1.first == _value ; + } +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/GenericPort.hxx b/src/DSC/DSC_User/Datastream/GenericPort.hxx new file mode 100644 index 000000000..dd6005780 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/GenericPort.hxx @@ -0,0 +1,642 @@ +// 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 : GenericPort.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#ifndef _GENERIC_PORT_HXX_ +#define _GENERIC_PORT_HXX_ + +#include "CorbaTypeManipulator.hxx" + +// SALOME CORBA Exception +#include "Utils_CorbaException.hxx" +// SALOME C++ Exception +#include "Utils_SALOME_Exception.hxx" + +#include +#include + +// Inclusions pour l'affichage +#include +#include + +// Classe GenericPort +// -------------------------------- +// +// Definition: Implemente un port de type "data-stream" +// Cette implémentation gère tous les types de données définies par DataManipulator::type +// Ce port est soumis à une politique d'itération sur les identificateurs de données (DataId) +// Un identificateur de données est construit à partir d'un ou plusieurs paramètres de la méthode put +// tels que : une date, une itération, un pas de temps ou une combinaison de ces paramètres. + +template < typename DataManipulator, class COUPLING_POLICY > +class GenericPort : public COUPLING_POLICY { +public: + // Type de données manipulés + typedef typename DataManipulator::Type DataType; + typedef typename DataManipulator::CorbaInType CorbaInDataType; + + GenericPort(); + virtual ~GenericPort(); + + template void put(CorbaInDataType data, TimeType time, TagType tag); + template DataType get(TimeType time, TagType tag); + template DataType get(TimeType ti, TimeType tf, TagType tag = 0); + template DataType next(TimeType &t, TagType &tag ); + void close (PortableServer::POA_var poa, PortableServer::ObjectId_var id); + void wakeupWaiting(); + +private: + + // Type identifiant une instance de donnee. Exemple (time,tag) + typedef typename COUPLING_POLICY::DataId DataId; + typedef std::map< DataId, DataType> DataTable; + + // Stockage des donnees recues et non encore distribuées + DataTable storedDatas ; + + // Indicateur que le destinataire attend une instance particuliere de données + bool waitingForConvenientDataId; + // Indicateur que le destinataire attend n'importe qu'elle instance de données + bool waitingForAnyDataId; + + // Identificateur de la donné que le destinataire (propriétaire du port) attend + DataId expectedDataId ; + // Sauvegarde du DataId courant pour la méthode next + DataId lastDataId; + bool lastDataIdSet; + // Exclusion mutuelle d'acces a la table des données reçues + omni_mutex storedDatas_mutex; + // Condition d'attente d'une instance (Le processus du Get attend la condition declaree par le processus Put) + omni_condition cond_instance; + +}; + +template < typename DataManipulator, typename COUPLING_POLICY > +GenericPort::GenericPort() : + cond_instance(& this->storedDatas_mutex),waitingForConvenientDataId(false), + waitingForAnyDataId(false),lastDataIdSet(false) {} + +template < typename DataManipulator, typename COUPLING_POLICY> +GenericPort::~GenericPort() { + typename DataTable::iterator it; + for (it=storedDatas.begin(); it!=storedDatas.end(); ++it) { +#ifdef _DEBUG_ + std::cerr << "~GenericPort() : destruction de la donnnée associée au DataId :"<< (*it).first << std::endl; +#endif + DataManipulator::delete_data( (*it).second ); + } +} + +template < typename DataManipulator, typename COUPLING_POLICY> void +GenericPort::close (PortableServer::POA_var poa, + PortableServer::ObjectId_var id) { + // Ferme le port en supprimant le servant + // La desactivation du servant du POA provoque sa suppression + poa->deactivate_object (id); +} + +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(); + +} + +/* Methode put_generique + * + * Stocke en memoire une instance de donnee (pointeur) que l'emetteur donne a l'intention du destinataire. + * Reveille le destinataire, si il y a lieu. + */ +template < typename DataManipulator, typename COUPLING_POLICY> +template < typename TimeType,typename TagType> +void GenericPort::put(CorbaInDataType dataParam, + TimeType time, + TagType tag) { + fflush(stdout); + fflush(stderr); + try { +#ifdef _DEBUG_ + // Affichage des donnees pour DEBUGging + std::cerr << "parametres emis: " << time << ", " << tag << std::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 + // Il est également possible de convertir les données recues ou bien de les dupliquer + // pour plusieurs valeurs de time et/ou tag (d'où la notion de container dans la politique de couplage) + typedef typename COUPLING_POLICY::DataIdContainer DataIdContainer; + typedef typename COUPLING_POLICY::DataId DataId; + + DataId dataId(time,tag); + // Effectue les traitements spécifiques à la politique de couplage + // pour construire une liste d'ids (par filtrage, conversion ...) + // DataIdContainer dataIds(dataId,*(static_cast(this))); + DataIdContainer dataIds(dataId, *this); + + typename DataIdContainer::iterator dataIdIt = dataIds.begin(); + + 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 + DataType data = DataManipulator::get_data(dataParam); + + + 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 + + // Recherche la première clé telle quelle ne soit pas < currentDataId + // pour celà l'opérateur de comparaison storedDatas.key_comp() est utilisé + // <=> 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; + (*wDataIt).second = data; + // Detruit la vieille donnee + 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 + // du type itérator qui n'est pas connu (pas de possibilité de déclarer un static ) + // - compliquer de créer une méthode sans les paramètres inutiles tout en réutilisant + // la méthode initiale car cette dernière ne peut pas être déclarée virtuelle + // à cause de ses paramètres templates. Du coup, il faudrait aussi redéfinir la + // méthode simplifiée dans les classes définissant une politique + // de couplage particulière ... + bool dummy1,dummy2; typename DataTable::iterator dummy3; + // Par construction, les valeurs de waitingForAnyDataId, waitingForConvenientDataId et de + // expectedDataId ne peuvent pas être modifiées pendant le traitement de la boucle + // sur les dataIds (à cause du lock utilisé dans la méthode put et les méthodes get ) + // rem : Utilisation de l'évaluation gauche droite du logical C or + if ( waitingForAnyDataId || + ( 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) + waitingForAnyDataId = false; + else + waitingForConvenientDataId = false; + // Reveille le thread du destinataire (stoppe son attente) + // Ne faudrait-il pas réveiller plutôt tous les threads ? + // Celui réveillé ne correspond pas forcément à celui qui demande + // cet expectedDataReceived. + // Pb1 : cas d'un un get séquentiel et d'un get sur un dataId que l'on vient de recevoir. + // Si l'on reveille le mauvais thread, l'autre va attendre indéfiniment ! (sauf timeout) + // 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); + + } // Catch les exceptions SALOME//C++ pour la transformer en une exception SALOME//CORBA + catch ( const SALOME_Exception & ex ) { + // On évite de laisser un mutex + storedDatas_mutex.unlock(); + THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR); + } + +} + + +// Version du Get en 0 copy +// ( n'effectue pas de recopie de la donnée trouvée dans storedDatas ) +// ( L'utilisateur devra être attentif à la politique de gestion de l'historique +// spécifique au mode de couplage car il peut y avoir une suppression potentielle +// d'une donnée utilisée directement dans le code utilisateur ) +// Le code doit prendre connaissance du transfert de propriété ou non des données +// auprès du mode de couplage choisi. +template < typename DataManipulator, typename COUPLING_POLICY > +template < typename TimeType,typename TagType> +typename DataManipulator::Type +GenericPort::get(TimeType time, + TagType tag) +// REM : Laisse passer toutes les exceptions +// En particulier les SALOME_Exceptions qui viennent de la COUPLING_POLICY +// Pour déclarer le throw avec l'exception spécifique il faut que je vérifie +// qu'un setunexpeted est positionné sinon le C++ arrête tout par appel à terminate +{ + typedef typename COUPLING_POLICY::DataId DataId; + // (Pointeur sur séquence) ou valeur.. + DataType dataToTransmit ; + 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; + + try { + storedDatas_mutex.lock(); // Gérer les Exceptions ds le corps de la méthode + + while ( true ) { + + // Renvoie isEqual si le dataId attendu est trouvé dans storedDatas : + // - l'itérateur wDataIt1 pointe alors sur ce dataId + // Renvoie isBounded si le dataId attendu n'est pas trouvé mais encadrable et + // que la politique gére ce cas de figure + // - 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); + size_t N = DataManipulator::size(dataToTransmit); + 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 + // implémente une méthode processBoundedDataId capable de générer les données à retourner + if ( isBounded ) { + // Pour être cohérent avec la politique du bloc précédent + // on stocke la paire (dataId,données interpolées ). + // CALCIUM ne stockait pas les données interpolées. + // Cependant comme les données sont censées être produites + // par ordre croissant de DataId, de nouvelles données ne devrait pas améliorer + // l'interpolation. +#ifdef _DEBUG_ + std::cout << "-------- Get : MARK 8 ------------------" << std::endl; +#endif + + typedef typename COUPLING_POLICY::template BoundedDataIdProcessor BDI; + BDI processBoundedDataId(*this); + // typename COUPLING_POLICY::template BoundedDataIdProcessor processBoundedDataId(*this); + //si static BDIP::apply(dataToTransmit,expectedDataId,wDataIt1); + //ancienne version template processBoundedDataId(dataToTransmit,expectedDataId,wDataIt1); + //BDIP processBoundedDataId; + processBoundedDataId.apply(dataToTransmit,expectedDataId,wDataIt1); + + // Il ne peut pas y avoir déjà une clé expectedDataId dans storedDatas (utilisation de la notation [] ) + // La nouvelle donnée produite est stockée, ce n'était pas le cas dans CALCIUM + // Cette opération n'a peut être pas un caractère générique. + // A déplacer en paramètre de la méthode précédente ? ou déléguer ce choix au mode de couplage ? + 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); + + std::copy(InIt1, InIt1 + N, + 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); + + break; + } + + // Délègue au mode de couplage la gestion d'une demande de donnée non disponible + // si le port est deconnecté + typename COUPLING_POLICY::template DisconnectProcessor processDisconnect(*this); + if ( processDisconnect.apply(storedDatas, expectedDataId, wDataIt1) ) continue; + + // 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 (...) { + waitingForConvenientDataId = true; + storedDatas_mutex.unlock(); + throw; + } + + // 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 + // c'est eraseDataId qui choisi ou non de supprimer la donnée + // Du coup interaction potentielle entre le 0 copy et gestion des niveaux + return dataToTransmit; + +} + +template < typename DataManipulator, typename COUPLING_POLICY > +template < typename TimeType,typename TagType> +typename DataManipulator::Type +GenericPort::get(TimeType ti, + TimeType tf, + TagType tag ) { + TimeType t = COUPLING_POLICY::getEffectiveTime(ti,tf); + return get(t,tag); +} + + +// Version du next en 0 copy +// ( n'effectue pas de recopie de la donnée trouvée dans storedDatas ) +template < typename DataManipulator, typename COUPLING_POLICY > +template < typename TimeType,typename TagType> +typename DataManipulator::Type +GenericPort::next(TimeType &t, + TagType &tag ) { + + typedef typename COUPLING_POLICY::DataId DataId; + + DataType dataToTransmit; + DataId dataId; + + try { + storedDatas_mutex.lock();// Gérer les Exceptions ds le corps de la méthode + +#ifdef _DEBUG_ + std::cout << "-------- Next : MARK 1 ---lastDataIdSet ("< processDisconnect(*this); + + while ( storedDatas.empty() || wDataIt1 == storedDatas.end() ) { + + // Délègue au mode de couplage la gestion d'une demande de donnée non disponible + // si le port est deconnecté + if ( processDisconnect.apply(storedDatas, lastDataId, wDataIt1) ) { + 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 + // c'est eraseDataId qui choisi ou non de supprimer la donnée + // Du coup interaction potentielle entre le 0 copy et gestion des niveaux + return dataToTransmit; + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/GenericProvidesPort.hxx b/src/DSC/DSC_User/Datastream/GenericProvidesPort.hxx new file mode 100644 index 000000000..16da2682f --- /dev/null +++ b/src/DSC/DSC_User/Datastream/GenericProvidesPort.hxx @@ -0,0 +1,26 @@ +// Eric Fayolle - EDF R&D +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (Wed, 28 Feb 2007) $ +// Id : $Id$ + +#ifndef _GENERIC_PROVIDES_PORT_HXX_ +#define _GENERIC_PROVIDES_PORT_HXX_ + +#include "provides_port.hxx" +#include "GenericPort.hxx" + + +template +class GenericProvidesPort : public ProvidesPort, + public GenericPort< DataManipulator , CouplingPolicy > { +public : + // Type de données manipulés + typedef typename DataManipulator::Type DataType; + typedef typename DataManipulator::CorbaInType CorbaInDataType; + + virtual ~GenericProvidesPort() {}; + +}; + + +#endif diff --git a/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx b/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx new file mode 100644 index 000000000..effed2b07 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx @@ -0,0 +1,146 @@ +// 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 : GenericUsesPort.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ + +#ifndef _GENERIC_USES_PORT_HXX_ +#define _GENERIC_USES_PORT_HXX_ + +#include "CorbaTypeManipulator.hxx" + +#include "uses_port.hxx" +#include "SALOME_Ports.hh" + +#include "DSC_Exception.hxx" + +// #define GENERATE_USES_PORT(dataManip,portType,portName) \ +// const char * _repository_##portType##_name_ = "IDL:Ports/##portType##:1.0"; \ +// GenericUsesPort< dataManip, portType, _repository_##portType##_name_ > portName; + +//ex : GENERATE_USES_PORT(Ports::Data_Short_Port,data_short_port); + +template +class GenericUsesPort : public UsesPort +{ +public : + // Type de données manipulés + typedef typename DataManipulator::Type DataType; + typedef typename DataManipulator::CorbaInType CorbaInDataType; + + GenericUsesPort(); + virtual ~GenericUsesPort(); + + virtual const char * get_repository_id(); + template + void put(CorbaInDataType data, TimeType time, TagType tag); + + virtual void uses_port_changed(Engines::DSC::uses_port * new_uses_port, + const Engines::DSC::Message message); + +protected : + Engines::DSC::uses_port * _my_ports; +}; + + +template +GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::GenericUsesPort() { + _my_ports = NULL; +} + +template +GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::~GenericUsesPort() +{ + delete _my_ports; +} + +template +const char * +GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::get_repository_id() { + return repositoryName; +} + + +template +template +void +GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::put( CorbaInDataType data, + TimeType time, + TagType tag) { + typedef typename CorbaPortType::_var_type CorbaPortTypeVar; + if (!_my_ports) + throw DSC_Exception(LOC("There is no connected provides port to communicate with.")); + + // OLD : PB1 : Cf remarque dans CalciumInterface, si on n'effectue pas de copie + // OLD : du buffer ! + // OLD : PB2 : Si les ports provides auquels on envoie data sont collocalisés + // OLD : ils vont partagés le même buffer (à cause de notre optim ds get_data) + // OLD : il faut alors effectuer une copie ici. + // OLD : Pour l'instant on résoud PB2 en créant une copie de la donnée en cas + // OLD : de connexions multiples. Il faudra tester la collocalisation. + // OLD : DataType copyOfData; // = data; PB1 + for(int i = 0; i < _my_ports->length(); i++) { + + CorbaPortTypeVar port = CorbaPortType::_narrow((*_my_ports)[i]); + //if (i) { PB1 + //OLD : copyOfData = DataManipulator::clone(data); +#ifdef _DEBUG_ + std::cout << "-------- GenericUsesPort::put -------- " << std::endl; +#endif + //} PB1 + try { + port->put(data,time,tag); + // OLD : port->put(*copyOfData,time,tag); + } catch(const CORBA::SystemException& ex) { + //OLD : DataManipulator::delete_data(copyOfData); + throw DSC_Exception(LOC(OSS() << "Impossible d'invoquer la méthode put sur le port n°" + << i << "( i>= 0)")); + + } + //if (i) PB1 + // La séquence est détruite avec le buffer si on n'est pas collocalisé + // La séquence est détruite sans son buffer sinon (cf comportement de get_data + // appelée dans put (port provides) + //OLD : DataManipulator::delete_data(copyOfData); + } +} + + +template +void +GenericUsesPort< DataManipulator, CorbaPortType, repositoryName, UsesPort + >::uses_port_changed(Engines::DSC::uses_port * new_uses_port, + const Engines::DSC::Message message) +{ + if (_my_ports) delete _my_ports; + +#ifdef _DEBUG_ + std::cerr << "GenericUsesPort::uses_port_changed" << std::endl; +#endif + _my_ports = new_uses_port; +} + +#endif diff --git a/src/DSC/DSC_User/Datastream/IteratorTraits.hxx b/src/DSC/DSC_User/Datastream/IteratorTraits.hxx new file mode 100644 index 000000000..c8d3de462 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/IteratorTraits.hxx @@ -0,0 +1,40 @@ +// 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 : IteratorTraits.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + +#ifndef _ITERATOR_TRAITS_HXX_ +#define _ITERATOR_TRAITS_HXX_ + +// Trait permettant d'accéder au type de donnée stockée +// dans une map +template < typename MapIterator > +struct iterator_t { + typedef typename MapIterator::value_type value_type1; + typedef typename value_type1::second_type value_type; +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Makefile.am b/src/DSC/DSC_User/Datastream/Makefile.am new file mode 100644 index 000000000..3b092508f --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Makefile.am @@ -0,0 +1,75 @@ +# 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 + +SUBDIRS = Palm Calcium + +# +# =============================================================== +# Header to be installed +# =============================================================== +# +# header files +salomeinclude_HEADERS = GenericPort.hxx \ + GenericProvidesPort.hxx \ + GenericUsesPort.hxx \ + DataIdFilter.hxx \ + CorbaTypeManipulator.hxx \ + CouplingPolicy.hxx \ + DisplayPair.hxx \ + FindKeyPredicate.hxx \ + AdjacentFunctor.hxx \ + IteratorTraits.hxx \ + ConstTraits.hxx + +# +# =============================================================== +# Local definitions +# =============================================================== +# + +# This local variable defines the list of CPPFLAGS common to all target in this package. +COMMON_CPPFLAGS= @BOOST_CPPFLAGS@ -I$(top_srcdir)/src/DSC/DSC_User + +# This local variable defines the list of dependant libraries common to all target in this package. +COMMON_LIBS = $(top_builddir)/src/DSC/DSC_User/Datastream/Palm/libSalomePalm.la \ + $(top_builddir)/src/DSC/DSC_User/Datastream/Calcium/libSalomeCalcium.la + +# +# =============================================================== +# Libraries targets +# =============================================================== +# +lib_LTLIBRARIES = libSalomeDatastream.la + +libSalomeDatastream_la_SOURCES = fake.cc + +libSalomeDatastream_la_CXXFLAGS = $(COMMON_CPPFLAGS) + +libSalomeDatastream_la_LIBADD = $(COMMON_LIBS) + +libSalomeDatastream_la_LDFLAGS = -no-undefined -version-info=0:0:0 + diff --git a/src/DSC/DSC_User/Datastream/Palm/Makefile.am b/src/DSC/DSC_User/Datastream/Palm/Makefile.am new file mode 100644 index 000000000..95f99cfa7 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Palm/Makefile.am @@ -0,0 +1,82 @@ +# 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 + +# +# =============================================================== +# Header to be installed +# =============================================================== +# +# header files +salomeinclude_HEADERS = palm_port_factory.hxx \ + palm_data_short_port_provides.hxx \ + palm_data_seq_short_port_provides.hxx \ + PalmCouplingPolicy.hxx + +# +# =============================================================== +# 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_Basic \ + -I$(top_srcdir)/src/Utils \ + -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 = @CORBA_LIBS@ + +# +# =============================================================== +# Libraries targets +# =============================================================== +# +noinst_LTLIBRARIES = libSalomePalm.la + +libSalomePalm_la_SOURCES = palm_port_factory.cxx + +libSalomePalm_la_CXXFLAGS = $(COMMON_CPPFLAGS) + +libSalomePalm_la_LDFLAGS = -no-undefined -version-info=0:0:0 + +# +# =============================================================== +# Executables targets +# =============================================================== +# +noinst_PROGRAMS = test_DataIdContainer + +test_DataIdContainer_SOURCES = test_DataIdContainer.cxx + +test_DataIdContainer_CXXFLAGS = $(COMMON_CPPFLAGS) + +test_DataIdContainer_LDFLAGS = $(COMMON_LIBS) + diff --git a/src/DSC/DSC_User/Datastream/Palm/PalmCouplingPolicy.hxx b/src/DSC/DSC_User/Datastream/Palm/PalmCouplingPolicy.hxx new file mode 100644 index 000000000..c5f57fff4 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Palm/PalmCouplingPolicy.hxx @@ -0,0 +1,195 @@ +// 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 : PalmCouplingPolicy.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-29 16:12:41 +0100 (lun, 29 jan 2007) $ +// Id : $Id$ + +#ifndef _PALM_COUPLING_POLICIES_HXX_ +#define _PALM_COUPLING_POLICIES_HXX_ + +#include + +#include +#include +#include "DataIdFilter.hxx" +#include "DisplayPair.hxx" +#include "CouplingPolicy.hxx" + +class PalmCouplingPolicy: public CouplingPolicy { + + // Objet de filtrage et conversion d'un TIME + filtre_conversion filtre_convert_TIME ; + // Objet de filtrage et conversion d'un TAG + filtre_conversion filtre_convert_TAG ; + +public: + + template class InternalDataIdContainer; + template friend class InternalDataIdContainer; + + filtre_conversion * get_filtre_convert_TIME() { return &filtre_convert_TIME; } + filtre_conversion * get_filtre_convert_TAG() { return &filtre_convert_TAG; } + + // Classe DataId rassemblant les paramètres de la méthode PORT::put + // qui identifient l'instance d'une donnée pour Palm + // Rem : Le DataId doit pouvoir être une key dans une map stl + typedef CORBA::Long TimeType; + typedef CORBA::Long TagType; + typedef std::pair < TimeType , TagType > DataId; + typedef InternalDataIdContainer < TimeType , TagType > DataIdContainer; + + TimeType getTime(const DataId &dataId) const { return dataId.first;} + TagType getTag (const DataId &dataId) const { return dataId.second;} + + // Container qui permet d'itérer sur l'ensemble des DataId générés par les + // eventuelles conversions + template class InternalDataIdContainer { + + std::vector _lTime; + std::vector _lTag; + + // Interdit la construction d'un container vide car + // aucune méthode d'ajout d'élément n'a été implémentée + InternalDataIdContainer() {} + + public: + typedef DataId value_type; + template class DataIdIterator; + typedef DataIdIterator iterator; + typedef value_type & reference; + typedef value_type const & const_reference; + + // Remplit le container d'identificateurs après avoir appliqué + // les filtres/convertions des paramètres "TIMEs" et des "TAGs" + InternalDataIdContainer(const DataId & dataId, const PalmCouplingPolicy & policy ) { + std::cout << "----Cst ---- InternalDataIdContainer(const DataId & dataId..) " << dataId <::iterator i=_lTime.begin();i!=_lTime.end();++i) + std::cout << "_lTime["<< c++ << "] : " << *i << std::endl; + policy.filtre_convert_TAG.applique_filtre_conversion(dataId.second, _lTag); + c=0; + for(vector::iterator i=_lTag.begin();i!=_lTag.end();++i) + std::cout << "_lTag["<< c++ << "] : " << *i << std::endl; + } + + // Pas encore testé + InternalDataIdContainer(std::vector const & lTime, std::vector const & lTag): + _lTime(lTime),_lTag(lTag) {} + + + // Pas encore testé + InternalDataIdContainer( InternalDataIdContainer const & pc): + _lTime(pc._lTime), _lTag(pc._lTag) {} + + + // Pas encore testé + InternalDataIdContainer & operator=(const InternalDataIdContainer & pc) { + if (this != &pc) { _lTime=pc._lTime; _lTag=pc._lTag; } + return *this; + } + + virtual ~InternalDataIdContainer() {} + + iterator begin() { return iterator(*this); } + iterator end() { return iterator(*this,_lTime.end(),_lTag.end()); } + // En Palm les deux paramètres du couple (temps,tag) doivent + // exister (un seul paramètre n'est pas recevable) + bool empty() const { return _lTime.empty() || _lTag.empty(); } + + // Définition de l'itérateur du container + template class DataIdIterator { + + public: + + typedef typename std::vector::const_iterator ItTime; + typedef typename std::vector::const_iterator ItTag; + + private: + ItTime _itTime; + ItTag _itTag; + const InternalDataIdContainer & _pc; + DataIdIterator() {} + + public: + + + // Pas encore testé + DataIdIterator(const InternalDataIdContainer & pc): + _pc(pc),_itTime(pc._lTime.begin()),_itTag(pc._lTag.begin()) {} + DataIdIterator(const InternalDataIdContainer & pc, ItTime itTime, ItTag itTag): + _pc(pc),_itTime(itTime),_itTag(itTag) {} + // Pas encore testé + DataIdIterator(const DataIdIterator & dIt): + _pc(dIt._pc),_itTime(dIt._itTime),_itTag(dIt._itTag) {} + ~DataIdIterator() {} + + + // Pas encore testé + DataIdIterator & operator=(const DataIdIterator & dIt) { + if (this != &dIt) { + _pc=dIt._pc;_itTime=dIt._itTime;_itTag=dIt._itTag; + } + return *this; + } + + DataId operator*() const { + std::cout << "-------- operator*(), *_itTime : " << *_itTime << " *_itTag " << *_itTag <, + PalmCouplingPolicy > +{ + typedef Ports::Palm_Ports::seq_short CorbaDataType; + typedef seq_u_manipulation DataManipulator; + typedef GenericPort< DataManipulator, PalmCouplingPolicy > Port; + + public : + palm_data_seq_short_port_provides() {} + virtual ~palm_data_seq_short_port_provides() {} + + void put(DataManipulator::CorbaInType data, CORBA::Long time, CORBA::Long tag) { + Port::put(data, time, tag); + } + + Ports::Port_ptr get_port_ref() { + return _this(); + } +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Palm/palm_data_short_port_provides.hxx b/src/DSC/DSC_User/Datastream/Palm/palm_data_short_port_provides.hxx new file mode 100644 index 000000000..8abd7de29 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Palm/palm_data_short_port_provides.hxx @@ -0,0 +1,57 @@ +// 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 : palm_data_short_port_provides.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL + +#ifndef _PALM_DATA_SHORT_PORT_PROVIDES_HXX_ +#define _PALM_DATA_SHORT_PORT_PROVIDES_HXX_ + +#include "Palm_Ports.hh" +#include "provides_port.hxx" +#include "GenericPort.hxx" +#include "PalmCouplingPolicy.hxx" + +class palm_data_short_port_provides : + public virtual POA_Ports::Palm_Ports::Palm_Data_Short_Port, + public virtual provides_port, + public virtual GenericPort< atom_manipulation< CORBA::Short >, PalmCouplingPolicy > + +{ + typedef CORBA::Short CorbaDataType; + typedef atom_manipulation < CorbaDataType > DataManipulator; + typedef GenericPort< DataManipulator, PalmCouplingPolicy > Port; + + public : + palm_data_short_port_provides() {} + virtual ~palm_data_short_port_provides() {} + + void put(DataManipulator::CorbaInType data, CORBA::Long time, CORBA::Long tag) { + Port::put(data, time, tag); + } + + virtual Ports::Port_ptr get_port_ref() { + return _this(); + } +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.cxx b/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.cxx new file mode 100644 index 000000000..2c194efb1 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.cxx @@ -0,0 +1,53 @@ +// 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 : palm_port_factory.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + + +#include "palm_port_factory.hxx" + +palm_port_factory::palm_port_factory() { +} + +palm_port_factory::~palm_port_factory() {} + +provides_port * +palm_port_factory::create_data_servant(string type) { + provides_port * rtn_port = NULL; + if (type == "short") { + rtn_port = new palm_data_short_port_provides(); + } + if (type == "seq_short") { + rtn_port = new palm_data_seq_short_port_provides(); + } + return rtn_port; +} + +uses_port * +palm_port_factory::create_data_proxy(string type) { + uses_port * rtn_port = NULL; + return rtn_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 new file mode 100644 index 000000000..544a9c1eb --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.hxx @@ -0,0 +1,55 @@ +// 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 : palm_port_factory.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + + +#ifndef _PALM_PORT_FACTORY_HXX_ +#define _PALM_PORT_FACTORY_HXX_ + +#include "port_factory.hxx" +#include "uses_port.hxx" +#include "provides_port.hxx" +#include + +#include "palm_data_short_port_provides.hxx" +#include "palm_data_seq_short_port_provides.hxx" + +using namespace std; + +class palm_port_factory : + public port_factory +{ + public: + palm_port_factory(); + virtual ~palm_port_factory(); + + virtual provides_port * create_data_servant(string type); + virtual uses_port * create_data_proxy(string type); +}; + +#endif + diff --git a/src/DSC/DSC_User/Datastream/Palm/test_DataIdContainer.cxx b/src/DSC/DSC_User/Datastream/Palm/test_DataIdContainer.cxx new file mode 100644 index 000000000..aea01def9 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Palm/test_DataIdContainer.cxx @@ -0,0 +1,123 @@ +// 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 : test_DataIdContainer.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL + +#include "PalmCouplingPolicy.hxx" + +#include "palm_data_short_port_provides.hxx" + +//using namespace PalmCouplingPolicy; + +class TEST1 : public PalmCouplingPolicy { +public: + TEST1() { + + std::cout << "------------ TEST1 --------------" << std::endl; + + int ret=0; + + CORBA::Long time=1,tag=1; + typedef PalmCouplingPolicy::DataIdContainer DataIdContainer; + typedef PalmCouplingPolicy::DataId DataId; + + DataId dataId(time,tag); //potentiellement avec un troisième paramètre + //std::vector a(1,time);std::vector b(1,tag); + //DataIdContainer dataIds(a,b); + + std::cout << "-------- MARK 1 --"<< dataId <<"----------------" << std::endl; + + filtre_conversion * f_time = get_filtre_convert_TIME(); + filtre_conversion * f_tag = get_filtre_convert_TAG(); + + // On accepte les temps de 1 à 100 sans conversion + filtre_elementaire * f_time_el = new filtre_elementaire(1, 100); + f_time->config_elementaire(*f_time_el); + + // On accepte que les tags 1 et ce sans conversion + filtre_elementaire * f_time_tag = new filtre_elementaire(1); + f_tag->config_elementaire(*f_time_tag); + + DataIdContainer dataIds(dataId,*this); + + DataIdContainer::iterator dataIdIt = dataIds.begin(); + + if (!dataIds.empty()) + for (;dataIdIt != dataIds.end();++dataIdIt) { + std::cout << "-------- MARK 2 --"<< *dataIdIt <<"----------------" << std::endl; + + } + } +}; + +class TEST2 : public PalmCouplingPolicy { +public: + TEST2() { + + std::cout << "------------ TEST2 --------------" << std::endl; + + int ret=0; + + CORBA::Long time=1,tag=1; + typedef PalmCouplingPolicy::DataIdContainer DataIdContainer; + typedef PalmCouplingPolicy::DataId DataId; + + DataId dataId(time,tag); //potentiellement avec un troisième paramètre + //std::vector a(1,time);std::vector b(1,tag); + //DataIdContainer dataIds(a,b); + + std::cout << "-------- MARK 1 --"<< dataId <<"----------------" << std::endl; + + filtre_conversion * f_time = get_filtre_convert_TIME(); + filtre_conversion * f_tag = get_filtre_convert_TAG(); + + + filtre_elementaire * f_time_2 = new filtre_elementaire(1); + filtre_elementaire * g_time_2 = new filtre_elementaire(2); + f_time->config_elementaire(*f_time_2, *g_time_2); + filtre_elementaire * f_time_3 = new filtre_elementaire(1); + f_time->config_elementaire(*f_time_3); + + // On accepte que les tags 1 et ce sans conversion + filtre_elementaire * f_time_tag = new filtre_elementaire(1); + f_time_tag = new filtre_elementaire(1); + f_tag->config_elementaire(*f_time_tag); + + + DataIdContainer dataIds(dataId,*this); + + DataIdContainer::iterator dataIdIt = dataIds.begin(); + + if (!dataIds.empty()) + for (;dataIdIt != dataIds.end();++dataIdIt) { + std::cout << "-------- MARK 2 --"<< *dataIdIt <<"----------------" << std::endl; + + } + } +}; + +int main() { + TEST1 test1; + TEST2 test2; +}; + diff --git a/src/DSC/DSC_User/Datastream/ProcessTimeIntervalTraits.hxx b/src/DSC/DSC_User/Datastream/ProcessTimeIntervalTraits.hxx new file mode 100644 index 000000000..b028ff13b --- /dev/null +++ b/src/DSC/DSC_User/Datastream/ProcessTimeIntervalTraits.hxx @@ -0,0 +1,68 @@ +// 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 : ProcessTimeIntervalTraits.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + +#ifndef _PROCESS_TIME_INTERVAL_TRAIT_HXX_ +#define _PROCESS_TIME_INTERVAL_TRAIT_HXX_ + +#include "IteratorTraits.hxx" + +// Par défaut les classes définissant un mode de couplage n'implémentent pas +// de traitement particulier pour une de demande de données identifiées à partir +// d'un dataId non reçu mais encadré par deux dataIds +// Ce trait peut être spécialisé pour la classe de couplage pour effectuer +// le traitement de son choix +template struct ProcessTimeIntervalTraits { + + template < typename Iterator > + std::pair::value_type > + static inline apply(typename WhatEver::DataId dataId, Iterator it1) { + typedef typename iterator_t::value_type value_type; + return std::make_pair (0,0); + } +}; + +// class CalciumCoulpingPolicy; +// template < typename Iterator > +// typename iterator_t::value_type +// CalciumCoulpingPolicy::processTimeInterval (DataId & dataId, +// Iterator & it1, Iterator & it2); +#include "CalciumCouplingPolicy.hxx" +template <> struct ProcessTimeIntervalTraits { + + template < class Iterator > + std::pair::value_type> + static inline apply(CalciumCouplingPolicy::DataId dataId, Iterator it1) { + + Iterator it2=it1; it2++; + + typedef typename iterator_t::value_type value_type; + return std::make_pair (1,processTimeInterval(dataId,it1,it2)); + } +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/fake.cc b/src/DSC/DSC_User/Datastream/fake.cc new file mode 100644 index 000000000..ca947860d --- /dev/null +++ b/src/DSC/DSC_User/Datastream/fake.cc @@ -0,0 +1,27 @@ +// 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 : fake.cc +// Author : Eric Fayolle (EDF) +// Module : KERNEL +void fake_method(void) { +int fake_int; +}; diff --git a/src/DSC/DSC_User/Datastream/testAdjacentFunctor.cxx b/src/DSC/DSC_User/Datastream/testAdjacentFunctor.cxx new file mode 100644 index 000000000..8b0527a42 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/testAdjacentFunctor.cxx @@ -0,0 +1,175 @@ +// 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 : testAdjacentFunctor.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + +#include +#include +#include +#include +#include +#include +#include + +#include "DisplayPair.hxx" +#include "AdjacentFunctor.hxx" + +#include +#include +#include + +struct MyRand { + static const double MAXVALUE = 150.0; + MyRand() { srand(getpid()); } + int operator()() const { + return 1+(int) ( MAXVALUE *rand()/(RAND_MAX +1.0)); + } +}; + +int main() { + typedef int Type; + const int N=20; + std::vector vect(N); + MyRand myRand; + + //TEST1 + std::generate(vect.begin(),vect.end(),myRand); + std::cout << "Vecteur généré aléatoirement :" << std::endl; + copy(vect.begin(),vect.end(),std::ostream_iterator(std::cout," ")); + std::cout<< std::endl; + + int valueToFind = myRand(); + std::cout << "La valeur recherchée est : " << valueToFind << std::endl; + + std::sort(vect.begin(),vect.end(),std::less< Type > ()); + std::cout << "Vecteur trié par ordre croissant :" << std::endl; + copy(vect.begin(),vect.end(),std::ostream_iterator(std::cout," ")); + std::cout<< std::endl; + + std::vector::iterator it,it1,it2; + AdjacentFunctor ap(valueToFind); + AdjacentFunctor & vap(ap); + // Ne peut pas marcher à cause de la recopie du prédicat !! + it = std::find_if(vect.begin(),vect.end(),vap); + // On peut garder la valeur prédente de l'itérateur + // si l'itérateur n'est pas reverse +// for (it = vect.begin(); it!=vect.end(); ++it) +// if ( ap(*it) ) break; + + if ( it == vect.end() ) { + std::cout << " Je n'ai pas trouvé la valeur " << valueToFind << std::endl; + } else { + if ( (*it) == valueToFind ) std::cout << " La valeur est trouvée *it :" << (*it) << std::endl; + else { + // Type min,max; + // if ( ap.getBounds(min,max) ) { + it2=it;it2--; + std::cout << "La valeur : " << valueToFind << " est encadrée par (*it) :" << (*it) << " et valeur de *(it-1) :" << (*it2) << std::endl; + } + } + + + + + // if ( it == vect.end() ) { +// std::cout << " Je n'ai pas trouvé la valeur " << valueToFind << std::endl; +// } else { +// if ( (*it) == valueToFind ) std::cout << " La valeur est trouvée *it :" << (*it) << std::endl; +// else { +// Type min,max; +// if ( ap.getBounds(min,max) ) { +// it2=it;it2--; +// std::cout << "La valeur : " << valueToFind << " est encadrée par (*it) :" << (*it) << " et valeur de *(it-1) :" << (*it2) << std::endl; +// } +// } +// } + + //TEST2 +// typedef std::map MapIntDouble; +// MapIntDouble myMap; +// MapIntDouble::const_iterator itM1,itM2; +// for(it=vect.begin(); it!=vect.end(); ++it) myMap[*it] = myRand(); + +// std::cout << "Clés de la Map :" << std::endl; +// for(itM1=myMap.begin();itM1!=myMap.end();++itM1) +// //std::cout << &((*itM1).first) +// std::cout << (*itM1).first << " "; +// std::cout<< std::endl; + +// AdjacentFunctor apMap(valueToFind); +// for (itM1 = myMap.begin(); itM1 != myMap.end(); ++itM1) +// if ( apMap(itM1->first) ) break; + +// if ( itM1 == myMap.end() ) { +// std::cout << " Je n'est pas trouvé la valeur " << valueToFind << std::endl; +// } else { +// if ( (itM1->first) == valueToFind ) std::cout << " La valeur est trouvée itM1->first :" << (itM1->first) << std::endl; +// else { +// Type min,max; +// if ( apMap.getBounds(min,max) ) { +// itM2=itM1;itM2--; +// std::cout << "La valeur " << valueToFind << " est encadrée par (itM1->first) :" << (itM1->first) << " et valeur de (it-1)->first :" << (itM2->first) << std::endl; +// } +// } +// } + + // TEST3 +// typedef std::map, double> MapIntDouble_Double; +// MapIntDouble_Double myMapP; +// MapIntDouble_Double::const_iterator itMP1,itMP2; +// for(it=vect.begin(); it!=vect.end(); ++it) myMapP[std::make_pair(*it,myRand())] = myRand(); +// //myMapP[std::make_pair(*(vect.begin()),myRand())] = myRand(); + +// std::cout << "Clés de la MapP :" << std::endl; +// for(itMP1=myMapP.begin();itMP1!=myMapP.end();++itMP1) +// std::cout << (*itMP1).first << " " ; +// std::cout<< std::endl; + +// //AdjacentPredicate > apMap(valueToFind); +// std::pair valuePToFind=std::make_pair(valueToFind,myRand()); +// //std::pair valuePToFind=myMapP.begin()->first; +// AdjacentFunctor< MapIntDouble_Double::key_type > apMapP(valuePToFind); +// for (itMP1 = myMapP.begin(); itMP1 != myMapP.end(); ++itMP1) +// if ( apMapP(itMP1->first) ) break; + +// if ( itMP1 == myMapP.end() ) { +// std::cout << " Je n'est pas trouvé la valeur " << valuePToFind << std::endl; +// } else { +// if ( (itMP1->first) == valuePToFind ) std::cout << " La valeur est trouvée itMP1->first :" << (itMP1->first) << std::endl; +// else { +// MapIntDouble_Double::key_type min,max; +// if ( apMapP.getBounds(min,max) ) { +// itMP2=itMP1;itMP2--; +// std::cout << "La valeur " << valuePToFind << " est encadrée par (itMP1->first) :" << (itMP1->first) << " et valeur de (it-1)->first :" << (itMP2->first) << std::endl; +// } +// } +// } + + + std::cout<< std::endl; + +}; + diff --git a/src/DSC/DSC_User/Datastream/testAdjacentPredicate.cxx b/src/DSC/DSC_User/Datastream/testAdjacentPredicate.cxx new file mode 100644 index 000000000..20fa84496 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/testAdjacentPredicate.cxx @@ -0,0 +1,142 @@ +// 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 : testAdjacentPredicate.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-01-08 19:01:14 +0100 (lun, 08 jan 2007) $ +// Id : $Id$ + +#include "AdjacentPredicate.hxx" +#include "DisplayPair.hxx" + +#include + +#include +#include +#include +#include + +#include +#include +#include + +struct MyRand { + static const double MAXVALUE = 150.0; + MyRand() { srand(getpid()); } + int operator()() const { + return 1+(int) ( MAXVALUE *rand()/(RAND_MAX +1.0)); + } +}; + +typedef int TimeType; +typedef double TagType; +typedef std::pair< TimeType , TagType > DataId; + +template < typename DataType > + DataType processTimeInterval (DataId & dataId, + typename std::map::const_iterator const & it1) { + return (*it1).second; +}; + +int main() { + typedef int Type; + const int N=20; + std::vector vect(N); + MyRand myRand; + + //TEST1 + std::generate(vect.begin(),vect.end(),myRand); + std::cout << "Vecteur généré aléatoirement :" << std::endl; + copy(vect.begin(),vect.end(),std::ostream_iterator(std::cout," ")); + std::cout<< std::endl; + + int valueToFind = myRand(); + + std::sort(vect.begin(),vect.end(),std::less< Type > ()); + std::cout << "Vecteur trié par ordre croissant :" << std::endl; + copy(vect.begin(),vect.end(),std::ostream_iterator(std::cout," ")); + std::cout<< std::endl; + + std::vector::iterator it; + AdjacentPredicate ap(valueToFind); + it = std::adjacent_find(vect.begin(),vect.end(),ap); + if ( it == vect.end() ) + std::cout << "Je n'est pas trouvé d'intervalle pour encadrer " << valueToFind << std::endl; + else + std::cout << "La valeur à trouver : " << valueToFind <<" est entre * it :" << *it << " et valeur de *(it+1) :" << *(it+1) << std::endl; + std::cout<< std::endl; + + //TEST2 + typedef std::map MapIntDouble; + MapIntDouble myMap; + MapIntDouble::const_iterator itM1,itM2; + for(it=vect.begin(); it!=vect.end(); ++it) myMap[*it] = myRand(); + + std::cout << "Clés de la Map :" << std::endl; + for(itM1=myMap.begin();itM1!=myMap.end();++itM1) + //std::cout << &((*itM1).first) + std::cout << (*itM1).first << " "; + std::cout<< std::endl; + + //AdjacentPredicate > apMap(valueToFind); + AdjacentPredicate< MapIntDouble::value_type > apMap(valueToFind); + itM1 = std::adjacent_find(myMap.begin(),myMap.end(),apMap); + itM2=itM1;itM2++; + if ( itM1 == myMap.end() ) + std::cout << "Map : Je n'est pas trouvé d'intervalle pour encadrer " << valueToFind << std::endl; + else { + std::cout << "Map : La valeur à trouver : " << valueToFind <<" est entre (*itM1).first :" << (*itM1).first << " et valeur de *(itM1+1).first :" << (*(itM2)).first << std::endl; + } + std::cout<< std::endl; + + // TEST3 + typedef std::map, double> MapPIntDouble_Double; + MapPIntDouble_Double myMapP; + MapPIntDouble_Double::const_iterator itMP1,itMP2; + // for(it=vect.begin(); it!=vect.end(); ++it) myMapP[std::make_pair(*it,myRand())] = myRand(); + myMapP[std::make_pair(*(vect.begin()),myRand())] = myRand(); + + std::cout << "Clés de la MapP :" << std::endl; + for(itMP1=myMapP.begin();itMP1!=myMapP.end();++itMP1) + std::cout << (*itMP1).first << " " ; + std::cout<< std::endl; + + //AdjacentPredicate > apMap(valueToFind); + // std::pair valuePToFind=std::make_pair(valueToFind,myRand()); + std::pair valuePToFind=myMapP.begin()->first; + AdjacentPredicate< MapPIntDouble_Double::value_type > apMapP(valuePToFind); + itMP1 = std::adjacent_find(myMapP.begin(),myMapP.end(),apMapP); + itMP2=itMP1;itMP2++; + if ( itMP1 == myMapP.end() ) + std::cout << "MapP : Je n'est pas trouvé d'intervalle pour encadrer " << valuePToFind << std::endl; + else { + std::cout << "MapP : La valeur à trouver : " << valuePToFind <<" est entre (*itMP1).first :" << (*itMP1).first << " et valeur de *(itMP1+1).first :" << (*(itMP2)).first << std::endl; + } + + std::cout << processTimeInterval(valuePToFind,itMP1); + std::cout<< std::endl; + + std::cout<< std::endl; + +}; + diff --git a/src/DSC/DSC_User/Makefile.am b/src/DSC/DSC_User/Makefile.am new file mode 100644 index 000000000..7db5294da --- /dev/null +++ b/src/DSC/DSC_User/Makefile.am @@ -0,0 +1,97 @@ +# 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) +# Module : KERNEL + + +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + +# +# =============================================================== +# Header to be installed +# =============================================================== +# +# header files +salomeinclude_HEADERS = base_port.hxx \ + uses_port.hxx \ + provides_port.hxx \ + Superv_Component_i.hxx \ + DSC_Exception.hxx \ + port_factory.hxx + +# +# =============================================================== +# Local definitions +# =============================================================== +# + +# This local variable defines the list of CPPFLAGS common to all target in this package. +COMMON_CPPFLAGS= -I$(srcdir)/Basic \ + -I$(srcdir)/Datastream \ + -I$(srcdir)/Datastream/Palm \ + -I$(srcdir)/Datastream/Calcium \ + -I$(top_srcdir)/src/Container \ + -I$(top_srcdir)/src/Notification \ + -I$(top_srcdir)/src/DSC/DSC_Basic \ + -I$(top_srcdir)/src/SALOMELocalTrace \ + -I$(top_srcdir)/src/Basics \ + -I$(top_srcdir)/src/Utils \ + -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 = + +# +# =============================================================== +# Libraries targets +# =============================================================== +# +lib_LTLIBRARIES = libSalomeDSCSuperv.la + +libSalomeDSCSuperv_la_SOURCES = base_port.cxx \ + uses_port.cxx \ + provides_port.cxx \ + Superv_Component_i.cxx + +libSalomeDSCSuperv_la_CXXFLAGS = $(COMMON_CPPFLAGS) + +libSalomeDSCSuperv_la_LDFLAGS = -no-undefined -version-info=0:0:0 + +# +# =============================================================== +# Executables targets +# =============================================================== +# +noinst_PROGRAMS = test_DSC_Exception + +test_DSC_Exception_SOURCES = test_DSC_Exception.cxx + +test_DSC_Exception_CXXFLAGS = $(COMMON_CPPFLAGS) + +test_DSC_Exception_LDADD = $(top_builddir)/src/Utils/libOpUtil.la \ + $(CORBA_LIBS) + +SUBDIRS = Basic Datastream diff --git a/src/DSC/DSC_User/Superv_Component_i.cxx b/src/DSC/DSC_User/Superv_Component_i.cxx new file mode 100644 index 000000000..3f2a3e972 --- /dev/null +++ b/src/DSC/DSC_User/Superv_Component_i.cxx @@ -0,0 +1,316 @@ +// 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 : Superv_Component_i.cxx +// Author : André RIBES (EDF), Eric Fayolle (EDF) +// Module : KERNEL + +#include "Superv_Component_i.hxx" + +DSC_EXCEPTION_CXX(Superv_Component_i,BadFabType); +DSC_EXCEPTION_CXX(Superv_Component_i,BadType); +DSC_EXCEPTION_CXX(Superv_Component_i,BadCast); +DSC_EXCEPTION_CXX(Superv_Component_i,UnexpectedState); +DSC_EXCEPTION_CXX(Superv_Component_i,PortAlreadyDefined); +DSC_EXCEPTION_CXX(Superv_Component_i,PortNotDefined); +DSC_EXCEPTION_CXX(Superv_Component_i,PortNotConnected); +DSC_EXCEPTION_CXX(Superv_Component_i,NilPort); +DSC_EXCEPTION_CXX(Superv_Component_i,BadProperty); + +Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName, + bool notif) : + Engines_DSC_i(orb, poa, contId, instanceName, interfaceName) +{ +#ifdef _DEBUG_ + std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl; +#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() +{ + factory_map_t::iterator begin = _factory_map.begin(); + factory_map_t::iterator end = _factory_map.end(); + for(;begin!=end;begin++) + { + delete begin->second; + } + + my_superv_ports_it = my_superv_ports.begin(); + for(;my_superv_ports_it != my_superv_ports.end();my_superv_ports_it++) + delete my_superv_ports_it->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 std::string& port_fab_type) + throw (BadFabType) +{ + provides_port * rtn_port = NULL; + std::string factory_name; + std::string type_name; + int search_result; + + 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_port = factory->create_data_servant(type_name); + } + + if (rtn_port == NULL) + throw BadFabType( LOC(OSS()<< "Impossible d'accéder à la fabrique " + <create_data_proxy(type_name); + } + + if (rtn_proxy == NULL) + throw BadFabType( LOC(OSS()<< "Impossible d'accéder à la fabrique " + <get_port_properties(); + Ports::Port_var portref=port->get_port_ref(); + Engines_DSC_interface::add_provides_port(portref, + provides_port_name, + portproperties); + + superv_port_t * new_superv_port = new superv_port_t(); + new_superv_port->p_ref = port; + my_superv_ports[provides_port_name] = new_superv_port; + + } + catch (const Engines::DSC::PortAlreadyDefined&) { + throw PortAlreadyDefined( LOC(OSS()<< "Le port provides " + << provides_port_name <<" existe déjà.")); + } + catch (const Engines::DSC::NilPort&) { + throw NilPort( LOC(OSS()<< "Le pointeur sur port provides est nul.")); + } + catch (const Engines::DSC::BadProperty&) { + throw BadProperty( LOC(OSS()<< "La propriété est mal définie")); + } +} + +void +Superv_Component_i::add_port(uses_port * port, + const char* uses_port_name) + throw (PortAlreadyDefined, NilPort, BadProperty) +{ + assert(port); + assert(uses_port_name); + + try { + Ports::PortProperties_var portproperties=port->get_port_properties(); + Engines_DSC_interface::add_uses_port(port->get_repository_id(), + uses_port_name, + portproperties); + superv_port_t * new_superv_port = new superv_port_t(); + new_superv_port->u_ref = port; + my_superv_ports[uses_port_name] = new_superv_port; + } + catch (const Engines::DSC::PortAlreadyDefined&) { + throw PortAlreadyDefined( LOC(OSS()<< "Le port uses " + << uses_port_name <<" existe déjà.")); + } + catch (const Engines::DSC::NilPort&) { + throw NilPort( LOC(OSS()<< "Le pointeur sur port uses est nul.")); + } + catch (const Engines::DSC::BadProperty&) { + throw BadProperty( LOC(OSS()<< "La propriété est mal définie")); + } +} + +void +Superv_Component_i::get_port(provides_port *& port, + const char * provides_port_name) + throw (PortNotDefined,PortNotConnected) +{ + assert(provides_port_name); + + try { + Ports::Port_var portref=Engines_DSC_interface::get_provides_port(provides_port_name, false); + port = my_superv_ports[provides_port_name]->p_ref; + } catch (const Engines::DSC::PortNotDefined&) { + throw PortNotDefined( LOC(OSS()<< "Le port provides " + << provides_port_name <<" n'existe pas.")); + } catch (const Engines::DSC::PortNotConnected&) { + throw PortNotConnected( LOC(OSS()<< "Le port provides " << provides_port_name + << " n'est pas connecté.")); + } +} + +void +Superv_Component_i::get_port(uses_port *& port, + const char * uses_port_name) + throw (PortNotDefined, PortNotConnected) +{ + assert(uses_port_name); + + try { + Engines::DSC::uses_port * portseq=Engines_DSC_i::get_uses_port(uses_port_name); + delete portseq; + port = my_superv_ports[uses_port_name]->u_ref; + } catch (const Engines::DSC::PortNotDefined&) { + throw PortNotDefined( LOC(OSS()<< "Le port uses " + << uses_port_name <<" n'existe pas.")); + } catch (const Engines::DSC::PortNotConnected&) { + throw PortNotConnected( LOC(OSS()<< "Le port uses " << uses_port_name + << " n'est pas connecté.")); + } +} + + + +void +Superv_Component_i::provides_port_changed(const char* provides_port_name, + int connection_nbr, + const Engines::DSC::Message message) +{ + my_superv_ports_it = my_superv_ports.find(provides_port_name); + if (my_superv_ports_it != my_superv_ports.end()) + my_superv_ports[provides_port_name]->p_ref->provides_port_changed(connection_nbr, + message); +} + +void +Superv_Component_i::uses_port_changed(const char* uses_port_name, + Engines::DSC::uses_port * new_uses_port, + const Engines::DSC::Message message) +{ + my_superv_ports_it = my_superv_ports.find(uses_port_name); + if (my_superv_ports_it != my_superv_ports.end()) + my_superv_ports[uses_port_name]->u_ref->uses_port_changed(new Engines::DSC::uses_port(*new_uses_port), + message); + //delete the copy made by the caller + delete new_uses_port; +} + + + +void +Superv_Component_i::get_uses_port_names(std::vector & port_names, + const std::string servicename) const { + + port_names.reserve(my_superv_ports.size()); + + superv_ports::const_iterator it; + + for (it=my_superv_ports.begin(); it!=my_superv_ports.end();++it) + if( (*it).second->p_ref == NULL ) port_names.push_back((*it).first); +} diff --git a/src/DSC/DSC_User/Superv_Component_i.hxx b/src/DSC/DSC_User/Superv_Component_i.hxx new file mode 100644 index 000000000..174380f05 --- /dev/null +++ b/src/DSC/DSC_User/Superv_Component_i.hxx @@ -0,0 +1,382 @@ +// 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 : Superv_Component_i.hxx +// Author : André RIBES (EDF), Eric Fayolle (EDF) +// Module : KERNEL + +#ifndef _SUPERV_COMPONENT_I_HXX_ +#define _SUPERV_COMPONENT_I_HXX_ + +#include "DSC_i.hxx" +#include "base_port.hxx" +#include "uses_port.hxx" +#include "provides_port.hxx" +#include "port_factory.hxx" + +// default ports factories in the Kernel +#include "basic_port_factory.hxx" +#include "palm_port_factory.hxx" +#include "calcium_port_factory.hxx" + +#include "DSC_Exception.hxx" + + +using namespace std; + +/*! \class Superv_Component_i + * \brief This class implements DSC_User component. + * + * This class allows a higher programming level than DSC_Basic. It enables + * a programming level for service's developpers who want to use DSC ports. + * + * This class has two level for using and declare ports. The higher level proposes + * operations to add ports that are provided by default by Salomé like Calcium ports. + * It provides too some methods to add their own DSC_User ports. + * + * \note This class doesn't implement the init_service CORBA operation. + */ +class Superv_Component_i : + public Engines_DSC_i, + virtual public POA_Engines::Superv_Component +{ +public: + Superv_Component_i(CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName, + bool notif = false); + virtual ~Superv_Component_i(); + + // Exceptions declarations. + // There are defined on the Superv_Component_i.cxx to avoid problems + // from dlopen. + DSC_EXCEPTION(BadFabType); + DSC_EXCEPTION(BadType); + DSC_EXCEPTION(BadCast); + DSC_EXCEPTION(UnexpectedState); + DSC_EXCEPTION(PortAlreadyDefined); + DSC_EXCEPTION(PortNotDefined); + DSC_EXCEPTION(PortNotConnected); + DSC_EXCEPTION(NilPort); + DSC_EXCEPTION(BadProperty); + + /*! + * \warning currently disabled. + */ + virtual provides_port * create_provides_control_port() + {return NULL;} + + /*! + * \warning currently disabled. + */ + virtual provides_port * create_provides_data_and_control_port(const char* port_type) + {return NULL;} + + /*! + * \warning currently disabled. + */ + virtual uses_port * create_uses_control_port() + {return NULL;} + + /*! + * \warning currently disabled. + */ + virtual uses_port * create_uses_data_and_control_port(const char* port_type) + {return NULL;} + + /*! + * This method permits to create a provides port provided by the platform. + * (See documentation of DSC for knoing these ports). + * + * + * \param port_fab_type type provides port. + * \return the provides port. + * + * \note It's user repsonsability to destroy the provides port. + */ + virtual provides_port * create_provides_data_port(const std::string& port_fab_type) + throw (BadFabType); + + + /*! + * This method permits to create a uses port provided by the platform. + * (See documentation of DSC for knoing these ports). + * + * + * \param port_fab_type type uses port. + * \return the uses port. + * + * \note It's user repsonsability to destroy the uses port. + */ + virtual uses_port * create_uses_data_port(const std::string& port_fab_type) + throw (BadFabType); + + /*! + * Adds a port to the component. With this method only Salomé's provided DSC ports + * can be added. + * + * \param port_fab_type type of the port. + * \param port_type uses or provides. + * \param port_name the name of the port in the component. + */ + virtual void add_port(const char * port_fab_type, + const char * port_type, + const char * port_name) + throw (PortAlreadyDefined, BadFabType, BadType, BadProperty); + + /*! + * Adds a port to the component. With this method only Salomé's provided DSC ports + * can be added. + * + * \param port_fab_type type of the port. + * \param port_type uses or provides. + * \param port_name the name of the port in the component. + * \return the created port. + */ + 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); + + /*! + * Adds a created provides port to the component. + * + * \param port the provides port. + * \param provides_port_name the name of the port in the component. + */ + virtual void add_port(provides_port * port, + const char* provides_port_name) + throw (PortAlreadyDefined, NilPort, BadProperty); + + /*! + * Adds a created uses port to the component. + * + * \param port the uses port. + * \param uses_port_name the name of the port in the component. + */ + virtual void add_port(uses_port * port, + const char* uses_port_name) + throw (PortAlreadyDefined, NilPort, BadProperty); + + /*! + * Gets the provides port already added in the component. + * + * \param port the provides port pointer. + * \param provides_port_name the name of the port. + */ + virtual void get_port(provides_port *& port, + const char* provides_port_name) + throw (PortNotDefined, PortNotConnected); + + /*! + * Gets the uses port already added in the component. + * + * \param port the uses port pointer. + * \param uses_port_name the name of the port. + */ + virtual void get_port(uses_port *& port, + const char* uses_port_name) + throw (PortNotDefined, PortNotConnected); + + /*! + * Gets the list of the ports of a service. + * If servicename is not set, all the ports of the component are + * returned. + * + * \param port_names the ports's list. + * \param servicename service's name. + */ + virtual void get_uses_port_names(std::vector & port_names, + const std::string servicename="") const; + + /*! + * Gets a port already added in the component. + * + * \param port_name the name of the port. + * \return a port's pointer. + */ + template + SpecificPortType * get_port( const char * port_name) + throw (PortNotDefined, PortNotConnected, BadCast, UnexpectedState); + + /*! + * \see DSC_Callbacks::provides_port_changed + */ + virtual void provides_port_changed(const char* provides_port_name, + int connection_nbr, + const Engines::DSC::Message message); + + /*! + * \see DSC_Callbacks::uses_port_changed + */ + virtual void uses_port_changed(const char* uses_port_name, + Engines::DSC::uses_port * new_uses_port, + const Engines::DSC::Message message); + + + /*! + * 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); + +private: + // Factory map + typedef std::map factory_map_t; + factory_map_t _factory_map; + + /*-------------------------------------------------*/ + // A Superv_Component port. + struct superv_port_t { + superv_port_t():u_ref(NULL),p_ref(NULL){}; + ~superv_port_t() + { + if(u_ref)delete u_ref; + if(p_ref)delete p_ref; + }; + // For uses ports. + uses_port * u_ref; + // For provides ports. + provides_port * p_ref; + }; + + typedef std::map superv_ports; + + /*-------------------------------------------------*/ + /*-------------------------------------------------*/ + + superv_ports my_superv_ports; + superv_ports::iterator my_superv_ports_it; +}; + + + +template < typename SpecificPortType > SpecificPortType * +Superv_Component_i::add_port(const char * port_fab_type, + const char * port_type, + const char * port_name) + throw (PortAlreadyDefined, BadFabType, BadType, BadCast, BadProperty) +{ + assert(port_fab_type); + assert(port_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") { + provides_port * port = create_provides_data_port(port_fab_type); + add_port(port, port_name); + retPort = dynamic_cast(port); + if ( retPort == NULL ) { delete port; + throw BadCast( LOC("La conversion vers le type de port demandé n'est pas possible " )); + } + } + 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 " )); + } + } + else + throw BadType(LOC(OSS()<< "Le port_type doit être soit 'provides' soit 'uses' not " + << port_type)); + + return retPort; +}; + + +template SpecificPortType * +Superv_Component_i::get_port( const char * port_name) + throw (PortNotDefined, PortNotConnected, BadCast, UnexpectedState) +{ + assert(port_name); + + SpecificPortType * retPort; + base_port * port; + + my_superv_ports_it = my_superv_ports.find(port_name); + if (my_superv_ports_it == my_superv_ports.end()) + { + throw PortNotDefined( LOC(OSS()<< "Port " << port_name <<" does not exist")); + } + + superv_port_t * superv_port = my_superv_ports[port_name]; + try { + if ( superv_port->p_ref != NULL ) { + port = superv_port->p_ref; + Ports::Port_var portref=Engines_DSC_interface::get_provides_port(port_name, false); + } + else if ( superv_port->u_ref != NULL ) { + port = superv_port->u_ref; + Engines::DSC::uses_port * portseq=Engines_DSC_i::get_uses_port(port_name); + delete portseq; + } else { + throw UnexpectedState( LOC(OSS()<< "Internal Error superv_port struct is inconsistent ")); + + } + } catch (const Engines::DSC::PortNotDefined&) { + throw PortNotDefined( LOC(OSS()<< "Le port " + << port_name <<" n'existe pas.")); + } catch (const Engines::DSC::PortNotConnected&) { + throw PortNotConnected( LOC(OSS()<< "Le port " << port_name + << " n'est pas connecté.")); + } + + retPort = dynamic_cast(port); + if ( retPort == NULL ) { + delete port; + throw BadCast( LOC("La conversion vers le type de port demandé n'est pas possible " )); + } + + return retPort; +}; + + +#endif diff --git a/src/DSC/DSC_User/base_port.cxx b/src/DSC/DSC_User/base_port.cxx new file mode 100644 index 000000000..a944500fc --- /dev/null +++ b/src/DSC/DSC_User/base_port.cxx @@ -0,0 +1,18 @@ +#include "base_port.hxx" + + +base_port::base_port() +{ + default_properties = new PortProperties_i(); +} + +base_port::~base_port() +{ + delete default_properties; +} + +Ports::PortProperties_ptr +base_port::get_port_properties() +{ + return default_properties->_this(); +} diff --git a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx b/src/DSC/DSC_User/base_port.hxx similarity index 57% rename from src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx rename to src/DSC/DSC_User/base_port.hxx index ea8080e89..eed215e04 100644 --- a/src/SALOMEDS/SALOMEDS_ExpandableAttribute.jxx +++ b/src/DSC/DSC_User/base_port.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 @@ -21,23 +19,34 @@ // // // -// File : SALOMEDS_ExpandableAttribute.jxx -// Author : Yves FRICAUD -// Module : SALOME -// $Header$ +// File : base_port.hxx +// Author : Eric Fayolle (EDF), André RIBES (EDF) +// Module : KERNEL + +#ifndef _PORT_HXX_ +#define _PORT_HXX_ + +#include "PortProperties_i.hxx" +/* + * This class is base class for all DSC_User provides and uses port. + * It provides a default property object for the port. + */ +class base_port +{ +public : + base_port(); + virtual ~base_port(); + + /*! + * This is used to get the property object of the port. + * + * \return property's CORBA reference. + */ + virtual Ports::PortProperties_ptr get_port_properties(); + +protected : + PortProperties_i * default_properties; +}; -#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/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/provides_port.cxx b/src/DSC/DSC_User/provides_port.cxx new file mode 100644 index 000000000..a09f5cf71 --- /dev/null +++ b/src/DSC/DSC_User/provides_port.cxx @@ -0,0 +1,32 @@ +// 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 : provides_port.cxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#include "provides_port.hxx" + +provides_port::provides_port() +{} + +provides_port::~provides_port() +{} diff --git a/src/DSC/DSC_User/provides_port.hxx b/src/DSC/DSC_User/provides_port.hxx new file mode 100644 index 000000000..a0aeacd0b --- /dev/null +++ b/src/DSC/DSC_User/provides_port.hxx @@ -0,0 +1,65 @@ +// 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 : provides_port.hxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#ifndef _PROVIDES_PORT_HXX_ +#define _PROVIDES_PORT_HXX_ + +#include "base_port.hxx" +#include "SALOME_Ports.hh" +#include "DSC_Engines.hh" + +/*! \class provides_port + * \brief This class implements a DSC_User provides C++ port. + * + * This class is base class for all DSC_User provides port. + * It's an abstract class. + */ +class provides_port : public base_port +{ + public : + provides_port(); + virtual ~provides_port(); + + /*! + * This method permits to get the CORBA reference of the port. + * + * \return port's CORBA reference. + */ + virtual Ports::Port_ptr get_port_ref() = 0; + + /*! + * This method is the callback called by the component to inform + * the provides port of a new or a removed connection. + * + * \param connection_nbr current connection number. + * \param message message associated with this connection. + */ + virtual void provides_port_changed(int connection_nbr, + const Engines::DSC::Message message) {} + +}; + +#endif + diff --git a/src/DSC/DSC_User/test_DSC_Exception.cxx b/src/DSC/DSC_User/test_DSC_Exception.cxx new file mode 100644 index 000000000..67e8e16ac --- /dev/null +++ b/src/DSC/DSC_User/test_DSC_Exception.cxx @@ -0,0 +1,157 @@ +// 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 : test_DSC_Exception.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// +#include "DSC_Exception.hxx" + +//Compiler ce fichier en mode _DEBUG_ et sans _DEBUG_ +class A { + +public: + DSC_EXCEPTION(Exp1); + DSC_EXCEPTION(Exp2); + + A() {}; + virtual ~A() {}; + // La salome exception ne permet pas de passer une chaine "" + void lanceException1_1() throw(Exp1) { throw Exp1("_");} + void lanceException1_2() throw(Exp1) { throw Exp1("Ceci est l'exception 1_2");} + void lanceException1_3() throw(Exp1) { throw Exp1(LOC("Ceci est l'exception 1_3"));} + void lanceException1_4() throw(Exp1) { throw Exp1(LOC(OSS() << "Ceci est l'exeption 1_4" )); } + void lanceException1_5() throw(Exp1) { + int a=1; + throw Exp1(LOC(OSS() << "Ceci est l'exeption 1_5 avec la valeur A : " << a )); } + void lanceException1_6() throw(Exp1) { + Exp1 exp1(LOC(OSS() << "Ceci est l'exeption 1_6")); + std::cout << "Affichage de exp1.what() dans lanceException1_6() " << exp1.what() << std::endl; + throw Exp1(exp1); + } + void lanceException1_7() throw(Exp1) { + throw Exp1(LOC(OSS() << "Ceci est l'exeption 1_7")); + } +}; + +DSC_EXCEPTION_CXX(A,Exp1); +DSC_EXCEPTION_CXX(A,Exp2); + + +int main() { + + A a; + + + try { + a.lanceException1_1(); + } + catch ( const A::Exp1 & ex ) { + std::cout << "Exception 1 bien reçue" << std::endl; + std::cout << ex.what() << std::endl; + } catch ( const DSC_Exception & dscE ) { + std::cout << "Exception DSC reçue mais aurait dû recevoir Exception 1" << std::endl; + } catch ( ...) { + std::cout << "Exception ... reçue mais aurait dû recevoir Exception 1" << std::endl; + } + + try { + a.lanceException1_2(); + } + // Essai par valeur (ne pas faire çà !) + catch ( A::Exp1 ex ) { + std::cout << "Exception 1 bien reçue" << std::endl; + std::cout << ex.what() << std::endl; + } catch ( const DSC_Exception & dscE ) { + std::cout << "Exception DSC reçue mais aurait dû recevoir Exception 1" << std::endl; + } catch ( ...) { + std::cout << "Exception ... reçue mais aurait dû recevoir Exception 1" << std::endl; + } + + try { + a.lanceException1_3(); + } + catch ( const A::Exp1 & ex ) { + std::cout << "Exception 1 bien reçue" << std::endl; + std::cout << ex.what() << std::endl; + } catch ( const DSC_Exception & dscE ) { + std::cout << "Exception DSC reçue mais aurait dû recevoir Exception 1" << std::endl; + } catch ( ...) { + std::cout << "Exception ... reçue mais aurait dû recevoir Exception 1" << std::endl; + } + + try { + a.lanceException1_4(); + } + catch ( const A::Exp1 & ex ) { + std::cout << "Exception 1 bien reçue" << std::endl; + std::cout << ex.what() << std::endl; + } catch ( const DSC_Exception & dscE ) { + std::cout << "Exception DSC reçue mais aurait dû recevoir Exception 1" << std::endl; + } catch ( ...) { + std::cout << "Exception ... reçue mais aurait dû recevoir Exception 1" << std::endl; + } + + try { + a.lanceException1_5(); + } + catch ( const A::Exp1 & ex ) { + std::cout << "Exception 1 bien reçue" << std::endl; + std::cout << ex.what() << std::endl; + } catch ( const DSC_Exception & dscE ) { + std::cout << "Exception DSC reçue mais aurait dû recevoir Exception 1" << std::endl; + } catch ( ...) { + std::cout << "Exception ... reçue mais aurait dû recevoir Exception 1" << std::endl; + } + + try { + a.lanceException1_6(); + } + catch ( SALOME_Exception ex ) { + std::cout << "Exception SALOME bien reçue" << std::endl; + std::cout << ex.what() << std::endl; + } catch ( ...) { + std::cout << "Exception ... reçue mais aurait dû recevoir Exception SALOME" << std::endl; + } + + try { + a.lanceException1_6(); + } + catch ( const SALOME_Exception & ex ) { + std::cout << "Exception SALOME bien reçue" << std::endl; + std::cout << ex.what() << std::endl; + } catch ( ...) { + std::cout << "Exception ... reçue mais aurait dû recevoir Exception SALOME" << std::endl; + } + + try { + a.lanceException1_7(); + } catch ( const DSC_Exception & ex ) { + std::cout << "Exception DSC bien reçue" << std::endl; + std::cout << ex.what() << std::endl; + } catch ( const SALOME_Exception & ex ) { + std::cout << "Exception SALOME reçue mais aurais dû recevoir une exception DSC" << std::endl; + std::cout << ex.what() << std::endl; + } catch ( ...) { + std::cout << "Exception ... reçue mais aurait dû recevoir Exception DSC" << std::endl; + } + +}; diff --git a/src/DSC/DSC_User/uses_port.cxx b/src/DSC/DSC_User/uses_port.cxx new file mode 100644 index 000000000..2a904b2ff --- /dev/null +++ b/src/DSC/DSC_User/uses_port.cxx @@ -0,0 +1,28 @@ +// 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 +// + +#include "uses_port.hxx" + +uses_port::uses_port() +{} + +uses_port::~uses_port() +{} + diff --git a/src/DSC/DSC_User/uses_port.hxx b/src/DSC/DSC_User/uses_port.hxx new file mode 100644 index 000000000..5c33f094f --- /dev/null +++ b/src/DSC/DSC_User/uses_port.hxx @@ -0,0 +1,71 @@ +// 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 : uses_port.hxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#ifndef _USES_PORT_HXX_ +#define _USES_PORT_HXX_ + +#include "base_port.hxx" +#include "SALOME_Ports.hh" +#include "DSC_Engines.hh" + +/*! \class uses_port + * \brief This class implements a DSC_User uses C++ port. + * + * This class is base class for all DSC_User uses port. + * It's an abstract class. + * + * Contrary to DSC_Basic layer, a uses port as an implementation + * provided by this class which permits to manipulate the uses port. + */ +class uses_port : public base_port +{ + public : + uses_port(); + virtual ~uses_port(); + + /*! + * This is used by the component to get the CORBA repository id + * of the uses port. It's an abstract method. + * + * \return port's CORBA repository id. + */ + virtual const char * get_repository_id() = 0; + + /*! + * This method is the uses port's callback to be aware of + * connections states. + * It's an abstract method. The uses port uses this method + * to manage the sequence of the DSC_Basic uses port. + * + * \param new_uses_port new uses port sequence. + * \param message message associated with this modification. + */ + virtual void uses_port_changed(Engines::DSC::uses_port * new_uses_port, + const Engines::DSC::Message message) = 0; + +}; + +#endif + diff --git a/src/DSC/Makefile.am b/src/DSC/Makefile.am new file mode 100644 index 000000000..dc9af3cb8 --- /dev/null +++ b/src/DSC/Makefile.am @@ -0,0 +1,32 @@ +# 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) +# Module : KERNEL + +if WITH_PACO_PARALLEL +SUBDIR_PAR = ParallelDSC +endif + +SUBDIRS = DSC_Basic DSC_User $(SUBDIR_PAR) DSC_Python + +EXTRA_DIST= DSC.dox diff --git a/src/DSC/ParallelDSC/Makefile.am b/src/DSC/ParallelDSC/Makefile.am new file mode 100644 index 000000000..d9f562b32 --- /dev/null +++ b/src/DSC/ParallelDSC/Makefile.am @@ -0,0 +1,75 @@ +# 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) +# Module : KERNEL + +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + +# +# =============================================================== +# Header to be installed +# =============================================================== +# +# header files +salomeinclude_HEADERS = ParallelDSC_i.hxx + +# +# =============================================================== +# Local definitions +# =============================================================== +# + +# This local variable defines the list of CPPFLAGS common to all target in this package. +COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \ + -I$(top_srcdir)/src/ParallelContainer \ + -I$(top_srcdir)/src/Notification \ + -I$(top_srcdir)/src/SALOMELocalTrace \ + -I$(top_srcdir)/src/Basics \ + -I$(top_srcdir)/src/NamingService \ + -I$(top_srcdir)/src/Utils \ + -I$(top_srcdir)/src/DSC/DSC_Basic \ + -I$(top_builddir)/salome_adm/unix \ + -I$(top_builddir)/idl \ + -I$(top_srcdir)/src/Registry \ + -I$(top_srcdir)/src/Utils \ + @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \ + @PACO_INCLUDES@ + +# This local variable defines the list of dependant libraries common to all target in this package. +COMMON_LIBS = + +# +# =============================================================== +# Libraries targets +# =============================================================== +# +lib_LTLIBRARIES = libSalomeParallelDSCContainer.la + +libSalomeParallelDSCContainer_la_SOURCES = ParallelDSC_i.cxx + +libSalomeParallelDSCContainer_la_CXXFLAGS = $(COMMON_CPPFLAGS) + +libSalomeParallelDSCContainer_la_LIBADD = $(COMMON_LIBS) + +libSalomeParallelDSCContainer_la_LDFLAGS = -no-undefined -version-info=0:0:0 + diff --git a/src/DSC/ParallelDSC/ParallelDSC_i.cxx b/src/DSC/ParallelDSC/ParallelDSC_i.cxx new file mode 100644 index 000000000..291e3138c --- /dev/null +++ b/src/DSC/ParallelDSC/ParallelDSC_i.cxx @@ -0,0 +1,120 @@ +// 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 : ParallelDSC_i.cxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#include "ParallelDSC_i.hxx" + +Engines_ParallelDSC_i::Engines_ParallelDSC_i(CORBA::ORB_ptr orb, + char * ior, + int rank, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName, + bool notif) : + Engines_Parallel_Component_i(orb, ior, rank, poa, contId, instanceName, interfaceName, notif), + Engines::Parallel_DSC_serv(orb, ior, rank), + Engines::DSC_serv(orb, ior, rank), + Engines::Superv_Component_serv(orb, ior, rank), + Engines::Component_serv(orb, ior, rank), + Engines::Parallel_Component_serv(orb, ior, rank), + InterfaceParallel_impl(orb, ior, rank) +{ +} + + +Engines_ParallelDSC_i::~Engines_ParallelDSC_i() {} + +// WARNING !!! +// CURRENTLY ERRORS ARE NOT SUPPORTED !!!!!!! +// WARNING !! + +void +Engines_ParallelDSC_i::set_paco_proxy(const CORBA::Object_ptr ref, + const char* provides_port_name, + Ports::PortProperties_ptr port_prop) { + assert(provides_port_name); + Engines_DSC_interface::add_provides_port(Ports::Port::_narrow(ref), + provides_port_name, + port_prop); + // Waiting that all the nodes have the proxy + _my_com->paco_barrier(); + cerr << "set_paco_proxy node fin" << endl; +} + +const char * +Engines_ParallelDSC_i::get_proxy(const char* provides_port_name) { + char * rtn_char = NULL; + Ports::Port_ptr proxy = Engines_DSC_interface::get_provides_port(provides_port_name, + 0); + if (!CORBA::is_nil(proxy)) + rtn_char = (char *) _orb->object_to_string(proxy); + return rtn_char; +} + +CORBA::Boolean +Engines_ParallelDSC_i::add_parallel_provides_proxy_port(const CORBA::Object_ptr ref, + const char * provides_port_name, + Ports::PortProperties_ptr port_prop) +{ + assert(provides_port_name); + CORBA::Boolean rtn_bool = false; + Engines::Parallel_DSC_var real_comp_proxy = + Engines::Parallel_DSC::_narrow(InterfaceParallel_impl::_proxy); + real_comp_proxy->set_paco_proxy(ref, provides_port_name, port_prop); + rtn_bool = true; + return rtn_bool; +} + +CORBA::Boolean +Engines_ParallelDSC_i::add_parallel_provides_proxy_wait(const char * provides_port_name) +{ + assert(provides_port_name); + char * proxy = NULL; + try { + proxy = (char *) get_proxy(provides_port_name); + } + catch(...) { + while(proxy == NULL) + { + sleep(1); + try { + proxy = (char *) get_proxy(provides_port_name); + } + catch(...) {} + } + } + return true; +} + +CORBA::Boolean +Engines_ParallelDSC_i::add_parallel_provides_node_port(Ports::Port_PaCO_ptr ref, + const char* provides_port_name) +{ + CORBA::Boolean rtn_bool = false; + PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(ref); + node->deploy(); + rtn_bool = true; + return rtn_bool; +} diff --git a/src/DSC/ParallelDSC/ParallelDSC_i.hxx b/src/DSC/ParallelDSC/ParallelDSC_i.hxx new file mode 100644 index 000000000..05859c002 --- /dev/null +++ b/src/DSC/ParallelDSC/ParallelDSC_i.hxx @@ -0,0 +1,214 @@ +// 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 : ParallelDSC_i.hxx +// Author : André RIBES (EDF) +// Module : KERNEL + +#ifndef _PARALLEL_DSC_COMPONENT_I_HXX_ +#define _PARALLEL_DSC_COMPONENT_I_HXX_ + +#include +#include + +#include "DSC_EnginesPaCO_Engines_Parallel_DSC_server.h" +#include "DSC_interface.hxx" +#include "SALOME_ParallelComponent_i.hxx" + +class Engines_ParallelDSC_i: + public virtual Engines_Parallel_Component_i, + public virtual Engines::Parallel_DSC_serv, + public virtual Engines_DSC_interface +{ +public: + Engines_ParallelDSC_i(CORBA::ORB_ptr orb, + char * ior, + int rank, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName, + bool notif = false); + + virtual ~Engines_ParallelDSC_i(); + + + /*! + * \see Engines::DSC::add_provides_port + */ + virtual void add_provides_port(Ports::Port_ptr ref, + const char* provides_port_name, + Ports::PortProperties_ptr port_prop) + throw (Engines::DSC::PortAlreadyDefined, + Engines::DSC::NilPort, + Engines::DSC::BadProperty) { + Engines_DSC_interface::add_provides_port(ref, + provides_port_name, + port_prop); + } + + /*! + * \see Engines::DSC::add_uses_port + */ + virtual void add_uses_port(const char* repository_id, + const char* uses_port_name, + Ports::PortProperties_ptr port_prop) + throw (Engines::DSC::PortAlreadyDefined, + Engines::DSC::BadProperty) { + Engines_DSC_interface::add_uses_port(repository_id, + uses_port_name, + port_prop); + } + + /*! + * \see Engines::DSC::get_provides_port + */ + virtual Ports::Port_ptr get_provides_port(const char* provides_port_name, + const CORBA::Boolean connection_error) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected) { + return Engines_DSC_interface::get_provides_port(provides_port_name, + connection_error); + } + + /*! + * \see Engines::DSC::get_uses_port + */ + virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected) { + return Engines_DSC_interface::get_uses_port(uses_port_name); + } + + /*! + * \see Engines::DSC::connect_provides_port + */ + virtual void connect_provides_port(const char* provides_port_name) + throw (Engines::DSC::PortNotDefined) { + Engines_DSC_interface::connect_provides_port(provides_port_name); + } + + /*! + * \see Engines::DSC::connect_uses_port + */ + 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) { + Engines_DSC_interface::connect_uses_port(uses_port_name, + provides_port_ref); + } + + /*! + * \see Engines::DSC::is_connected + */ + virtual CORBA::Boolean is_connected(const char* port_name) + throw (Engines::DSC::PortNotDefined) { + return Engines_DSC_interface::is_connected(port_name); + } + + /*! + * \see Engines::DSC::disconnect_provides_port + */ + virtual void disconnect_provides_port(const char* provides_port_name, + const Engines::DSC::Message message) + throw (Engines::DSC::PortNotDefined, + Engines::DSC::PortNotConnected) { + Engines_DSC_interface::disconnect_provides_port(provides_port_name, + message); + } + + /*! + * \see Engines::DSC::disconnect_uses_port + */ + 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) { + Engines_DSC_interface::disconnect_uses_port(uses_port_name, + provides_port_ref, + message); + } + + virtual Ports::PortProperties_ptr get_port_properties(const char* port_name) + throw (Engines::DSC::PortNotDefined) { + return Engines_DSC_interface::get_port_properties(port_name); + } + + /*! + * This method is used to register the proxy of the parallel port into + * all the nodes of the parallel component. + * + * \param ref CORBA proxy reference. + * \param provides_port_name provides port associated with the proxy. + * \param port_prop port properties. + */ + virtual void set_paco_proxy(CORBA::Object_ptr ref, + const char* provides_port_name, + Ports::PortProperties_ptr port_prop); + + /*! + * This method is used by the node that want to add the parallel proxy port. + * + * \param ref CORBA proxy reference. + * \param provides_port_name provides port associated with the proxy. + * + * \return true if the proxy is correctly added. + */ + virtual CORBA::Boolean add_parallel_provides_proxy_port(const CORBA::Object_ptr ref, + const char * provides_port_name, + Ports::PortProperties_ptr port_prop); + + /*! + * This method by the nodes that do not add the proxy to wait is reference. + * + * \param provides_port_name provides port associated with the proxy. + * + * \return true if the proxy is correctly added. + */ + virtual CORBA::Boolean add_parallel_provides_proxy_wait(const char * provides_port_name); + + /*! + * Permits to add a parallel node of a parallel provides port. + * + * \param ref CORBA node reference. + * \param provides_port_name provides port associated with the node. + * + * \return true if the node is correctly added. + */ + virtual CORBA::Boolean add_parallel_provides_node_port(Ports::Port_PaCO_ptr ref, + const char* provides_port_name); + + /*! + * Used to get the proxy of the parallel port. + * + * \param provides_port_name name of the parallel provides port. + * + * \return IOR of the proxy. + */ + virtual const char * get_proxy(const char* provides_port_name); + +}; + +#endif diff --git a/src/GenericObj/SALOME_GenericObj_i.cc b/src/GenericObj/SALOME_GenericObj_i.cc index fe837e3fd..2760b73db 100644 --- a/src/GenericObj/SALOME_GenericObj_i.cc +++ b/src/GenericObj/SALOME_GenericObj_i.cc @@ -42,9 +42,9 @@ GenericObj_i::GenericObj_i(PortableServer::POA_ptr thePOA): myRefCounter(1){ "; CORBA::is_nil(thePOA) = "< -#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) { @@ -315,11 +296,8 @@ void SaveDatasetInASCIIfile(HDFdataset *hdf_dataset, FILE* fp, int ident) fprintf(fp, "\n"); -#ifndef WNT - for(unsigned j=0; jGetAttributeName(j); HDFattribute *hdf_attribute = new HDFattribute(name, hdf_dataset); delete name; @@ -327,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(); @@ -344,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; @@ -360,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"); @@ -368,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(); @@ -400,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"); @@ -453,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; } @@ -676,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/HDFattrGetSize.c b/src/HDFPersist/HDFattrGetSize.c index 6319792f9..51f36c9b5 100644 --- a/src/HDFPersist/HDFattrGetSize.c +++ b/src/HDFPersist/HDFattrGetSize.c @@ -25,16 +25,15 @@ #include "hdfi.h" #include -hdf_type -HDFattrGetSize(hdf_idt id) +hdf_type HDFattrGetSize( hdf_idt id ) { + hdf_type ret; hdf_idt type_id; - int ret; if ((type_id = H5Aget_type(id)) < 0) return HDF_NONE; - ret = H5Tget_size(type_id); + ret = (hdf_type)H5Tget_size(type_id); H5Tclose(type_id); 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/HDFPersist/HDFdatasetGetOrder.c b/src/HDFPersist/HDFdatasetGetOrder.c index 3af8c4271..a60256845 100644 --- a/src/HDFPersist/HDFdatasetGetOrder.c +++ b/src/HDFPersist/HDFdatasetGetOrder.c @@ -32,7 +32,7 @@ HDFdatasetGetOrder(hdf_idt dataset_id) hdf_byte_order order; if ((type_id = H5Dget_type(dataset_id)) < 0) - return -1; + return H5T_ORDER_ERROR; order = H5Tget_order(type_id); diff --git a/src/HDFPersist/HDFdatasetWrite.c b/src/HDFPersist/HDFdatasetWrite.c index 3dea8c5f5..625b316cb 100644 --- a/src/HDFPersist/HDFdatasetWrite.c +++ b/src/HDFPersist/HDFdatasetWrite.c @@ -23,6 +23,7 @@ SALOME HDFPersist : implementation of HDF persitent ( save/ restore ) ----------------------------------------------------------------------------*/ #include "hdfi.h" +#include /* * - Name : _MEDdatasetWrite @@ -55,7 +56,7 @@ hdf_err HDFdatasetWrite(hdf_idt id, void *val) if(ndim < 0) return -1; hdf_size *dim = (hdf_size *) malloc(sizeof(hdf_size)*ndim); - if ((ret == HDFdatasetGetDim(id, dim)) < 0) return -1; + if ((ret = HDFdatasetGetDim(id, dim)) < 0) return -1; for(i=0; i -#endif -#ifndef _TDF_Label_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_OpenedAttribute_HeaderFile -#include "SALOMEDS_OpenedAttribute.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/HDFobjectIdentify.c b/src/HDFPersist/HDFobjectIdentify.c index dc7ed608c..e5919d9e8 100644 --- a/src/HDFPersist/HDFobjectIdentify.c +++ b/src/HDFPersist/HDFobjectIdentify.c @@ -54,8 +54,8 @@ hdf_err HDFobjectIdentify(hdf_idt fid,char *path,int i,char *name) hdf_err RankInfo(hdf_idt id, const char *name, void *data) { - if (data != NULL) - strcpy(data,name); + if ( data ) + strcpy( (char*)data, name ); else return -1; diff --git a/src/HDFPersist/HDFobjectType.c b/src/HDFPersist/HDFobjectType.c index ff25c2a5d..40f6e3320 100644 --- a/src/HDFPersist/HDFobjectType.c +++ b/src/HDFPersist/HDFobjectType.c @@ -27,7 +27,6 @@ SALOME HDFPersist : implementation of HDF persitent ( save/ restore ) hdf_err HDFobjectType(hdf_idt id, char *name, hdf_object_type *type) { - hdf_object_type rep; hdf_bool follow = 1; H5G_stat_t buf; hdf_err ret; diff --git a/src/HDFPersist/Makefile.am b/src/HDFPersist/Makefile.am index b65ea9ac5..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 \ @@ -104,3 +106,16 @@ EXTRA_DIST = \ test7.cxx \ test8.cxx \ test9.cxx + +#bin_PROGRAMS=HDFtest1 HDFtest2 HDFtest3 +#HDFtest1_SOURCES = test1.c +#HDFtest2_SOURCES = test2.c +#HDFtest3_SOURCES = test3.cxx + +#AM_CFLAGS= @CAS_CPPFLAGS@ @HDF5_INCLUDES@ -DPCLINUX \ +# -I$(srcdir)/../SALOMELocalTrace \ +# -I$(srcdir)/../Basics +#AM_CXXFLAGS= @CAS_CPPFLAGS@ @HDF5_INCLUDES@ -DPCLINUX \ +# -I$(srcdir)/../SALOMELocalTrace \ +# -I$(srcdir)/../Basics +#AM_LDFLAGS= @HDF5_LIBS@ diff --git a/src/HDFPersist/test1.c b/src/HDFPersist/test1.c index 26e77a915..c91ad895c 100644 --- a/src/HDFPersist/test1.c +++ b/src/HDFPersist/test1.c @@ -25,6 +25,9 @@ SALOME HDFPersist : implementation of HDF persitent ( save/ restore ) #include"hdfi.h" #include +#define MESSAGE(msg) printf(msg); +//__FILE__,":[",__LINE__,"]: ", + int main() { hdf_idt fid,gid,did,atid; hdf_err ret; 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/Makefile.am b/src/KERNEL_PY/Makefile.am index bd5ab0a86..3b4e96641 100755 --- a/src/KERNEL_PY/Makefile.am +++ b/src/KERNEL_PY/Makefile.am @@ -25,8 +25,8 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am -# Scripts to be installed (pkgpython is an automake keyword for python targets) -pkgpython_PYTHON = \ +# Scripts to be installed (salomepython is an automake keyword for python targets) +salomepython_PYTHON = \ Help.py \ PyInterp.py \ salome.py \ diff --git a/src/KERNEL_PY/batchmode_salome.py b/src/KERNEL_PY/batchmode_salome.py index c19046ccb..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 * @@ -217,11 +217,17 @@ def FindFileInDataDir(filename): orb = None step = 0 -while step < 100 and orb is None: +sleeping_time = 0.01 +sleeping_time_max = 1.0 +while 1: orb = CORBA.ORB_init([''], CORBA.ORB_ID) + if orb is not None: break step = step + 1 - time.sleep(4) - + if step > 100: break + time.sleep(sleeping_time) + sleeping_time = max(sleeping_time_max, 2*sleeping_time) + pass + if orb is None: print "Warning: ORB has not been initialized !!!" @@ -229,10 +235,16 @@ if orb is None: lcc = LifeCycleCORBA(orb) step = 0 -while step < 100 and lcc is None: +sleeping_time = 0.01 +sleeping_time_max = 1.0 +while 1: lcc = LifeCycleCORBA(orb) + if lcc is not None: break step = step + 1 - time.sleep(4) + if step > 100: break + time.sleep(sleeping_time) + sleeping_time = max(sleeping_time_max, 2*sleeping_time) + pass if lcc is None: print "Warning: LifeCycleCORBA object has not been initialized !!!" @@ -244,10 +256,16 @@ naming_service = SALOME_NamingServicePy_i(orb) obj = None step = 0 -while step < 100 and obj == None: +sleeping_time = 0.01 +sleeping_time_max = 1.0 +while 1: obj = naming_service.Resolve('myStudyManager') + if obj is not None:break step = step + 1 - time.sleep(4) + if step > 100: break + time.sleep(sleeping_time) + sleeping_time = max(sleeping_time_max, 2*sleeping_time) + pass myStudyManager = obj._narrow(SALOMEDS.StudyManager) diff --git a/src/KERNEL_PY/import_hook.py b/src/KERNEL_PY/import_hook.py index 42b23daa2..b8687498c 100755 --- a/src/KERNEL_PY/import_hook.py +++ b/src/KERNEL_PY/import_hook.py @@ -70,38 +70,112 @@ def register_pattern(pattern): patterns.append(pattern) def is_shared(name): + """ Indicate if module name is a shared module + among multiple interpreters (return value=1) + """ if shared_imported.has_key(name):return 1 for pattern in patterns: if pattern(name) : return 1 return 0 -def get_shared_imported(name): - return shared_imported.get(name) +def get_shared_imported(name,fromlist): + """ If the module is registered in shared_imported + update the sys.modules dict + Let the real import be done by original_import + """ + module= shared_imported.get(name) + if module is None : + #module name is not shared or not already imported + #let original_import do the job + return None + + # module is already imported and shared. Put it in sys.modules and + # let original_import finish the job + sys.modules[name]=module + +def get_real_module(mod,name): + """Return effective module on import + Standard import returns module A on import A.B + To get module A.B use get_real_module with name "A.B" + """ + components = name.split('.') + for comp in components[1:]: + mod = getattr(mod, comp) + return mod def set_shared_imported(name,module): + """ Register a shared module + Name can be a dotted name : package + """ shared_imported[name]=module #print "Module %s shared registered" % name,module -def get_shared_imported_with_copy(name): - module_dict= shared_imported.get(name) - m=imp.new_module(name) - m.__dict__.update(module_dict) - return m -def set_shared_imported_with_copy(name,module): - shared_imported[name]=module.__dict__.copy() - #print "Module %s shared registered" % name +def import_module(partname, fqname, parent): + """ Try to import module fqname + It's parent is module parent and has name partname + """ + try: + m = sys.modules[fqname] + except KeyError: + pass + else: + return m + +def ensure_fromlist(m, fromlist, recursive=0): + """ Return the real modules list to be imported + """ + l=[] + for sub in fromlist: + if sub == "*": + if not recursive: + try: + all = m.__all__ + except AttributeError: + pass + else: + l.extend(ensure_fromlist(m, all, 1)) + elif hasattr(m,sub): + submod=getattr(m,sub) + if type(submod) == type(sys): + l.append(("%s.%s" % (m.__name__, sub),submod)) + else: + subname="%s.%s" % (m.__name__, sub) + submod = import_module(sub, subname, m) + if not submod: + raise ImportError, "No module named " + subname + l.append((subname,submod)) + return l def import_hook(name, globals=None, locals=None, fromlist=None): + """ Import replacement for sharing modules among multiple interpreters + Mostly update sys.modules before doing real import + """ #print "import_hook",name,fromlist - module=get_shared_imported(name) - if module: - sys.modules[name]=module - return module + m=get_shared_imported(name,fromlist) module= original_import(name, globals, locals, fromlist) - if is_shared(name): - set_shared_imported(name,module) + if fromlist: + #when fromlist is specified, module is the real module + #fromlist is a list of possibly dotted name + m=module + for nam,mod in ensure_fromlist(m, fromlist): + if is_shared(nam): + set_shared_imported(nam,mod) + else: + #when fromlist is not specified and name is a dotted name, + # module is the root package not the real module + #so we need to retrieve it + # note: some modules like xml.dom do not play the rule + # (import xml: no attribute dom, but import xml.dom OK) + try: + m=get_real_module(module,name) + except AttributeError: + m=None + + if type(m) == type(sys) and is_shared(m.__name__): + set_shared_imported(m.__name__,m) + return module original_reload=__builtin__.reload diff --git a/src/KERNEL_PY/kernel_shared_modules.py b/src/KERNEL_PY/kernel_shared_modules.py index c06cba1b6..bcf92d92b 100755 --- a/src/KERNEL_PY/kernel_shared_modules.py +++ b/src/KERNEL_PY/kernel_shared_modules.py @@ -31,36 +31,19 @@ register_name("libSALOME_LifeCycleCORBA") register_pattern(lambda(x):x.endswith("_idl")) register_pattern(lambda(x):x.endswith("_Swig")) +register_name("omniORB") register_name("CORBA") -from omniORB import CORBA +register_name("CosNaming") +register_name("CosNaming__POA") +register_name("omnipatch") -register_name("omniORB") import omniORB - -register_name("CosNaming") +from omniORB import CORBA import CosNaming - -register_name("omnipatch") +import CosNaming__POA import omnipatch -import Engines -import SALOME -import SALOMEDS -import SALOME_ModuleCatalog - def init_shared_modules(): """ This function initializes shared modules that need to be """ - # EDF-CCAR: - # Problem with omniORB : omniORB creates a C Python module named _omnipy - # this module has sub-modules : omni_func, ... - # _omnipy is quite a package but import with Python sub-interpreters does not seem to work - # To make it work we need to add those sub-modules in sys.modules - import sys - import _omnipy - sys.modules["_omnipy.omni_func"]=_omnipy.omni_func - sys.modules["_omnipy.poa_func"]=_omnipy.poa_func - sys.modules["_omnipy.poamanager_func"]=_omnipy.poamanager_func - sys.modules["_omnipy.orb_func"]=_omnipy.orb_func - diff --git a/src/KERNEL_PY/omnipatch.py b/src/KERNEL_PY/omnipatch.py index 1f4f8d9c4..8de79dad5 100644 --- a/src/KERNEL_PY/omnipatch.py +++ b/src/KERNEL_PY/omnipatch.py @@ -42,6 +42,9 @@ def openModule(mname, fname=None): if mname == "CORBA": mod = sys.modules["omniORB.CORBA"] + # Salome modification start + shared_imported[mname]=mod + # Salome modification end elif sys.modules.has_key(mname): mod = sys.modules[mname] @@ -50,16 +53,21 @@ def openModule(mname, fname=None): pmod = _partialModules[mname] mod.__dict__.update(pmod.__dict__) del _partialModules[mname] + # Salome modification start + shared_imported[mname]=mod + # Salome modification end elif _partialModules.has_key(mname): mod = _partialModules[mname] + # Salome modification start + elif shared_imported.get(mname) : + mod = shared_imported[mname] + # Salome modification end + else: mod = newModule(mname) - # Salome modification start - shared_imported[mname]=mod - # Salome modification end if not hasattr(mod, "__doc__") or mod.__doc__ is None: mod.__doc__ = "omniORB IDL module " + mname + "\n\n" + \ @@ -103,12 +111,20 @@ def newModule(mname): # Function to update a module with the partial module store in the # partial module map def updateModule(mname): + # Salome modification start + # Be sure to use the right module dictionnary + import sys + # Salome modification end if _partialModules.has_key(mname): pmod = _partialModules[mname] mod = sys.modules[mname] mod.__dict__.update(pmod.__dict__) del _partialModules[mname] + # Salome modification start + shared_imported[mname]=sys.modules[mname] + # Salome modification end + omniORB.updateModule=updateModule omniORB.newModule=newModule omniORB.openModule=openModule diff --git a/src/KERNEL_PY/salome.py b/src/KERNEL_PY/salome.py index 2539dd37d..7b44adbd6 100755 --- a/src/KERNEL_PY/salome.py +++ b/src/KERNEL_PY/salome.py @@ -23,12 +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 + +""" -import omnipatch 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): """ @@ -78,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_shared_modules.py b/src/KERNEL_PY/salome_shared_modules.py index bb3c2f20a..892b1085f 100755 --- a/src/KERNEL_PY/salome_shared_modules.py +++ b/src/KERNEL_PY/salome_shared_modules.py @@ -22,8 +22,6 @@ # File : salome_shared_modules.py # Module : SALOME -from SALOME_utilities import * - """ This module with help of import_hook and *_shared_modules filters imports when using the embedded Python interpretor. @@ -56,13 +54,19 @@ import glob,os,sys import import_hook # shared_imported, patterns, register_name, register_pattern # will be shared by all Python sub interpretors -from omnipatch import shared_imported -import_hook.shared_imported=shared_imported from import_hook import patterns from import_hook import register_name from import_hook import register_pattern register_name("salome_shared_modules") +register_name("omniORB") +register_name("omnipatch") +register_pattern(lambda(x):x.endswith("_idl")) +register_pattern(lambda(x):x.startswith("omniORB.")) + +from omnipatch import shared_imported +shared_imported.update(import_hook.shared_imported) +import_hook.shared_imported=shared_imported # Get the SALOMEPATH if set or else use KERNEL_ROOT_DIR that should be set. salome_path=os.environ.get("SALOMEPATH",os.getenv("KERNEL_ROOT_DIR")) @@ -70,16 +74,30 @@ salome_path=os.environ.get("SALOMEPATH",os.getenv("KERNEL_ROOT_DIR")) list_modules=[] # Import all *_shared_modules in the path and store them in list_modules -path=salome_path.split(":") +splitter = ":" +if sys.platform == "win32": + splitter = ";" +path=salome_path.split(splitter) +import platform +if platform.architecture()[0] == "64bit": + if platform.machine() == "ia64": + libdir = "lib" + else: + libdir = "lib64" +else: + libdir = "lib" for rep in path: # Import all *_shared_modules in rep - for f in glob.glob(os.path.join(rep,"lib","python"+sys.version[:3],"site-packages","salome","shared_modules","*_shared_modules.py")): + for f in glob.glob(os.path.join(rep,libdir,"python"+sys.version[:3],"site-packages","salome","shared_modules","*_shared_modules.py")): try: name=os.path.splitext(os.path.basename(f))[0] register_name(name) + #print name + " REGISTERED" m=__import__(name) + #print name + " IMPORTED" list_modules.append(m) except: + print "Exception during register and import shared module" pass # @@ -87,7 +105,7 @@ for rep in path: # we add them to shared_imported # for name,module in sys.modules.items(): - if import_hook.is_shared(name) and shared_imported.get(name) is None: + if module and import_hook.is_shared(name) and not shared_imported.has_key(name): #print "Module shared added to shared_imported: ",name shared_imported[name]=module diff --git a/src/KERNEL_PY/salome_study.py b/src/KERNEL_PY/salome_study.py index b96a77434..3c86ed63a 100644 --- a/src/KERNEL_PY/salome_study.py +++ b/src/KERNEL_PY/salome_study.py @@ -27,49 +27,54 @@ import salome_kernel import SALOMEDS import salome_iapp +from launchConfigureParser import verbose #-------------------------------------------------------------------------- -def DumpComponent(Study, SO, offset): - it = Study.NewChildIterator(SO) - Builder = Study.NewBuilder() - while it.More(): - CSO = it.Value() - it.Next() - anAttr = Builder.FindOrCreateAttribute(CSO, "AttributeName") - AtName = anAttr._narrow(SALOMEDS.AttributeName) - t_name = AtName.Value() - if t_name[0] == 1: - ofs = 1 - a = "" - while ofs <= offset: - a = a + "--" - ofs = ofs +1 - MESSAGE( a + ">" + str(CSO.GetID()) + " " + str(t_name[1]) ) - t_RefSO = CSO.ReferencedObject() - if t_RefSO[0] == 1: - RefSO = t_RefSO[1] - ofs = 1 - a = "" - while ofs <= offset: - a = a + " " - ofs = ofs +1 - MESSAGE( a + ">" + str(RefSO.GetID()) ) - DumpComponent(Study, CSO, offset+2) +def DumpComponent(Study, SO, Builder,offset): + it = Study.NewChildIterator(SO) + while it.More(): + CSO = it.Value() + a=offset*"--" + ">" + CSO.GetID() + find,AtName = Builder.FindAttribute(CSO, "AttributeName") + if find: + a=a+":"+AtName.Value() + find,AtIOR = Builder.FindAttribute(CSO, "AttributeIOR") + if find: + a=a+":"+AtIOR.Value() + find,RefSO = CSO.ReferencedObject() + if find: + a=a+":"+RefSO.GetID() + print a + DumpComponent(Study, CSO, Builder,offset+2) + it.Next() - #-------------------------------------------------------------------------- +#-------------------------------------------------------------------------- def DumpStudy(Study): + """ + Dump a study, given the ior + """ itcomp = Study.NewComponentIterator() + Builder = Study.NewBuilder() while itcomp.More(): - SC = itcomp.Value() - itcomp.Next() - name = SC.ComponentDataType() - MESSAGE( "-> ComponentDataType is " + name ) - DumpComponent(Study, SC, 1) - + SC = itcomp.Value() + name = SC.ComponentDataType() + print "-> ComponentDataType is " + name + DumpComponent(Study, SC,Builder, 1) + itcomp.Next() + +def DumpStudies(): + """ + Dump all studies in a StudyManager + """ + for name in myStudyManager.GetOpenStudies(): + s=myStudyManager.GetStudyByName(name) + print "study:",name, s._get_StudyId() + DumpStudy(s) - #-------------------------------------------------------------------------- + +#-------------------------------------------------------------------------- def IDToObject(id): myObj = None @@ -244,21 +249,21 @@ salome_study_ID = -1 def getActiveStudy(theStudyId=0): global salome_study_ID - print "getActiveStudy" + if verbose(): print "getActiveStudy" if salome_study_ID == -1: if salome_iapp.hasDesktop(): - print "---in gui" + if verbose(): print "---in gui" salome_study_ID = salome_iapp.sg.getActiveStudyId() else: - print "---outside gui" + if verbose(): print "---outside gui" if theStudyId: aStudy=myStudyManager.GetStudyByID(theStudyId) if aStudy: - print "connection to existing study ", theStudyId + if verbose(): print "connection to existing study ", theStudyId salome_study_ID = theStudyId if salome_study_ID == -1: salome_study_ID = createNewStudy() - print"--- Study Id ", salome_study_ID + if verbose(): print"--- Study Id ", salome_study_ID return salome_study_ID #-------------------------------------------------------------------------- @@ -307,14 +312,14 @@ def salome_study_init(theStudyId=0): orb, lcc, naming_service, cm = salome_kernel.salome_kernel_init() # get Study Manager reference - print "looking for studyManager ..." + if verbose(): print "looking for studyManager ..." obj = naming_service.Resolve('myStudyManager') myStudyManager = obj._narrow(SALOMEDS.StudyManager) - print "studyManager found" + if verbose(): print "studyManager found" # get active study Id, ref and name myStudyId = getActiveStudy(theStudyId) - print "myStudyId",myStudyId + if verbose(): print "myStudyId",myStudyId myStudy = myStudyManager.GetStudyByID(myStudyId) myStudyName = myStudy._get_Name() diff --git a/src/KERNEL_PY/salome_test.py b/src/KERNEL_PY/salome_test.py index fac61b837..d18c706e2 100755 --- a/src/KERNEL_PY/salome_test.py +++ b/src/KERNEL_PY/salome_test.py @@ -14,6 +14,7 @@ import salome from salome import sg import SALOMEDS import os +import sys import SALOME_ModuleCatalog @@ -133,9 +134,14 @@ idedge=geompy.addToStudyInFather(face,edge,name) # ---- create Hypothesis +if sys.platform == "win32": + stdMeshersEngine = "StdMeshersEngine" +else: + stdMeshersEngine = "libStdMeshersEngine.so" + print "-------------------------- create Hypothesis" print "-------------------------- LocalLength" -hypLen1 = smesh.CreateHypothesis( "LocalLength", "libStdMeshersEngine.so" ) +hypLen1 = smesh.CreateHypothesis( "LocalLength", stdMeshersEngine ) hypLen1.SetLength(100) print hypLen1.GetName() print hypLen1.GetId() @@ -144,7 +150,7 @@ print hypLen1.GetLength() smeshgui.SetName(salome.ObjectToID(hypLen1), "Local_Length_100") print "-------------------------- NumberOfSegments" -hypNbSeg1= smesh.CreateHypothesis( "NumberOfSegments", "libStdMeshersEngine.so" ) +hypNbSeg1= smesh.CreateHypothesis( "NumberOfSegments", stdMeshersEngine ) hypNbSeg1.SetNumberOfSegments(7) print hypNbSeg1.GetName() print hypNbSeg1.GetId() @@ -153,7 +159,7 @@ print hypNbSeg1.GetNumberOfSegments() smeshgui.SetName(salome.ObjectToID(hypNbSeg1), "NumberOfSegments_7") print "-------------------------- MaxElementArea" -hypArea1 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" ) +hypArea1 = smesh.CreateHypothesis( "MaxElementArea", stdMeshersEngine ) hypArea1.SetMaxElementArea(2500) print hypArea1.GetName() print hypArea1.GetId() @@ -162,7 +168,7 @@ print hypArea1.GetMaxElementArea() smeshgui.SetName(salome.ObjectToID(hypArea1), "MaxElementArea_2500") print "-------------------------- MaxElementArea" -hypArea2 = smesh.CreateHypothesis( "MaxElementArea", "libStdMeshersEngine.so" ) +hypArea2 = smesh.CreateHypothesis( "MaxElementArea", stdMeshersEngine ) hypArea2.SetMaxElementArea(500) print hypArea2.GetName() print hypArea2.GetId() @@ -171,7 +177,7 @@ print hypArea2.GetMaxElementArea() smeshgui.SetName(salome.ObjectToID(hypArea2), "MaxElementArea_500") print "-------------------------- Regular_1D" -algoReg = smesh.CreateHypothesis( "Regular_1D", "libStdMeshersEngine.so" ) +algoReg = smesh.CreateHypothesis( "Regular_1D", stdMeshersEngine ) listHyp=algoReg.GetCompatibleHypothesis() for hyp in listHyp: print hyp @@ -181,7 +187,7 @@ print algoReg.GetId() smeshgui.SetName(salome.ObjectToID(algoReg), "Regular_1D" ) print "-------------------------- MEFISTO_2D" -algoMef = smesh.CreateHypothesis( "MEFISTO_2D", "libStdMeshersEngine.so" ) +algoMef = smesh.CreateHypothesis( "MEFISTO_2D", stdMeshersEngine ) listHyp=algoMef.GetCompatibleHypothesis() for hyp in listHyp: print hyp @@ -231,202 +237,205 @@ print ret smesh.Compute(mesh, box) sg.updateObjBrowser(1); -print -print "============= Test Supervisor =============================" -print - -comp = catalog.GetComponent("SUPERV") -if comp is None: - raise RuntimeError,"Component SUPERV not found in Module Catalog." - -from SuperV import * -import SALOMEDS -myStudy = salome.myStudy -myBuilder = myStudy.NewBuilder() - -SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","SUPERV") -father = myStudy.FindComponent("SUPERV") -if father is None: - father = myBuilder.NewComponent("SUPERV") - A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName"); - FName = A1._narrow(SALOMEDS.AttributeName) - FName.SetValue( salome.sg.getComponentUserName("SUPERV") ) - A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap"); - aPixmap = A2._narrow(SALOMEDS.AttributePixMap); - aPixmap.SetPixMap( "ICON_OBJBROWSER_Supervision" ); - myBuilder.DefineComponentInstance(father,SuperVision) - -def addStudy(ior): - dataflow = SuperVision.getStreamGraph(ior) - name=dataflow.Name() - itr = myStudy.NewChildIterator(father) - while itr.More(): - item=itr.Value() - res,A=item.FindAttribute("AttributeName") - if res: - aName = A._narrow(SALOMEDS.AttributeName) - if aName.Value() == name : - print myBuilder.FindOrCreateAttribute(item, "AttributeIOR") - A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR") - print "A = ", A - if A is not None : - #res,A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR") - anIOR = A._narrow(SALOMEDS.AttributeIOR); - print "anIOR.SetValue(dataflow.getIOR())" - anIOR.SetValue(dataflow.getIOR()) - return - itr.Next() - obj = myBuilder.NewObject(father) - A=myBuilder.FindOrCreateAttribute(obj, "AttributeName") - aName=A._narrow(SALOMEDS.AttributeName) - aName.SetValue(name) - A=myBuilder.FindOrCreateAttribute(obj, "AttributeIOR") - anIOR = A._narrow(SALOMEDS.AttributeIOR) - anIOR.SetValue(dataflow.getIOR()) - -import os -dir= os.getenv("DATA_DIR") -if dir == None: - raise RuntimeError, "DATA_DIR is not defined" -xmlfile = dir + "/Superv/Graphs/GraphGeomEssaiGates.xml" -print "Load dataflow from the file : " -print xmlfile -print - -myGraph = StreamGraph ( xmlfile ) - -# This DataFlow is "valid" : no loop, correct links between Nodes etc... -print "myGraph.IsValid() = ", myGraph.IsValid() - -# Get Nodes -myGraph.PrintNodes() - -# This DataFlow is "executable" : all pending Ports are defined with Datas -print myGraph.IsExecutable() - -# Starts only execution of that DataFlow and gets control immediatly -print myGraph.Run() - -# That DataFlow is running ==> 0 (false) -print myGraph.IsDone() - -# Events of execution : -aStatus,aNode,anEvent,aState = myGraph.Event() -while aStatus : - print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState - aStatus,aNode,anEvent,aState = myGraph.Event() -print "myGraph.IsDone() = ",myGraph.IsDone() - -# Wait for Completion (but it is already done after event loop ...) -print "Done : ",myGraph.DoneW() - -print " " -#print "Type : print myGraph.IsDone()" -#print " If execution is finished ==> 1 (true)" -res=myGraph.IsDone() -if res != 1: - raise RuntimeError, "myGraph.Run() is not done" - -print " " -print "Type : myGraph.PrintPorts()" -print " to see input and output values of the graph" -myGraph.PrintPorts() - -# Export will create newsupervisionexample.xml and the corresponding .py file -tmpdir=os.getenv("TmpDir") -if tmpdir is None: - tmpdir="/tmp" -file = tmpdir + "/newsupervisionexample" -print "--------------\n"+file+"\n--------------\n" -myGraph.Export(file) - -ior = salome.orb.object_to_string(myGraph.G) -addStudy(ior) - -GraphName = myGraph.Name() -print "Befor save ", -#nodes = myGraph.Nodes() -nodes = myGraph.G.Nodes().FNodes -length_bs = len(nodes) -print "ListOfNodes length = ", length_bs -names=[] -for node in nodes: - names.append(node.Name()) -print names - -# Graph creation -GraphInLines = StreamGraph( 'GraphInLines' ) -GraphInLines.SetName( 'GraphInLines' ) -GraphInLines.SetAuthor( '' ) -GraphInLines.SetComment( '' ) -GraphInLines.Coords( 0 , 0 ) - -# Creation of InLine Nodes -PyAdd = [] -PyAdd.append( 'def Add(a,b) : ' ) -PyAdd.append( ' return a+b ' ) -PyAdd.append( '' ) -Add = GraphInLines.INode( 'Add' , PyAdd ) -Add.InPort( 'a' , 'long' ) -Add.InPort( 'b' , 'long' ) -Add.OutPort( 'f' , 'long' ) -Add.SetName( 'Add' ) -Add.SetAuthor( '' ) -Add.SetComment( 'Python function' ) -Add.Coords( 351 , 77 ) -PySub = [] -PySub.append( 'def Sub(a,b) : ' ) -PySub.append( ' return a-b ' ) -PySub.append( '' ) -Sub = GraphInLines.INode( 'Sub' , PySub ) -Sub.InPort( 'a' , 'long' ) -Sub.InPort( 'b' , 'long' ) -Sub.OutPort( 'f' , 'long' ) -Sub.SetName( 'Sub' ) -Sub.SetAuthor( '' ) -Sub.SetComment( 'Python function' ) -Sub.Coords( 86 , 333 ) -PyMul = [] -PyMul.append( 'def Mul(a,b) : ' ) -PyMul.append( ' return a*b ' ) -Mul = GraphInLines.INode( 'Mul' , PyMul ) -Mul.InPort( 'a' , 'long' ) -Mul.InPort( 'b' , 'long' ) -Mul.OutPort( 'Result' , 'long' ) -Mul.SetName( 'Mul' ) -Mul.SetAuthor( '' ) -Mul.SetComment( 'Python function' ) -Mul.Coords( 616 , 247 ) - -# Creation of intermediate Output variables and of Control Links -Addf = Add.Port( 'f' ) -Mula = GraphInLines.Link( Addf , Mul.Port( 'a' ) ) -Mula.AddCoord( 1 , 570 , 356 ) -Mula.AddCoord( 2 , 570 , 186 ) -Subf = Sub.Port( 'f' ) -Mulb = GraphInLines.Link( Subf , Mul.Port( 'b' ) ) -Mulb.AddCoord( 1 , 282 , 376 ) -Mulb.AddCoord( 2 , 282 , 442 ) -Addb = GraphInLines.Link( Subf , Add.Port( 'b' ) ) -Addb.AddCoord( 1 , 283 , 209 ) -Addb.AddCoord( 2 , 283 , 374 ) -Addb.AddCoord( 3 , 283 , 442 ) - -# Creation of Input datas -Adda = Add.Input( 'a' , 1) -Suba = Sub.Input( 'a' , 3) -Subb = Sub.Input( 'b' , 4) - -# Creation of Output variables -MulResult = Mul.Port( 'Result' ) - -GraphInLines.Run() - -GraphInLines.DoneW() - -GraphInLines.PrintPorts() - -sg.updateObjBrowser(1); +if sys.platform != "win32": + print + print "============= Test Supervisor =============================" + print + + comp = catalog.GetComponent("SUPERV") + if comp is None: + raise RuntimeError,"Component SUPERV not found in Module Catalog." + + from SuperV import * + import SALOMEDS + myStudy = salome.myStudy + myBuilder = myStudy.NewBuilder() + + SuperVision = lcc.FindOrLoadComponent("SuperVisionContainer","SUPERV") + father = myStudy.FindComponent("SUPERV") + if father is None: + father = myBuilder.NewComponent("SUPERV") + A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName"); + FName = A1._narrow(SALOMEDS.AttributeName) + FName.SetValue( salome.sg.getComponentUserName("SUPERV") ) + A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap"); + aPixmap = A2._narrow(SALOMEDS.AttributePixMap); + aPixmap.SetPixMap( "ICON_OBJBROWSER_Supervision" ); + myBuilder.DefineComponentInstance(father,SuperVision) + + def addStudy(ior): + dataflow = SuperVision.getStreamGraph(ior) + name=dataflow.Name() + itr = myStudy.NewChildIterator(father) + while itr.More(): + item=itr.Value() + res,A=item.FindAttribute("AttributeName") + if res: + aName = A._narrow(SALOMEDS.AttributeName) + if aName.Value() == name : + print myBuilder.FindOrCreateAttribute(item, "AttributeIOR") + A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR") + print "A = ", A + if A is not None : + #res,A = myBuilder.FindOrCreateAttribute(item, "AttributeIOR") + anIOR = A._narrow(SALOMEDS.AttributeIOR); + print "anIOR.SetValue(dataflow.getIOR())" + anIOR.SetValue(dataflow.getIOR()) + return + itr.Next() + obj = myBuilder.NewObject(father) + A=myBuilder.FindOrCreateAttribute(obj, "AttributeName") + aName=A._narrow(SALOMEDS.AttributeName) + aName.SetValue(name) + A=myBuilder.FindOrCreateAttribute(obj, "AttributeIOR") + anIOR = A._narrow(SALOMEDS.AttributeIOR) + anIOR.SetValue(dataflow.getIOR()) + + import os + dir= os.getenv("DATA_DIR") + if dir == None: + raise RuntimeError, "DATA_DIR is not defined" + xmlfile = dir + "/Superv/Graphs/GraphGeomEssaiGates.xml" + print "Load dataflow from the file : " + print xmlfile + print + + myGraph = StreamGraph ( xmlfile ) + + # This DataFlow is "valid" : no loop, correct links between Nodes etc... + print "myGraph.IsValid() = ", myGraph.IsValid() + + # Get Nodes + myGraph.PrintNodes() + + # This DataFlow is "executable" : all pending Ports are defined with Datas + print myGraph.IsExecutable() + + # Starts only execution of that DataFlow and gets control immediatly + print myGraph.Run() + + # That DataFlow is running ==> 0 (false) + print myGraph.IsDone() + + # Events of execution : + aStatus,aNode,anEvent,aState = myGraph.Event() + while aStatus : + print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState + aStatus,aNode,anEvent,aState = myGraph.Event() + print "myGraph.IsDone() = ",myGraph.IsDone() + + # Wait for Completion (but it is already done after event loop ...) + print "Done : ",myGraph.DoneW() + + print " " + #print "Type : print myGraph.IsDone()" + #print " If execution is finished ==> 1 (true)" + res=myGraph.IsDone() + if res != 1: + raise RuntimeError, "myGraph.Run() is not done" + + print " " + print "Type : myGraph.PrintPorts()" + print " to see input and output values of the graph" + myGraph.PrintPorts() + + # Export will create newsupervisionexample.xml and the corresponding .py file + tmpdir=os.getenv("TmpDir") + if tmpdir is None: + tmpdir="/tmp" + file = tmpdir + "/newsupervisionexample" + print "--------------\n"+file+"\n--------------\n" + myGraph.Export(file) + + ior = salome.orb.object_to_string(myGraph.G) + addStudy(ior) + + GraphName = myGraph.Name() + print "Befor save ", + #nodes = myGraph.Nodes() + nodes = myGraph.G.Nodes().FNodes + length_bs = len(nodes) + print "ListOfNodes length = ", length_bs + names=[] + for node in nodes: + names.append(node.Name()) + print names + + # Graph creation + GraphInLines = StreamGraph( 'GraphInLines' ) + GraphInLines.SetName( 'GraphInLines' ) + GraphInLines.SetAuthor( '' ) + GraphInLines.SetComment( '' ) + GraphInLines.Coords( 0 , 0 ) + + # Creation of InLine Nodes + PyAdd = [] + PyAdd.append( 'def Add(a,b) : ' ) + PyAdd.append( ' return a+b ' ) + PyAdd.append( '' ) + Add = GraphInLines.INode( 'Add' , PyAdd ) + Add.InPort( 'a' , 'long' ) + Add.InPort( 'b' , 'long' ) + Add.OutPort( 'f' , 'long' ) + Add.SetName( 'Add' ) + Add.SetAuthor( '' ) + Add.SetComment( 'Python function' ) + Add.Coords( 351 , 77 ) + PySub = [] + PySub.append( 'def Sub(a,b) : ' ) + PySub.append( ' return a-b ' ) + PySub.append( '' ) + Sub = GraphInLines.INode( 'Sub' , PySub ) + Sub.InPort( 'a' , 'long' ) + Sub.InPort( 'b' , 'long' ) + Sub.OutPort( 'f' , 'long' ) + Sub.SetName( 'Sub' ) + Sub.SetAuthor( '' ) + Sub.SetComment( 'Python function' ) + Sub.Coords( 86 , 333 ) + PyMul = [] + PyMul.append( 'def Mul(a,b) : ' ) + PyMul.append( ' return a*b ' ) + Mul = GraphInLines.INode( 'Mul' , PyMul ) + Mul.InPort( 'a' , 'long' ) + Mul.InPort( 'b' , 'long' ) + Mul.OutPort( 'Result' , 'long' ) + Mul.SetName( 'Mul' ) + Mul.SetAuthor( '' ) + Mul.SetComment( 'Python function' ) + Mul.Coords( 616 , 247 ) + + # Creation of intermediate Output variables and of Control Links + Addf = Add.Port( 'f' ) + Mula = GraphInLines.Link( Addf , Mul.Port( 'a' ) ) + Mula.AddCoord( 1 , 570 , 356 ) + Mula.AddCoord( 2 , 570 , 186 ) + Subf = Sub.Port( 'f' ) + Mulb = GraphInLines.Link( Subf , Mul.Port( 'b' ) ) + Mulb.AddCoord( 1 , 282 , 376 ) + Mulb.AddCoord( 2 , 282 , 442 ) + Addb = GraphInLines.Link( Subf , Add.Port( 'b' ) ) + Addb.AddCoord( 1 , 283 , 209 ) + Addb.AddCoord( 2 , 283 , 374 ) + Addb.AddCoord( 3 , 283 , 442 ) + + # Creation of Input datas + Adda = Add.Input( 'a' , 1) + Suba = Sub.Input( 'a' , 3) + Subb = Sub.Input( 'b' , 4) + + # Creation of Output variables + MulResult = Mul.Port( 'Result' ) + + GraphInLines.Run() + + GraphInLines.DoneW() + + GraphInLines.PrintPorts() + + sg.updateObjBrowser(1); + + pass print print "============= Test VISU and MED =============================" @@ -457,9 +466,19 @@ try: if os.access(medFile, os.R_OK) : if not os.access(medFile, os.W_OK) : import random - medFileNew = "/tmp/" + str(random.randint(0,1000000)) + "_" + medFileName + if sys.platform != "win32": + tmpDir = "/tmp/" + else: + tmpDir = os.getenv('TEMP') + '/' + medFileNew = tmpDir + str(random.randint(0,1000000)) + "_" + medFileName print " -- Copy " + medFile + " to " + medFileNew - os.system("cp "+ medFile + " " + medFileNew) + + if sys.platform != "win32": + copyCommand = "cp" + else: + copyCommand = "copy /Y" + os.system(copyCommand + " " + medFile + " " + medFileNew) + medFile = medFileNew os.system("chmod 755 " + medFile) diff --git a/src/Launcher/BatchLight_BatchManager.cxx b/src/Launcher/BatchLight_BatchManager.cxx new file mode 100644 index 000000000..37def271e --- /dev/null +++ b/src/Launcher/BatchLight_BatchManager.cxx @@ -0,0 +1,296 @@ +// 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(job); + + // export input files on cluster + exportInputFiles(job); + + // build salome coupling script for job + buildSalomeCouplingScript(job); + + // build batch script for job + buildSalomeBatchScript(job); + + // submit job on cluster + id = submit(job); + + // register job on map + _jobmap[id] = job; + END_OF("BatchManager::submitJob"); + return id; + } + + void BatchManager::setDirForTmpFiles(BatchLight::Job* job) + { + std::string dirForTmpFiles; + std::string thedate; + + // Adding date to the directory name + Batch::Date date = Batch::Date(time(0)); + thedate = date.str(); + int lend = thedate.size() ; + int i = 0 ; + while ( i < lend ) { + if ( thedate[i] == '/' || thedate[i] == '-' || thedate[i] == ':' ) { + thedate[i] = '_' ; + } + i++ ; + } + + dirForTmpFiles += string("Batch/"); + dirForTmpFiles += thedate ; + job->setDirForTmpFiles(dirForTmpFiles); + } + + void BatchManager::exportInputFiles(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager::exportInFiles"); + int status; + const char * fileToExecute = job->getFileToExecute(); + const Engines::FilesList filesToExportList = job->getFilesToExportList(); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + std::string command; + std::string copy_command; + + // Test protocol + if( _params.protocol == "rsh" ) + copy_command = "rcp "; + else if( _params.protocol == "ssh" ) + copy_command = "scp "; + else + throw SALOME_Exception("Unknown protocol : only rsh and ssh are known !"); + + // First step : creating batch tmp files directory + command = _params.protocol; + 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) { + std::ostringstream oss; + oss << status; + std::string ex_mess("Error of connection on remote host ! status = "); + ex_mess += oss.str(); + throw SALOME_Exception(ex_mess.c_str()); + } + + // Second step : copy fileToExecute into + // batch tmp files directory + command = copy_command; + 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) { + std::ostringstream oss; + oss << status; + std::string ex_mess("Error of connection on remote host ! status = "); + ex_mess += oss.str(); + throw SALOME_Exception(ex_mess.c_str()); + } + + // Third step : copy filesToExportList into + // batch tmp files directory + for (int i = 0 ; i < filesToExportList.length() ; i++ ) { + command = copy_command; + 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) { + std::ostringstream oss; + oss << status; + std::string ex_mess("Error of connection on remote host ! status = "); + ex_mess += oss.str(); + throw SALOME_Exception(ex_mess.c_str()); + } + } + + 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) + { + // Try to get what we can (logs files) + // throw SALOME_Exception("Error of connection on remote host"); + std::string mess("Copy command failed ! status is :"); + ostringstream status_str; + status_str << status; + mess += status_str.str(); + INFOS(mess); + } + } + + 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(std::string & TemporaryFileName) + { + string command = "rm "; + command += TemporaryFileName; + 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/Launcher/BatchLight_BatchManager.hxx b/src/Launcher/BatchLight_BatchManager.hxx new file mode 100644 index 000000000..7183c1d1b --- /dev/null +++ b/src/Launcher/BatchLight_BatchManager.hxx @@ -0,0 +1,89 @@ +// 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; + + virtual int submit(BatchLight::Job* job) throw(SALOME_Exception) = 0; + void setDirForTmpFiles(BatchLight::Job* job); + void exportInputFiles(BatchLight::Job* job) throw(SALOME_Exception); + virtual void buildSalomeCouplingScript(BatchLight::Job* job) throw(SALOME_Exception) = 0; + virtual void buildSalomeBatchScript(BatchLight::Job* job) throw(SALOME_Exception) = 0; + + std::string BuildTemporaryFileName() const; + void RmTmpFile(std::string & TemporaryFileName); + MpiImpl *FactoryMpiImpl(std::string mpiImpl) throw(SALOME_Exception); + private: + + }; + +} + +#endif diff --git a/src/Launcher/BatchLight_BatchManager_PBS.cxx b/src/Launcher/BatchLight_BatchManager_PBS.cxx new file mode 100644 index 000000000..eec063a02 --- /dev/null +++ b/src/Launcher/BatchLight_BatchManager_PBS.cxx @@ -0,0 +1,475 @@ +// 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; + oss << this << "_" << jobid; + 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 += _pbs_job_name[jobid]; + 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(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_PBS::buildSalomeCouplingScript"); + int status; + const char *fileToExecute = job->getFileToExecute(); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + int idx = dirForTmpFiles.find("Batch/"); + std::string filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); + + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + std::string fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + std::string TmpFileName = BuildTemporaryFileName(); + + ofstream tempOutputFile; + tempOutputFile.open(TmpFileName.c_str(), ofstream::out ); + + // Begin + tempOutputFile << "#! /bin/sh -f" << endl ; + tempOutputFile << "cd " ; + tempOutputFile << _params.applipath << endl ; + tempOutputFile << "export SALOME_BATCH=1\n"; + tempOutputFile << "export PYTHONPATH=~/" ; + tempOutputFile << dirForTmpFiles ; + tempOutputFile << ":$PYTHONPATH" << endl ; + + // Test node rank + tempOutputFile << "if test " ; + tempOutputFile << _mpiImpl->rank() ; + tempOutputFile << " = 0; then" << endl ; + + // ----------------------------------------------- + // Code for rank 0 : launch runAppli and a container + // RunAppli + 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 --ns-port-log=" + << filelogtemp + << " &\n"; + + // Wait NamingService + tempOutputFile << " current=0\n" + << " stop=20\n" + << " while ! test -f " << filelogtemp << "\n" + << " do\n" + << " sleep 2\n" + << " let current=current+1\n" + << " if [ \"$current\" -eq \"$stop\" ] ; then\n" + << " echo Error Naming Service failed ! >&2" + << " exit\n" + << " fi\n" + << " done\n" + << " port=`cat " << filelogtemp << "`\n"; + + // Launch a container + tempOutputFile << " ./runSession SALOME_Container 'YACS_Server_'" + << _mpiImpl->rank() + << " > ~/" << dirForTmpFiles << "/YACS_Server_" + << _mpiImpl->rank() << "_container_log." << filelogtemp + << " 2>&1 &\n"; + + // Wait other containers + tempOutputFile << " for ((ip=0; 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 ; + + // Launch user script + tempOutputFile << " ./runSession python ~/" << dirForTmpFiles << "/" << fileNameToExecute << ".py\n"; + + // Stop application + tempOutputFile << " rm " << filelogtemp << "\n" + << " ./runSession killSalomeWithPort.py $port\n"; + + // ------------------------------------- + // Other nodes launch a container + tempOutputFile << "else" << endl ; + + // Wait NamingService + tempOutputFile << " current=0\n" + << " stop=20\n" + << " while ! test -f " << filelogtemp << "\n" + << " do\n" + << " sleep 2\n" + << " let current=current+1\n" + << " if [ \"$current\" -eq \"$stop\" ] ; then\n" + << " echo Error Naming Service failed ! >&2" + << " exit\n" + << " fi\n" + << " done\n" + << " port=`cat " << filelogtemp << "`\n"; + + // Launching container + tempOutputFile << " ./runSession SALOME_Container 'YACS_Server_'"; + tempOutputFile << _mpiImpl->rank() + << " > ~/" << dirForTmpFiles << "/YACS_Server_" + << _mpiImpl->rank() << "_container_log." << filelogtemp + << " 2>&1\n"; + 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(TmpFileName); + + END_OF("BatchManager_PBS::buildSalomeCouplingScript"); + } + + void BatchManager_PBS::buildSalomeBatchScript(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_PBS::buildSalomeBatchScript"); + int status; + const int nbproc = job->getNbProc(); + std::string edt = job->getExpectedDuringTime(); + std::string mem = job->getMemory(); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + const char *fileToExecute = job->getFileToExecute(); + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + std::string fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + int idx = dirForTmpFiles.find("Batch/"); + std::string filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); + + 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; + + std::string 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 ; + if (edt != "") + tempOutputFile << "#PBS -l walltime=" << edt << ":00" << endl ; + if (mem != "") + tempOutputFile << "#PBS -l mem=" << mem << endl ; + // In some systems qsub does not correctly expand env variables + // like PBS_O_HOME for #PBS directives.... + //tempOutputFile << "#PBS -o /$PBS_O_HOME/" << dirForTmpFiles << "/runSalome.output.log.${PBS_JOBID}" << endl ; + //tempOutputFile << "#PBS -e /$PBS_O_HOME/" << dirForTmpFiles << "/runSalome.error.log.${PBS_JOBID}" << endl ; + tempOutputFile << "#PBS -o runSalome.output.log." << filelogtemp << endl ; + tempOutputFile << "#PBS -e runSalome.error.log." << filelogtemp << 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"); + + // Adding log files into import list files + ostringstream file_name_output; + file_name_output << "~/" << dirForTmpFiles << "/" << "runSalome.output.log*"; + ostringstream file_name_error; + file_name_error << "~/" << dirForTmpFiles << "/" << "runSalome.error.log*"; + ostringstream file_container_log; + file_container_log << "~/" << dirForTmpFiles << "/" << "YACS_Server*"; + job->addFileToImportList(file_name_output.str()); + job->addFileToImportList(file_name_error.str()); + job->addFileToImportList(file_container_log.str()); + RmTmpFile(TmpFileName); + END_OF("BatchManager_PBS::buildSalomeBatchScript"); + } + + int BatchManager_PBS::submit(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_PBS::submit"); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + const char *fileToExecute = job->getFileToExecute(); + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + std::string fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + + // 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 += " \"cd " ; + command += dirForTmpFiles; + command += "; qsub " ; + 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; + + // Ajout dans la map + _pbs_job_name[id] = sline; + END_OF("BatchManager_PBS::submit"); + return id; + } + +} diff --git a/src/Launcher/BatchLight_BatchManager_PBS.hxx b/src/Launcher/BatchLight_BatchManager_PBS.hxx new file mode 100644 index 000000000..e0c21651b --- /dev/null +++ b/src/Launcher/BatchLight_BatchManager_PBS.hxx @@ -0,0 +1,64 @@ +// 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(BatchLight::Job* job) throw(SALOME_Exception); + void buildSalomeBatchScript(BatchLight::Job* job) throw(SALOME_Exception); + int submit(BatchLight::Job* job) throw(SALOME_Exception); + + // Permet d'avoir la chaîne complête pour demander + // le statut du job + typedef std::map _pbs_job_name_t; + _pbs_job_name_t _pbs_job_name; + }; + +} + +#endif diff --git a/src/Launcher/BatchLight_BatchManager_SLURM.cxx b/src/Launcher/BatchLight_BatchManager_SLURM.cxx new file mode 100644 index 000000000..d184ca6bb --- /dev/null +++ b/src/Launcher/BatchLight_BatchManager_SLURM.cxx @@ -0,0 +1,340 @@ +// 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(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_SLURM::buildSalomeCouplingScript"); + int status; + const char *fileToExecute = job->getFileToExecute(); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + std::string fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + + std::string 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(TmpFileName); + + END_OF("BatchManager_SLURM::buildSalomeCouplingScript"); + } + + void BatchManager_SLURM::buildSalomeBatchScript(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_SLURM::buildSalomeBatchScript"); + int status; + const int nbproc = job->getNbProc(); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + std::string TmpFileName = BuildTemporaryFileName(); + ofstream tempOutputFile; + tempOutputFile.open(TmpFileName.c_str(), ofstream::out ); + const char *fileToExecute = job->getFileToExecute(); + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + std::string fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + + tempOutputFile << "#! /bin/sh -f" << endl ; + tempOutputFile << "#BSUB -n " << nbproc << endl ; + tempOutputFile << "#BSUB -o " << dirForTmpFiles << "/runSalome.log%J" << endl ; + tempOutputFile << "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(TmpFileName); + END_OF("BatchManager_SLURM::buildSalomeBatchScript"); + + } + + int BatchManager_SLURM::submit(BatchLight::Job* job) throw(SALOME_Exception) + { + BEGIN_OF("BatchManager_SLURM::submit"); + const std::string dirForTmpFiles = job->getDirForTmpFiles(); + const char *fileToExecute = job->getFileToExecute(); + string::size_type p1 = string(fileToExecute).find_last_of("/"); + string::size_type p2 = string(fileToExecute).find_last_of("."); + std::string fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1); + + // 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 p10 = sline.find("<"); + int p20 = sline.find(">"); + string strjob = sline.substr(p10+1,p20-p10-1); + + int id; + istringstream iss(strjob); + iss >> id; + + END_OF("BatchManager_SLURM::submit"); + return id; + } + +} diff --git a/src/Launcher/BatchLight_BatchManager_SLURM.hxx b/src/Launcher/BatchLight_BatchManager_SLURM.hxx new file mode 100644 index 000000000..6024b28de --- /dev/null +++ b/src/Launcher/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(BatchLight::Job* job) throw(SALOME_Exception); + void buildSalomeBatchScript(BatchLight::Job* job) throw(SALOME_Exception); + int submit(BatchLight::Job* job) throw(SALOME_Exception); + + private: + + }; + +} + +#endif diff --git a/src/Launcher/BatchLight_Job.cxx b/src/Launcher/BatchLight_Job.cxx new file mode 100644 index 000000000..1980054a9 --- /dev/null +++ b/src/Launcher/BatchLight_Job.cxx @@ -0,0 +1,160 @@ +// 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.cxx : + * + * Auteur : Bernard SECHER - CEA/DEN + * Date : Juillet 2007 + * Projet : SALOME + * + */ + +#include "BatchLight_Job.hxx" +#include + +using namespace std; +using namespace BatchLight; + +Job::Job(const char *fileToExecute, + const Engines::FilesList& filesToExport, + const Engines::FilesList& filesToImport, + const Engines::BatchParameters& batch_params) : _fileToExecute(fileToExecute), + _filesToExport(filesToExport), + _filesToImport(filesToImport), + _batch_params(batch_params) +{ + _dirForTmpFiles = "/tmp/default_batch_tmp_directory"; + std::string _fileNameToExecute = ""; +} + +Job::~Job() +{ + MESSAGE("Job destructor"); +} + +void +Job::addFileToImportList(std::string file_name) +{ + CORBA::ULong lgth = _filesToImport.length(); + _filesToImport.length(lgth+1); + _filesToImport[lgth] = CORBA::string_dup(file_name.c_str()); +} + +const std::string +Job::getExpectedDuringTime() +{ + std::string str(_batch_params.expected_during_time); + return str; +} + +const std::string +Job::getMemory() +{ + std::string str(_batch_params.mem); + return str; +} + +bool +Job::check() { + bool rtn = true; + INFOS("Warning : batch_directory option is not currently implemented"); + INFOS("Warning : currently these informations are only in the PBS batch manager"); + INFOS("Job parameters are :"); + INFOS("Directory : $HOME/Batch/$date"); + + // check expected_during_time (check the format) + std::string edt_info; + std::string edt_value = _batch_params.expected_during_time.in(); + if (edt_value != "") { + std::string begin_edt_value = edt_value.substr(0, 2); + std::string mid_edt_value = edt_value.substr(2, 1); + std::string end_edt_value = edt_value.substr(3); + + long value; + std::istringstream iss(begin_edt_value); + if (!(iss >> value)) { + edt_info = "Error on definition ! : " + edt_value; + rtn = false; + } + else if (value < 0) { + edt_info = "Error on definition time is negative ! : " + value; + rtn = false; + } + std::istringstream iss_2(end_edt_value); + if (!(iss_2 >> value)) { + edt_info = "Error on definition ! : " + edt_value; + rtn = false; + } + else if (value < 0) { + edt_info = "Error on definition time is negative ! : " + value; + rtn = false; + } + if (mid_edt_value != ":") { + edt_info = "Error on definition ! :" + edt_value; + rtn = false; + } + } + else { + edt_info = "No value given"; + } + INFOS("Expected during time : " << edt_info); + + // check memory (check the format) + std::string mem_info; + std::string mem_value = _batch_params.mem.in(); + if (mem_value != "") { + std::string begin_mem_value = mem_value.substr(0, mem_value.length()-2); + long re_mem_value; + std::istringstream iss(begin_mem_value); + if (!(iss >> re_mem_value)) { + mem_info = "Error on definition ! : " + mem_value; + rtn = false; + } + else if (re_mem_value <= 0) { + mem_info = "Error on definition memory is negative ! : " + mem_value; + rtn = false; + } + std::string end_mem_value = mem_value.substr(mem_value.length()-2); + if (end_mem_value != "gb" and end_mem_value != "mb") { + mem_info = "Error on definition, type is bad ! " + mem_value; + rtn = false; + } + } + else { + mem_info = "No value given"; + } + INFOS("Memory : " << mem_info); + + // check nb_proc + std::string nb_proc_info; + ostringstream nb_proc_value; + nb_proc_value << _batch_params.nb_proc; + if(_batch_params.nb_proc <= 0) { + nb_proc_info = "Bad value ! nb_proc = "; + nb_proc_info += nb_proc_value.str(); + rtn = false; + } + else { + nb_proc_info = nb_proc_value.str(); + } + INFOS("Nb of processors : " << nb_proc_info); + + return rtn; +} diff --git a/src/Launcher/BatchLight_Job.hxx b/src/Launcher/BatchLight_Job.hxx new file mode 100644 index 000000000..e17e790b9 --- /dev/null +++ b/src/Launcher/BatchLight_Job.hxx @@ -0,0 +1,72 @@ +// 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 Engines::BatchParameters& batch_params); + virtual ~Job(); + + const char *getFileToExecute() const { return _fileToExecute; } + const Engines::FilesList getFilesToExportList() const { return _filesToExport; } + const Engines::FilesList getFilesToImportList() const { return _filesToImport; } + void addFileToImportList(std::string file_name); + const CORBA::Long getNbProc() const { return _batch_params.nb_proc; } + const std::string getExpectedDuringTime(); + const std::string getMemory(); + + const std::string getDirForTmpFiles() const { return _dirForTmpFiles;} + void setDirForTmpFiles(std::string dirForTmpFiles) {_dirForTmpFiles = dirForTmpFiles; + SCRUTE(_dirForTmpFiles);} + bool check(); + protected: + const char* _fileToExecute; + const Engines::FilesList _filesToExport; + Engines::FilesList _filesToImport; + Engines::BatchParameters _batch_params; + std::string _dirForTmpFiles; // Tmp directory on the server + private: + + }; + +} + +#endif diff --git a/src/Launcher/Makefile.am b/src/Launcher/Makefile.am new file mode 100644 index 000000000..a78dc3edb --- /dev/null +++ b/src/Launcher/Makefile.am @@ -0,0 +1,138 @@ +# 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 = \ + BatchLight_BatchManager.hxx \ + BatchLight_BatchManager_PBS.hxx \ + BatchLight_BatchManager_SLURM.hxx \ + BatchLight_Job.hxx \ + MpiImpl.hxx \ + 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 \ + BatchLight_BatchManager.cxx \ + BatchLight_BatchManager_SLURM.cxx \ + BatchLight_BatchManager_PBS.cxx \ + BatchLight_Job.cxx \ + MpiImpl.cxx + +libSalomeLauncher_la_CPPFLAGS =\ + $(COMMON_CPPFLAGS) + +libSalomeLauncher_la_LDFLAGS =\ + -no-undefined -version-info=0:0:0 \ + @LDEXPDYNFLAGS@ + +libSalomeLauncher_la_LIBADD =\ + $(COMMON_LIBS) + + +# +# =============================================================== +# Executables targets +# =============================================================== +# +bin_PROGRAMS = SALOME_LauncherServer + +SALOME_LauncherServer_SOURCES =\ + SALOME_LauncherServer.cxx + +SALOME_LauncherServer_CPPFLAGS=\ + $(COMMON_CPPFLAGS) + +SALOME_LauncherServer_LDADD =\ + libSalomeLauncher.la \ + $(MPI_LIBS) \ + $(CORBA_LIBS) \ + $(LIBXML_LIBS) \ + $(PYTHON_LIBS) + + diff --git a/src/Launcher/MpiImpl.cxx b/src/Launcher/MpiImpl.cxx new file mode 100644 index 000000000..036018b1e --- /dev/null +++ b/src/Launcher/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/Launcher/MpiImpl.hxx b/src/Launcher/MpiImpl.hxx new file mode 100644 index 000000000..beeac0301 --- /dev/null +++ b/src/Launcher/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/Launcher/SALOME_Launcher.cxx b/src/Launcher/SALOME_Launcher.cxx new file mode 100644 index 000000000..a507c010d --- /dev/null +++ b/src/Launcher/SALOME_Launcher.cxx @@ -0,0 +1,286 @@ +// 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 Engines::BatchParameters& batch_params, + 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); + if (aMachineList->length() == 0) + throw SALOME_Exception("No resources have been found with your parameters"); + + const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]); + string clustername(p->alias); + INFOS("Choose cluster" << clustername); + + // search batch manager for that cluster in map or instanciate one + std::map < string, BatchLight::BatchManager * >::const_iterator it = _batchmap.find(clustername); + if(it == _batchmap.end()) + { + _batchmap[clustername] = FactoryBatchManager(p); + // TODO: Add a test for the cluster ! + } + + // create and submit job on cluster + BatchLight::Job* job = new BatchLight::Job(fileToExecute, filesToExport, filesToImport, batch_params); + bool res = job->check(); + if (!res) { + delete job; + throw SALOME_Exception("Job parameters are bad (see informations above)"); + } + jobId = _batchmap[clustername]->submitJob(job); + } + catch(const SALOME_Exception &ex){ + INFOS(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..4bc5d65ce --- /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 Engines::BatchParameters& batch_params, + 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/LifeCycleCORBA.py b/src/LifeCycleCORBA/LifeCycleCORBA.py index e0a7ac0f3..928c83cea 100644 --- a/src/LifeCycleCORBA/LifeCycleCORBA.py +++ b/src/LifeCycleCORBA/LifeCycleCORBA.py @@ -159,7 +159,7 @@ class LifeCycleCORBA: pass pass if len(machinesOK)!=0: - bestMachine=self._contManager.FindBest(machinesOK) + bestMachine=self._contManager.FindFirst(machinesOK) componentNameForNS= [CosNaming.NameComponent(bestMachine,"dir"), CosNaming.NameComponent(containerName,"dir"), CosNaming.NameComponent(componentName,"object")] @@ -176,7 +176,7 @@ class LifeCycleCORBA: else: return None else: - bestMachine=self._contManager.FindBest(listOfMachines) + bestMachine=self._contManager.FindFirst(listOfMachines) MESSAGE("Not implemented yet ...") return None pass diff --git a/src/LifeCycleCORBA/Makefile.am b/src/LifeCycleCORBA/Makefile.am index 6bee2cf3c..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_MT_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_MT_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 a608f2196..895c53581 100644 --- a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.cxx @@ -74,7 +74,7 @@ SALOME_FileTransferCORBA::SALOME_FileTransferCORBA(string refMachine, _refMachine = refMachine; _origFileName = origFileName; _containerName = containerName; - if (_refMachine.empty() or _origFileName.empty()) + if (_refMachine.empty() || _origFileName.empty()) { INFOS("bad parameters: machine and file name must be given"); } @@ -108,7 +108,7 @@ string SALOME_FileTransferCORBA::getLocalFile(string localFile) if (CORBA::is_nil(_theFileRef)) { - if (_refMachine.empty() or _origFileName.empty()) + if (_refMachine.empty() || _origFileName.empty()) { INFOS("not enough parameters: machine and file name must be given"); return ""; @@ -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); @@ -182,8 +184,10 @@ string SALOME_FileTransferCORBA::getLocalFile(string localFile) SCRUTE(toFollow); CORBA::Octet *buf = aBlock->get_buffer(); int nbWri = fwrite(buf, sizeof(CORBA::Octet), toFollow, fp); + delete aBlock; ASSERT(nbWri == toFollow); } + fclose(fp); MESSAGE("end of transfer"); fileTransfer->close(fileId); _theFileRef->addRef(myMachine.c_str(), localFile.c_str()); diff --git a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.hxx b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.hxx index 871e0aa14..c0927d92c 100644 --- a/src/LifeCycleCORBA/SALOME_FileTransferCORBA.hxx +++ b/src/LifeCycleCORBA/SALOME_FileTransferCORBA.hxx @@ -34,7 +34,17 @@ #include -class SALOME_FileTransferCORBA +#ifdef WNT +# if defined LIFECYCLECORBA_EXPORTS +# define LIFECYCLECORBA_EXPORT __declspec( dllexport ) +# else +# define LIFECYCLECORBA_EXPORT __declspec( dllimport ) +# endif +#else +# define LIFECYCLECORBA_EXPORT +#endif + +class LIFECYCLECORBA_EXPORT SALOME_FileTransferCORBA { public: SALOME_FileTransferCORBA(); diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index 07250628a..a18a09c8e 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -32,7 +32,9 @@ #include #include -#include +#ifndef WNT + #include +#endif #include "OpUtil.hxx" #include "utilities.h" @@ -92,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); } //============================================================================= @@ -122,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, @@ -153,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, @@ -186,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, @@ -219,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)) @@ -255,7 +287,7 @@ SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName, // SCRUTE(params->isMPI); free(stContainer); return FindOrLoad_Component(params,componentName); - + //#endif } //============================================================================= @@ -275,11 +307,12 @@ 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)) { - INFOS("Catalog Error : Component not found in the catalog"); + INFOS("Catalog Error: Component not found in the catalog" ); + INFOS( componentName ); return false; } else return true; @@ -337,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; } //============================================================================= @@ -372,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 - @@ -422,7 +471,7 @@ _FindComponent(const Engines::MachineParameters& params, if(lghtOfmachinesOK != 0) { machinesOK->length(lghtOfmachinesOK); - CORBA::String_var bestMachine = _ContManager->FindBest(machinesOK); + CORBA::String_var bestMachine = _ResManager->FindFirst(machinesOK); CORBA::Object_var obj = _NS->ResolveComponent(bestMachine, containerName, componentName, @@ -454,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, @@ -473,16 +519,50 @@ _LoadComponent(const Engines::MachineParameters& params, return myInstance._retn(); } +Engines::Component_ptr +SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::MachineParameters& params, + const char *componentName, + int studyId) +{ + MESSAGE("Entering LoadParallelComponent"); + +/*MESSAGE("Parameters : "); + MESSAGE("Container name : " << params.container_name); + 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 = _ResManager->GetFittingResources(params, clist); + if (listOfMachines->length() == 0) + { + INFOS("No matching machines founded !"); + return Engines::Component::_nil(); + } + MESSAGE("Starting Parallel Container"); + Engines::Container_var cont = _ContManager->FindOrStartParallelContainer(params, listOfMachines); + if (CORBA::is_nil(cont)) { + INFOS("FindOrStartParallelContainer() returns a NULL container !"); + return Engines::Component::_nil(); + } - - - - - - - - - - + MESSAGE("Loading component library"); + bool isLoadable = cont->load_component_Library(componentName); + if (!isLoadable) { + INFOS(componentName <<" library is not loadable !"); + return Engines::Component::_nil(); + } + + MESSAGE("Creating component instance"); + // @PARALLEL@ permits to identify that the component requested + // is a parallel component. + string name = string(componentName) + string("@PARALLEL@"); + Engines::Component_var myInstance = cont->create_component_instance(name.c_str(), studyId); + if (CORBA::is_nil(myInstance)) + INFOS("create_component_instance returns a NULL component !"); + return myInstance._retn(); +} diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx index 0ff890dda..ced93eb1e 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx @@ -39,19 +39,16 @@ #include #include CORBA_CLIENT_HEADER(SALOME_ContainerManager) #include CORBA_CLIENT_HEADER(SALOME_Component) - -#if defined LIFECYCLECORBA_EXPORTS -#if defined WIN32 -#define LIFECYCLECORBA_EXPORT __declspec( dllexport ) -#else -#define LIFECYCLECORBA_EXPORT -#endif -#else -#if defined WNT -#define LIFECYCLECORBA_EXPORT __declspec( dllimport ) +#include +using namespace std; +#ifdef WNT +# if defined LIFECYCLECORBA_EXPORTS +# define LIFECYCLECORBA_EXPORT __declspec( dllexport ) +# else +# define LIFECYCLECORBA_EXPORT __declspec( dllimport ) +# endif #else -#define LIFECYCLECORBA_EXPORT -#endif +# define LIFECYCLECORBA_EXPORT #endif @@ -89,6 +86,12 @@ public: FindOrLoad_Component(const char *containerName, const char *componentName); // for compatibility + // Parallel extension + Engines::Component_ptr + Load_ParallelComponent(const Engines::MachineParameters& params, + const char *componentName, + int studyId); + bool isKnownComponentClass(const char *componentName); bool isMpiContainer(const Engines::MachineParameters& params) @@ -99,6 +102,7 @@ public: void preSet(Engines::MachineParameters& params); Engines::ContainerManager_ptr getContainerManager(); + Engines::ResourcesManager_ptr getResourcesManager(); protected: @@ -121,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/LifeCycleCORBA/TestContainerManager.cxx b/src/LifeCycleCORBA/TestContainerManager.cxx new file mode 100644 index 000000000..b908e90f8 --- /dev/null +++ b/src/LifeCycleCORBA/TestContainerManager.cxx @@ -0,0 +1,166 @@ +// SALOME TestContainer : test of container creation and its life cycle +// +// 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 : TestContainer.cxx +// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA +// Module : SALOME +// $Header$ + +#include "utilities.h" +#include +#include +#include +#include "SALOME_NamingService.hxx" +#include "SALOME_ContainerManager.hxx" +#include "SALOME_LifeCycleCORBA.hxx" +#include "NamingService_WaitForServerReadiness.hxx" +#include "OpUtil.hxx" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" +#include "Utils_SALOME_Exception.hxx" +#include "Utils_CommException.hxx" +using namespace std; + +int main (int argc, char * argv[]) +{ + map cycle; + map first; + Engines::Container_ptr cont; + Engines::Component_ptr compo; + bool error = false; + bool bestImplemented; + int status; + + // Initializing omniORB + ORB_INIT &init = *SINGLETON_::Instance() ; + CORBA::ORB_ptr orb = init( argc , argv ) ; + + SALOME_NamingService *_NS=new SALOME_NamingService(orb); + + 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"; + p.mem_mb = 1000; + p.cpu_clock = 1000; + p.nb_proc_per_node = 1; + p.nb_node = 1; + p.isMPI = false; + + char st[10]; + for(int i=0;i<10;i++){ + sprintf(st,"cycl_%d",i); + p.container_name = CORBA::string_dup(st); + 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->GiveContainer(p,Engines::P_FIRST,clist); + if(CORBA::is_nil(cont)) error = true; + } + + p.container_name = CORBA::string_dup("best"); + cont = _ContManager->GiveContainer(p,Engines::P_BEST,clist); + if(CORBA::is_nil(cont)) bestImplemented = false; + else bestImplemented = true; + + SALOME_LifeCycleCORBA LCC(_NS); + p.container_name = CORBA::string_dup("FactoryServer"); + compo = LCC.FindOrLoad_Component(p,"SMESH"); + if(CORBA::is_nil(compo)) error = true; + compo = LCC.FindOrLoad_Component(p,"SMESH"); + if(CORBA::is_nil(compo)) error = true; + + _NS->Change_Directory("/Containers"); + + vector vec = _NS->list_directory_recurs(); + list lstCont; + 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); + if(!CORBA::is_nil(cont)){ + cycle[cont->getHostName()]=0; + first[cont->getHostName()]=0; + 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)){ + if(strncmp(basename(cont->name()),"cycl",4)==0) + cycle[cont->getHostName()]++; + if(strncmp(basename(cont->name()),"first",5)==0) + first[cont->getHostName()]++; + } + } + _ContManager->ShutdownContainers(); + + int cmin=10; + 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){ + 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; + } + } + } + string msg; + if( ((cmax-cmin) <= 2) && (fmax == 10/nbpmax) && !error ){ + if(bestImplemented) + msg = "TEST OK"; + else + msg = "TEST OK but FindBest not implemented!"; + status=0; + } + else{ + 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/Makefile.am b/src/LifeCycleCORBA_SWIG/Makefile.am index 0a1b1d8b4..60f4b8305 100644 --- a/src/LifeCycleCORBA_SWIG/Makefile.am +++ b/src/LifeCycleCORBA_SWIG/Makefile.am @@ -52,11 +52,11 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am BUILT_SOURCES = swig_wrap.cpp -SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../LifeCycleCORBA +SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../LifeCycleCORBA -I$(srcdir)/../Utils SWIG_SOURCES = libSALOME_LifeCycleCORBA.i -pkgpython_PYTHON = libSALOME_LifeCycleCORBA.py -pkgpyexec_LTLIBRARIES = _libSALOME_LifeCycleCORBA.la +salomepython_PYTHON = libSALOME_LifeCycleCORBA.py +salomepyexec_LTLIBRARIES = _libSALOME_LifeCycleCORBA.la _libSALOME_LifeCycleCORBA_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES) _libSALOME_LifeCycleCORBA_la_CPPFLAGS =\ @PYTHON_INCLUDES@ \ @@ -93,4 +93,4 @@ dist_salomescript_DATA =\ TestLifeCycleCORBA.py # It's not needed to specify libSALOME_LifeCycleCORBA.py. It is -# automaticaly installed through the swig target pkgpython_PYTHON. +# automaticaly installed through the swig target salomepython_PYTHON. diff --git a/src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py b/src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py index 347524308..e979e3920 100644 --- a/src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py +++ b/src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py @@ -176,7 +176,10 @@ class LifeCycleCORBA_SWIGTest(unittest.TestCase): """ containerName = "aFarAwayContainer" containerName += "/swTheContainer" - cp1=self.lcc.FindOrLoad_Component(containerName,"SalomeTestComponent") + try: + cp1=self.lcc.FindOrLoad_Component(containerName,"SalomeTestComponent") + except RuntimeError,ex : + self.assertEqual(ex.args[0],'Salome Exception : unknown host') pass 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/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i b/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i index c8bbe000b..feaca2631 100644 --- a/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i +++ b/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i @@ -19,14 +19,22 @@ // +// ---------------------------------------------------------------------------- + %module libSALOME_LifeCycleCORBA +%include + + +// ---------------------------------------------------------------------------- + %{ #include "utilities.h" #include "SALOME_LifeCycleCORBA.hxx" #include "SALOME_FileTransferCORBA.hxx" #include "SALOME_NamingService.hxx" #include "ServiceUnreachable.hxx" +#include "Utils_SALOME_Exception.hxx" using namespace std; @@ -55,6 +63,9 @@ struct omniORBpyAPI { %} +// ---------------------------------------------------------------------------- + + %init %{ // init section @@ -72,20 +83,8 @@ struct omniORBpyAPI { %} -%exception { - try { - $action - } - catch (ServiceUnreachable) { - PyErr_SetString(PyExc_RuntimeError,"Naming Service Unreacheable"); - return NULL; - } - catch (...) { - PyErr_SetString(PyExc_RuntimeError, "unknown exception"); - return NULL; - } -} +// ---------------------------------------------------------------------------- %typemap(python,out) Engines::Container_ptr, Engines::Component_ptr, Engines::fileRef_ptr { @@ -95,6 +94,20 @@ struct omniORBpyAPI { SCRUTE($result); } +%typemap(python,in) Engines::fileRef_ptr aFileRef +{ + MESSAGE("typemap in on CORBA object ptr"); + try { + CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1); + $1 = Engines::fileRef::_narrow(obj); + SCRUTE($1); + } + catch (...) { + PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr"); + } +} + + %typemap(python,out) std::string, string { @@ -150,6 +163,8 @@ struct omniORBpyAPI { param->nb_proc_per_node = 0; param->nb_node = 0; param->isMPI = false; + param->parallelLib = CORBA::string_dup(""); + param->nb_component_nodes = 0; PyObject *key, *value; int pos = 0; while (PyDict_Next($input, &pos, &key, &value)) @@ -188,6 +203,14 @@ struct omniORBpyAPI { { param->isMPI = PyLong_AsLong(value); } + else if (strcmp(keystr,"parallelLib")==0) + { + param->parallelLib = CORBA::string_dup(PyString_AsString(value)); + } + else if (strcmp(keystr,"nb_component_nodes")==0) + { + param->nb_component_nodes = PyLong_AsLong(value); + } } $1 = param; } @@ -206,5 +229,39 @@ struct omniORBpyAPI { delete $1; } -%include "SALOME_LifeCycleCORBA.hxx" -%include "SALOME_FileTransferCORBA.hxx" +// ---------------------------------------------------------------------------- + +%include + +%exception { + Py_BEGIN_ALLOW_THREADS + try { + $action + } + catch (ServiceUnreachable) { + Py_BLOCK_THREADS + PyErr_SetString(PyExc_RuntimeError,"Naming Service Unreacheable"); + return NULL; + } + catch (SALOME_Exception &e) { + Py_BLOCK_THREADS + PyErr_SetString(PyExc_RuntimeError,e.what()); + return NULL; + } + catch (SALOME::SALOME_Exception &e) { + Py_BLOCK_THREADS + PyErr_SetString(PyExc_RuntimeError,e.details.text); + return NULL; + } + catch (...) { + Py_BLOCK_THREADS + PyErr_SetString(PyExc_RuntimeError, "unknown exception"); + return NULL; + } + Py_END_ALLOW_THREADS +} + + +%include +%include + diff --git a/src/Logger/SALOME_Logger_Server.hxx b/src/Logger/SALOME_Logger_Server.hxx index 74ef8e4d0..6481eb995 100644 --- a/src/Logger/SALOME_Logger_Server.hxx +++ b/src/Logger/SALOME_Logger_Server.hxx @@ -11,6 +11,8 @@ #if !defined SALOME_Logger_Server_include #define SALOME_Logger_Server_include +#include + #ifndef WNT #include #else @@ -20,9 +22,19 @@ #include #include "Logger.hh" -class Logger : - public POA_SALOME_Logger::Logger, - public PortableServer::RefCountServantBase +#ifdef WNT +# if defined LOGGER_EXPORTS +# define LOGGER_EXPORT __declspec( dllexport ) +# else +# define LOGGER_EXPORT __declspec( dllimport ) +# endif +#else +# define LOGGER_EXPORT +#endif + + +class LOGGER_EXPORT Logger : + public POA_SALOME_Logger::Logger { public: //constructor w/o parameters diff --git a/src/Logger/SALOME_Logger_Server_main.cxx b/src/Logger/SALOME_Logger_Server_main.cxx index a15d85405..c9551d567 100644 --- a/src/Logger/SALOME_Logger_Server_main.cxx +++ b/src/Logger/SALOME_Logger_Server_main.cxx @@ -14,6 +14,8 @@ #include #ifndef __WIN32__ # include +#else +# include "utilities.h" // for compilation type "timespec" #endif int main(int argc, char **argv) diff --git a/src/Makefile.am b/src/Makefile.am index 8d6b7fa89..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 \ @@ -52,7 +53,8 @@ SUBDIR_CORBA = \ KERNEL_PY \ ModuleGenerator \ Communication \ - Communication_SWIG + Communication_SWIG \ + DSC SUBDIR_CPPUNIT_BASE= \ Basics/Test \ @@ -79,10 +81,14 @@ SUBDIR_BATCH= \ Batch \ Batch_SWIG +SUBDIR_PARALLEL= ParallelContainer + + DIST_SUBDIRS = \ $(SUBDIR_BASE) \ $(SUBDIR_CORBA) \ $(SUBDIR_MPI) \ + $(SUBDIR_PARALLEL) \ $(SUBDIR_BATCH) \ $(SUBDIR_CPPUNIT_BASE) \ $(SUBDIR_CPPUNIT_CORBA) \ @@ -96,17 +102,17 @@ DIST_SUBDIRS = \ SUBDIRS = $(SUBDIR_BASE) -if CORBA_GEN - SUBDIRS += $(SUBDIR_CORBA) +if WITH_BATCH + SUBDIRS += $(SUBDIR_BATCH) endif -if MPI_IS_OK - SUBDIRS += $(SUBDIR_MPI) +if CORBA_GEN + SUBDIRS += $(SUBDIR_CORBA) endif -if WITH_BATCH - SUBDIRS += $(SUBDIR_BATCH) -endif +#if MPI_IS_OK +# SUBDIRS += $(SUBDIR_MPI) +#endif if CPPUNIT_IS_OK if CORBA_GEN @@ -120,4 +126,6 @@ else $(SUBDIR_CPPUNIT_GENERAL) endif endif - +if WITH_PACO_PARALLEL +SUBDIRS += $(SUBDIR_PARALLEL) +endif diff --git a/src/ModuleCatalog/Makefile.am b/src/ModuleCatalog/Makefile.am index f4d06ac04..45dd39b49 100644 --- a/src/ModuleCatalog/Makefile.am +++ b/src/ModuleCatalog/Makefile.am @@ -40,10 +40,11 @@ salomeinclude_HEADERS = \ PathPrefix.hxx \ SALOME_ModuleCatalog_Parser.hxx \ SALOME_ModuleCatalog_Parser_IO.hxx \ - SALOME_ModuleCatalog_Handler.hxx + SALOME_ModuleCatalog_Handler.hxx \ + SALOME_ModuleCatalog.hxx # Scripts to be installed -dist_salomescript_DATA = SALOME_TestModuleCatalog.py +dist_salomescript_DATA = TestModuleCatalog.py # @@ -61,8 +62,8 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Utils \ -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ - @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \ - @QT_MT_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 =\ @@ -70,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 \ @@ -84,8 +86,7 @@ libSalomeCatalog_la_CPPFLAGS =\ libSalomeCatalog_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeCatalog_la_LIBADD =\ - $(COMMON_LIBS) \ - @QT_MT_LIBS@ + $(COMMON_LIBS) # @@ -102,7 +103,6 @@ SALOME_ModuleCatalog_Server_CPPFLAGS =\ SALOME_ModuleCatalog_Server_LDADD =\ libSalomeCatalog.la \ - $(COMMON_LIBS) \ @CORBA_LIBS@ # SALOME_ModuleCatalog_Client @@ -112,5 +112,4 @@ SALOME_ModuleCatalog_Client_CPPFLAGS =\ SALOME_ModuleCatalog_Client_LDADD =\ libSalomeCatalog.la \ - $(COMMON_LIBS) \ @CORBA_LIBS@ diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog.hxx new file mode 100755 index 000000000..75d05ccb8 --- /dev/null +++ b/src/ModuleCatalog/SALOME_ModuleCatalog.hxx @@ -0,0 +1,48 @@ +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_ModuleCatalog.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOME_ModuleCatalog_HXX_ +#define _SALOME_ModuleCatalog_HXX_ + +#ifdef WNT + #if defined MODULECATALOG_EXPORTS + #if defined WIN32 + #define MODULECATALOG_EXPORT __declspec( dllexport ) + #else + #define MODULECATALOG_EXPORT + #endif + #else + #if defined WIN32 + #define MODULECATALOG_EXPORT __declspec( dllimport ) + #else + #define MODULECATALOG_EXPORT + #endif + #endif +#else + #define MODULECATALOG_EXPORT +#endif + +#endif + diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx index 7e4409a5a..3208d6e89 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"); @@ -413,13 +413,22 @@ CORBA::Boolean SALOME_ModuleCatalog_AcomponentImpl::multistudy() //---------------------------------------------------------------------- // Function : implementation type -// Purpose : define if a component is implemented in C++ or Python +// Purpose : return the implementation type : C++ (dyn lib), Python (module) or executable //---------------------------------------------------------------------- -CORBA::Boolean SALOME_ModuleCatalog_AcomponentImpl::implementation_type() +SALOME_ModuleCatalog::ImplType SALOME_ModuleCatalog_AcomponentImpl::implementation_type() { return _Component.implementationType ; } +//---------------------------------------------------------------------- +// Function : implementation name +// Purpose : return the implementation name to exec if the default one is not convenient +//---------------------------------------------------------------------- +char* SALOME_ModuleCatalog_AcomponentImpl::implementation_name() +{ + return _Component.implname ; +} + //---------------------------------------------------------------------- // Function : component_type // Purpose : define the type of the component diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx index 879ea5df5..e693d70f4 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.hxx @@ -29,31 +29,18 @@ #ifndef ACOMPONENT_IMPL_H #define ACOMPONENT_IMPL_H +#include + #include "SALOME_ModuleCatalog_Parser.hxx" #include #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) -#if defined MODULECATALOG_EXPORTS -#if defined WIN32 -#define MODULECATALOG_EXPORT __declspec( dllexport ) -#else -#define MODULECATALOG_EXPORT -#endif -#else -#if defined WNT -#define MODULECATALOG_EXPORT __declspec( dllimport ) -#else -#define MODULECATALOG_EXPORT -#endif -#endif - -class MODULECATALOG_EXPORT SALOME_ModuleCatalog_AcomponentImpl: public POA_SALOME_ModuleCatalog::Acomponent, - public PortableServer::RefCountServantBase +class MODULECATALOG_EXPORT SALOME_ModuleCatalog_AcomponentImpl: public POA_SALOME_ModuleCatalog::Acomponent { public: //! standard constructor - SALOME_ModuleCatalog_AcomponentImpl(SALOME_ModuleCatalog::Component &C); + SALOME_ModuleCatalog_AcomponentImpl(SALOME_ModuleCatalog::ComponentDef &C); //! standard destructor virtual ~SALOME_ModuleCatalog_AcomponentImpl(); @@ -148,15 +135,21 @@ public: */ virtual char* component_icone(); - //! method to define if a component is implemented in C++ or Python + //! method to define if a component is implemented in a dyn lib a python module or an executable + /*! + \return an enum SO or PY or EXE + */ + virtual SALOME_ModuleCatalog::ImplType implementation_type(); + + //! method to obtain the implementation name of the component if the default one is not convenient /*! - \return true if it's a C++ component + \return the implementation name to exec */ - virtual CORBA::Boolean implementation_type(); + virtual char* implementation_name(); 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 82f1710b8..bf3e99952 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"; @@ -61,6 +68,7 @@ SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler() test_component_multistudy = "component-multistudy"; test_component_icon = "component-icone" ; test_component_impltype = "component-impltype"; + test_component_implname = "component-implname"; test_component_version = "component-version"; test_component_comment = "component-comment"; @@ -99,6 +107,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 +123,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 +143,648 @@ 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); - if(MYDEBUG) SCRUTE(grandparent); - 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); - - // 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); - if(MYDEBUG) SCRUTE(test_outDataStreamParameter_list); - 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 = (const char*)chars ; - 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 = aContent; + + // Tag test_component_implname + if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_implname) ) + _aModule.implementationName = aContent; + + // 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 62610ee44..50758d6a6 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx @@ -29,169 +29,112 @@ #ifndef SALOME_CATALOG_HANDLER_H #define SALOME_CATALOG_HANDLER_H +#include + #include "SALOME_ModuleCatalog_Parser.hxx" -#include + #include #include #include -#if defined MODULECATALOG_EXPORTS -#if defined WIN32 -#define MODULECATALOG_EXPORT __declspec( dllexport ) -#else -#define MODULECATALOG_EXPORT -#endif -#else -#if defined WNT -#define MODULECATALOG_EXPORT __declspec( dllimport ) -#else -#define MODULECATALOG_EXPORT -#endif -#endif +#include -class MODULECATALOG_EXPORT SALOME_ModuleCatalog_Handler : public QXmlDefaultHandler +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_implname; + 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..4a330bf9d 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 @@ -95,23 +96,43 @@ struct ParserComponent std::string constraint; ParserInterfaces interfaces; ParserPathPrefixes prefixes; - bool implementationType; + std::string implementationType; + std::string implementationName; std::string version; std::string comment; }; 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 ea84cc81e..5e3760e22 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" @@ -43,7 +41,34 @@ static int MYDEBUG = 1; static int MYDEBUG = 1; #endif -static const char* SEPARATOR = ":"; +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 @@ -71,20 +96,7 @@ SALOME_ModuleCatalogImpl::SALOME_ModuleCatalogImpl(int argc, char** argv, CORBA: ComponentTypeConvert[OTHER] = SALOME_ModuleCatalog::OTHER; - // Conversion rules for datastream parameters type and dependency - DataStreamTypeConvert["UNKNOWN"] - = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN; - DataStreamTypeConvert["INTEGER"] - = SALOME_ModuleCatalog::DATASTREAM_INTEGER; - DataStreamTypeConvert["FLOAT"] - = SALOME_ModuleCatalog::DATASTREAM_FLOAT; - DataStreamTypeConvert["DOUBLE"] - = SALOME_ModuleCatalog::DATASTREAM_DOUBLE; - DataStreamTypeConvert["STRING"] - = SALOME_ModuleCatalog::DATASTREAM_STRING; - DataStreamTypeConvert["BOOLEAN"] - = SALOME_ModuleCatalog::DATASTREAM_BOOLEAN; - + // Conversion rules for datastream parameters dependency DataStreamDepConvert["UNDEFINED"] = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED; DataStreamDepConvert["T"] @@ -104,40 +116,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 - = QStringList::split( SEPARATOR, _general_path, - false ); // skip empty entries - - for ( int i = 0; i < dirList.count(); i++ ) { - QFileInfo fileInfo( dirList[ i ] ); - if ( fileInfo.isFile() && fileInfo.exists() ) { - _parse_xml_file(fileInfo.filePath(), - _general_module_list, - _general_path_list); - } + + list dirList; + +#ifdef WNT + dirList = splitStringToList(_general_path, SEPARATOR); +#else + //check for new format + bool isNew = (std::string( _general_path ).find(SEPARATOR) != string::npos); + if ( isNew ) { + //using new format + dirList = splitStringToList(_general_path, SEPARATOR); + } else { + //support old format + dirList = splitStringToList(_general_path, OLD_SEPARATOR); } - +#endif + + 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)){ @@ -163,6 +197,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 @@ -402,7 +506,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++; } @@ -468,7 +572,7 @@ SALOME_ModuleCatalogImpl::GetComponent(const char* name) std::string s(name); ParserComponent *C_parser = NULL; - ParserPathPrefixes *pp = NULL; + //ParserPathPrefixes *pp = NULL; SALOME_ModuleCatalog::Acomponent_ptr compo = SALOME_ModuleCatalog::Acomponent::_nil(); @@ -477,7 +581,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); @@ -496,7 +600,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); @@ -505,8 +609,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; } @@ -514,6 +618,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) { @@ -553,22 +667,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); - - QXmlInputSource source(xmlFile); + //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); - 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 "<::const_iterator it_type; - std::map < std::string, SALOME_ModuleCatalog::DataStreamDependency >::const_iterator it_dep; // duplicate parameter name P_corba.Parametername = CORBA::string_dup(P_parser.name.c_str()); - // doesn't work ??? - // it_type = DataStreamTypeConvert.find(P_parser.type); - // P_corba.Parametertype - // = (it_type == DataStreamTypeConvert.end()) - // ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN; - - if(MYDEBUG) SCRUTE(P_parser.type); - P_corba.Parametertype = SALOME_ModuleCatalog::DATASTREAM_UNKNOWN; - for (it_type = DataStreamTypeConvert.begin(); - it_type != DataStreamTypeConvert.end(); - it_type++) - if (P_parser.type.compare(it_type->first) == 0) { - P_corba.Parametertype = it_type->second; - break; - } - if(MYDEBUG) SCRUTE(P_corba.Parametertype); - // duplicate parameter type // doesn't work ??? @@ -769,6 +886,10 @@ void SALOME_ModuleCatalogImpl::duplicate // P_corba.Parametertype // = (it_type == DataStreamTypeConvert.end()) // ? it_type->second : SALOME_ModuleCatalog::DATASTREAM_UNKNOWN; + + P_corba.Parametertype = CORBA::string_dup(P_parser.type.c_str()); + + // duplicate parameter dependency if(MYDEBUG) SCRUTE(P_parser.dependency); P_corba.Parameterdependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED; @@ -879,5 +1000,3 @@ SALOME_ModuleCatalogImpl::_parseArguments(int argc, char **argv, } return _return_value; } - - diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx index d09e02da6..40650ac9f 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.hxx @@ -30,6 +30,8 @@ #ifndef MODULECATALOG_IMPL_H #define MODULECATALOG_IMPL_H +#include + #include #include @@ -38,23 +40,7 @@ #include #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) - -#if defined MODULECATALOG_EXPORTS -#if defined WIN32 -#define MODULECATALOG_EXPORT __declspec( dllexport ) -#else -#define MODULECATALOG_EXPORT -#endif -#else -#if defined WNT -#define MODULECATALOG_EXPORT __declspec( dllimport ) -#else -#define MODULECATALOG_EXPORT -#endif -#endif - -class MODULECATALOG_EXPORT SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog, - public PortableServer::RefCountServantBase +class MODULECATALOG_EXPORT SALOME_ModuleCatalogImpl: public POA_SALOME_ModuleCatalog::ModuleCatalog { public: //! standard constructor @@ -69,6 +55,12 @@ public: */ virtual SALOME_ModuleCatalog::ListOfComputers* GetComputerList(); + //! method to get the list of all types of the catalog + /*! + * \return the types list + */ + virtual SALOME_ModuleCatalog::ListOfTypeDefinition* GetTypes(); + //! method to get the PathPrefix of a computer /*! If the wanted computer doesn't exist, the Notfound exception is thrown \param machinename const char* arguments @@ -114,12 +106,14 @@ public: \param componentname const char* arguments \return the wanted component description */ - virtual SALOME_ModuleCatalog::Component * + virtual SALOME_ModuleCatalog::ComponentDef * GetComponentInfo(const char *name); void ping(){}; + CORBA::Long getPID(); + void ShutdownWithExit(); - void shutdown() { if (_orb) _orb->shutdown(1); }; + void shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }; private: //! method to parse one module catalog @@ -127,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 /*! @@ -144,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 @@ -213,14 +210,13 @@ 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 ; ParserPathPrefixes _personal_path_list ; - std::map - DataStreamTypeConvert; - std::map DataStreamDepConvert; diff --git a/src/ModuleCatalog/TestModuleCatalog.py b/src/ModuleCatalog/TestModuleCatalog.py new file mode 100755 index 000000000..9f9245b0b --- /dev/null +++ b/src/ModuleCatalog/TestModuleCatalog.py @@ -0,0 +1,82 @@ +# 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 +# +import batchmode_salome +import SALOME_ModuleCatalog + +print +print "======================================================================" +print " XML Catalog file generation from idl file" +print "======================================================================" + +import os +os.system('runIDLparser -Wbcatalog=x \ + ${KERNEL_ROOT_DIR}/idl/salome/SALOME_TestModuleCatalog.idl') + +print "======================================================================" +print " Get Catalog " +print "======================================================================" +obj = batchmode_salome.naming_service.Resolve('Kernel/ModulCatalog') +catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog) +catalog.GetComponentList() + +print +print "======================================================================" +print " Import xml file " +print "======================================================================" +catalog.ImportXmlCatalogFile("x.xml") + +name = "AddComponent" +print +print "======================================================================" +print " Dump component <", name, "> " +print "======================================================================" +C = catalog.GetComponent(name) + +print "name : ", C._get_componentname() +print "username : ", C._get_componentusername() +print "type : ", C._get_component_type() +print "constraint : ", C._get_constraint() +print "icon : ", C._get_component_icone() + +for iL in C.GetInterfaceList(): + I = C.GetInterface(iL) + print "interface : ", I.interfacename + for S in I.interfaceservicelist: + print " service : ", S.ServiceName + print " ", len(S.ServiceinParameter), "in params : " + for iP in S.ServiceinParameter: + print ' ' + iP.Parametername + '(' + iP.Parametertype + ')' + pass + print " ", len(S.ServiceoutParameter), "out params : " + for iP in S.ServiceoutParameter: + print ' ' + iP.Parametername + '(' + iP.Parametertype + ')' + pass + print " ", len(S.ServiceinDataStreamParameter), "in datastream params : " + for iP in S.ServiceinDataStreamParameter: + print ' ' + iP.Parametername + '(' + str(iP.Parametertype) + ', ' + \ + str(iP.Parameterdependency) + ')' + pass + print " ", len(S.ServiceoutDataStreamParameter), "out datastream params : " + for iP in S.ServiceoutDataStreamParameter: + print ' ' + iP.Parametername + '(' + str(iP.Parametertype) + ', ' + \ + str(iP.Parameterdependency) + ')' + pass + pass + pass + diff --git a/src/ModuleGenerator/IDLparser.py b/src/ModuleGenerator/IDLparser.py index 96ccd6c37..0b74eb3af 100644 --- a/src/ModuleGenerator/IDLparser.py +++ b/src/ModuleGenerator/IDLparser.py @@ -430,6 +430,7 @@ class Component(Tree): self.addNamedChild('component-version', common_data["VERSION"]) self.addNamedChild('component-comment', 'unknown') self.addNamedChild('component-multistudy', common_data["COMP_MULT"]) + self.addNamedChild('component-impltype', common_data["COMP_IMPL"]) self.addNamedChild('component-icone', common_data["ICON"]) self.addNamedChild('constraint') self.addNamedChild('component-interface-list') @@ -447,7 +448,7 @@ class Component(Tree): for i in ['component-username', 'component-author', 'component-type', 'component-icone', 'component-version', - 'component-multistudy', 'constraint']: + 'component-multistudy', 'component-impltype', 'constraint']: ext = C.getChild(i) int = self.getChild(i) if int is None: @@ -733,7 +734,7 @@ def run(tree, args): if __name__ == "__main__": print - print "Usage : omniidl -bIDLparser [-I]* -Wbcatalog=[,icon=][,version=][,author=][,name=][,username=][,multistudy=] " + print "Usage : omniidl -bIDLparser [-I]* -Wbcatalog=[,icon=][,version=][,author=][,name=][,username=][,multistudy=][,impltype=] " print diff --git a/src/NOTIFICATION_SWIG/Makefile.am b/src/NOTIFICATION_SWIG/Makefile.am index beb83ffe4..e043680f4 100644 --- a/src/NOTIFICATION_SWIG/Makefile.am +++ b/src/NOTIFICATION_SWIG/Makefile.am @@ -40,21 +40,23 @@ BUILT_SOURCES = swig_wrap.cpp SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../Notification SWIG_SOURCES = NOTIFICATION.i -pkgpython_PYTHON = libNOTIFICATION.py -pkgpyexec_LTLIBRARIES = _libNOTIFICATION.la +salomepython_PYTHON = libNOTIFICATION.py +salomepyexec_LTLIBRARIES = _libNOTIFICATION.la _libNOTIFICATION_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES) \ - NOTIFICATION_Swig.cxx NOTIFICATION_Swig.hxx + NOTIFICATION_Swig.cxx NOTIFICATION_Swig.hxx SALOME_NOTIFICATION_SWIG.hxx _libNOTIFICATION_la_CPPFLAGS =\ @PYTHON_INCLUDES@ -DHAVE_CONFIG_H \ -I$(srcdir)/../Notification \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ + -I$(top_builddir)/salome_adm/unix \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ _libNOTIFICATION_la_LDFLAGS = -module -_libNOTIFICATION_la_LIBADD = ../Notification/libSalomeNotification.la \ - @PYTHON_LIBS@ +_libNOTIFICATION_la_LIBADD = ../Notification/libSalomeNotification.la + +# @PYTHON_LIBS@ swig_wrap.cpp : $(SWIG_SOURCES) $(SWIG) $(SWIG_FLAGS) -o $@ $< diff --git a/src/NOTIFICATION_SWIG/NOTIFICATION.i b/src/NOTIFICATION_SWIG/NOTIFICATION.i index 2bf44afec..ccd684c2f 100644 --- a/src/NOTIFICATION_SWIG/NOTIFICATION.i +++ b/src/NOTIFICATION_SWIG/NOTIFICATION.i @@ -27,9 +27,13 @@ %module libNOTIFICATION + %{ +//#define __declspec(a) #include "NOTIFICATION_Swig.hxx" %} +%include SALOME_NOTIFICATION.hxx +%include SALOME_NOTIFICATION_SWIG.hxx %include NOTIFICATION.hxx %include NOTIFICATION_Swig.hxx diff --git a/src/NOTIFICATION_SWIG/NOTIFICATION_Swig.hxx b/src/NOTIFICATION_SWIG/NOTIFICATION_Swig.hxx index 0665096bb..d04db4f06 100644 --- a/src/NOTIFICATION_SWIG/NOTIFICATION_Swig.hxx +++ b/src/NOTIFICATION_SWIG/NOTIFICATION_Swig.hxx @@ -25,9 +25,13 @@ // Author : Francis KLOSS // Module : SALOME +#ifndef _NOTIFICATION_SWIG_HXX_ +#define _NOTIFICATION_SWIG_HXX_ + #include "NOTIFICATION.hxx" +#include "SALOME_NOTIFICATION_SWIG.hxx" -class NOTIFICATION_Supplier_Swig { +class NOTIFICATION_SWIG_EXPORT NOTIFICATION_Supplier_Swig { public: NOTIFICATION_Supplier_Swig(const char* instanceName, bool notif); ~NOTIFICATION_Supplier_Swig(); @@ -37,7 +41,7 @@ class NOTIFICATION_Supplier_Swig { NOTIFICATION_Supplier* _supplier; }; -class NOTIFICATION_Consumer_Swig { +class NOTIFICATION_SWIG_EXPORT NOTIFICATION_Consumer_Swig { public: NOTIFICATION_Consumer_Swig(); ~NOTIFICATION_Consumer_Swig(); @@ -46,3 +50,5 @@ class NOTIFICATION_Consumer_Swig { private: NOTIFICATION_Consumer* _consumer; }; + +#endif diff --git a/src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx b/src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx new file mode 100755 index 000000000..33d751c91 --- /dev/null +++ b/src/NOTIFICATION_SWIG/SALOME_NOTIFICATION_SWIG.hxx @@ -0,0 +1,47 @@ +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_NOTIFICATION_SWIG.hxx +// Author : Oleg UVAROV +// Module : SALOME + +#ifndef _SALOME_NOTIFICATION_SWIG_HXX_ +#define _SALOME_NOTIFICATION_SWIG_HXX_ + +#ifdef WNT + #if defined NOTIFICATION_SWIG_EXPORTS + #if defined WIN32 + #define NOTIFICATION_SWIG_EXPORT __declspec( dllexport ) + #else + #define NOTIFICATION_SWIG_EXPORT + #endif + #else + #if defined WIN32 + #define NOTIFICATION_SWIG_EXPORT __declspec( dllimport ) + #else + #define NOTIFICATION_SWIG_EXPORT + #endif + #endif +#else + #define NOTIFICATION_SWIG_EXPORT +#endif + +#endif diff --git a/src/NamingService/NamingService_WaitForServerReadiness.cxx b/src/NamingService/NamingService_WaitForServerReadiness.cxx index 308e104b0..d4eb2aa7e 100644 --- a/src/NamingService/NamingService_WaitForServerReadiness.cxx +++ b/src/NamingService/NamingService_WaitForServerReadiness.cxx @@ -66,13 +66,13 @@ void NamingService_WaitForServerReadiness(SALOME_NamingService* NS, { if (serverName.length() == 0) { - string dummyadr = NS->getIORaddr(); // to wait for naming service + CORBA::String_var dummyadr = NS->getIORaddr(); // to wait for naming service found = 1; break; // naming service found } else { - CORBA::Object_ptr obj = NS->Resolve(serverName.c_str()); + CORBA::Object_var obj = NS->Resolve(serverName.c_str()); if (! CORBA::is_nil(obj)) { found =1; @@ -80,9 +80,9 @@ void NamingService_WaitForServerReadiness(SALOME_NamingService* NS, } MESSAGE("Server "<< serverName <<" not yet ready, waiting..."); #ifndef WNT - int a = nanosleep(&ts_req,&ts_rem); // wait before retry + nanosleep(&ts_req,&ts_rem); // wait before retry #else - Sleep(TIMESleep/1000000); + Sleep(TIMESleep/1000000); #endif } } @@ -90,9 +90,9 @@ void NamingService_WaitForServerReadiness(SALOME_NamingService* NS, { MESSAGE("CORBA::COMM_FAILURE: Naming Service not yet ready, waiting..."); #ifndef WNT - int a = nanosleep(&ts_req,&ts_rem); // wait before retry + nanosleep(&ts_req,&ts_rem); // wait before retry #else - Sleep(TIMESleep/1000000); + Sleep(TIMESleep/1000000); #endif } } diff --git a/src/NamingService/NamingService_WaitForServerReadiness.hxx b/src/NamingService/NamingService_WaitForServerReadiness.hxx index a4156b7ce..a941fd245 100644 --- a/src/NamingService/NamingService_WaitForServerReadiness.hxx +++ b/src/NamingService/NamingService_WaitForServerReadiness.hxx @@ -27,15 +27,11 @@ #ifndef _NAMINGSERVICE_WAITFORSERVERREADINESS_HXX_ #define _NAMINGSERVICE_WAITFORSERVERREADINESS_HXX_ -#include #include "SALOME_NamingService.hxx" -#ifdef WNT -#include -#else -#define SALOME_WNT_EXPORT -#endif -void SALOME_WNT_EXPORT NamingService_WaitForServerReadiness(SALOME_NamingService* NS, +#include + +void NAMINGSERVICE_EXPORT NamingService_WaitForServerReadiness(SALOME_NamingService* NS, std::string serverName); #endif diff --git a/src/NamingService/SALOME_NamingService.cxx b/src/NamingService/SALOME_NamingService.cxx index a7768ec2a..965982293 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(); } + } } // ============================================================================ @@ -368,7 +346,7 @@ CORBA::Object_ptr SALOME_NamingService::Resolve(const char* Path) ASSERT(!CORBA::is_nil(_current_context)); - CORBA::Object_ptr obj = CORBA::Object::_nil(); + CORBA::Object_var obj = CORBA::Object::_nil(); try { @@ -380,7 +358,7 @@ CORBA::Object_ptr SALOME_NamingService::Resolve(const char* Path) CosNaming::Name n = ex.rest_of_name; if (ex.why == CosNaming::NamingContext::missing_node) - INFOS("Resolve() : " << (char *) n[0].id + MESSAGE("Resolve() : " << (char *) n[0].id << " (" << (char *) n[0].kind << ") not found"); if (ex.why == CosNaming::NamingContext::not_context) @@ -411,7 +389,7 @@ CORBA::Object_ptr SALOME_NamingService::Resolve(const char* Path) throw ServiceUnreachable(); } - return obj; + return obj._retn(); } // ============================================================================ @@ -449,7 +427,7 @@ CORBA::Object_ptr SALOME_NamingService::ResolveFirst(const char* Path) } // SCRUTE(name); - CORBA::Object_ptr obj = CORBA::Object::_nil(); + CORBA::Object_var obj = CORBA::Object::_nil(); bool isOk = false; if (basePath.empty()) @@ -475,7 +453,7 @@ CORBA::Object_ptr SALOME_NamingService::ResolveFirst(const char* Path) } } - return obj; + return obj._retn(); } // ============================================================================ @@ -486,9 +464,9 @@ CORBA::Object_ptr SALOME_NamingService::ResolveFirst(const char* Path) * number of processors. * If the NamingService is out, the exception ServiceUnreachable is thrown. * \param hostname name of the machine on which the component is searched. - * \param containername name of the container in which the component is + * \param containerName name of the container in which the component is instanciated. - * \param componentname name of the component we are looking for an existing + * \param componentName name of the component we are looking for an existing instance. * \param nbproc in case of multi processor machine, container name is * suffixed with _nbproc. @@ -639,9 +617,8 @@ SALOME_NamingService::ContainerName(const Engines::MachineParameters& params) * Build a string representing the absolute pathname of a container in * SALOME_NamingService. This form gives a suffixed containerName in case of * multi processor machine. - * \param params struct from which we get container name (may be - * empty), number of nodes and number of processor - * per node. + * \param containerName name of the container in which the component is + instanciated. * \param hostname name of the host of the container, without domain names. * \return the path under the form /Containers/hostname/containerName * \sa ContainerName(const Engines::MachineParameters& params) @@ -847,7 +824,7 @@ throw(ServiceUnreachable) CosNaming::Name n = ex.rest_of_name; if (ex.why == CosNaming::NamingContext::missing_node) - INFOS( "Change_Directory() : " << (char *) n[0].id + MESSAGE( "Change_Directory() : " << (char *) n[0].id << " (" << (char *) n[0].kind << ") not found"); if (ex.why == CosNaming::NamingContext::not_context) INFOS("Change_Directory() : " << (char *) n[0].id @@ -1034,7 +1011,9 @@ throw(ServiceUnreachable) if (binding->binding_type == CosNaming::nobject) { - dirList.push_back(CORBA::string_dup(bindingName[0].id)); + // remove memory leak + // dirList.push_back(CORBA::string_dup(bindingName[0].id)); + dirList.push_back(string(bindingName[0].id)); } } @@ -1086,7 +1065,7 @@ throw(ServiceUnreachable) if (binding->binding_type == CosNaming::ncontext) { - dirList.push_back(CORBA::string_dup(bindingName[0].id)); + dirList.push_back(bindingName[0].id.in()); } } @@ -1118,10 +1097,12 @@ throw(ServiceUnreachable) vector dirList ; - string currentDir = Current_Directory(); + char* currentDir = Current_Directory(); _list_directory_recurs(dirList, "", currentDir); + free(currentDir); + return dirList; } @@ -1672,7 +1653,7 @@ void SALOME_NamingService::_Find(const char* name, * \param splitPath * \param lengthResult * \param contextToFind - * \param _notFound + * \param notFound */ // ============================================================================ @@ -1707,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/ServiceUnreachable.hxx b/src/NamingService/ServiceUnreachable.hxx index 3e55e2aa4..496f376fe 100644 --- a/src/NamingService/ServiceUnreachable.hxx +++ b/src/NamingService/ServiceUnreachable.hxx @@ -29,10 +29,8 @@ #if !defined ( SERVICEUNREACHABLE_H ) #define SERVICEUNREACHABLE_H -#include "Utils_SALOME_Exception.hxx" - #if defined NAMINGSERVICE_EXPORTS -#if defined WIN32 +#if defined WNT #define NAMINGSERVICE_EXPORT __declspec( dllexport ) #else #define NAMINGSERVICE_EXPORT @@ -45,6 +43,8 @@ #endif #endif +#include "Utils_SALOME_Exception.hxx" + //! exception class for NamingService : ServiceUnreachable class NAMINGSERVICE_EXPORT ServiceUnreachable : public SALOME_Exception diff --git a/src/NamingService/Test/NamingServiceTest.cxx b/src/NamingService/Test/NamingServiceTest.cxx index 441f4fff0..2a9e1fca2 100644 --- a/src/NamingService/Test/NamingServiceTest.cxx +++ b/src/NamingService/Test/NamingServiceTest.cxx @@ -89,6 +89,7 @@ NSTEST::echo_ptr NSTEST_aFactory_i::createInstance() NSTEST_echo_i * anEcho = new NSTEST_echo_i(_num); _num++; NSTEST::echo_var anEchoRef = anEcho->_this(); + anEcho->_remove_ref(); return anEchoRef._retn(); } @@ -149,6 +150,7 @@ NamingServiceTest::setUp() _myFactoryId = _root_poa->activate_object(_myFactory); _factoryRef = _myFactory->_this(); _pman->activate(); + _myFactory->_remove_ref(); } @@ -180,7 +182,7 @@ NamingServiceTest::testConstructorDefault() //CPPUNIT_ASSERT_THROW(NS.getIORaddr(),CORBA::Exception); NS.init_orb(_orb); - char *root = NS.getIORaddr(); + CORBA::String_var root = NS.getIORaddr(); CORBA::Object_var obj = _orb->string_to_object(root); CPPUNIT_ASSERT(!CORBA::is_nil(obj)); @@ -199,7 +201,7 @@ void NamingServiceTest::testConstructorOrb() { SALOME_NamingService NS(_orb); - char *root = NS.getIORaddr(); + CORBA::String_var root = NS.getIORaddr(); CORBA::Object_var obj = _orb->string_to_object(root); CPPUNIT_ASSERT(!CORBA::is_nil(obj)); @@ -1027,7 +1029,9 @@ NamingServiceTest::testCurrentDirectory() CPPUNIT_ASSERT(ret); _NS.Change_Directory(path.c_str()); - string curdir = _NS.Current_Directory(); + char* acurdir = _NS.Current_Directory(); + string curdir = acurdir; + free(acurdir); CPPUNIT_ASSERT(curdir == path); } @@ -1202,7 +1206,7 @@ NamingServiceTest::testDestroyFullDirectory() void NamingServiceTest::testGetIorAddr() { - char *root = _NS.getIORaddr(); + CORBA::String_var root = _NS.getIORaddr(); CORBA::Object_var obj = _orb->string_to_object(root); CPPUNIT_ASSERT(!CORBA::is_nil(obj)); } diff --git a/src/NamingService/Test/NamingServiceTest.hxx b/src/NamingService/Test/NamingServiceTest.hxx index d41ddcae3..b471a9449 100644 --- a/src/NamingService/Test/NamingServiceTest.hxx +++ b/src/NamingService/Test/NamingServiceTest.hxx @@ -28,7 +28,7 @@ #include CORBA_SERVER_HEADER(nstest) class NSTEST_echo_i : public virtual POA_NSTEST::echo, - public virtual PortableServer::RefCountServantBase + public virtual PortableServer::ServantBase { public: NSTEST_echo_i(); @@ -40,7 +40,7 @@ private: }; class NSTEST_aFactory_i : public virtual POA_NSTEST::aFactory, - public virtual PortableServer::RefCountServantBase + public virtual PortableServer::ServantBase { public: NSTEST_aFactory_i(); diff --git a/src/NamingService/Test/TestNamingService.py b/src/NamingService/Test/TestNamingService.py index 2bc32efe9..5c3a8e712 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...) @@ -46,6 +47,8 @@ clt.waitLogger("Logger") # execute Unit Test command = ['TestNamingService'] +valgrind = ['valgrind','--leak-check=full'] +#command=valgrind+command #to check memory leaks ret = os.spawnvp(os.P_WAIT, command[0], command) # kill Test process diff --git a/src/Notification/CosNotifyShorthands.h b/src/Notification/CosNotifyShorthands.h index 2cb2d3010..271a3776f 100644 --- a/src/Notification/CosNotifyShorthands.h +++ b/src/Notification/CosNotifyShorthands.h @@ -27,6 +27,8 @@ #ifndef _COS_NOTIFY_H_ #define _COS_NOTIFY_H_ +#include + #ifndef COS_USES_BOA #include #include diff --git a/src/Notification/Makefile.am b/src/Notification/Makefile.am index b5b5bbb52..1259fbd1c 100644 --- a/src/Notification/Makefile.am +++ b/src/Notification/Makefile.am @@ -38,7 +38,8 @@ salomeinclude_HEADERS = \ NOTIFICATION.hxx \ NOTIFICATION_Supplier.hxx \ NOTIFICATION_Consumer.hxx \ - CosNotifyShorthands.h + CosNotifyShorthands.h \ + SALOME_NOTIFICATION.hxx # # =============================================================== @@ -56,6 +57,7 @@ libSalomeNotification_la_CPPFLAGS =\ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Utils \ + -I$(top_builddir)/salome_adm/unix \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/Notification/NOTIFICATION.hxx b/src/Notification/NOTIFICATION.hxx index d381a4263..04da6bfdf 100644 --- a/src/Notification/NOTIFICATION.hxx +++ b/src/Notification/NOTIFICATION.hxx @@ -28,6 +28,8 @@ #ifndef NOTIFICATION_HXX #define NOTIFICATION_HXX +#include + #define NOTIF_WARNING "Warning" #define NOTIF_STEP "Step" #define NOTIF_TRACE "Trace" @@ -43,21 +45,6 @@ #include "NOTIFICATION_Supplier.hxx" #include "NOTIFICATION_Consumer.hxx" - -#if defined NOTIFICATION_EXPORTS -#if defined WIN32 -#define NOTIFICATION_EXPORT __declspec( dllexport ) -#else -#define NOTIFICATION_EXPORT -#endif -#else -#if defined WNT -#define NOTIFICATION_EXPORT __declspec( dllimport ) -#else -#define NOTIFICATION_EXPORT -#endif -#endif - NOTIFICATION_EXPORT char* NOTIFICATION_date(); NOTIFICATION_EXPORT CosNA_EventChannel_ptr NOTIFICATION_channel(); diff --git a/src/Notification/NOTIFICATION_Consumer.cxx b/src/Notification/NOTIFICATION_Consumer.cxx index c088ee9be..879f69558 100644 --- a/src/Notification/NOTIFICATION_Consumer.cxx +++ b/src/Notification/NOTIFICATION_Consumer.cxx @@ -93,14 +93,15 @@ bool NOTIFICATION_Consumer::Receive(char** graph, char** node, char** type, char }; if (status) { - char* Asender; - char* Agraph; - char* Atype; - CORBA::ULong Acounter; - CORBA::ULong Astamp; - char* Adate; - char* Anode; - char* Amessage; + //omniORB 4.1.x requiries using only CORBA types instead C types + const char* Asender; + const char* Agraph; + const char* Atype; + CORBA::ULong Acounter; + CORBA::ULong Astamp; + const char* Adate; + const char* Anode; + const char* Amessage; event->filterable_data[0].value >>= Asender; event->filterable_data[1].value >>= Agraph; event->filterable_data[2].value >>= Atype; diff --git a/src/Notification/NOTIFICATION_Consumer.hxx b/src/Notification/NOTIFICATION_Consumer.hxx index 41ac4f496..db5e04ccf 100644 --- a/src/Notification/NOTIFICATION_Consumer.hxx +++ b/src/Notification/NOTIFICATION_Consumer.hxx @@ -28,19 +28,7 @@ #ifndef NOTIFICATION_Consumer_HXX #define NOTIFICATION_Consumer_HXX -#if defined NOTIFICATION_EXPORTS -#if defined WIN32 -#define NOTIFICATION_EXPORT __declspec( dllexport ) -#else -#define NOTIFICATION_EXPORT -#endif -#else -#if defined WNT -#define NOTIFICATION_EXPORT __declspec( dllimport ) -#else -#define NOTIFICATION_EXPORT -#endif -#endif +#include class NOTIFICATION_EXPORT NOTIFICATION_Consumer: public POA_CosNotifyComm::StructuredPullConsumer { public: diff --git a/src/Notification/NOTIFICATION_Supplier.hxx b/src/Notification/NOTIFICATION_Supplier.hxx index 301d807b3..058a70cde 100644 --- a/src/Notification/NOTIFICATION_Supplier.hxx +++ b/src/Notification/NOTIFICATION_Supplier.hxx @@ -28,19 +28,7 @@ #ifndef NOTIFICATION_Supplier_HXX #define NOTIFICATION_Supplier_HXX -#if defined NOTIFICATION_EXPORTS -#if defined WIN32 -#define NOTIFICATION_EXPORT __declspec( dllexport ) -#else -#define NOTIFICATION_EXPORT -#endif -#else -#if defined WNT -#define NOTIFICATION_EXPORT __declspec( dllimport ) -#else -#define NOTIFICATION_EXPORT -#endif -#endif +#include class NOTIFICATION_EXPORT NOTIFICATION_Supplier: public POA_CosNotifyComm::StructuredPushSupplier { public: diff --git a/src/Notification/SALOME_NOTIFICATION.hxx b/src/Notification/SALOME_NOTIFICATION.hxx new file mode 100755 index 000000000..c187b4119 --- /dev/null +++ b/src/Notification/SALOME_NOTIFICATION.hxx @@ -0,0 +1,47 @@ +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_NOTIFICATION.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOME_NOTIFICATION_HXX_ +#define _SALOME_NOTIFICATION_HXX_ + +#ifdef WNT + #if defined NOTIFICATION_EXPORTS + #if defined WIN32 + #define NOTIFICATION_EXPORT __declspec( dllexport ) + #else + #define NOTIFICATION_EXPORT + #endif + #else + #if defined WIN32 + #define NOTIFICATION_EXPORT __declspec( dllimport ) + #else + #define NOTIFICATION_EXPORT + #endif + #endif +#else + #define NOTIFICATION_EXPORT +#endif + +#endif diff --git a/src/ParallelContainer/Makefile.am b/src/ParallelContainer/Makefile.am new file mode 100644 index 000000000..18ff73d7f --- /dev/null +++ b/src/ParallelContainer/Makefile.am @@ -0,0 +1,131 @@ +# 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) +# Module : KERNEL +# + +include $(top_srcdir)/salome_adm/unix/make_common_starter.am + +# +# =============================================================== +# Header to be installed +# =============================================================== +# +# header files +salomeinclude_HEADERS = SALOME_ParallelComponent_i.hxx \ + SALOME_ParallelContainer_i.hxx \ + SALOME_ParallelContainerProxy_i.hxx \ + Parallel_Salome_file_i.hxx + +# +# =============================================================== +# Local definitions +# =============================================================== +# + +# This local variable defines the list of CPPFLAGS common to all target in this package. +COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \ + -I$(top_srcdir)/src/Notification \ + -I$(top_srcdir)/src/SALOMELocalTrace \ + -I$(top_srcdir)/src/Basics \ + -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 \ + @CORBA_CXXFLAGS@ \ + @CORBA_INCLUDES@ \ + @PACO_INCLUDES@ + +# 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@ + +# +# =============================================================== +# Libraries targets +# =============================================================== +# +lib_LTLIBRARIES = libSalomeParallelContainer.la + +libSalomeParallelContainer_la_SOURCES = SALOME_ParallelComponent_i.cxx \ + SALOME_ParallelContainer_i.cxx \ + SALOME_ParallelContainerProxy_i.cxx \ + $(top_srcdir)/src/Container/Salome_file_i.cxx \ + Parallel_Salome_file_i.cxx + +libSalomeParallelContainer_la_CXXFLAGS = $(COMMON_CPPFLAGS) + +libSalomeParallelContainer_la_LIBADD = $(COMMON_LIBS) + +libSalomeParallelContainer_la_LDFLAGS = -no-undefined -version-info=0:0:0 + +# +# =============================================================== +# Executables targets +# =============================================================== +# + +if MPI_IS_OK +bin_mpi_programs = SALOME_ParallelContainerProxyMpi \ + SALOME_ParallelContainerNodeMpi +endif + +bin_PROGRAMS = SALOME_ParallelContainerProxyDummy \ + SALOME_ParallelContainerNodeDummy \ + $(bin_mpi_programs) + +SALOME_ParallelContainerProxyDummy_SOURCES = SALOME_ParallelContainerProxyDummy.cxx +SALOME_ParallelContainerProxyDummy_CXXFLAGS = $(COMMON_CPPFLAGS) +SALOME_ParallelContainerProxyDummy_LDADD = libSalomeParallelContainer.la \ + -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 \ + $(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@ \ + $(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@\ + $(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..7c9394863 --- /dev/null +++ b/src/ParallelContainer/Parallel_Salome_file_i.cxx @@ -0,0 +1,361 @@ +// 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, + int rank) : + InterfaceParallel_impl(orb,ior,rank), + Engines::Salome_file_serv(orb,ior,rank), + Engines::fileTransfer_serv(orb,ior,rank), + Engines::Parallel_Salome_file_serv(orb,ior,rank) +{ + 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::InterfaceManager_var interface_manager = + PaCO::InterfaceManager::_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); + delete aBlock; + 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..21384fef9 --- /dev/null +++ b/src/ParallelContainer/Parallel_Salome_file_i.hxx @@ -0,0 +1,76 @@ +// 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, + int rank); + 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 new file mode 100644 index 000000000..fab45e703 --- /dev/null +++ b/src/ParallelContainer/SALOME_ParallelComponent_i.cxx @@ -0,0 +1,1138 @@ +// SALOME_ParallelComponent : implementation of container and engine for Parallel Kernel +// +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// File : SALOME_ParallelComponent_i.cxx +// Author : André RIBES, EDF +// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA + +#include "SALOME_ParallelComponent_i.hxx" +#include "SALOME_ParallelContainer_i.hxx" + +#include "OpUtil.hxx" +#include +#ifndef WNT +#include +#endif +#include +#include "utilities.h" + +#ifndef WNT +#include +#include +#include +#else +#include +int SIGUSR11 = 1000; +#endif + +#include +#include + +using namespace std; + +extern bool _Sleeping ; +static Engines_Parallel_Component_i * theEngines_Component ; + +bool Engines_Parallel_Component_i::_isMultiStudy = true; +bool Engines_Parallel_Component_i::_isMultiInstance = false; + +//============================================================================= +/*! + * Default constructor, not for use + */ +//============================================================================= + +Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, int rank) : + InterfaceParallel_impl(orb,ior,rank), + Engines::Component_serv(orb,ior,rank), + Engines::Parallel_Component_serv(orb,ior,rank) +{ + //ASSERT(0); + INFOS("Default Constructor..."); +} + +//============================================================================= +/*! + * Standard Constructor for generic Component, used in derived class + * Connection to Registry and Notification + * \param orb Object Request broker given by Container + * \parap poa Portable Object Adapter from Container (normally root_poa) + * \param contId container CORBA id inside the server + * \param instanceName unique instance name for this object (see Container_i) + * \param interfaceName component class name + * \param notif use of notification + */ +//============================================================================= + +Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, int rank, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName, + bool notif) : + InterfaceParallel_impl(orb,ior,rank), + Engines::Component_serv(orb,ior,rank), + Engines::Parallel_Component_serv(orb,ior,rank), + _instanceName(instanceName), + _interfaceName(interfaceName), + _myConnexionToRegistry(0), + _ThreadId(0) , + _ThreadCpuUsed(0) , + _Executed(false) , + _graphName("") , + _nodeName(""), + _studyId(-1) +{ + MESSAGE("Component constructor with instanceName "<< _instanceName); + //SCRUTE(pd_refCount); + _orb = CORBA::ORB::_duplicate(orb); + _poa = PortableServer::POA::_duplicate(poa); + _contId = contId ; + CORBA::Object_var o = _poa->id_to_reference(*contId); // container ior... + const CORBA::String_var the_ior = _orb->object_to_string(o); + _myConnexionToRegistry = new RegistryConnexion(0, 0, the_ior,"theSession", + _instanceName.c_str()); + + _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif); + + deploy_mutex = new pthread_mutex_t(); + pthread_mutex_init(deploy_mutex, NULL); + _proxy = NULL; + //SCRUTE(pd_refCount); +} + +//============================================================================= +/*! + * Destructor: call Container for decrement of instances count. + * When instances count falls to 0, the container tries to remove the + * component library (dlclose) + */ +//============================================================================= + +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; +} + +//============================================================================= +/*! + * CORBA method: return name of the instance, unique in this Container + */ +//============================================================================= + +char* Engines_Parallel_Component_i::instanceName() +{ + return CORBA::string_dup(_instanceName.c_str()) ; +} + +//============================================================================= +/*! + * CORBA method: return name of the component class + */ +//============================================================================= + +char* Engines_Parallel_Component_i::interfaceName() +{ + return CORBA::string_dup(_interfaceName.c_str()) ; +} + +//============================================================================= +/*! + * CORBA method: Get study Id + * \return -1: not initialised (Internal Error) + * 0: multistudy component instance + * >0: study id associated to this instance + */ +//============================================================================= + +CORBA::Long Engines_Parallel_Component_i::getStudyId() +{ + return _studyId; +} + +//============================================================================= +/*! + * CORBA method: Test if instance is alive and responds + */ +//============================================================================= + +void Engines_Parallel_Component_i::ping() +{ + // MESSAGE("Engines_Parallel_Component_i::ping_c() pid "<< getpid() << " threadid " << pthread_self()); +} + +//============================================================================= +/*! + * CORBA method: Deactivate this instance. CORBA object is deactivated (do not + * respond any more to CORBA calls), the connection to Regsitry is removed + * (Registry informed of deactivation), internal server reference counter on + * the derived servant class is decremented, to allow destruction of the class + * (delete) by POA, when there are no more references. + * -- TO BE USED BY CONTAINER ONLY (Container housekeeping) -- + */ +//============================================================================= + +void Engines_Parallel_Component_i::destroy() +{ + MESSAGE("Engines_Parallel_Component_i::destroy()"); + //SCRUTE(pd_refCount); + + delete _notifSupplier; + _notifSupplier = 0; + + delete _myConnexionToRegistry; + _myConnexionToRegistry = 0 ; + _poa->deactivate_object(*_id) ; + CORBA::release(_poa) ; + delete(_id) ; + //SCRUTE(pd_refCount); + _thisObj->_remove_ref(); + //SCRUTE(pd_refCount); + MESSAGE("Engines_Parallel_Component_i::destroyed") ; +} + +//============================================================================= +/*! + * CORBA method: return CORBA reference of the Container + * + */ +//============================================================================= + +Engines::Container_ptr Engines_Parallel_Component_i::GetContainerRef() +{ + MESSAGE("Engines_Parallel_Component_i::GetContainerRef"); + CORBA::Object_ptr o = _poa->id_to_reference(*_contId) ; + return Engines::Container::_narrow(o); +} + +//============================================================================= +/*! + * CORBA method: + * Gives a sequence of (key=string,value=any) to the component. + * Base class component stores the sequence in a map. + * The map is cleared before. + * This map is for use by derived classes. + * \param dico sequence of (key=string,value=any) + */ +//============================================================================= + +void Engines_Parallel_Component_i::setProperties(const Engines::FieldsDict& dico) +{ + _fieldsDict.clear(); + for (CORBA::ULong i=0; ilength(_fieldsDict.size()); + map::iterator it; + CORBA::ULong i = 0; + for (it = _fieldsDict.begin(); it != _fieldsDict.end(); it++, i++) + { + std::string cle((*it).first); + copie[i].key = CORBA::string_dup(cle.c_str()); + copie[i].value = _fieldsDict[cle]; + } + return copie._retn(); +} + +//============================================================================= +/*! + * CORBA method: used by Supervision to give names to this instance + */ +//============================================================================= + +void Engines_Parallel_Component_i::Names( const char * graphName , + const char * nodeName ) +{ + _graphName = graphName ; + _nodeName = nodeName ; + INFOS("Engines_Parallel_Component_i::Names( '" << _graphName << "' , '" + << _nodeName << "' )"); +} + +//============================================================================= +/*! + * CORBA method: used in Supervision + */ +//============================================================================= + +bool Engines_Parallel_Component_i::Kill_impl() +{ +// MESSAGE("Engines_Parallel_Component_i::Kill_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 << " this " << hex << this +// << dec ) ; + + bool RetVal = false ; +#ifndef WNT + if ( _ThreadId > 0 && pthread_self() != _ThreadId ) + { + RetVal = Killer( _ThreadId , 0 ) ; + _ThreadId = (pthread_t ) -1 ; + } + +#else + if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p ) + { + RetVal = Killer( *_ThreadId , 0 ) ; + _ThreadId = (pthread_t* ) 0 ; + } + +#endif + return RetVal ; +} + +//============================================================================= +/*! + * CORBA method: used in Supervision + */ +//============================================================================= + +bool Engines_Parallel_Component_i::Stop_impl() +{ + MESSAGE("Engines_Parallel_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 ); + + + bool RetVal = false ; +#ifndef WNT + if ( _ThreadId > 0 && pthread_self() != _ThreadId ) + { + RetVal = Killer( _ThreadId , 0 ) ; + _ThreadId = (pthread_t ) -1 ; + } +#else + if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p ) + { + RetVal = Killer( *_ThreadId , 0 ) ; + _ThreadId = (pthread_t* ) 0 ; + } +#endif + return RetVal ; +} + +//============================================================================= +/*! + * CORBA method: used in Supervision + */ +//============================================================================= + +bool Engines_Parallel_Component_i::Suspend_impl() +{ + MESSAGE("Engines_Parallel_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 ); + + bool RetVal = false ; +#ifndef WNT + if ( _ThreadId > 0 && pthread_self() != _ThreadId ) +#else + if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p ) +#endif + { + if ( _Sleeping ) + { + return false ; + } + else + { +#ifndef WNT + RetVal = Killer( _ThreadId ,SIGINT ) ; +#else + RetVal = Killer( *_ThreadId ,SIGINT ) ; +#endif + //if ( RetVal ) _Sleeping = true; + + } + } + return RetVal ; +} + +//============================================================================= +/*! + * CORBA method: used in Supervision + */ +//============================================================================= + +bool Engines_Parallel_Component_i::Resume_impl() +{ + MESSAGE("Engines_Parallel_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 ); + bool RetVal = false ; +#ifndef WNT + if ( _ThreadId > 0 && pthread_self() != _ThreadId ) +#else + if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p ) +#endif + { + if ( _Sleeping ) + { + _Sleeping = false ; + RetVal = true ; + } + else + { + RetVal = false ; + } + } + return RetVal ; +} + +//============================================================================= +/*! + * CORBA method: + */ +//============================================================================= + +CORBA::Long Engines_Parallel_Component_i::CpuUsed_impl() +{ + long cpu = 0 ; + if ( _ThreadId || _Executed ) + { + if ( _ThreadId > 0 ) + { +#ifndef WNT + if ( pthread_self() != _ThreadId ) +#else + if ( pthread_self().p != _ThreadId->p ) +#endif + { + if ( _Sleeping ) + { + } + else + { + // Get Cpu in the appropriate thread with that object !... + theEngines_Component = this ; +#ifndef WNT + Killer( _ThreadId ,SIGUSR1 ) ; +#else + Killer( *_ThreadId ,SIGUSR11 ) ; +#endif + } + cpu = _ThreadCpuUsed ; + } + else + { + _ThreadCpuUsed = CpuUsed() ; + cpu = _ThreadCpuUsed ; + // cout << pthread_self() << " Engines_Parallel_Component_i::CpuUsed_impl " + // << _serviceName << " " << cpu << endl ; + } + } + else + { + cpu = _ThreadCpuUsed ; + // cout << pthread_self() << " Engines_Parallel_Component_i::CpuUsed_impl " + // << _serviceName << " " << cpu<< endl ; + } + } + else + { + // cout<< pthread_self()<<"Engines_Parallel_Component_i::CpuUsed_impl _ThreadId " + // <<_ThreadId <<" "<<_serviceName<<" _StartUsed "<<_StartUsed<(_poa->id_to_servant(*_contId)) ; +} + +//============================================================================= +/*! + * C++ method: set study Id + * \param studyId 0 if instance is not associated to a study, + * >0 otherwise (== study id) + * \return true if the set of study Id is OK + * must be set once by Container, at instance creation, + * and cannot be changed after. + */ +//============================================================================= + +CORBA::Boolean Engines_Parallel_Component_i::setStudyId(CORBA::Long studyId) +{ + ASSERT( studyId >= 0); + CORBA::Boolean ret = false; + if (_studyId < 0) // --- not yet initialized + { + _studyId = studyId; + ret = true; + } + else + if ( _studyId == studyId) ret = true; + return ret; +} + +//============================================================================= +/*! + * C++ method: return CORBA instance id, the id is set in derived class + * constructor, when instance is activated. + */ +//============================================================================= + +PortableServer::ObjectId * Engines_Parallel_Component_i::getId() +{ +// MESSAGE("PortableServer::ObjectId * Engines_Parallel_Component_i::getId()"); + return _id ; +} + +//============================================================================= +/*! + * C++ method: used by derived classes for supervision + */ +//============================================================================= + +void Engines_Parallel_Component_i::beginService(const char *serviceName) +{ + MESSAGE(pthread_self() << "Send BeginService notification for " <p = pthread_self().p ; + _ThreadId->x = pthread_self().x ; +#endif + _StartUsed = 0 ; + _StartUsed = CpuUsed_impl() ; + _ThreadCpuUsed = 0 ; + _Executed = true ; + _serviceName = serviceName ; + if ( pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS , NULL ) ) + { + perror("pthread_setcanceltype ") ; + exit(0) ; + } + if ( pthread_setcancelstate( PTHREAD_CANCEL_ENABLE , NULL ) ) + { + perror("pthread_setcancelstate ") ; + exit(0) ; + } +// MESSAGE(pthread_self() << " Return from BeginService for " << serviceName +// << " ThreadId " << _ThreadId << " StartUsed " << _StartUsed +// << " _graphName " << _graphName << " _nodeName " << _nodeName ); + + // --- for supervisor : all strings given with setProperties + // are set in environment + bool overwrite = true; + map::iterator it; + for (it = _fieldsDict.begin(); it != _fieldsDict.end(); it++) + { + std::string cle((*it).first); + if ((*it).second.type()->kind() == CORBA::tk_string) + { + const char* value; + (*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); + setenv(cle.c_str(), value, overwrite); +#else + //CCRT porting : setenv not defined in stdlib.h + std::string s(cle); + s+='='; + s+=value; + // char* cast because 1st arg of linux putenv function + // is not a const char* ! + //int ret=putenv((char *)s.c_str()); + putenv((char *)s.c_str()); + //End of CCRT porting +#endif + MESSAGE("--- setenv: "<SetCurCpu() ; +} + +//============================================================================= +/*! + * C++ method: + */ +//============================================================================= + +void Engines_Parallel_Component_i::SetCurCpu() +{ + _ThreadCpuUsed = CpuUsed() ; + // MESSAGE(pthread_self() << + // " Engines_Parallel_Component_i::SetCurCpu() _ThreadCpuUsed " << _ThreadCpuUsed) ; +} + +//============================================================================= +/*! + * C++ method: + */ +//============================================================================= + +long Engines_Parallel_Component_i::CpuUsed() +{ + long cpu = 0 ; +#ifndef WNT + struct rusage usage ; + if ( _ThreadId || _Executed ) + { + if ( getrusage( RUSAGE_SELF , &usage ) == -1 ) + { + perror("Engines_Parallel_Component_i::CpuUsed") ; + return 0 ; + } + cpu = usage.ru_utime.tv_sec - _StartUsed ; + // cout << pthread_self() << " Engines_Parallel_Component_i::CpuUsed " << " " + // << _serviceName << usage.ru_utime.tv_sec << " - " << _StartUsed + // << " = " << cpu << endl ; + } + else + { + // cout << pthread_self() << "Engines_Parallel_Component_i::CpuUsed _ThreadId " + // << _ThreadId << " " << _serviceName<< " _StartUsed " + // << _StartUsed << endl ; + } +#else + // NOT implementet yet +#endif + + + return cpu ; +} + +//============================================================================= +/*! + * C++ method: Send message to event channel + */ +//============================================================================= + +void Engines_Parallel_Component_i::sendMessage(const char *event_type, + const char *message) +{ + _notifSupplier->Send(graphName(), nodeName(), event_type, message); +} + +//============================================================================= +/*! + * C++ method: return standard library name built on component name + */ +//============================================================================= + +string Engines_Parallel_Component_i::GetDynLibraryName(const char *componentName) +{ + string ret="lib"; + ret+=componentName; + ret+="Engine.so"; + return ret; +} + +//============================================================================= +/*! + * C++ method: DumpPython default implementation + */ +//============================================================================= + +Engines::TMPFile* Engines_Parallel_Component_i::DumpPython(CORBA::Object_ptr theStudy, + CORBA::Boolean isPublished, + CORBA::Boolean& isValidScript) +{ + const char* aScript = "def RebuildData(theStudy): pass"; + char* aBuffer = new char[strlen(aScript)+1]; + strcpy(aBuffer, aScript); + CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer; + int aBufferSize = strlen(aBuffer)+1; + Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1); + isValidScript = true; + return aStreamFile._retn(); +} + + +Engines::Salome_file_ptr +Engines_Parallel_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_Proxy_Salome_file_map * _proxy_map = new _t_Proxy_Salome_file_map(); + _Proxy_Input_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_Input_Service_file_map[service_name] = _IOR_proxy_map; + } + _t_Salome_file_map * _map = _Input_Service_file_map[service_name]; + _t_Proxy_Salome_file_map * _proxy_map = _Proxy_Input_Service_file_map[service_name]; + _t_IOR_Proxy_Salome_file_map * _IOR_proxy_map = _IOR_Proxy_Input_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. + Engines::Parallel_Salome_file_proxy_impl * proxy = NULL; + if (getMyRank() == 0) { + proxy = new Engines::Parallel_Salome_file_proxy_impl(CORBA::ORB::_duplicate(_orb), + new paco_omni_fabrique()); + proxy->copyGlobalContext(this); + PaCO::PacoTopology_t serveur_topo; + serveur_topo.total = getTotalNode(); + proxy->setTopology(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... + Engines::Parallel_Component_var component_proxy = + Engines::Parallel_Component::_narrow(InterfaceParallel_impl::_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(), + i); + servant->copyGlobalContext(this); + + // We register the CORBA objet into the POA + servant->POA_PaCO::InterfaceParallel::_this(); + + // Register the servant + servant->deploy(); + + // Adding servant to the map + (*_map)[Salome_file_name] = servant; + } + + _my_com->paco_barrier(); + // start parallel object + if (getMyRank() == 0) { + proxy->start(); + _my_com->paco_barrier(); + } + else + _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); + Engines::Parallel_Salome_file_proxy_impl * proxy; + 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) { + proxy = new Engines::Parallel_Salome_file_proxy_impl(CORBA::ORB::_duplicate(_orb), + new paco_omni_fabrique()); + proxy->copyGlobalContext(this); + PaCO::PacoTopology_t serveur_topo; + serveur_topo.total = getTotalNode(); + proxy->setTopology(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... + Engines::Parallel_Component_var component_proxy = + Engines::Parallel_Component::_narrow(InterfaceParallel_impl::_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(), + i); + servant->copyGlobalContext(this); + + // We register the CORBA objet into the POA + servant->POA_PaCO::InterfaceParallel::_this(); + + // Register the servant + servant->deploy(); + + // Adding servant to the map + (*_map)[Salome_file_name] = servant; + } + + _my_com->paco_barrier(); + // start parallel object + if (getMyRank() == 0) { + proxy->start(); + _my_com->paco_barrier(); + } + else + _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 new file mode 100644 index 000000000..218864970 --- /dev/null +++ b/src/ParallelContainer/SALOME_ParallelComponent_i.hxx @@ -0,0 +1,204 @@ +// SALOME_ParallelComponent : implementation of container and engine for Parallel Kernel +// +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// File : SALOME_ParallelComponent_i.hxx +// Author : André RIBES, EDF +// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA + +#ifndef _SALOME_PARALLEL_COMPONENT_I_HXX_ +#define _SALOME_PARALLEL_COMPONENT_I_HXX_ + +#include +#include +#include +#ifndef WNT +#include +#endif +#include +#include +#include +#include + +#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; + +#if defined CONTAINER_EXPORTS +#if defined WIN32 +#define CONTAINER_EXPORT __declspec( dllexport ) +#else +#define CONTAINER_EXPORT +#endif +#else +#if defined WNT +#define CONTAINER_EXPORT __declspec( dllimport ) +#else +#define CONTAINER_EXPORT +#endif +#endif + +class CONTAINER_EXPORT Engines_Parallel_Component_i: + public virtual Engines::Parallel_Component_serv, + public virtual PortableServer::RefCountServantBase +{ +public: + Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, int rank); + Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, int rank, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName, + bool notif = false); + + virtual ~Engines_Parallel_Component_i(); + + // --- CORBA methods + + char* instanceName(); + char* interfaceName(); + + void ping(); + void destroy(); + + CORBA::Long getStudyId(); + Engines::Container_ptr GetContainerRef(); + + void setProperties(const Engines::FieldsDict& dico); + Engines::FieldsDict* getProperties(); + + void Names( const char * graphName , const char * nodeName ) ; + bool Kill_impl(); + bool Stop_impl(); + bool Suspend_impl(); + bool Resume_impl(); + CORBA::Long CpuUsed_impl() ; + + virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, + 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 + + PortableServer::ObjectId * getId(); + Engines_Parallel_Container_i *GetContainerPtr(); + + bool setStudyId(CORBA::Long studyId); + static bool isMultiStudy(); + static bool isMultiInstance(); + static std::string GetDynLibraryName(const char *componentName); + + void beginService(const char *serviceName); + void endService(const char *serviceName); + void sendMessage(const char *event_type, const char *message); + char * graphName() ; + char * nodeName() ; + bool Killer( pthread_t ThreadId , int signum ); + 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; + static bool _isMultiInstance; + + std::string _instanceName ; + std::string _interfaceName ; + + CORBA::ORB_ptr _orb; + PortableServer::POA_ptr _poa; + PortableServer::ObjectId * _id; + PortableServer::ObjectId * _contId; + Engines_Parallel_Component_i * _thisObj ; + RegistryConnexion *_myConnexionToRegistry; + 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 ; +#else + pthread_t* _ThreadId ; +#endif + long _StartUsed ; + long _ThreadCpuUsed ; + bool _Executed ; +}; + +#endif diff --git a/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx b/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx new file mode 100644 index 000000000..d3470b9de --- /dev/null +++ b/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx @@ -0,0 +1,212 @@ +// SALOME ParallelContainerNodeDummy : launcher of a PaCO++ object +// +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_ParallelContainerNodeDummy.cxx +// Author : André Ribes, EDF +// Module : SALOME PARALLEL + +#include +#include +#include + +#ifndef WNT +#include +#else +#include +#endif + +#include "SALOME_ParallelContainer_i.hxx" + +#include +#include + +#include "SALOME_NamingService.hxx" + +#include "utilities.h" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" +#include "SALOMETraceCollector.hxx" +#include "OpUtil.hxx" + +using namespace std; + +#ifdef _DEBUG_ +#include + +void handler(int t) { + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "SIGSEGV in :" << getpid() << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + while (1) {} +} +#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"); + + if(getenv ("DEBUGGER")) + { + setsig(SIGSEGV,&Handler); + set_terminate(&terminateHandler); + set_unexpected(&unexpectedHandler); + } + + // Initialise the ORB. + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + std::string containerName(""); + if(argc > 1) { + containerName = argv[1]; + } + std::string hostname(""); + if(argc > 3) { + hostname = argv[3]; + } + + try { + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); + PortableServer::POAManager_var pman = root_poa->the_POAManager(); + +#ifndef WNT + // add this container to the kill list + char aCommand[100]; + sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerNode", getpid()); + system(aCommand); +#endif + + SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb)); + // Get the proxy + string proxyNameInNS = ns->BuildContainerNameForNS(containerName.c_str(), + hostname.c_str()); + obj = ns->Resolve(proxyNameInNS.c_str()); + char * proxy_ior = orb->object_to_string(obj); + + // Creating a node + string node_name = containerName + "Node"; + Engines_Parallel_Container_i * servant = new Engines_Parallel_Container_i(CORBA::ORB::_duplicate(orb), + proxy_ior, + 0, + root_poa, + (char*) node_name.c_str(), + argc, argv); + // PaCO++ init + paco_fabrique_manager * pfm = paco_getFabriqueManager(); + pfm->register_com("dummy", new paco_dummy_fabrique()); + pfm->register_thread("omni", new paco_omni_fabrique()); + servant->setLibCom("dummy", servant); + servant->setLibThread("omni"); + + // Activation + PortableServer::ObjectId * _id = root_poa->activate_object(servant); + servant->set_id(_id); + obj = root_poa->id_to_reference(*_id); + + // In the NamingService + string hostname = GetHostname(); + int myid = 0; + char buffer [5]; + snprintf(buffer, 5, "%d", myid); + node_name = node_name + buffer; + string _containerName = ns->BuildContainerNameForNS((char*) node_name.c_str(), + hostname.c_str()); + cerr << "---------" << _containerName << "----------" << endl; + ns->Register(obj, _containerName.c_str()); + pman->activate(); + orb->run(); + } + catch (PaCO::PACO_Exception& e) + { + INFOS("Caught PaCO::PACO_Exception"); + std::cerr << e << std::endl; + } + catch(CORBA::SystemException&) + { + INFOS("Caught CORBA::SystemException."); + } + catch(PortableServer::POA::ServantAlreadyActive&) + { + INFOS("Caught CORBA::ServantAlreadyActiveException"); + } + catch(CORBA::Exception&) + { + INFOS("Caught CORBA::Exception."); + } + catch(std::exception& exc) + { + INFOS("Caught std::exception - "< +#include +#include + +#ifndef WNT +#include +#else +#include +#endif + +#include "SALOME_ParallelContainer_i.hxx" + +// PaCO++ include +#include +#include + +#include + +#include "SALOME_NamingService.hxx" + +#include "utilities.h" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" +#include "SALOMETraceCollector.hxx" +#include "OpUtil.hxx" + +using namespace std; + +#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; + cerr << "SIGSEGV in :" << getpid() << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + while (1) {} +} +#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"); + + // MPI Init + int provided; + int myid; + MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE ,&provided); + MPI_Comm_rank(MPI_COMM_WORLD,&myid); + + if(getenv ("DEBUGGER")) + { + std::cerr << "Unexpected: unexpected exception !" << std::endl; + setsig(SIGSEGV,&Handler); + set_terminate(&terminateHandler); + set_unexpected(&unexpectedHandler); + } + 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; + cerr << "Level MPI_THREAD_MULTIPLE : " << MPI_THREAD_MULTIPLE << endl; + cerr << "Level provided : " << provided << endl; + // Initialise the ORB. + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + // Code pour choisir le reseau infiniband ..... + /* string hostname_temp = GetHostname(); + hostent * t = gethostbyname(hostname_temp.c_str()); + cerr << " AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA " << t->h_addr << " " << hostname_temp << endl; + cerr << t->h_addr << endl; + in_addr * address=(in_addr * ) t->h_addr; + cerr << inet_ntoa(* address) << endl; + string ip = inet_ntoa(* address); + cerr << " AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA " << endl; + string com = "giop:tcp:" + ip + ":"; + const char* options[][2] = { { "endPoint", com.c_str() }, { 0, 0 } }; + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB4", options); + */ + std::string containerName(""); + containerName = argv[1]; + + std::string hostname(""); + if(argc > 3) { + hostname = argv[3]; + } + + try { + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); + PortableServer::POAManager_var pman = root_poa->the_POAManager(); + +#ifndef WNT + // add this container to the kill list + char aCommand[100]; + sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerNodeMpi", getpid()); + system(aCommand); +#endif + + SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb)); + // On récupère le proxy + string proxyNameInNS = ns->BuildContainerNameForNS(containerName.c_str(), + hostname.c_str()); + obj = ns->Resolve(proxyNameInNS.c_str()); + char * proxy_ior = orb->object_to_string(obj); + + // Node creation + string node_name = containerName + "Node"; + Engines_Parallel_Container_i * servant = + new Engines_Parallel_Container_i(CORBA::ORB::_duplicate(orb), + proxy_ior, + myid, + root_poa, + (char*) node_name.c_str(), + argc, argv); + // PaCO++ init + paco_fabrique_manager * pfm = paco_getFabriqueManager(); + pfm->register_com("mpi", new paco_mpi_fabrique()); + pfm->register_thread("omni", new paco_omni_fabrique()); + MPI_Comm group = MPI_COMM_WORLD; + servant->setLibCom("mpi", &group); + servant->setLibThread("omni"); + + // Activation + PortableServer::ObjectId * _id = root_poa->activate_object(servant); + servant->set_id(_id); + obj = root_poa->id_to_reference(*_id); + + // In the NamingService + string hostname = GetHostname(); + + int myid; + MPI_Comm_rank(MPI_COMM_WORLD, &myid); + char buffer [5]; + snprintf(buffer, 5, "%d", myid); + node_name = node_name + buffer; + string _containerName = ns->BuildContainerNameForNS(node_name.c_str(), + hostname.c_str()); + cerr << "---------" << _containerName << "----------" << endl; + ns->Register(obj, _containerName.c_str()); + pman->activate(); + orb->run(); + } + catch (PaCO::PACO_Exception& e) + { + INFOS("Caught PaCO::PACO_Exception"); + std::cerr << e << std::endl; + } + catch(CORBA::SystemException&) + { + INFOS("Caught CORBA::SystemException."); + } + catch(PortableServer::POA::ServantAlreadyActive&) + { + INFOS("Caught CORBA::ServantAlreadyActiveException"); + } + catch(CORBA::Exception&) + { + INFOS("Caught CORBA::Exception."); + } + catch(std::exception& exc) + { + INFOS("Caught std::exception - "< +#include +#include + +#ifndef WNT +#include +#else +#include +#endif + +// PaCO++ include +//#include "SALOME_ComponentPaCO_Engines_Container_server.h" +#include "SALOME_ParallelContainerProxy_i.hxx" +#include +#include + +#include "SALOME_NamingService.hxx" + +#include "utilities.h" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" +#include "SALOMETraceCollector.hxx" +#include "OpUtil.hxx" + +#ifdef DEBUG_PARALLEL +#include +using namespace std; + +void handler(int t) { + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "SIGSEGV in :" << getpid() << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + while (1) {} +} +#endif + +int main(int argc, char* argv[]) +{ + INFOS("Launching a parallel proxy container"); + +#ifdef DEBUG_PARALLEL + signal(SIGSEGV, handler); +#endif + // Initialise the ORB. + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + std::string containerName(""); + if(argc > 1) { + containerName = argv[1]; + } + + try { + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + ASSERT(!CORBA::is_nil(obj)); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); + PortableServer::POAManager_var pman = root_poa->the_POAManager(); + +#ifndef WNT + // add this container to the kill list + char aCommand[100]; + sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxyDummy", getpid()); + system(aCommand); +#endif + + SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb)); +// Engines::Container_proxy_impl * proxy = +// new Engines::Container_proxy_impl(orb, +// new paco_omni_fabrique()); + + Container_proxy_impl_final * proxy = + new Container_proxy_impl_final(orb, + new paco_omni_fabrique()); + // PaCO++ code + paco_fabrique_manager* pfm = paco_getFabriqueManager(); + pfm->register_com("dummy", new paco_dummy_fabrique()); + proxy->setLibCom("dummy", proxy); + pfm->register_thread("omnithread", new paco_omni_fabrique()); + proxy->setLibThread("omnithread"); + // Topo of the parallel object + PaCO::PacoTopology_t serveur_topo; + serveur_topo.total = 1; + proxy->setTopology(serveur_topo); + + PortableServer::ObjectId_var _id = root_poa->activate_object(proxy); + obj = root_poa->id_to_reference(_id); + + // In the NamingService + string hostname = GetHostname(); + Engines::Container_var pCont = Engines::Container::_narrow(obj); + string _containerName = ns->BuildContainerNameForNS(containerName.c_str(), + hostname.c_str()); + cerr << "---------" << _containerName << "----------" << endl; + ns->Register(pCont, _containerName.c_str()); + pman->activate(); + orb->run(); + } + catch (PaCO::PACO_Exception& e) + { + INFOS("Caught PaCO::PACO_Exception"); + std::cerr << e << std::endl; + } + catch(CORBA::SystemException&) + { + INFOS("Caught CORBA::SystemException."); + } + catch(PortableServer::POA::ServantAlreadyActive&) + { + INFOS("Caught CORBA::ServantAlreadyActiveException"); + } + catch(CORBA::Exception&) + { + INFOS("Caught CORBA::Exception."); + } + catch(std::exception& exc) + { + INFOS("Caught std::exception - "< +#include +#include + +#ifndef WNT +#include +#else +#include +#endif + +//#include "SALOME_ComponentPaCO_Engines_Container_server.h" +#include "SALOME_ParallelContainerProxy_i.hxx" +#include +#include + +#include + +#include "SALOME_NamingService.hxx" + +#include "utilities.h" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" +#include "SALOMETraceCollector.hxx" +#include "OpUtil.hxx" +using namespace std; + +#ifdef DEBUG_PARALLEL +#include + +void handler(int t) { + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "SIGSEGV in :" << getpid() << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; + while (1) {} +} +#endif + +int main(int argc, char* argv[]) +{ + INFOS("Launching a parallel Mpi proxy container"); + +#ifdef DEBUG_PARALLEL + signal(SIGSEGV, handler); +#endif + + // MPI Init + int provided; + MPI_Init_thread(&argc, &argv, MPI_THREAD_SERIALIZED ,&provided); + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); + + std::string containerName(""); + containerName = argv[1]; + int nb_nodes; + sscanf(argv[2],"%d",&nb_nodes); + + try { + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA"); + ASSERT(!CORBA::is_nil(obj)); + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj); + PortableServer::POAManager_var pman = root_poa->the_POAManager(); + +#ifndef WNT + // add this container to the kill list + char aCommand[100]; + sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxyMpi", getpid()); + system(aCommand); +#endif + + SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb)); +// Engines::Container_proxy_impl * proxy = +// new Engines::Container_proxy_impl(orb, +// new paco_omni_fabrique()); + Container_proxy_impl_final * proxy = + new Container_proxy_impl_final(orb, + new paco_omni_fabrique()); + + // PaCO++ code + paco_fabrique_manager* pfm = paco_getFabriqueManager(); + pfm->register_com("mpi", new paco_mpi_fabrique()); + MPI_Comm group = MPI_COMM_WORLD; + proxy->setLibCom("mpi", &group); + pfm->register_thread("omnithread", new paco_omni_fabrique()); + proxy->setLibThread("omnithread"); + PaCO::PacoTopology_t serveur_topo; + serveur_topo.total = nb_nodes; + proxy->setTopology(serveur_topo); + + // Activation + PortableServer::ObjectId_var _id = root_poa->activate_object(proxy); + obj = root_poa->id_to_reference(_id); + + // in the NamingService + string hostname = GetHostname(); + Engines::Container_var pCont = Engines::Container::_narrow(obj); + string _containerName = ns->BuildContainerNameForNS(containerName.c_str(), + hostname.c_str()); + cerr << "---------" << _containerName << "----------" << endl; + ns->Register(pCont, _containerName.c_str()); + pman->activate(); + orb->run(); + } + catch (PaCO::PACO_Exception& e) + { + INFOS("Caught PaCO::PACO_Exception"); + std::cerr << e << std::endl; + } + catch(CORBA::SystemException&) + { + INFOS("Caught CORBA::SystemException."); + } + catch(PortableServer::POA::ServantAlreadyActive&) + { + INFOS("Caught CORBA::ServantAlreadyActiveException"); + } + catch(CORBA::Exception&) + { + INFOS("Caught CORBA::Exception."); + } + catch(std::exception& exc) + { + INFOS("Caught std::exception - "<shutdown(0); +} + diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx new file mode 100644 index 000000000..77d59144f --- /dev/null +++ b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx @@ -0,0 +1,44 @@ +// SALOME_ParallelContainerProxy : implementation of container and engine for Parallel Kernel +// +// Copyright (C) 2008 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// File : SALOME_ParallelContainerProxy_i.hxx +// Author : André RIBES, EDF + +#ifndef _SALOME_PARALLEL_CONTAINER_PROXY_I_HXX_ +#define _SALOME_PARALLEL_CONTAINER_PROXY_I_HXX_ + +#include "utilities.h" +#include "SALOME_ComponentPaCO_Engines_Container_server.h" + +class Container_proxy_impl_final : + public Engines::Container_proxy_impl +{ + public: + Container_proxy_impl_final(CORBA::ORB_ptr orb, + paco_fabrique_thread * fab_thread, + bool is_a_return_proxy = false); + + virtual ~Container_proxy_impl_final(); + + virtual void Shutdown(); +}; + +#endif diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx new file mode 100644 index 000000000..97f655b39 --- /dev/null +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx @@ -0,0 +1,1068 @@ +// SALOME_ParallelContainer : implementation of container and engine for ParallelKernel +// +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// File : SALOME_ParallelContainer_i.cxx +// Author : Andr� RIBES, EDF +// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA + +#include +#ifndef WNT +#else +#include +#endif +#include "SALOME_ParallelContainer_i.hxx" + +#include "SALOME_Component_i.hxx" + +#include "SALOME_FileRef_i.hxx" +#include "SALOME_FileTransfer_i.hxx" +#include "SALOME_NamingService.hxx" +#include "OpUtil.hxx" + +#include "OpUtil.hxx" +#include +#include +#ifndef WNT +#include +#include +#else +#include "../../adm/win32/SALOME_WNT.hxx" +#include +#include +int SIGUSR1 = 1000; +#endif + +#include +#include "utilities.h" +using namespace std; + +bool _Sleeping = false ; + +// Containers with name FactoryServer are started via rsh in LifeCycleCORBA +// Other Containers are started via start_impl of FactoryServer + +extern "C" {void ActSigIntHandler() ; } +#ifndef WNT +extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; } +#else +extern "C" {void SigIntHandler( int ) ; } +#endif + + +map Engines_Parallel_Container_i::_cntInstances_map; +map Engines_Parallel_Container_i::_library_map; +map Engines_Parallel_Container_i::_toRemove_map; +omni_mutex Engines_Parallel_Container_i::_numInstanceMutex ; + +//============================================================================= +/*! + * Default constructor, not for use + */ +//============================================================================= + +Engines_Parallel_Container_i::Engines_Parallel_Container_i (CORBA::ORB_ptr orb, + char * ior, + int rank) : + InterfaceParallel_impl(orb,ior,rank), + Engines::Container_serv(orb,ior,rank), + _numInstance(0) +{ +} + +//============================================================================= +/*! + * Construtor to use + */ +//============================================================================= + +Engines_Parallel_Container_i::Engines_Parallel_Container_i (CORBA::ORB_ptr orb, + char * ior, + int rank, + PortableServer::POA_ptr poa, + char *containerName , + int argc , char* argv[], + bool activAndRegist, + bool isServantAloneInProcess + ) : + InterfaceParallel_impl(orb,ior,rank), + Engines::Container_serv(orb,ior,rank), + _numInstance(0),_isServantAloneInProcess(isServantAloneInProcess) +{ + _pid = (long)getpid(); + + if(activAndRegist) + ActSigIntHandler() ; + + _argc = argc ; + _argv = argv ; + + string hostname = GetHostname(); + + _orb = CORBA::ORB::_duplicate(orb) ; + _poa = PortableServer::POA::_duplicate(poa) ; + _NS = new SALOME_NamingService(); + _NS->init_orb( CORBA::ORB::_duplicate(_orb) ); + _containerName = _NS->BuildContainerNameForNS(containerName, hostname.c_str()); + + fileTransfer_i* aFileTransfer = new fileTransfer_i(); + _fileTransfer = Engines::fileTransfer::_narrow(aFileTransfer->_this()); +} + +//============================================================================= +/*! + * Destructor + */ +//============================================================================= + +Engines_Parallel_Container_i::~Engines_Parallel_Container_i() +{ + MESSAGE("Container_i::~Container_i()"); + delete _id; +} + +//============================================================================= +/*! + * CORBA attribute: Container name (see constructor) + */ +//============================================================================= + +char* Engines_Parallel_Container_i::name() +{ + return CORBA::string_dup(_containerName.c_str()) ; +} + +//============================================================================= +/*! + * CORBA method: Get the hostName of the Container (without domain extensions) + */ +//============================================================================= + +char* Engines_Parallel_Container_i::getHostName() +{ + string s = GetHostname(); + MESSAGE("Engines_Parallel_Container_i::getHostName " << s); + return CORBA::string_dup(s.c_str()) ; +} + +//============================================================================= +/*! + * CORBA method: Get the PID (process identification) of the Container + */ +//============================================================================= + +CORBA::Long Engines_Parallel_Container_i::getPID() +{ + return (CORBA::Long)getpid(); +} + +//============================================================================= +/*! + * CORBA method: check if servant is still alive + */ +//============================================================================= + +void Engines_Parallel_Container_i::ping() +{ + MESSAGE("Engines_Parallel_Container_i::ping() pid "<< getpid()); +} + +//============================================================================= +/*! + * CORBA method, oneway: Server shutdown. + * - Container name removed from naming service, + * - servant deactivation, + * - orb shutdown if no other servants in the process + */ +//============================================================================= + +void Engines_Parallel_Container_i::Shutdown() +{ + MESSAGE("Engines_Parallel_Container_i::Shutdown()"); + _NS->Destroy_FullDirectory(_containerName.c_str()); + //_remove_ref(); + //_poa->deactivate_object(*_id); + if(_isServantAloneInProcess) + { + MESSAGE("Effective Shutdown of container Begins..."); + LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); + bp1->deleteInstance(bp1); + _orb->shutdown(0); + } +} + + +//============================================================================= +/*! + * CORBA method: load a new component class (Python or C++ implementation) + * \param componentName like COMPONENT + * try to make a Python import of COMPONENT, + * then a lib open of libCOMPONENTEngine.so + * \return true if dlopen successfull or already done, false otherwise + */ +//============================================================================= + +bool +Engines_Parallel_Container_i::load_component_Library(const char* componentName) +{ + bool ret = false; + string aCompName = componentName; + // --- try dlopen C++ component + +#ifndef WNT + string impl_name = string ("lib") + aCompName + string("Engine.so"); +#else + string impl_name = aCompName + string("Engine.dll"); +#endif + + SCRUTE(impl_name); + + _numInstanceMutex.lock(); // lock to be alone + if (_toRemove_map[impl_name]) _toRemove_map.erase(impl_name); + if (_library_map[impl_name]) + { + MESSAGE("Library " << impl_name << " already loaded"); + _numInstanceMutex.unlock(); + ret = true; + } + + void* handle; +#ifndef WNT + handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ; +#else + handle = dlopen( impl_name.c_str() , 0 ) ; +#endif + if ( handle ) + { + _library_map[impl_name] = handle; + _numInstanceMutex.unlock(); + ret = true; + } + else + { + cerr << "Can't load shared library : " << impl_name << endl; + cerr << "error dlopen: " << dlerror() << endl; + _numInstanceMutex.unlock(); + ret = false; + } + + // To be sure that all the nodes of the component as loaded the library + _my_com->paco_barrier(); + + return ret; +} + +//============================================================================= +/*! + * CORBA method: Creates a new servant instance of a component. + * The servant registers itself to naming service and Registry. + * \param genericRegisterName Name of the component instance to register + * in Registry & Name Service (without _inst_n suffix) + * \param studyId 0 for multiStudy instance, + * study Id (>0) otherwise + * \return a loaded component + */ +//============================================================================= + +Engines::Component_ptr +Engines_Parallel_Container_i::create_component_instance(const char*genericRegisterName, + CORBA::Long studyId) +{ + cerr << "----------------- create_component_instance node : " << getMyRank() << endl; + + if (studyId < 0) + { + INFOS("studyId must be > 0 for mono study instance, =0 for multiStudy"); + return Engines::Component::_nil() ; + } + + Engines::Component_var iobject = Engines::Component::_nil() ; + + // is it a parallel component ? + bool parallel = false; + string aCompName = genericRegisterName; + int par = aCompName.find("@PARALLEL@"); + if (par>0) { + parallel = true; + aCompName = aCompName.substr(0,par); + } + + //--- try C++ +#ifndef WNT + string impl_name = string ("lib") + aCompName +string("Engine.so"); +#else + string impl_name = aCompName +string("Engine.dll"); +#endif + void* handle = _library_map[impl_name]; + + if ( !handle ) + { + cerr << "shared library " << impl_name <<"must be loaded before instance" << endl;; + return Engines::Component::_nil() ; + } + else + { + if (parallel) { + // Sequential component case + // Component parallel proxy created on node 0 + iobject = createParallelInstance(aCompName, + handle, + studyId); + + } + else { + // Sequential component case + iobject = createInstance(aCompName, + handle, + studyId); + } + + return iobject._retn(); + } +} + +//============================================================================= +/*! + * CORBA method: Finds a servant instance of a component + * \param registeredName Name of the component in Registry or Name Service, + * without instance suffix number + * \param studyId 0 if instance is not associated to a study, + * >0 otherwise (== study id) + * \return the first instance found with same studyId + */ +//============================================================================= + +Engines::Component_ptr Engines_Parallel_Container_i::find_component_instance( const char* registeredName, + CORBA::Long studyId) +{ + Engines::Component_var anEngine = Engines::Component::_nil(); + map::iterator itm =_listInstances_map.begin(); + while (itm != _listInstances_map.end()) + { + string instance = (*itm).first; + SCRUTE(instance); + if (instance.find(registeredName) == 0) + { + anEngine = (*itm).second; + if (studyId == anEngine->getStudyId()) + { + return anEngine._retn(); + } + } + itm++; + } + return anEngine._retn(); +} + +//============================================================================= +/*! + * CORBA method: find or create an instance of the component (servant), + * load a new component class (dynamic library) if required, + * ---- FOR COMPATIBILITY WITH 2.2 ---- + * ---- USE ONLY FOR MULTISTUDY INSTANCES ! -------- + * The servant registers itself to naming service and Registry. + * \param genericRegisterName Name of the component to register + * in Registry & Name Service + * \param componentName Name of the constructed library of the component + * \return a loaded component + */ +//============================================================================= + +Engines::Component_ptr Engines_Parallel_Container_i::load_impl( const char* genericRegisterName, + const char* componentName ) +{ + string impl_name = string ("lib") + genericRegisterName +string("Engine.so"); + Engines::Component_var iobject = Engines::Component::_nil() ; + if (load_component_Library(genericRegisterName)) + iobject = find_or_create_instance(genericRegisterName, impl_name); + return iobject._retn(); +} + + +//============================================================================= +/*! + * CORBA method: Stops the component servant, and deletes all related objects + * \param component_i Component to be removed + */ +//============================================================================= + +void Engines_Parallel_Container_i::remove_impl(Engines::Component_ptr component_i) +{ + ASSERT(! CORBA::is_nil(component_i)); + string instanceName = component_i->instanceName() ; + MESSAGE("unload component " << instanceName); + _listInstances_map.erase(instanceName); + component_i->destroy() ; + _NS->Destroy_Name(instanceName.c_str()); +} + +//============================================================================= +/*! + * CORBA method: Discharges unused libraries from the container. + */ +//============================================================================= + +void Engines_Parallel_Container_i::finalize_removal() +{ + MESSAGE("finalize unload : dlclose"); + _numInstanceMutex.lock(); // lock to be alone + // (see decInstanceCnt, load_component_Library) + map::iterator ith; + for (ith = _toRemove_map.begin(); ith != _toRemove_map.end(); ith++) + { + 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); + } + } + _toRemove_map.clear(); + _numInstanceMutex.unlock(); +} + +//============================================================================= +/*! + * CORBA method: Kill the container process with exit(0). + * To remove : never returns ! + */ +//============================================================================= + +bool Engines_Parallel_Container_i::Kill_impl() +{ + MESSAGE("Engines_Parallel_Container_i::Kill() pid "<< getpid() << " containerName " + << _containerName.c_str() << " machineName " + << GetHostname().c_str()); + INFOS("==============================================================="); + INFOS("= REMOVE calls to Kill_impl in C++ container ="); + INFOS("==============================================================="); + //exit( 0 ) ; + ASSERT(0); + return false; +} + +//============================================================================= +/*! + * C++ method: Finds an already existing servant instance of a component, or + * create an instance. + * ---- USE ONLY FOR MULTISTUDY INSTANCES ! -------- + * \param genericRegisterName Name of the component instance to register + * in Registry & Name Service, + * (without _inst_n suffix, like "COMPONENT") + * \param componentLibraryName like "libCOMPONENTEngine.so" + * \return a loaded component + * + * example with names: + * aGenRegisterName = COMPONENT (= first argument) + * impl_name = libCOMPONENTEngine.so (= second argument) + * _containerName = /Containers/cli76ce/FactoryServer + * factoryName = COMPONENTEngine_factory + * component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT + * + * instanceName = COMPONENT_inst_1 + * component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1 + */ +//============================================================================= + +Engines::Component_ptr +Engines_Parallel_Container_i::find_or_create_instance(string genericRegisterName, + string componentLibraryName) +{ + string aGenRegisterName = genericRegisterName; + string impl_name = componentLibraryName; + void* handle = _library_map[impl_name]; + if ( !handle ) + { + INFOS("shared library " << impl_name <<"must be loaded before instance"); + return Engines::Component::_nil() ; + } + else + { + // --- find a registered instance in naming service, or create + + string component_registerBase = + _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"); + } + } + } + catch (...) + { + INFOS( "Container_i::load_impl catched" ) ; + } + return iobject._retn(); + } +} + +//============================================================================= +/*! + * C++ method: create a servant instance of a component. + * \param genericRegisterName Name of the component instance to register + * in Registry & Name Service, + * (without _inst_n suffix, like "COMPONENT") + * \param handle loaded library handle + * \param studyId 0 for multiStudy instance, + * study Id (>0) otherwise + * \return a loaded component + * + * example with names: + * aGenRegisterName = COMPONENT (= first argument) + * _containerName = /Containers/cli76ce/FactoryServer + * factoryName = COMPONENTEngine_factory + * component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT + * instanceName = COMPONENT_inst_1 + * component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1 + */ +//============================================================================= + +Engines::Component_ptr +Engines_Parallel_Container_i::createInstance(string genericRegisterName, + void *handle, + int studyId) +{ + // --- find the factory + + string aGenRegisterName = genericRegisterName; + string factory_name = aGenRegisterName + string("Engine_factory"); + + SCRUTE(factory_name) ; + + typedef PortableServer::ObjectId * (*FACTORY_FUNCTION) + (CORBA::ORB_ptr, + PortableServer::POA_ptr, + PortableServer::ObjectId *, + const char *, + const char *) ; + + FACTORY_FUNCTION Component_factory + = (FACTORY_FUNCTION) dlsym(handle, factory_name.c_str()); + + char *error ; + if ( (error = dlerror() ) != NULL) + { + INFOS("Can't resolve symbol: " + factory_name); + SCRUTE(error); + return Engines::Component::_nil() ; + } + + // --- create instance + Engines::Component_var iobject = Engines::Component::_nil() ; + try + { + _numInstanceMutex.lock() ; // lock on the instance number + _numInstance++ ; + int numInstance = _numInstance ; + _numInstanceMutex.unlock() ; + + char aNumI[12]; + sprintf( aNumI , "%d" , numInstance ) ; + string instanceName = aGenRegisterName + "_inst_" + aNumI ; + string component_registerName = + _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() ) ; + + // --- get reference & servant from id + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = Engines::Component::_narrow(obj) ; + + Engines_Component_i *servant = + dynamic_cast(_poa->reference_to_servant(iobject)); + ASSERT(servant); + servant->_remove_ref(); // compensate previous id_to_reference + _listInstances_map[instanceName] = iobject; + _cntInstances_map[aGenRegisterName] += 1; + bool ret_studyId = servant->setStudyId(studyId); + ASSERT(ret_studyId); + + // --- register the engine under the name + // containerName(.dir)/instanceName(.object) + _NS->Register(iobject , component_registerName.c_str()) ; + MESSAGE( component_registerName.c_str() << " bound" ) ; + } + catch (...) + { + INFOS( "Container_i::createInstance exception catched" ) ; + } + return iobject._retn(); +} + +Engines::Component_ptr +Engines_Parallel_Container_i::createParallelInstance(string genericRegisterName, + void *handle, + int studyId) +{ + cerr << "----------------- createParallelInstance node : " << getMyRank() << endl; + // --- create instance + Engines::Component_var iobject = Engines::Component::_nil(); + string aGenRegisterName = genericRegisterName; + + ////////////////////////////////////////////////////////////////////////// + // 1: Proxy Step + // Node 0 create the proxy + if (getMyRank() == 0) { + // --- find the factory + string factory_name = aGenRegisterName + string("EngineProxy_factory"); + + typedef PortableServer::ObjectId * (*FACTORY_FUNCTION) + (CORBA::ORB_ptr, + paco_fabrique_thread *, + PortableServer::POA_ptr, + PortableServer::ObjectId *, + const char *, + int) ; + + FACTORY_FUNCTION Component_factory + = (FACTORY_FUNCTION) dlsym(handle, factory_name.c_str()); + + char *error ; + if ( (error = dlerror() ) != NULL) { + INFOS("Can't resolve symbol: " + factory_name); + SCRUTE(error); + return Engines::Component::_nil(); + } + try { + _numInstanceMutex.lock() ; // lock on the instance number + _numInstance++ ; + int numInstance = _numInstance ; + _numInstanceMutex.unlock() ; + + char aNumI[12]; + sprintf( aNumI , "%d" , numInstance ) ; + string instanceName = aGenRegisterName + "_inst_" + aNumI ; + string component_registerName = + _containerName + "/" + instanceName; + + // --- Instanciate required CORBA object + PortableServer::ObjectId *id ; //not owner, do not delete (nore use var) + id = (Component_factory) ( _orb, new paco_omni_fabrique(), _poa, _id, instanceName.c_str(), getTotalNode()) ; + + // --- get reference & servant from id + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = Engines::Component::_narrow(obj) ; + + _listInstances_map[instanceName] = iobject; + _cntInstances_map[aGenRegisterName] += 1; + + // --- register the engine under the name + // containerName(.dir)/instanceName(.object) + _NS->Register(iobject , component_registerName.c_str()) ; + MESSAGE( component_registerName.c_str() << " bound" ) ; + } + catch (...) + { + INFOS( "Container_i::createParallelInstance exception catched in Proxy creation" ) ; + } + } + else { + // We have to have the same numIntance to be able to get the proxy reference + // in the nameing service. + _numInstanceMutex.lock() ; // lock on the instance number + _numInstance++ ; + // int numInstance = _numInstance ; + _numInstanceMutex.unlock() ; + } + cerr << "Node " << getMyRank() << " entering in paco_barrier()" << endl; + _my_com->paco_barrier(); + cerr << "Node " << getMyRank() << " quitting paco_barrier()" << endl; + + ////////////////////////////////////////////////////////////////////////// + // 2: Nodes Step + + char * proxy_ior; + Engines::Component_PaCO_var iobject2; + + char aNumI[12]; + sprintf( aNumI , "%d" , _numInstance ) ; + string instanceName = aGenRegisterName + "_inst_" + aNumI ; + + string component_registerName = _containerName + "/" + instanceName; + string hostname = GetHostname(); + + CORBA::Object_var temp = _NS->Resolve(component_registerName.c_str()); + Engines::Component_var obj_proxy = Engines::Component::_narrow(temp); + proxy_ior = _orb->object_to_string(obj_proxy); + + // --- find the factory + string factory_name = aGenRegisterName + string("Engine_factory"); + + typedef PortableServer::ObjectId * (*FACTORY_FUNCTION) + (CORBA::ORB_ptr, char *, int, + PortableServer::POA_ptr, + PortableServer::ObjectId *, + const char *, + const char *) ; + + FACTORY_FUNCTION Component_factory + = (FACTORY_FUNCTION) dlsym(handle, factory_name.c_str()); + + char *error ; + if ( (error = dlerror() ) != NULL) + { + INFOS("Can't resolve symbol: " + factory_name); + SCRUTE(error); + return Engines::Component::_nil() ; + } + try + { + char aNumI2[12]; + sprintf(aNumI2 , "%d" , getMyRank()) ; + string instanceName = aGenRegisterName + "_inst_node_" + aNumI2; + string component_registerName = _containerName + aNumI2 + "/" + instanceName; + + // --- Instanciate required CORBA object + + PortableServer::ObjectId *id ; //not owner, do not delete (nore use var) + id = (Component_factory) ( _orb, proxy_ior, getMyRank(), _poa, _id, instanceName.c_str(), + aGenRegisterName.c_str() ) ; + + // --- get reference & servant from id + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject2 = Engines::Component_PaCO::_narrow(obj) ; + + // --- register the engine under the name + _NS->Register(iobject2 , component_registerName.c_str()) ; + MESSAGE( component_registerName.c_str() << " bound" ) ; + } + catch (...) + { + INFOS( "Container_i::createParallelInstance exception catched" ) ; + } + + ////////////////////////////////////////////////////////////////////////// + // 3: Deployment Step + + iobject2->deploy(); + _my_com->paco_barrier(); + cerr << "--------- createParallelInstance : End Deploy step ----------" << endl; + if (getMyRank() == 0) { + PaCO::InterfaceManager_var proxy = PaCO::InterfaceManager::_narrow(iobject); + proxy->start(); + _my_com->paco_barrier(); + } + else + _my_com->paco_barrier(); + + return iobject._retn(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void Engines_Parallel_Container_i::decInstanceCnt(string genericRegisterName) +{ + string aGenRegisterName =genericRegisterName; + MESSAGE("Engines_Parallel_Container_i::decInstanceCnt " << aGenRegisterName); + ASSERT(_cntInstances_map[aGenRegisterName] > 0); + _numInstanceMutex.lock(); // lock to be alone + // (see finalize_removal, load_component_Library) + _cntInstances_map[aGenRegisterName] -= 1; + SCRUTE(_cntInstances_map[aGenRegisterName]); + if (_cntInstances_map[aGenRegisterName] == 0) + { + string impl_name = + Engines_Component_i::GetDynLibraryName(aGenRegisterName.c_str()); + SCRUTE(impl_name); + void* handle = _library_map[impl_name]; + ASSERT(handle); + _toRemove_map[impl_name] = handle; + } + _numInstanceMutex.unlock(); +} + +//============================================================================= +/*! + * Retrieves only with container naming convention if it is a python container + */ +//============================================================================= + +bool Engines_Parallel_Container_i::isPythonContainer(const char* ContainerName) +{ + bool ret=false; + int len=strlen(ContainerName); + if(len>=2) + if(strcmp(ContainerName+len-2,"Py")==0) + ret=true; + return ret; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void ActSigIntHandler() +{ +#ifndef WNT + struct sigaction SigIntAct ; + SigIntAct.sa_sigaction = &SigIntHandler ; + SigIntAct.sa_flags = SA_SIGINFO ; +#endif + + // DEBUG 03.02.2005 : the first parameter of sigaction is not a mask of signals + // (SIGINT | SIGUSR1) : + // it must be only one signal ===> one call for SIGINT + // and an other one for SIGUSR1 +#ifndef WNT + if ( sigaction( SIGINT , &SigIntAct, NULL ) ) { + perror("SALOME_Container main ") ; + exit(0) ; + } + if ( sigaction( SIGUSR1 , &SigIntAct, NULL ) ) { + perror("SALOME_Container main ") ; + exit(0) ; + } + //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 : + // streams of C++ are naturally thread-safe and use pthread_mutex_lock ===> + // A stream operation may be interrupted by a signal and if the Handler use stream we + // may have a "Dead-Lock" ===HangUp + //==INFOS is commented + // INFOS(pthread_self() << "SigIntHandler activated") ; +#else + signal( SIGINT, SigIntHandler ); + signal( SIGUSR1, SigIntHandler ); +#endif + +} + +void SetCpuUsed() ; + +#ifndef WNT +void SigIntHandler(int what , 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 : + // streams of C++ are naturally thread-safe and use pthread_mutex_lock ===> + // A stream operation may be interrupted by a signal and if the Handler use stream we + // may have a "Dead-Lock" ===HangUp + //==MESSAGE is commented + // MESSAGE(pthread_self() << "SigIntHandler what " << what << endl + // << " si_signo " << siginfo->si_signo << endl + // << " si_code " << siginfo->si_code << endl + // << " si_pid " << siginfo->si_pid) ; + if ( _Sleeping ) { + _Sleeping = false ; + // MESSAGE("SigIntHandler END sleeping.") ; + return ; + } + else { + ActSigIntHandler() ; + if ( siginfo->si_signo == SIGUSR1 ) { + SetCpuUsed() ; + } + else { + _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 ) { + MESSAGE( pthread_self() << "SigIntHandler what " << what << endl ); + if ( _Sleeping ) { + _Sleeping = false ; + MESSAGE("SigIntHandler END sleeping.") ; + return ; + } + else { + ActSigIntHandler() ; + if ( what == SIGUSR1 ) { + SetCpuUsed() ; + } + else { + _Sleeping = true ; + MESSAGE("SigIntHandler BEGIN sleeping.") ; + int count = 0 ; + while( _Sleeping ) { + Sleep( 1000 ) ; + count += 1 ; + } + MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ; + } + return ; + } +} +#endif + +//============================================================================= +/*! + * CORBA method: get or create a fileRef object associated to a local file + * (a file on the computer on which runs the container server), which stores + * a list of (machine, localFileName) corresponding to copies already done. + * + * \param origFileName absolute path for a local file to copy on other + * computers + * \return a fileRef object associated to the file. + */ +//============================================================================= + +Engines::fileRef_ptr +Engines_Parallel_Container_i::createFileRef(const char* origFileName) +{ + string origName(origFileName); + Engines::fileRef_var theFileRef = Engines::fileRef::_nil(); + + if (origName[0] != '/') + { + INFOS("path of file to copy must be an absolute path begining with '/'"); + return Engines::fileRef::_nil(); + } + + if (CORBA::is_nil(_fileRef_map[origName])) + { + CORBA::Object_var obj=_poa->id_to_reference(*_id); + Engines::Container_var pCont = Engines::Container::_narrow(obj); + fileRef_i* aFileRef = new fileRef_i(pCont, origFileName); + theFileRef = Engines::fileRef::_narrow(aFileRef->_this()); + _numInstanceMutex.lock() ; // lock to be alone (stl container write) + _fileRef_map[origName] = theFileRef; + _numInstanceMutex.unlock() ; + } + + theFileRef = Engines::fileRef::_duplicate(_fileRef_map[origName]); + ASSERT(! CORBA::is_nil(theFileRef)); + return theFileRef._retn(); +} + +//============================================================================= +/*! + * CORBA method: + * \return a reference to the fileTransfer object + */ +//============================================================================= + +Engines::fileTransfer_ptr +Engines_Parallel_Container_i::getFileTransfer() +{ + Engines::fileTransfer_var aFileTransfer + = Engines::fileTransfer::_duplicate(_fileTransfer); + return aFileTransfer._retn(); +} + + +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; +} + +//============================================================================= +/*! + * CORBA attribute: Container working directory + */ +//============================================================================= + +char* +Engines_Parallel_Container_i::workingdir() +{ + char wd[256]; + getcwd (wd,256); + return CORBA::string_dup(wd) ; +} + +//============================================================================= +/*! + * CORBA attribute: Container log file name + */ +//============================================================================= + +char* +Engines_Parallel_Container_i::logfilename() +{ + return CORBA::string_dup(_logfilename.c_str()) ; +} + +void +Engines_Parallel_Container_i::logfilename(const char* name) +{ + _logfilename=name; +} diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx new file mode 100644 index 000000000..34d980fdb --- /dev/null +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx @@ -0,0 +1,167 @@ +// SALOME_ParallelContainer : implementation of container and engine for Parallel Kernel +// +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// File : SALOME_ParallelContainer_i.hxx +// Author : André RIBES, EDF +// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA + +#ifndef _SALOME_PARALLEL_CONTAINER_I_HXX_ +#define _SALOME_PARALLEL_CONTAINER_I_HXX_ + +#include + +#include "SALOME_ComponentPaCO_Engines_Container_server.h" + +#include +#include +#include +#ifndef WNT +#include +#endif +#include +#include +#include +#include + +class SALOME_NamingService; + + +#if defined CONTAINER_EXPORTS +#if defined WIN32 +#define CONTAINER_EXPORT __declspec( dllexport ) +#else +#define CONTAINER_EXPORT +#endif +#else +#if defined WNT +#define CONTAINER_EXPORT __declspec( dllimport ) +#else +#define CONTAINER_EXPORT +#endif +#endif + +class CONTAINER_EXPORT Engines_Parallel_Container_i: + /* public virtual POA_Engines::Container, */ + public Engines::Container_serv, + public virtual PortableServer::RefCountServantBase +{ +public: + Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior, int rank); + Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior, int rank, + PortableServer::POA_ptr poa, + char * containerName , + int argc, char* argv[], + bool activAndRegist = true, + bool isServantAloneInProcess = true); + virtual ~Engines_Parallel_Container_i(); + + // --- CORBA methods + + virtual bool load_component_Library(const char* componentName); + + virtual Engines::Component_ptr + create_component_instance( const char* componentName, + CORBA::Long studyId); // 0 for multiStudy + + Engines::Component_ptr + find_component_instance( const char* registeredName, + CORBA::Long studyId); // 0 for multiStudy + + Engines::Component_ptr + load_impl(const char* nameToRegister, + const char* componentName); + + + void remove_impl(Engines::Component_ptr component_i); + void finalize_removal(); + + virtual void ping(); + char* name(); + char* workingdir(); + char* logfilename(); + void logfilename(const char* name); + + virtual void Shutdown(); + char* getHostName(); + CORBA::Long getPID(); + //! Kill current container + bool Kill_impl() ; + + // --- local C++ methods + + Engines::Component_ptr + find_or_create_instance( std::string genericRegisterName, + std::string componentLibraryName); + + Engines::Component_ptr + createInstance(std::string genericRegisterName, + void *handle, + int studyId); + + Engines::Component_ptr + createParallelInstance(std::string genericRegisterName, + void *handle, + int studyId); + + static bool isPythonContainer(const char* ContainerName); + static void decInstanceCnt(std::string genericRegisterName); + + // --- needed for parallel components, Numerical Platon + + int getArgc() { return _argc; } + char **getArgv() { return _argv; } + + void set_id(PortableServer::ObjectId * id) { _id = id;} + + 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; + static std::map _library_map; // library names, loaded + static std::map _toRemove_map;// library names to remove + static omni_mutex _numInstanceMutex ; // lib and instance protection + + bool _isSupervContainer; + + SALOME_NamingService *_NS ; + std::string _library_path; + std::string _containerName; + std::string _logfilename; + CORBA::ORB_var _orb; + PortableServer::POA_var _poa; + PortableServer::ObjectId * _id ; + int _numInstance ; + std::map _listInstances_map; + std::map _fileRef_map; + std::map _Salome_file_map; + Engines::fileTransfer_var _fileTransfer; + + int _argc ; + char** _argv ; + long _pid; + bool _isServantAloneInProcess; +}; + +#endif + diff --git a/src/Registry/Makefile.am b/src/Registry/Makefile.am index 6258de831..136b5df88 100644 --- a/src/Registry/Makefile.am +++ b/src/Registry/Makefile.am @@ -31,7 +31,8 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # header files salomeinclude_HEADERS =\ RegistryConnexion.hxx \ - RegistryService.hxx + RegistryService.hxx \ + SALOME_Registry.hxx # Libraries targets lib_LTLIBRARIES = libRegistry.la diff --git a/src/Registry/RegistryConnexion.hxx b/src/Registry/RegistryConnexion.hxx index 9dc8ac287..510196d3f 100644 --- a/src/Registry/RegistryConnexion.hxx +++ b/src/Registry/RegistryConnexion.hxx @@ -33,24 +33,12 @@ # if !defined( __RegistryConnexion_HXX__ ) # define __RegistryConnexion_HXX__ +#include + #include #include CORBA_CLIENT_HEADER(SALOME_Registry) #include -#if defined REGISTRY_EXPORTS -#if defined WIN32 -#define REGISTRY_EXPORT __declspec( dllexport ) -#else -#define REGISTRY_EXPORT -#endif -#else -#if defined WNT -#define REGISTRY_EXPORT __declspec( dllimport ) -#else -#define REGISTRY_EXPORT -#endif -#endif - class REGISTRY_EXPORT RegistryConnexion { protected : 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 b52fa758d..9b26f41f8 100644 --- a/src/Registry/RegistryService.hxx +++ b/src/Registry/RegistryService.hxx @@ -29,25 +29,13 @@ # ifndef __RegistryService_h__ # define __RegistryService_h__ +#include + #include #include CORBA_SERVER_HEADER(SALOME_Registry) # include -#if defined REGISTRY_EXPORTS -#if defined WIN32 -#define REGISTRY_EXPORT __declspec( dllexport ) -#else -#define REGISTRY_EXPORT -#endif -#else -#if defined WNT -#define REGISTRY_EXPORT __declspec( dllimport ) -#else -#define REGISTRY_EXPORT -#endif -#endif - class REGISTRY_EXPORT RegistryService : public POA_Registry::Components //, public PortableServer::RefCountServantBase { @@ -84,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 @@ -100,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 new file mode 100755 index 000000000..4ca01a2c7 --- /dev/null +++ b/src/Registry/SALOME_Registry.hxx @@ -0,0 +1,48 @@ +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_Registry.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOME_Registry_HXX_ +#define _SALOME_Registry_HXX_ + +#ifdef WNT + #if defined REGISTRY_EXPORTS + #if defined WIN32 + #define REGISTRY_EXPORT __declspec( dllexport ) + #else + #define REGISTRY_EXPORT + #endif + #else + #if defined WIN32 + #define REGISTRY_EXPORT __declspec( dllimport ) + #else + #define REGISTRY_EXPORT + #endif + #endif +#else + #define REGISTRY_EXPORT +#endif + +#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 eaa49f92a..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_MT_INCLUDES@ + $(COMMON_CPPFLAGS) + libSalomeResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeResourcesManager_la_LIBADD =\ - $(COMMON_LIBS) \ - @QT_MT_LIBS@ + $(COMMON_LIBS) diff --git a/src/ResourcesManager/SALOME_LoadRateManager.cxx b/src/ResourcesManager/SALOME_LoadRateManager.cxx index 5841ced68..f0df795cb 100644 --- a/src/ResourcesManager/SALOME_LoadRateManager.cxx +++ b/src/ResourcesManager/SALOME_LoadRateManager.cxx @@ -20,16 +20,80 @@ #include "SALOME_LoadRateManager.hxx" #include "utilities.h" #include +#include using namespace std; -string SALOME_LoadRateManager::FindBest(const Engines::MachineList& hosts) +string SALOME_LoadRateManager::FindFirst(const Engines::MachineList& hosts) { - // for the moment then "maui" will be used for dynamic selection ... - MESSAGE("SALOME_LoadRateManager::FindBest " << hosts.length()); + MESSAGE("SALOME_LoadRateManager::FindFirst " << hosts.length()); if (hosts.length() == 0) return string(""); return string(hosts[0]); } + +string SALOME_LoadRateManager::FindNext(const Engines::MachineList& hosts,MapOfParserResourcesType& resList,SALOME_NamingService *ns) +{ + MESSAGE("SALOME_LoadRateManager::FindNext " << hosts.length()); + map machines; + + if (hosts.length() == 0) + return string(""); + + for(int i=0;iChange_Directory("/Containers"); + vector vec = ns->list_directory_recurs(); + Engines::Container_var cont; + for(vector::iterator iter = vec.begin();iter!=vec.end();iter++){ + 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)){ + 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; + 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 #if defined WIN32 @@ -43,7 +44,9 @@ class RESOURCESMANAGER_EXPORT SALOME_LoadRateManager { public: - std::string FindBest(const Engines::MachineList& hosts); + std::string FindFirst(const Engines::MachineList& hosts); + std::string FindNext(const Engines::MachineList& hosts,MapOfParserResourcesType& resList,SALOME_NamingService *ns); + std::string FindBest(const Engines::MachineList& hosts) throw (SALOME_Exception); }; #endif diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index e08f5960a..0b85c6bfb 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,312 +91,329 @@ 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).latin1()); + 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)) { - - case 'i': - _resource.Mode = interactive; - break; - - case 'b': - _resource.Mode = batch; - break; - - default: - // If it'not in all theses cases, the mode is affected to interactive - _resource.Mode = interactive; - break; + xmlChar* alias = xmlGetProp(aCurNode, (const xmlChar*)test_alias); + _resource.Alias = (const char*)alias; + xmlFree(alias); } - } - - 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; + else + _resource.Alias = ""; - 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 (xmlHasProp(aCurNode, (const xmlChar*)test_protocol)) + { + 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); + } + else + _resource.Protocol = rsh; + + if (xmlHasProp(aCurNode, (const xmlChar*)test_mode)) + { + xmlChar* mode=xmlGetProp(aCurNode, (const xmlChar*)test_mode); + switch ( mode[0] ) + { + case 'i': + _resource.Mode = interactive; + break; + 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); + } + else + _resource.Mode = interactive; - 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)) - _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 = (const char *)chars ; - 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; + // For debug only + if (MYDEBUG) + { + 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.OS); + SCRUTE((*iter).second.Protocol); + SCRUTE((*iter).second.Mode); + } + + MESSAGE("This is the end of document"); + } } -//============================================================================= -/*! - * 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() ); - - 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 9e9c57da4..ea88da8f8 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,52 @@ 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/CatalogResources.xml + * ${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; if (_isAppliSalomeDefined) { @@ -87,10 +111,11 @@ SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb) else { _path_resources = getenv("KERNEL_ROOT_DIR"); - _path_resources += "/share/salome/resources/CatalogResources.xml"; + _path_resources += "/share/salome/resources/kernel/CatalogResources.xml"; } ParseXmlFile(); + MESSAGE("constructor end"); } //============================================================================= @@ -101,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(); } //============================================================================= @@ -118,86 +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; - // --- To be sure that we search in a correct list. - ParseXmlFile(); + try{ + // --- 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 - { - // --- 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(); + INFOS("Caught exception."); + THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::BAD_PARAM); + //return ret; + } - 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; } @@ -211,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()) { @@ -230,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; @@ -265,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( IO_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!"); } @@ -295,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 "<ContainerName(params); - command += "_"; - command += GetHostname(); - command += "_"; - command += getenv( "USER" ) ; - command += ".log 2>&1 &" ; MESSAGE("command =" << command); } @@ -471,7 +585,6 @@ SALOME_ResourcesManager::BuildCommandToLaunchRemoteContainer return command; } - //============================================================================= /*! * builds the command to be launched. @@ -517,10 +630,32 @@ SALOME_ResourcesManager::BuildCommandToLaunchLocalContainer else { + command=""; + std::string wdir=params.workingdir.in(); + std::cerr << wdir << std::endl; + if(wdir != "") + { + // a working directory is requested + if(wdir == "$TEMPDIR") + { + // a new temporary directory is requested + char dir[]="/tmp/salomeXXXXXX"; + char* mdir=mkdtemp(dir); + if(mdir==NULL) + std::cerr << "Problem in mkdtemp " << dir << " " << mdir << std::endl; + else + command="cd "+std::string(dir)+";"; + } + else + { + // a permanent directory is requested use it or create it + command="mkdir -p " + wdir + " && cd " + wdir + ";"; + } + } if (isPythonContainer(params.container_name)) - command = "SALOME_ContainerPy.py "; + command += "SALOME_ContainerPy.py "; else - command = "SALOME_Container "; + command += "SALOME_Container "; } command += _NS->ContainerName(params); @@ -529,13 +664,7 @@ SALOME_ResourcesManager::BuildCommandToLaunchLocalContainer command += idc; command += " -"; AddOmninamesParams(command); - command += " > /tmp/"; - command += _NS->ContainerName(params); - command += "_"; - command += GetHostname(); - command += "_"; - command += getenv( "USER" ) ; - command += ".log 2>&1 &" ; + MESSAGE("Command is ... " << command); return command; } @@ -551,7 +680,11 @@ void SALOME_ResourcesManager::RmTmpFile() { if (_TmpFileName != "") { +#ifndef WNT string command = "rm "; +#else + string command = "del /F "; +#endif command += _TmpFileName; char *temp = strdup(command.c_str()); int lgthTemp = strlen(temp); @@ -589,7 +722,7 @@ SALOME_ResourcesManager::BuildCommand command += machine; command += " "; - string path = (*(resInfo.ModulesPath.find("KERNEL"))).second; + string path = getenv("KERNEL_ROOT_DIR"); command += path; command += "/bin/salome/"; @@ -601,11 +734,6 @@ SALOME_ResourcesManager::BuildCommand command += containerName; command += " -"; AddOmninamesParams(command); - command += " > /tmp/"; - command += containerName; - command += "_"; - command += machine; - command += ".log 2>&1 &" ; SCRUTE( command ); return command; @@ -648,17 +776,29 @@ throw(SALOME_Exception) void SALOME_ResourcesManager::KeepOnlyResourcesWithModule ( vector& 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++; @@ -693,7 +833,7 @@ void SALOME_ResourcesManager::AddOmninamesParams(string& command) const //} //command += nameservice ; - char *iorstr = _NS->getIORaddr(); + CORBA::String_var iorstr = _NS->getIORaddr(); command += "ORBInitRef NameService="; command += iorstr; } @@ -707,24 +847,9 @@ void SALOME_ResourcesManager::AddOmninamesParams(string& command) const void SALOME_ResourcesManager::AddOmninamesParams(ofstream& fileStream) const { - string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ; - ifstream omniORBfile( omniORBcfg.c_str() ) ; - char ORBInitRef[11] ; - char egal[3] ; - char nameservice[132] ; - omniORBfile >> ORBInitRef ; - fileStream << "ORBInitRef "; - omniORBfile >> egal ; - omniORBfile >> nameservice ; - omniORBfile.close() ; - char * bsn = strchr( nameservice , '\n' ) ; - - if ( bsn ) - { - bsn[ 0 ] = '\0' ; - } - - fileStream << nameservice; + CORBA::String_var iorstr = _NS->getIORaddr(); + fileStream << "ORBInitRef NameService="; + fileStream << iorstr; } @@ -770,8 +895,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 ); @@ -780,27 +907,7 @@ 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; // ! env vars @@ -827,8 +934,7 @@ SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer #endif } - tempOutputFile << (*(resInfo.ModulesPath.find("KERNEL"))).second - << "/bin/salome/"; + tempOutputFile << getenv("KERNEL_ROOT_DIR") << "/bin/salome/"; if (params.isMPI) { @@ -866,30 +972,219 @@ SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer commandRcp += machine; commandRcp += ":"; commandRcp += _TmpFileName; - system(commandRcp.c_str()); + status = system(commandRcp.c_str()); } else if (resInfo.Protocol == ssh) - command = "ssh "; + { + command = "ssh "; + string commandRcp = "scp "; + commandRcp += _TmpFileName; + commandRcp += " "; + commandRcp += machine; + commandRcp += ":"; + commandRcp += _TmpFileName; + 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 += " "; command += _TmpFileName; - command += " > "; - command += "/tmp/"; - command += _NS->ContainerName(params); - command += "_"; - command += machine; - command += ".log 2>&1 &"; + SCRUTE(command); return command; } +//============================================================================= +/*! Creates a command line that the container manager uses to launch + * a parallel container. + */ +//============================================================================= +string +SALOME_ResourcesManager::BuildCommandToLaunchLocalParallelContainer(const std::string& exe_name, + const Engines::MachineParameters& params, + const std::string& log) +{ + // This method knows the differences between the proxy and the nodes. + // nb_component_nodes is not used in the same way if it is a proxy or + // a node. + + string command; + string parallelLib(CORBA::string_dup(params.parallelLib)); + string hostname(CORBA::string_dup(params.hostname)); + int par = exe_name.find("Proxy"); + int nbproc = params.nb_component_nodes; + char buffer [33]; + sprintf(buffer,"%d",nbproc); + + Engines::MachineParameters_var rtn = new Engines::MachineParameters(); + rtn->container_name = params.container_name; + rtn->hostname = params.hostname; + rtn->OS = params.OS; + rtn->mem_mb = params.mem_mb; + rtn->cpu_clock = params.cpu_clock; + rtn->nb_proc_per_node = params.nb_proc_per_node; + rtn->nb_node = params.nb_node; + rtn->isMPI = params.isMPI; + + string real_exe_name = exe_name + parallelLib; + + if (parallelLib == "Dummy") + { + //command = "gdb --args "; + //command = "valgrind --tool=memcheck --log-file=val_log "; + //command += real_exe_name; + + command = real_exe_name; + command += " " + _NS->ContainerName(rtn); + command += " " + parallelLib; + command += " " + hostname; + command += " -"; + AddOmninamesParams(command); + } + + else if (parallelLib == "Mpi") + { + // Step 1 : check if MPI is started + if (_MpiStarted == false) + { + startMPI(); + } + if (par < 0) + { + // Nodes case + + command = "mpiexec -np " + string(buffer) + " "; +// command += "gdb --args "; + command += real_exe_name; + command += " " + _NS->ContainerName(rtn); + command += " " + parallelLib; + command += " " + hostname; + command += " -"; + AddOmninamesParams(command); + } + else + { + // Proxy case + command = "mpiexec -np 1 "; + command += real_exe_name; + command += " " + _NS->ContainerName(rtn); + command += " " + string(buffer); + command += " " + parallelLib; + command += " " + hostname; + command += " -"; + AddOmninamesParams(command); + } + } + else + { + std::string message("Unknown parallelLib" + parallelLib); + throw SALOME_Exception(message.c_str()); + } + // log choice + if (log == "default") + { + command += " > /tmp/"; + command += _NS->ContainerName(rtn); + command += "_"; + command += GetHostname(); + command += "_"; + command += getenv( "USER" ) ; + command += ".log 2>&1 &" ; + } + if (log == "xterm") + { + command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; " + + command + " \" &"; +// + command + "; echo $LD_LIBRARY_PATH; cat \" &"; + } + return command; + +/* if (log == "xterm") + { + command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; echo $LD_LIBRARY_PATH; echo $PATH; " + command + "; cat \" &"; + } +*/ +/* command = "cd ; rm " + fichier_commande + "; touch " + \ + fichier_commande + "; echo \" export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; " + \ + command + " >& /tmp/ribes_" + fichier_commande + " & \" > " + fichier_commande + ";"; + command += "ssh cn01 sh " + fichier_commande + " &"; + cerr << "La commande : " << command << endl; +*/ +} + +void SALOME_ResourcesManager::startMPI() +{ + cerr << "----------------------------------------------" << endl; + cerr << "----------------------------------------------" << endl; + cerr << "----------------------------------------------" << endl; + cerr << "-Only Lam on Localhost is currently supported-" << endl; + cerr << "----------------------------------------------" << endl; + cerr << "----------------------------------------------" << endl; + cerr << "----------------------------------------------" << endl; + + int status = system("lamboot"); + if (status == -1) + { + INFOS("lamboot failed : system command status -1"); + } + else if (status == 217) + { + INFOS("lamboot failed : system command status 217"); + } + else + { + _MpiStarted = true; + } +} + +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 34a8a93d4..23c7bd647 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.hxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.hxx @@ -31,8 +31,6 @@ #include #include - - #if defined RESOURCESMANAGER_EXPORTS #if defined WIN32 #define RESOURCESMANAGER_EXPORT __declspec( dllexport ) @@ -53,21 +51,25 @@ // 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); + char* FindFirst(const Engines::MachineList& listOfMachines); + std::string FindNext(const Engines::MachineList& listOfMachines); std::string FindBest(const Engines::MachineList& listOfMachines); std::string BuildCommandToLaunchRemoteContainer @@ -84,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, @@ -100,19 +101,36 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager const MapOfParserResourcesType& GetList() const; + // Parallel extension + 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 + void startMPI(); + 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; @@ -121,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 00ead570a..37686d204 100644 --- a/src/SALOMEDS/Makefile.am +++ b/src/SALOMEDS/Makefile.am @@ -41,7 +41,8 @@ salomeinclude_HEADERS= \ SALOMEDS_SComponent.hxx \ SALOMEDS_GenericAttribute_i.hxx \ SALOMEDS_GenericAttribute.hxx \ - SALOMEDS_IParameters.hxx + SALOMEDS_IParameters.hxx \ + SALOMEDS_Defines.hxx # Scripts to be installed dist_salomescript_DATA = SALOME_DriverPy.py @@ -54,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 \ @@ -70,9 +71,6 @@ COMMON_CPPFLAGS=\ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ -# 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 =\ ../TOOLSDS/libTOOLSDS.la \ @@ -81,13 +79,12 @@ 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) + @HDF5_LIBS@ #LDFLAGS+= -lSalomeGenericObj -lSalomeLifeCycleCORBA @@ -140,6 +137,7 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_AttributeStudyProperties_i.cxx \ SALOMEDS_AttributePythonObject_i.cxx \ SALOMEDS_AttributeParameter_i.cxx \ + SALOMEDS_AttributeString_i.cxx \ SALOMEDS_SObject.cxx \ SALOMEDS_SComponent.cxx \ SALOMEDS_GenericAttribute.cxx \ @@ -180,31 +178,8 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_AttributeUserID.cxx \ SALOMEDS_TMPFile_i.cxx \ 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 \ @@ -270,37 +245,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 \ @@ -309,19 +261,14 @@ 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 \ SALOMEDS_UseCaseIterator_i.hxx \ SALOMEDS_AttributeParameter.hxx \ SALOMEDS_AttributeParameter_i.hxx \ + SALOMEDS_AttributeString.hxx \ + SALOMEDS_AttributeString_i.hxx \ SALOMEDS_TMPFile_i.hxx libSalomeDS_la_CPPFLAGS = $(COMMON_CPPFLAGS) @@ -337,17 +284,10 @@ 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 \ + $(HDF5_LIBS) $(CORBA_LIBS) 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 \ + $(HDF5_LIBS) $(CORBA_LIBS) 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.cxx b/src/SALOMEDS/SALOMEDS.cxx index aaa0fa97b..57c00c16f 100644 --- a/src/SALOMEDS/SALOMEDS.cxx +++ b/src/SALOMEDS/SALOMEDS.cxx @@ -50,6 +50,8 @@ #include "SALOMEDS_StudyManager_i.hxx" #endif +#include "SALOMEDS_Defines.hxx" + // IDL headers #include #include CORBA_SERVER_HEADER(SALOMEDS) @@ -91,37 +93,41 @@ void SALOMEDS::unlock() extern "C" { - -SALOMEDSClient_StudyManager* StudyManagerFactory() +SALOMEDS_EXPORT + SALOMEDSClient_StudyManager* StudyManagerFactory() { return new SALOMEDS_StudyManager(); } - -SALOMEDSClient_Study* StudyFactory(SALOMEDS::Study_ptr theStudy) +SALOMEDS_EXPORT + SALOMEDSClient_Study* StudyFactory(SALOMEDS::Study_ptr theStudy) { if(CORBA::is_nil(theStudy)) return NULL; return new SALOMEDS_Study(theStudy); } -SALOMEDSClient_SObject* SObjectFactory(SALOMEDS::SObject_ptr theSObject) +SALOMEDS_EXPORT + SALOMEDSClient_SObject* SObjectFactory(SALOMEDS::SObject_ptr theSObject) { if(CORBA::is_nil(theSObject)) return NULL; return new SALOMEDS_SObject(theSObject); } -SALOMEDSClient_SComponent* SComponentFactory(SALOMEDS::SComponent_ptr theSComponent) +SALOMEDS_EXPORT + SALOMEDSClient_SComponent* SComponentFactory(SALOMEDS::SComponent_ptr theSComponent) { if(CORBA::is_nil(theSComponent)) return NULL; return new SALOMEDS_SComponent(theSComponent); } -SALOMEDSClient_StudyBuilder* BuilderFactory(SALOMEDS::StudyBuilder_ptr theBuilder) +SALOMEDS_EXPORT + SALOMEDSClient_StudyBuilder* BuilderFactory(SALOMEDS::StudyBuilder_ptr theBuilder) { if(CORBA::is_nil(theBuilder)) return NULL; return new SALOMEDS_StudyBuilder(theBuilder); } -SALOMEDSClient_StudyManager* CreateStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa) +SALOMEDS_EXPORT + SALOMEDSClient_StudyManager* CreateStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa) { SALOME_NamingService namingService(orb); CORBA::Object_var obj = namingService.Resolve( "/myStudyManager" ); @@ -130,18 +136,21 @@ SALOMEDSClient_StudyManager* CreateStudyManager(CORBA::ORB_ptr orb, PortableServ SALOMEDS_StudyManager_i * aStudyManager_i = new SALOMEDS_StudyManager_i(orb, root_poa); // Activate the objects. This tells the POA that the objects are ready to accept requests. PortableServer::ObjectId_var aStudyManager_iid = root_poa->activate_object(aStudyManager_i); + //give ownership to the poa : the object will be deleted by the poa + aStudyManager_i->_remove_ref(); aStudyManager_i->register_name("/myStudyManager"); } return new SALOMEDS_StudyManager(); } -SALOMEDSClient_IParameters* GetIParameters(const _PTR(AttributeParameter)& ap) +SALOMEDS_EXPORT + SALOMEDSClient_IParameters* GetIParameters(const _PTR(AttributeParameter)& ap) { return new SALOMEDS_IParameters(ap); } - -SALOMEDS::SObject_ptr ConvertSObject(const _PTR(SObject)& theSObject) +SALOMEDS_EXPORT + SALOMEDS::SObject_ptr ConvertSObject(const _PTR(SObject)& theSObject) { SALOMEDS_SObject* so = _CAST(SObject, theSObject); @@ -149,14 +158,16 @@ SALOMEDS::SObject_ptr ConvertSObject(const _PTR(SObject)& theSObject) return so->GetSObject(); } -SALOMEDS::Study_ptr ConvertStudy(const _PTR(Study)& theStudy) +SALOMEDS_EXPORT + SALOMEDS::Study_ptr ConvertStudy(const _PTR(Study)& theStudy) { SALOMEDS_Study* study = _CAST(Study, theStudy); if(!theStudy || !study) return SALOMEDS::Study::_nil(); return study->GetStudy(); } -SALOMEDS::StudyBuilder_ptr ConvertBuilder(const _PTR(StudyBuilder)& theBuilder) +SALOMEDS_EXPORT + SALOMEDS::StudyBuilder_ptr ConvertBuilder(const _PTR(StudyBuilder)& theBuilder) { SALOMEDS_StudyBuilder* builder = _CAST(StudyBuilder, theBuilder); if(!theBuilder || !builder) return SALOMEDS::StudyBuilder::_nil(); diff --git a/src/SALOMEDS/SALOMEDS.hxx b/src/SALOMEDS/SALOMEDS.hxx index 2cebbf404..ca022bf4b 100644 --- a/src/SALOMEDS/SALOMEDS.hxx +++ b/src/SALOMEDS/SALOMEDS.hxx @@ -30,6 +30,8 @@ #ifndef SALOMEDS_HeaderFile #define SALOMEDS_HeaderFile +#include + #include namespace SALOMEDS @@ -43,7 +45,7 @@ namespace SALOMEDS // // Locker lock; // - class Locker : public Utils_Locker + class SALOMEDS_EXPORT Locker : public Utils_Locker { public: Locker(); 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 362308d7a..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,5 +40,6 @@ void SALOMEDS_AttributeIOR_i::SetValue(const char* value) SALOMEDS::Locker lock; CheckLocked(); CORBA::String_var Str = CORBA::string_dup(value); - Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str)); + 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 0be09d990..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 = (bool)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 e1f976734..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); } //======================================================================= @@ -61,11 +60,11 @@ CORBA::Long SALOMEDS_AttributeParameter_i::GetInt(const char* theID) * Purpose : Associates a double value with the ID */ //======================================================================= -void SALOMEDS_AttributeParameter_i::SetReal(const char* theID, const CORBA::Double theValue) +void SALOMEDS_AttributeParameter_i::SetReal(const char* theID, CORBA::Double theValue) { 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, const CORBA::Doub 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 df1ba297a..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() {}; @@ -51,7 +51,7 @@ public: virtual void SetInt(const char* theID, CORBA::Long theValue); virtual CORBA::Long GetInt(const char* theID); - virtual void SetReal(const char* theID, const CORBA::Double theValue); + virtual void SetReal(const char* theID, CORBA::Double theValue); virtual CORBA::Double GetReal(const char* theID); virtual void SetString(const char* theID, const char* theValue); 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 35e65d4a6..24f07d42c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributePythonObject.hxx @@ -33,15 +33,10 @@ #include CORBA_SERVER_HEADER(SALOMEDS) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -#ifdef GetObject -#undef GetObject -#endif - 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 83d7ecd01..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,21 +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; - char* aSeq = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->GetObject().ToCString(); - CORBA::String_var aStr = CORBA::string_dup(aSeq); + 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 new file mode 100644 index 000000000..6feb94ba6 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeString.cxx @@ -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 +// +// File : SALOMEDS_AttributeString.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDS_AttributeString.hxx" +#include "SALOMEDS.hxx" + +#include + +SALOMEDS_AttributeString::SALOMEDS_AttributeString(SALOMEDSImpl_AttributeString* theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeString::SALOMEDS_AttributeString(SALOMEDS::AttributeString_ptr theAttr) +:SALOMEDS_GenericAttribute(theAttr) +{} + +SALOMEDS_AttributeString::~SALOMEDS_AttributeString() +{} + +std::string SALOMEDS_AttributeString::Value() +{ + std::string aValue; + if (_isLocal) { + SALOMEDS::Locker lock; + aValue = dynamic_cast(_local_impl)->Value(); + } + else aValue = SALOMEDS::AttributeString::_narrow(_corba_impl)->Value(); + return aValue; +} + +void SALOMEDS_AttributeString::SetValue(const std::string& value) +{ + if (_isLocal) { + CheckLocked(); + SALOMEDS::Locker lock; + dynamic_cast(_local_impl)->SetValue(value); + } + else SALOMEDS::AttributeString::_narrow(_corba_impl)->SetValue(value.c_str()); +} diff --git a/src/CASCatch/CASCatch.hxx b/src/SALOMEDS/SALOMEDS_AttributeString.hxx similarity index 53% rename from src/CASCatch/CASCatch.hxx rename to src/SALOMEDS/SALOMEDS_AttributeString.hxx index 03541f951..8f7942903 100644 --- a/src/CASCatch/CASCatch.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeString.hxx @@ -17,39 +17,31 @@ // // 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 - +// File : SALOMEDS_AttributeString.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDS_AttributeString_HeaderFile +#define SALOMEDS_AttributeString_HeaderFile + +#include "SALOMEDSClient_AttributeString.hxx" +#include "SALOMEDS_GenericAttribute.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +class SALOMEDS_AttributeString: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeString +{ +public: + SALOMEDS_AttributeString(SALOMEDSImpl_AttributeString* theAttr); + SALOMEDS_AttributeString(SALOMEDS::AttributeString_ptr theAttr); + ~SALOMEDS_AttributeString(); + + virtual std::string Value(); + virtual void SetValue(const std::string& value); +}; #endif diff --git a/src/SALOMEDS/SALOMEDS_FileType.jxx b/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx similarity index 59% rename from src/SALOMEDS/SALOMEDS_FileType.jxx rename to src/SALOMEDS/SALOMEDS_AttributeString_i.cxx index 81932deae..468c9720d 100644 --- a/src/SALOMEDS/SALOMEDS_FileType.jxx +++ b/src/SALOMEDS/SALOMEDS_AttributeString_i.cxx @@ -17,21 +17,31 @@ // // 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 +// File : SALOMEDS_AttributeString_i.cxx +// Author : Sergey RUIN +// Module : SALOME + + +#include "SALOMEDS_AttributeString_i.hxx" + +#include "SALOMEDS_SObject_i.hxx" +#include "SALOMEDS.hxx" + +using namespace std; + +char* SALOMEDS_AttributeString_i::Value() +{ + SALOMEDS::Locker lock; + + CORBA::String_var c_s = + CORBA::string_dup(dynamic_cast(_impl)->Value().c_str()); + return c_s._retn(); +} + +void SALOMEDS_AttributeString_i::SetValue(const char* value) +{ + SALOMEDS::Locker lock; + + CheckLocked(); + dynamic_cast(_impl)->SetValue(string(value)); +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx b/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx similarity index 56% rename from src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx rename to src/SALOMEDS/SALOMEDS_AttributeString_i.hxx index 3f39b21e7..b95b5eb8f 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_OCAFApplication.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeString_i.hxx @@ -17,35 +17,31 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File : SALOMEDSImpl_OCAFApplication.hxx +// File : SALOMEDS_AttributeString_i.hxx // Author : Sergey RUIN // Module : SALOME -#ifndef _SALOMEDSImpl_OCAFApplication_HeaderFile -#define _SALOMEDSImpl_OCAFApplication_HeaderFile +#ifndef SALOMEDS_AttributeString_i_HeaderFile +#define SALOMEDS_AttributeString_i_HeaderFile +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) -//Handle definition -#include -#include -DEFINE_STANDARD_HANDLE( SALOMEDSImpl_OCAFApplication, TDocStd_Application) +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" -#include -#include +class SALOMEDS_AttributeString_i: public virtual POA_SALOMEDS::AttributeString, + public virtual SALOMEDS_GenericAttribute_i +{ +public: + SALOMEDS_AttributeString_i(SALOMEDSImpl_AttributeString* theAttr, CORBA::ORB_ptr orb) + :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; + virtual ~SALOMEDS_AttributeString_i() {}; -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 ) - + char* Value(); + void SetValue(const char* value); }; #endif 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 a7bbc0451..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,13 +265,11 @@ 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); + aLength = aRow->length(); for (i = 0; i < aLength; i++) aVector.push_back(aRow[i]); } @@ -309,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(); @@ -334,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->SetRowData(theColumn, aColumn); + aTable->SetColumnData(theColumn, theData); } catch(...) { throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength(); @@ -349,7 +316,7 @@ void SALOMEDS_AttributeTableOfInteger::SetColumn(int theColumn, const std::vecto SALOMEDS::LongSeq_var aColumn = new SALOMEDS::LongSeq(); aColumn->length(aLength); for (i = 0; i < aLength; i++) aColumn[i] = theData[i]; - SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRow(theColumn, aColumn); + SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetColumn(theColumn, aColumn); } } @@ -359,13 +326,11 @@ 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); + aLength = aColumn->length(); for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i]); } return aVector; @@ -377,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(); @@ -394,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; @@ -406,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(); @@ -425,14 +388,12 @@ 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 = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowSetIndices(theRow); + aLength = aSet->length(); for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); } return aVector; @@ -442,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 ce2afc9f7..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,13 +259,11 @@ 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); + aLength = aRow->length(); for (i = 0; i < aLength; i++) aVector.push_back(aRow[i]); } @@ -308,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(); @@ -333,12 +298,9 @@ void SALOMEDS_AttributeTableOfReal::SetColumn(int theColumn, const std::vectorAppend(theData[i]); + SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast(_local_impl); try { - aTable->SetRowData(theColumn, aColumn); + aTable->SetColumnData(theColumn, theData); } catch(...) { throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength(); @@ -348,7 +310,7 @@ void SALOMEDS_AttributeTableOfReal::SetColumn(int theColumn, const std::vectorlength(aLength); for (i = 0; i < aLength; i++) aColumn[i] = theData[i]; - SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRow(theColumn, aColumn); + SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetColumn(theColumn, aColumn); } } @@ -358,13 +320,11 @@ 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); + aLength = aColumn->length(); for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i]); } return aVector; @@ -376,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(); @@ -393,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; @@ -405,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(); @@ -423,13 +382,11 @@ 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); + aLength = aSet->length(); for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); } return aVector; @@ -439,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 de544941a..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,13 +261,11 @@ 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); + aLength = aRow->length(); for (i = 0; i < aLength; i++) aVector.push_back((char*)aRow[i].in()); } @@ -308,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(); @@ -333,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->SetRowData(theColumn, aColumn); + aTable->SetColumnData(theColumn, theData); } catch(...) { throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength(); @@ -348,7 +312,7 @@ void SALOMEDS_AttributeTableOfString::SetColumn(int theColumn, const std::vector SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq(); aColumn->length(aLength); for (i = 0; i < aLength; i++) aColumn[i] = (char*)theData[i].c_str(); - SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRow(theColumn, aColumn); + SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumn(theColumn, aColumn); } } @@ -358,16 +322,12 @@ 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 = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumn(theColumn); + aLength = aColumn->length(); for (i = 0; i < aLength; i++) aVector.push_back(aColumn[i].in()); } return aVector; @@ -379,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(); @@ -396,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; @@ -408,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(); @@ -427,14 +385,12 @@ 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 = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowSetIndices(theRow); + aLength = aSet->length(); for (i = 0; i < aLength; i++) aVector.push_back(aSet[i]); } return aVector; @@ -444,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 df3d011d4..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,19 +59,20 @@ 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)); } } else { SALOMEDS::Study::ListOfSObject_var aSeq = SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Get(); aLength = aSeq->length(); - aSO = new SALOMEDS_SObject(aSeq[i].in()); - for (i = 0; i < aLength; i++) aVector.push_back(_PTR(SObject)(aSO)); + for (i = 0; i < aLength; i++) { + aSO = new SALOMEDS_SObject(aSeq[i].in()); + aVector.push_back(_PTR(SObject)(aSO)); + } } return aVector; @@ -84,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 59703419d..577e16811 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode.cxx @@ -25,17 +25,14 @@ #include "SALOMEDS.hxx" #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) {} @@ -52,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 { @@ -69,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 { @@ -85,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 { @@ -102,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 { @@ -119,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 { @@ -135,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 { @@ -152,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 { @@ -169,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 { @@ -185,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 { @@ -202,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 { @@ -219,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 { @@ -235,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 { @@ -251,9 +240,8 @@ void SALOMEDS_AttributeTreeNode::SetTreeID(const std::string& value) 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); @@ -263,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) @@ -286,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 { @@ -304,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 { @@ -322,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 { @@ -340,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 { @@ -357,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(); } @@ -367,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; @@ -378,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; @@ -390,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 { @@ -409,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 { @@ -428,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 { @@ -446,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 b4ae565ce..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(aNode->ID())); + 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 1b73e3c5c..804f4b148 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeUserID.cxx @@ -25,11 +25,9 @@ #include "SALOMEDS.hxx" #include -#include -#include -#include +#include -SALOMEDS_AttributeUserID::SALOMEDS_AttributeUserID(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr) +SALOMEDS_AttributeUserID::SALOMEDS_AttributeUserID(SALOMEDSImpl_AttributeUserID* theAttr) :SALOMEDS_GenericAttribute(theAttr) {} @@ -46,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; @@ -58,8 +55,7 @@ void SALOMEDS_AttributeUserID::SetValue(const std::string& value) 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 c27e95d2d..7ccfc0243 100644 --- a/src/SALOMEDS/SALOMEDS_Attributes.hxx +++ b/src/SALOMEDS/SALOMEDS_Attributes.hxx @@ -55,6 +55,7 @@ #include "SALOMEDSImpl_AttributeFlags.hxx" #include "SALOMEDSImpl_AttributeGraphic.hxx" #include "SALOMEDSImpl_AttributeParameter.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" #include "SALOMEDS_AttributeName_i.hxx" @@ -86,9 +87,10 @@ #include "SALOMEDS_AttributeFlags_i.hxx" #include "SALOMEDS_AttributeGraphic_i.hxx" #include "SALOMEDS_AttributeParameter_i.hxx" +#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(); \ @@ -124,6 +126,7 @@ __CreateCORBAAttribute(AttributeFlags) \ __CreateCORBAAttribute(AttributeGraphic) \ __CreateCORBAAttribute(AttributeTreeNode) \ __CreateCORBAAttribute(AttributeUserID) \ -__CreateCORBAAttribute(AttributeParameter) +__CreateCORBAAttribute(AttributeParameter) \ +__CreateCORBAAttribute(AttributeString) #endif 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 950181786..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::RefCountServantBase { + 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_Callback_i.hxx b/src/SALOMEDS/SALOMEDS_Callback_i.hxx index ffc6e6db2..d6f755437 100644 --- a/src/SALOMEDS/SALOMEDS_Callback_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Callback_i.hxx @@ -16,7 +16,7 @@ #include CORBA_SERVER_HEADER(SALOMEDS) class SALOMEDS_Callback_i: public virtual POA_SALOMEDS::Callback, - public virtual PortableServer::RefCountServantBase + public virtual PortableServer::ServantBase { private: SALOMEDS::UseCaseBuilder_var _builder; 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 7092d89f3..be5906142 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx @@ -37,16 +37,16 @@ #include class SALOMEDS_ChildIterator_i: public virtual POA_SALOMEDS::ChildIterator, - public virtual PortableServer::RefCountServantBase, + public virtual PortableServer::ServantBase, public virtual SALOME::GenericObj_i { 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 59343ac77..cc76b69e0 100644 --- a/src/SALOMEDS/SALOMEDS_Client.cxx +++ b/src/SALOMEDS/SALOMEDS_Client.cxx @@ -29,9 +29,10 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS) #include "SALOMEDS_StudyManager_i.hxx" -#include "utilities.h" #include "SALOMEDS_AttributeName_i.hxx" +#include "utilities.h" #include "HDFOI.hxx" + using namespace std; //============================================================================ @@ -39,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()){ @@ -49,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()); } @@ -70,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(); @@ -89,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"); @@ -281,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 69ae2d131..fd5307fa6 100644 --- a/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx +++ b/src/SALOMEDS/SALOMEDS_ClientAttributes.hxx @@ -56,6 +56,7 @@ #include "SALOMEDSImpl_AttributeFlags.hxx" #include "SALOMEDSImpl_AttributeGraphic.hxx" #include "SALOMEDSImpl_AttributeParameter.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" #include "SALOMEDS_GenericAttribute.hxx" #include "SALOMEDS_AttributeName.hxx" @@ -87,9 +88,10 @@ #include "SALOMEDS_AttributeFlags.hxx" #include "SALOMEDS_AttributeGraphic.hxx" #include "SALOMEDS_AttributeParameter.hxx" +#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); \ } @@ -127,7 +129,8 @@ __CreateClientAttributeLocal(AttributeFlags) \ __CreateClientAttributeLocal(AttributeGraphic) \ __CreateClientAttributeLocal(AttributeTreeNode) \ __CreateClientAttributeLocal(AttributeUserID) \ -__CreateClientAttributeLocal(AttributeParameter) +__CreateClientAttributeLocal(AttributeParameter) \ +__CreateClientAttributeLocal(AttributeString) #define __CreateGenericClientAttributeCORBA \ __CreateClientAttributeCORBA(AttributeReal) \ @@ -158,6 +161,7 @@ __CreateClientAttributeCORBA(AttributeFlags) \ __CreateClientAttributeCORBA(AttributeGraphic) \ __CreateClientAttributeCORBA(AttributeTreeNode) \ __CreateClientAttributeCORBA(AttributeUserID) \ -__CreateClientAttributeCORBA(AttributeParameter) +__CreateClientAttributeCORBA(AttributeParameter) \ +__CreateClientAttributeCORBA(AttributeString) #endif 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_Defines.hxx b/src/SALOMEDS/SALOMEDS_Defines.hxx new file mode 100755 index 000000000..33c4bde26 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_Defines.hxx @@ -0,0 +1,47 @@ +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOMEDS_Defines.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOMEDS_Defines_HXX_ +#define _SALOMEDS_Defines_HXX_ + +#ifdef WNT + #if defined SALOMEDS_EXPORTS + #if defined WIN32 + #define SALOMEDS_EXPORT __declspec( dllexport ) + #else + #define SALOMEDS_EXPORT + #endif + #else + #if defined WIN32 + #define SALOMEDS_EXPORT __declspec( dllimport ) + #else + #define SALOMEDS_EXPORT + #endif + #endif +#else + #define SALOMEDS_EXPORT +#endif + +#endif 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_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 64f337da3..1a61bc496 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.hxx @@ -20,13 +20,13 @@ #ifndef __SALOMEDS_DRIVER_I_H__ #define __SALOMEDS_DRIVER_I_H__ -#include -#include +#include + +#include #include "SALOMEDSImpl_Driver.hxx" #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_SObject.hxx" -#include #include CORBA_SERVER_HEADER(SALOMEDS) #include CORBA_SERVER_HEADER(SALOME_Component) @@ -46,70 +46,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" @@ -118,7 +118,7 @@ public: class SALOMEDS_DriverFactory_i : public virtual SALOMEDSImpl_DriverFactory { protected: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOME_NamingService* _name_service; public: @@ -135,9 +135,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_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_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 f7d837568..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; @@ -58,7 +57,7 @@ SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ long pid = (long)getpid(); #endif - long addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = ((SALOMEDSImpl_GenericAttribute*)(addr)); _corba_impl = SALOMEDS::GenericAttribute::_nil(); @@ -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 8ab64d6ab..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,29 +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 - char* aTypeOfAttribute = Handle(SALOMEDSImpl_GenericAttribute):: - DownCast(theAttr)->GetClassType().ToCString(); + string aClassType = dynamic_cast(theAttr)->GetClassType(); + char* aTypeOfAttribute = (char*)aClassType.c_str(); SALOMEDS::GenericAttribute_var anAttribute; SALOMEDS_GenericAttribute_i* attr_servant = NULL; __CreateGenericCORBAAttribute @@ -131,7 +114,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== -CORBA::Long SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +CORBA::LongLong SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) { #ifdef WIN32 long pid = (long)_getpid(); @@ -139,6 +122,5 @@ CORBA::Long SALOMEDS_GenericAttribute_i::GetLocalImpl(const char* theHostname, C long pid = (long)getpid(); #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - TDF_Attribute* local_impl = _impl.operator->(); - return ((long)local_impl); + return ((CORBA::LongLong)_impl); } diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx index 6835caa3a..08252579d 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx @@ -28,21 +28,21 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS) #include -#include +#include "DF_Attribute.hxx" #include "SALOMEDS_SObject_i.hxx" #include "SALOMEDSImpl_GenericAttribute.hxx" class Standard_EXPORT SALOMEDS_GenericAttribute_i: public virtual POA_SALOMEDS::GenericAttribute, - public virtual PortableServer::RefCountServantBase, + public virtual PortableServer::ServantBase, public virtual SALOME::GenericObj_i { 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,11 +53,11 @@ 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::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); + virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif 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_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_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_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 4652d95ee..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::RefCountServantBase { -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 dba9faad6..0f0759e2b 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx @@ -37,14 +37,14 @@ #include "SALOMEDSImpl_SComponentIterator.hxx" class SALOMEDS_SComponentIterator_i:public virtual POA_SALOMEDS::SComponentIterator, - public virtual PortableServer::RefCountServantBase, + public virtual PortableServer::ServantBase, public virtual SALOME::GenericObj_i { 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 9affb5f38..b7b6e7410 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -21,11 +21,7 @@ // Author : Sergey RUIN // Module : SALOME - - #include -#include -#include #include "SALOMEDS_SObject.hxx" @@ -43,6 +39,7 @@ #include "Utils_SINGLETON.hxx" #ifdef WIN32 +#include #include #else #include @@ -62,7 +59,9 @@ SALOMEDS_SObject::SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject) long pid = (long)getpid(); #endif - long addr = theSObject->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = // mpv: fix for IPAL13534: for 64-bit platforms use 8-bytes long for pointer storage + theSObject->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + if(_isLocal) { _local_impl = ((SALOMEDSImpl_SObject*)(addr)); _corba_impl = SALOMEDS::SObject::_duplicate(theSObject); @@ -75,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(); } @@ -89,6 +95,9 @@ SALOMEDS_SObject::~SALOMEDS_SObject() if (!_isLocal) { _corba_impl->Destroy(); } + else { + if(_local_impl) delete _local_impl; + } } std::string SALOMEDS_SObject::GetID() @@ -96,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; @@ -106,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())); } @@ -128,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; @@ -146,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)); } @@ -165,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)); } @@ -192,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(); @@ -203,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()); } @@ -216,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)); } } @@ -241,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(); @@ -253,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(); @@ -265,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(); @@ -312,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 f3d1602ed..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,14 +317,14 @@ 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(); } //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== -CORBA::Long SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +CORBA::LongLong SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) { #ifdef WIN32 long pid = (long)_getpid(); @@ -326,6 +332,5 @@ CORBA::Long SALOMEDS_SObject_i::GetLocalImpl(const char* theHostname, CORBA::Lon long pid = (long)getpid(); #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - SALOMEDSImpl_SObject* local_impl = _impl.operator->(); - return ((long)local_impl); + return ((CORBA::LongLong)(void*)_impl); } diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.hxx b/src/SALOMEDS/SALOMEDS_SObject_i.hxx index 29e434bf6..dfab13cba 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.hxx @@ -35,23 +35,19 @@ // Cascade headers #include "SALOMEDSImpl_SObject.hxx" -#ifdef GetObject -#undef GetObject -#endif - class Standard_EXPORT SALOMEDS_SObject_i: public virtual POA_SALOMEDS::SObject, - public virtual PortableServer::RefCountServantBase, + public virtual PortableServer::ServantBase, 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(); @@ -76,7 +72,7 @@ public: virtual CORBA::Short Tag(); virtual CORBA::Short Depth(); - virtual CORBA::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); + virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif 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 b58231aae..8ecce2d4b 100644 --- a/src/SALOMEDS/SALOMEDS_Server.cxx +++ b/src/SALOMEDS/SALOMEDS_Server.cxx @@ -26,12 +26,14 @@ // Module : SALOME // $Header$ -#include -#include CORBA_SERVER_HEADER(SALOMEDS) -#include "SALOMEDS_StudyManager_i.hxx" #include "utilities.h" #include "Utils_SINGLETON.hxx" + #include "SALOME_NamingService.hxx" +#include "SALOMEDS_StudyManager_i.hxx" + +#include +#include CORBA_SERVER_HEADER(SALOMEDS) #ifdef CHECKTIME #include @@ -54,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; @@ -161,6 +161,7 @@ int main(int argc, char** argv) // ready to accept requests. PortableServer::ObjectId_var myStudyManager_iid = poa->activate_object(myStudyManager_i); myStudyManager_i->register_name("/myStudyManager"); + myStudyManager_i->_remove_ref(); // Obtain a POAManager, and tell the POA to start accepting // requests on its objects. diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index 2c99122fb..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,9 +238,15 @@ _PTR(SObject) SALOMEDS_Study::CreateObjectID(const std::string& anObjectID) SALOMEDSClient_SObject* aSO = NULL; if (_isLocal) { SALOMEDS::Locker lock; - aSO = new SALOMEDS_SObject(_local_impl->CreateObjectID((char*)anObjectID.c_str())); + SALOMEDSImpl_SObject aSO_impl = _local_impl->CreateObjectID(anObjectID); + if(!aSO_impl) return _PTR(SObject)(aSO); + aSO = new SALOMEDS_SObject(aSO_impl); + } + else { + SALOMEDS::SObject_var aSO_impl = _corba_impl->CreateObjectID((char*)anObjectID.c_str()); + if(CORBA::is_nil(aSO_impl)) return _PTR(SObject)(aSO); + aSO = new SALOMEDS_SObject(aSO_impl); } - else aSO = new SALOMEDS_SObject(_corba_impl->CreateObjectID((char*)anObjectID.c_str())); return _PTR(SObject)(aSO); } @@ -256,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 { @@ -274,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 { @@ -288,11 +288,12 @@ _PTR(SObject) SALOMEDS_Study::FindObjectByPath(const std::string& thePath) std::string SALOMEDS_Study::GetObjectPath(const _PTR(SObject)& theSO) { + if(!theSO) return ""; SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); 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; @@ -302,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()); } @@ -312,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; @@ -324,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()); @@ -343,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()); @@ -363,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()); @@ -383,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()); @@ -402,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 { @@ -437,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 { @@ -453,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; @@ -463,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()); } @@ -498,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; @@ -514,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()); } @@ -547,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 { @@ -579,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; @@ -591,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(); @@ -610,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 { @@ -639,10 +632,53 @@ void SALOMEDS_Study::EnableUseCaseAutoFilling(bool isEnabled) bool SALOMEDS_Study::DumpStudy(const string& thePath, const string& theBaseName, bool isPublished) { //SRN: Pure CORBA DumpStudy as it does more cleaning than the local one + if(CORBA::is_nil(_corba_impl)) GetStudy(); //If CORBA implementation is null then retrieve it bool ret = _corba_impl->DumpStudy(thePath.c_str(), theBaseName.c_str(), isPublished); return ret; } +void SALOMEDS_Study::SetStudyLock(const string& theLockerID) +{ + if (_isLocal) { + SALOMEDS::Locker lock; + _local_impl->SetStudyLock(theLockerID.c_str()); + } + else _corba_impl->SetStudyLock((char*)theLockerID.c_str()); +} + +bool SALOMEDS_Study::IsStudyLocked() +{ + bool isLocked; + if (_isLocal) { + SALOMEDS::Locker lock; + isLocked = _local_impl->IsStudyLocked(); + } + else isLocked = _corba_impl->IsStudyLocked(); + return isLocked; +} + +void SALOMEDS_Study::UnLockStudy(const string& theLockerID) +{ + if(_isLocal) _local_impl->UnLockStudy(theLockerID.c_str()); + else _corba_impl->UnLockStudy((char*)theLockerID.c_str()); +} + +vector SALOMEDS_Study::GetLockerID() +{ + std::vector aVector; + int aLength, i; + if (_isLocal) { + SALOMEDS::Locker lock; + aVector = _local_impl->GetLockerID(); + } + else { + SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetLockerID(); + aLength = aSeq->length(); + for (i = 0; i < aLength; i++) aVector.push_back((char*)aSeq[i].in()); + } + return aVector; +} + std::string SALOMEDS_Study::ConvertObjectToIOR(CORBA::Object_ptr theObject) { return _orb->object_to_string(theObject); @@ -666,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 3856c94b0..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(); @@ -90,6 +91,11 @@ public: virtual _PTR(AttributeParameter) GetCommonParameters(const std::string& theID, int theSavePoint); virtual _PTR(AttributeParameter) GetModuleParameters(const std::string& theID, const std::string& theModuleName, int theSavePoint); + virtual void SetStudyLock(const std::string& theLockerID); + virtual bool IsStudyLocked(); + virtual void UnLockStudy(const std::string& theLockerID); + virtual std::vector GetLockerID(); + std::string ConvertObjectToIOR(CORBA::Object_ptr theObject); CORBA::Object_ptr ConvertIORToObject(const std::string& theIOR); diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx index 97fa1f884..4b6da1939 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.cxx @@ -41,9 +41,9 @@ #include "SALOMEDSImpl_GenericAttribute.hxx" #include +#include -#include -#include +#include "DF_Attribute.hxx" #include "Utils_CorbaException.hxx" #include "Utils_ORB_INIT.hxx" @@ -51,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; @@ -81,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 { @@ -97,13 +97,15 @@ _PTR(SComponent) SALOMEDS_StudyBuilder::NewComponent(const std::string& Componen void SALOMEDS_StudyBuilder::DefineComponentInstance (const _PTR(SComponent)& theSCO, const std::string& ComponentIOR) { + if(!theSCO) return; + SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO.get()); if (_isLocal) { 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()); @@ -113,12 +115,13 @@ void SALOMEDS_StudyBuilder::DefineComponentInstance (const _PTR(SComponent)& the void SALOMEDS_StudyBuilder::RemoveComponent(const _PTR(SComponent)& theSCO) { + if(!theSCO) return; SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO.get()); if (_isLocal) { 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())); } @@ -133,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 { @@ -156,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); } @@ -177,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(); @@ -188,6 +191,8 @@ void SALOMEDS_StudyBuilder::AddDirectory(const std::string& thePath) void SALOMEDS_StudyBuilder::LoadWith(const _PTR(SComponent)& theSCO, const std::string& theIOR) { + if(!theSCO) return; + SALOMEDS_SComponent* aSCO = dynamic_cast(theSCO.get()); CORBA::Object_var obj = _orb->string_to_object(theIOR.c_str()); SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj); @@ -196,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); @@ -211,46 +215,51 @@ 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())); } void SALOMEDS_StudyBuilder::RemoveObject(const _PTR(SObject)& theSO) { + if(!theSO) return; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveObject(aSO->GetLocalImpl()); + _local_impl->RemoveObject(*(aSO->GetLocalImpl())); } else _corba_impl->RemoveObject(aSO->GetCORBAImpl()); } void SALOMEDS_StudyBuilder::RemoveObjectWithChildren(const _PTR(SObject)& theSO) { + if(!theSO) return; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveObjectWithChildren(aSO->GetLocalImpl()); + _local_impl->RemoveObjectWithChildren(*(aSO->GetLocalImpl())); } else _corba_impl->RemoveObjectWithChildren(aSO->GetCORBAImpl()); } _PTR(GenericAttribute) SALOMEDS_StudyBuilder::FindOrCreateAttribute(const _PTR(SObject)& theSO, const std::string& aTypeOfAttribute) -{ - SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); +{ SALOMEDSClient_GenericAttribute* anAttr = NULL; + if(!theSO) return _PTR(GenericAttribute)(anAttr); + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); 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(); @@ -271,13 +280,19 @@ bool SALOMEDS_StudyBuilder::FindAttribute(const _PTR(SObject)& theSO, const std::string& aTypeOfAttribute) { bool ret; + + if(!theSO) return false; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); 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; @@ -290,49 +305,58 @@ bool SALOMEDS_StudyBuilder::FindAttribute(const _PTR(SObject)& theSO, void SALOMEDS_StudyBuilder::RemoveAttribute(const _PTR(SObject)& theSO, const std::string& aTypeOfAttribute) { + if(!theSO) return; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { 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) { + throw DFexception("Invalid arguments"); + } + SALOMEDS_SObject* aSO = dynamic_cast(me.get()); SALOMEDS_SObject* aRefSO = dynamic_cast(thereferencedObject.get()); if (_isLocal) { 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()); } void SALOMEDS_StudyBuilder::RemoveReference(const _PTR(SObject)& me) { + if(!me) return; SALOMEDS_SObject* aSO = dynamic_cast(me.get()); if (_isLocal) { CheckLocked(); SALOMEDS::Locker lock; - _local_impl->RemoveReference(aSO->GetLocalImpl()); + _local_impl->RemoveReference(*(aSO->GetLocalImpl())); } else _corba_impl->RemoveReference(aSO->GetCORBAImpl()); } void SALOMEDS_StudyBuilder::SetGUID(const _PTR(SObject)& theSO, const std::string& theGUID) { + if(!theSO) return; + 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()); } @@ -344,7 +368,7 @@ bool SALOMEDS_StudyBuilder::IsGUID(const _PTR(SObject)& theSO, const std::string 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()); @@ -482,36 +506,42 @@ void SALOMEDS_StudyBuilder::CheckLocked() void SALOMEDS_StudyBuilder::SetName(const _PTR(SObject)& theSO, const std::string& theValue) { + if(!theSO) return; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { 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()); } void SALOMEDS_StudyBuilder::SetComment(const _PTR(SObject)& theSO, const std::string& theValue) { + if(!theSO) return; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { 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()); } void SALOMEDS_StudyBuilder::SetIOR(const _PTR(SObject)& theSO, const std::string& theValue) { + if(!theSO) return; + SALOMEDS_SObject* aSO = dynamic_cast(theSO.get()); if (_isLocal) { 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 39807b2bd..a05408ae4 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder.hxx @@ -24,6 +24,8 @@ #ifndef __SALOMEDS_STUDYBUILDER_H__ #define __SALOMEDS_STUDYBUILDER_H__ +#include "SALOMEDS_Defines.hxx" + #include "SALOMEDSClient.hxx" #include "SALOMEDSImpl_StudyBuilder.hxx" @@ -31,18 +33,17 @@ #include #include CORBA_SERVER_HEADER(SALOMEDS) - -class SALOMEDS_StudyBuilder: public SALOMEDSClient_StudyBuilder +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 87adc2db8..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,11 +95,10 @@ 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); + _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 7912fa834..6d1db089d 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx @@ -34,18 +34,14 @@ #include "SALOMEDSImpl_StudyBuilder.hxx" -// Cascade header -#include - -class SALOMEDS_StudyBuilder_i: public POA_SALOMEDS::StudyBuilder, - public PortableServer::RefCountServantBase +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,5 +126,8 @@ public: virtual void SetName(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection); 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); + + SALOMEDSImpl_StudyBuilder* GetImpl() { return _impl; } + }; #endif diff --git a/src/SALOMEDS/SALOMEDS_StudyManager.cxx b/src/SALOMEDS/SALOMEDS_StudyManager.cxx index cae5cfba5..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) { @@ -61,7 +57,7 @@ SALOMEDS_StudyManager::SALOMEDS_StudyManager(SALOMEDS::StudyManager_ptr theManag long pid = (long)getpid(); #endif - long addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = ((SALOMEDSImpl_StudyManager*)(addr)); _corba_impl = SALOMEDS::StudyManager::_duplicate(theManager); @@ -89,7 +85,7 @@ SALOMEDS_StudyManager::SALOMEDS_StudyManager() long pid = (long)getpid(); #endif - long addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); + CORBA::LongLong addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal); if(_isLocal) { _local_impl = ((SALOMEDSImpl_StudyManager*)(addr)); _corba_impl = SALOMEDS::StudyManager::_duplicate(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 617f7c194..7c5abcb94 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; @@ -90,7 +87,9 @@ SALOMEDS_StudyManager_i::~SALOMEDS_StudyManager_i() { // Destroy directory to register open studies _name_service->Destroy_Directory("/Study"); + delete _name_service; delete _factory; + delete _impl; } //============================================================================ @@ -115,8 +114,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(); } @@ -134,9 +133,9 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name) _name_service->Register(Study, study_name); // Assign the value of the IOR in the study->root - const char* IORStudy = _orb->object_to_string(Study); + CORBA::String_var IORStudy = _orb->object_to_string(Study); - aStudyImpl->SetTransientReference((char*)IORStudy); + aStudyImpl->SetTransientReference((char*)IORStudy.in()); _mapOfPOA[Study->StudyId()] = _poa; @@ -156,7 +155,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... "); @@ -166,12 +165,12 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) // Assign the value of the IOR in the study->root CORBA::String_var IORStudy = _orb->object_to_string(Study); - aStudyImpl->SetTransientReference((char*)IORStudy); + aStudyImpl->SetTransientReference((char*)IORStudy.in()); // 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 +215,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 +228,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 +246,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 +259,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 +272,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 +284,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 +302,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,16 +325,17 @@ 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(); } SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); - SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(aStudy_servant->_this()); + CORBA::Object_var obj = aStudy_servant->_this(); + SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(obj); return aStudy._retn(); } @@ -353,8 +351,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); @@ -372,8 +370,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); @@ -391,8 +389,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); @@ -413,9 +411,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); @@ -431,15 +429,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); } @@ -453,10 +451,24 @@ 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 //=========================================================================== -CORBA::Long SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +CORBA::LongLong SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) { #ifdef WIN32 long pid = (long)_getpid(); @@ -464,27 +476,12 @@ CORBA::Long SALOMEDS_StudyManager_i::GetLocalImpl(const char* theHostname, CORBA long pid = (long)getpid(); #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - SALOMEDSImpl_StudyManager* aManager = _impl.operator->(); - return ((long)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 3f3c3d831..a7ec9b17e 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,28 +40,23 @@ #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); } -class Standard_EXPORT SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager, - public PortableServer::RefCountServantBase { +class Standard_EXPORT SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager +{ private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _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::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); + 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 b36531420..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(); @@ -194,7 +188,9 @@ SALOMEDS::SObject_ptr SALOMEDS_Study_i::CreateObjectID(const char* anObjectID) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_SObject) aSO = _impl->CreateObjectID((char*)anObjectID); + if(!anObjectID || strlen(anObjectID) == 0) return SALOMEDS::SObject::_nil(); + + SALOMEDSImpl_SObject aSO = _impl->CreateObjectID((char*)anObjectID); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb); @@ -212,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); @@ -250,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); @@ -266,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)) { @@ -278,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()); } @@ -294,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(); } @@ -307,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()); } //============================================================================ @@ -322,13 +317,20 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetObjectNames(const char* theContext SALOMEDS::Locker lock; SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); - Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetObjectNames(TCollection_AsciiString((char*)theContext)); - int aLength = aSeq->Length(); + + if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) + throw SALOMEDS::Study::StudyInvalidContext(); + + vector aSeq = _impl->GetObjectNames(string((char*)theContext)); + if (_impl->GetErrorCode() == "InvalidContext") + throw SALOMEDS::Study::StudyInvalidContext(); + + 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(); } @@ -342,13 +344,20 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetDirectoryNames(const char* theCont SALOMEDS::Locker lock; SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); - Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetDirectoryNames(TCollection_AsciiString((char*)theContext)); - int aLength = aSeq->Length(); + + if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) + throw SALOMEDS::Study::StudyInvalidContext(); + + vector aSeq = _impl->GetDirectoryNames(string((char*)theContext)); + if (_impl->GetErrorCode() == "InvalidContext") + throw SALOMEDS::Study::StudyInvalidContext(); + + 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(); } @@ -362,19 +371,27 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetFileNames(const char* theContext) SALOMEDS::Locker lock; SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); - Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetFileNames(TCollection_AsciiString((char*)theContext)); - int aLength = aSeq->Length(); + + if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) + throw SALOMEDS::Study::StudyInvalidContext(); + + vector aSeq = _impl->GetFileNames(string((char*)theContext)); + if (_impl->GetErrorCode() == "InvalidContext") + throw SALOMEDS::Study::StudyInvalidContext(); + + 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(); } //============================================================================ /*! Function : GetComponentNames * Purpose : method to get all components names + * SRN: Note, theContext can be any, it doesn't matter */ //============================================================================ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theContext) @@ -382,13 +399,15 @@ SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetComponentNames(const char* theCont SALOMEDS::Locker lock; SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; - if (strlen(theContext) == 0 && !_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext(); - Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetComponentNames(TCollection_AsciiString((char*)theContext)); - int aLength = aSeq->Length(); + + vector aSeq = _impl->GetComponentNames(string((char*)theContext)); + + 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(); } @@ -401,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); @@ -445,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()); } //============================================================================ @@ -456,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)); } //============================================================================ @@ -492,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) @@ -500,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()); } //============================================================================ @@ -511,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)); } @@ -530,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)); @@ -550,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); @@ -574,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(); } @@ -582,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(); } @@ -623,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; @@ -649,6 +678,7 @@ void SALOMEDS_Study_i::Close() } } } + _impl->Close(); } @@ -660,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 } //============================================================================ @@ -685,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 } //============================================================================ @@ -730,8 +738,7 @@ void SALOMEDS_Study_i::UndoPostponed(CORBA::Long theWay) #endif { SALOMEDS::Locker lock; - - _impl->UndoPostponed(theWay); + //Not implemented } @@ -746,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; @@ -762,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(); } @@ -778,11 +785,65 @@ 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(); } +//============================================================================ +/*! Function : SetStudyLock + * Purpose : + */ +//============================================================================ +void SALOMEDS_Study_i::SetStudyLock(const char* theLockerID) +{ + SALOMEDS::Locker lock; + _impl->SetStudyLock(theLockerID); +} + +//============================================================================ +/*! Function : IsStudyLocked + * Purpose : + */ +//============================================================================ +bool SALOMEDS_Study_i::IsStudyLocked() +{ + SALOMEDS::Locker lock; + return _impl->IsStudyLocked(); +} + +//============================================================================ +/*! Function : UnLockStudy + * Purpose : + */ +//============================================================================ +void SALOMEDS_Study_i::UnLockStudy(const char* theLockerID) +{ + SALOMEDS::Locker lock; + _impl->UnLockStudy(theLockerID); +} + +//============================================================================ +/*! Function : GetLockerID + * Purpose : + */ +//============================================================================ +SALOMEDS::ListOfStrings* SALOMEDS_Study_i::GetLockerID() +{ + SALOMEDS::Locker lock; + + SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings; + + vector aSeq = _impl->GetLockerID(); + + int aLength = aSeq.size(); + aResult->length(aLength); + for(int anIndex = 0; anIndex < aLength; anIndex++) { + aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str()); + } + return aResult._retn(); +} + //============================================================================ /*! Function : GetDefaultScript * Purpose : @@ -796,10 +857,31 @@ char* SALOMEDS_Study_i::GetDefaultScript(const char* theModuleName, const char* return CORBA::string_dup(script.c_str()); } +//============================================================================ +/*! Function : EnableUseCaseAutoFilling + * Purpose : + */ +//============================================================================ +void SALOMEDS_Study_i::EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) +{ + _impl->EnableUseCaseAutoFilling(isEnabled); + SALOMEDSImpl_StudyBuilder* builder = _builder->GetImpl(); + if(builder) { + if(isEnabled) { + builder->SetOnAddSObject(_impl->GetCallback()); + builder->SetOnRemoveSObject(_impl->GetCallback()); + } + else { + builder->SetOnAddSObject(NULL); + builder->SetOnRemoveSObject(NULL); + } + } +} + //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== -CORBA::Long SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) +CORBA::LongLong SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal) { #ifdef WIN32 long pid = (long)_getpid(); @@ -807,6 +889,5 @@ CORBA::Long SALOMEDS_Study_i::GetLocalImpl(const char* theHostname, CORBA::Long long pid = (long)getpid(); #endif isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0; - SALOMEDSImpl_Study* local_impl = _impl.operator->(); - return ((long)local_impl); + return ((CORBA::LongLong)_impl); } diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index 9dba2243c..efb31e66e 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -43,18 +43,17 @@ #include "SALOMEDSImpl_Study.hxx" #include "SALOMEDSImpl_AttributeIOR.hxx" -class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study, - public PortableServer::RefCountServantBase +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(); @@ -224,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 @@ -239,15 +241,15 @@ 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); virtual SALOMEDS::Study::ListOfSObject* FindDependances(SALOMEDS::SObject_ptr anObject); - virtual SALOMEDS::AttributeStudyProperties_ptr SALOMEDS_Study_i::GetProperties(); + virtual SALOMEDS::AttributeStudyProperties_ptr GetProperties(); virtual char* GetLastModificationDate(); @@ -260,7 +262,7 @@ public: virtual void Close(); - void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled) { _impl->EnableUseCaseAutoFilling(isEnabled); } + void EnableUseCaseAutoFilling(CORBA::Boolean isEnabled); // postponed destroying of CORBA object functionality virtual void AddPostponed(const char* theIOR); @@ -284,12 +286,20 @@ public: const char* theModuleName, CORBA::Long theSavePoint); + virtual void SetStudyLock(const char* theLockerID); + + virtual bool IsStudyLocked(); + + virtual void UnLockStudy(const char* theLockerID); + + virtual SALOMEDS::ListOfStrings* GetLockerID(); + virtual char* GetDefaultScript(const char* theModuleName, const char* theShift); 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::Long GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); + virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); }; #endif 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_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_UseCaseBuilder.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder.cxx index d429516f3..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); @@ -200,11 +199,19 @@ _PTR(SObject) SALOMEDS_UseCaseBuilder::AddUseCase(const std::string& theName) _PTR(UseCaseIterator) SALOMEDS_UseCaseBuilder::GetUseCaseIterator(const _PTR(SObject)& theObject) { SALOMEDS_UseCaseIterator* it = NULL; - SALOMEDS_SObject* obj = dynamic_cast(theObject.get()); + SALOMEDS_SObject* obj = (theObject)?dynamic_cast(theObject.get()):NULL; if (_isLocal) { SALOMEDS::Locker lock; - it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(obj->GetLocalImpl())); + if(obj) + it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(*(obj->GetLocalImpl()))); + else + it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(SALOMEDSImpl_SObject())); + } + else { + if(obj) + it = new SALOMEDS_UseCaseIterator(_corba_impl->GetUseCaseIterator(obj->GetCORBAImpl())); + else + it = new SALOMEDS_UseCaseIterator(_corba_impl->GetUseCaseIterator(SALOMEDS::SObject::_nil())); } - else it = new SALOMEDS_UseCaseIterator(_corba_impl->GetUseCaseIterator(obj->GetCORBAImpl())); return _PTR(UseCaseIterator)(it); } 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 a0da803d2..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,8 +100,8 @@ 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; - return _impl->AppendTo(_impl->GetSObject(theFirst->GetID()), _impl->GetSObject(theNext->GetID())); + 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,8 +217,10 @@ SALOMEDS::UseCaseIterator_ptr SALOMEDS_UseCaseBuilder_i::GetUseCaseIterator(SALO { SALOMEDS::Locker lock; - if(_impl.IsNull()) return SALOMEDS::UseCaseIterator::_nil(); - Handle(SALOMEDSImpl_UseCaseIterator) anItr = _impl->GetUseCaseIterator(_impl->GetSObject(theObject->GetID())); + 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(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 c9d039d57..e5a433178 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx @@ -33,26 +33,24 @@ #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) #include -// Cascade headers -#include #include #include "SALOMEDSImpl_UseCaseIterator.hxx" #include "SALOMEDSImpl_UseCaseBuilder.hxx" class SALOMEDS_UseCaseBuilder_i: public virtual POA_SALOMEDS::UseCaseBuilder, - public virtual PortableServer::RefCountServantBase, + public virtual PortableServer::ServantBase, public virtual SALOME::GenericObj_i { 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 0197c77e9..b1e58a30d 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx @@ -35,17 +35,17 @@ #include "SALOMEDSImpl_UseCaseIterator.hxx" class SALOMEDS_UseCaseIterator_i: public virtual POA_SALOMEDS::UseCaseIterator, - public virtual PortableServer::RefCountServantBase, + public virtual PortableServer::ServantBase, public virtual SALOME::GenericObj_i { 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 6b1bc5f50..7c765fa9f 100644 --- a/src/SALOMEDS/Test/Makefile.am +++ b/src/SALOMEDS/Test/Makefile.am @@ -57,12 +57,13 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \ -I$(srcdir)/$(RPATH)/ResourcesManager \ -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 =\ @@ -79,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 \ @@ -90,21 +92,57 @@ COMMON_LIBS =\ # =============================================================== # lib_LTLIBRARIES = libSALOMEDSTest.la -libSALOMEDSTest_la_SOURCES = SALOMEDSTest.cxx +dist_libSALOMEDSTest_la_SOURCES = SALOMEDSTest.cxx libSALOMEDSTest_la_CPPFLAGS = $(COMMON_CPPFLAGS) libSALOMEDSTest_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSALOMEDSTest_la_LIBADD = $(COMMON_LIBS) +EXTRA_DIST = \ + SALOMEDSTest_AttributeComment.cxx \ + SALOMEDSTest_AttributeDrawable.cxx \ + SALOMEDSTest_AttributeExpandable.cxx \ + SALOMEDSTest_AttributeExternalFileDef.cxx \ + SALOMEDSTest_AttributeFileType.cxx \ + SALOMEDSTest_AttributeFlags.cxx \ + SALOMEDSTest_AttributeGraphic.cxx \ + SALOMEDSTest_AttributeInteger.cxx \ + SALOMEDSTest_AttributeIOR.cxx \ + SALOMEDSTest_AttributeLocalID.cxx \ + SALOMEDSTest_AttributeName.cxx \ + SALOMEDSTest_AttributeOpened.cxx \ + SALOMEDSTest_AttributeParameter.cxx \ + SALOMEDSTest_AttributePersistentRef.cxx \ + SALOMEDSTest_AttributePixMap.cxx \ + SALOMEDSTest_AttributePythonObject.cxx \ + SALOMEDSTest_AttributeReal.cxx \ + SALOMEDSTest_AttributeSelectable.cxx \ + SALOMEDSTest_AttributeSequenceOfInteger.cxx \ + SALOMEDSTest_AttributeSequenceOfReal.cxx \ + SALOMEDSTest_AttributeStudyProperties.cxx \ + SALOMEDSTest_AttributeTableOfInteger.cxx \ + SALOMEDSTest_AttributeTableOfReal.cxx \ + SALOMEDSTest_AttributeTableOfString.cxx \ + SALOMEDSTest_AttributeTarget.cxx \ + SALOMEDSTest_AttributeTextColor.cxx \ + SALOMEDSTest_AttributeTextHighlightColor.cxx\ + SALOMEDSTest_AttributeTreeNode.cxx \ + SALOMEDSTest_AttributeUserID.cxx \ + SALOMEDSTest_ChildIterator.cxx \ + SALOMEDSTest_SComponent.cxx \ + SALOMEDSTest_SComponentIterator.cxx \ + SALOMEDSTest_SObject.cxx \ + SALOMEDSTest_StudyBuilder.cxx \ + SALOMEDSTest_Study.cxx \ + SALOMEDSTest_StudyManager.cxx \ + SALOMEDSTest_UseCase.cxx + # # =============================================================== # Executables targets # =============================================================== # bin_PROGRAMS = TestSALOMEDS -TestSALOMEDS_SOURCES = TestSALOMEDS.cxx +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 \ + $(CORBA_LIBS) diff --git a/src/SALOMEDS/Test/SALOMEDSTest.cxx b/src/SALOMEDS/Test/SALOMEDSTest.cxx index 6221e9b83..68de91733 100644 --- a/src/SALOMEDS/Test/SALOMEDSTest.cxx +++ b/src/SALOMEDS/Test/SALOMEDSTest.cxx @@ -20,81 +20,47 @@ #include "SALOMEDSTest.hxx" + +#include "SALOMEDS_StudyManager_i.hxx" +#include "utilities.h" +#include "Utils_SINGLETON.hxx" +#include "Utils_ORB_INIT.hxx" +#include "SALOME_NamingService.hxx" +#include "SALOME_LifeCycleCORBA.hxx" + #include #include #include #include #include -#include "utilities.h" -#include "Utils_SALOME_Exception.hxx" -#include "Utils_ORB_INIT.hxx" -#include "Utils_SINGLETON.hxx" -#include "OpUtil.hxx" #include "SALOMEDSClient.hxx" -#include "SALOMEDSClient_ClientFactory.hxx" +#include "SALOMEDS_StudyManager_i.hxx" +#include "SALOMEDS_StudyManager.hxx" +#include "SALOMEDS_SObject.hxx" -#include using namespace std; -#define PT_INTEGER 0 -#define PT_REAL 1 -#define PT_BOOLEAN 2 -#define PT_STRING 3 -#define PT_REALARRAY 4 -#define PT_INTARRAY 5 -#define PT_STRARRAY 6 - - -#define TRACEFILE "/tmp/traceUnitTest.log" - // ============================================================================ /*! * Set up the environment */ // ============================================================================ - + void SALOMEDSTest::setUp() -{ - TCollection_AsciiString kernel(getenv("KERNEL_ROOT_DIR")); - TCollection_AsciiString subPath("/share/salome/resources"); - TCollection_AsciiString csf_var = (kernel+subPath); - setenv("CSF_PluginDefaults", csf_var.ToCString(), 0); - setenv("CSF_SALOMEDS_ResourcesDefaults", csf_var.ToCString(), 0); - - // --- trace on file - char *theFileName = TRACEFILE; - - string s = "file:"; - s += theFileName; - CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite - - ofstream traceFile; - traceFile.open(theFileName, ios::out | ios::app); - CPPUNIT_ASSERT(traceFile); // file created empty, then closed - traceFile.close(); - - LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); - CPPUNIT_ASSERT(bp1); - - // --- Get or initialize the orb +{ + int argc = 1; + char* argv[] = {""}; - int _argc = 1; - char* _argv[] = {""}; ORB_INIT &init = *SINGLETON_::Instance() ; ASSERT(SINGLETON_::IsAlreadyExisting()); - _orb = init(_argc , _argv ) ; + _orb = init(argc , argv ) ; + SALOME_NamingService NS(_orb); + CORBA::Object_var obj = NS.Resolve( "/myStudyManager" ); + _sm = SALOMEDS::StudyManager::_narrow( obj ); - sleep(2); - - // --- Create a SALOME_NamingService instance - - _NS = new SALOME_NamingService; - - sleep(2); - - _NS->init_orb(_orb) ; + CPPUNIT_ASSERT( !CORBA::is_nil(_sm) ); } // ============================================================================ @@ -103,88 +69,73 @@ void SALOMEDSTest::setUp() */ // ============================================================================ -void -SALOMEDSTest::tearDown() +void SALOMEDSTest::tearDown() { - LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); - CPPUNIT_ASSERT(bp1); - bp1->deleteInstance(bp1); - - delete _NS; + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + vector v = sm->GetOpenStudies(); + for(int i = 0; iGetStudyByName(v[i]); + if(study) + sm->Close(study); + } } +#include "SALOMEDSTest_AttributeComment.cxx" +#include "SALOMEDSTest_AttributeDrawable.cxx" +#include "SALOMEDSTest_AttributeExpandable.cxx" +#include "SALOMEDSTest_AttributeExternalFileDef.cxx" +#include "SALOMEDSTest_AttributeFileType.cxx" +#include "SALOMEDSTest_AttributeFlags.cxx" +#include "SALOMEDSTest_AttributeGraphic.cxx" +#include "SALOMEDSTest_AttributeIOR.cxx" +#include "SALOMEDSTest_AttributeInteger.cxx" +#include "SALOMEDSTest_AttributeLocalID.cxx" +#include "SALOMEDSTest_AttributeName.cxx" +#include "SALOMEDSTest_AttributeOpened.cxx" +#include "SALOMEDSTest_AttributeParameter.cxx" +#include "SALOMEDSTest_AttributePersistentRef.cxx" +#include "SALOMEDSTest_AttributePixMap.cxx" +#include "SALOMEDSTest_AttributePythonObject.cxx" +#include "SALOMEDSTest_AttributeReal.cxx" +#include "SALOMEDSTest_AttributeSelectable.cxx" +#include "SALOMEDSTest_AttributeSequenceOfInteger.cxx" +#include "SALOMEDSTest_AttributeSequenceOfReal.cxx" +#include "SALOMEDSTest_AttributeStudyProperties.cxx" +#include "SALOMEDSTest_AttributeTableOfInteger.cxx" +#include "SALOMEDSTest_AttributeTableOfReal.cxx" +#include "SALOMEDSTest_AttributeTableOfString.cxx" +#include "SALOMEDSTest_AttributeTarget.cxx" +#include "SALOMEDSTest_AttributeTextColor.cxx" +#include "SALOMEDSTest_AttributeTextHighlightColor.cxx" +#include "SALOMEDSTest_AttributeTreeNode.cxx" +#include "SALOMEDSTest_AttributeUserID.cxx" +#include "SALOMEDSTest_ChildIterator.cxx" +#include "SALOMEDSTest_SComponent.cxx" +#include "SALOMEDSTest_SComponentIterator.cxx" +#include "SALOMEDSTest_SObject.cxx" +#include "SALOMEDSTest_Study.cxx" +#include "SALOMEDSTest_StudyBuilder.cxx" +#include "SALOMEDSTest_StudyManager.cxx" +#include "SALOMEDSTest_UseCase.cxx" + + // ============================================================================ /*! - * Check AttributeParameter + * Set up the environment */ // ============================================================================ -void SALOMEDSTest::testAttributeParameter() -{ - CORBA::Object_var obj = _orb->resolve_initial_references( "RootPOA" ); - PortableServer::POA_var poa = PortableServer::POA::_narrow( obj ); - - PortableServer::POAManager_var pman = poa->the_POAManager(); - pman->activate() ; - - _PTR(StudyManager) sm = ClientFactory::createStudyManager(_orb, poa); - - CPPUNIT_ASSERT(sm); - - _PTR(Study) study = sm->NewStudy("Test"); - - CPPUNIT_ASSERT(study); - - _PTR(AttributeParameter) _ap = study->GetCommonParameters("TestComp", 0); - - CPPUNIT_ASSERT(_ap); - - _ap->SetInt("IntValue", 1); - CPPUNIT_ASSERT(_ap->IsSet("IntValue", PT_INTEGER)); - CPPUNIT_ASSERT(_ap->GetInt("IntValue") == 1); + +void SALOMEDSTest_Embedded::setUp() +{ + int argc = 1; + char* argv[] = {""}; - _ap->SetReal("RealValue", 1.2); - CPPUNIT_ASSERT(_ap->IsSet("RealValue", PT_REAL)); - CPPUNIT_ASSERT(_ap->GetReal("RealValue") == 1.2); - - _ap->SetString("StringValue", "hello"); - CPPUNIT_ASSERT(_ap->IsSet("StringValue", PT_STRING)); - CPPUNIT_ASSERT(_ap->GetString("StringValue") == "hello"); - - _ap->SetBool("BoolValue", 0); - CPPUNIT_ASSERT(_ap->IsSet("BoolValue", PT_BOOLEAN)); - CPPUNIT_ASSERT(!_ap->GetBool("BoolValue")); - - _ap->SetBool("BoolValue", 0); - CPPUNIT_ASSERT(_ap->IsSet("BoolValue", PT_BOOLEAN)); - CPPUNIT_ASSERT(!_ap->GetBool("BoolValue")); - - vector intArray; - intArray.push_back(0); - intArray.push_back(1); - - _ap->SetIntArray("IntArray", intArray); - CPPUNIT_ASSERT(_ap->IsSet("IntArray", PT_INTARRAY)); - CPPUNIT_ASSERT(_ap->GetIntArray("IntArray")[0] == 0); - CPPUNIT_ASSERT(_ap->GetIntArray("IntArray")[1] == 1); - - vector realArray; - realArray.push_back(0.0); - realArray.push_back(1.1); - - _ap->SetRealArray("RealArray", realArray); - CPPUNIT_ASSERT(_ap->IsSet("RealArray", PT_REALARRAY)); - CPPUNIT_ASSERT(_ap->GetRealArray("RealArray")[0] == 0.0); - CPPUNIT_ASSERT(_ap->GetRealArray("RealArray")[1] == 1.1); + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()); + _orb = init(argc , argv ) ; + SALOME_NamingService NS(_orb); + CORBA::Object_var obj = NS.Resolve( "/myStudyManager_embedded" ); + _sm = SALOMEDS::StudyManager::_narrow( obj ); - vector strArray; - strArray.push_back("hello"); - strArray.push_back("world"); - - _ap->SetStrArray("StrArray", strArray); - CPPUNIT_ASSERT(_ap->IsSet("StrArray", PT_STRARRAY)); - CPPUNIT_ASSERT(_ap->GetStrArray("StrArray")[0] == "hello"); - CPPUNIT_ASSERT(_ap->GetStrArray("StrArray")[1] == "world"); + CPPUNIT_ASSERT( !CORBA::is_nil(_sm) ); } - - - diff --git a/src/SALOMEDS/Test/SALOMEDSTest.hxx b/src/SALOMEDS/Test/SALOMEDSTest.hxx index 83c4debb6..64165bbb1 100644 --- a/src/SALOMEDS/Test/SALOMEDSTest.hxx +++ b/src/SALOMEDS/Test/SALOMEDSTest.hxx @@ -23,26 +23,161 @@ #include -#include - #include -#include "SALOME_NamingService.hxx" +#include CORBA_SERVER_HEADER(SALOMEDS) class SALOMEDSTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( SALOMEDSTest ); - CPPUNIT_TEST( testAttributeParameter ); + + //Attributes' tests + + CPPUNIT_TEST( testAttributeComment ); + CPPUNIT_TEST( testAttributeDrawable ); + CPPUNIT_TEST( testAttributeExpandable ); + CPPUNIT_TEST( testAttributeExternalFileDef ); + CPPUNIT_TEST( testAttributeFileType ); + CPPUNIT_TEST( testAttributeFlags ); + CPPUNIT_TEST( testAttributeGraphic ); + CPPUNIT_TEST( testAttributeIOR ); + CPPUNIT_TEST( testAttributeInteger ); + CPPUNIT_TEST( testAttributeLocalID ); + CPPUNIT_TEST( testAttributeName ); + CPPUNIT_TEST( testAttributeOpened ); + CPPUNIT_TEST( testAttributeParameter ); + CPPUNIT_TEST( testAttributePersistentRef ); + CPPUNIT_TEST( testAttributePixMap ); + CPPUNIT_TEST( testAttributePythonObject ); + CPPUNIT_TEST( testAttributeReal ); + CPPUNIT_TEST( testAttributeSelectable ); + CPPUNIT_TEST( testAttributeSequenceOfInteger ); + CPPUNIT_TEST( testAttributeSequenceOfReal ); + CPPUNIT_TEST( testAttributeStudyProperties ); + CPPUNIT_TEST( testAttributeTableOfInteger ); + CPPUNIT_TEST( testAttributeTableOfReal ); + CPPUNIT_TEST( testAttributeTableOfString ); + CPPUNIT_TEST( testAttributeTarget ); + CPPUNIT_TEST( testAttributeTextColor ); + CPPUNIT_TEST( testAttributeTextHighlightColor ); + CPPUNIT_TEST( testAttributeTreeNode ); + CPPUNIT_TEST( testAttributeUserID ); + CPPUNIT_TEST( testChildIterator ); + CPPUNIT_TEST( testSComponent ); + CPPUNIT_TEST( testSComponentIterator ); + CPPUNIT_TEST( testSObject ); + CPPUNIT_TEST( testStudy ); + CPPUNIT_TEST( testStudyBuilder ); + CPPUNIT_TEST( testStudyManager ); + CPPUNIT_TEST( testUseCase ); + + CPPUNIT_TEST_SUITE_END(); public: - void setUp(); - void tearDown(); + virtual void setUp(); + virtual void tearDown(); + + //Attributes + void testAttributeComment(); + void testAttributeDrawable(); + void testAttributeExpandable(); + void testAttributeExternalFileDef(); + void testAttributeFileType(); + void testAttributeFlags(); + void testAttributeGraphic(); + void testAttributeIOR(); + void testAttributeInteger(); + void testAttributeLocalID(); + void testAttributeName(); + void testAttributeOpened(); void testAttributeParameter(); + void testAttributePersistentRef(); + void testAttributePixMap(); + void testAttributePythonObject(); + void testAttributeReal(); + void testAttributeSelectable(); + void testAttributeSequenceOfInteger(); + void testAttributeSequenceOfReal(); + void testAttributeStudyProperties(); + void testAttributeTableOfInteger(); + void testAttributeTableOfReal(); + void testAttributeTableOfString(); + void testAttributeTarget(); + void testAttributeTextColor(); + void testAttributeTextHighlightColor(); + void testAttributeTreeNode(); + void testAttributeUserID(); + + //Objects + void testChildIterator(); + void testSComponent(); + void testSComponentIterator(); + void testSObject(); + void testStudy(); + void testStudyBuilder(); + void testStudyManager(); + void testUseCase(); protected: - CORBA::ORB_var _orb; - SALOME_NamingService* _NS; + +SALOMEDS::StudyManager_var _sm; +CORBA::ORB_var _orb; + +}; + + + +class SALOMEDSTest_Embedded : public SALOMEDSTest +{ + CPPUNIT_TEST_SUITE( SALOMEDSTest_Embedded ); + + //Attributes' tests + + CPPUNIT_TEST( testAttributeComment ); + CPPUNIT_TEST( testAttributeDrawable ); + CPPUNIT_TEST( testAttributeExpandable ); + CPPUNIT_TEST( testAttributeExternalFileDef ); + CPPUNIT_TEST( testAttributeFileType ); + CPPUNIT_TEST( testAttributeFlags ); + CPPUNIT_TEST( testAttributeGraphic ); + CPPUNIT_TEST( testAttributeIOR ); + CPPUNIT_TEST( testAttributeInteger ); + CPPUNIT_TEST( testAttributeLocalID ); + CPPUNIT_TEST( testAttributeName ); + CPPUNIT_TEST( testAttributeOpened ); + CPPUNIT_TEST( testAttributeParameter ); + CPPUNIT_TEST( testAttributePersistentRef ); + CPPUNIT_TEST( testAttributePixMap ); + CPPUNIT_TEST( testAttributePythonObject ); + CPPUNIT_TEST( testAttributeReal ); + CPPUNIT_TEST( testAttributeSelectable ); + CPPUNIT_TEST( testAttributeSequenceOfInteger ); + CPPUNIT_TEST( testAttributeSequenceOfReal ); + CPPUNIT_TEST( testAttributeStudyProperties ); + CPPUNIT_TEST( testAttributeTableOfInteger ); + CPPUNIT_TEST( testAttributeTableOfReal ); + CPPUNIT_TEST( testAttributeTableOfString ); + CPPUNIT_TEST( testAttributeTarget ); + CPPUNIT_TEST( testAttributeTextColor ); + CPPUNIT_TEST( testAttributeTextHighlightColor ); + CPPUNIT_TEST( testAttributeTreeNode ); + CPPUNIT_TEST( testAttributeUserID ); + CPPUNIT_TEST( testChildIterator ); + CPPUNIT_TEST( testSComponent ); + CPPUNIT_TEST( testSComponentIterator ); + CPPUNIT_TEST( testSObject ); + CPPUNIT_TEST( testStudy ); + CPPUNIT_TEST( testStudyBuilder ); + CPPUNIT_TEST( testChildIterator ); + CPPUNIT_TEST( testStudyManager ); + CPPUNIT_TEST( testUseCase ); + + CPPUNIT_TEST_SUITE_END(); + +public: + + virtual void setUp(); }; #endif diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeComment.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeComment.cxx new file mode 100755 index 000000000..ce401624f --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeComment.cxx @@ -0,0 +1,75 @@ +// Copyright (C) 2006 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 +// + + +/*! + * Check all methods of SALOMEDS_AttributeComment + * Use code of SALOMEDS_AttributeComment.cxx + */ + +void SALOMEDSTest::testAttributeComment() +{ + //Create or find the Study manager + _PTR(StudyManager) sm(new SALOMEDS_StudyManager(_sm)); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeComment + _PTR(AttributeComment) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeComment"); + + CPPUNIT_ASSERT(_attr); + + //Check method Value + string value = _attr->Value(); + + CPPUNIT_ASSERT(value.empty()); + + value = "Test string!"; + + //Check method SetValue + _attr->SetValue(value); + + CPPUNIT_ASSERT(value == _attr->Value()); + + //Try to set empty string + _attr->SetValue(""); + CPPUNIT_ASSERT(_attr->Value() == ""); + + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeDrawable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeDrawable.cxx new file mode 100755 index 000000000..b1e72cf76 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeDrawable.cxx @@ -0,0 +1,73 @@ +// Copyright (C) 2006 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 +// + + +/*! + * Check all methods of SALOMEDS_AttributeDrawable + * Use code of SALOMEDS_AttributeDrawable.cxx + */ + +void SALOMEDSTest::testAttributeDrawable() +{ + //Create or find the Study manager + _PTR(StudyManager) sm(new SALOMEDS_StudyManager(_sm)); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeDrawable + _PTR(AttributeDrawable) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeDrawable"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method IsDrawable + bool isDrawable = _attr->IsDrawable(); + + CPPUNIT_ASSERT(!isDrawable); + + //Check method SetDrawable + _attr->SetDrawable(true); + + CPPUNIT_ASSERT(_attr->IsDrawable()); + + _attr->SetDrawable(false); + + CPPUNIT_ASSERT(!_attr->IsDrawable()); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx new file mode 100755 index 000000000..6fc220a12 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExpandable.cxx @@ -0,0 +1,71 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeExpandable + * Use code of SALOMEDS_AttributeExpandable.cxx + */ +void SALOMEDSTest::testAttributeExpandable() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeExpandable + _PTR(AttributeExpandable) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeExpandable"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method IsExpandable + bool isExpandable = _attr->IsExpandable(); + + CPPUNIT_ASSERT(isExpandable); + + //Check method SetExpandable + _attr->SetExpandable(false); + + CPPUNIT_ASSERT(!_attr->IsExpandable()); + + _attr->SetExpandable(true); + + CPPUNIT_ASSERT(_attr->IsExpandable()); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeExternalFileDef.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExternalFileDef.cxx new file mode 100755 index 000000000..db6ca94a9 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeExternalFileDef.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeExternalFileDef + * Use code of SALOMEDS_AttributeExternalFileDef.cxx + */ +void SALOMEDSTest::testAttributeExternalFileDef() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeExternalFileDef + _PTR(AttributeExternalFileDef) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeExternalFileDef"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Value + string value = _attr->Value(); + + CPPUNIT_ASSERT(value.empty()); + + value = "Test string!"; + + //Check method SetValue + _attr->SetValue(value); + + CPPUNIT_ASSERT(value == _attr->Value()); + + //Try to set empty string + _attr->SetValue(""); + CPPUNIT_ASSERT(_attr->Value() == ""); + + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeFileType.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeFileType.cxx new file mode 100755 index 000000000..1db238278 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeFileType.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeFileType + * Use code of SALOMEDS_AttributeFileType.cxx + */ +void SALOMEDSTest::testAttributeFileType() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeFileType + _PTR(AttributeFileType) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeFileType"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Value + string value = _attr->Value(); + + CPPUNIT_ASSERT(value.empty()); + + value = "Test string!"; + + //Check method SetValue + _attr->SetValue(value); + + CPPUNIT_ASSERT(value == _attr->Value()); + + //Try to set empty string + _attr->SetValue(""); + CPPUNIT_ASSERT(_attr->Value() == ""); + + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeFlags.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeFlags.cxx new file mode 100755 index 000000000..d171576c7 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeFlags.cxx @@ -0,0 +1,76 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeFlags + * Use code of SALOMEDS_AttributeFlags.cxx + */ +void SALOMEDSTest::testAttributeFlags() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeFlags + _PTR(AttributeFlags) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeFlags"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Set + _attr->Set(2, true); + + CPPUNIT_ASSERT(_attr->Get(2)); + + _attr->Set(4, false); + + //Check method Get + CPPUNIT_ASSERT(!_attr->Get(4)); + + //Check method GetFlags + int flags = _attr->GetFlags(); + + _attr->SetFlags(flags); + + CPPUNIT_ASSERT(_attr->Get(2)); + + CPPUNIT_ASSERT(!_attr->Get(4)); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeGraphic.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeGraphic.cxx new file mode 100755 index 000000000..b7f6152a8 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeGraphic.cxx @@ -0,0 +1,73 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeGraphic + * Use code of SALOMEDS_AttributeGraphic.cxx + */ +void SALOMEDSTest::testAttributeGraphic() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeGraphic + _PTR(AttributeGraphic) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeGraphic"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method SetVisibility + _attr->SetVisibility(1, true); + + //Check method GetVisibility + CPPUNIT_ASSERT(_attr->GetVisibility(1)); + + _attr->SetVisibility(2, false); + + CPPUNIT_ASSERT(!_attr->GetVisibility(2) && _attr->GetVisibility(1)); + + //Check visibility for 0 and -1 + _attr->SetVisibility(0, false); + CPPUNIT_ASSERT(!_attr->GetVisibility(0)); + _attr->SetVisibility(-1, true); + CPPUNIT_ASSERT(_attr->GetVisibility(-1)); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeIOR.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeIOR.cxx new file mode 100755 index 000000000..5a30c88b1 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeIOR.cxx @@ -0,0 +1,69 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeIOR + * Use code of SALOMEDS_AttributeIOR.cxx + */ +void SALOMEDSTest::testAttributeIOR() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeIOR + _PTR(AttributeIOR) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeIOR"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Value + string value = _attr->Value(); + + CPPUNIT_ASSERT(value.empty()); + + string ior = _orb->object_to_string(_sm); + + //Check method SetValue + _attr->SetValue(ior); + + CPPUNIT_ASSERT(ior == _attr->Value()); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeInteger.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeInteger.cxx new file mode 100755 index 000000000..1476a85be --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeInteger.cxx @@ -0,0 +1,66 @@ +// Copyright (C) 2006 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 +// + + +/*! + * Check all methods of SALOMEDS_AttributeInteger + * Use code of SALOMEDS_AttributeInteger.cxx + */ +void SALOMEDSTest::testAttributeInteger() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeInteger + _PTR(AttributeInteger) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeInteger"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + int value = 10; + + //Check method SetValue + _attr->SetValue(value); + + //Check method Value + CPPUNIT_ASSERT(_attr->Value() == value); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeLocalID.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeLocalID.cxx new file mode 100755 index 000000000..d8fce6079 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeLocalID.cxx @@ -0,0 +1,65 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeLocalID + * Use code of SALOMEDS_AttributeLocalID.cxx + */ +void SALOMEDSTest::testAttributeLocalID() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeLocalID + _PTR(AttributeLocalID) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeLocalID"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + int value = 10; + + //Check method SetValue + _attr->SetValue(value); + + //Check method Value + CPPUNIT_ASSERT(_attr->Value() == value); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeName.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeName.cxx new file mode 100755 index 000000000..2c5d28525 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeName.cxx @@ -0,0 +1,73 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeName + * Use code of SALOMEDS_AttributeName.cxx + */ +void SALOMEDSTest::testAttributeName() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeName + _PTR(AttributeName) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeName"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Value + string value = _attr->Value(); + + CPPUNIT_ASSERT(value.empty()); + + value = "Test string!"; + + //Check method SetValue + _attr->SetValue(value); + + CPPUNIT_ASSERT(value == _attr->Value()); + + //Try to set empty string + _attr->SetValue(""); + CPPUNIT_ASSERT(_attr->Value() == ""); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeOpened.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeOpened.cxx new file mode 100755 index 000000000..9e41cd5bc --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeOpened.cxx @@ -0,0 +1,71 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeOpened + * Use code of SALOMEDS_AttributeOpened.cxx + */ +void SALOMEDSTest::testAttributeOpened() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeOpened + _PTR(AttributeOpened) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeOpened"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method IsOpened + bool isOpened = _attr->IsOpened(); + + CPPUNIT_ASSERT(!isOpened); + + //Check method SetOpened + _attr->SetOpened(true); + + CPPUNIT_ASSERT(_attr->IsOpened()); + + _attr->SetOpened(false); + + CPPUNIT_ASSERT(!_attr->IsOpened()); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeParameter.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeParameter.cxx new file mode 100755 index 000000000..5eb3ba31c --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeParameter.cxx @@ -0,0 +1,146 @@ +// Copyright (C) 2006 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 +// + +#define PT_INTEGER 0 +#define PT_REAL 1 +#define PT_BOOLEAN 2 +#define PT_STRING 3 +#define PT_REALARRAY 4 +#define PT_INTARRAY 5 +#define PT_STRARRAY 6 + +/*! + * Check all methods of SALOMEDS_AttributeParameter + * Use code of SALOMEDS_AttributeParameter.cxx + */ +void SALOMEDSTest::testAttributeParameter() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeParameter + _PTR(AttributeParameter) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeParameter"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Try to retreive a value with invalid ID + bool isRaised = false; + CPPUNIT_ASSERT(!_attr->IsSet("invalid ID", PT_INTEGER)); + try { + _attr->GetInt("invalid ID"); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + //Check method SetInt and GetInt + _attr->SetInt("IntValue", 1); + CPPUNIT_ASSERT(_attr->IsSet("IntValue", PT_INTEGER)); + CPPUNIT_ASSERT(_attr->GetInt("IntValue") == 1); + + //Check method SetReal an GetReal + _attr->SetReal("RealValue", 1.2); + CPPUNIT_ASSERT(_attr->IsSet("RealValue", PT_REAL)); + CPPUNIT_ASSERT(_attr->GetReal("RealValue") == 1.2); + + //Check method SetString and GetString + _attr->SetString("StringValue", "hello"); + CPPUNIT_ASSERT(_attr->IsSet("StringValue", PT_STRING)); + CPPUNIT_ASSERT(_attr->GetString("StringValue") == "hello"); + + //Check method SetBool and GetBool + _attr->SetBool("BoolValue", 0); + CPPUNIT_ASSERT(_attr->IsSet("BoolValue", PT_BOOLEAN)); + CPPUNIT_ASSERT(!_attr->GetBool("BoolValue")); + + _attr->SetBool("BoolValue", 0); + CPPUNIT_ASSERT(_attr->IsSet("BoolValue", PT_BOOLEAN)); + CPPUNIT_ASSERT(!_attr->GetBool("BoolValue")); + + vector intArray; + intArray.push_back(0); + intArray.push_back(1); + + //Check method SetIntArray and GetIntArray + _attr->SetIntArray("IntArray", intArray); + CPPUNIT_ASSERT(_attr->IsSet("IntArray", PT_INTARRAY)); + CPPUNIT_ASSERT(_attr->GetIntArray("IntArray")[0] == 0); + CPPUNIT_ASSERT(_attr->GetIntArray("IntArray")[1] == 1); + + vector realArray; + realArray.push_back(0.0); + realArray.push_back(1.1); + + //Check method SetRealArray and GetRealArray + _attr->SetRealArray("RealArray", realArray); + CPPUNIT_ASSERT(_attr->IsSet("RealArray", PT_REALARRAY)); + CPPUNIT_ASSERT(_attr->GetRealArray("RealArray")[0] == 0.0); + CPPUNIT_ASSERT(_attr->GetRealArray("RealArray")[1] == 1.1); + + vector strArray; + strArray.push_back("hello"); + strArray.push_back("world"); + + //Check method SetStrArray and GetStrArray + _attr->SetStrArray("StrArray", strArray); + CPPUNIT_ASSERT(_attr->IsSet("StrArray", PT_STRARRAY)); + CPPUNIT_ASSERT(_attr->GetStrArray("StrArray")[0] == "hello"); + CPPUNIT_ASSERT(_attr->GetStrArray("StrArray")[1] == "world"); + + /* + string saved = _attr->Save(); + _attr->Load(saved); + + CPPUNIT_ASSERT(_attr->IsSet("IntValue", PT_INTEGER) && _attr->GetInt("IntValue") == 1); + CPPUNIT_ASSERT(_attr->IsSet("RealValue", PT_REAL) && _attr->GetReal("IntValue") == 1.2); + CPPUNIT_ASSERT(_attr->IsSet("StringValue", PT_STRING) && _attr->GetString("StringValue") == "hello"); + CPPUNIT_ASSERT(_attr->IsSet("BoolValue", PT_BOOLEAN) && _attr->GetBool("BoolValue") == 0); + CPPUNIT_ASSERT(_attr->IsSet("IntArray", PT_INTARRAY) && _attr->GetIntArray("IntArray")[0] == 0); + CPPUNIT_ASSERT(_attr->IsSet("IntArray", PT_INTARRAY) && _attr->GetIntArray("IntArray")[1] == 1); + CPPUNIT_ASSERT(_attr->IsSet("RealArray", PT_REALARRAY) && _attr->GetRealArray("RealArray")[0] == 0.0); + CPPUNIT_ASSERT(_attr->IsSet("RealArray", PT_REALARRAY) && _attr->GetRealArray("RealArray")[1] == 1.1); + CPPUNIT_ASSERT(_attr->IsSet("StrArray", PT_STRARRAY) && _attr->GetStrArray("StrArray")[0] == "hello"); + CPPUNIT_ASSERT(_attr->IsSet("StrArray", PT_STRARRAY) && _attr->GetStrArray("StrArray")[1] == "world"); + */ + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributePersistentRef.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributePersistentRef.cxx new file mode 100755 index 000000000..acd864710 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributePersistentRef.cxx @@ -0,0 +1,73 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributePersistentRef + * Use code of SALOMEDS_AttributePersistentRef.cxx + */ +void SALOMEDSTest::testAttributePersistentRef() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + //Check the attribute creation + CPPUNIT_ASSERT(so); + + //Create an attribute AttributePersistentRef + _PTR(AttributePersistentRef) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributePersistentRef"); + + CPPUNIT_ASSERT(_attr); + + //Check method Value + string value = _attr->Value(); + + CPPUNIT_ASSERT(value.empty()); + + value = "Test string!"; + + //Check method SetValue + _attr->SetValue(value); + + CPPUNIT_ASSERT(value == _attr->Value()); + + //Try to set empty string + _attr->SetValue(""); + CPPUNIT_ASSERT(_attr->Value() == ""); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributePixMap.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributePixMap.cxx new file mode 100755 index 000000000..87828f007 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributePixMap.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributePixMap + * Use code of SALOMEDS_AttributePixMap.cxx + */ +void SALOMEDSTest::testAttributePixMap() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributePixMap + _PTR(AttributePixMap) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributePixMap"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method HasPixMap + CPPUNIT_ASSERT(!_attr->HasPixMap()); + + //Check method SetPixMap + string pixmap = "something"; + _attr->SetPixMap(pixmap); + + CPPUNIT_ASSERT(_attr->HasPixMap()); + + //Check method GetPixMap + CPPUNIT_ASSERT(_attr->GetPixMap() == pixmap); + + //Check empty PixMap assigning and retreival + _attr->SetPixMap(""); + CPPUNIT_ASSERT(_attr->GetPixMap() == ""); + + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributePythonObject.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributePythonObject.cxx new file mode 100755 index 000000000..8db63c023 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributePythonObject.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributePythonObject + * Use code of SALOMEDS_AttributePythonObject.cxx + */ +void SALOMEDSTest::testAttributePythonObject() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributePythonObject + _PTR(AttributePythonObject) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributePythonObject"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method IsScript + CPPUNIT_ASSERT(!_attr->IsScript()); + + string pyobj = "some object!"; + + //Check method SetObject + _attr->SetObject(pyobj, true); + + CPPUNIT_ASSERT(_attr->IsScript()); + + //Check method GetObject + CPPUNIT_ASSERT(_attr->GetObject() == pyobj); + + //Check setting and retreival of empty object + _attr->SetObject("", true); + CPPUNIT_ASSERT(_attr->GetObject() == "" && _attr->IsScript()); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeReal.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeReal.cxx new file mode 100755 index 000000000..c04e3e70f --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeReal.cxx @@ -0,0 +1,65 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeReal + * Use code of SALOMEDS_AttributeReal.cxx + */ +void SALOMEDSTest::testAttributeReal() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeReal + _PTR(AttributeReal) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeReal"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + double value = 10.12; + + //Check method SetValue + _attr->SetValue(value); + + //Check method Value + CPPUNIT_ASSERT(_attr->Value() == value); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx new file mode 100755 index 000000000..3c02ae622 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSelectable.cxx @@ -0,0 +1,71 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeSelectable + * Use code of SALOMEDS_AttributeSelectable.cxx + */ +void SALOMEDSTest::testAttributeSelectable() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeSelectable + _PTR(AttributeSelectable) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeSelectable"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method IsSelectable + bool isSelectable = _attr->IsSelectable(); + + CPPUNIT_ASSERT(isSelectable); + + //Check method SetSelectable + _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 new file mode 100755 index 000000000..b90507041 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfInteger.cxx @@ -0,0 +1,127 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeSequenceOfInteger + * Use code of SALOMEDS_AttributeSequenceOfInteger.cxx + */ +void SALOMEDSTest::testAttributeSequenceOfInteger() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeSequenceOfInteger + _PTR(AttributeSequenceOfInteger) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeSequenceOfInteger"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Length + CPPUNIT_ASSERT(_attr->Length() == 0); + + //Check method Add + _attr->Add(1); + + _attr->Add(2); + + _attr->Add(3); + + _attr->Add(4); + + CPPUNIT_ASSERT(_attr->Length() == 4); + + CPPUNIT_ASSERT(_attr->Value(2) == 2); + + //Check method Remove + _attr->Remove(3); + + //Check method Value + CPPUNIT_ASSERT(_attr->Value(3) == 4); + + //Check method ChangeValue + _attr->ChangeValue(3, 3); + + CPPUNIT_ASSERT(_attr->Value(3) == 3); + + //Check method CorbaSequence + vector v = _attr->CorbaSequence(); + CPPUNIT_ASSERT(v.size() == 3); + + + for(int i = 0; iAssign(v); + + CPPUNIT_ASSERT(_attr->Length() == 4); + + CPPUNIT_ASSERT(_attr->Value(4) == 5); + + //Check processing of invalid indicies + bool isRaised = false; + try { + _attr->Value(-1); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + isRaised = false; + try { + _attr->ChangeValue(12, 1); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + isRaised = false; + try { + _attr->Remove(10); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfReal.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfReal.cxx new file mode 100755 index 000000000..ed4747576 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeSequenceOfReal.cxx @@ -0,0 +1,121 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeSequenceOfReal + * Use code of SALOMEDS_AttributeSequenceOfReal.cxx + */ +void SALOMEDSTest::testAttributeSequenceOfReal() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeSequenceOfReal + _PTR(AttributeSequenceOfReal) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeSequenceOfReal"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Length + CPPUNIT_ASSERT(_attr->Length() == 0); + + //Check method Add + _attr->Add(1.1); + + _attr->Add(2.2); + + _attr->Add(3.3); + + _attr->Add(4.4); + + CPPUNIT_ASSERT(_attr->Length() == 4); + + CPPUNIT_ASSERT(_attr->Value(2) == 2.2); + + //Check method Remove + _attr->Remove(3); + + CPPUNIT_ASSERT(_attr->Value(3) == 4.4); + + //Check method ChangeValue + _attr->ChangeValue(3, 3.3); + + CPPUNIT_ASSERT(_attr->Value(3) == 3.3); + + //Check method CorbaSequence + vector v = _attr->CorbaSequence(); + CPPUNIT_ASSERT(v.size() == 3); + + v.push_back(5.5); + + _attr->Assign(v); + + CPPUNIT_ASSERT(_attr->Length() == 4); + + CPPUNIT_ASSERT(_attr->Value(4) == 5.5); + + //Check processing of invalid indicies + bool isRaised = false; + try { + _attr->Value(-1); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + isRaised = false; + try { + _attr->ChangeValue(12, 1); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + isRaised = false; + try { + _attr->Remove(10); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeStudyProperties.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeStudyProperties.cxx new file mode 100755 index 000000000..965773d4d --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeStudyProperties.cxx @@ -0,0 +1,113 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeStudyProperties + * Use code of SALOMEDS_AttributeStudyProperties.cxx + */ +void SALOMEDSTest::testAttributeStudyProperties() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeStudyProperties + _PTR(AttributeStudyProperties) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeStudyProperties"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method SetCreationDate + _attr->SetCreationDate(1, 2, 3, 4, 5); + + //Check method GetCreationDate + int MN, H, D, MH, Y; + _attr->GetCreationDate(MN, H, D, MH, Y); + + CPPUNIT_ASSERT(MN == 1 && H == 2 && D == 3 && MH == 4 && Y == 5); + + //Check method SetUserName + _attr->SetUserName("srn"); + + //Check method GetUserName + CPPUNIT_ASSERT(_attr->GetUserName() == "srn"); + + //Check method SetCreationMode + string value = "from scratch"; + _attr->SetCreationMode(value); + + //Check method GetCreationMode + CPPUNIT_ASSERT(_attr->GetCreationMode() == value); + + //Check method SetModified + _attr->SetModified(2); + + //Check method IsModified + CPPUNIT_ASSERT(_attr->IsModified()); + + //Check method GetModified + CPPUNIT_ASSERT(_attr->GetModified() == 2); + + //Check method SetLocked + _attr->SetLocked(true); + + //Check method IsLocked + CPPUNIT_ASSERT(_attr->IsLocked()); + + _attr->SetLocked(false); + + CPPUNIT_ASSERT(!_attr->IsLocked()); + + //Check method SetModification + _attr->SetModification("srn2", 6, 7, 8, 9, 10); + + //Check method GetModificationsList + vector vs; + vector vi[5]; + _attr->GetModificationsList(vs, vi[0], vi[1], vi[2], vi[3], vi[4], false); + CPPUNIT_ASSERT(vs[0] == "srn2" && vi[0][0] == 6 && vi[1][0] == 7 && vi[2][0] == 8 && vi[3][0] == 9 && vi[4][0] == 10); + + vs.clear(); + for(int i=0; i<5; i++) vi[i].clear(); + + _attr->GetModificationsList(vs, vi[0], vi[1], vi[2], vi[3], vi[4], true); + CPPUNIT_ASSERT(vs[0] == "srn" && vi[0][0] == 1 && vi[1][0] == 2 && vi[2][0] == 3 && vi[3][0] == 4 && vi[4][0] == 5); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfInteger.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfInteger.cxx new file mode 100755 index 000000000..35ed1d4be --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfInteger.cxx @@ -0,0 +1,190 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTableOfInteger + * Use code of SALOMEDS_AttributeTableOfInteger.cxx + */ +void SALOMEDSTest::testAttributeTableOfInteger() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTableOfInteger + _PTR(AttributeTableOfInteger) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTableOfInteger"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method SetTitle + _attr->SetTitle("Table_1"); + + //Check method GetTitle + CPPUNIT_ASSERT(_attr->GetTitle() == "Table_1"); + + //Check method SetNbColumns + _attr->SetNbColumns(2); + + //Check method GetNbColumns + CPPUNIT_ASSERT(_attr->GetNbColumns() == 2); + + //Check method HasValue + CPPUNIT_ASSERT(!_attr->HasValue(1, 1)); + + bool isCaught = false; + try { + _attr->GetValue(1, 1); + } + catch(...) { + isCaught = true; + } + CPPUNIT_ASSERT(isCaught); + + //Check method PutValue + _attr->PutValue(23, 1,1); + + CPPUNIT_ASSERT(_attr->HasValue(1, 1)); + + //Check method GetValue + CPPUNIT_ASSERT(_attr->GetValue(1, 1) == 23); + + //Check method GetRowSetIndices + 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"); + + //Check method GetRowTitles + vector rt = _attr->GetRowTitles(); + + CPPUNIT_ASSERT(rt.size() == 2 && rt[0] == "new_title" && rt[1] == "title2"); + + vector colTitles; + colTitles.push_back("title1"); + colTitles.push_back("title2"); + + //Check method SetColumnTitles + _attr->SetColumnTitles(colTitles); + + //Check method SetColumnTitle + _attr->SetColumnTitle(1, "new_title"); + + //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"); + rowUnits.push_back("unit2"); + + //Check method SetRowUnits + _attr->SetRowUnits(rowUnits); + + //Check method SetRowUnit + _attr->SetRowUnit(1, "new_unit"); + + //Check method GetRowUnits + vector ru = _attr->GetRowUnits(); + + CPPUNIT_ASSERT(ru.size() == 2 && ru[0] == "new_unit" && ru[1] == "unit2"); + + //Check method GetNbColumns + CPPUNIT_ASSERT(_attr->GetNbColumns() == 2); + + //Check method AddRow + vector data; + data.push_back(11); + data.push_back(22); + + _attr->AddRow(data); + + CPPUNIT_ASSERT(_attr->GetNbRows() == 3); + + //Check method GetRow + vector data2 = _attr->GetRow(3); + + CPPUNIT_ASSERT(data2.size() == 2 && data2[0] == 11 && data2[1] == 22); + + //Check method SetRow + data[0] = 33; + _attr->SetRow(3, data); + + data2 = _attr->GetRow(3); + + CPPUNIT_ASSERT(data2.size() == 2 && data2[0] == 33 && data2[1] == 22); + + //Check method AddColumn + data[0] = -11; + data[1] = -22; + data.push_back(-33); + + _attr->AddColumn(data); + + + CPPUNIT_ASSERT(_attr->GetNbColumns() == 3); + + //Check method GetColumn + data2 = _attr->GetColumn(3); + + CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == -11 && data2[1] == -22 && data2[2] == -33); + + //Check method SetColumn + data[0] = 11; + _attr->SetColumn(3, data); + + 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 new file mode 100755 index 000000000..e86d3ef58 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfReal.cxx @@ -0,0 +1,189 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTableOfReal + * Use code of SALOMEDS_AttributeTableOfReal.cxx + */ +void SALOMEDSTest::testAttributeTableOfReal() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTableOfReal + _PTR(AttributeTableOfReal) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTableOfReal"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method SetTitle + _attr->SetTitle("Table_1"); + + //Check method GetTitle + CPPUNIT_ASSERT(_attr->GetTitle() == "Table_1"); + + //Check method SetNbColumns + _attr->SetNbColumns(2); + + //Check method GetNbColumns + CPPUNIT_ASSERT(_attr->GetNbColumns() == 2); + + //Check method HasValue + CPPUNIT_ASSERT(!_attr->HasValue(1, 1)); + + bool isCaught = false; + try { + _attr->GetValue(1, 1); + } + catch(...) { + isCaught = true; + } + CPPUNIT_ASSERT(isCaught); + + //Check method PutValue + _attr->PutValue(23.23, 1,1); + + CPPUNIT_ASSERT(_attr->HasValue(1, 1)); + + //Check method GetValue + CPPUNIT_ASSERT(_attr->GetValue(1, 1) == 23.23); + + //Check method GetRowSetIndices + vector rs = _attr->GetRowSetIndices(1); + + CPPUNIT_ASSERT(rs.size() == 1 && rs[0] == 1); + + _attr->PutValue(32.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"); + + //Check method GetRowTitles + vector rt = _attr->GetRowTitles(); + + CPPUNIT_ASSERT(rt.size() == 2 && rt[0] == "new_title" && rt[1] == "title2"); + + vector colTitles; + colTitles.push_back("title1"); + colTitles.push_back("title2"); + + //Check method SetColumnTitles + _attr->SetColumnTitles(colTitles); + + //Check method SetColumnTitle + _attr->SetColumnTitle(1, "new_title"); + + //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"); + rowUnits.push_back("unit2"); + + //Check method SetRowUnits + _attr->SetRowUnits(rowUnits); + + //Check method SetRowUnit + _attr->SetRowUnit(1, "new_unit"); + + //Check method GetRowUnits + vector ru = _attr->GetRowUnits(); + + CPPUNIT_ASSERT(ru.size() == 2 && ru[0] == "new_unit" && ru[1] == "unit2"); + + //Check method GetNbColumns + CPPUNIT_ASSERT(_attr->GetNbColumns() == 2); + + //Check method AddRow + vector data; + data.push_back(11.11); + data.push_back(22.22); + + _attr->AddRow(data); + + CPPUNIT_ASSERT(_attr->GetNbRows() == 3); + + //Check method GetRow + vector data2 = _attr->GetRow(3); + + CPPUNIT_ASSERT(data2.size() == 2 && data2[0] == 11.11 && data2[1] == 22.22); + + //Check method SetRow + data[0] = 33.33; + _attr->SetRow(3, data); + + data2 = _attr->GetRow(3); + + CPPUNIT_ASSERT(data2.size() == 2 && data2[0] == 33.33 && data2[1] == 22.22); + + //Check method AddColumn + data[0] = -11.11; + data[1] = -22.22; + data.push_back(-33.33); + + _attr->AddColumn(data); + + CPPUNIT_ASSERT(_attr->GetNbColumns() == 3); + + //Check method GetColumn + data2 = _attr->GetColumn(3); + + CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == -11.11 && data2[1] == -22.22 && data2[2] == -33.33); + + //Check method SetColumn + data[0] = 11.11; + _attr->SetColumn(3, data); + + data2 = _attr->GetColumn(3); + + CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == 11.11 && data2[1] == -22.22 && data2[2] == -33.33); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfString.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfString.cxx new file mode 100755 index 000000000..f9de75405 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTableOfString.cxx @@ -0,0 +1,190 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTableOfString + * Use code of SALOMEDS_AttributeTableOfString.cxx + */ +void SALOMEDSTest::testAttributeTableOfString() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTableOfString + _PTR(AttributeTableOfString) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTableOfString"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + //Check method SetTitle + _attr->SetTitle("Table_1"); + + //Check method GetTitle + CPPUNIT_ASSERT(_attr->GetTitle() == "Table_1"); + + //Check method SetNbColumns + _attr->SetNbColumns(2); + + //Check method GetNbColumns + CPPUNIT_ASSERT(_attr->GetNbColumns() == 2); + + //Check method HasValue + CPPUNIT_ASSERT(!_attr->HasValue(1, 1)); + + bool isCaught = false; + try { + _attr->GetValue(1, 1); + } + catch(...) { + isCaught = true; + } + CPPUNIT_ASSERT(isCaught); + + + //Check method PutValue + _attr->PutValue("23", 1,1); + + CPPUNIT_ASSERT(_attr->HasValue(1, 1)); + + //Check method GetValue + CPPUNIT_ASSERT(_attr->GetValue(1, 1) == "23"); + + //Check method GetRowSetIndices + 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"); + + //Check method GetRowTitles + vector rt = _attr->GetRowTitles(); + + CPPUNIT_ASSERT(rt.size() == 2 && rt[0] == "new_title" && rt[1] == "title2"); + + + vector colTitles; + colTitles.push_back("title1"); + colTitles.push_back("title2"); + + //Check method SetColumnTitles + _attr->SetColumnTitles(colTitles); + + //Check method SetColumnTitle + _attr->SetColumnTitle(1, "new_title"); + + //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"); + rowUnits.push_back("unit2"); + + //Check method SetRowUnits + _attr->SetRowUnits(rowUnits); + + //Check method SetRowUnit + _attr->SetRowUnit(1, "new_unit"); + + //Check method GetRowUnits + vector ru = _attr->GetRowUnits(); + + CPPUNIT_ASSERT(ru.size() == 2 && ru[0] == "new_unit" && ru[1] == "unit2"); + + //Check method GetNbColumns + CPPUNIT_ASSERT(_attr->GetNbColumns() == 2); + + //Check method AddRow + vector data; + data.push_back("11"); + data.push_back("22"); + + _attr->AddRow(data); + + CPPUNIT_ASSERT(_attr->GetNbRows() == 3); + + //Check method GetRow + vector data2 = _attr->GetRow(3); + + CPPUNIT_ASSERT(data2.size() == 2 && data2[0] == "11" && data2[1] == "22"); + + //Check method SetRow + data[0] = "33"; + _attr->SetRow(3, data); + + data2 = _attr->GetRow(3); + + CPPUNIT_ASSERT(data2.size() == 2 && data2[0] == "33" && data2[1] == "22"); + + //Check method AddColumn + data[0] = "-11"; + data[1] = "-22"; + data.push_back("-33"); + + _attr->AddColumn(data); + + CPPUNIT_ASSERT(_attr->GetNbColumns() == 3); + + //Check method GetColumn + data2 = _attr->GetColumn(3); + + CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == "-11" && data2[1] == "-22" && data2[2] == "-33"); + + //Check method SetColumn + data[0] = "11"; + _attr->SetColumn(3, data); + + 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_AttributeTarget.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTarget.cxx new file mode 100755 index 000000000..4f2785f0d --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTarget.cxx @@ -0,0 +1,89 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTarget + * Use code of SALOMEDS_AttributeTarget.cxx + */ +void SALOMEDSTest::testAttributeTarget() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTarget + _PTR(AttributeTarget) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTarget"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method Get + CPPUNIT_ASSERT(_attr->Get().size() == 0); + + _PTR(SObject) so1 = study->CreateObjectID("0:1:2"); + studyBuilder->Addreference(so1, so); + + _PTR(SObject) so2 = study->CreateObjectID("0:1:3"); + studyBuilder->Addreference(so2, so1); + + //Check method Add + _attr->Add(so1); + + _attr->Add(so2); + + //Check method Get + vector< _PTR(SObject) > v = _attr->Get(); + + CPPUNIT_ASSERT(v.size() == 2); + + CPPUNIT_ASSERT(v[0]->GetID() == "0:1:2"); + + CPPUNIT_ASSERT(v[1]->GetID() == "0:1:3"); + + //Check method Remove + _attr->Remove(so1); + + v = _attr->Get(); + + CPPUNIT_ASSERT(v.size() == 1); + + CPPUNIT_ASSERT(v[0]->GetID() == "0:1:3"); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx new file mode 100755 index 000000000..de2f21099 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextColor.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTextColor + * Use code of SALOMEDS_AttributeTextColor.cxx + */ +void SALOMEDSTest::testAttributeTextColor() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTextColor + _PTR(AttributeTextColor) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTextColor"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + STextColor color; + color.R = 0; + color.G = 1; + color.B = 2; + + //Check method SetTextColor + _attr->SetTextColor(color); + + //Check method TextColor + STextColor color2 = _attr->TextColor(); + + CPPUNIT_ASSERT(color.R == color2.R); + + CPPUNIT_ASSERT(color.G == color2.G); + + CPPUNIT_ASSERT(color.B == color2.B); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextHighlightColor.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextHighlightColor.cxx new file mode 100755 index 000000000..40ec96098 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTextHighlightColor.cxx @@ -0,0 +1,74 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTextHighlightColor + * Use code of SALOMEDS_AttributeTextHighlightColor.cxx + */ +void SALOMEDSTest::testAttributeTextHighlightColor() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTextHighlightColor + _PTR(AttributeTextHighlightColor) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTextHighlightColor"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + STextColor color; + color.R = 0; + color.G = 1; + color.B = 2; + + //Check method SetTextHighlightColor + _attr->SetTextHighlightColor(color); + + //Check method TextHighlightColor + STextColor color2 = _attr->TextHighlightColor(); + + CPPUNIT_ASSERT(color.R == color2.R); + + CPPUNIT_ASSERT(color.G == color2.G); + + CPPUNIT_ASSERT(color.B == color2.B); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx new file mode 100755 index 000000000..270ba559b --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeTreeNode.cxx @@ -0,0 +1,195 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeTreeNode + * Use code of SALOMEDS_AttributeTreeNode.cxx + */ +#define SALOMEDS_ALL_TESTS +void SALOMEDSTest::testAttributeTreeNode() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeTreeNode + _PTR(AttributeTreeNode) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeTreeNode"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + string TreeNodeID = "0e1c36e6-379b-4d90-ab3b-17a14310e648"; + + _PTR(SObject) so1 = study->CreateObjectID("0:1:2"); + + _PTR(AttributeTreeNode) _attr1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeTreeNode"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr1); + + //Check method Label + CPPUNIT_ASSERT(_attr1->Label() == "0:1:2"); + + _PTR(SObject) so2 = study->CreateObjectID("0:1:3"); + + _PTR(AttributeTreeNode) _attr2 = studyBuilder->FindOrCreateAttribute(so2, "AttributeTreeNode"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr2); + + //Check method SetFather + _attr1->SetFather(_attr); + + //Check method HasFather + CPPUNIT_ASSERT(_attr1->HasFather()); + +#ifdef SALOMEDS_ALL_TESTS + //Check method GetFather + CPPUNIT_ASSERT(_attr1->GetFather()->Label() == _attr->Label()); + + //Check method Append + _attr->Append(_attr1); + + //Check possibility to Append to itself + bool isRaised = false; + try { + _attr->Append(_attr); + }catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + _attr->Append(_attr2); + + //Check method HasNext + CPPUNIT_ASSERT(_attr1->HasNext()); + + //Check method GetNext + CPPUNIT_ASSERT(_attr1->GetNext()->Label() == _attr2->Label()); + + //Check method HasPrevious + CPPUNIT_ASSERT(_attr2->HasPrevious()); + + //Check method GetPrevious + CPPUNIT_ASSERT(_attr2->GetPrevious()->Label() == _attr1->Label()); + + //Check method Depth + CPPUNIT_ASSERT(_attr->Depth() == 1 && _attr1->Depth() == 2); + + //Check method IsRoot + CPPUNIT_ASSERT(_attr->IsRoot()); + + //Check method IsFather + CPPUNIT_ASSERT(_attr->IsFather(_attr1)); + + //Check method IsDescendant + CPPUNIT_ASSERT(_attr2->IsDescendant(_attr)); + + //Check method GetFirst + CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr1->Label()); + + _attr2->Remove(); + + //Check method Prepend + _attr->Prepend(_attr2); + + CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr2->Label()); + + //Check possibility to Prepend to itself + isRaised = false; + try { + _attr->Prepend(_attr); + }catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + _attr1->Remove(); + + //Check method InsertBefore + _attr2->InsertBefore(_attr1); + + CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr1->Label()); + + //Check possibility to InsertBefore to itself + isRaised = false; + try { + _attr->InsertBefore(_attr); + }catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + _attr1->Remove(); + + //Check method InsertAfter + _attr2->InsertAfter(_attr1); + + CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr2->Label()); + + //Check possibility to InsertAfter to itself + isRaised = false; + try { + _attr->InsertAfter(_attr); + }catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + //Check method Remove + _attr2->Remove(); + + CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr1->Label()); + + //Check method SetTreeID and GetTreeID + _attr2->SetTreeID(TreeNodeID); + + CPPUNIT_ASSERT(_attr2->GetTreeID() == TreeNodeID); +#else + cout << endl << "THE TEST IS NOT COMPLETE !!!" << endl; +#endif + + + //Try to create the attribute with given TreeID + string value = "0e1c36e6-1111-4d90-ab3b-18a14310e648"; + _PTR(AttributeTreeNode) _attr_guid = studyBuilder->FindOrCreateAttribute(so, "AttributeTreeNodeGUID"+value); + CPPUNIT_ASSERT(_attr_guid && _attr_guid->GetTreeID() == value); + + sm->Close(study); +} +#undef SALOMEDS_ALL_TESTS + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx b/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx new file mode 100755 index 000000000..1af8beeba --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_AttributeUserID.cxx @@ -0,0 +1,70 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_AttributeUserID + * Use code of SALOMEDS_AttributeUserID.cxx + */ +void SALOMEDSTest::testAttributeUserID() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + //Create an attribute AttributeUserID + _PTR(AttributeUserID) _attr = studyBuilder->FindOrCreateAttribute(so, "AttributeUserID"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + string value = "0e1c36e6-379b-4d90-ab3b-17a14310e648"; + + //Check method SetValue + _attr->SetValue(value); + + //Check method Value + CPPUNIT_ASSERT(value == _attr->Value()); + + //Try to create the attribute with given UserID + value = "0e1c36e6-379b-4d90-ab3b-18a14310e648"; + _PTR(AttributeUserID) _attr2 = studyBuilder->FindOrCreateAttribute(so, "AttributeUserID"+value); + CPPUNIT_ASSERT(_attr2 && _attr2->Value() == value); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx b/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx new file mode 100755 index 000000000..ac3f02690 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_ChildIterator.cxx @@ -0,0 +1,79 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_ChildIterator + * Use code of SALOMEDS_ChildIterator.cxx + */ +void SALOMEDSTest::testChildIterator() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a SObject with entry 0:1:1 + _PTR(SObject) so = study->CreateObjectID("0:1:1"); + + CPPUNIT_ASSERT(so); + + _PTR(SObject) so1 = studyBuilder->NewObjectToTag(so, 1); + studyBuilder->NewObjectToTag(so1, 2); + + _PTR(ChildIterator) ci = study->NewChildIterator(so); + + //Check the creation of the ChildIterator + CPPUNIT_ASSERT(ci); + + int count = 0; + for(; ci->More(); ci->Next()) { + //Check method Value + CPPUNIT_ASSERT(ci->Value()->Tag() == 1); + count++; + } + + //Check that there is only one SObject on the first level of so + CPPUNIT_ASSERT(count == 1); + + count = 0; + int i = 1; + for(ci->InitEx(true); ci->More(); ci->Next(), i++) { + CPPUNIT_ASSERT(ci->Value()->Tag() == i); + count++; + } + + //Check that there are two SObject under so + CPPUNIT_ASSERT(count == 2); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx b/src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx new file mode 100755 index 000000000..1ca79b8c4 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_SComponent.cxx @@ -0,0 +1,70 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_SComponent + * Use code of SALOMEDS_SComponent.cxx + */ +void SALOMEDSTest::testSComponent() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + _PTR(SComponent) sco = studyBuilder->NewComponent("Test"); + + //Check the creation of the SComponent + CPPUNIT_ASSERT(sco); + + //Create an attribute AttributeIOR + _PTR(AttributeIOR) _attr = studyBuilder->FindOrCreateAttribute(sco, "AttributeIOR"); + + //Check the attribute creation + CPPUNIT_ASSERT(_attr); + + //Check method ComponentIOR + + string ior = _orb->object_to_string(_sm); + + _attr->SetValue(ior); + string new_ior; + CPPUNIT_ASSERT(sco->ComponentIOR(new_ior)); + + CPPUNIT_ASSERT(new_ior == ior); + + //Check method ComponentDataType + CPPUNIT_ASSERT(sco->ComponentDataType() == "Test"); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_SComponentIterator.cxx b/src/SALOMEDS/Test/SALOMEDSTest_SComponentIterator.cxx new file mode 100755 index 000000000..7ca4ca72c --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_SComponentIterator.cxx @@ -0,0 +1,65 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_SComponentIterator + * Use code of SALOMEDS_SComponentIterator.cxx + */ +void SALOMEDSTest::testSComponentIterator() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create two SComponents + studyBuilder->NewComponent("Test1"); + studyBuilder->NewComponent("Test2"); + + vector v; + v.push_back("Test1"); + v.push_back("Test2"); + + _PTR(SComponentIterator) ci = study->NewComponentIterator(); + + //Check the creation of the SComponentIterator + CPPUNIT_ASSERT(ci); + + for(int i = 0; ci->More(); ci->Next(), i++) { + //Check method Value + CPPUNIT_ASSERT(i<2); + CPPUNIT_ASSERT(ci->Value()->ComponentDataType() == v[i]); + } + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx b/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx new file mode 100755 index 000000000..c79274f8b --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_SObject.cxx @@ -0,0 +1,125 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_SObject + * Use code of SALOMEDS_SObject.cxx + */ + +void SALOMEDSTest::testSObject() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("TestSObject"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + CPPUNIT_ASSERT(studyBuilder); + + //Create a new SComponent + _PTR(SComponent) sco = studyBuilder->NewComponent("Test"); + + //Create new SObject + _PTR(SObject) so = studyBuilder->NewObjectToTag(sco, 2); + + //Check the creation of the SObject + CPPUNIT_ASSERT(so); + + //Check method GetID + CPPUNIT_ASSERT(so->GetID() == "0:1:1:2"); + + //Check method Tag + CPPUNIT_ASSERT(so->Tag() == 2); + + //Check method GetFatherComponent + _PTR(SComponent) father = so->GetFatherComponent(); + CPPUNIT_ASSERT(father->GetID() == sco->GetID()); + + //Check method GetFather + _PTR(SObject) so1 = studyBuilder->NewObject(so); + CPPUNIT_ASSERT(so1->GetFather()->GetID() == so->GetID()); + + //Check method FindAttribute + + _PTR(AttributeIOR) _attrIOR = studyBuilder->FindOrCreateAttribute(so, "AttributeIOR"); + _PTR(AttributeName) _attrName = studyBuilder->FindOrCreateAttribute(so, "AttributeName"); + _PTR(AttributeComment) _attrComment = studyBuilder->FindOrCreateAttribute(so, "AttributeComment"); + + string ior = _orb->object_to_string(_sm); + _attrIOR->SetValue(ior); + _attrName->SetValue("SO name"); + _attrComment->SetValue("SO comment"); + + _PTR(GenericAttribute) ga; + CPPUNIT_ASSERT(so->FindAttribute(ga, "AttributeIOR")); + + //Try to find attribute with empty type + CPPUNIT_ASSERT(!so->FindAttribute(ga, "")); + + //Check method ReferencedObject + studyBuilder->Addreference(so1, so); + _PTR(SObject) so2; + CPPUNIT_ASSERT(so1->ReferencedObject(so2)); + CPPUNIT_ASSERT(so2->GetID() == so->GetID()); + + //Check method FindSubObject + CPPUNIT_ASSERT(so->FindSubObject(1, so2)); + CPPUNIT_ASSERT(so2->GetID() == so1->GetID()); + + //Check method GetStudy + CPPUNIT_ASSERT(so->GetStudy()->StudyId() == study->StudyId()); + + //Check methods Name + so->Name("test"); + CPPUNIT_ASSERT(so->Name() == "test"); + + //Check method GetAllAttributes + vector< _PTR(GenericAttribute) > v = so->GetAllAttributes(); + + CPPUNIT_ASSERT(v.size() == 5); //+AttributeTarget +AttributeTreeNode + + //Check method GetName + CPPUNIT_ASSERT(so->GetName() == "SO name"); + + //Check method GetComment + CPPUNIT_ASSERT(so->GetComment() == "SO comment"); + + //Check method GetIOR + CPPUNIT_ASSERT(so->GetIOR() == ior); + + //Check method Depth + CPPUNIT_ASSERT(so->Depth() == 3); + + //Check method GetObject + CORBA::Object_var obj = dynamic_cast(so.get())->GetObject(); + CPPUNIT_ASSERT(!CORBA::is_nil(obj)); + + sm->Close(study); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx b/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx new file mode 100755 index 000000000..1a34ea293 --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_Study.cxx @@ -0,0 +1,349 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_Study + * Use code of SALOMEDS_Study.cxx + */ + +void SALOMEDSTest::testStudy() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("Test"); + + //Check the creation of the study + CPPUNIT_ASSERT(study); + + //Check method NewBuilder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + CPPUNIT_ASSERT(studyBuilder); + + //Check method NewComponentIterator + _PTR(SComponentIterator) componentIterator = study->NewComponentIterator(); + + CPPUNIT_ASSERT(componentIterator); + + //Check method GetTransientReference + CPPUNIT_ASSERT(!study->GetTransientReference().empty()); + + //Check method StudyId + CPPUNIT_ASSERT(study->StudyId() > 0); + + //Check method Name (get/set) + CPPUNIT_ASSERT(study->Name() == "Test"); + study->Name("New name"); + CPPUNIT_ASSERT(study->Name() == "New name"); + study->Name("Test"); + + //Check method URL (get/set) + study->URL(""); + CPPUNIT_ASSERT(study->URL() == ""); + study->URL("some url"); + CPPUNIT_ASSERT(study->URL() == "some url"); + + //Check method GetPersistentReference == URL + CPPUNIT_ASSERT(study->GetPersistentReference() == "some url"); + + //Check method IsSaved (get/set) + study->IsSaved(true); + CPPUNIT_ASSERT(study->IsSaved()); + study->IsSaved(false); + CPPUNIT_ASSERT(!study->IsSaved()); + + //Check method CreateObjectID + _PTR(SObject) so = study->CreateObjectID("0:2:1:3"); + CPPUNIT_ASSERT(so); + + //Try to create SObject with empty and invalid entries + CPPUNIT_ASSERT(!study->CreateObjectID("")); + CPPUNIT_ASSERT(!study->CreateObjectID("entry")); + + //Check method NewChildIterator + _PTR(ChildIterator) childIterator = study->NewChildIterator(so); + CPPUNIT_ASSERT(childIterator); + + //Check method IsEmpty + CPPUNIT_ASSERT(!study->IsEmpty()); + + //Check method FindComponent + _PTR(SComponent) sco1 = studyBuilder->NewComponent("test1"); + _PTR(SComponent) sco2 = study->FindComponent("test1"); + CPPUNIT_ASSERT(sco1 && sco2); + CPPUNIT_ASSERT(sco1->GetID() == sco2->GetID()); + _PTR(AttributeName) name_attr_sco1 = studyBuilder->FindOrCreateAttribute(sco1, "AttributeName"); + CPPUNIT_ASSERT(name_attr_sco1); + name_attr_sco1->SetValue("sco1"); + + //Try to find component with empty type + CPPUNIT_ASSERT(!study->FindComponent("")); + + //Check method GetComponentNames + vector components = study->GetComponentNames(""); //The context doesn't matter + CPPUNIT_ASSERT(components.size() == 1 && components[0] == "sco1"); + + //Check method FindComponentID + _PTR(SComponent) sco3 = study->FindComponentID(sco1->GetID()); + CPPUNIT_ASSERT(sco3 && sco3->GetID() == sco1->GetID()); + + //Try to find component with empty id + CPPUNIT_ASSERT(!study->FindComponentID("")); + + _PTR(SObject) so1 = studyBuilder->NewObject(sco1); + CPPUNIT_ASSERT(so1); + _PTR(AttributeName) name_attr_so1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeName"); + CPPUNIT_ASSERT(name_attr_so1); + name_attr_so1->SetValue("so1"); + + //Create an attribute AttributeIOR + _PTR(AttributeIOR) ior_attr_so1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeIOR"); + CPPUNIT_ASSERT(ior_attr_so1); + + string ior = _orb->object_to_string(_sm); + ior_attr_so1->SetValue(ior); + + _PTR(SObject) so2 = studyBuilder->NewObject(so1); + CPPUNIT_ASSERT(so2); + _PTR(AttributeName) name_attr_so2 = studyBuilder->FindOrCreateAttribute(so2, "AttributeName"); + CPPUNIT_ASSERT(name_attr_so2); + name_attr_so2->SetValue("so2"); + + //Check method FindObject + _PTR(SObject) so3 = study->FindObject("so1"); + CPPUNIT_ASSERT(so3 && so3->GetID() == so1->GetID()); + + //Try to find SObject with empty name + CPPUNIT_ASSERT(!study->FindObject("")); + + //Check method FindObjectID + _PTR(SObject) so4 = study->FindObjectID(so1->GetID()); + CPPUNIT_ASSERT(so4 && so4->GetID() == so1->GetID()); + + //Try to find SObject with empty ID + CPPUNIT_ASSERT(!study->FindObjectID("")); + + //Check method FindObjectByName + vector< _PTR(SObject) > v = study->FindObjectByName("so1", sco1->ComponentDataType()); + CPPUNIT_ASSERT(v.size()==1 && v[0]->GetID() == so1->GetID()); + + //Try to find SObject with empty name and empty component type + CPPUNIT_ASSERT((study->FindObjectByName("", "")).size() == 0); + + //Check method FindObjectByPath + _PTR(SObject) path_so = study->FindObjectByPath("/"+sco1->GetName()+"/"+so1->GetName()); + CPPUNIT_ASSERT(path_so && path_so->GetID() == so1->GetID()); + + //Check method FindObjectIOR + _PTR(SObject) so5 = study->FindObjectIOR(ior); + CPPUNIT_ASSERT(so5 && so5->GetID() == so1->GetID()); + + //Try to find SObject with empty IOR + CPPUNIT_ASSERT(!study->FindObjectIOR("")); + + //Check method GetObjectPath + string path = study->GetObjectPath(so2); + + //Try to get path of NULL SObject + _PTR(SObject) emptySO; + path = study->GetObjectPath(emptySO); + CPPUNIT_ASSERT(path.empty()); + + //Check method SetContext + study->SetContext("/sco1"); + CPPUNIT_ASSERT(study->GetContext() == "/sco1"); + + //Check method FindObjectByPath + _PTR(SObject) so6 = study->FindObjectByPath("so1"); + CPPUNIT_ASSERT(so6 && so6->GetID() == so1->GetID()); + + + //Try to find SObject with empty path + _PTR(SObject) tmp = study->FindObjectByPath(""); //Must return the Context SObject + CPPUNIT_ASSERT(tmp && tmp->GetID() == sco1->GetID()); + + study->SetContext("/"); //Root + + //Check method GetObjectNames + vector vs = study->GetObjectNames("/sco1"); + CPPUNIT_ASSERT(vs.size() == 2); + + //Check method GetDirectoryNames + _PTR(AttributeLocalID) locid_attr_sco1 = studyBuilder->FindOrCreateAttribute(sco1, "AttributeLocalID"); + CPPUNIT_ASSERT(locid_attr_sco1); + locid_attr_sco1->SetValue(16661); //DIRECTORYID + _PTR(AttributeLocalID) locid_attr_so1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeLocalID"); + CPPUNIT_ASSERT(locid_attr_so1); + locid_attr_so1->SetValue(16661); //DIRECTORYID + vs = study->GetDirectoryNames(""); //Empty context (the current is taken) + CPPUNIT_ASSERT(vs.size() == 2); + + //Check method GetFileNames + locid_attr_sco1->SetValue(26662); //FILELOCALID + _PTR(AttributePersistentRef) persref_attr_sco1 = studyBuilder->FindOrCreateAttribute(sco1, "AttributePersistentRef"); + CPPUNIT_ASSERT(persref_attr_sco1); + persref_attr_sco1->SetValue("FILE: filename1"); + locid_attr_so1->SetValue(26662); //FILELOCALID + _PTR(AttributePersistentRef) persref_attr_so1 = studyBuilder->FindOrCreateAttribute(so1, "AttributePersistentRef"); + CPPUNIT_ASSERT(persref_attr_so1); + persref_attr_so1->SetValue("FILE: filename2"); + vs = study->GetFileNames(""); + CPPUNIT_ASSERT(vs.size() == 2 && vs[0] == "filename1" && vs[1] == "filename2"); + + //Check method StudyId (get/set) + int id = study->StudyId(); + study->StudyId(-1); + CPPUNIT_ASSERT(study->StudyId() == -1); + study->StudyId(id); + + //Check method FindDependances + studyBuilder->Addreference(so2, so1); + studyBuilder->Addreference(sco1, so1); + vector< _PTR(SObject) > vso = study->FindDependances(so1); + CPPUNIT_ASSERT(vso.size() == 2 && vso[0]->GetID() == so2->GetID() && vso[1]->GetID() == sco1->GetID()); + + //Check method GetProperties + _PTR(AttributeStudyProperties) sp = study->GetProperties(); + CPPUNIT_ASSERT(sp); + + //Check Lock functionality + sp->SetLocked(true); + bool isLockRaised = false; + try { + name_attr_so1->SetValue("test"); + } + catch(...) { + isLockRaised = true; + } + CPPUNIT_ASSERT(isLockRaised); + + sp->SetLocked(false); + isLockRaised = false; + try { + name_attr_so1->SetValue("test"); + } + catch(...) { + isLockRaised = true; + } + CPPUNIT_ASSERT(!isLockRaised); + + //Check method GetLastModificationDate + sp->SetModification("srn", 1, 2, 3, 4, 5); + sp->SetModification("srn", 6, 7, 8, 9, 10); + string date = study->GetLastModificationDate(); + + CPPUNIT_ASSERT(date == "08/09/0010 07:06"); + + //Check method GetModificationsDate + vs = study->GetModificationsDate(); + CPPUNIT_ASSERT(vs.size() == 2 && vs[0] == "03/04/0005 02:01" && vs[1] == "08/09/0010 07:06"); + + //Check method GetCommonParameters + _PTR(AttributeParameter) cp = study->GetCommonParameters("id", 1); //Save point = 1 + CPPUNIT_ASSERT(cp); + cp->SetBool("test_true", true); + cp->SetBool("test_false", false); + _PTR(AttributeParameter) cp2 = study->GetCommonParameters("id", 1); //Save point = 1 + CPPUNIT_ASSERT(cp2); + CPPUNIT_ASSERT(cp2->GetBool("test_true") && !cp2->GetBool("test_false")); + _PTR(AttributeParameter) cp21 = study->GetCommonParameters("id", 2); //Save point = 2 + CPPUNIT_ASSERT(cp21); + CPPUNIT_ASSERT(!cp21->IsSet("test_true", PT_BOOLEAN) && !cp21->IsSet("test_false", PT_BOOLEAN)); + + //Check method GetModuleParameters + _PTR(AttributeParameter) cp3 = study->GetModuleParameters("id", "module name", 1); //Save point = 1, name = "module name" + CPPUNIT_ASSERT(cp3); + cp3->SetBool("test_true", true); + cp3->SetBool("test_false", false); + _PTR(AttributeParameter) cp4 = study->GetModuleParameters("id", "module name", 1); //Save point = 1, name = "module name" + CPPUNIT_ASSERT(cp4); + CPPUNIT_ASSERT(cp4->GetBool("test_true") && !cp4->GetBool("test_false")); + _PTR(AttributeParameter) cp5 = study->GetModuleParameters("id", "module name 2", 1); //Save point = 1, name = "module name 2" + CPPUNIT_ASSERT(cp5); + CPPUNIT_ASSERT(!cp5->IsSet("test_true", PT_BOOLEAN) && !cp5->IsSet("test_false", PT_BOOLEAN)); + _PTR(AttributeParameter) cp6 = study->GetModuleParameters("id", "module name", 2); //Save point = 2, name = "module name" + CPPUNIT_ASSERT(cp6); + CPPUNIT_ASSERT(!cp6->IsSet("test_true", PT_BOOLEAN) && !cp6->IsSet("test_false", PT_BOOLEAN)); + + //Check method GetUseCaseBuilder + _PTR(UseCaseBuilder) ub = study->GetUseCaseBuilder(); + CPPUNIT_ASSERT(ub); + + //Check method SetStudyLock + study->SetStudyLock("locker1"); + + //Check method IsStudyLocked + CPPUNIT_ASSERT(study->IsStudyLocked()); + + //Check method GetLockerID + study->SetStudyLock("locker2"); + vs = study->GetLockerID(); + CPPUNIT_ASSERT(vs.size() == 2 && vs[0] == "locker1" && vs[1] == "locker2"); + + //Check method UnLockStudy + study->UnLockStudy("locker1"); + CPPUNIT_ASSERT(study->IsStudyLocked()); + vs = study->GetLockerID(); + CPPUNIT_ASSERT(vs.size() == 1 && vs[0] == "locker2"); + study->UnLockStudy("locker2"); + CPPUNIT_ASSERT(!study->IsStudyLocked()); + vs = study->GetLockerID(); + CPPUNIT_ASSERT(vs.size() == 0); + + //Check method EnableUseCaseAutoFilling + study->EnableUseCaseAutoFilling(false); + _PTR(SObject) uso1 = study->NewBuilder()->NewObject(sco1); + vector< _PTR(GenericAttribute) > va1 = uso1->GetAllAttributes(); + CPPUNIT_ASSERT(va1.size() == 0); + + study->EnableUseCaseAutoFilling(true); + _PTR(SObject) uso2 = study->NewBuilder()->NewObject(sco1); + vector< _PTR(GenericAttribute) > va2 = uso2->GetAllAttributes(); + CPPUNIT_ASSERT(va2.size() == 1); // +AttributeTreeNode + + //Check method DumpStudy + study->DumpStudy(".", "SRN", false); + + fstream f("SRN.py"); + char buffer[128]; + buffer[81] = (char)0; + f.getline(buffer, 80); + string line(buffer); + + f.close(); + system("rm -f SRN.py"); + CPPUNIT_ASSERT(line == "### This file is generated by SALOME automatically by dump python functionality"); + + //Check method Close + bool isException = false; + try { + sm->Close(study); //Close is called inside StudyManager::Close + } + catch(...) { + isException = true; + } + CPPUNIT_ASSERT(!isException); +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx b/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx new file mode 100755 index 000000000..109ac0e2d --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_StudyBuilder.cxx @@ -0,0 +1,250 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_StudyBuilder + * Use code of SALOMEDS_StudyBuilder.cxx + */ + +void SALOMEDSTest::testStudyBuilder() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("TestStudyBuilder"); + + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + + //Check the StudyBuilder creation + CPPUNIT_ASSERT(studyBuilder); + + //Check method NewComponent + _PTR(SComponent) sco1 = studyBuilder->NewComponent("Test"); + CPPUNIT_ASSERT(sco1 && sco1->ComponentDataType() == "Test"); + + //Check method DefineComponentInstance + string ior = _orb->object_to_string(_sm); + studyBuilder->DefineComponentInstance(sco1, ior); + string newior; + sco1->ComponentIOR(newior); + CPPUNIT_ASSERT(newior == ior); + + //Check method RemoveComponent + studyBuilder->RemoveComponent(sco1); + _PTR(SComponent) sco2 = study->FindComponent("Test"); + CPPUNIT_ASSERT(!sco2); + + //Try to create and find the component with empty type + _PTR(SComponent) sco_empty = studyBuilder->NewComponent(""); + CPPUNIT_ASSERT(!sco_empty); + + _PTR(SComponent) sco3 = studyBuilder->NewComponent("NewComp"); + CPPUNIT_ASSERT(sco3); + + //Check method NewObject + _PTR(SObject) so1 = studyBuilder->NewObject(sco3); + CPPUNIT_ASSERT(so1); + string id1 = so1->GetID(); + + //Check method NewObjectToTag + _PTR(SObject) so2 = studyBuilder->NewObjectToTag(so1, 2); + CPPUNIT_ASSERT(so2 && so2->Tag() == 2); + string id2 = so2->GetID(); + + //Check method FindOrCreateAttribute + _PTR(SObject) so3 = studyBuilder->NewObject(sco3); + CPPUNIT_ASSERT(so3); + _PTR(AttributeName) an3 = studyBuilder->FindOrCreateAttribute(so3, "AttributeName"); + CPPUNIT_ASSERT(an3); + + //Try to create attribute with invalid type + CPPUNIT_ASSERT(!studyBuilder->FindOrCreateAttribute(so3, "invalid type")); + + //Check method FindAttribute + _PTR(GenericAttribute) ga; + CPPUNIT_ASSERT(studyBuilder->FindAttribute(so3, ga, "AttributeName")); + + //Try to find attribute with invalid type + CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so3, ga, "invalid type")); + + //Check method RemoveObject + studyBuilder->RemoveObject(so3); + CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so3, ga, "AttributeName")); + + //Check method RemoveObjectWithChildren + _PTR(AttributeName) an2 = studyBuilder->FindOrCreateAttribute(so2, "AttributeName"); + CPPUNIT_ASSERT(an2); + studyBuilder->RemoveObjectWithChildren(so1); + CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so2, ga, "AttributeName")); + + //Check method RemoveAttribute + _PTR(AttributeName) an1 = studyBuilder->FindOrCreateAttribute(so1, "AttributeName"); + CPPUNIT_ASSERT(an1); + CPPUNIT_ASSERT(studyBuilder->FindAttribute(so1, ga, "AttributeName")); + studyBuilder->RemoveAttribute(so1, "AttributeName"); + CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so1, ga, "AttributeName")); + + //Check method Addreference + studyBuilder->Addreference(so2, so1); + _PTR(SObject) refSO; + CPPUNIT_ASSERT(so2->ReferencedObject(refSO) && refSO->GetID() == so1->GetID()); + + //Try to set reference to NULL SObject + bool isRaised = false; + _PTR(SObject) empty_so; + try { + studyBuilder->Addreference(so2, empty_so); + } + catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + //Check method RemoveReference + studyBuilder->RemoveReference(so2); + CPPUNIT_ASSERT(!so2->ReferencedObject(refSO)); + + //Check method SetGUID and IsGUID + string value = "0e1c36e6-379b-4d90-ab3b-17a14310e648"; + studyBuilder->SetGUID(so1, value); + + CPPUNIT_ASSERT(studyBuilder->IsGUID(so1, value)); + +/* Not implemented + //Check method UndoLimit (set/get) + studyBuilder->UndoLimit(10); + CPPUNIT_ASSERT(studyBuilder->UndoLimit() == 10); +*/ + + //Check method SetName + studyBuilder->SetName(so1, "new name"); + CPPUNIT_ASSERT(so1->GetName() == "new name"); + + //Try to set empty Name + studyBuilder->SetName(so1, ""); + CPPUNIT_ASSERT(so1->GetName() == ""); + + //Check method SetComment + studyBuilder->SetComment(so1, "new comment"); + CPPUNIT_ASSERT(so1->GetComment() == "new comment"); + + //Check method empty Comment + studyBuilder->SetComment(so1, ""); + CPPUNIT_ASSERT(so1->GetComment() == ""); + + //Try to set empty IOR + studyBuilder->SetIOR(so1, ""); + CPPUNIT_ASSERT(so1->GetIOR() == ""); + + //Check method SetIOR + studyBuilder->SetIOR(so1, ior); + CPPUNIT_ASSERT(so1->GetIOR() == ior); + + sm->Close(study); + + //Check method LoadWith + _PTR(Study) study2 = sm->NewStudy("Study2"); + + SALOME_NamingService NS(_orb); + CORBA::Object_var obj = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("FactoryServer", "SMESH"); + CPPUNIT_ASSERT(!CORBA::is_nil(obj)); + + 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("SMESH"); + + ior = _orb->object_to_string(drv); + sb2->DefineComponentInstance(sco, ior); + + sm->SaveAs("srn_SALOMEDS_UnitTests.hdf", study2, false); + sm->Close(study2); + + _PTR(Study) study3 = sm->Open("srn_SALOMEDS_UnitTests.hdf"); + _PTR(StudyBuilder) sb3 = study3->NewBuilder(); + _PTR(SComponent) aComp = study3->FindComponent("SMESH"); + CPPUNIT_ASSERT(aComp); + + 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 = ""; + aComp->ComponentIOR(ior); + CPPUNIT_ASSERT(!ior.empty()); + + system("rm -f srn_SALOMEDS_UnitTests.hdf"); + + //Check method AddDirectory + _PTR(AttributeName) na1 = sb3->FindOrCreateAttribute(aComp, "AttributeName"); + na1->SetValue("Component"); + + isRaised = false; + try { + sb3->AddDirectory("/Component/Dir1"); + } catch(...) { + isRaised = true; + } + + + CPPUNIT_ASSERT(!isRaised); + _PTR(SObject) so5 = study3->FindObjectByPath("/Component/Dir1"); + CPPUNIT_ASSERT(so5); + + isRaised = false; + try { + sb3->AddDirectory("/Component/Dir1"); //Attempt to create the same directory + } catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + isRaised = false; + try { + sb3->AddDirectory("/MyComponent/Dir1"); //Attempt to create the invalid directory + } catch(...) { + isRaised = true; + } + CPPUNIT_ASSERT(isRaised); + + sm->Close(study3); +} diff --git a/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx b/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx new file mode 100755 index 000000000..4f2f7369d --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_StudyManager.cxx @@ -0,0 +1,168 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_StudyManager + * Use code of SALOMEDS_StudyManager.cxx + */ +void SALOMEDSTest::testStudyManager() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + + CPPUNIT_ASSERT(sm); + + //Check method NewStudy + _PTR(Study) study1 = sm->NewStudy("Study1"); + CPPUNIT_ASSERT(study1); + + _PTR(Study) study2 = sm->NewStudy("Study2"); + CPPUNIT_ASSERT(study2); + + //Check method GetStudyByName + _PTR(Study) study3 = sm->GetStudyByName("Study1"); + CPPUNIT_ASSERT(study3->StudyId() == study1->StudyId()); + CPPUNIT_ASSERT(study3->Name() == study1->Name()); + + //Check method GetStudyByName with empty name + CPPUNIT_ASSERT(!sm->GetStudyByName("")); + + //Try to create Study with empty name + _PTR(Study) study_empty = sm->NewStudy(""); + CPPUNIT_ASSERT(study_empty); + CPPUNIT_ASSERT(sm->GetStudyByName("")); + sm->Close(study_empty); + + //Check method FindStudyByID + _PTR(Study) study4 = sm->GetStudyByID(study2->StudyId()); + CPPUNIT_ASSERT(study4->StudyId() == study2->StudyId()); + CPPUNIT_ASSERT(study4->Name() == study2->Name()); + + //Check method GetOpenStudies + vector v = sm->GetOpenStudies(); + CPPUNIT_ASSERT(v.size() == 2); + + //Check method Close + int id = study2->StudyId(); + sm->Close(study2); + CPPUNIT_ASSERT(!sm->GetStudyByID(id)); + + //Check method GetStudyByID for invalid ID + CPPUNIT_ASSERT(!sm->GetStudyByID(-1)); + + //Check methods CanPaste, CanCopy, Copy, Paste + _PTR(StudyBuilder) sb1 = study1->NewBuilder(); + _PTR(SComponent) sco1 = sb1->NewComponent("Test"); + _PTR(SObject) so1 = sb1->NewObject(sco1); + _PTR(AttributeName) na1 = sb1->FindOrCreateAttribute(so1, "AttributeName"); + CPPUNIT_ASSERT(na1); + na1->SetValue("Some name"); + + CPPUNIT_ASSERT(!sm->CanCopy(so1)); //The father component has no IOR + + CPPUNIT_ASSERT(sm->Copy(so1)); + + CPPUNIT_ASSERT(!sm->CanPaste(so1)); //The father component has no IOR + + _PTR(SObject) so1_2 = sb1->NewObject(sco1); + _PTR(SObject) pasted_so = sm->Paste(so1_2); + CPPUNIT_ASSERT(pasted_so); + + _PTR(AttributeName) na2 = sb1->FindOrCreateAttribute(pasted_so, "AttributeName"); + CPPUNIT_ASSERT(na2 && na2->Value() == "Some name"); + + + //Check method SaveAs + sm->SaveAs("srn_UnitTest_Save.hdf", study1, false); + string url = study1->URL(); + sm->Close(study1); + + //Check method Open + _PTR(Study) study1_opened = sm->Open("srn_UnitTest_Save.hdf"); //Contains Test component + system("rm -f srn_UnitTest_Save.hdf"); + url = study1->URL(); + CPPUNIT_ASSERT(study1_opened); + CPPUNIT_ASSERT(url == "srn_UnitTest_Save.hdf"); + + //Check method Save + _PTR(StudyBuilder) sb3 = study1_opened->NewBuilder(); + _PTR(SComponent) sco3 = study1_opened->FindComponent("Test"); + CPPUNIT_ASSERT(sco3); + // Add a new SObject with AttributeName that contains "Saved study" string + _PTR(SObject) so3 = sb3->NewObject(sco3); + 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); + CPPUNIT_ASSERT(url == "srn_UnitTest_SaveASCII.hdf"); + + //Check method SaveASCII + _PTR(StudyBuilder) sb5 = study3_opened->NewBuilder(); + _PTR(SComponent) sco5 = study3_opened->FindComponent("Test"); + CPPUNIT_ASSERT(sco5); + // Add a new SObject with AttributeName that contains "Saved study" string + _PTR(SObject) so5 = sb5->NewObject(sco5); + soID = so5->GetID(); + _PTR(AttributeName) na5 = sb5->FindOrCreateAttribute(so5, "AttributeName"); + CPPUNIT_ASSERT(na5); + na5->SetValue("Saved study ASCII"); + // Save and close the study + sm->Save(study3_opened, false); + sm->Close(study3_opened); + + // Open saved study and find the created SObject with AttributeName, then compare the stored string + _PTR(Study) study4_opened = sm->Open("srn_UnitTest_SaveASCII.hdf"); + system("rm -f srn_UnitTest_SaveASCII.hdf"); + CPPUNIT_ASSERT(study4_opened); + _PTR(SObject) so6 = study4_opened->CreateObjectID(soID); + _PTR(StudyBuilder) sb6 = study4_opened->NewBuilder(); + _PTR(AttributeName) na6 = sb6->FindOrCreateAttribute(so6, "AttributeName"); + CPPUNIT_ASSERT(na6 && na6->Value() == "Saved study ASCII"); //Compare the value of restored attribute with string that has to be saved. +} + + + diff --git a/src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx b/src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx new file mode 100755 index 000000000..27c2246ce --- /dev/null +++ b/src/SALOMEDS/Test/SALOMEDSTest_UseCase.cxx @@ -0,0 +1,149 @@ +// Copyright (C) 2006 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 +// + +/*! + * Check all methods of SALOMEDS_UseCaseBuilder and UseCaseIterator + * Use code of SALOMEDS_UseCaseBuilder.cxx and SALOMEDS_UseCaseIterator.cxx + */ + +#define SALOMEDS_ALL_TESTS + +void SALOMEDSTest::testUseCase() +{ + //Create or find the Study manager + _PTR(StudyManager) sm ( new SALOMEDS_StudyManager(_sm) ); + CPPUNIT_ASSERT(sm); + + //Create a new study + _PTR(Study) study = sm->NewStudy("TestSObject"); + CPPUNIT_ASSERT(study); + + //Create Study Builder + _PTR(StudyBuilder) studyBuilder = study->NewBuilder(); + CPPUNIT_ASSERT(studyBuilder); + + //Create a new UseCaseBuilder + _PTR(UseCaseBuilder) builder = study->GetUseCaseBuilder(); + CPPUNIT_ASSERT(builder); + + //Check method AddUseCase + _PTR(SObject) root1 = builder->AddUseCase("UseCase_1"); + _PTR(SObject) root2 = builder->AddUseCase("UseCase_2"); + CPPUNIT_ASSERT(root1 && root2); + + //Check method SetCurrentObject + builder->SetCurrentObject(root1); + + //Check method GetCurrentObject + CPPUNIT_ASSERT(builder->GetCurrentObject() && builder->GetCurrentObject()->GetID() == root1->GetID()); + + //Check method SetRootCurrent + CPPUNIT_ASSERT(builder->SetRootCurrent()); + CPPUNIT_ASSERT(builder->GetCurrentObject()->GetID() == "0:2"); //Root in UseCases is always placed at label 0:2 + + //Check method IsUseCase + CPPUNIT_ASSERT(builder->IsUseCase(root1) && builder->IsUseCase(root2)); + + //Check method SetName + builder->SetName("A root use case"); + + //Check method GetName + CPPUNIT_ASSERT(builder->GetName() == "A root use case"); + +#ifdef SALOMEDS_ALL_TESTS + //Check method GetUseCaseIterator + builder->SetRootCurrent(); + _PTR(SObject) nullObject; + _PTR(UseCaseIterator) root_it = builder->GetUseCaseIterator(nullObject); //The iterator on all UseCases + root_it->Init(false); //Only the first level + CPPUNIT_ASSERT(root_it->More()); + CPPUNIT_ASSERT(root_it->Value()->GetID() == root1->GetID()); + root_it->Next(); + CPPUNIT_ASSERT(root_it->More()); + CPPUNIT_ASSERT(root_it->Value()->GetID() == root2->GetID()); + root_it->Next(); + CPPUNIT_ASSERT(!root_it->More()); +#else + cout << endl << "THE TEST IS NOT COMPLETE !!!" << endl; +#endif + + builder->SetCurrentObject(root1); + _PTR(UseCaseIterator) it = builder->GetUseCaseIterator(root1); //The iterator on the given UseCase + + //Check method Append + _PTR(SObject) so1 = study->CreateObjectID("0:1:1"); + _PTR(SObject) so2 = study->CreateObjectID("0:1:2"); + CPPUNIT_ASSERT(builder->Append(so1)); + + //Check methods Init, More, Next and Value of UseCaseIterator + it->Init(false); + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID()); + it->Next(); + CPPUNIT_ASSERT(!it->More()); + + //Check method AppendTo + CPPUNIT_ASSERT(builder->AppendTo(so1, so2)); + + //Check method HasChildren + CPPUNIT_ASSERT(builder->HasChildren(so1)); + CPPUNIT_ASSERT(!builder->HasChildren(so2)); + + //Check method Init of UseCaseIterator + it->Init(false); //Only the first level + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID()); + it->Next(); + CPPUNIT_ASSERT(!it->More()); + + it->Init(true); //All levels + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID()); + it->Next(); + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so2->GetID()); + it->Next(); + CPPUNIT_ASSERT(!it->More()); + + //Check method Remove + CPPUNIT_ASSERT(builder->Remove(so2)); + it->Init(true); + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID()); + it->Next(); + CPPUNIT_ASSERT(!it->More()); + + CPPUNIT_ASSERT(builder->Append(so2)); + + //Check method InsertBefore + CPPUNIT_ASSERT(builder->InsertBefore(so2, so1)); + + it->Init(false); + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so2->GetID()); + it->Next(); + CPPUNIT_ASSERT(it->More()); + CPPUNIT_ASSERT(it->Value()->GetID() == so1->GetID()); + + sm->Close(study); +} +#undef SALOMEDS_ALL_TESTS + + diff --git a/src/SALOMEDS/Test/TestSALOMEDS.cxx b/src/SALOMEDS/Test/TestSALOMEDS.cxx index 68c94b243..2d02b2829 100644 --- a/src/SALOMEDS/Test/TestSALOMEDS.cxx +++ b/src/SALOMEDS/Test/TestSALOMEDS.cxx @@ -26,10 +26,147 @@ // --- Registers the fixture into the 'registry' -CPPUNIT_TEST_SUITE_REGISTRATION( SALOMELocalTraceTest ); -CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSImplTest ); CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest ); +CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest_Embedded ); -// --- generic Main program from Basic/Test +#include +#include +#include +#include +#include +#include +#include +#include -#include "BasicMainTest.hxx" +#include +#include + +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include "utilities.h" +#include "Utils_SINGLETON.hxx" +#include "Utils_ORB_INIT.hxx" +#include "OpUtil.hxx" +#include "SALOME_NamingService.hxx" +#include "NamingService_WaitForServerReadiness.hxx" +#include "SALOMEDS_StudyManager_i.hxx" + +// ============================================================================ +/*! + * Main program source for Unit Tests with cppunit package does not depend + * on actual tests, so we use the same for all partial unit tests. + */ +// ============================================================================ + +int main(int argc, char* argv[]) +{ + // --- Run Salome without GUI + + setenv("SALOME_trace", "file:./traceUnitTest.log", 1); // 1: overwrite + + system("runSalome -t &"); + + // --- Wait till SALOMEDS server is launched + + char hostname[511]; + int size; + gethostname(hostname, size); + char* chr_port = getenv("SALOMEDS_UNITTESTS_PORT"); + string port; + if(chr_port) port = chr_port; + if(port.empty()) port = "2810"; + string cfg_file = string(getenv("HOME"))+"/.omniORB_"+string(hostname)+"_"+port+".cfg"; + setenv("OMNIORB_CONFIG", cfg_file.c_str(), 1); + + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()); + CORBA::ORB_var orb = init(argc , argv ) ; + + sleep(15); + + string host; // = GetHostname(); + char* wait_Superv = getenv("SALOMEDS_UNITTESTS_WAIT_SUPERVISOR"); + if(wait_Superv) host = GetHostname(); + + SALOME_NamingService NS(orb); + if(host.empty()) + NamingService_WaitForServerReadiness(&NS, "/myStudyManager"); + else { + string serverName = "/Containers/"+host+"/SuperVisionContainer"; + NamingService_WaitForServerReadiness(&NS, serverName); + } + + CORBA::Object_var obj = NS.Resolve( "/myStudyManager" ); + if(CORBA::is_nil(obj)) { + system("killSalome.py"); + return 1; + } + + //Set up the environement for Embedded case + string kernel_root = getenv("KERNEL_ROOT_DIR"); + CPPUNIT_ASSERT(!kernel_root.empty()); + kernel_root+="/share/salome/resources/kernel"; + + CORBA::Object_var poaObj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(poaObj)) { + PortableServer::POA_var poa = PortableServer::POA::_narrow(poaObj); + + SALOMEDS_StudyManager_i * aStudyManager_i = new SALOMEDS_StudyManager_i(orb, poa); + // Activate the objects. This tells the POA that the objects are ready to accept requests. + PortableServer::ObjectId_var aStudyManager_iid = poa->activate_object(aStudyManager_i); + aStudyManager_i->register_name("/myStudyManager_embedded"); + + // Obtain a POAManager, and tell the POA to start accepting + // requests on its objects. + PortableServer::POAManager_var pman = poa->the_POAManager(); + pman->activate(); + } + + + // --- Create the event manager and test controller + CPPUNIT_NS::TestResult controller; + + // --- Add a listener that colllects test result + CPPUNIT_NS::TestResultCollector result; + controller.addListener( &result ); + + // --- Add a listener that print dots as test run. +#ifdef WIN32 + CPPUNIT_NS::TextTestProgressListener progress; +#else + CPPUNIT_NS::BriefTestProgressListener progress; +#endif + controller.addListener( &progress ); + + // --- Get the top level suite from the registry + + CPPUNIT_NS::Test *suite = + CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest(); + + // --- Adds the test to the list of test to run + + CPPUNIT_NS::TestRunner runner; + runner.addTest( suite ); + runner.run( controller); + + // --- Print test in a compiler compatible format. + + std::ofstream testFile; + testFile.open("UnitTestsResult", std::ios::out | std::ios::trunc); + //CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr ); + CPPUNIT_NS::CompilerOutputter outputter( &result, testFile ); + outputter.write(); + + // --- Run the tests. + + bool wasSucessful = result.wasSuccessful(); + testFile.close(); + + // --- Kill all created Salome process + + system("killSalome.py"); + + // --- Return error code 1 if the one of test failed. + + return wasSucessful ? 0 : 1; +} diff --git a/src/SALOMEDSClient/Makefile.am b/src/SALOMEDSClient/Makefile.am index 489548895..4615a1a86 100644 --- a/src/SALOMEDSClient/Makefile.am +++ b/src/SALOMEDSClient/Makefile.am @@ -55,6 +55,7 @@ salomeinclude_HEADERS=\ SALOMEDSClient_AttributeTreeNode.hxx \ SALOMEDSClient_AttributeUserID.hxx \ SALOMEDSClient_AttributeParameter.hxx \ + SALOMEDSClient_AttributeString.hxx \ SALOMEDSClient_ChildIterator.hxx \ SALOMEDSClient_GenericAttribute.hxx \ SALOMEDSClient_SComponent.hxx \ diff --git a/src/SALOMEDSClient/SALOMEDSClient.hxx b/src/SALOMEDSClient/SALOMEDSClient.hxx index a03c019e0..6551f3cbb 100644 --- a/src/SALOMEDSClient/SALOMEDSClient.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient.hxx @@ -50,6 +50,7 @@ #include "SALOMEDSClient_AttributeTreeNode.hxx" #include "SALOMEDSClient_AttributeUserID.hxx" #include "SALOMEDSClient_AttributeParameter.hxx" +#include "SALOMEDSClient_AttributeString.hxx" #include "SALOMEDSClient_ChildIterator.hxx" #include "SALOMEDSClient_GenericAttribute.hxx" #include "SALOMEDSClient_SComponent.hxx" diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx b/src/SALOMEDSClient/SALOMEDSClient_AttributeString.hxx similarity index 64% rename from src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx rename to src/SALOMEDSClient/SALOMEDSClient_AttributeString.hxx index 7a0cd5471..442a94952 100644 --- a/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx +++ b/src/SALOMEDSClient/SALOMEDSClient_AttributeString.hxx @@ -17,21 +17,22 @@ // // 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 +// File : SALOMEDSClient_AttributeString.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef SALOMEDSClient_AttributeString_HeaderFile +#define SALOMEDSClient_AttributeString_HeaderFile + +#include "SALOMEDSClient_definitions.hxx" +#include "SALOMEDSClient_GenericAttribute.hxx" +#include + +class SALOMEDSClient_AttributeString: public virtual SALOMEDSClient_GenericAttribute +{ +public: + virtual std::string Value() = 0; + virtual void SetValue(const std::string& value) = 0; +}; + #endif diff --git a/src/SALOMEDSClient/SALOMEDSClient_AttributeTreeNode.hxx b/src/SALOMEDSClient/SALOMEDSClient_AttributeTreeNode.hxx index b3b31b94d..47383e748 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_AttributeTreeNode.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_AttributeTreeNode.hxx @@ -27,7 +27,7 @@ #include "SALOMEDSClient_definitions.hxx" #include "SALOMEDSClient_GenericAttribute.hxx" -class SALOMEDSClient_AttributeTreeNode +class SALOMEDSClient_AttributeTreeNode: public virtual SALOMEDSClient_GenericAttribute { public: diff --git a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx index 6c226d402..703b65f5c 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_ClientFactory.hxx @@ -38,7 +38,7 @@ #include #include CORBA_CLIENT_HEADER(SALOMEDS) -class ClientFactory { +class SALOMEDSCLIENT_EXPORT ClientFactory { public: /*! diff --git a/src/SALOMEDSClient/SALOMEDSClient_Study.hxx b/src/SALOMEDSClient/SALOMEDSClient_Study.hxx index f3cf67d8e..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; @@ -86,6 +87,10 @@ public: virtual _PTR(AttributeParameter) GetCommonParameters(const std::string& theID, int theSavePoint) = 0; virtual _PTR(AttributeParameter) GetModuleParameters(const std::string& theID, const std::string& theModuleName, int theSavePoint) = 0; + virtual void SetStudyLock(const std::string& theLockerID) = 0; + virtual bool IsStudyLocked() = 0; + virtual void UnLockStudy(const std::string& theLockerID) = 0; + virtual std::vector GetLockerID() = 0; }; diff --git a/src/SALOMEDSClient/SALOMEDSClient_definitions.hxx b/src/SALOMEDSClient/SALOMEDSClient_definitions.hxx index 8b1137e37..752c9849d 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_definitions.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_definitions.hxx @@ -20,6 +20,16 @@ #ifndef SALOMEDSCLIENT_DEF_HXX #define SALOMEDSCLIENT_DEF_HXX +#ifdef WIN32 +# ifdef SALOMEDSCLIENT_EXPORTS +# define SALOMEDSCLIENT_EXPORT __declspec( dllexport ) +# else +# define SALOMEDSCLIENT_EXPORT __declspec( dllimport ) +# endif +#else +# define SALOMEDSCLIENT_EXPORT +#endif + #include template class clt_shared_ptr: public boost::shared_ptr @@ -30,7 +40,7 @@ public: template explicit clt_shared_ptr(Y * p) { - reset(p); + boost::shared_ptr::reset(p); } template diff --git a/src/SALOMEDSImpl/Makefile.am b/src/SALOMEDSImpl/Makefile.am index ca9352aab..4ca4e58ab 100644 --- a/src/SALOMEDSImpl/Makefile.am +++ b/src/SALOMEDSImpl/Makefile.am @@ -66,13 +66,13 @@ salomeinclude_HEADERS= \ SALOMEDSImpl_AttributeComment.hxx \ SALOMEDSImpl_AttributeReference.hxx \ SALOMEDSImpl_AttributeParameter.hxx \ + SALOMEDSImpl_AttributeString.hxx \ SALOMEDSImpl_UseCaseBuilder.hxx \ SALOMEDSImpl_UseCaseIterator.hxx \ SALOMEDSImpl_SComponentIterator.hxx \ SALOMEDSImpl_StudyBuilder.hxx \ SALOMEDSImpl_Study.hxx \ SALOMEDSImpl_StudyManager.hxx \ - SALOMEDSImpl_OCAFApplication.hxx \ SALOMEDSImpl_ChildNodeIterator.hxx \ SALOMEDSImpl_IParameters.hxx \ SALOMEDSImpl_TMPFile.hxx @@ -85,21 +85,18 @@ 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@ - -# This flag is used to resolve the dependencies of OCC libraries. -LDXMUFLAGS = -L/usr/X11R6/lib@LIB_LOCATION_SUFFIX@ -lXmu + -I$(srcdir)/../DF \ + @HDF5_INCLUDES@ \ + @BOOST_CPPFLAGS@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ ../HDFPersist/libSalomeHDFPersist.la \ - @CAS_OCAF@ \ - @HDF5_LIBS@ \ - $(LDXMUFLAGS) + ../DF/libDF.la \ + @HDF5_LIBS@ # @@ -116,7 +113,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 \ @@ -147,6 +143,7 @@ libSalomeDSImpl_la_SOURCES =\ SALOMEDSImpl_AttributeComment.cxx \ SALOMEDSImpl_AttributeReference.cxx \ SALOMEDSImpl_AttributeParameter.cxx \ + SALOMEDSImpl_AttributeString.cxx \ SALOMEDSImpl_ChildNodeIterator.cxx \ SALOMEDSImpl_UseCaseBuilder.cxx \ SALOMEDSImpl_UseCaseIterator.cxx \ @@ -187,12 +184,13 @@ libSalomeDSImpl_la_SOURCES =\ SALOMEDSImpl_AttributeTextHighlightColor.hxx \ SALOMEDSImpl_AttributeTreeNode.hxx \ SALOMEDSImpl_AttributeUserID.hxx \ + SALOMEDSImpl_AttributeParameter.hxx \ + SALOMEDSImpl_AttributeString.hxx \ SALOMEDSImpl_Callback.hxx \ SALOMEDSImpl_ChildIterator.hxx \ SALOMEDSImpl_ChildNodeIterator.hxx \ SALOMEDSImpl_Driver.hxx \ SALOMEDSImpl_GenericAttribute.hxx \ - SALOMEDSImpl_OCAFApplication.hxx \ SALOMEDSImpl_SComponent.hxx \ SALOMEDSImpl_SComponentIterator.hxx \ SALOMEDSImpl_SObject.hxx \ @@ -216,4 +214,5 @@ libSalomeDSImpl_la_LIBADD = $(COMMON_LIBS) bin_PROGRAMS = testDS testDS_SOURCES = testDS.cxx testDS_CPPFLAGS = $(COMMON_CPPFLAGS) -testDS_LDADD = libSalomeDSImpl.la $(COMMON_LIBS) +testDS_LDADD = libSalomeDSImpl.la \ + $(HDF5_LIBS) 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 69451c0a0..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); } @@ -67,14 +64,14 @@ Handle(SALOMEDSImpl_AttributeExpandable) SALOMEDSImpl_AttributeExpandable::Set ( SALOMEDSImpl_AttributeExpandable::SALOMEDSImpl_AttributeExpandable() :SALOMEDSImpl_GenericAttribute("AttributeExpandable") { - myValue = 0; + myValue = 1; } //======================================================================= //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 1eea12dbd..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); } @@ -119,6 +114,8 @@ void SALOMEDSImpl_AttributeParameter::SetInt(const string& theID, const int& the { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _ints[theID] = theValue; @@ -134,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]; } @@ -148,6 +145,8 @@ void SALOMEDSImpl_AttributeParameter::SetReal(const string& theID, const double& { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _reals[theID] = theValue; @@ -163,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]; } @@ -177,6 +176,8 @@ void SALOMEDSImpl_AttributeParameter::SetString(const string& theID, const strin { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _strings[theID] = theValue; @@ -192,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]; } @@ -206,6 +207,8 @@ void SALOMEDSImpl_AttributeParameter::SetBool(const string& theID, const bool& t { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _bools[theID] = theValue; @@ -221,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]; } @@ -235,6 +238,8 @@ void SALOMEDSImpl_AttributeParameter::SetRealArray(const string& theID, const ve { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _realarrays[theID] = theArray; @@ -250,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]; } @@ -265,6 +270,8 @@ void SALOMEDSImpl_AttributeParameter::SetIntArray(const string& theID, const vec { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _intarrays[theID] = theArray; @@ -280,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]; } @@ -295,6 +302,8 @@ void SALOMEDSImpl_AttributeParameter::SetStrArray(const string& theID, const vec { CheckLocked(); + if(theID.size() == 0) return; + Backup(); _strarrays[theID] = theArray; @@ -310,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]; } @@ -413,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; @@ -435,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(); @@ -558,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(); } @@ -572,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(); @@ -583,17 +592,20 @@ void SALOMEDSImpl_AttributeParameter::Restore(const Handle(TDF_Attribute)& with) _intarrays.clear(); _strarrays.clear(); - for(map::const_iterator p = A->_ints.begin(); p!= A->_ints.end(); p++) _ints[p->first] = p->second; - for(map::const_iterator p = A->_reals.begin(); p!= A->_reals.end(); p++) _reals[p->first] = p->second; - for(map::const_iterator p = A->_bools.begin(); p!= A->_bools.end(); p++) _bools[p->first] = p->second; + for(map::const_iterator p = A->_ints.begin(); p!= A->_ints.end(); p++) + if(p->first.size()) _ints[p->first] = p->second; + for(map::const_iterator p = A->_reals.begin(); p!= A->_reals.end(); p++) + if(p->first.size()) _reals[p->first] = p->second; + for(map::const_iterator p = A->_bools.begin(); p!= A->_bools.end(); p++) + if(p->first.size()) _bools[p->first] = p->second; for(map::const_iterator p = A->_strings.begin(); p!= A->_strings.end(); p++) - _strings[p->first] = p->second; + if(p->first.size()) _strings[p->first] = p->second; for(map< string,vector >::const_iterator p = A->_realarrays.begin(); p!= A->_realarrays.end(); p++) - _realarrays[p->first] = p->second; + if(p->first.size()) _realarrays[p->first] = p->second; for(map< string,vector >::const_iterator p = A->_intarrays.begin(); p!= A->_intarrays.end(); p++) - _intarrays[p->first] = p->second; + if(p->first.size()) _intarrays[p->first] = p->second; for(map< string,vector >::const_iterator p = A->_strarrays.begin(); p!= A->_strarrays.end(); p++) - _strarrays[p->first] = p->second; + if(p->first.size()) _strarrays[p->first] = p->second; } //======================================================================= @@ -602,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); } @@ -614,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]; @@ -675,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; } @@ -686,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(); @@ -697,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 db54d1e1a..cfd38f459 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributePythonObject.cxx @@ -22,39 +22,35 @@ // 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(); + CheckLocked(); Backup(); mySequence = theSequence; myIsScript = theScript; @@ -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,47 +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() { - char* aString = (char*)GetObject().ToCString(); - char* aResult = new char[strlen(aString) + 2]; - aResult[0] = IsScript()?'s':'n'; - strcpy(aResult+1, aString); - TCollection_AsciiString ret(aResult); + string aString = GetObject(); + string aResult = IsScript()?"s":"n"; + aResult += aString; - delete aResult; - return ret; + 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 85cadc8ff..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); } @@ -68,14 +64,14 @@ Handle(SALOMEDSImpl_AttributeSelectable) SALOMEDSImpl_AttributeSelectable::Set ( SALOMEDSImpl_AttributeSelectable::SALOMEDSImpl_AttributeSelectable() :SALOMEDSImpl_GenericAttribute("AttributeSelectable") { - myValue = 0; + myValue = 1; } //======================================================================= //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 459b8b26e..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,88 +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(); - myValue->SetValue(Index, Value); + + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); + + 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(); - myValue->Remove(Index); - + + 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; + } + } + 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) { - return myValue->Value(Index); + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); + + 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 1cad917f6..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,89 +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(); - myValue->SetValue(Index, Value); + + if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range"); + + 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(); - myValue->Remove(Index); - - SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved + + 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; + } + } + + 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) { - 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 new file mode 100644 index 000000000..9bdc26b23 --- /dev/null +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.cxx @@ -0,0 +1,104 @@ +// 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_AttributeString.cxx +// Author : Sergey RUIN +// Module : SALOME + +#include "SALOMEDSImpl_AttributeString.hxx" + +#ifndef WNT +using namespace std; +#endif + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const std::string& SALOMEDSImpl_AttributeString::GetID () +{ + static std::string CommentID ("1808A12F-AD0E-4a6a-B58A-395DCF469FE9"); + return CommentID; +} + +SALOMEDSImpl_AttributeString* SALOMEDSImpl_AttributeString::Set (const DF_Label& L, + const std::string& Val) +{ + SALOMEDSImpl_AttributeString* A = NULL; + if (!(A=(SALOMEDSImpl_AttributeString*)L.FindAttribute(SALOMEDSImpl_AttributeString::GetID()))) { + A = new SALOMEDSImpl_AttributeString(); + L.AddAttribute(A); + } + + A->SetValue(Val); + + return A; +} + +//======================================================================= +//function : SetValue +//purpose : +//======================================================================= +void SALOMEDSImpl_AttributeString::SetValue (const std::string& S) +{ + CheckLocked(); + + if(myString == S) return; + + Backup(); + + myString = S; + + SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved +} + + +//======================================================================= +//function : ID +//purpose : +//======================================================================= +const std::string& SALOMEDSImpl_AttributeString::ID () const { return GetID(); } + +//======================================================================= +//function : NewEmpty +//purpose : +//======================================================================= +DF_Attribute* SALOMEDSImpl_AttributeString::NewEmpty () const +{ + return new SALOMEDSImpl_AttributeString(); +} + +//======================================================================= +//function : Restore +//purpose : +//======================================================================= +void SALOMEDSImpl_AttributeString::Restore(DF_Attribute* with) +{ + myString = dynamic_cast(with)->Value (); +} + +//======================================================================= +//function : Paste +//purpose : +//======================================================================= + +void SALOMEDSImpl_AttributeString::Paste (DF_Attribute* into) +{ + dynamic_cast(into)->SetValue(myString); +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx new file mode 100644 index 000000000..2f7bb8587 --- /dev/null +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeString.hxx @@ -0,0 +1,60 @@ +// 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_AttributeIOR.hxx +// Author : Sergey RUIN +// Module : SALOME + +#ifndef _SALOMEDSImpl_AttributeString_HeaderFile +#define _SALOMEDSImpl_AttributeString_HeaderFile + +#include "DF_Attribute.hxx" +#include +#include "DF_Label.hxx" +#include "SALOMEDSImpl_GenericAttribute.hxx" + + +class SALOMEDSImpl_AttributeString : public SALOMEDSImpl_GenericAttribute +{ +private: + + std::string myString; + +public: + +Standard_EXPORT static const std::string& GetID() ; + +Standard_EXPORT SALOMEDSImpl_AttributeString() :SALOMEDSImpl_GenericAttribute("AttributeString") {} + +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 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() {} + +}; + +#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 0cfa7fda5..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 SALOMEDSImpl_AttributeTarget::Add(const Handle(SALOMEDSImpl_SObject)& theSO); -Standard_EXPORT Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_AttributeTarget::Get(); -Standard_EXPORT void SALOMEDSImpl_AttributeTarget::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 e62e998df..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, RealFirst()); + 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 53428e371..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, RealFirst()); + 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 9a9776d30..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,24 +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()) 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); @@ -108,35 +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"); - Handle(SALOMEDSImpl_AttributeTreeNode) bid; - TN->SetPrevious(bid); + if(TN->Label() == Label()) throw DFexception("Attempt of self linking"); + + 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); } @@ -144,12 +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()) throw DFexception("Attempt of self linking"); TN->SetFather(GetFather()); TN->SetPrevious(GetPrevious()); @@ -164,19 +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->ID() == myTreeID) ) - Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID"); + if(TN->Label() == Label()) throw DFexception("Attempt of self linking"); + + if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID"); TN->SetFather(GetFather()); TN->SetPrevious(this); @@ -188,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 @@ -209,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(); } @@ -253,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; @@ -265,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); } @@ -275,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; } //======================================================================= @@ -290,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); } @@ -301,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); } @@ -311,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; } @@ -336,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 } @@ -349,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 } @@ -363,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 } @@ -376,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 } @@ -388,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; @@ -467,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); } @@ -497,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 +string SALOMEDSImpl_AttributeTreeNode::Type() { - Handle(SALOMEDSImpl_AttributeTreeNode) fct = myFirst; - while (!fct.IsNull()) { - aDataSet->AddAttribute(fct); - fct = fct->myNext; - } -} - -TCollection_AsciiString 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); @@ -567,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 118cdf3d8..ff366e786 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Attributes.hxx @@ -24,8 +24,18 @@ #ifndef __SALOMEDSIMPL_ATTRIBUTES__H__ #define __SALOMEDSIMPL_ATTRIBUTES__H__ +#ifdef WNT +# ifdef SALOMEDSIMPL_EXPORTS +# define SALOMEDSIMPL_EXPORT __declspec( dllexport ) +# else +# define SALOMEDSIMPL_EXPORT __declspec( dllimport ) +# endif +#else +# define SALOMEDSIMPL_EXPORT +#endif + #include -class LockProtection +class SALOMEDSIMPL_EXPORT LockProtection { public : LockProtection(const char *message) { @@ -64,6 +74,7 @@ public : #include "SALOMEDSImpl_AttributeFlags.hxx" #include "SALOMEDSImpl_AttributeGraphic.hxx" #include "SALOMEDSImpl_AttributeParameter.hxx" +#include "SALOMEDSImpl_AttributeString.hxx" #define __AttributeTypeToGUIDForSObject \ @@ -89,18 +100,19 @@ 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(); \ if(theType == "AttributeGraphic") return SALOMEDSImpl_AttributeGraphic::GetID(); \ if(theType == "AttributeReference") return SALOMEDSImpl_AttributeReference::GetID(); \ - if(theType == "AttributeParameter") return SALOMEDSImpl_AttributeParameter::GetID(); + if(theType == "AttributeParameter") return SALOMEDSImpl_AttributeParameter::GetID(); \ + 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); \ @@ -108,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); \ } \ @@ -132,6 +144,7 @@ __FindOrCreateAttributeLocked(AttributeTableOfReal) \ __FindOrCreateAttributeLocked(AttributeTableOfString) \ __FindOrCreateAttributeLocked(AttributePythonObject) \ __FindOrCreateAttributeLocked(AttributeParameter) \ +__FindOrCreateAttributeLocked(AttributeString) \ __FindOrCreateAttribute(AttributePersistentRef) \ __FindOrCreateAttribute(AttributeDrawable) \ __FindOrCreateAttribute(AttributeSelectable) \ 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 8965e8f91..a197b28ef 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_IParameters.hxx @@ -29,10 +29,10 @@ /*! Class which an interface to store the parameters of the objects */ -class SALOMEDSImpl_IParameters +class Standard_EXPORT SALOMEDSImpl_IParameters { public: - SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap); + SALOMEDSImpl_IParameters(SALOMEDSImpl_AttributeParameter* ap); virtual ~SALOMEDSImpl_IParameters(); @@ -76,12 +76,12 @@ public: /*! Returns all parameter names of the given entry */ - virtual std::vector SALOMEDSImpl_IParameters::getAllParameterNames(const std::string& entry); + virtual std::vector getAllParameterNames(const std::string& entry); /*! Returns all parameter values of the given entry */ - virtual std::vector SALOMEDSImpl_IParameters::getAllParameterValues(const std::string& entry); + virtual std::vector getAllParameterValues(const std::string& entry); /*! Returns a number of parameters of the given entry @@ -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_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 ed054fb2e..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,36 +37,33 @@ 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); } @@ -95,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 { @@ -122,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); } //============================================================================ @@ -144,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(); } @@ -153,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; @@ -173,7 +159,7 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponent (const TCollec if(!_find) { _errorCode = "No component was found"; - return NULL; + return compo; } return compo; } @@ -183,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 @@ -207,7 +193,7 @@ Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponentID(const TColle if(!_find) { _errorCode = "No component was found"; - compo = NULL; + compo = compo; } return compo; @@ -218,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 = ""; @@ -226,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; @@ -242,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; } @@ -251,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); @@ -272,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); @@ -294,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) ; } } @@ -339,47 +325,24 @@ 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 = ""; - - // firstly searching in the datamap for optimization - if (myIORLabels.IsBound(anObjectIOR)) { - Handle(SALOMEDSImpl_SObject) aResult = GetSObject(myIORLabels.Find(anObjectIOR)); + + SALOMEDSImpl_SObject aResult ; + + // searching in the datamap for optimization + 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); - } else - return aResult; + if (!aResult.GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) { + myIORLabels.erase(anObjectIOR); + aResult = SALOMEDSImpl_SObject(); + } } - // Iterate to all components defined in the study - // After testing the component name, iterate in all objects defined under - // components (function _FindObject) - bool _find = false; - Handle(SALOMEDSImpl_SObject) RefSO = NULL; - - SALOMEDSImpl_SComponentIterator it = NewComponentIterator(); - Handle(SALOMEDSImpl_SComponent) SC; - for (; it.More();it.Next()){ - if(!_find) - { - SC = it.Value(); - TCollection_AsciiString ior = SC->GetIOR(); - if (ior != "") - { - if (ior == anObjectIOR) - { - _find = true; - RefSO = SC; - } - } - if (!_find) - RefSO = _FindObjectIOR(SC, anObjectIOR, _find); - } - } - - if(RefSO.IsNull()) _errorCode = "No object was found"; - return RefSO; + + if(!aResult) _errorCode = "No object was found"; + return aResult; } //============================================================================ @@ -387,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; } @@ -450,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; } } @@ -485,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; } @@ -505,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; @@ -526,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; @@ -553,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 = ""; @@ -561,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); } @@ -570,29 +532,31 @@ 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()) { - if(_current.IsNull()) { - _errorCode = "InvalidContext"; - return aResultSeq; - } + 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; } - TDF_ChildIterator anIter(aLabel, Standard_False); // 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()); + if (aLabel.IsNull()) { + _errorCode = "InvalidContext"; + return aResultSeq; + } + + DF_ChildIterator anIter (aLabel, true); // iterate all subchildren at all sublevels + for (; anIter.More(); anIter.Next()) { + DF_Label aLabel = anIter.Value(); + SALOMEDSImpl_AttributeName* aName; + if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) + aResultSeq.push_back(aName->Value()); } return aResultSeq; @@ -603,33 +567,34 @@ 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()) { - if(_current.IsNull()) { - _errorCode = "InvalidContext"; - return aResultSeq; - } + 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; } - TDF_ChildIterator anIter(aLabel, Standard_False); // 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)) { + if (aLabel.IsNull()) { + _errorCode = "InvalidContext"; + return aResultSeq; + } + + DF_ChildIterator anIter (aLabel, true); // iterate first-level children at all sublevels + for (; anIter.More(); anIter.Next()) { + 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()); } } } @@ -643,35 +608,36 @@ 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()) { - if(_current.IsNull()) { - _errorCode = "InvalidContext"; - return aResultSeq; - } + 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; } - TDF_ChildIterator anIter(aLabel, Standard_False); // 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)) { + if (aLabel.IsNull()) { + _errorCode = "InvalidContext"; + return aResultSeq; + } + + DF_ChildIterator anIter (aLabel, true); // iterate all subchildren at all sublevels + for (; anIter.More(); anIter.Next()) { + 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())); } } } @@ -685,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; @@ -705,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); } @@ -729,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) { @@ -745,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; @@ -756,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; @@ -782,7 +749,7 @@ void SALOMEDSImpl_Study::IsSaved(bool save) { _errorCode = ""; _Saved = save; - if(save) _doc->UnModify(); + if(save) _doc->SetModified(false); } //============================================================================ @@ -805,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; @@ -816,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, "/"); @@ -841,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()); @@ -877,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()); @@ -927,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(); } @@ -979,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; } @@ -1032,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; @@ -1047,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(); } @@ -1166,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; @@ -1186,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); } //============================================================================ @@ -1198,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; @@ -1218,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); } //============================================================================ @@ -1230,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; } @@ -1244,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) { @@ -1256,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(); @@ -1291,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; @@ -1319,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; @@ -1359,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(); @@ -1387,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; } @@ -1396,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; @@ -1419,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(); @@ -1450,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; @@ -1517,7 +1369,7 @@ void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO, void SALOMEDSImpl_Study::Modify() { _errorCode = ""; - _doc->Modify(); + _doc->SetModified(true); } //============================================================================ @@ -1525,18 +1377,31 @@ 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_SObject) newSO; - if(theSavePoint == 0) //Get an attribute that is placed on the component itself. - newSO = so; - else - newSO = builder->NewObjectToTag(so, theSavePoint); - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(builder->FindOrCreateAttribute(newSO, "AttributeParameter")); + if (theSavePoint < 0) return NULL; + 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 ... + 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 ); + } + + 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; } //============================================================================ @@ -1544,30 +1409,111 @@ 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; } + +//============================================================================ +/*! Function : SetStudyLock + * Purpose : + */ +//============================================================================ +void SALOMEDSImpl_Study::SetStudyLock(const char* theLockerID) +{ + _lockers.push_back(theLockerID); +} + +//============================================================================ +/*! Function : IsStudyLocked + * Purpose : + */ +//============================================================================ +bool SALOMEDSImpl_Study::IsStudyLocked() +{ + return (_lockers.size() > 0); +} + +//============================================================================ +/*! Function : UnLockStudy + * Purpose : + */ +//============================================================================ +void SALOMEDSImpl_Study::UnLockStudy(const char* theLockerID) +{ + vector::iterator vsI = _lockers.begin(); + int length = _lockers.size(); + bool isFound = false; + string id(theLockerID); + for(int i = 0; i SALOMEDSImpl_Study::GetLockerID() +{ + return _lockers; +} + +//============================================================================ +/*! Function : EnableUseCaseAutoFilling + * Purpose : + */ +//============================================================================ +void SALOMEDSImpl_Study::EnableUseCaseAutoFilling(bool isEnabled) +{ + _errorCode = ""; _autoFill = isEnabled; + if(isEnabled) { + _builder->SetOnAddSObject(_cb); + _builder->SetOnRemoveSObject(_cb); + } + else { + _builder->SetOnAddSObject(NULL); + _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 ffa1ec5b9..cfddeb627 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx @@ -24,30 +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 -#ifndef WNT -#include -#else -#include -#endif //SALOMEDSImpl headers #include "SALOMEDSImpl_SComponentIterator.hxx" @@ -64,134 +50,123 @@ DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared ) class SALOMEDSImpl_StudyManager; class SALOMEDSImpl_GenericAttribute; -#ifndef WNT -typedef NCollection_DataMap DataMapOfAsciiStringTransient; -typedef NCollection_DataMap DataMapAsciiStringLabel; -#else -typedef NCollection_DataMap1 DataMapOfAsciiStringTransient; -typedef NCollection_DataMap1 DataMapAsciiStringLabel; -#endif -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(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(); @@ -203,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(); @@ -214,69 +189,73 @@ 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) SALOMEDSImpl_Study::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) { _errorCode = ""; _autoFill = 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 void EnableUseCaseAutoFilling(bool isEnabled); - 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); -public: - DEFINE_STANDARD_RTTI( SALOMEDSImpl_Study ) + //Locks the study, theLockerID is identificator of the of the one who locked the study for ex. IOR + Standard_EXPORT void SetStudyLock(const char* theLockerID); + + //Returns True if the study is locked + Standard_EXPORT bool IsStudyLocked(); + + //Unlocks the study + Standard_EXPORT void UnLockStudy(const char* theLockerID); + + //Returns an ID of the study locker + Standard_EXPORT std::vector GetLockerID(); + + //Returns a callback + Standard_EXPORT SALOMEDSImpl_Callback* GetCallback() { return _cb; } + + //Returns a list of IOR's stored in the study + Standard_EXPORT std::vector GetIORs(); + friend class SALOMEDSImpl_StudyManager; friend class SALOMEDSImpl_GenericAttribute; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index d47beb3dd..6dcb7bdd6 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -24,44 +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 "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(); } //============================================================================ @@ -77,28 +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(); + + 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; } @@ -108,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; } @@ -131,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(); @@ -143,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; } @@ -172,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; } @@ -196,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; } @@ -232,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; } @@ -280,24 +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()); + 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 @@ -307,37 +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 aHDFPath(Res); - - 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; @@ -363,19 +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; - } + string aDir = SALOMEDSImpl_Tool::GetDirFromPath(Res); bool aResult = (ASCIIfileState[0]=='A')? - aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir, aMultifileState[0]=='M'): - aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir, 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; @@ -386,7 +363,7 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& throw HDFexception("Unable to load component"); } - if(aDir != NULL) delete []aDir; + //if(aDir != NULL) delete []aDir; multifile_hdf_dataset->CloseOnDisk(); multifile_hdf_dataset = 0; @@ -401,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(aHDFUrl); + vector aFilesToRemove; + aFilesToRemove.push_back("hdf_from_ascii.hdf"); SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true); } @@ -411,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; } @@ -428,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"; } @@ -442,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; @@ -454,51 +431,55 @@ 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 ) { - Standard_GUID aTreeNodeGUID; - if (strcmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode") == 0) { + if (strncmp(aTypeOfAttribute.c_str(), "AttributeTreeNode",17) == 0 ) { + + string aTreeNodeGUID; + if (strcmp(aTypeOfAttribute.c_str(), "AttributeTreeNode") == 0) { aTreeNodeGUID = SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID(); } else { - char* aGUIDString = new char[40]; - char* aType = (char*)aTypeOfAttribute.ToCString(); - sprintf(aGUIDString, &(aType[21])); - 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 ) { - Handle(SALOMEDSImpl_AttributeUserID) anAttr; - if (!Lab.FindAttribute(SALOMEDSImpl_AttributeUserID::DefaultID(), anAttr)) { + if (strncmp(aTypeOfAttribute.c_str(), "AttributeUserID",15) == 0 ) { + std::string aUserGUID; + if (strcmp(aTypeOfAttribute.c_str(), "AttributeUserID") == 0) { + aUserGUID = SALOMEDSImpl_AttributeUserID::DefaultID(); + } else { + aUserGUID = aTypeOfAttribute.substr(15, aTypeOfAttribute.size()); // create tree node GUID by name + } + SALOMEDSImpl_AttributeUserID* anAttr = NULL; + if (!(anAttr=(SALOMEDSImpl_AttributeUserID*)Lab.FindAttribute(aUserGUID))) { CheckLocked(); - anAttr = SALOMEDSImpl_AttributeUserID::Set(Lab, SALOMEDSImpl_AttributeUserID::DefaultID()); + anAttr = SALOMEDSImpl_AttributeUserID::Set(Lab, aUserGUID); } return anAttr; } @@ -513,21 +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)) { - _doc->Modify(); - return Standard_True; + 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 true; } - return Standard_False; + return false; } //============================================================================ @@ -536,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; } @@ -565,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; } @@ -590,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)); + } - _doc->Modify(); + Lab.ForgetAttribute(SALOMEDSImpl_AttributeReference::GetID()); + + _doc->SetModified(true); return true; } @@ -621,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; } @@ -695,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; } @@ -718,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); } @@ -739,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 } //============================================================================ @@ -758,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); } //============================================================================ @@ -787,7 +757,9 @@ void SALOMEDSImpl_StudyBuilder::CommitCommand() bool SALOMEDSImpl_StudyBuilder::HasOpenCommand() { _errorCode = ""; - return _doc->HasOpenCommand(); + + //Not implememnted + return false; } //============================================================================ @@ -798,9 +770,7 @@ bool SALOMEDSImpl_StudyBuilder::HasOpenCommand() void SALOMEDSImpl_StudyBuilder::AbortCommand() { _errorCode = ""; - SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(0); - - _doc->AbortCommand(); + //Not implemented } //============================================================================ @@ -810,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); } //============================================================================ @@ -836,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); } //============================================================================ @@ -862,7 +822,7 @@ void SALOMEDSImpl_StudyBuilder::Redo() bool SALOMEDSImpl_StudyBuilder::GetAvailableUndos() { _errorCode = ""; - return _doc->GetAvailableUndos(); + return false; } //============================================================================ @@ -873,7 +833,7 @@ bool SALOMEDSImpl_StudyBuilder::GetAvailableUndos() bool SALOMEDSImpl_StudyBuilder::GetAvailableRedos() { _errorCode = ""; - return _doc->GetAvailableRedos(); + return false; } //============================================================================ @@ -884,7 +844,7 @@ bool SALOMEDSImpl_StudyBuilder::GetAvailableRedos() int SALOMEDSImpl_StudyBuilder::UndoLimit() { _errorCode = ""; - return _doc->GetUndoLimit(); + return 1; } //============================================================================ @@ -896,7 +856,7 @@ void SALOMEDSImpl_StudyBuilder::UndoLimit(int n) { _errorCode = ""; CheckLocked(); - _doc->SetUndoLimit (n); + //Not implemented } //============================================================================ @@ -904,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; } @@ -918,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; } @@ -935,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"); @@ -952,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; } @@ -973,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; } @@ -994,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; } @@ -1016,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 0cde58ca0..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,18 +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" -#define AUTO_SAVE_GUID "128268A3-71C9-4036-89B1-F81BD6A4FCF2" -#define AUTO_SAVE_TAG "0:8" -#define AUTO_SAVE_TIME_OUT_IN_SECONDS 1200 - -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); //============================================================================ @@ -74,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"); } //============================================================================ @@ -86,8 +66,8 @@ SALOMEDSImpl_StudyManager::SALOMEDSImpl_StudyManager() //============================================================================ SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager() { - // Destroy OCAF application - _OCAFApp.Nullify(); + // Destroy application + delete _appli; } @@ -96,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; @@ -124,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 = ""; @@ -133,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); @@ -147,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 } @@ -157,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 ); @@ -186,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); } @@ -198,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); } @@ -228,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; } @@ -245,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; } @@ -263,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; } @@ -286,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) { @@ -295,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) { @@ -309,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); } } @@ -341,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; } @@ -373,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]; } } @@ -404,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 = ""; @@ -414,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; } @@ -474,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) @@ -483,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 = ""; @@ -499,34 +464,33 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, hdf_int32 name_len = 0; char *component_name = 0; - int aLocked = aStudy->GetProperties()->IsLocked(); - if (aLocked) aStudy->GetProperties()->SetLocked(false); - - Handle(SALOMEDSImpl_StudyBuilder) SB= aStudy->NewBuilder(); - map aMapTypeDriver; - - if(aStudy.IsNull()) { + if(!aStudy) { _errorCode = "Study is null"; return false; } + int aLocked = aStudy->GetProperties()->IsLocked(); + if (aLocked) aStudy->GetProperties()->SetLocked(false); + + SALOMEDSImpl_StudyBuilder* SB= aStudy->NewBuilder(); + map aMapTypeDriver; + 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)) { @@ -542,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(); //----------------------------------------------------------------------- @@ -558,65 +522,22 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl, SALOMEDSImpl_SComponentIterator itcomponent = aStudy->NewComponentIterator(); - //SRN: Added 17 Nov, 2003 - Handle(SALOMEDSImpl_SObject) anAutoSaveSO = aStudy->FindObjectID(AUTO_SAVE_TAG); - //SRN: End 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(); - - //SRN: Added 17 Nov 2003: If there is a specified attribute, the component peforms a special save - if(!anAutoSaveSO.IsNull() && SB->IsGUID(sco, AUTO_SAVE_GUID)) { - - Handle(SALOMEDSImpl_AttributeTableOfString) aTable; - if(anAutoSaveSO->GetLabel().FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID(), aTable)) { - Standard_Integer nbRows = aTable->GetNbRows(), k, aTimeOut = 0; - if(nbRows > 0 && aTable->GetNbColumns() > 1) { - - Handle(TColStd_HSequenceOfExtendedString) aRow; - for(k=1; k<=nbRows; k++) { - aRow = aTable->GetRowData(k); - if (aRow->Value(1) == componentDataType) { - TCollection_AsciiString anEntry = TCollection_AsciiString(aRow->Value(2)); - Handle(SALOMEDSImpl_SObject) aCompSpecificSO = aStudy->FindObjectID(anEntry); - if(!aCompSpecificSO.IsNull()) { - Handle(SALOMEDSImpl_AttributeInteger) anInteger; - if(aCompSpecificSO->GetLabel().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anInteger)) { - anInteger->SetValue(-1); - while(anInteger->Value() < 0) { -#ifndef WNT - sleep(2); -#else - Sleep(2); -#endif - if(++aTimeOut > AUTO_SAVE_TIME_OUT_IN_SECONDS) - break; - } - } // if(aCompSpecificSO->FindAttribute(anInteger, "AttributeInteger")) - } // if(!CORBA::is_nil(aCompSpecificSO)) - } // if (strcmp(aRow[0], componentDataType) == 0) - } // for - - } // if(nbRows > 0 && aTable->GetNbColumns() > 1) - - } // if(anAutoSaveSO->FindAttribute(aTable, "AttributeTableOfString") - - } // if(SB->IsGUID(AUTO_SAVE_GUID) - - //SRN: End - 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); @@ -624,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), @@ -636,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; @@ -647,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); @@ -680,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); @@ -698,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); @@ -716,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(); @@ -750,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; @@ -761,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 = ""; @@ -771,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); @@ -810,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; @@ -837,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); } @@ -855,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; @@ -922,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()); } @@ -975,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; } @@ -1014,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()); @@ -1038,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); @@ -1076,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; } @@ -1120,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()) { @@ -1134,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); } @@ -1184,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 } @@ -1208,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; - - char* current_string = new char[hdf_dataset->GetSize()]; + 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") || @@ -1230,14 +1143,11 @@ static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy, } else { 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); hdf_dataset->CloseOnDisk(); } @@ -1245,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"); @@ -1258,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); @@ -1283,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 b59e16837..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; - virtual size_t Size() = 0; - - virtual TOctet* Data(); + Standard_EXPORT virtual size_t Size() = 0; - virtual TOctet& Get(size_t) = 0; + Standard_EXPORT virtual TOctet* Data(); - DEFINE_STANDARD_RTTI( SALOMEDSImpl_TMPFile ); + Standard_EXPORT virtual TOctet& Get(size_t) = 0; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx index 46529552b..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,29 +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(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 6a20fec57..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,19 +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(); - Handle(SALOMEDSImpl_AttributeTreeNode) aFather, aNode; + DF_Label aFatherLabel = theFather.GetLabel(), aLabel = theObject.GetLabel(); + if(aFatherLabel == aLabel) return false; + + 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()); } @@ -185,16 +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; + + DF_Label aFirstLabel = theFirst.GetLabel(), aLabel= theNext.GetLabel(); + if(aFirstLabel == aLabel) return false; - TDF_Label aFirstLabel = theFirst->GetLabel(), aLabel= theNext->GetLabel(); - 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()); } @@ -202,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(); @@ -215,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()); } @@ -242,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()); @@ -257,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()); } //============================================================================ @@ -278,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; } @@ -297,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); } @@ -316,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; - - Handle(SALOMEDSImpl_AttributeName) aName; - if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) return aString; - aString = TCollection_AsciiString(aName->Value()); - return aString; + string aString; + if(!_root) return aString; + + SALOMEDSImpl_AttributeName* aName = NULL; + if (!(aName=(SALOMEDSImpl_AttributeName*)_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) return aString; + return aName->Value(); } //============================================================================ @@ -332,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; @@ -346,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); @@ -386,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 de90a0a9e..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"); - 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 df4d15d1b..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,69 +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; - Handle(SALOMEDSImpl_StudyBuilder) aBuilder = aStudy->NewBuilder(); + + cout << "Check the study lock, locking" << endl; + aStudy->SetStudyLock("SRN"); + cout << "Is study locked = " << aStudy->IsStudyLocked() << endl; + vector ids = aStudy->GetLockerID(); + for(int i = 0; iUnLockStudy("SRN"); + cout << "Is study locked = " << aStudy->IsStudyLocked() << endl; + + 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; @@ -117,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); } @@ -154,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); @@ -185,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/BaseTraceCollector.cxx b/src/SALOMELocalTrace/BaseTraceCollector.cxx index 1c34fbd4e..5980a4075 100644 --- a/src/SALOMELocalTrace/BaseTraceCollector.cxx +++ b/src/SALOMELocalTrace/BaseTraceCollector.cxx @@ -37,7 +37,12 @@ using namespace std; // Class attributes initialisation, for class method BaseTraceCollector::run BaseTraceCollector* BaseTraceCollector::_singleton = 0; -pthread_mutex_t BaseTraceCollector::_singletonMutex = PTHREAD_MUTEX_INITIALIZER ; +#ifndef WNT +pthread_mutex_t BaseTraceCollector::_singletonMutex; +#else +pthread_mutex_t BaseTraceCollector::_singletonMutex = + PTHREAD_MUTEX_INITIALIZER; +#endif sem_t BaseTraceCollector::_sem; int BaseTraceCollector::_threadToClose = 0; pthread_t* BaseTraceCollector::_threadId = 0; // used to control single run diff --git a/src/SALOMELocalTrace/BaseTraceCollector.hxx b/src/SALOMELocalTrace/BaseTraceCollector.hxx index c9303ed28..af3fbc06d 100644 --- a/src/SALOMELocalTrace/BaseTraceCollector.hxx +++ b/src/SALOMELocalTrace/BaseTraceCollector.hxx @@ -27,24 +27,11 @@ #ifndef _BASETRACECOLLECTOR_HXX_ #define _BASETRACECOLLECTOR_HXX_ +#include "SALOME_LocalTrace.hxx" + #include #include - -#if defined SALOMELOCALTRACE_EXPORTS -#if defined WIN32 -#define SALOMELOCALTRACE_EXPORT __declspec( dllexport ) -#else -#define SALOMELOCALTRACE_EXPORT -#endif -#else -#if defined WNT -#define SALOMELOCALTRACE_EXPORT __declspec( dllimport ) -#else -#define SALOMELOCALTRACE_EXPORT -#endif -#endif - //! See derived Classes in SALOMELocalTrace for usage without CORBA, //! see derived Classes in SALOMETraceCollector for usage with CORBA. diff --git a/src/SALOMELocalTrace/FileTraceCollector.cxx b/src/SALOMELocalTrace/FileTraceCollector.cxx index f648dbead..d64f5eafb 100644 --- a/src/SALOMELocalTrace/FileTraceCollector.cxx +++ b/src/SALOMELocalTrace/FileTraceCollector.cxx @@ -64,7 +64,7 @@ BaseTraceCollector* FileTraceCollector::instance(const char *fileName) sem_init(&_sem,0,0); // to wait until run thread is initialized pthread_t traceThread; - int bid; + int bid = 0; int re2 = pthread_create(&traceThread, NULL, FileTraceCollector::run, (void *)bid); sem_wait(&_sem); @@ -182,6 +182,7 @@ FileTraceCollector:: ~FileTraceCollector() int ret = pthread_join(*_threadId, NULL); if (ret) cerr << "error close FileTraceCollector : "<< ret << endl; else DEVTRACE("FileTraceCollector destruction OK"); + delete _threadId; _threadId = 0; _threadToClose = 0; } diff --git a/src/SALOMELocalTrace/FileTraceCollector.hxx b/src/SALOMELocalTrace/FileTraceCollector.hxx index 13356627f..96a503d7b 100644 --- a/src/SALOMELocalTrace/FileTraceCollector.hxx +++ b/src/SALOMELocalTrace/FileTraceCollector.hxx @@ -27,6 +27,8 @@ #ifndef _FILETRACECOLLECTOR_HXX_ #define _FILETRACECOLLECTOR_HXX_ +#include "SALOME_LocalTrace.hxx" + #include #include "LocalTraceBufferPool.hxx" #include "BaseTraceCollector.hxx" diff --git a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx index 14f07cf6a..f41e57593 100644 --- a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx +++ b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// copyright (C) 2004 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 @@ -31,6 +31,7 @@ #ifndef WNT #include #else +#include #endif //#define _DEVDEBUG_ @@ -93,10 +94,8 @@ LocalTraceBufferPool* LocalTraceBufferPool::instance() // --- start a trace Collector char* traceKind = getenv("SALOME_trace"); - assert(traceKind); - //cerr<<"SALOME_trace="< #include diff --git a/src/SALOMELocalTrace/LocalTraceCollector.cxx b/src/SALOMELocalTrace/LocalTraceCollector.cxx index cad59c44d..f34170657 100644 --- a/src/SALOMELocalTrace/LocalTraceCollector.cxx +++ b/src/SALOMELocalTrace/LocalTraceCollector.cxx @@ -56,9 +56,8 @@ BaseTraceCollector* LocalTraceCollector::instance() sem_init(&_sem,0,0); // to wait until run thread is initialized pthread_t traceThread; - int bid; int re2 = pthread_create(&traceThread, NULL, - LocalTraceCollector::run, (void *)bid); + LocalTraceCollector::run, NULL); sem_wait(&_sem); _singleton = myInstance; // _singleton known only when init done } @@ -149,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/LocalTraceCollector.hxx b/src/SALOMELocalTrace/LocalTraceCollector.hxx index 8e043a4ce..cc9681f8a 100644 --- a/src/SALOMELocalTrace/LocalTraceCollector.hxx +++ b/src/SALOMELocalTrace/LocalTraceCollector.hxx @@ -27,6 +27,8 @@ #ifndef _LOCALTRACECOLLECTOR_HXX_ #define _LOCALTRACECOLLECTOR_HXX_ +#include "SALOME_LocalTrace.hxx" + #include #include "LocalTraceBufferPool.hxx" #include "BaseTraceCollector.hxx" diff --git a/src/SALOMELocalTrace/Makefile.am b/src/SALOMELocalTrace/Makefile.am index 658fa2274..f49994211 100644 --- a/src/SALOMELocalTrace/Makefile.am +++ b/src/SALOMELocalTrace/Makefile.am @@ -31,7 +31,8 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am salomeinclude_HEADERS = \ utilities.h \ LocalTraceBufferPool.hxx \ - BaseTraceCollector.hxx + BaseTraceCollector.hxx \ + SALOME_LocalTrace.hxx lib_LTLIBRARIES = libSALOMELocalTrace.la @@ -43,7 +44,8 @@ libSALOMELocalTrace_la_SOURCES = \ FileTraceCollector.cxx \ FileTraceCollector.hxx \ LocalTraceBufferPool.cxx \ - LocalTraceBufferPool.hxx + LocalTraceBufferPool.hxx \ + SALOME_LocalTrace.hxx libSALOMELocalTrace_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSALOMELocalTrace_la_CPPFLAGS = -I$(srcdir)/../Basics diff --git a/src/SALOMELocalTrace/SALOME_LocalTrace.hxx b/src/SALOMELocalTrace/SALOME_LocalTrace.hxx new file mode 100755 index 000000000..743fc22c6 --- /dev/null +++ b/src/SALOMELocalTrace/SALOME_LocalTrace.hxx @@ -0,0 +1,48 @@ +// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_LocalTrace.hxx +// Author : Alexander A. BORODIN +// Module : SALOME + +#ifndef _SALOME_LOCALTRACE_HXX_ +#define _SALOME_LOCALTRACE_HXX_ + +#ifdef WNT + #if defined SALOMELOCALTRACE_EXPORTS + #if defined WIN32 + #define SALOMELOCALTRACE_EXPORT __declspec( dllexport ) + #else + #define SALOMELOCALTRACE_EXPORT + #endif + #else + #if defined WIN32 + #define SALOMELOCALTRACE_EXPORT __declspec( dllimport ) + #else + #define SALOMELOCALTRACE_EXPORT + #endif + #endif +#else + #define SALOMELOCALTRACE_EXPORT +#endif + +#endif + 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 dab74d492..c20c835a0 100644 --- a/src/SALOMELocalTrace/utilities.h +++ b/src/SALOMELocalTrace/utilities.h @@ -92,12 +92,13 @@ #error INFOS_COMPILATION already defined #endif +#if defined(_DEBUG_) || defined(_DEBUG) + +// --- the following MACROS are useful at debug time + #define INFOS_COMPILATION { MESS_BEGIN("COMPILED with ") << COMPILER \ << ", " << __DATE__ \ << " at " << __TIME__ << MESS_END } -#ifdef _DEBUG_ - -// --- the following MACROS are useful at debug time #define MESSAGE(msg) {MESS_BEGIN("- Trace ") << msg << MESS_END} #define SCRUTE(var) {MESS_BEGIN("- Trace ") << #var << "=" << var < + #include #include #include #include -#include +#include using namespace std; @@ -67,7 +69,7 @@ BaseTraceCollector* SALOMETraceCollector::instance() sem_init(&_sem,0,0); // to wait until run thread is initialized pthread_t traceThread; - int bid; + int bid = 0; int re2 = pthread_create(&traceThread, NULL, SALOMETraceCollector::run, (void *)bid); sem_wait(&_sem); @@ -188,6 +190,7 @@ SALOMETraceCollector:: ~SALOMETraceCollector() int ret = pthread_join(*_threadId, NULL); if (ret) cerr << "error close SALOMETraceCollector : "<< ret << endl; else DEVTRACE("SALOMETraceCollector destruction OK"); + delete _threadId; _threadId = 0; _threadToClose = 0; } @@ -217,6 +220,7 @@ SALOMETraceCollector::SALOMETraceCollector() extern "C" { + SALOMETRACECOLLECTOR_EXPORT BaseTraceCollector *SingletonInstance(void) { BaseTraceCollector *instance = SALOMETraceCollector::instance(); diff --git a/src/SALOMETraceCollector/SALOMETraceCollector.hxx b/src/SALOMETraceCollector/SALOMETraceCollector.hxx index 442143bfd..58e069efd 100644 --- a/src/SALOMETraceCollector/SALOMETraceCollector.hxx +++ b/src/SALOMETraceCollector/SALOMETraceCollector.hxx @@ -28,25 +28,21 @@ #define _SALOMETRACECOLLECTOR_HXX_ #include -#include +#include #include "BaseTraceCollector.hxx" #include "LocalTraceBufferPool.hxx" //! See LocalTraceCollector instead of SALOMETraceCollector, //! for usage without CORBA -#if defined SALOMETRACECOLLECTOR_EXPORTS -#if defined WIN32 -#define SALOMETRACECOLLECTOR_EXPORT __declspec( dllexport ) -#else -#define SALOMETRACECOLLECTOR_EXPORT -#endif -#else #if defined WNT -#define SALOMETRACECOLLECTOR_EXPORT __declspec( dllimport ) +# if defined SALOMETRACECOLLECTOR_EXPORTS +# define SALOMETRACECOLLECTOR_EXPORT __declspec( dllexport ) +# else +# define SALOMETRACECOLLECTOR_EXPORT +# endif #else -#define SALOMETRACECOLLECTOR_EXPORT -#endif +# define SALOMETRACECOLLECTOR_EXPORT #endif class SALOMETRACECOLLECTOR_EXPORT SALOMETraceCollector: diff --git a/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.hxx b/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.hxx index 0bcea5ec2..e7a59bdc3 100644 --- a/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.hxx +++ b/src/SALOMETraceCollector/TraceCollector_WaitForServerReadiness.hxx @@ -27,7 +27,7 @@ #ifndef _TRACECOLLECTOR_WAITFORSERVERREADINESS_HXX_ #define _TRACECOLLECTOR_WAITFORSERVERREADINESS_HXX_ -#include +#include #include CORBA::Object_ptr TraceCollector_WaitForServerReadiness(CORBA::ORB_ptr theOrb, 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 d0c40386c..fcf2be69d 100644 --- a/src/TOOLSDS/SALOMEDS_Tool.cxx +++ b/src/TOOLSDS/SALOMEDS_Tool.cxx @@ -28,30 +28,42 @@ #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 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) 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/" @@ -60,53 +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); - aDir.Build(aProtection); +#ifdef WNT + CreateDirectory(aDir.c_str(), NULL); +#else + mkdir(aDir.c_str(), 0x1ff); +#endif - return aTmpDir.ToCString(); + return aDir; } //============================================================================ @@ -117,30 +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; i(theFromDirectory.c_str())); + string aTmpDir = theFromDirectory; long aBufferSize = 0; long aCurrentPos; @@ -178,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(); @@ -214,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 @@ -293,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(); @@ -324,8 +335,12 @@ SALOMEDS_Tool::PutStreamToFiles(const SALOMEDS::TMPFile& theStream, memcpy(&aFileSize, (aBuffer + aCurrentPos), ((sizeof(long) > 8) ? 8 : sizeof(long))); aCurrentPos += 8; - TCollection_AsciiString aFullPath = aTmpDir + aFileName; - ofstream aFile(aFullPath.ToCString()); + string aFullPath = aTmpDir + aFileName; +#ifdef WNT + ofstream aFile(aFullPath.c_str(), ios::binary); +#else + ofstream aFile(aFullPath.c_str()); +#endif aFile.write((char *)(aBuffer+aCurrentPos), aFileSize); aFile.close(); aCurrentPos += aFileSize; @@ -342,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; } //============================================================================ @@ -354,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(); i + #if defined TOOLSDS_EXPORTS + #if defined WIN32 + #define TOOLSDS_EXPORT __declspec( dllexport ) + #else + #define TOOLSDS_EXPORT + #endif + #else + #if defined WIN32 + #define TOOLSDS_EXPORT __declspec( dllimport ) + #else + #define TOOLSDS_EXPORT + #endif + #endif #else -#define SALOME_WNT_EXPORT + #define TOOLSDS_EXPORT #endif -class SALOME_WNT_EXPORT SALOMEDS_Tool +class TOOLSDS_EXPORT SALOMEDS_Tool { - public: // Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set diff --git a/src/TestContainer/Makefile.am b/src/TestContainer/Makefile.am index aca3e40c4..8101d8b2a 100644 --- a/src/TestContainer/Makefile.am +++ b/src/TestContainer/Makefile.am @@ -97,8 +97,10 @@ libSalomeTestComponentEngine_la_LIBADD = $(COMMON_LIBS) bin_PROGRAMS = TestContainer TestLogger TestContainer_SOURCES = TestContainer.cxx TestContainer_CPPFLAGS = $(COMMON_CPPFLAGS) -TestContainer_LDADD = $(COMMON_LIBS) libSalomeTestComponentEngine.la +TestContainer_LDADD = libSalomeTestComponentEngine.la \ + $(CORBA_LIBS) TestLogger_SOURCES = TestLogger.cxx TestLogger_CPPFLAGS = $(COMMON_CPPFLAGS) -TestLogger_LDADD = $(COMMON_LIBS) libSalomeTestComponentEngine.la +TestLogger_LDADD = libSalomeTestComponentEngine.la \ + $(CORBA_LIBS) diff --git a/src/TestContainer/SALOME_TestComponent_i.cxx b/src/TestContainer/SALOME_TestComponent_i.cxx index 2a6ebf223..221f60d66 100644 --- a/src/TestContainer/SALOME_TestComponent_i.cxx +++ b/src/TestContainer/SALOME_TestComponent_i.cxx @@ -26,7 +26,9 @@ // Module : SALOME // $Header$ -#define private protected +#ifndef WNT +# define private protected +#endif #include "utilities.h" #include "SALOME_TestComponent_i.hxx" #include @@ -44,7 +46,9 @@ Engines_TestComponent_i::Engines_TestComponent_i(CORBA::ORB_ptr orb, MESSAGE("activate object"); _thisObj = this ; _id = _poa->activate_object(_thisObj); - SCRUTE(pd_refCount); + //does not work with 4.0.6 (too bad) + //SCRUTE(_pd_refCount); + //SCRUTE(_refcount_value()); } Engines_TestComponent_i::Engines_TestComponent_i() @@ -60,7 +64,9 @@ char* Engines_TestComponent_i::Coucou(CORBA::Long L) { char s[100]; sprintf(s, "TestComponent_i : L = %ld", (long) L); - SCRUTE(pd_refCount); + //does not work with 4.0.6 (too bad) + //SCRUTE(_pd_refCount); + //SCRUTE(_refcount_value()); return CORBA::string_dup(s); } diff --git a/src/TestContainer/SALOME_TestComponent_i.hxx b/src/TestContainer/SALOME_TestComponent_i.hxx index 303a6a3f7..8bac7eecb 100644 --- a/src/TestContainer/SALOME_TestComponent_i.hxx +++ b/src/TestContainer/SALOME_TestComponent_i.hxx @@ -30,9 +30,11 @@ #define _SALOME_TESTCOMPONENT_I_HXX_ #include + +#include "SALOME_Component_i.hxx" + #include #include CORBA_SERVER_HEADER(SALOME_TestComponent) -#include "SALOME_Component_i.hxx" class Engines_TestComponent_i: public POA_Engines::TestComponent, diff --git a/src/TestContainer/TestComponentPy.py b/src/TestContainer/TestComponentPy.py index 4cfa5b896..d48e43853 100755 --- a/src/TestContainer/TestComponentPy.py +++ b/src/TestContainer/TestComponentPy.py @@ -34,6 +34,7 @@ import string from omniORB import CORBA import CosNaming import Engines +from Utils_Identity import getShortHostName #initialise the ORB @@ -48,8 +49,7 @@ if rootContext is None: sys.exit(1) #resolve the name /Containers.dir/FactoryServerPy.object -myMachine=string.split(os.getenv( "HOSTNAME" ),'.') -machineName= myMachine[0] +machineName=getShortHostName() containerName = "FactoryServerPy" name = [CosNaming.NameComponent("Containers","dir"), CosNaming.NameComponent(machineName,"dir"), diff --git a/src/TestContainer/TestContainer.cxx b/src/TestContainer/TestContainer.cxx index fb7a2f9fb..0ef063b74 100644 --- a/src/TestContainer/TestContainer.cxx +++ b/src/TestContainer/TestContainer.cxx @@ -190,6 +190,9 @@ int main (int argc, char * argv[]) catch(CORBA::Exception& e) { INFOS("Caught CORBA::Exception."< #include diff --git a/src/SALOMEDS/SALOMEDS_OCAFApplication.jxx b/src/Utils/SALOME_Utils.hxx old mode 100644 new mode 100755 similarity index 69% rename from src/SALOMEDS/SALOMEDS_OCAFApplication.jxx rename to src/Utils/SALOME_Utils.hxx index 3ea3ada01..d6c28d278 --- a/src/SALOMEDS/SALOMEDS_OCAFApplication.jxx +++ b/src/Utils/SALOME_Utils.hxx @@ -1,5 +1,3 @@ -// 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 // @@ -17,16 +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_OCAFApplication.jxx +// File : SALOME_Utils.hxx +// Author : Alexander A. BORODIN // Module : SALOME -#ifndef _TColStd_SequenceOfExtendedString_HeaderFile -#include +#ifndef _SALOME_UTILS_HXX_ +#define _SALOME_UTILS_HXX_ + +#ifdef WNT +# if defined UTILS_EXPORTS +# define UTILS_EXPORT __declspec( dllexport ) +# else +# define UTILS_EXPORT __declspec( dllimport ) +# endif +#else +# define UTILS_EXPORT #endif -#ifndef _SALOMEDS_OCAFApplication_HeaderFile -#include "SALOMEDS_OCAFApplication.hxx" + #endif diff --git a/src/Utils/SALOME_utilities.py b/src/Utils/SALOME_utilities.py index 298b29f87..1d790ed9d 100644 --- a/src/Utils/SALOME_utilities.py +++ b/src/Utils/SALOME_utilities.py @@ -10,32 +10,34 @@ import SALOME_Trace GLogger = SALOME_Trace.SALOME_Trace() +from launchConfigureParser import verbose + def MYTRACE (): - if __debug__: + if verbose(): str = "- Trace " GLogger.putMessage(str + " : ") def REPERE(): - if __debug__: + if verbose(): GLogger.putMessage(" -------------- \n") def BEGIN_OF(msg): - if __debug__: + if verbose(): REPERE(); MYTRACE(); GLogger.putMessage("Begin of : "+ str(msg) + "\n") REPERE(); def END_OF(msg): - if __debug__: + if verbose(): REPERE(); MYTRACE(); GLogger.putMessage("Normale end of : "+ str(msg) + "\n") REPERE(); def MESSAGE(msg): - if __debug__: + if verbose(): MYTRACE() GLogger.putMessage(str(msg) + "\n") diff --git a/src/Utils/SalomeString.hxx b/src/Utils/SalomeString.hxx index b751edb9b..eaee786cd 100644 --- a/src/Utils/SalomeString.hxx +++ b/src/Utils/SalomeString.hxx @@ -27,10 +27,12 @@ # ifndef SALOME_STRING # define SALOME_STRING +#include "SALOME_Utils.hxx" + # include # include -class SALOME_STRING : public string +class UTILS_EXPORT SALOME_STRING : public string { private : ostringstream _s ; diff --git a/src/Utils/Test/Makefile.am b/src/Utils/Test/Makefile.am index 682b4b417..4bcdb9b64 100644 --- a/src/Utils/Test/Makefile.am +++ b/src/Utils/Test/Makefile.am @@ -84,5 +84,5 @@ libUtilsTest_la_LIBADD = $(COMMON_LIBS) bin_PROGRAMS = TestUtils TestUtils_SOURCES = TestUtils.cxx TestUtils_CPPFLAGS = $(COMMON_CPPFLAGS) -TestUtils_LDADD = libUtilsTest.la $(COMMON_LIBS) +TestUtils_LDADD = libUtilsTest.la $(CORBA_LIBS) diff --git a/src/Utils/Utils_CommException.hxx b/src/Utils/Utils_CommException.hxx index 38d753679..4a07615d9 100644 --- a/src/Utils/Utils_CommException.hxx +++ b/src/Utils/Utils_CommException.hxx @@ -29,7 +29,9 @@ # if !defined ( __Utils_CommException_H__ ) # define __Utils_CommException_H__ ) -# include "Utils_SALOME_Exception.hxx" +#include "SALOME_Utils.hxx" + +#include "Utils_SALOME_Exception.hxx" class UTILS_EXPORT CommException : public SALOME_Exception { diff --git a/src/Utils/Utils_CorbaException.hxx b/src/Utils/Utils_CorbaException.hxx index 2142c8bed..c5c8f033e 100644 --- a/src/Utils/Utils_CorbaException.hxx +++ b/src/Utils/Utils_CorbaException.hxx @@ -29,6 +29,8 @@ #ifndef _UTILS_CORBAEXCEPTION_HXX_ #define _UTILS_CORBAEXCEPTION_HXX_ +#include "SALOME_Utils.hxx" + #include #include CORBA_SERVER_HEADER(SALOME_Exception) diff --git a/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx b/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx index 58f168b9d..9ae866266 100644 --- a/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx +++ b/src/Utils/Utils_DESTRUCTEUR_GENERIQUE.hxx @@ -29,9 +29,14 @@ # if !defined( __DESTRUCTEUR_GENERIQUE__H__ ) # define __DESTRUCTEUR_GENERIQUE__H__ -# include +#include + +#include "SALOME_Utils.hxx" + +#include #include -# include +#include +#include //# include "utilities.h" /*!\class DESTRUCTEUR_GENERIQUE_ @@ -55,29 +60,15 @@ * -# an object method to execute the destruction : operator()(). */ -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) -#else -#define UTILS_EXPORT -#endif -#endif - -class DESTRUCTEUR_GENERIQUE_ +class UTILS_EXPORT DESTRUCTEUR_GENERIQUE_ { public : - UTILS_EXPORT static std::list *Destructeurs; + static std::list *Destructeurs; virtual ~DESTRUCTEUR_GENERIQUE_() {}//!< virtual destructor - UTILS_EXPORT static const int Ajout( DESTRUCTEUR_GENERIQUE_ &objet );//!< adds a destruction object to the list of destructions - UTILS_EXPORT virtual void operator()( void )=0 ;//!< performs the destruction -} ; + static const int Ajout( DESTRUCTEUR_GENERIQUE_ &objet );//!< adds a destruction object to the list of destructions + virtual void operator()( void )=0 ;//!< performs the destruction +}; /*!\class DESTRUCTEUR_DE_ @@ -122,12 +113,15 @@ public : virtual void operator()(void){ typedef PortableServer::ServantBase TServant; if(_PtrObjet){ + if(dynamic_cast(_PtrObjet)){ + // std::cerr << "WARNING: automatic destruction for servant is no more used. It's too late in exit. Use explicit call" << std::endl; + /* if(TServant* aServant = dynamic_cast(_PtrObjet)){ - //cerr << "DESTRUCTEUR_GENERIQUE_::operator() deleting ServantBase's _PtrObjet" << endl; PortableServer::POA_var aPOA = aServant->_default_POA(); PortableServer::ObjectId_var anObjectId = aPOA->servant_to_id(aServant); aPOA->deactivate_object(anObjectId.in()); aServant->_remove_ref(); + */ }else{ //cerr << "DESTRUCTEUR_GENERIQUE_::operator() deleting _PtrObjet" << endl; TYPE* aPtr = static_cast(_PtrObjet); diff --git a/src/Utils/Utils_ExceptHandlers.hxx b/src/Utils/Utils_ExceptHandlers.hxx index 45f4a5754..8ac5aa8e5 100644 --- a/src/Utils/Utils_ExceptHandlers.hxx +++ b/src/Utils/Utils_ExceptHandlers.hxx @@ -29,21 +29,9 @@ #ifndef Utils_ExceptHandlers_HeaderFile #define Utils_ExceptHandlers_HeaderFile -#include +#include -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) -#else -#define UTILS_EXPORT -#endif -#endif +#include typedef void (*PVF)(); diff --git a/src/Utils/Utils_Identity.cxx b/src/Utils/Utils_Identity.cxx index 661cebbcc..41e24858d 100644 --- a/src/Utils/Utils_Identity.cxx +++ b/src/Utils/Utils_Identity.cxx @@ -83,23 +83,45 @@ const char* duplicate( const char *const str ) ; const char* get_uname( void ) { - char* hostName = new char[256]; - DWORD nSize = 256; - ASSERT(GetComputerName(hostName, &nSize)); - return hostName; + static std::string hostName(256, 0); + static DWORD nSize = hostName.length(); + static int res = ::GetComputerNameEx(ComputerNameDnsFullyQualified, &hostName[0], &nSize); + ASSERT( res ); + return hostName.c_str(); } const char* get_adip( void ) { - return get_uname(); + //#include + //#include + //static GUID sType = SVCID_HOSTNAME; + //static CSADDR_INFO* ips = new CSADDR_INFO[8]; // in case multiple IP addresses are returned + //static DWORD nSize = 1024; + //static std::string uname = get_uname(); + //static int res = ::GetAddressByName( NS_DEFAULT, &sType, &uname[0], 0, 0, 0, ips, &nSize, 0, 0 ); + //if ( res ) + // return ips[0].LocalAddr.lpSockaddr->sa_data; + + static hostent* he = ::gethostbyname( get_uname() ); + if ( he && he->h_addr_list && he->h_length >0 ) { + static char str[16]; + unsigned i1 = (unsigned char)he->h_addr_list[0][0]; + unsigned i2 = (unsigned char)he->h_addr_list[0][1]; + unsigned i3 = (unsigned char)he->h_addr_list[0][2]; + unsigned i4 = (unsigned char)he->h_addr_list[0][3]; + sprintf ( str, "%03u.%03u.%03u.%03u", i1, i2, i3, i4 ); + return str; + } + return ""; } const char* const get_pwname( void ) { - DWORD dwSize = 256 + 1; - char* retVal = new char[256]; - ASSERT(GetUserName ( retVal, &dwSize )); - return retVal; + static std::string retVal(256, 0); + static DWORD dwSize = retVal.length() + 1; + static int res = GetUserName( &retVal[0], &dwSize ); + ASSERT( res ); + return retVal.c_str(); } PSID getuid() { @@ -149,9 +171,14 @@ Identity::~Identity(void) //delete [] (char*)_dir ; //(char*&)_dir = NULL ; free((char*)_dir); - +#ifndef WIN32 + // free the memory only on Unix + // becasue at Windows it is the same static variable + // (function get_adip() returns the same char* as get_uname() ) delete [] (char*)_adip ; +#endif (char*&)_adip = NULL ; + } /*------------*/ diff --git a/src/Utils/Utils_Identity.hxx b/src/Utils/Utils_Identity.hxx index c6fd7e40c..5e508a47f 100644 --- a/src/Utils/Utils_Identity.hxx +++ b/src/Utils/Utils_Identity.hxx @@ -29,6 +29,8 @@ # if !defined( __IDENTITE_H__ ) # define __IDENTITE_H__ +#include + extern "C" { # include @@ -41,19 +43,6 @@ extern "C" #endif } -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) -#else -#define UTILS_EXPORT -#endif -#endif class UTILS_EXPORT Identity { diff --git a/src/Utils/Utils_Identity.py b/src/Utils/Utils_Identity.py index 8be6e2c00..d826b06b9 100644 --- a/src/Utils/Utils_Identity.py +++ b/src/Utils/Utils_Identity.py @@ -31,7 +31,10 @@ import sys import os import socket -import pwd + +if not sys.platform == "win32": + import pwd + import time import string @@ -50,10 +53,15 @@ class Identity: self._name = name self._pid = os.getpid() self._machine = socket.gethostname() - self._adip = socket.gethostbyname(self._machine) # IP adress - self._uid = os.getuid() - list = pwd.getpwuid(self._uid) - self._pwname = list[0] # user name + self._adip = socket.gethostbyname(self._machine) # IP adress + if sys.platform == "win32": + self._uid = os.getpid() + self._pwname = os.environ["USER"] + else: + self._uid = os.getuid() + list = pwd.getpwuid(self._uid) + self._pwname = list[0] # user name + self._tc_start = time.time() self._cstart = time.ctime(self._tc_start) self._cdir = os.getcwd() diff --git a/src/Utils/Utils_Mutex.hxx b/src/Utils/Utils_Mutex.hxx index c6d274180..a9e78653f 100644 --- a/src/Utils/Utils_Mutex.hxx +++ b/src/Utils/Utils_Mutex.hxx @@ -28,21 +28,9 @@ #ifndef Utils_Mutex_HeaderFile #define Utils_Mutex_HeaderFile -#include +#include "SALOME_Utils.hxx" -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) -#else -#define UTILS_EXPORT -#endif -#endif +#include class UTILS_EXPORT Utils_Mutex { diff --git a/src/Utils/Utils_ORB_INIT.cxx b/src/Utils/Utils_ORB_INIT.cxx index 9fe535564..7d7370e71 100644 --- a/src/Utils/Utils_ORB_INIT.cxx +++ b/src/Utils/Utils_ORB_INIT.cxx @@ -40,8 +40,16 @@ ORB_INIT::~ORB_INIT() { if ( ! CORBA::is_nil( _orb ) ) { + MESSAGE("WARNING: orb destroy is no more called at exit. Use explicit call."); //std::cerr << "appel _orb->destroy()" << std::endl; - _orb->destroy() ; + /* + try { + _orb->destroy() ; + } + catch(...) { + MESSAGE("Caught CORBA::Exception."); + } + */ //std::cerr << "retour _orb->destroy()" << std::endl; } } @@ -55,13 +63,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 ) diff --git a/src/Utils/Utils_ORB_INIT.hxx b/src/Utils/Utils_ORB_INIT.hxx index 8ec2770f1..e4f8c97f1 100644 --- a/src/Utils/Utils_ORB_INIT.hxx +++ b/src/Utils/Utils_ORB_INIT.hxx @@ -29,24 +29,13 @@ # if ! defined( __ORB_INIT_HXX__ ) # define __ORB_INIT_HXX__ -# include "CORBA.h" +#include -#include "Utils_CommException.hxx" +#include "SALOME_Utils.hxx" +#include "omniORB4/CORBA.h" -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) -#else -#define UTILS_EXPORT -#endif -#endif +#include "Utils_CommException.hxx" /*! * Ce composant prend en charge la connexion et la deconnexion a l'orb diff --git a/src/Utils/Utils_SALOME_Exception.hxx b/src/Utils/Utils_SALOME_Exception.hxx index d0f465b4d..5c9207dbc 100644 --- a/src/Utils/Utils_SALOME_Exception.hxx +++ b/src/Utils/Utils_SALOME_Exception.hxx @@ -29,6 +29,8 @@ #if !defined( __Utils_SALOME_Exception_hxx__ ) #define __Utils_SALOME_Exception_hxx__ +//#include "SALOME_Utils.hxx" + # include # include @@ -38,18 +40,18 @@ # define LOCALIZED(message) #message #endif -#if defined UTILS_EXPORTS -#if defined WIN32 -#define UTILS_EXPORT __declspec( dllexport ) -#else -#define UTILS_EXPORT -#endif -#else -#if defined WNT -#define UTILS_EXPORT __declspec( dllimport ) +//swig tool on Linux doesn't pass defines from header SALOME_Utils.hxx +//therefore (temporary solution) defines are placed below + +#ifdef WNT +# if defined UTILS_EXPORTS +# define UTILS_EXPORT __declspec( dllexport ) +# else +# define UTILS_EXPORT __declspec( dllimport ) +# define LOCALIZED(message) #message +# endif #else -#define UTILS_EXPORT -#endif +# define UTILS_EXPORT #endif class UTILS_EXPORT SALOME_Exception : public std::exception diff --git a/src/Utils/Utils_SINGLETON.hxx b/src/Utils/Utils_SINGLETON.hxx index 9d78f9a18..8873946bb 100644 --- a/src/Utils/Utils_SINGLETON.hxx +++ b/src/Utils/Utils_SINGLETON.hxx @@ -29,6 +29,8 @@ # if !defined( __SINGLETON__H__ ) # define __SINGLETON__H__ +#include "SALOME_Utils.hxx" + # include "Utils_DESTRUCTEUR_GENERIQUE.hxx" # include diff --git a/src/Utils/Utils_SignalsHandler.h b/src/Utils/Utils_SignalsHandler.h new file mode 100644 index 000000000..a76ce46d8 --- /dev/null +++ b/src/Utils/Utils_SignalsHandler.h @@ -0,0 +1,50 @@ +// KERNEL Utils : common utils for KERNEL +// Copyright (C) 2003 CEA +// +// 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.org + +#ifndef _UTILS_SIGNALSHANDLER_H_ +#define _UTILS_SIGNALSHANDLER_H_ + +#include "SALOME_Utils.hxx" + +#include +typedef void (*TSigHandler)(int); + + +class UTILS_EXPORT Utils_SignalsHandler{ + public: + Utils_SignalsHandler(); + ~Utils_SignalsHandler(); + + TSigHandler GetSigHandler(int theSigId); + TSigHandler SetSigHandler(int theSigId, TSigHandler theSigHandler); + typedef std::map TSigHandlerCont; + + private: + TSigHandlerCont mySigHandlerCont; +}; + + +class UTILS_EXPORT Utils_CASSignalsHandler: private Utils_SignalsHandler{ + public: + Utils_CASSignalsHandler(); +}; + + +#endif diff --git a/src/Utils/Utils_Timer.hxx b/src/Utils/Utils_Timer.hxx index 27655f2af..a8363e030 100644 --- a/src/Utils/Utils_Timer.hxx +++ b/src/Utils/Utils_Timer.hxx @@ -24,6 +24,8 @@ // File : Utils_Timer.hxx // Module : SALOME +#include "SALOME_Utils.hxx" + #include #include @@ -38,7 +40,7 @@ #define _POSIX_ #endif -class Utils_Timer { +class UTILS_EXPORT Utils_Timer { public: Utils_Timer(); virtual ~Utils_Timer(); -- 2.30.2