From 425a5e9144cbf648ca18d5160a061fbe00d458fc Mon Sep 17 00:00:00 2001 From: prascle Date: Fri, 6 Nov 2009 13:25:50 +0000 Subject: [PATCH] merge from branch V5_1_main tag mergeto_BR_V51_AR_6nov09 --- Makefile.am | 2 +- bin/Makefile.am | 1 + bin/NSparam.py | 3 +- bin/addToKillList.py | 3 +- bin/appli_clean.sh | 32 +- bin/appli_gen.py | 5 +- bin/appli_install.sh | 2 +- bin/appliskel/SalomeApp.xml | 7 +- bin/appliskel/env.d/envSalome.sh | 1 - bin/appliskel/getAppliPath.py | 1 + bin/appliskel/runSession | 94 +- bin/envSalome.py | 10 +- bin/killSalome.py | 3 +- bin/killSalomeWithPort.py | 3 +- bin/launchConfigureParser.py | 58 +- bin/launchSalome.py | 3 +- bin/nameserver.py | 30 +- bin/orbmodule.py | 9 +- bin/runNS.py | 1 + bin/runSalome | 4 +- bin/runSalome.bat | 23 + bin/runSalome.csh | 2 +- bin/runSalome.ksh | 6 +- bin/runSalome.py | 109 +- bin/salome.launch | 2 - bin/salomeConsole.py | 1 + bin/salome_session.py | 3 +- bin/salome_utils.py | 50 +- bin/server.py | 1 + bin/setenv.py | 35 +- bin/showNS.py | 1 + bin/shutdownSalome.py | 1 + bin/virtual_salome.py | 1 + bin/waitContainers.py | 1 + bin/waitNS.py | 1 + configure.ac | 244 +- doc/salome/Batch.texi | 4962 ----------------- doc/salome/batch.dox | 10 - doc/salome/gui/Makefile.am | 7 +- doc/salome/gui/doxyfile.in | 2 +- doc/salome/main.dox | 1 - doc/salome/tui/pythfilter.py | 1 + ...Calcium_Ports.idl => Calcium_Ports.idl.in} | 32 +- idl/Makefile.am | 50 +- idl/SALOMEDS.idl | 27 +- idl/SALOME_Component.idl | 23 +- .../SALOME_PyNode.idl | 50 +- resources/KERNELCatalog.xml.in | 3 + salome_adm/cmake_files/FindBOOST.cmake | 41 +- salome_adm/cmake_files/FindDOXYGEN.cmake | 93 + salome_adm/cmake_files/FindPLATFORM.cmake | 2 + salome_adm/cmake_files/FindPYTHON.cmake | 1 + salome_adm/cmake_files/Makefile.am | 1 + salome_adm/cmake_files/am2cmake.py | 288 +- .../cmake_files/install_python_from_idl.cmake | 2 +- salome_adm/unix/SALOMEconfig.ref.in | 48 +- salome_adm/unix/config_files/Makefile.am | 9 +- .../config_files/ac_check_sizeof_fortran.m4 | 49 + .../unix/config_files/ac_cxx_depend_flag.m4 | 10 +- .../unix/config_files/ac_cxx_have_sstream.m4 | 33 +- .../unix/config_files/ac_linker_options.m4 | 5 + salome_adm/unix/config_files/check_boost.m4 | 16 + salome_adm/unix/config_files/check_calcium.m4 | 58 + salome_adm/unix/config_files/check_f77.m4 | 1 - salome_adm/unix/config_files/check_hdf5.m4 | 8 + .../unix/config_files/check_libbatch.m4 | 115 + salome_adm/unix/config_files/check_libxml.m4 | 3 + salome_adm/unix/config_files/check_local.m4 | 90 - salome_adm/unix/config_files/check_lsf.m4 | 105 - salome_adm/unix/config_files/check_openpbs.m4 | 88 - salome_adm/unix/config_files/local_install.m4 | 65 + salome_adm/unix/make_common_starter.am | 13 + .../Batch_APIInternalFailureException.hxx | 51 - src/Batch/Batch_BatchManager.cxx | 149 - src/Batch/Batch_BatchManager.hxx | 85 - src/Batch/Batch_BatchManagerCatalog.cxx | 96 - src/Batch/Batch_BatchManagerCatalog.hxx | 70 - src/Batch/Batch_BatchManager_LSF.cxx | 194 - src/Batch/Batch_BatchManager_LSF.hxx | 97 - src/Batch/Batch_BatchManager_Local.cxx | 828 --- src/Batch/Batch_BatchManager_Local.hxx | 174 - src/Batch/Batch_BatchManager_Local_RSH.cxx | 151 - src/Batch/Batch_BatchManager_Local_RSH.hxx | 82 - src/Batch/Batch_BatchManager_Local_SH.cxx | 118 - src/Batch/Batch_BatchManager_Local_SH.hxx | 82 - src/Batch/Batch_BatchManager_Local_SSH.cxx | 152 - src/Batch/Batch_BatchManager_Local_SSH.hxx | 82 - src/Batch/Batch_BatchManager_PBS.cxx | 216 - src/Batch/Batch_BatchManager_PBS.hxx | 98 - src/Batch/Batch_BatchManager_eClient.cxx | 246 - src/Batch/Batch_BatchManager_eClient.hxx | 78 - src/Batch/Batch_BatchManager_eLSF.cxx | 363 -- src/Batch/Batch_BatchManager_eLSF.hxx | 96 - src/Batch/Batch_BatchManager_ePBS.cxx | 342 -- src/Batch/Batch_BatchManager_ePBS.hxx | 95 - src/Batch/Batch_BatchManager_eSGE.cxx | 344 -- src/Batch/Batch_BatchManager_eSGE.hxx | 95 - src/Batch/Batch_BoolType.cxx | 66 - src/Batch/Batch_BoolType.hxx | 69 - src/Batch/Batch_CharType.cxx | 66 - src/Batch/Batch_CharType.hxx | 70 - src/Batch/Batch_ConnexionFailureException.cxx | 37 - src/Batch/Batch_Couple.cxx | 63 - src/Batch/Batch_Couple.hxx | 74 - src/Batch/Batch_CoupleType.cxx | 73 - src/Batch/Batch_CoupleType.hxx | 72 - src/Batch/Batch_Date.cxx | 195 - src/Batch/Batch_Date.hxx | 67 - src/Batch/Batch_DateType.cxx | 74 - src/Batch/Batch_DateType.hxx | 74 - src/Batch/Batch_Defines.hxx | 42 - src/Batch/Batch_Environnement.cxx | 38 - src/Batch/Batch_Environnement.hxx | 48 - src/Batch/Batch_FactBatchManager.cxx | 68 - src/Batch/Batch_FactBatchManager.hxx | 63 - src/Batch/Batch_FactBatchManager_LSF.cxx | 60 - src/Batch/Batch_FactBatchManager_LSF.hxx | 57 - src/Batch/Batch_FactBatchManager_Local.cxx | 60 - src/Batch/Batch_FactBatchManager_Local.hxx | 57 - .../Batch_FactBatchManager_Local_RSH.cxx | 58 - .../Batch_FactBatchManager_Local_RSH.hxx | 57 - src/Batch/Batch_FactBatchManager_Local_SH.cxx | 60 - src/Batch/Batch_FactBatchManager_Local_SH.hxx | 57 - .../Batch_FactBatchManager_Local_SSH.cxx | 60 - .../Batch_FactBatchManager_Local_SSH.hxx | 57 - src/Batch/Batch_FactBatchManager_PBS.cxx | 58 - src/Batch/Batch_FactBatchManager_PBS.hxx | 57 - src/Batch/Batch_FactBatchManager_eClient.cxx | 50 - src/Batch/Batch_FactBatchManager_eClient.hxx | 60 - src/Batch/Batch_FactBatchManager_eLSF.cxx | 63 - src/Batch/Batch_FactBatchManager_eLSF.hxx | 63 - src/Batch/Batch_FactBatchManager_ePBS.cxx | 64 - src/Batch/Batch_FactBatchManager_ePBS.hxx | 63 - src/Batch/Batch_FactBatchManager_eSGE.cxx | 66 - src/Batch/Batch_FactBatchManager_eSGE.hxx | 61 - src/Batch/Batch_GenericException.cxx | 37 - src/Batch/Batch_GenericException.hxx | 54 - src/Batch/Batch_GenericType.cxx | 65 - src/Batch/Batch_GenericType.hxx | 72 - src/Batch/Batch_IOMutex.hxx | 47 - src/Batch/Batch_IntType.cxx | 72 - src/Batch/Batch_IntType.hxx | 69 - src/Batch/Batch_InvalidArgumentException.cxx | 37 - src/Batch/Batch_InvalidKeyException.cxx | 38 - src/Batch/Batch_InvalidKeyException.hxx | 58 - src/Batch/Batch_Job.cxx | 117 - src/Batch/Batch_Job.hxx | 78 - src/Batch/Batch_JobId.cxx | 137 - src/Batch/Batch_JobId.hxx | 91 - src/Batch/Batch_JobInfo.cxx | 96 - src/Batch/Batch_JobInfo.hxx | 79 - src/Batch/Batch_JobInfo_LSF.cxx | 204 - src/Batch/Batch_JobInfo_LSF.hxx | 76 - src/Batch/Batch_JobInfo_Local.cxx | 54 - src/Batch/Batch_JobInfo_Local.hxx | 60 - src/Batch/Batch_JobInfo_PBS.cxx | 198 - src/Batch/Batch_JobInfo_PBS.hxx | 72 - src/Batch/Batch_JobInfo_eLSF.cxx | 107 - src/Batch/Batch_JobInfo_eLSF.hxx | 72 - src/Batch/Batch_JobInfo_ePBS.cxx | 118 - src/Batch/Batch_JobInfo_ePBS.hxx | 71 - src/Batch/Batch_JobInfo_eSGE.cxx | 113 - src/Batch/Batch_JobInfo_eSGE.hxx | 72 - src/Batch/Batch_Job_LSF.cxx | 264 - src/Batch/Batch_Job_LSF.hxx | 65 - src/Batch/Batch_Job_Local.cxx | 106 - src/Batch/Batch_Job_Local.hxx | 71 - src/Batch/Batch_Job_PBS.cxx | 472 -- src/Batch/Batch_Job_PBS.hxx | 96 - src/Batch/Batch_ListIsFullException.cxx | 37 - src/Batch/Batch_ListIsFullException.hxx | 50 - src/Batch/Batch_LongType.cxx | 71 - src/Batch/Batch_LongType.hxx | 69 - src/Batch/Batch_MapKey.cxx | 42 - src/Batch/Batch_MapKey.hxx | 69 - .../Batch_NotYetImplementedException.cxx | 37 - .../Batch_NotYetImplementedException.hxx | 52 - src/Batch/Batch_Parametre.cxx | 295 - src/Batch/Batch_Parametre.hxx | 159 - src/Batch/Batch_PyVersatile.cxx | 202 - src/Batch/Batch_PyVersatile.hxx | 69 - src/Batch/Batch_RunTimeException.cxx | 37 - src/Batch/Batch_RunTimeException.hxx | 51 - src/Batch/Batch_StringType.cxx | 66 - src/Batch/Batch_StringType.hxx | 67 - src/Batch/Batch_TypeMismatchException.cxx | 36 - src/Batch/Batch_TypeMismatchException.hxx | 51 - src/Batch/Batch_Versatile.cxx | 323 -- src/Batch/Batch_Versatile.hxx | 123 - src/Batch/Makefile.am | 237 - src/Batch/MpiImpl.cxx | 277 - src/Batch/MpiImpl.hxx | 170 - src/Batch_SWIG/Batch_test.py | 74 - src/Batch_SWIG/Makefile.am | 91 - src/Batch_SWIG/libBatch_Swig.i | 84 - src/Batch_SWIG/libBatch_Swig_exception.i | 45 - src/Batch_SWIG/libBatch_Swig_typemap.i | 247 - src/Communication/Makefile.am | 1 - src/Communication_SWIG/Makefile.am | 1 - src/Container/Component_i.cxx | 264 +- src/Container/Container_i.cxx | 118 +- src/Container/Makefile.am | 4 +- src/Container/SALOME_ComponentPy.py | 23 +- src/Container/SALOME_Component_i.hxx | 19 +- src/Container/SALOME_Container.cxx | 8 +- src/Container/SALOME_Container.py | 25 +- src/Container/SALOME_ContainerManager.cxx | 506 +- src/Container/SALOME_ContainerManager.hxx | 18 +- src/Container/SALOME_ContainerPy.py | 29 +- src/Container/SALOME_Container_i.hxx | 22 +- src/Container/SALOME_FileRef_i.cxx | 10 +- src/Container/SALOME_FileRef_i.hxx | 4 +- src/Container/SALOME_PyNode.py | 76 + src/Container/Salome_file_i.cxx | 122 +- src/Container/Salome_file_i.hxx | 4 +- src/DF/DF_Attribute.cxx | 5 +- src/DF/DF_Document.cxx | 1 + src/DSC/DSC_Basic/DSC_i.cxx | 6 +- src/DSC/DSC_Basic/DSC_interface.cxx | 193 + src/DSC/DSC_Basic/DSC_interface.hxx | 3 + src/DSC/DSC_Basic/Makefile.am | 1 - src/DSC/DSC_Python/Makefile.am | 6 +- src/DSC/DSC_Python/calcium.i | 7 +- src/DSC/DSC_Python/dsccalcium.py | 5 + src/DSC/DSC_User/Basic/Makefile.am | 1 - .../DSC_User/Datastream/AdjacentFunctor.hxx | 12 +- src/DSC/DSC_User/Datastream/Calcium/Calcium.c | 220 +- .../DSC_User/Datastream/Calcium/Calcium.cxx | 14 +- .../Datastream/Calcium/CalciumCInterface.cxx | 155 + .../Datastream/Calcium/CalciumCInterface.hxx | 93 + .../Calcium/CalciumCouplingPolicy.cxx | 40 +- .../Calcium/CalciumCouplingPolicy.hxx | 66 +- .../Calcium/CalciumCxxInterface.cxx} | 27 +- .../Calcium/CalciumCxxInterface.hxx | 583 +- .../Datastream/Calcium/CalciumFortranInt.h.in | 42 + .../Calcium/CalciumGenericProvidesPort.hxx | 14 +- .../Calcium/CalciumGenericUsesPort.hxx | 2 + .../Datastream/Calcium/CalciumInterface.hxx | 227 +- .../Calcium/CalciumMacroCInterface.hxx | 148 + .../Datastream/Calcium/CalciumPortTraits.hxx | 24 +- .../Calcium/CalciumProvidesPort.cxx | 4 + ...desPort.hxx => CalciumProvidesPort.hxx.in} | 8 + .../Datastream/Calcium/CalciumTypes.hxx | 106 +- .../Calcium/CalciumTypes2CorbaTypes.cxx | 26 +- .../Datastream/Calcium/Copy2CorbaSpace.hxx | 11 +- .../Datastream/Calcium/Copy2UserSpace.hxx | 12 +- .../Calcium/CorbaTypes2CalciumTypes.cxx | 25 +- .../DSC_User/Datastream/Calcium/Makefile.am | 22 +- src/DSC/DSC_User/Datastream/Calcium/calcium.h | 15 + .../DSC_User/Datastream/Calcium/calciumP.h | 742 +-- .../Calcium/calcium_destructors_port_uses.cxx | 4 + .../Calcium/calcium_intc_port_uses.hxx} | 41 +- ...s.hxx => calcium_integer_port_uses.hxx.in} | 10 +- .../Calcium/calcium_long_port_uses.hxx} | 47 +- .../Calcium/calcium_port_factory.cxx | 8 + .../Calcium/calcium_port_factory.hxx | 2 + .../Calcium/calcium_repository_types.cxx | 4 + .../DSC_User/Datastream/Calcium/calciumf.c | 221 +- .../DSC_User/Datastream/Calcium/calciumf.h | 78 + .../Datastream/CorbaTypeManipulator.hxx | 11 +- src/DSC/DSC_User/Datastream/GenericPort.hxx | 326 +- .../DSC_User/Datastream/GenericUsesPort.hxx | 8 +- src/DSC/DSC_User/Datastream/Palm/Makefile.am | 1 - src/DSC/DSC_User/Makefile.am | 1 - src/DSC/DSC_User/Superv_Component_i.cxx | 69 +- src/DSC/DSC_User/Superv_Component_i.hxx | 45 +- src/DSC/DSC_User/base_port.cxx | 7 +- src/DSC/ParallelDSC/Makefile.am | 1 - src/GenericObj/Makefile.am | 1 - src/HDFPersist/HDFobjectIdentify.c | 1 + src/KERNEL_PY/Help.py | 1 + src/KERNEL_PY/Makefile.am | 7 +- src/KERNEL_PY/PyInterp.py | 1 + src/KERNEL_PY/batchmode_salome.py | 1 + src/KERNEL_PY/import_hook.py | 5 +- src/KERNEL_PY/iparameters.py | 1 + src/KERNEL_PY/kernel_shared_modules.py | 1 + src/KERNEL_PY/omnipatch.py | 1 + src/KERNEL_PY/salome.py | 1 + src/KERNEL_PY/salome_ComponentGUI.py | 1 + src/KERNEL_PY/salome_genericobj.py | 26 + src/KERNEL_PY/salome_iapp.py | 1 + src/KERNEL_PY/salome_kernel.py | 1 + src/KERNEL_PY/salome_notebook.py | 108 +- src/KERNEL_PY/salome_pynode.py | 61 + src/KERNEL_PY/salome_shared_modules.py | 1 + src/KERNEL_PY/salome_study.py | 1 + src/KERNEL_PY/salome_test.py | 13 +- src/KERNEL_PY/salome_version.py | 1 + src/Launcher/BatchTest.cxx | 15 +- src/Launcher/Launcher.cxx | 127 +- src/Launcher/Launcher.hxx | 6 +- src/Launcher/Makefile.am | 20 +- src/LifeCycleCORBA/LifeCycleCORBA.py | 1 + src/LifeCycleCORBA/Makefile.am | 1 - src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx | 26 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx | 3 + src/LifeCycleCORBA/Test/Makefile.am | 1 - src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py | 1 + src/LifeCycleCORBA/TestContainerManager.cxx | 2 +- src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py | 1 + src/LifeCycleCORBA_SWIG/Makefile.am | 1 - .../Test/LifeCycleCORBA_SWIGTest.py | 1 + .../Test/TestLifeCycleCORBA_SWIG.py | 1 + .../Test/testcontainermanager.py | 2 + .../Test/testresourcemanager.py | 2 + src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py | 1 + src/Logger/Makefile.am | 2 - src/Logger/SALOME_Trace.py | 1 + src/Logger/Test/TestKiller.py | 1 + src/MPIContainer/MPIContainer_i.cxx | 23 +- src/MPIContainer/MPIObject_i.cxx | 6 +- src/MPIContainer/MPIObject_i.hxx | 2 +- src/MPIContainer/Makefile.am | 1 - src/MPIContainer/SALOME_MPIContainer.cxx | 30 +- src/Makefile.am | 11 +- src/ModuleCatalog/Makefile.am | 1 - src/ModuleCatalog/TestModuleCatalog.py | 1 + src/ModuleGenerator/IDLparser.py | 1 + src/NOTIFICATION_SWIG/Makefile.am | 1 - src/NamingService/Makefile.am | 1 - src/NamingService/SALOME_NamingService.cxx | 18 +- src/NamingService/SALOME_NamingService.hxx | 3 +- src/NamingService/SALOME_NamingServicePy.py | 5 +- src/NamingService/Test/Makefile.am | 1 - src/NamingService/Test/TestNamingService.py | 1 + src/Notification/Makefile.am | 1 - src/ParallelContainer/Makefile.am | 1 - .../SALOME_ParallelContainerProxy_i.cxx | 4 +- .../SALOME_ParallelContainer_i.cxx | 4 +- src/Registry/Makefile.am | 2 - src/Registry/RegistryConnexion.cxx | 172 +- src/Registry/RegistryService.cxx | 278 +- src/ResourcesManager/Makefile.am | 3 +- src/ResourcesManager/ResourcesManager.cxx | 2 +- src/ResourcesManager/ResourcesManager.hxx | 3 + .../SALOME_ResourcesCatalog_Handler.cxx | 1 + src/SALOMEDS/Makefile.am | 1 - src/SALOMEDS/SALOMEDS_AttributeIOR.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx | 4 + src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeName.cxx | 4 +- src/SALOMEDS/SALOMEDS_AttributePixMap.cxx | 6 +- .../SALOMEDS_AttributeStudyProperties.cxx | 28 +- src/SALOMEDS/SALOMEDS_ChildIterator.cxx | 5 +- src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_Driver_i.cxx | 1 + src/SALOMEDS/SALOMEDS_GenericAttribute.cxx | 9 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx | 8 +- src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx | 4 +- src/SALOMEDS/SALOMEDS_SComponent.cxx | 11 +- src/SALOMEDS/SALOMEDS_SComponentIterator.cxx | 2 +- .../SALOMEDS_SComponentIterator_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_SComponent_i.cxx | 3 +- src/SALOMEDS/SALOMEDS_SObject.cxx | 17 +- src/SALOMEDS/SALOMEDS_SObject.hxx | 2 +- src/SALOMEDS/SALOMEDS_SObject_i.cxx | 7 +- src/SALOMEDS/SALOMEDS_SObject_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_Study.cxx | 53 +- src/SALOMEDS/SALOMEDS_Study.hxx | 4 + src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx | 52 +- src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 49 +- src/SALOMEDS/SALOMEDS_Study_i.cxx | 85 +- src/SALOMEDS/SALOMEDS_Study_i.hxx | 12 +- src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx | 2 +- src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx | 2 +- src/SALOMEDS/SALOME_DriverPy.py | 1 + src/SALOMEDS/Test/Makefile.am | 1 - src/SALOMEDS/Test/TestSALOMEDS.py | 1 + src/SALOMEDSClient/Makefile.am | 1 - src/SALOMEDSClient/SALOMEDSClient_Study.hxx | 4 + src/SALOMEDSImpl/Makefile.am | 9 +- .../SALOMEDSImpl_AttributeIOR.cxx | 75 +- .../SALOMEDSImpl_AttributeIOR.hxx | 2 +- .../SALOMEDSImpl_GenericVariable.hxx | 2 +- .../SALOMEDSImpl_ScalarVariable.cxx | 35 + .../SALOMEDSImpl_ScalarVariable.hxx | 4 + src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 319 +- src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx | 11 + .../SALOMEDSImpl_StudyBuilder.cxx | 5 + .../SALOMEDSImpl_StudyManager.cxx | 69 +- src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx | 44 +- src/SALOMEDSImpl/Test/Makefile.am | 1 - src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py | 1 + .../Test/TestSALOMELocalTrace.py | 1 + src/SALOMETraceCollector/Makefile.am | 1 - src/SALOMETraceCollector/Test/Makefile.am | 3 +- .../Test/TestSALOMETraceCollector.py | 1 + src/TOOLSDS/Makefile.am | 1 - src/TestContainer/Makefile.am | 1 - src/TestContainer/SALOME_TestComponentPy.py | 1 + src/TestContainer/TestLogger.py | 1 + src/TestMPIContainer/Makefile.am | 1 - src/UnitTests/Makefile.am | 3 +- src/UnitTests/UnitTests.py | 1 + src/Utils/Makefile.am | 1 - src/Utils/SALOME_utilities.py | 1 + src/Utils/Test/Makefile.am | 3 +- src/Utils/Test/TestUtils.py | 1 + src/Utils/Utils_Identity.py | 1 + src/Utils/Utils_SALOME_Exception.hxx | 2 +- src/win32pm/setup.py | 1 + 403 files changed, 5707 insertions(+), 21785 deletions(-) create mode 100644 bin/runSalome.bat delete mode 100755 doc/salome/Batch.texi delete mode 100644 doc/salome/batch.dox rename idl/{Calcium_Ports.idl => Calcium_Ports.idl.in} (78%) rename src/Batch/Batch_InvalidArgumentException.hxx => idl/SALOME_PyNode.idl (54%) create mode 100644 salome_adm/cmake_files/FindDOXYGEN.cmake create mode 100644 salome_adm/unix/config_files/ac_check_sizeof_fortran.m4 create mode 100644 salome_adm/unix/config_files/check_calcium.m4 create mode 100644 salome_adm/unix/config_files/check_libbatch.m4 delete mode 100755 salome_adm/unix/config_files/check_local.m4 delete mode 100755 salome_adm/unix/config_files/check_lsf.m4 delete mode 100644 salome_adm/unix/config_files/check_openpbs.m4 create mode 100644 salome_adm/unix/config_files/local_install.m4 delete mode 100644 src/Batch/Batch_APIInternalFailureException.hxx delete mode 100644 src/Batch/Batch_BatchManager.cxx delete mode 100644 src/Batch/Batch_BatchManager.hxx delete mode 100644 src/Batch/Batch_BatchManagerCatalog.cxx delete mode 100644 src/Batch/Batch_BatchManagerCatalog.hxx delete mode 100644 src/Batch/Batch_BatchManager_LSF.cxx delete mode 100644 src/Batch/Batch_BatchManager_LSF.hxx delete mode 100644 src/Batch/Batch_BatchManager_Local.cxx delete mode 100644 src/Batch/Batch_BatchManager_Local.hxx delete mode 100644 src/Batch/Batch_BatchManager_Local_RSH.cxx delete mode 100644 src/Batch/Batch_BatchManager_Local_RSH.hxx delete mode 100644 src/Batch/Batch_BatchManager_Local_SH.cxx delete mode 100644 src/Batch/Batch_BatchManager_Local_SH.hxx delete mode 100644 src/Batch/Batch_BatchManager_Local_SSH.cxx delete mode 100644 src/Batch/Batch_BatchManager_Local_SSH.hxx delete mode 100644 src/Batch/Batch_BatchManager_PBS.cxx delete mode 100644 src/Batch/Batch_BatchManager_PBS.hxx delete mode 100644 src/Batch/Batch_BatchManager_eClient.cxx delete mode 100644 src/Batch/Batch_BatchManager_eClient.hxx delete mode 100644 src/Batch/Batch_BatchManager_eLSF.cxx delete mode 100644 src/Batch/Batch_BatchManager_eLSF.hxx delete mode 100644 src/Batch/Batch_BatchManager_ePBS.cxx delete mode 100644 src/Batch/Batch_BatchManager_ePBS.hxx delete mode 100644 src/Batch/Batch_BatchManager_eSGE.cxx delete mode 100644 src/Batch/Batch_BatchManager_eSGE.hxx delete mode 100644 src/Batch/Batch_BoolType.cxx delete mode 100644 src/Batch/Batch_BoolType.hxx delete mode 100644 src/Batch/Batch_CharType.cxx delete mode 100644 src/Batch/Batch_CharType.hxx delete mode 100644 src/Batch/Batch_ConnexionFailureException.cxx delete mode 100644 src/Batch/Batch_Couple.cxx delete mode 100644 src/Batch/Batch_Couple.hxx delete mode 100644 src/Batch/Batch_CoupleType.cxx delete mode 100644 src/Batch/Batch_CoupleType.hxx delete mode 100644 src/Batch/Batch_Date.cxx delete mode 100644 src/Batch/Batch_Date.hxx delete mode 100644 src/Batch/Batch_DateType.cxx delete mode 100644 src/Batch/Batch_DateType.hxx delete mode 100755 src/Batch/Batch_Defines.hxx delete mode 100644 src/Batch/Batch_Environnement.cxx delete mode 100644 src/Batch/Batch_Environnement.hxx delete mode 100644 src/Batch/Batch_FactBatchManager.cxx delete mode 100644 src/Batch/Batch_FactBatchManager.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_LSF.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_LSF.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local_RSH.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local_RSH.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local_SH.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local_SH.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local_SSH.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_Local_SSH.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_PBS.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_PBS.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_eClient.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_eClient.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_eLSF.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_eLSF.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_ePBS.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_ePBS.hxx delete mode 100644 src/Batch/Batch_FactBatchManager_eSGE.cxx delete mode 100644 src/Batch/Batch_FactBatchManager_eSGE.hxx delete mode 100644 src/Batch/Batch_GenericException.cxx delete mode 100644 src/Batch/Batch_GenericException.hxx delete mode 100644 src/Batch/Batch_GenericType.cxx delete mode 100644 src/Batch/Batch_GenericType.hxx delete mode 100644 src/Batch/Batch_IOMutex.hxx delete mode 100644 src/Batch/Batch_IntType.cxx delete mode 100644 src/Batch/Batch_IntType.hxx delete mode 100644 src/Batch/Batch_InvalidArgumentException.cxx delete mode 100644 src/Batch/Batch_InvalidKeyException.cxx delete mode 100644 src/Batch/Batch_InvalidKeyException.hxx delete mode 100644 src/Batch/Batch_Job.cxx delete mode 100644 src/Batch/Batch_Job.hxx delete mode 100644 src/Batch/Batch_JobId.cxx delete mode 100644 src/Batch/Batch_JobId.hxx delete mode 100644 src/Batch/Batch_JobInfo.cxx delete mode 100644 src/Batch/Batch_JobInfo.hxx delete mode 100644 src/Batch/Batch_JobInfo_LSF.cxx delete mode 100644 src/Batch/Batch_JobInfo_LSF.hxx delete mode 100644 src/Batch/Batch_JobInfo_Local.cxx delete mode 100644 src/Batch/Batch_JobInfo_Local.hxx delete mode 100644 src/Batch/Batch_JobInfo_PBS.cxx delete mode 100644 src/Batch/Batch_JobInfo_PBS.hxx delete mode 100644 src/Batch/Batch_JobInfo_eLSF.cxx delete mode 100644 src/Batch/Batch_JobInfo_eLSF.hxx delete mode 100644 src/Batch/Batch_JobInfo_ePBS.cxx delete mode 100644 src/Batch/Batch_JobInfo_ePBS.hxx delete mode 100644 src/Batch/Batch_JobInfo_eSGE.cxx delete mode 100644 src/Batch/Batch_JobInfo_eSGE.hxx delete mode 100644 src/Batch/Batch_Job_LSF.cxx delete mode 100644 src/Batch/Batch_Job_LSF.hxx delete mode 100644 src/Batch/Batch_Job_Local.cxx delete mode 100644 src/Batch/Batch_Job_Local.hxx delete mode 100644 src/Batch/Batch_Job_PBS.cxx delete mode 100644 src/Batch/Batch_Job_PBS.hxx delete mode 100644 src/Batch/Batch_ListIsFullException.cxx delete mode 100644 src/Batch/Batch_ListIsFullException.hxx delete mode 100644 src/Batch/Batch_LongType.cxx delete mode 100644 src/Batch/Batch_LongType.hxx delete mode 100644 src/Batch/Batch_MapKey.cxx delete mode 100644 src/Batch/Batch_MapKey.hxx delete mode 100644 src/Batch/Batch_NotYetImplementedException.cxx delete mode 100644 src/Batch/Batch_NotYetImplementedException.hxx delete mode 100644 src/Batch/Batch_Parametre.cxx delete mode 100644 src/Batch/Batch_Parametre.hxx delete mode 100644 src/Batch/Batch_PyVersatile.cxx delete mode 100644 src/Batch/Batch_PyVersatile.hxx delete mode 100644 src/Batch/Batch_RunTimeException.cxx delete mode 100644 src/Batch/Batch_RunTimeException.hxx delete mode 100644 src/Batch/Batch_StringType.cxx delete mode 100644 src/Batch/Batch_StringType.hxx delete mode 100644 src/Batch/Batch_TypeMismatchException.cxx delete mode 100644 src/Batch/Batch_TypeMismatchException.hxx delete mode 100644 src/Batch/Batch_Versatile.cxx delete mode 100644 src/Batch/Batch_Versatile.hxx delete mode 100644 src/Batch/Makefile.am delete mode 100644 src/Batch/MpiImpl.cxx delete mode 100644 src/Batch/MpiImpl.hxx delete mode 100644 src/Batch_SWIG/Batch_test.py delete mode 100644 src/Batch_SWIG/Makefile.am delete mode 100644 src/Batch_SWIG/libBatch_Swig.i delete mode 100644 src/Batch_SWIG/libBatch_Swig_exception.i delete mode 100644 src/Batch_SWIG/libBatch_Swig_typemap.i create mode 100644 src/Container/SALOME_PyNode.py create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx rename src/{Batch/Batch_IOMutex.cxx => DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.cxx} (73%) create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumFortranInt.h.in create mode 100644 src/DSC/DSC_User/Datastream/Calcium/CalciumMacroCInterface.hxx rename src/DSC/DSC_User/Datastream/Calcium/{CalciumProvidesPort.hxx => CalciumProvidesPort.hxx.in} (85%) rename src/{Batch/Batch_APIInternalFailureException.cxx => DSC/DSC_User/Datastream/Calcium/calcium_intc_port_uses.hxx} (58%) rename src/DSC/DSC_User/Datastream/Calcium/{calcium_integer_port_uses.hxx => calcium_integer_port_uses.hxx.in} (90%) rename src/{Batch/Batch_ConnexionFailureException.hxx => DSC/DSC_User/Datastream/Calcium/calcium_long_port_uses.hxx} (56%) create mode 100644 src/DSC/DSC_User/Datastream/Calcium/calciumf.h create mode 100644 src/KERNEL_PY/salome_genericobj.py create mode 100644 src/KERNEL_PY/salome_pynode.py diff --git a/Makefile.am b/Makefile.am index 6d46bb852..8407412a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,7 +40,7 @@ endif DIST_SUBDIRS= salome_adm idl src doc bin resources -DISTCLEANFILES = a.out +DISTCLEANFILES = a.out local-install.sh salomeinclude_DATA = KERNEL_version.h diff --git a/bin/Makefile.am b/bin/Makefile.am index 000aeda4b..5ad8d82e4 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -50,6 +50,7 @@ dist_salomescript_SCRIPTS = \ runSalome \ runSalome.csh \ runSalome.ksh \ + runSalome.bat \ waitNS.sh # These files are python files diff --git a/bin/NSparam.py b/bin/NSparam.py index 4a2d9881a..bbc4d3c16 100755 --- a/bin/NSparam.py +++ b/bin/NSparam.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/addToKillList.py b/bin/addToKillList.py index 730ac8d35..7c439be3e 100755 --- a/bin/addToKillList.py +++ b/bin/addToKillList.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/appli_clean.sh b/bin/appli_clean.sh index a5413a737..521940cd4 100644 --- a/bin/appli_clean.sh +++ b/bin/appli_clean.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -21,5 +21,31 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # #clean appli -# -rm -rf bin lib share doc idl env.d envd USERS getAppliPath.py searchFreePort.sh runAppli runConsole runSession runRemote.sh runTests SalomeApp.xml *.pyc *~ .bashrc + +DELCOM="rm -rf bin lib share doc idl env.d envd USERS getAppliPath.py searchFreePort.sh runAppli runConsole runSession runRemote.sh runTests SalomeApp.xml *.pyc *~ .bashrc" +DOIT="false" + +if [ $# > 0 ] +then + if [ "x$1" == "x-f" ] + then DOIT="true" + fi +fi + +if [ $DOIT == "false" ] +then + echo "Do you want to delete a SALOME application in this directory ? " `pwd` + echo "command to execute: " $DELCOM + echo "enter yes or no" + read ANSWER + echo "ANSWER="$ANSWER + if [ "x$ANSWER" == "xyes" ] + then + DOIT="true" + fi +fi + +if [ $DOIT == "true" ] +then + $DELCOM +fi diff --git a/bin/appli_gen.py b/bin/appli_gen.py index e6d035518..872fdd7f0 100644 --- a/bin/appli_gen.py +++ b/bin/appli_gen.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -253,7 +254,7 @@ def install(prefix,config_file,verbose=0): command=""" - + """ diff --git a/bin/appli_install.sh b/bin/appli_install.sh index e587c1251..68e505a73 100644 --- a/bin/appli_install.sh +++ b/bin/appli_install.sh @@ -58,7 +58,7 @@ fi VERSION=V3_2_0 -for module in KERNEL MED GUI GEOM SMESH VISU SUPERV LIGHT NETGENPLUGIN PYCALCULATOR; +for module in KERNEL MED GUI GEOM SMESH VISU LIGHT NETGENPLUGIN PYCALCULATOR; do echo " ========= " ${module}; python virtual_salome.py -v --prefix="." --module=$INSTALL_ROOT/${module}_${VERSION} diff --git a/bin/appliskel/SalomeApp.xml b/bin/appliskel/SalomeApp.xml index 7caea4e03..267d9272e 100644 --- a/bin/appliskel/SalomeApp.xml +++ b/bin/appliskel/SalomeApp.xml @@ -16,7 +16,7 @@ - + @@ -39,7 +39,6 @@ - @@ -62,10 +61,6 @@ -
- - -
diff --git a/bin/appliskel/env.d/envSalome.sh b/bin/appliskel/env.d/envSalome.sh index e85232ef1..b97e88343 100644 --- a/bin/appliskel/env.d/envSalome.sh +++ b/bin/appliskel/env.d/envSalome.sh @@ -35,7 +35,6 @@ export SalomeAppConfig=${HOME}/${APPLI} export GEOM_ROOT_DIR=${REPINST}/GEOM_V301 export MED_ROOT_DIR=${REPINST}/MED_V301 export SMESH_ROOT_DIR=${REPINST}/SMESH_V301 -export SUPERV_ROOT_DIR=${REPINST}/SUPERV_V301 export VISU_ROOT_DIR=${REPINST}/VISU_V301 export NETGENPLUGIN_ROOT_DIR=${REPINST}/NETGENPLUGIN_V301 export COMPONENT_ROOT_DIR=${REPINST}/COMPONENT_V301 diff --git a/bin/appliskel/getAppliPath.py b/bin/appliskel/getAppliPath.py index 488ea674b..d946c57ec 100755 --- a/bin/appliskel/getAppliPath.py +++ b/bin/appliskel/getAppliPath.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/appliskel/runSession b/bin/appliskel/runSession index 716fbe6d9..ba6019c79 100755 --- a/bin/appliskel/runSession +++ b/bin/appliskel/runSession @@ -28,6 +28,39 @@ APPLI_HOME=`dirname $0` +NSPORT=last +NSHOST=localhost + +usage() +{ + echo "Connect to a SALOME session (local or remote)" + echo "" + echo "Usage: $(basename $0) [ -p PORT ] [ -m MACHINE ] [ -h ] [command]" + echo "" + echo " -p PORT : The port to connect to " + echo " -m MACHINE : The machine to connect to " + echo " -h : Print this message" + echo " command : The command to execute in the SALOME session" + echo "" + echo "If the command is not given a shell is opened" + echo "If PORT and MACHINE are not given, try to connect to the last active session on the local machine" + echo "If PORT and MACHINE are given, try to connect to the remote session associated with PORT on MACHINE" + echo "If MACHINE is not given, try to connect to the session associated to PORT on the local machine" + echo "If PORT is not given, try to connect to the remote session associated to port 2810 on MACHINE" + echo "" +} + +while getopts 'm:p:h' OPTION + do + case $OPTION in + m)NSHOST="$OPTARG" ;; + p)NSPORT="$OPTARG" ;; + h|?) usage + exit 1 ;; + esac + done +shift $(($OPTIND - 1)) + # --- retrieve APPLI path, relative to $HOME, set ${APPLI} export APPLI=`${APPLI_HOME}/getAppliPath.py` @@ -36,32 +69,47 @@ export APPLI=`${APPLI_HOME}/getAppliPath.py` . ${HOME}/${APPLI}/envd ${HOME}/${APPLI} -if test "x$1" == "xNSPORT"; then - NSPORT=$2 - export NSPORT - myhost=`hostname` - OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${myhost}_${NSPORT}.cfg - export OMNIORB_CONFIG - NSHOST=${myhost} - export NSHOST - shift 2 -else - - # --- set omniORB configuration to current session if any - - fileOmniConfig=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg - - if [ -f $fileOmniConfig ]; then - OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg +if test "x${NSPORT}" == "xlast"; then + #PORT is not given + if test "x${NSHOST}" == "xlocalhost"; then + #MACHINE and PORT are not given + # --- set omniORB configuration to current session if any + fileOmniConfig=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg + if [ -f $fileOmniConfig ]; then + OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg + export OMNIORB_CONFIG + # --- set environment variables for port and hostname of NamingService + NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host` + NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port` + export NSPORT + export NSHOST + fi + else + #MACHINE is given PORT is not given + NSPORT=2810 + OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${NSHOST}_${NSPORT}.cfg export OMNIORB_CONFIG - - # --- set environment variables for port and hostname of NamingService - - NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host` - export NSHOST - NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port` + #if omniorb config file exists do not override (perhaps too conservative) + if [ ! -f ${OMNIORB_CONFIG} ]; then + echo "InitRef = NameService=corbaname::${NSHOST}:${NSPORT}" > ${OMNIORB_CONFIG} + fi export NSPORT + export NSHOST + fi +else + #PORT is given + if test "x${NSHOST}" == "xlocalhost"; then + #MACHINE is not given PORT is given + NSHOST=`hostname` + fi + OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${NSHOST}_${NSPORT}.cfg + export OMNIORB_CONFIG + #if omniorb config file exists do not override (perhaps too conservative) + if [ ! -f ${OMNIORB_CONFIG} ]; then + echo "InitRef = NameService=corbaname::${NSHOST}:${NSPORT}" > ${OMNIORB_CONFIG} fi + export NSPORT + export NSHOST fi # --- invoke shell with or without args diff --git a/bin/envSalome.py b/bin/envSalome.py index 348c0a460..bac107658 100755 --- a/bin/envSalome.py +++ b/bin/envSalome.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -42,4 +43,11 @@ sys.argv = argv[1:] #runSalome.set_env(args, modules_list, modules_root_dir) setenv.main(True); +if sys.platform == "win32": + if len(argv) >= 2: + # Fix a problem of spaces in argv[1] + argv[1] = '"%s"'%(argv[1]) + pass + pass + os.execvp(argv[0],argv) diff --git a/bin/killSalome.py b/bin/killSalome.py index 381f3f710..7b66e0bb7 100755 --- a/bin/killSalome.py +++ b/bin/killSalome.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/killSalomeWithPort.py b/bin/killSalomeWithPort.py index fcdea4ec4..0f90aca3a 100755 --- a/bin/killSalomeWithPort.py +++ b/bin/killSalomeWithPort.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 87630757e..65e3fb2d8 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -56,6 +57,8 @@ batch_nam = "batch" test_nam = "test" play_nam = "play" gdb_session_nam = "gdb_session" +ddd_session_nam = "ddd_session" +shutdown_servers_nam = "shutdown_servers" # values in XML configuration file giving specific module parameters ( section) # which are stored in opts with key _ (eg SMESH_plugins) @@ -69,11 +72,11 @@ 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"] +standalone_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "pyContainer"] # values of boolean type (must be '0' or '1'). # xml_parser.boolValue() is used for correct setting -boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam, pinter_nam ) +boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam, pinter_nam, shutdown_servers_nam ) intKeys = ( interp_nam, ) # values of list type @@ -451,7 +454,9 @@ def CreateOptionParser (theAdditionalOptions=[]): 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" + help_str += "otherwise in an external python interpreter. " + help_str += "Note: this option is obsolete. Instead you can pass Python script(s) " + help_str += "directly as positional parameter." o_u = optparse.Option("-u", "--execute", metavar="", @@ -625,6 +630,26 @@ def CreateOptionParser (theAdditionalOptions=[]): dest="gdb_session", default=False, help=help_str) + # ddd session + help_str = "Launch session with ddd" + o_ddd = optparse.Option("--ddd-session", + action="store_true", + dest="ddd_session", default=False, + help=help_str) + + # shutdown-servers. Default: False. + help_str = "1 to shutdown standalone servers when leaving python interpreter, " + help_str += "0 to keep the standalone servers as daemon [default]. " + help_str += "This option is only useful in batchmode " + help_str += "(terminal mode or without showing desktop)." + o_shutdown = optparse.Option("--shutdown-servers", + metavar="<1/0>", + #type="choice", choices=boolean_choices, + type="string", + action="callback", callback=store_boolean, callback_args=('shutdown_servers',), + dest="shutdown_servers", + help=help_str) + # All options opt_list = [o_t,o_g, # GUI/Terminal o_d,o_o, # Desktop @@ -647,7 +672,10 @@ def CreateOptionParser (theAdditionalOptions=[]): o_nspl, o_test, # Write/read test script file with help of TestRecorder o_play, # Reproducing test script with help of TestRecorder - o_gdb] + o_gdb, + o_ddd, + o_shutdown, + ] #std_options = ["gui", "desktop", "log_file", "py_scripts", "resources", # "xterm", "modules", "embedded", "standalone", @@ -656,7 +684,7 @@ def CreateOptionParser (theAdditionalOptions=[]): opt_list += theAdditionalOptions - a_usage = "%prog [options] [STUDY_FILE]" + a_usage = "%prog [options] [STUDY_FILE] [PYTHON_FILE [PYTHON_FILE ...]]" version_str = "Salome %s" % version() pars = optparse.OptionParser(usage=a_usage, version=version_str, option_list=opt_list) @@ -851,8 +879,6 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): 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 @@ -874,6 +900,13 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): listlist = cmd_opts.py_scripts for listi in listlist: args[script_nam] += re.split( "[:;,]", listi) + for arg in cmd_args: + if arg[-3:] == ".py": + args[script_nam].append(arg) + elif not args["study_hdf"]: + args["study_hdf"] = arg + pass + pass # xterm if cmd_opts.xterm is not None: args[xterm_nam] = cmd_opts.xterm @@ -931,6 +964,17 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): if cmd_opts.gdb_session is not None: args[gdb_session_nam] = cmd_opts.gdb_session + # Ddd session in xterm + if cmd_opts.ddd_session is not None: + args[ddd_session_nam] = cmd_opts.ddd_session + + # Shutdown servers + if cmd_opts.shutdown_servers is None: + args[shutdown_servers_nam] = 0 + else: + args[shutdown_servers_nam] = cmd_opts.shutdown_servers + pass + #################################################### # Add values to args for add_opt in theAdditionalOptions: diff --git a/bin/launchSalome.py b/bin/launchSalome.py index 8d8900cc1..0f4ae1bea 100755 --- a/bin/launchSalome.py +++ b/bin/launchSalome.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/nameserver.py b/bin/nameserver.py index 32fa88627..14db5bccf 100755 --- a/bin/nameserver.py +++ b/bin/nameserver.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -63,14 +64,6 @@ class NamingServer(Server): #print "Can't create " + upath pass - #os.system("touch " + upath + "/dummy") - for fname in os.listdir(upath): - try: - if not fname.startswith("."): os.remove(upath + "/" + fname) - except: - pass - #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log") - if verbose(): print "Name Service... ", #hname=os.environ["HOST"] #commands.getoutput("hostname") if sys.platform == "win32": @@ -89,6 +82,27 @@ class NamingServer(Server): #aPort=(ss.join().split(':'))[2]; #aPort=re.findall("\d+", ss[0])[0] + # \begin{E.A.} + # put the log files of omniNames in different directory with port reference, + # it is cleaner on linux and it is a fix for salome since it is impossible to + # remove the log files if the corresponding omniNames has not been killed. + # \end{E.A.} + + upath += "/omniNames_%s"%(aPort) + 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") + #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/" #print "sed command = ", aSedCommand #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"]) diff --git a/bin/orbmodule.py b/bin/orbmodule.py index d9aa08d7a..8bcd95aa0 100755 --- a/bin/orbmodule.py +++ b/bin/orbmodule.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -127,13 +128,13 @@ class client: # -------------------------------------------------------------------------- - def waitNS(self,name,typobj=None,maxcount=60): + def waitNS(self,name,typobj=None,maxcount=240): count=0 delta=0.5 print "Searching %s in Naming Service " % name, while(1): count += 1 - if count > maxcount : raise "Impossible de trouver %s" % name + if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name obj=self.Resolve(name) if obj : print " found in %s seconds " % ((count-1)*delta) @@ -160,7 +161,7 @@ class client: try: os.kill(thePID,0) except: - raise "Process %d for %s not found" % (thePID,theName) + raise RuntimeError, "Process %d for %s not found" % (thePID,theName) aCount += 1 anObj = self.Resolve(theName) if anObj: @@ -208,7 +209,7 @@ class client: print "Searching %s in Naming Service " % name, while(1): count += 1 - if count > maxcount : raise "Impossible de trouver %s" % name + if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name obj=self.ResolveLogger(name) if obj : print " found in %s seconds " % ((count-1)*delta) diff --git a/bin/runNS.py b/bin/runNS.py index 2135ec1f5..0c8ec5acf 100755 --- a/bin/runNS.py +++ b/bin/runNS.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/runSalome b/bin/runSalome index b56fbc634..dba8a38de 100755 --- a/bin/runSalome +++ b/bin/runSalome @@ -32,7 +32,7 @@ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/ # - if the config file does not exist, it is created with default values. # # -# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,SUPERV,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer,supervContainer --xterm --killall +# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer --xterm --killall # # parameters from command line supersede those from SalomeApp.xml # @@ -40,7 +40,7 @@ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/ # (embedded = same process) or in a separate process (standalone): # --> registry,study,moduleCatalog,cppContainer # Other CORBA servers could only be launched in separate process (standalone): -# --> pyContainer,supervContainer +# --> pyContainer # # $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h # help diff --git a/bin/runSalome.bat b/bin/runSalome.bat new file mode 100644 index 000000000..127ca4b92 --- /dev/null +++ b/bin/runSalome.bat @@ -0,0 +1,23 @@ +@REM Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +@REM +@REM Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +@REM CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +@REM +@REM This library is free software; you can redistribute it and/or +@REM modify it under the terms of the GNU Lesser General Public +@REM License as published by the Free Software Foundation; either +@REM version 2.1 of the License. +@REM +@REM This library is distributed in the hope that it will be useful, +@REM but WITHOUT ANY WARRANTY; without even the implied warranty of +@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +@REM Lesser General Public License for more details. +@REM +@REM You should have received a copy of the GNU Lesser General Public +@REM License along with this library; if not, write to the Free Software +@REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +@REM +@REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +@REM + +@"%PYTHONBIN%" "%KERNEL_ROOT_DIR%\bin\salome\envSalome.py" "%PYTHONBIN%" "%KERNEL_ROOT_DIR%\bin\salome\runSalome.py" %* diff --git a/bin/runSalome.csh b/bin/runSalome.csh index e88c3fe6c..7a76d17e8 100755 --- a/bin/runSalome.csh +++ b/bin/runSalome.csh @@ -22,4 +22,4 @@ # -runSalome --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --killall +runSalome --gui --modules=GEOM,SMESH,VISU,MED --killall diff --git a/bin/runSalome.ksh b/bin/runSalome.ksh index 58d0edef6..719fb0576 100644 --- a/bin/runSalome.ksh +++ b/bin/runSalome.ksh @@ -75,7 +75,7 @@ fi # - if the config file does not exist, it is created with default values. # # -# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,SUPERV,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer,supervContainer --xterm --killall +# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer --xterm --killall # # parameters from command line supersede those from SalomeApp.xml # @@ -83,7 +83,7 @@ fi # (embedded = same process) or in a separate process (standalone): # --> registry,study,moduleCatalog,cppContainer # Other CORBA servers could only be launched in separate process (standalone): -# --> pyContainer,supervContainer +# --> pyContainer # # $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h # help @@ -96,4 +96,4 @@ fi # # ----------------------------------------------------------------------------- # Example on CCRT (without ihm) : -# ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --terminal --modules=MED,CALCULATOR,COMPONENT --standalone=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer --killall +# ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --terminal --modules=MED,CALCULATOR,COMPONENT --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall diff --git a/bin/runSalome.py b/bin/runSalome.py index f5b95927f..d67d6b057 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -30,7 +31,7 @@ import orbmodule import setenv from server import * from launchConfigureParser import verbose -#process_id = {} move to server.py +from server import process_id # ----------------------------------------------------------------------------- @@ -80,7 +81,7 @@ def kill_salome(args): # ----------------------------------------------------------------------------- # -# Definition des classes d'objets pour le lancement des Server CORBA +# Class definitions to launch CORBA Servers # class InterpServer(Server): @@ -88,7 +89,6 @@ class InterpServer(Server): self.args=args env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("LD_LIBRARY_PATH")] self.CMD=['xterm', '-e']+ env_ld_library_path + ['python'] - #self.CMD=['xterm', '-e', 'python'] def run(self): global process_id @@ -195,17 +195,6 @@ class ContainerPYServer(Server): # --- -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'] - -# --- - class LoggerServer(Server): def __init__(self,args): self.args=args @@ -258,8 +247,6 @@ 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['standalone']: - self.SCMD2+=['SUPERV'] if self.args['gui']: session_gui = True if self.args.has_key('session_gui'): @@ -320,7 +307,7 @@ class SessionServer(Server): elif self.args.has_key('play'): self.CMD+=['-play'] + self.args['play'] - if self.args["gdb_session"]: + if self.args["gdb_session"] or self.args["ddd_session"]: f = open(".gdbinit4salome", "w") f.write("set args ") args = " ".join(self.CMD[1:]) @@ -329,7 +316,11 @@ class SessionServer(Server): f.write(args) f.write("\n") f.close() - self.CMD = ["xterm", "-e", "gdb", "--command=.gdbinit4salome", self.CMD[0]] + if self.args["ddd_session"]: + self.CMD = ["ddd", "--command=.gdbinit4salome", self.CMD[0]] + elif self.args["gdb_session"]: + self.CMD = ["xterm", "-e", "gdb", "--command=.gdbinit4salome", self.CMD[0]] + pass pass # --- @@ -407,9 +398,6 @@ def startGUI(): import SALOME import SALOMEDS import SALOME_ModuleCatalog - reload(Engines) - reload(SALOME) - reload(SALOMEDS) import SALOME_Session_idl session=clt.waitNS("/Kernel/Session",SALOME.Session) session.GetInterface() @@ -423,7 +411,7 @@ def startSalome(args, modules_list, modules_root_dir): if verbose(): print "startSalome ", args # - # Initialisation ORB et Naming Service + # Initialisation ORB and Naming Service # clt=orbmodule.client(args) @@ -440,8 +428,8 @@ def startSalome(args, modules_list, modules_root_dir): f.write(os.environ['NSPORT']) f.close() - # (non obligatoire) Lancement Logger Server - # et attente de sa disponibilite dans le naming service + # Launch Logger Server (optional) + # and wait until it is registered in naming service # if args['logger']: @@ -458,7 +446,7 @@ def startSalome(args, modules_list, modules_root_dir): myServer=NotifyServer(args,modules_root_dir) myServer.run() - # Lancement Session Server (to show splash ASAP) + # Launch Session Server (to show splash ASAP) # if args["gui"]: @@ -467,8 +455,8 @@ def startSalome(args, modules_list, modules_root_dir): mySessionServ.run() # - # Lancement Registry Server, - # attente de la disponibilite du Registry dans le Naming Service + # Launch Registry Server, + # and wait until it is registered in naming service # if ('registry' not in args['embedded']) | (args["gui"] == 0) : @@ -480,10 +468,9 @@ def startSalome(args, modules_list, modules_root_dir): clt.waitNSPID("/Registry",myServer.PID) # - # Lancement Catalog Server, - # attente de la disponibilite du Catalog Server dans le Naming Service + # Launch Catalog Server, + # and wait until it is registered in naming service # - if ('moduleCatalog' not in args['embedded']) | (args["gui"] == 0): cataServer=CatalogServer(args) @@ -496,8 +483,8 @@ def startSalome(args, modules_list, modules_root_dir): clt.waitNSPID("/Kernel/ModulCatalog",cataServer.PID,SALOME_ModuleCatalog.ModuleCatalog) # - # Lancement SalomeDS Server, - # attente de la disponibilite du SalomeDS dans le Naming Service + # Launch SalomeDS Server, + # and wait until it is registered in naming service # #print "ARGS = ",args @@ -511,7 +498,7 @@ def startSalome(args, modules_list, modules_root_dir): clt.waitNSPID("/myStudyManager",myServer.PID) # - # Lancement LauncherServer + # Launch LauncherServer # myCmServer = LauncherServer(args) @@ -537,8 +524,8 @@ def startSalome(args, modules_list, modules_root_dir): theComputer = getShortHostName() # - # Lancement Container C++ local, - # attente de la disponibilite du Container C++ local dans le Naming Service + # Launch local C++ Container (FactoryServer), + # and wait until it is registered in naming service # if ('cppContainer' in args['standalone']) | (args["gui"] == 0) : @@ -550,9 +537,8 @@ def startSalome(args, modules_list, modules_root_dir): clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",myServer.PID) # - # Lancement Container Python local, - # attente de la disponibilite du Container Python local - # dans le Naming Service + # Launch local Python Container (FactoryServerPy), + # and wait until it is registered in naming service # if 'pyContainer' in args['standalone']: @@ -564,21 +550,7 @@ def startSalome(args, modules_list, modules_root_dir): clt.waitNSPID("/Containers/" + theComputer + "/FactoryServerPy",myServer.PID) # - # Lancement Container Supervision local, - # attente de la disponibilite du Container Supervision local - # dans le Naming Service - # - - if 'supervContainer' in args['standalone']: - myServer=ContainerSUPERVServer(args) - myServer.run() - 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 + # Wait until Session Server is registered in naming service # if args["gui"]: @@ -587,9 +559,6 @@ def startSalome(args, modules_list, modules_root_dir): import SALOME import SALOMEDS import SALOME_ModuleCatalog - reload(Engines) - reload(SALOME) - reload(SALOMEDS) import SALOME_Session_idl if sys.platform == "win32": session=clt.waitNS("/Kernel/Session",SALOME.Session) @@ -626,7 +595,7 @@ def startSalome(args, modules_list, modules_root_dir): anInterp=InterpServer(args) anInterp.run() - # set PYTHONINSPECT variable + # set PYTHONINSPECT variable (python interpreter in interactive mode) if args['pinter']: os.environ["PYTHONINSPECT"]="1" import readline @@ -678,7 +647,7 @@ def useSalome(args, modules_list, modules_root_dir): """%filedict # - # Impression arborescence Naming Service + # Print Naming Service directory list # if clt != None: @@ -688,6 +657,22 @@ def useSalome(args, modules_list, modules_root_dir): clt.showNS() pass + if not args['gui'] or not args['session_gui']: + if args['shutdown_servers']: + class __utils__(object): + def __init__(self, port): + self.port = port + import killSalomeWithPort + self.killSalomeWithPort = killSalomeWithPort + return + def __del__(self): + self.killSalomeWithPort.killMyPort(self.port) + return + pass + args['shutdown_servers'] = __utils__(args['port']) + pass + pass + # run python scripts, passed via --execute option toimport = [] if args.has_key('pyscript'): @@ -699,13 +684,14 @@ def useSalome(args, modules_list, modules_root_dir): 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 + sys.path.insert( 0, os.path.dirname(scrname)) execfile(scrname,globals()) + del sys.path[0] else: print 'importing',scrname doimport = 'import ' + scrname @@ -752,7 +738,7 @@ def searchFreePort(args, save_config=1): os.remove( tmp_file ); # def portIsUsed(port, data): - regObj = re.compile( "tcp.*:([0-9]+).*:.*listen", re.IGNORECASE ); + regObj = re.compile( ".*tcp.*:([0-9]+).*:.*listen", re.IGNORECASE ); for item in data: try: p = int(regObj.match(item).group(1)) @@ -834,7 +820,7 @@ def searchFreePort(args, save_config=1): 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 + raise RuntimeError, msg NSPORT=NSPORT+1 pass return @@ -856,7 +842,6 @@ def no_main(): def main(): """Salome launch as a main application""" - import sys from salome_utils import getHostName print "runSalome running on %s" % getHostName() args, modules_list, modules_root_dir = setenv.get_config() diff --git a/bin/salome.launch b/bin/salome.launch index 1b5bbdd1b..5c71df7ef 100644 --- a/bin/salome.launch +++ b/bin/salome.launch @@ -13,7 +13,6 @@ - @@ -26,6 +25,5 @@ pyContainer - supervContainer diff --git a/bin/salomeConsole.py b/bin/salomeConsole.py index 56c805c14..1c728734f 100755 --- a/bin/salomeConsole.py +++ b/bin/salomeConsole.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/salome_session.py b/bin/salome_session.py index be227c89f..59e09142d 100644 --- a/bin/salome_session.py +++ b/bin/salome_session.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -96,7 +97,7 @@ def searchFreePort(): msg = "" msg += "Can not find a free port to launch omniNames\n" msg += "Kill the running servers and try again.\n" - raise msg + raise RuntimeError, msg NSPORT = NSPORT+1 pass os.environ['NSHOST'] = hostname diff --git a/bin/salome_utils.py b/bin/salome_utils.py index 61d609273..d6b0493da 100644 --- a/bin/salome_utils.py +++ b/bin/salome_utils.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -183,12 +184,12 @@ def getAppName(): # --- -def getPortNumber(): +def getPortNumber(use_default=True): """ Get current naming server port number: 1. try NSPORT environment variable 1. if fails, try to parse config file defined by OMNIORB_CONFIG environment variable - 2. if fails, return 2809 as default port number + 2. if fails, return 2809 as default port number (if use_default is True) or None (id use_default is False) """ import os try: @@ -197,7 +198,8 @@ def getPortNumber(): pass port = getPortFromORBcfg() if port is not None: return port - return 2809 # '2809' is default port number + if use_default: return 2809 # '2809' is default port number + return None # --- @@ -351,22 +353,40 @@ def generateFileName( dir, prefix = None, suffix = None, extension = None, # --- -def makeTmpDir( path ): +def makeTmpDir( path, mode=0777 ): """ Make temporary directory with the specified path. If the directory exists then clear its contents. Parameters: - path : absolute path to the directory to be created. + - mode : access mode """ import os - if os.path.exists( path ): - os.system( "rm -rf " + path + "/*" ) + import sys + if sys.platform == "win32": + os.system( "rmdir /S /Q " + '"' + path + '"' ) + os.system( "mkdir " + '"' + path + '"' ) + else: + os.system( "rm -rf " + path + "/*" ) + pass pass else: - os.makedirs( path, 0777 ) - pass + dirs = path.split("/") + shift1 = shift2 = 0 + if not dirs[0]: shift1 = 1 + if dirs[-1]: shift2 = 1 + for i in range(1+shift1,len(dirs)+shift2): + p = "/".join(dirs[:i]) + try: + os.mkdir(p, mode) + os.chmod(p, mode) + except: + pass + pass + pass + pass # --- @@ -399,10 +419,20 @@ def uniteFiles( src_file, dest_file ): dest.writelines( dest_lines ) dest.close() - command = "cat " + src_file + " >> " + dest_file + import sys + if sys.platform == "win32": + command = "type " + '"' + src_file + '"' + " >> " + '"' + dest_file + '"' + else: + command = "cat " + src_file + " >> " + dest_file + pass pass else: - command = "cp " + src_file + " " + dest_file + import sys + if sys.platform == "win32": + command = "copy " + '"' + src_file + '"' + " " + '"' + dest_file + '"' + " > nul" + else: + command = "cp " + src_file + " " + dest_file + pass pass os.system( command ) diff --git a/bin/server.py b/bin/server.py index a5588c6b6..53d0fe72f 100755 --- a/bin/server.py +++ b/bin/server.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/setenv.py b/bin/setenv.py index cde2e1165..19077278b 100755 --- a/bin/setenv.py +++ b/bin/setenv.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -142,10 +143,6 @@ def get_config(silent=False): 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 # ----------------------------------------------------------------------------- @@ -154,12 +151,15 @@ def set_env(args, modules_list, modules_root_dir, silent=False): """Add to the PATH-variables modules specific paths""" import os - from salome_utils import getTmpDir, generateFileName, makeTmpDir + from salome_utils import getTmpDir, generateFileName, makeTmpDir, getPortNumber # create temporary directory for environment files needed by modules from the list - tmp_dir = getTmpDir() - env_dir = generateFileName(tmp_dir, prefix="env", with_port=True) - makeTmpDir(env_dir) + port = getPortNumber(False) + if port: + tmp_dir = getTmpDir() + env_dir = generateFileName(tmp_dir, prefix="env", with_port=True) + makeTmpDir(env_dir) + pass python_version="python%d.%d" % sys.version_info[0:2] modules_root_dir_list = [] @@ -198,13 +198,15 @@ def set_env(args, modules_list, modules_root_dir, silent=False): salome_subdir, "shared_modules"), "PYTHONPATH") - + # set environment by modules from the list - try: - mod=__import__(module.lower()+"_setenv") - mod.set_env(args) - pass - except: + if port: + try: + mod=__import__(module.lower()+"_setenv") + mod.set_env(args) + pass + except: + pass pass pass pass @@ -223,12 +225,7 @@ def set_env(args, modules_list, modules_root_dir, silent=False): if args['logger']: os.environ["SALOME_trace"]="with_logger" - # 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", diff --git a/bin/showNS.py b/bin/showNS.py index 7f4a0ba01..049b30321 100755 --- a/bin/showNS.py +++ b/bin/showNS.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/shutdownSalome.py b/bin/shutdownSalome.py index 3746788e9..a7826c464 100755 --- a/bin/shutdownSalome.py +++ b/bin/shutdownSalome.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/virtual_salome.py b/bin/virtual_salome.py index 971ab8c39..93e5e53e8 100644 --- a/bin/virtual_salome.py +++ b/bin/virtual_salome.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/waitContainers.py b/bin/waitContainers.py index ebc94e097..ceb444cb8 100755 --- a/bin/waitContainers.py +++ b/bin/waitContainers.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/bin/waitNS.py b/bin/waitNS.py index 576df3c79..5d392482a 100755 --- a/bin/waitNS.py +++ b/bin/waitNS.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/configure.ac b/configure.ac index ad2b9503c..f6439a26b 100644 --- a/configure.ac +++ b/configure.ac @@ -24,14 +24,14 @@ # ================================================================ #AC_PREREQ(2.59) # -AC_INIT([Salome2 Project], [5.1.1], [paul.rascle@edf.fr], [SalomeKERNEL]) +AC_INIT([Salome2 Project], [5.1.3], [paul.rascle@edf.fr], [SalomeKERNEL]) # 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([tar-pax]) +AM_INIT_AUTOMAKE([tar-pax -Wno-portability]) #AC_CONFIG_HEADER([config.h]) XVERSION=`echo $VERSION | awk -F. '{printf("0x%02x%02x%02x",$1,$2,$3)}'` @@ -86,11 +86,15 @@ AC_ARG_ENABLE(corba_gen, esac],[corba_gen=true]) AM_CONDITIONAL(CORBA_GEN, test x$corba_gen = xtrue) -# ---- option to build only launcher, resources manager and batch classes +# ---- option to build only launcher and resources manager AC_ARG_WITH(onlylauncher, - --with-onlylauncher, - [],[with_onlylauncher="no"]) + [AC_HELP_STRING([--with-onlylauncher],[Build only launcher and resources manager [default=no]])], + [], + [with_onlylauncher="no"]) AM_CONDITIONAL(WITHONLYLAUNCHER, test x$with_onlylauncher = xyes) +if test "$with_onlylauncher" != "yes"; then + AC_DEFINE([HAVE_SALOME_CONFIG], [], [True if SALOMEconfig.h file is used]) +fi # ---------------------------------------------------------------------------- @@ -117,6 +121,7 @@ echo --------------------------------------------- echo AC_PROG_MAKE_SET AC_PROG_INSTALL +AC_LOCAL_INSTALL echo echo --------------------------------------------- @@ -149,6 +154,7 @@ echo cc_ok=no AC_PROG_CC AC_PROG_CXX +AC_LANG(C++) AC_CXX_WARNINGS AC_CXX_TEMPLATE_OPTIONS AC_DEPEND_FLAG @@ -173,6 +179,14 @@ AC_CXX_HAVE_SSTREAM # Testing linker AC_LINKER_OPTIONS +echo +echo --------------------------------------------- +echo testing Fortran INTEGER size for CALCIUM +echo --------------------------------------------- +echo + +CHECK_CALCIUM + echo echo --------------------------------------------- echo testing threads @@ -336,53 +350,6 @@ echo testing optionnal products echo ============================================================ echo -echo -echo --------------------------------------------- -echo Testing Batch -echo --------------------------------------------- -echo - -dnl Several batch systems (OpenPBS, LSF, ...) can be operated using -dnl the Batch classes library integrated in the KERNEL module. The -dnl checking process tests here the presence of underlying batch -dnl softwares. If none is detected, the KERNEL is declared to be -dnl "without batch". - -echo testing OpenPBS -echo --------------- -openpbs_ok=no -CHECK_OPENPBS -dnl openpbs_ok is set to yes by CHECK_OPENPBS - -echo testing LSF -echo ----------- -lsf_ok=no -CHECK_LSF -dnl lsf_ok is set to yes by CHECK_LSF -echo lsf = $lsf_ok - -echo testing Local batch system -echo -------------------------- -localbatch_ok=no -CHECK_LOCAL -dnl localbatch_ok is set to yes by CHECK_LOCAL - -WITH_BATCH=no -test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes - -AC_ARG_ENABLE(batch, - [AC_HELP_STRING([--enable-batch],[Batch [default=yes]])], - [case "${enableval}" in - yes) test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes;; - no) WITH_BATCH=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-batch) ;; - esac],[test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes]) - -echo Batch mode = $WITH_BATCH - -AC_SUBST(WITH_BATCH) -AM_CONDITIONAL(WITH_BATCH, [test x"$WITH_BATCH" = xyes]) - echo echo ---------------------------------------------- echo testing CPPUNIT only required for unit testing @@ -390,6 +357,15 @@ echo ---------------------------------------------- echo CHECK_CPPUNIT +echo +echo -------------------------------------------------------------- +echo Testing libBatch only required for batch functions in Launcher +echo -------------------------------------------------------------- +echo + +CHECK_LIBBATCH +AM_CONDITIONAL(WITH_LIBBATCH, [test x"$libbatch_ok" = xyes]) + echo echo ============================================================ echo testing products required only for documentation generation @@ -405,7 +381,7 @@ echo CHECK_HTML_GENERATORS # Additional conditional to avoid compilation of non-portable code -AM_CONDITIONAL(WINDOWS, 0) +AM_CONDITIONAL(WINDOWS, [ test ]) echo echo ============================================================ @@ -466,13 +442,6 @@ if test x$with_onlylauncher = xno; then check_fatal_error $corba_mandatory_products else echo --- CORBA products not required - option --disable-corba-gen - if test x"$WITH_BATCH" = xyes; then - echo --- BATCH mode mandatory products - default configuration: - summary "python_ok" - check_fatal_error "python_ok" - else - echo --- Python not required - option --enable-batch=no - fi fi fi echo @@ -482,12 +451,17 @@ echo --- Kernel parallel extensions: summary $parallel_products echo -optional_products="cppunit_ok openpbs_ok lsf_ok numpy_ok" +optional_products="cppunit_ok numpy_ok libbatch_ok" echo --- Optional products: echo [" These products are optional because the KERNEL functions"] echo [" using them are built only if the products are detected."] summary $optional_products echo +if test x$libbatch_ok = xno; then + echo [" Warning: Batch functions will not be available in"] + echo [" Salome Launcher because they require libBatch."] + echo +fi htmldoc_products="doxygen_ok graphviz_ok rst2html_ok" @@ -529,78 +503,80 @@ echo # autoscan, the Makefile list is generated in the output file configure.scan. # This could be helpfull to update de configuration. AC_OUTPUT([ \ - ./KERNEL_version.h \ - ./salome_adm/unix/SALOMEconfig.ref \ - ./salome_adm/Makefile \ - ./salome_adm/cmake_files/Makefile \ - ./salome_adm/unix/Makefile \ - ./salome_adm/unix/config_files/Makefile \ - Makefile \ - ./bin/Makefile \ - ./bin/VERSION \ - ./doc/Makefile \ - ./doc/salome/Makefile \ - ./doc/salome/tui/Makefile \ - ./doc/salome/tui/doxyfile \ - ./doc/salome/gui/Makefile \ - ./doc/salome/gui/doxyfile \ - ./idl/Makefile \ - ./resources/Makefile \ - ./resources/KERNELCatalog.xml \ - ./resources/CatalogResources.xml \ - ./src/Makefile \ - ./src/Basics/Makefile \ - ./src/Basics/Test/Makefile \ - ./src/Batch/Makefile \ - ./src/Batch_SWIG/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 \ - ./src/LifeCycleCORBA_SWIG/Test/Makefile \ - ./src/Logger/Makefile \ - ./src/Logger/Test/Makefile \ - ./src/ModuleCatalog/Makefile \ - ./src/ModuleGenerator/Makefile \ - ./src/ModuleGenerator/testIDLparser \ - ./src/MPIContainer/Makefile \ - ./src/NamingService/Makefile \ - ./src/NamingService/Test/Makefile \ - ./src/Notification/Makefile \ - ./src/NOTIFICATION_SWIG/Makefile \ - ./src/Registry/Makefile \ - ./src/ResourcesManager/Makefile \ - ./src/SALOMEDS/Makefile \ - ./src/SALOMEDS/Test/Makefile \ - ./src/SALOMEDSClient/Makefile \ - ./src/SALOMEDSImpl/Makefile \ - ./src/SALOMEDSImpl/Test/Makefile \ - ./src/SALOMELocalTrace/Makefile \ - ./src/SALOMELocalTrace/Test/Makefile \ - ./src/SALOMETraceCollector/Makefile \ - ./src/SALOMETraceCollector/Test/Makefile \ - ./src/TestContainer/Makefile \ - ./src/TestMPIContainer/Makefile \ - ./src/TOOLSDS/Makefile \ - ./src/UnitTests/Makefile \ - ./src/Utils/Makefile \ - ./src/Utils/Test/Makefile \ + KERNEL_version.h \ + salome_adm/unix/SALOMEconfig.ref \ + salome_adm/Makefile \ + salome_adm/cmake_files/Makefile \ + salome_adm/unix/Makefile \ + salome_adm/unix/config_files/Makefile \ + Makefile \ + bin/Makefile \ + bin/VERSION \ + doc/Makefile \ + doc/salome/Makefile \ + doc/salome/tui/Makefile \ + doc/salome/tui/doxyfile \ + doc/salome/gui/Makefile \ + doc/salome/gui/doxyfile \ + idl/Makefile \ + idl/Calcium_Ports.idl \ + resources/Makefile \ + resources/KERNELCatalog.xml \ + resources/CatalogResources.xml \ + src/Makefile \ + src/Basics/Makefile \ + src/Basics/Test/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/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx \ + src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx \ + src/DSC/DSC_User/Datastream/Calcium/CalciumFortranInt.h \ + 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 \ + src/LifeCycleCORBA_SWIG/Test/Makefile \ + src/Logger/Makefile \ + src/Logger/Test/Makefile \ + src/ModuleCatalog/Makefile \ + src/ModuleGenerator/Makefile \ + src/ModuleGenerator/testIDLparser \ + src/MPIContainer/Makefile \ + src/NamingService/Makefile \ + src/NamingService/Test/Makefile \ + src/Notification/Makefile \ + src/NOTIFICATION_SWIG/Makefile \ + src/Registry/Makefile \ + src/ResourcesManager/Makefile \ + src/SALOMEDS/Makefile \ + src/SALOMEDS/Test/Makefile \ + src/SALOMEDSClient/Makefile \ + src/SALOMEDSImpl/Makefile \ + src/SALOMEDSImpl/Test/Makefile \ + src/SALOMELocalTrace/Makefile \ + src/SALOMELocalTrace/Test/Makefile \ + src/SALOMETraceCollector/Makefile \ + src/SALOMETraceCollector/Test/Makefile \ + src/TestContainer/Makefile \ + src/TestMPIContainer/Makefile \ + src/TOOLSDS/Makefile \ + src/UnitTests/Makefile \ + src/Utils/Makefile \ + src/Utils/Test/Makefile \ ]) diff --git a/doc/salome/Batch.texi b/doc/salome/Batch.texi deleted file mode 100755 index 817e5b996..000000000 --- a/doc/salome/Batch.texi +++ /dev/null @@ -1,4962 +0,0 @@ -\input texinfo @c -*-texinfo-*- -@c %**start of header -@setfilename Batch.info -@settitle Documentation de Batch -@setchapternewpage odd -@iftex -@afourpaper -@end iftex - -@include version.texi - -@dircategory Bibliotheque de classes Batch -@direntry -* Batch: (Batch); Documentation de la bibliotheque de classes Batch. -@end direntry - -@c %**end of header - - - -@titlepage -@sp 10 -@comment The title is printed in a large font. -@title Bibliotheque de classes Batch -@subtitle Documentation - version @value{VERSION} -@subtitle @value{UPDATED} -@author Ivan DUTKA-MALEN - EDF R&D - -@c The following two commands start the copyright page. -@page -@vskip 0pt plus 1filll -Copyright @copyright{} 2003-2004 EDF R&D sous licence GPL -@end titlepage - -@contents - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Top, Description, Index , (dir) -@comment node-name, next, previous, up -@ifinfo -Copyright @copyright{} 2003-2004 EDF R&D sous licence GPL -@end ifinfo - -@unnumbered Introduction - -Ceci est la documentation de la bibliotheque de classes Batch version -@value{VERSION}. - -Ce manuel est normalement disponible sous la forme de fichiers -@file{.info}, PostScript @file{.ps}, PDF @file{.pdf} et HTML -@file{.html}. Merci a Texinfo. - - -@menu -* Description:: Le batch, c'est quoi ? Ca sert a quoi ? -* Classes:: Une description des classes internes. -* Utilisation:: Comment on s'en sert ? Quelques exemples. -* Installation de la bibliotheque:: Comment ca s'installe ? -* Divers:: D'autres petits details. -* Index:: Index generaux. -@end menu - - - - - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Description, Classes, Top, Top -@comment node-name, next, previous, up -@chapter Description Generale -@cindex description - -Dans le domaine du batch, nombreux sont les gestionnaires qui sont -apparus et se sont popularises en fonction des plates-formes et des -constructeurs. On peut notamment citer NQS, le premier de tous, LSF, -LoadLeveler, PBS (et ses derives OpenPBS et PBS Pro), etc. qui se -prevalent tous d'une compatibilite avec NQS. - -Si l'ensemble de ces produits offrent les fonctionnalites de base de -NQS, a savoir soumission, controle, destruction, modification, etc. de -travaux batch, ils se distinguent tous par leur incompatibilite mutuelle -et par les syntaxes de fichiers et les appels de fonction specifiques -qu'ils ont developpes. - -Or il est interessant de pouvoir acceder d'une facon homogene et -generique aux fonctionnalites de ces gestionnaires quitte a se -restreindre a un sous-ensemble minimal mais essentiel de leurs -possibilites. - -La bibliotheque de classes Batch fournit ce moyen de soumettre et -controler des travaux batch depuis une machine cliente sans s'occuper du -type de gestionnaire present sur le serveur sur lequel se deroule -l'execution du travail. Seul doit etre precise le nom du serveur sur -lequel sera soumis le travail batch et le type de gestionnaire qui s'y -trouve. Tout le reste est generique et ne depend plus de l'implementation. - - - - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classes, Terminologie, Description, Top -@comment node-name, next, previous, up -@chapter Classes Internes -@cindex classe - -Les classes de la bibliotheque reposent sur des concepts issus du monde -de la gestion de batch, qui meritent d'etre reprecises pour ne pas -introduire d'ambiguite semantique dans le discours. - -@menu -* Terminologie:: Description des termes employes. -* Classes generiques:: Les classes communes a tous les gestionnaires. -* Classes specifiques:: Les classes d'implementation. -@end menu - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Terminologie, Batch, Classes, Classes -@comment node-name, next, previous, up -@section Terminologie -@cindex terminologie - -Pour les non-inities aux mysteres de la gestion de batch, un petit -glossaire des termes employes dans cette documentation, assaisonne a la -sauce de la bibliotheque de classes Batch. - -@menu -* Batch:: Gestion par lots, execution differee. -* BatchManager:: Gestionnaire de batch. -* Job:: Travail. -* Parametre:: Configuration de l'execution. -* Environnement:: Environnement d'execution. -* JobId:: Identifiant de travail. -* JobInfo:: Informations sur le travail. -@end menu - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Batch, BatchManager, Terminologie, Terminologie -@comment node-name, next, previous, up -@subsection Batch -@cindex batch - -Le traitement batch (batch processing en anglais), ou traitement par -lot, fait reference au mode de sequencage et d'utilisation des -ressources d'un calculateur tel qu'il a ete premierement employe dans -les debuts de l'ere informatique. Mais il faut preciser que cette -anteriorite ne condamne pas le traitement batch aux oubliettes au motif -d'une quelconque obsolescence. Si le traitement par lot a vu le jour et -existe encore aujourd'hui, c'est parce qu'il repond de maniere -satisfaisante a une certaine utilisation des ressources d'un -calculateur, et que cette utilisation est encore d'actualite. Present -depuis plus de quarante ans, le batch est encore largement utilise sur -les grands serveurs, et le sera vraisemblablement pour quelques annees -encore. - -Le traitement par lot se distingue de l'execution interactive par le -fait que les travaux a effectuer sont places dans une file d'attente -avec une indication pour chaque lot des ressources dont il doit disposer -pour aboutir correctement. Une fois les travaux inscrits dans la file, -c'est au systeme de traitement batch (@xref{BatchManager}.) de veiller a -leur bonne execution en leur fournissant les ressources demandees. Tout -travail qui ne disposerait pas des ressources adequates ne peut pas etre -active. - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node BatchManager, Job, Batch, Terminologie -@comment node-name, next, previous, up -@subsection Batch Manager -@cindex batch manager -@cindex gestionnaire - -Le role du gestionnaire de batch, ou batch manager en anglais, est -d'executer et eventuellement d'ordonner les travaux places en file -d'attente en leur allouant exclusivement les ressources necessaires a -leur execution. Son objectif est d'optimiser les ressources du systeme -dont il a la charge de maniere a ecouler le maximum de travaux en un -minimum de temps et un minimum de ressources materielles. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Job, Parametre, BatchManager, Terminologie -@comment node-name, next, previous, up -@subsection Job -@cindex Job -@cindex travail - -Le travail, ou job en anglais, est l'unite elementaire de traitement qui -peut etre soumis au gestionnaire de batch. Il peut s'agir d'une simple -commande systeme, comme d'une application ou bien meme de l'enchainement -complexe mais indivisible de plusieurs applications ou commandes. - -Pour s'executer correctement, c'est-a-dire sans erreur, le job doit -disposer de certaines ressources --- de la memoire, du temps, de -l'espace disque @dots{} --- pendant toute la duree de son -execution. C'est au gestionnaire de batch (@xref{BatchManager}.) de -garantir au job la presence et la persistence de ces ressources pendant -l'execution du job. - -Par contre c'est a l'utilisateur qui soumet le job d'informer le -gestionnaire de batch des ressources necessaires au job. Pour des -raisons evidentes de bonne gestion des ressources, le job ne peut -consommer plus de ressources que celles qu'il a demande et obtenu du -gestionnaire de batch sans etre arrete ou reclasse. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Parametre, Environnement, Job, Terminologie -@comment node-name, next, previous, up -@subsection Parametre -@cindex parametre - -Le premier type de ressource necessaire a un job concerne les elements -materiels ou temporels, en un mot, physiques. Parmi ces ressources, on -trouve le temps de calcul, le temps de presence en machine, l'espace -disque, la quantite de memoire vive, l'architecture du calculateur, etc. - -Dans la terminologie de la bibliotheque de classes Batch, tous ces -elements ont ete regroupes sous le terme de @emph{Parametre}. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Environnement, JobId, Parametre, Terminologie -@comment node-name, next, previous, up -@subsection Environnement -@cindex environnement - -Le second type de ressource necessaire a un job concerne les elements -logiciels. Cela se traduit le plus souvent, et particulierement, dans -les systemes Unix par la notion de variable d'environnement. Lorsque le -job s'execute, il doit pouvoir trouver l'ensemble des commandes et des -applications auquel il souhaite faire appel. Les variables -d'environnement decrivent donc les localisations des ces -programmes. Elles peuvent egalement contenir des informations influant -sur le comportement des programmes. - -Dans la terminologie de la bibliotheque de classes Batch, tous ces -elements on ete regroupes sous le terme de @emph{Environnement}. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node JobId, JobInfo, Environnement, Terminologie -@comment node-name, next, previous, up -@subsection JobId -@cindex jobid -@cindex identifier - -Si un job (@xref{Job}.) decrit les actions qui doivent etre effectues -par le systeme sous le controle du gestionnaire de batch, il est clair -qu'il est possible de soumettre plusieurs fois de suite le meme job, et -par la-meme d'executer plusieurs fois (et parfois simultanement) ces -memes actions. On a donc plusieurs instances du meme job qui sont -presentes en machine. Chaque instance peut etre distinguee des autres -par un identifiant unique qui lui est propre : c'est le @emph{jobId}. - -Le JobId est determine par le gestionnaire de batch au moment de la -soumission. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node JobInfo, Classes generiques, JobId, Terminologie -@comment node-name, next, previous, up -@subsection JobInfo -@cindex jobinfo - - -Des qu'un job (@xref{Job}.) est soumis donc des qu'il dispose d'un -JobId (@xref{JobId}.), il est possible d'interroger le gestionnaire de -batch pour etre informe de son comportement, de son evolution au sein du -systeme pendant son execution. - -On peut ainsi connaitre les parametres reellement consommes par rapport -aux parametres alloues, ainsi que l'environnement d'execution du job. - -Le JobInfo est une structure qui collecte ses informations sur l'etat du -job. - - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classes generiques, Namespace, JobInfo, Classes -@comment node-name, next, previous, up -@section Classes generiques -@cindex classes generiques - -Schematiquement, les classes composant la bibliotheque sont regroupees -en trois categories. Celles appartenant au groupe @emph{Types de base} -ne servent que de support au fonctionnement des classes de plus haut -niveau, egalement appellees @emph{Classes utilisateur}. Seules ces -dernieres sont vraiment interessantes pour l'utilisateur de la -bibliotheque. Les exceptions sont regroupees dans une categorie qui leur -est propre. - -@menu -* Namespace:: Espace de noms pour la bibliotheque. -* Types de base:: Les classes elementaires. -* Classes utilisateur:: Les classes de haut-niveau. -* Exceptions:: Les exceptions de la bibliotheque. -@end menu - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Namespace, Types de base, Classes generiques, Classes generiques -@comment node-name, next, previous, up -@subsection Namespace -@cindex namespace - -Toutes les classes de la bibliotheque sont regroupees dans un unique -namespace nomme @emph{Batch} afin de ne pas introduire de conflit avec -d'autres classes de meme nom. - -Ainsi lorsque par exemple on cite la classe @emph{BatchManager}, il -faudra declarer un objet @emph{Batch::BatchManager} ou bien faire appel -au namespace @emph{Batch} en C++. En Python, les objets sont regroupes -dans un module nomme @emph{libBatch_Swig}. - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Types de base, Classe Couple, Namespace, Classes generiques -@comment node-name, next, previous, up -@subsection Types de base -@cindex types de base - -Les classes decrites ici sont toutes utilisees ou utilisables par les -classes utilisateur de la bibliotheque, et en particulier par la classe -Versatile. @xref{Classe Versatile}. - -Ces classes implementent sous forme d'objet les types de base du langage -C++. Ainsi la classe @emph{Booltype} implemente le type de base -@emph{bool}. Certains types de base n'existant pas dans le langage ont -ete crees et encapsules dans une classe : c'est le cas notamment du type -de base @emph{Date} et de la classe @emph{DateType}, et du type de base -@emph{Couple} et de la classe @emph{CoupleType}. - -Tous les classes heritent de la classe generique @emph{GenericType}. - -@menu --- Types de base -- - -* Classe Couple:: Association de fichiers. -* Classe Date:: Type elementaire de date. - --- Classes d'implementation des types de base -- - -* Classe GenericType:: Classe-mere de tous les types. -* Classe BoolType:: Encapsulation du type bool. -* Classe CharType:: Encapsulation du type char. -* Classe CoupleType:: Encapsulation du type Couple. -* Classe DateType:: Encapsulation du type Date. -* Classe IntType:: Encapsulation du type int. -* Classe LongType:: Encapsulation du type long. -* Classe StringType:: Encapsulation du type string. - -@end menu - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe Couple, Classe Date, Types de base, Types de base -@comment node-name, next, previous, up -@page -@subsubsection Couple -@findex Couple - -La classe @emph{Couple} implemente le comportement d'un couple de deux -chaines de type @emph{string} qui sont respectivement nommees -@emph{local} et @emph{remote}. - -Cette classe est utilisee essentiellement pour la designation des -fichiers a transferer lors des soumissions de travaux, d'ou les noms -employes. - -@cartouche -Il faut toutefois faire attention a designer correctement ce qui est -local ou distant. Ainsi dans la bibliotheque de classes Batch, on a -adopte la convention qu'un fichier dit @emph{local} est celui present -sur la machine qui execute la bibliotheque de classes Batch, alors qu'un -fichier dit @emph{remote} (ou distant) est celui present sur le serveur -du gestionnaire de batch. -L'approche est donc clairement orientee utilisateur plutot que serveur. -@end cartouche - -@itemize @bullet{} -@item Entete - -@example -class Couple -@{ - public: - // Constructeur standard - Couple(const string & local, const string & remote); - - // Constructeur par recopie - Couple(const Couple & C); - - // Operateur pour l'affichage sur un stream - friend ostream & operator << (ostream & os, const Couple & cp); - - // Operateur d'affectation - virtual Couple & operator =(const Couple &); - - // Conversion en chaine - virtual string str() const; - - // Accesseurs - virtual string getLocal() const; - virtual string getRemote() const; - - protected: - string _local; // chemin d'acces au fichier local - string _remote; // chemin d'acees au fichier distant - - private: - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe Date, Classe GenericType, Classe Couple, Types de base -@comment node-name, next, previous, up -@page -@subsubsection Date -@findex Date - -La classe @emph{Date} sert a stocker n'importe quelle information de -temps et peut la representer sous une forme plus lisible a l'utilisateur -que le traditionnel appel a la fonction @emph{ctime}. @xref{(*manpages*)ctime}. - -@itemize @bullet{} -@item Entete - -@example -class Date -@{ - public: - // Constructeur standard (a partir d'une valeur epoch) - Date(const long l=0); - - // Constructeur a partir d'une chaine hh:mm:ss - Date(const string s); - - // Operateurs portant sur les Dates - virtual Date & operator =(long l); - virtual Date & operator +(long l); - virtual Date & operator -(long l); - virtual Date & operator +=(long l); - virtual Date & operator -=(long l); - virtual Date & operator =(const string & s); - - // Conversions en types standards - virtual string str() const; - virtual long epoch() const; - - protected: - int _day, _month, _year; - int _hour, _min, _sec; - - private: - -@}; -@end example -@end itemize - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe GenericType, Classe BoolType, Classe Date, Types de base -@comment node-name, next, previous, up -@page -@subsubsection GenericType -@findex GenericType - -La classe @emph{GenericType} est la classe-mere de toutes les classes -utilisees par la classe @emph{Versatile}. @xref{Classe Versatile}. - -Elle definit une interface que @emph{Versatile} utilise pour controler -les objets : constructeur simple et destructeur, operateur sur -@emph{ostream}, conversion en chaine et surtout methode @emph{clone}. - -La methode @emph{clone} permet de recuperer un nouvel objet identique au -premier qui sera automatiquement alloue sur le tas par un appel a -@emph{new}. Il est important de noter ici que le nouvel objet @strong{DEVRA} -etre desalloue par un appel a @emph{delete}. Cette desallocation est a -la charge de l'utilisateur de l'objet sans quoi une fuite memoire en -resultera. - -@itemize @bullet{} -@item Entete - -@example -class GenericType -@{ - public: - // Constructeur et destructeur - GenericType(); - virtual ~GenericType(); - - // Operateur pour l'affichage sur un stream - friend ostream & operator << (ostream & os, - const GenericType & obj); - - // Conversion en chaine - virtual string affiche() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - // Retourne le nombre d'objets GenericType et al. - static int getNb(); - - protected: - - private: - static int _nb; // nombre total d'objets GenericType et al. - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe BoolType, Classe CharType, Classe GenericType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection BoolType -@findex BoolType - -Cette classe encapsule le type C++ @emph{bool} dans un objet herite de -@emph{GenericType} de maniere a pouvoir le stocker aisement dans un -objet de classe @emph{Versatile}. - -@itemize @bullet{} -@item Entete - -@example -class BoolType : public GenericType -@{ - public: - // Constructeur - BoolType(const bool b=false); - - // Conversion en chaine - virtual string affiche() const; - - // Operateur d'affectation - virtual BoolType & operator =(bool); - - // Conversion en bool - virtual operator bool() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - bool _data; - - private: - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe CharType, Classe CoupleType, Classe BoolType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection CharType -@findex CharType - -Cette classe encapsule le type C++ @emph{char} dans un objet herite de -@emph{GenericType} de maniere a pouvoir le stocker aisement dans un -objet de classe @emph{Versatile}. - - -@itemize @bullet{} -@item Entete - -@example -class CharType : public GenericType -@{ - public: - // Constructeur - CharType(const char c=0); - - // Conversion en chaine - virtual string affiche() const; - - // Operateur d'affectation - virtual CharType & operator =(char); - - // Conversion en char - virtual operator char() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - char _data; - - private: - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe CoupleType, Classe DateType, Classe CharType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection CoupleType -@findex CoupleType - -Cette classe encapsule le type interne @emph{Couple} dans un objet herite de -@emph{GenericType} de maniere a pouvoir le stocker aisement dans un -objet de classe @emph{Versatile}. - - -@itemize @bullet{} -@item Entete - -@example -class CoupleType : public GenericType -@{ - public: - // Constructeur - CoupleType(const Couple & C); - - // Conversion en chaine - virtual string affiche() const; - virtual operator string() const; - - // Operateur d'affectation - virtual CoupleType & operator =(const Couple & C); - - // Conversion en char - virtual operator Couple() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - Couple _data; - - private: - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe DateType, Classe IntType, Classe CoupleType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection DateType -@findex DateType - -Cette classe encapsule le type interne @emph{Date} dans un objet herite de -@emph{GenericType} de maniere a pouvoir le stocker aisement dans un -objet de classe @emph{Versatile}. - - -@itemize @bullet{} -@item Entete - -@example -class DateType : public GenericType -@{ - public: - // Constructeur - DateType(const Date & d); - - // Conversion en chaine - virtual string affiche() const; - - // Operateur d'affectation - virtual DateType & operator =(const Date &); - - // Conversion en Date - virtual operator Date() const; - - // Conversion en long - virtual operator long() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - Date _data; - - private: -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe IntType, Classe LongType, Classe DateType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection IntType -@findex IntType - -Cette classe encapsule le type C++ @emph{int} dans un objet herite de -@emph{GenericType} de maniere a pouvoir le stocker aisement dans un -objet de classe @emph{Versatile}. - - -@itemize @bullet{} -@item Entete - -@example -class IntType : public GenericType -@{ - public: - // Constructeur - IntType(const int i=0); - - // Conversion en chaine - virtual string affiche() const; - - // Operateur d'affectation - virtual IntType & operator =(int); - - // Conversion en int - virtual operator int() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - int _data; - - private: - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe LongType, Classe StringType, Classe IntType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection LongType -@findex LongType - -Cette classe encapsule le type C++ @emph{long} dans un objet herite de -@emph{GenericType} de maniere a pouvoir le stocker aisement dans un -objet de classe @emph{Versatile}. - -@itemize @bullet{} -@item Entete - -@example -class LongType : public GenericType -@{ - public: - // Constructeur - LongType(const long l=0L); - - // Conversion en chaine - virtual string affiche() const; - - // Operateur d'affectation - virtual LongType & operator =(long); - - // Conversion en long - virtual operator long() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - long _data; - - private: - -@}; -@end example -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe StringType, Classes utilisateur, Classe LongType, Types de base -@comment node-name, next, previous, up -@page -@subsubsection StringType -@findex StringType - -Cette classe encapsule le type C++ @emph{string} de la STL dans un objet -herite de @emph{GenericType} de maniere a pouvoir le stocker aisement -dans un objet de classe @emph{Versatile}. - -@itemize @bullet{} -@item Entete - -@example -class StringType : public GenericType -@{ - public: - // Constructeur - StringType(const string & s=""); - - // Conversion en chaine - virtual string affiche() const; - virtual operator string() const; - - // Operateur d'affectation - virtual StringType & operator =(string); - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - string _data; - - private: - -@}; -@end example -@end itemize - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classes utilisateur, Exemple, Classe StringType, Classes generiques -@comment node-name, next, previous, up -@page -@subsection Classes utilisateur -@cindex classes utilisateur - -Les classes dites classes utilisateur sont en realite les classes de -plus haut niveau de la biliotheque de classes Batch. Ces classes -remplissent les unes avec les autres l'ensemble des fonctionnalites -proposees par la bibliotheque. L'utilisateur trouvera donc dans cette -section la description des possibilites de la bibliotheque et le moyen -de les mettre en oeuvre. - -La premiere section montre un exemple complet de soumission et de -controle d'un job soumis a travers les classes de la biliotheque. Les -sections suivantes reprennent les elements de l'exemple pour le -detailler et le completer. - -@menu -* Exemple:: Exemple simple mais complet d'utilisation. -* Classe BatchManagerCatalog:: Description de la classe BatchManagerCatalog. -* Classe FactBatchManager:: Description de la classe FactBatchManager. -* Classe BatchManager:: Description de la classe BatchManager. -* Classe Environnement:: Description de la classe Environnement. -* Classe Job:: Description de la classe Job. -* Classe JobId:: Description de la classe JobId. -* Classe JobInfo:: Description de la classe JobInfo. -* Classe Parametre:: Description de la classe Parametre. -* Classe Versatile:: Description de la classe Versatile. -@end menu - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Exemple, Classe BatchManagerCatalog, Classes utilisateur, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection Exemple -@cindex exemple - -Cet exemple decrit le processus type de creation et de soumission d'un -job a travers les classes de la bibliotheque. - -Il faut toutefois penser que les appels aux methodes peuvent lever des -exceptions qu'il faudra intercepter et gerer. @xref{Exceptions}. - -@example - @dots{} - - // On instancie le catalogue de gestionnaires de batch - Batch::BatchManagerCatalog cata; - - // On cree un BatchManager qui se connecte au veritable gestionnaire - // de batch - Batch::BatchManager & bm = (* cata("PBS"))("monserver.mondomaine.fr"); - - // Pour fabriquer un Job, on doit d'abord creer un objet Parametre et - // un objet Environnement qui contiennent respectivement la liste des - // parametres du job au sein du gestionnaire de batch et la liste des - // variables d'environnement necessaires au fonctionnement du job - Batch::Parametre param; - - param[EXECUTABLE] = "/home/user/mon_application/executable"; - param[NAME] = "MonJob"; - param[ACCOUNT] = "MonProjet"; // code d'imputation/facturation - param[MAXCPUTIME] = 360L; // 6min - param[MAXWALLTIME] = 480L; // 8min - param[INFILE] = Batch::Couple("/tmp/infich1", rempath+"/infich1"); - param[OUTFILE] = Batch::Couple("/tmp/outfich1", rempath+"/outfich1"); - param[OUTFILE] += Batch::Couple("stderr", path + "/STDERR"); - param[OUTFILE] += Batch::Couple("stdout", path + "/STDOUT"); - param[MAIL] = "user@@domaine.fr"; - param[USER] = "user"; - - Batch::Environnement env; - env["DEBUG"] = "3"; // un niveau de debug exige par l'application - env["MYAPP_FILE"] = "/home/user/mon_application/data/mydatafile"; - - // Creation du job - Batch::Job job(param, env); - - // On soumet le Job au BatchManager qui le relaie jusqu'au veritable - // gestionnaire de batch sur le serveur. En retour on obtient un - // identifiant unique de notre job (JobId). - const Batch::JobId jobid = bm.submitJob(job); - - // On interroge le BatchManager pour connaitre l'etat du Job - const Batch::JobInfo jinfo = jobid.queryJob(); - cout << jinfo << endl; - - // On detruit l'objet BatchManager - delete &bm; - - @dots{} -@end example - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe BatchManagerCatalog, Classe FactBatchManager, Exemple, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection BatchManagerCatalog -@findex BatchManagerCatalog - -La classe @emph{BatchManagerCatalog} definit une interface d'acces au -catalogue de fabriques de BatchManager. @xref{Classe FactBatchManager}. - -Pourquoi utiliser une fabrique et ne pas instancier directement un objet -@emph{BatchManager} en fonction de sa classe ? C'est l'option qui avait ete -choisie dans la premiere version de la bibliotheque de classes -Batch. Cette facon de proceder est simple, aussi bien pour le -developpeur de la classe que pour l'utilisateur, mais elle se revele a -terme penalisante dans la souplesse d'utilisation des classes. Elle -permet aussi moins facilement de mettre en place une strategie de -singleton pour les objets @emph{BatchManager}, ce qui peut se reveler utile non -pas en termes de performance mais plutot en termes de genericite et -toujours de souplesse. - -En resume, l'utilisation de fabiques permet d'acceder a la genericite, -qui rappelons-le est l'objet de cette biliotheque, a la souplesse et a -la performance au prix d'une legere complication pour le developpeur -mais pas pour l'utilisateur. - -Le catalogue de fabriques est une @emph{map}, ou tableau associatif, -auquel on passe le nom d'une fabrique et qui retourne un pointeur sur -une instance de cette fabrique. - -Le catalogue est renseigne statiquement par les fabriques declarees -elles-memes statiquement dans la biliotheque. Il est donc precharge avec -les fabriques correspondant a chacune des API disponibles. Comme le -catalogue n'est pas declare constant, il est possible de rajouter ou de -supprimer des fabriques dans le catalogue dynamiquement. - -@itemize @bullet{} -@item Entete - -@example -class BatchManagerCatalog -@{ -public: - // Constructeur - BatchManagerCatalog(); - // Destructeur - virtual ~BatchManagerCatalog(); - - // Accesseurs - static FactBatchManager * getFactBatchManager(const char * type); - static void addFactBatchManager(const char * type, - FactBatchManager * pFBM); - virtual FactBatchManager * operator() (const char * type) const; - - // Wrapping Python - virtual map * dict() const; - virtual string __repr__() const; - -protected: - // Le catalogue est gere en singleton et en multi-thread - static map * _p_catalog; - static pthread_mutex_t _mutex; - -private: - -@}; -@end example - -@item Exemple - -@example -@dots{} - -// On instancie le catalogue de gestionnaires de batch -Batch::BatchManagerCatalog cata; - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{BatchManagerCatalog()} - -Le constructeur par defaut permet d'obtenir une instance de -@emph{BatchManagerCatalog} qui permet de manipuler un objet statique -interne. Cet objet interne est le veritable catalogue et se trouve etre -un singleton. - - -@item -@b{~BatchManagerCatalog()} - -Le destructeur n'a pas d'action particuliere. - -@item -@b{static FactBatchManager * getFactBatchManager(const char * type)} - -Cet accesseur retourne un pointeur sur un objet de type -@emph{FactBatchManager} en fonction du nom (le type) sous lequel il -s'est enregistre dans le catalogue. - -Cette fonction est statique et peut donc etre utilisee pour interroger -le catalogue depuis des objets statiques. - -@item -@b{static void addFactBatchManager(const char * type, FactBatchManager * pFBM)} - -Cet accesseur enregistre dans le catalogue un pointeur sur un objet de type -@emph{FactBatchManager} sous le nom (le type) passe en argument. - -Cette fonction est statique et peut donc etre utilisee pour enregistrer -des objets statiques dans le catalogue. - -@item -@b{FactBatchManager * operator() (const char * type) const} - -Cet accesseur retourne un pointeur sur un objet de type -@emph{FactBatchManager} en fonction du nom (le type) sous lequel il -s'est enregistre dans le catalogue. - -Cette fonction non statique est utilisable sur une instance de -@emph{BatchManagerCatalog}. - -@item -@b{map * dict() const} - -Cette methode utilisable depuis Python permet de recuperer un -dictionnaire decrivant le contenu du catalogue. - -@item -@b{string __repr__() const} - -Cette methode utilisable depuis Python retourne une description de -l'objet @emph{BatchManagerCatalog}. - -@end itemize - - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe FactBatchManager, Classe BatchManager, Classe BatchManagerCatalog, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection FactBatchManager -@findex FactBatchManager - -La classe @emph{FactBatchManager} est abstraite. Elle definit une interface -qui doit etre implementee par des classes specialisees en fonction du -gestionnaire de batch et de son API de communication. @xref{Classes specifiques}. - -Les objets repondant a l'interface de @emph{FactBatchManager} sont -automatiquement inseres dans le catalogue des fabriques de -@emph{BatchManager} a la construction de l'objet. Il est ainsi possible -de definir statiquement des objets de ce type qui enrichiront le -catalogue des la compilation. @xref{Classe -BatchManagerCatalog}. @xref{Classe BatchManager}. - -Les objets de la classe @emph{FactBatchManager} ou de ses derivees sont -des functors et renvoient au moment de l'appel un pointeur sur un objet -gestionnaire de batch @emph{BatchManager} associe a un -serveur. L'allocation de l'objet est faite sur le tas et celui-ci doit -donc etre desalloue manuellement par l'utilisateur de la bibliotheque au -moment opportun. - -@itemize @bullet{} -@item Entete - -@example -class FactBatchManager -@{ -public: - // Constructeur - FactBatchManager(const string & type); - - // Destructeur - virtual ~FactBatchManager(); - - // Functor - virtual BatchManager * operator() (const char * hostname) const = 0; - - // Accesseur au type interne - string getType() const; - - // Wrapping Python - string __repr__() const; - -protected: - string type; // Le type interne - -private: - -@}; -@end example - -@item Exemple - -@example -@dots{} - -// On instancie le catalogue de gestionnaires de batch -Batch::BatchManagerCatalog cata; - -// On cree une fabrique de BatchManager de type PBS -Batch::FactBatchManager & fbm = * cata("PBS"); - -@dots{} -@end example - -@item Methodes -@itemize @minus{} - -@item -@b{FactBatchManager(const string & type)} - -Le constructeur de la classe prend un type qui doit identifer de maniere -unique la fabrique au sein du catalogue de fabrique. Ce type sert de cle au -catalogue. @xref{Classe BatchManagerCatalog}. - -@item -@b{~FactBatchManager()} - -Le destructeur de la classe n'a pas d'action particuliere. - -@item -@b{BatchManager * operator() (const char * hostname) const} - -Cette methode est virtuelle pure. Elle doit etre surchargee dans les -classes derivees et doit retourner un pointeur sur un objet de type -@emph{BatchManager} correpondant au type de la classe et oeuvrant sur la -machine passee en argument. Le @emph{hostname} est soit alphabetique -soit numerique et doit etre soit un nom de machine valide soit une -adresse IP valide. Aucun controle n'est a priori realise et cet argument -est passe tel quel a l'API du gestionnaire de batch. - -Cet objet agit comme @emph{parent} vis-a-vis de l'objet -@emph{BatchManager} qu'il retourne. - -@item -@b{string getType() const} - -Cette methode renvoie le type interne de l'objet, c'est-a-dire la cle -sous lequel il est enregistre dans le catalogue. - -@item -@b{string __repr__() const} - -Cette methode utilisable depuis Python retourne une description de -l'objet @emph{FactBatchManager}. - -@end itemize - - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe BatchManager, Classe Environnement, Classe FactBatchManager, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection BatchManager -@findex BatchManager - -La classe @emph{BatchManager} est abstraite. Elle definit une interface -qui doit etre implementee par des classes specialisees en fonction du -gestionnaire de batch et de son API de communication. @xref{Classes -specifiques}. - -Toute action a destination du gestionnaire de batch doit etre precedee -de l'instanciation d'un objet derivant de la classe @emph{BatchManager} -puisque c'est a travers cet objet que l'on aura acces a l'interface du -gestionnaire. - -Cette instanciation est realisee par une fabrique de gestionnaire de -batch, instance elle-meme derivee de la classe abstraite -FactBatchManager. @xref{Classe FactBatchManager}. - -@itemize @bullet{} -@item Entete - -@example -class BatchManager -@{ - public: - // Constructeur et destructeur - BatchManager(const FactBatchManager * parent, - const char * host="localhost") - throw(InvalidArgumentException); - virtual ~BatchManager(); - - // Recupere l'identifiant d'un job deja soumis au BatchManager - virtual const JobId getJobIdByReference(const string & ref); - - // Methodes pour le controle des jobs : virtuelles pures - // soumet un job au gestionnaire - virtual const JobId submitJob(const Job & job) = 0; - - // retire un job du gestionnaire - virtual void deleteJob(const JobId & jobid) = 0; - - // suspend un job en file d'attente - virtual void holdJob(const JobId & jobid) = 0; - - // relache un job suspendu - virtual void releaseJob(const JobId & jobid) = 0; - - // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, - const Parametre & param, - const Environnement & env) = 0; - virtual void alterJob(const JobId & jobid, - const Parametre & param) = 0; - virtual void alterJob(const JobId & jobid, - const Environnement & env) = 0; - - // renvoie l'etat du job - virtual JobInfo queryJob(const JobId & jobid) = 0; - - // wrapping Python - virtual string __repr__() const; - - protected: - string _hostname; // serveur ou tourne le BatchManager - const FactBatchManager * _parent; // fabrique qui a produit l'instance - - private: - -@}; -@end example - -@item Exemple - -@example -@dots{} - -// On instancie le catalogue de gestionnaires de batch -Batch::BatchManagerCatalog cata; - -// On cree un BatchManager qui se connecte au veritable gestionnaire -// de batch -Batch::BatchManager & bm = (* cata("PBS"))("monserver.mondomaine.fr"); - -// Maintenant, on peut utiliser toutes les fonctionnalites du -// gestionnaire de batch a travers le variable myBM - -// On detruit l'objet BatchManager -delete &bm; - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{BatchManager(const FactBatchManager * parent,$* -const char * host="localhost") throw(InvalidArgumentException)} - -Excepte un pointeur sur la fabrique qui a produit l'objet, @xref{Classe FactBatchManager}, - le constructeur accepte zero ou un argument de type -@emph{string} decrivant soit le nom de domaine completement qualifie -(FQDN, @i{fully qualified domain name}) du serveur de batch, soit son -adresse IP dans un format decimal "aaa.bbb.ccc.ddd". - -Une resolution du nom ou de l'adresse peut etre realisee en fonction des -capacites de la plate-forme pour s'assurer que le serveur est connu et -joignable. En cas d'echec, une exception InvalidArgumentException est -levee. @xref{Classe InvalidArgumentException}. A priori, aucune -verification n'est faite par defaut. - -Ceci fait, une connexion est etablie avec le gestionnaire de batch qui -est maintenue jusqu'a destruction de l'objet, si le gestionnaire le permet. - -@item -@b{~BatchManager()} - -Le destructeur supprime la connexion precedemment etablie par le -constructeur lorsque celle-ci a reussi. - -@item -@b{const JobId submitJob(const Job & job)} - -Cette methode soumet le job passe en argument au gestionnaire de -batch. Etant donne que le job ne peut pas etre envoye tel quel puisqu'il -a un format generique au sein de la bibliotheque de classes Batch, cette -methode est chargee de le convertir dans un format adapte au -gestionnaire de batch sous-jacent. - -Ce n'est que lorsque cette conversion est realisee que le job est soumis -au gestionnaire a travers son API. L'identifiant propose par le -gestionnaire est alors renvoye a l'appelant. Si la soumission echoue -pour une raison ou une autre, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - -@item -@b{void deleteJob(const JobId & jobid)} - -Cette methode retire le job dont l'identifiant est passe en argument de -la file d'attente du gestionnaire, ou bien l'arrete s'il est en cours -d'execution. Cette methode est inoperante sur des travaux deja termines, -auquel cas une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - - -@item -@b{void holdJob(const JobId & jobid)} - -Cette methode suspend le job dont l'identifiant est passe en argument au -sein de la file d'attente du gestionnaire. Cette methode est inoperante -sur des travaux en cours d'execution ou deja termines, ainsi que sur des -travaux deja suspendus. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - -@item -@b{void releaseJob(const JobId & jobid)} - -Cette methode relache un job precedemment suspendu en file -d'attente dont l'identifiant est passe en argument. Elle est inoperante -sur des travaux deja relaches, en cours d'execution ou termines. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - - -@item -@b{void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)@* -void alterJob(const JobId & jobid, const Parametre & param)@* -void alterJob(const JobId & jobid, const Environnement & env)} - -Ces methodes permettent de modifier les parametres d'execution et -d'environnement d'un job dont l'identifiant est passe en -argument. @xref{Classe Parametre}. @xref{Classe Environnement}. Il -est important de noter que le job doit etre encore place en file -d'attente sinon la methode est inoperante. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - -@item -@b{JobInfo queryJob(const JobId & jobid)} - -Cette methode permet de recuperer les informations concernant le job -dont l'identifiant est passe en argument dans un objet de classe -@emph{JobInfo}. @xref{Classe JobInfo}. On y retrouve les parametres -d'execution et d'environnement du job tels qu'ils ont ete passes au -gestionnaire au moment de la soumission, ainsi que des informations -concernant l'execution du job comme par exemple la machine d'execution, -le temps consomme, la memoire consommee, etc. - -Il n'est pas toujours possible d'interroger un job deja termine. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - - -@item -@b{const JobId getJobIdByReference(const string & ref)} - -Cette methode permet de recuperer au sein de la classe un identifiant de -job a partir d'une chaine de caracteres obtenue par un biais -externe. Cet identifiant pourra etre utilise par la suite au sein de la -biliotheque de classes pour controler le job comme s'il avait ete cree -et soumis depuis la biliotheque-meme. - -@end itemize - - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe Environnement, Classe Job, Classe BatchManager, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection Environnement -@findex Environnement - -La classe @emph{Environnement} permet de definir les variables -d'environnement necessaires a l'execution d'un job. Ces variables seront -creees automatiquement dans l'environnement du job lorsque celui-ci -debutera son execution sur la machine. - -Une variable d'environnement est traditionnellement composee d'un nom et -d'une valeur qui peut etre vide ou absente. L'ensemble des variables -d'environnement peut ainsi etre represente sous la forme d'une table -associative dans laquelle le nom de la variable correspond a la clef de la -table, et la valeur de la variable correspond a la valeur de la table -pour la clef donnee. - -Chaque objet de la classe @emph{Environnement} se comporte comme une -table associative telle que decrite auparavant. - -@itemize @bullet{} -@item Entete - -@example -typedef map < string, string > Environnement; -@end example - - -@item Exemple -@example -@dots{} - -Environnement env; -env["MYAPP_ROOTDIR"] = "/home/user/myapplication"; -env["MYAPP_LICENSEFILE"] = env["MYAPP_ROOTDIR"] + "/license.dat"; -env["CXX"] = "g++"; -env["CXXFLAGS"] = "-g -O2"; - -@dots{} -@end example - -@item Methodes - -Compte tenu de la definition actuelle de la classe @emph{Environnement} -en tant que map STL, elle beneficie de toutes les fonctionnalites -classiques des maps STL. - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe Job, Classe JobId, Classe Environnement, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection Job -@findex Job - -La classe @emph{Job} represente la notion de travail, ou job, dans la -bibliotheque de classes Batch. Elle se comporte essentiellement comme -une collection de parametres et de variables necessaires a la -description des actions qui doivent etre realisees dans des conditions -precisees. - -Elle se repose sur deux autres classes qui distinguent la notion de -parametre d'execution et celle de variable d'environnement : les classes -@emph{Parametre} et @emph{Environnement}. @xref{Classe -Parametre}. @xref{Classe Environnement}. - -Son role est de preparer la soumission qui aura lieu et qui concretisera -l'incarnation du job dans le gestionnaire de batch. Tant que le job n'a -pas ete soumis, on ne peut pas vraiment considerer son existence et de -fait les interactions qu'on peut avoir avec l'objet sont tres limitees. - -@itemize @bullet{} -@item Entete - -@example -class Job -@{ - public: - // Constructeurs et destructeur - Job(); - Job(Parametre param); - Job(Environnement env); - Job(Parametre param, Environnement env); - virtual ~Job(); - - // Operateur pour l'affichage sur un stream - friend ostream & operator <<(ostream & os, const Job & job); - - // Accesseurs - Parametre getParametre() const; - void setParametre(const Parametre &); - - // Accesseurs - Environnement getEnvironnement() const; - void setEnvironnement(const Environnement &); - - // Methodes pour l'interfacage avec Python (SWIG) - string __repr__() const; - - protected: - Parametre _param; // table des parametres batch du job - Environnement _env; // table des variables d'environnement - - private: - -@}; -@end example - - -@item Exemple -@example -@dots{} - -@dots{} (ici on cree un BatchManager bm) -Parametre param; -Environnement env; - -@dots{} (ici on cree les parametres du job) - -Job job(param, env); -JobId jobid = bm.sumbitJob(job); - -@dots{} -@end example - -@item Methodes -@itemize @minus{} - -@item -@b{Job()$* -Job(Parametre param)$* -Job(Environnement env)$* -Job(Parametre param, Environnement env)} - -Le constructeur, en plus de creer l'objet, peut faire des verifications -sur la coherence des objets passes en argument s'il y en a. - -@item -@b{~Job()} - -Le destructeur libere simplement les espaces alloues. - -@item -@b{ostream & operator <<(ostream & os, const Job & job)} - -Cette methode permet a l'utilisateur d'afficher sur un stream le contenu -d'un objet de classe @emph{Job}. - -@item -@b{Parametre getParametre() const} - -Un accesseur pour recuperer l'objet Parametre passe en argument du -constructeur. - -@item -@b{void setParametre(const Parametre &)} - -Cette methode permet de positionner @i{a posteriori} l'objet -@emph{Parametre}. Des tests complementaires peuvent etre faits pour -verifier la coherence de l'objet. - -@item -@b{Environnement getEnvironnement() const} - -Un accesseur pour recuperer l'objet Environnement passe en argument du constructeur. - -@item -@b{void setEnvironnement(const Environnement &)} - -Cette methode permet de positionner @i{a posteriori} l'objet -@emph{Environnement}. Des tests complementaires peuvent etre faits pour -verifier la coherence de l'objet. - -@item -@b{string __repr__() const} - -Cette methode sert dans l'interfacage Python de l'objet et permet d'en -realiser l'affichage a travers l'interpreteur Python. - -@end itemize -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe JobId, Classe JobInfo, Classe Job, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection JobId -@findex JobId - -La classe @emph{JobId} represente l'incarnation d'un objet de classe -@emph{Job} une fois soumis au travers du gestionnaire de batch. A chaque -objet @emph{JobId} correspond une et une seule soumission d'un objet -@emph{Job}. Ainsi un meme objet @emph{Job} peut etre soumis plusieurs -fois de suite a un ou plusieurs gestionnaires de batch et produira -autant d'objets @emph{JobId}. - -L'objet @emph{JobId} assure le controle et la gestion du job au travers -du gestionnaire de batch. Chaque objet @emph{JobId} est associe a un -gestionnaire particulier aupres duquel il relaie les actions qu'on lui -soumet. - - -@itemize @bullet{} -@item Entete - -@example -class JobId -@{ - friend class BatchManager; - - public: - // Constructeur standard et destructeur - JobId(); - virtual ~JobId(); - - // Constructeur avec le pointeur sur le BatchManager associe - // et avec une reference - JobId(BatchManager *, string ref); - - // Operateur d'affectation entre objets - virtual JobId & operator =(const JobId &); - - // Constructeur par recopie - JobId(const JobId &); - - // Accesseur pour la reference interne - virtual string getReference() const; - - // Methodes pour le controle du job - // retire un job du gestionnaire - virtual void deleteJob() const; - - // suspend un job en file d'attente - virtual void holdJob() const; - - // relache un job suspendu - virtual void releaseJob() const; - - // modifie un job en file d'attente - virtual void alterJob(const Parametre & param, - const Environnement & env) const; - virtual void alterJob(const Parametre & param) const; - virtual void alterJob(const Environnement & env) const; - - // modifie un job en file d'attente - virtual void setParametre(const Parametre & param); - virtual void setEnvironnement(const Environnement & env); - - // renvoie l'etat du job - virtual Batch::JobInfo queryJob() const; - - // Methodes pour l'interfacage avec Python (SWIG) - string __str__() const; // SWIG : affichage en Python - string __repr__() const; // SWIG : affichage en Python - - protected: - BatchManager * _p_batchmanager; // pointeur sur le BatchManager - // qui controle le job - string _reference; // reference du job au sein du BatchManager - - private: - -@}; -@end example - - -@item Exemple -@example -@dots{} (ici on cree un BatchManager bm et un Job job) - -// On soumet le job et on recupere un identifiant -JobId jobid = bm.submitJob(job); - -// Ce qui permet d'interroger l'etat du job en cours -JobInfo jinfo = jobid.queryJob(); - -@dots{} -@end example - -@item Methodes - -@itemize @minus{} -@item -@b{JobId()@* -JobId(BatchManager *, string ref)} - -Le constructeur par defaut cree un @emph{JobId} qui devra etre complete -par la suite. Ceci n'est pas directement realisable par l'utilisateur -mais sert pour certaines classes amies de la classe @emph{JobId}. - -D'un point de vue utilisateur la construction d'un objet @emph{JobId} -necessite un pointeur sur un gestionnaire de batch existant et une -chaine de caractere representant une reference au sein de ce -gestionnaire de batch. - -Ces parametres sont en general issus de la -communication avec l'API du gestionnaire de batch et ne peuvent etre -aisement deduits. C'est pourquoi il est recommande de passer par une -classe d'implementation pour fabriquer un objet @emph{JobId}. - - -@item -@b{~JobId()} - -Le destructeur libere l'espace occupe par l'objet. - -@item -@b{JobId & operator =(const JobId &)} - -L'affectation d'un objet @emph{JobId} duplique les donnees internes de -l'objet passe en argument. Les deux objets sont totalement independants -a l'issue de l'affectation et designent chacun la meme instance du job -dans le meme gestionnaire de batch. Le controle du job peut etre realise -avec l'un ou l'autre des objets. - -@item -@b{JobId(const JobId &)} - -De meme que l'affectation le constructeur par recopie produit un objet -@emph{JobId} totalement independant de l'objet passe en argument et qui -designe le meme job dans le meme gestionnaire de batch. Le controle du -job peut etre realise avec l'un ou l'autre des objets. - -@item -@b{string getReference() const} - -Cet accesseur retourne la reference du job pour le gestionnaire de batch -qui a produit l'objet. - -@item -@b{void deleteJob() const} - -Cette methode relaie aupres au gestionnaire de batch qui a produit -l'objet la demande d'arret du job. - -@item -@b{void holdJob() const} - -Cette methode relaie aupres au gestionnaire de batch qui a produit -l'objet la demande de suspension du job. - -@item -@b{void releaseJob() const} - -Cette methode relaie aupres au gestionnaire de batch qui a produit -l'objet la demande de liberation du job. - -@item -@b{void alterJob(const Parametre & param, const Environnement & env) const@* -void alterJob(const Parametre & param) const@* -void alterJob(const Environnement & env) const} - -Ces methodes relaient aupres du gestionnaire de batch qui a produit -l'objet la demande de modification des parametres et/ou des variables -d'environnement du job. - -@item -@b{void setParametre(const Parametre & param)} - -Cette methode n'est utile que pour l'interfacage avec Python, car Python -ne sait pas gerer la surcharge de methode, et de fait leve des -exceptions lors d'appels a de telles methodes. - -Elle est equivalente a la methode @samp{void alterJob(const Parametre & param) const}. - - -@item -@b{void setEnvironnement(const Environnement & env)} - -Cette methode n'est utile que pour l'interfacage avec Python, car Python -ne sait pas gerer la surcharge de methode, et de fait leve des -exceptions lors d'appels a de telles methodes. - -Elle est equivalente a la methode @samp{void alterJob(const Environnement & env) const}. - -@item -@b{Batch::JobInfo queryJob() const} - -Cette methode relaie aupres du gestionnaire de batch qui a produit -l'objet la demande d'interrogation de l'etat du job. - -@item -@b{string __str__() const} - -Cette methode n'est utile que pour l'interfacage avec Python. Elle -permet d'afficher l'etat de l'objet @emph{JobId}. - -@item -@b{string __repr__() const} - -Cette methode n'est utile que pour l'interfacage avec Python. Elle -permet d'afficher l'etat de l'objet @emph{JobId}. - -@end itemize -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe JobInfo, Classe Parametre, Classe JobId, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection JobInfo -@findex JobInfo - -Un objet de classe @emph{JobInfo} represente l'ensemble des informations -disponibles sur un travail actif, c'est-a-dire soumis au gestionnaire de -batch, a un instant donne. - -Cet objet reprend des informations issues du job tel qu'il a ete soumis, -@xref{Classe Job}, mais aussi des informations produites par le -gestionnaire de batch a partir de la soumission et du transit du job en -son sein : nom de la queue dans laquelle le job est inscrit, duree -d'execution, date de soumission, etc. - -Ces informations sont disponibles aupres de l'utilisateur de la classe a -travers les objets @emph{Parametre} et @emph{Environnement} que l'objet -@emph{JobInfo} peut fournir. - -@itemize @bullet{} -@item Entete - -@example -class JobInfo -@{ - public: - // Constructeur standard et destructeur - JobInfo(); - virtual ~JobInfo(); - - // Constructeur par recopie - JobInfo(const JobInfo & jinfo); - - // Operateur pour l'affichage sur un stream - friend ostream & operator <<(ostream & os, const JobInfo & ji); - - // Accesseurs - virtual Parametre getParametre() const; - virtual Environnement getEnvironnement() const; - - // Methodes pour l'interfacage avec Python (SWIG) - string __str__() const; // SWIG : affichage en Python - string __repr__() const; // SWIG : affichage en Python - - protected: - Parametre _param; // parametres du job - Environnement _env; // variables d'environnement du job - - private: -@}; -@end example - - -@item Exemple -@example -@dots{} (ici on cree un BatchManager bm et un Job job) - -// On soumet le job et on recupere un identifiant -JobId jobid = bm.submitJob(job); - -// Ce qui permet d'interroger l'etat du job en cours -JobInfo jinfo = jobid.queryJob(); - -// On recupere l'objet Parametre interne modifie -// par le gestionnaire de batch -Parametre param = jinfo.getParametre(); - -// On recupere l'objet Environnement interne modifie -// par le gestionnaire de batch -Environnement env = jinfo.getEnvironnement(); - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{JobInfo()} - -Ce constructeur cree un objet @emph{JobInfo} vide. - -@item -@b{~JobInfo()} - -Le destructeur libere l'espace memoire alloue par l'objet. - -@item -@b{JobInfo(const JobInfo & jinfo)} - -Le constructeur par recopie produit un objet identique a celui passe en -argument. Les deux objets sont totalement independants l'un de l'autre. - -@item -@b{ostream & operator <<(ostream & os, const JobInfo & ji)} - -Cet operateur permet de voir le contenu de l'objet sur un flot de sortie. - -@item -@b{Parametre getParametre() const} - -Cet accesseur retourne l'objet interne @emph{Parametre} modifie par le -gestionnaire de batch. En particulier on y retrouve toutes les clefs et -les valeurs correspondant aux informations produites dynamiquement par -le gestionnaire (duree d'execution, machine d'execution, etc.). -Il n'est pas garanti que les valeurs passees au moment de la soumission -soient inchangees car des modifications ont pu etre apportees a ces -valeurs pendant le traitement du job par le gestionnaire. - -@item -@b{Environnement getEnvironnement() const} - -Cet accesseur retourne l'objet interne @emph{Environnement} modifie par le -gestionnaire de batch. En particulier on y retrouve toutes les clefs et -les valeurs correspondant aux informations produites dynamiquement par -le gestionnaire (chemin d'acces, variables d'environnement specifiques a -la machine d'execution, etc.). -Il n'est pas garanti que les valeurs passees au moment de la soumission -soient inchangees car des modifications ont pu etre apportees a ces -valeurs pendant le traitement du job par le gestionnaire. - -@item -@b{string __str__() const} - -Cette methode n'est utile que pour l'interfacage avec Python. Elle -permet d'afficher l'etat de l'objet @emph{JobInfo}. - -@item -@b{string __repr__() const} - -Cette methode n'est utile que pour l'interfacage avec Python. Elle -permet d'afficher l'etat de l'objet @emph{JobInfo}. - -@end itemize - -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe Parametre, Classe Versatile, Classe JobInfo, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection Parametre -@findex Parametre - -Les objets de la classe @emph{Parametre} se comportent comme des maps -STL, dont ils ont les fonctionnalites, decrivant les parametres -d'execution du job. - -Contrairement aux variables d'environnement qui sont decrites par les -objets de la classe @emph{Environnement}, les parametres d'execution -servent a preciser les contraintes qui pesent sur le job, comme par -exemple la duree maximale d'execution autorisee, la quantite maximale de -memoire utilisable ou la queue de soumission, ou bien a renseigner le -job avec des informations specifiques a l'utilisateur, comme son -username, son adresse email, le code d'imputation du job, etc. - -En raison du caractere tres specifique et precis des informations qui -doivent etre fournies au gestionnaire de batch, une nomenclature est -proposee par la classe @emph{Parametre} qu'il est vivement conseille de -suivre. De plus tout a ete fait pour rendre cette ecriture naturelle et -facile, donc il ne devrait pas y avoir de probleme pour l'utiliser. - -Ainsi, a titre d'exemple, pour preciser le temps maximal autorise pour -un job, il faut creer une clef de nom @var{maxcputime} dans un objet de -classe @emph{Parametre} qui sera ensuite passe au job. Et pour preciser -le code d'imputation du job, il faut creer une clef de nom @var{account}. - -Mais cet exemple simple montre que la valeur associee a la clef -@var{maxcputime} est semantiquement une duree, et que la valeur associee a -la clef @var{account} est semantiquement un nom. On a donc un probleme de -type puisque dans la definition d'une map STL le type de la valeur doit -etre le meme, et ce meme si les valeurs doivent par la suite avoir des -types semantiques differents. C'est pourquoi on a definit une classe -@emph{Versatile} qui encapsule des types differents. @xref{Classe -Versatile}. - -Quoiqu'il en soit toute la mecanique est cachee et seul importe pour -l'utilisateur de savoir que les valeurs associees aux clefs sont typees -et que ces types sont definis dans l'enumeration @emph{DiscriminatorType}. -@xref{Classe Versatile}. - - -@itemize @bullet{} -@item Entete - -@example -class Parametre : public map< string, Versatile > -@{ - public: - // Constructeur standard - Parametre(); - - // Constructeur par recopie - Parametre(const Parametre & PM); - - // Operateur de recherche dans la map - Versatile & operator [] (const string &); - const Versatile & operator [] (const string &) const; - - // Operateur d'affectation - Parametre & operator =(const Parametre & PM); - - // Declarations statique des clefs de la map - static const string ACCOUNT; - static const string CHECKPOINT; - static const string CKPTINTERVAL; - static const string CREATIONTIME; - static const string EGROUP; - static const string ELIGIBLETIME; - static const string EUSER; - static const string EXECUTABLE; - static const string EXECUTIONHOST; - static const string HOLD; - static const string ID; - static const string INFILE; - static const string MAIL; - static const string MAXCPUTIME; - static const string MAXDISKSIZE; - static const string MAXRAMSIZE; - static const string MAXWALLTIME; - static const string MODIFICATIONTIME; - static const string NAME; - static const string OUTFILE; - static const string PID; - static const string QUEUE; - static const string QUEUEDTIME; - static const string SERVER; - static const string STARTDATE; - static const string STATE; - static const string TEXT; - static const string TMPDIR; - static const string USEDCPUTIME; - static const string USEDDISKSIZE; - static const string USEDRAMSIZE; - static const string USEDWALLTIME; - static const string USER; - - protected: - // map interne servant a controler le type - // de la valeur associee a chaque clef - map< string, TypeParam > TypeMap; - - private: - -@}; -@end example - - -@item Exemple -@example -@dots{} - -Parametre param; - -param[EXECUTABLE] = "/home/user/mon_application/executable"; -param[NAME] = "MonJob"; -param[ACCOUNT] = "MonProjet"; // code d'imputation/facturation -param[MAXCPUTIME] = 360L; // 6min -param[MAXWALLTIME] = 480L; // 8min -param[INFILE] = Couple("/tmp/infich1", rempath + "/infich1"); -param[OUTFILE] = Couple("/tmp/outfich1", rempath + "/outfich1"); -param[OUTFILE] += Couple("stderr", path + "/STDERR"); -param[OUTFILE] += Couple("stdout", path + "/STDOUT"); -param[MAIL] = "user@@domaine.fr"; -param[USER] = "user"; - -@dots{} -@end example - -@item Methodes -@itemize @minus{} - -@item -@b{Parametre()} - -Le constructeur par defaut initialise l'objet @emph{Parametre} et cree -la table des types internes. Par contre l'objet ne contient aucune valeur. - -@item -@b{Parametre(const Parametre & PM)} - -Le constructeur par recopie cree un objet @emph{Parametre} a l'image de -celui qui lui est passe en argument. La table des types internes est -dupliquee ainsi que tous les objets correspondant a chacune des clefs. - -@item -@b{Versatile & operator [] (const string &)} - -Cet operateur permet de recuperer la valeur designee par la clef passee -en argument. Cette valeur est de classe @emph{Versatile} qui encapsule -tous les types de base utilisables dans la bibliotheque en tant que -parametre. @xref{Classe Versatile}. - - -@item -@b{const Versatile & operator [] (const string &) const} - -A l'image de l'operateur precedent, cet operateur permet de recuperer la -valeur designee par la clef passee en argument mais uniquement pour des -objets constants. - -@item -@b{Parametre & operator =(const Parametre & PM)} - -L'operateur d'affectation remplace l'ensemble du contenu de l'objet -@emph{Parametre} par le contenu de l'objet passe en argument. Les -valeurs sont dupliquees par rapport a l'objet @var{pm}. - -@end itemize - -@item Description des clefs - -Selon les gestionnaires de batch utilises, certaines clefs sont actives -ou inactives. Une definition superflue ne pose pas de probleme et se -trouve ignoree au moment de la soumission. Par contre l'absence d'un -clef peut empecher la soumission d'aboutir et lever une exception. - -@itemize @minus{} -@item ACCOUNT : type STRING - -Le code de facturation sur lequel le job doit s'imputer. - -@item CHECKPOINT : type LONG - -Une valeur non nulle indique au gestionnaire de batch que le job est -@dfn{checkpointable}, c'est-a-dire interruptible pour une reprise -ulterieure. - -@item CKPTINTERVAL : type LONG - -En liaison avec la clef @var{CHECKPOINT}, la clef @var{CKPTINTERVAL} -indique l'intervalle en secondes entre deux interruptions du code -(@dfn{checkpoint}). - -@item CREATIONTIME : type LONG - -La date a laquelle le job a ete cree (soumis) dans le gestionnaire de batch. - -@item EGROUP : type STRING - -Le groupe effectif au sens Unix du terme dans lequel le job s'execute. - -@item ELIGIBLETIME : type LONG - -La date a laquelle le job a pu disposer des ressources necessaires a son -execution. - -@item EUSER : type STRING - -L'utilisateur effectif au sens Unix du terme pour lequel le job s'execute. - -@item EXECUTABLE : type STRING - -Le chemin d'acces absolu a l'executable sur la machine qui soumet le job. - -@item EXECUTIONHOST : type STRING - -Le nom de la machine qui execute le job. - -@item HOLD : type LONG - -Une valeur non nulle indique au gestionnaire de batch que le job doit -etre place dans l'etat suspendu. Une valeur nulle libere le job. - -@item ID : type STRING - -L'identifiant unique du job pour le gestionnaire de batch. - -@item INFILE : type liste de COUPLE - -La clef @var{infile} liste les fichiers qui seront envoyes au job avant -son execution. Chaque fichier peut avoir un nom different sur la machine -cliente --- qui soumet le job --- et sur le serveur. C'est pourquoi -chaque fichier a envoyer est represente par un couple dont le nom @var{local} -est le chemin absolu du fichier sur la machine cliente et le nom -@var{remote} est le chemin absolu du fichier sur le -serveur. @xref{Classe Couple}. - -Si le nom @var{remote} vaut @samp{stdin}, alors le contenu du fichier -designe par le nom @var{local} est envoye sur l'entree standard du job -au moment de son execution. - -@item MAIL : type STRING - -L'adresse email de l'utilisateur ou lui seront envoyes les eventuels -messages d'information et d'alerte du gestionnaire de batch. - -@item MAXCPUTIME : type LONG - -Le temps de calcul (@i{CPU time}) en secondes que ne devra pas depasser le job. - -@item MAXDISKSIZE : type LONG - -L'espace disque en octets que ne devra pas depasser le job. - -@item MAXRAMSIZE : type LONG - -La quantite de memoire vive en octets que ne devra pas depasser le job. - -@item MAXWALLTIME : type LONG - -Le temps reel (@i{elapsed time}) en secondes que ne devra pas depasser le job. - -@item MODIFICATIONTIME : type LONG - -La date a laquelle le job a ete modifie pour la derniere fois dans le -gestionnaire de batch. Cette date correspond le plus souvent a la -derniere operation realisee par le gestionnaire dans la gestion du job : -routage au sein des files, suspension ou reprise, etc. - -@item NAME : type STRING - -Le nom du job tel qu'il apparait a l'utilisateur dans son dialogue avec -le gestionnaire de batch. Ce nom n'a pas besoin d'etre unique et ne -remplace pas l'identifiant (ID). Il n'est la que pour informer -l'utilisateur de la nature de son job. - -@item OUTFILE : type liste de COUPLE - -La clef @var{outfile} liste les fichiers qui sont produits par le job et -qui seront recuperes sur la machine locale de l'utilisateur apres -son execution. Chaque fichier peut avoir un nom different sur la machine -cliente --- qui soumet le job --- et sur le serveur. C'est pourquoi -chaque fichier a recuperer est represente par un couple dont le nom @var{local} -est le chemin absolu du fichier sur la machine cliente et le nom -@var{remote} est le chemin absolu du fichier sur le -serveur. @xref{Classe Couple}. - -Si le nom @var{local} vaut @samp{stdout}, alors le contenu du fichier -designe par le nom @var{local} contient la sortie standard du job -au moment de son execution. - -Si le nom @var{local} vaut @samp{stderr}, alors le contenu du fichier -designe par le nom @var{local} contient la sortie d'erreur du job -au moment de son execution. - -@item PID : type LONG - -La valeur du PID (@i{process identifier}) du job sur la machine sur -lqsuelle il s'execute. - -@item QUEUE : type STRING - -Le nom de la queue, aussi appelee classe ou file suivant les -terminologies, qui accueille le job. - -@item QUEUEDTIME : type LONG - -La date depuis laquelle le job a ete place en queue dans le gestionnaire -de batch. - -@item SERVER : type STRING - -Le nom complet du serveur qui recoit les soumissions de job. - -@item STARTDATE : type LONG - -La date a partir de laquelle l'utilisateur desire que le job soit -execute. L'execution ne demarrera qu'au dela de cette date et a -condition que toutes les conditions de ressources soient remplies. - -@item STATE : type STRING - -L'etat actuel du job. - -ATTENTION : Ces valeurs ne sont pas encore normalisees. - -@item TEXT : type STRING - -Un texte d'information que le gestionnaire peut emettre a destination de -l'utilisateur lorsque l'ensemble des parametres n'est pas suffisant pour -traduire l'etat reel du job. Par exemple, ce message peut informer -l'utilisateur de la raison qui maintient un job dans un etat suspendu ou -qui l'empeche de s'executer. - -@item TMPDIR : type STRING - -Un chemin d'acces absolu a un repertoire qui sera cree au demarrage du -job et qui isolera le job des autres travaux en cours d'execution sur la -meme machine. - -@item USEDCPUTIME : type LONG - -Le temps de calcul (@i{CPU time}) en secondes reellement consomme par le job. - -@item USEDDISKSIZE : type LONG - -L'espace disque en octets reellement consomme par le job. - -@item USEDRAMSIZE : type LONG - -L'espace disque en octets reellement consommee par le job. - -@item USEDWALLTIME : type LONG - -Le temps reel (@i{elapsed time}) en secondes reellement consomme par le job. - -@item USER : type STRING - -Le nom de l'utilisateur (@i{username}) sous lequel le job devra tourner -sur la machine d'execution. Ce parametre est utile lorsque l'utilisateur -possede des comptes differents sur les machines sur lequel il soumet et calcule. - -@end itemize - - -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe Versatile, Exceptions, Classe Parametre, Classes utilisateur -@comment node-name, next, previous, up -@page -@subsubsection Versatile -@findex Versatile - -Cette classe est normalement invisible en tant que telle a l'utilsateur -de la bibliotheque de classes Batch. Mais il est tout de meme utile de -la presenter car son action est visible, notamment dans son interaction -fine avec la classe @emph{Parametre}. @xref{Classe Parametre}. - -Comme il a ete precise dans la descrption de la classe @emph{Parametre}, -la classe @emph{Versatile} a ete concue pour encapsuler les valeurs de -la map @emph{Parametre} qui peuvent etre de types effectifs differents. - -Ces types, decrits par l'enumeration @emph{DiscriminatorType}, sont -actuellement au nombre de trois : @var{long}, @var{string} et -@var{couple}. Ces types correpondent au types de base du langage C++ ou -de la biliotheque de classes Batch. @xref{Types de base}. - -Le type special @var{undefined} ne sert que pour l'objet -@emph{Versatile} juste cree mais non encore affecte d'une valeur et donc -d'un type. La premiere affection d'une valeur a un objet -@emph{Versatile} non encore affecte lui donne automatiquement le type de -la valeur. - -Les objets de classe @emph{Versatile} peuvent se comporter soit comme -des variables scalaires, c'est-a-dire ne contenant qu'une valeur unique, -soit comme des listes, auquel cas elles utilisent l'interface des -@emph{list} de la STL. Toutefois afin de faciliter l'ecriture pour -l'utilisateur basique de la classe @emph{Versatile} --- et de la classe -@emph{Parametre} ---, des operateurs de concatenation @samp{+=} et -@samp{,} ont ete ajoutes. - - -@itemize @bullet{} -@item Entete - -@example -// Les types autorises -enum DiscriminatorType @{ UNDEFINED, LONG, STRING, COUPLE @}; - -typedef struct @{ - DiscriminatorType type; // le type de l'element interne - int maxelem; // le nombre d'elements autorises -@} TypeParam; - -class Versatile : public list< GenericType * > -@{ - public: - // Constructeur standard et destructeur - Versatile(); - virtual ~Versatile(); - - // Constructeur par recopie - Versatile(const Versatile & V); - - // Constructeur depuis le type de "base" - Versatile(long l); - Versatile(const string & s); - Versatile(const Couple & c); - - // Operateur d'affectation et de concatenation - // a partir d'un type de "base" - Versatile & operator = (const long l) - throw(TypeMismatchException); - Versatile & operator = (const string & ch) - throw(TypeMismatchException); - Versatile & operator +=(const string & ch) - throw(TypeMismatchException,ListIsFullException); - Versatile & operator , (const string & ch) - throw(TypeMismatchException,ListIsFullException); - Versatile & operator = (const Couple & cp) - throw(TypeMismatchException); - Versatile & operator +=(const Couple & cp) - throw(TypeMismatchException,ListIsFullException); - Versatile & operator , (const Couple & cp) - throw(TypeMismatchException,ListIsFullException); - - // Operateur d'affectation entre objets - Versatile & operator = (const Versatile & V) - throw(TypeMismatchException); - - // Conversion de type vers un type de "base" - operator long() const throw(TypeMismatchException); - operator string() const throw(TypeMismatchException); - operator Couple() const throw(TypeMismatchException); - string str() const throw(TypeMismatchException); - - // Operateur pour l'affichage sur un stream - friend ostream & operator << (ostream & os, const Versatile & ); - - // Positionnement et recuperation du type de l'element interne - void setType(DiscriminatorType) throw(TypeMismatchException); - DiscriminatorType getType() const; - - // Positionnement et recuperation du nombre d'elements internes - void setMaxSize(int i); - int getMaxSize() const; - - // Positionnement et recuperation du nom de l'objet - string getName() const; - void setName(const string & name); - - protected: - // Efface tous les elements internes de l'objet - virtual void eraseAll(); - - DiscriminatorType _discriminator; // type de l'element interne - int _maxsize; // nombre max d'elements internes - string _name; // nom de l'objet (sert pour les exceptions) - - private: - -@}; -@end example - - -@item Exemple -@example -@dots{} - -// On cree un objet Versatile non encore affecte (scalaire) -Versatile Vlong; - -// L'affectation d'un long lui donne le type LONG -Vlong = 1024L * 1024L * 1024L; -cout << "Versatile long (must be 1073741824) : " << Vlong << endl; - -// On cree un objet Versatile non encore affecte (scalaire) -Versatile Vstring; - -// L'affectation d'une string (const char * promu en string) -// lui donne le type STRING -Vstring = "UneChaine"; -cout << "Versatile string (must be UneChaine) : " << Vstring << endl; - -try - @{ - // L'affectation d'un autre type leve une exception. - // Il n'y a pas de retypage dynamique. - Vlong = ""; - cout << "ERR : No TypeMismatchException catched for Versatile long" - << endl; - @} -catch (TypeMismatchException & ex) - @{ - cout << "OK : TypeMismatchException catched for Versatile long" - << endl; - @} - -// Reaffectation avec le meme type -Vlong = 1024L * 1024L; -cout << "Versatile long (must be 1048576) : " << Vlong << endl; - -// On cree un objet Versatile non encore affecte (scalaire) ... -Versatile Vcat1; - -// ... que l'on transforme en liste (non limitee) -Vcat1.setMaxSize(0); - -// On affecte la premiere valeur ... -Vcat1 = "A"; - -// ... puis les suivantes par concatenation -Vcat1 += "B"; -Vcat1 += "C"; -Vcat1 += "D"; -Vcat1 += "E"; -cout << "Versatile string concatenation (must be A B C D E) : " - << Vcat1 << endl; - -// Idem que pour Vcat1, mais avec une limite a 5 elements dans la liste -Versatile Vcat2; -Vcat2.setMaxSize(5); -Vcat2 = "a", "b", "c", "d", "e"; -cout << "Versatile string concatenation (must be a b c d e) : " - << Vcat2 << endl; - -// On tronque les 2 derniers elements de la liste (il en reste 3) -Vcat2.setMaxSize(3); -cout << "Versatile string concatenation (must be a b c) : " - << Vcat2 << endl; - - -Versatile Vcopy2(Vcat2); -cout << "Versatile copy (must be a b c) : " << Vcopy2 << endl; - -Versatile Vaffect; -Vaffect = Vcat1; -cout << "Versatile affect (must be A B C D E) : " << Vaffect << endl; -Vaffect = Vcat2; -cout << "Versatile affect (must be a b c) : " << Vaffect << endl; - -try - @{ - // Retypage dynamique interdit - Vaffect = Vlong; - cout << "ERR : No TypeMismatchException catched for Versatile" - << endl; - @} -catch (TypeMismatchException & ex) - @{ - cout << "OK : TypeMismatchException catched for Versatile string" - << endl; - @} - -try - @{ - // Concatenation au dela de la limite interdit - Vcat2 += "En trop"; - cout << "ERR : No ListIsFullException catched for Versatile string" - << endl; - @} -catch (ListIsFullException & ex) - @{ - cout << "OK : ListIsFullException catched for Versatile string" - << endl; - @} - -// Les objets Versatile se comportent (presque) comme des objets -// standards du langage -long L = Vlong; -cout << "Long value of Versatile long (must be 1048576) : " - << L << endl; - -string S = Vstring; -cout << "String value of Versatile (must be EncoreUneAutreChaine):" - << S << endl; - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{Versatile()} - -Le constructeur par defaut fabrique un objet scalaire de type -@var{undefined} et de nom @samp{undefined}. - -@item -@b{~Versatile()} - -Le destructeur efface tout le contenu de l'objet si celui-ci avait ete affecte. - -@item -@b{Versatile(const Versatile & V)} - -Le constructeur par recopie duplique l'objet passe en argument ainsi que -les valeurs qu'il contient. Le nouvel objet est totalement independant -de son geniteur. - -@item -@b{Versatile(long l)@* -Versatile(const string & s)@* -Versatile(const Couple & c)} - -Ces constructeurs fabriquent des objets scalaires @emph{Versatile} a partir des -types de base passes en argument. Chaque objet acquerera definitivement -le type correspondant au type de base : @var{long} pour @samp{long}, -@var{string} pour @samp{string} et @var{couple} pour @samp{Couple}. - -@item -@b{Versatile & operator = (const long l) throw(TypeMismatchException)@* -Versatile & operator = (const string & ch) throw(TypeMismatchException)@* -Versatile & operator = (const Couple & cp) throw(TypeMismatchException)} - -Ces operateurs affectent ou reaffectent la valeur passee en argument a -l'objet. Le type de la valeur doit correspondre au type de l'objet si -celui-ci a deja ete affecte, sinon une exception @emph{TypeMismatchException} est -levee. @xref{Classe TypeMismatchException}. - -L'ancienne valeur de l'objet est perdue. - -@item -@b{Versatile & operator += (const string & ch) - throw(TypeMismatchException, ListIsFullException)@* -Versatile & operator , (const string & ch) - throw(TypeMismatchException, ListIsFullException)@* -Versatile & operator += (const Couple & cp) - throw(TypeMismatchException, ListIsFullException)@* -Versatile & operator , (const Couple & cp) - throw(TypeMismatchException, ListIsFullException)} - -Ces operateurs concatenent la valeur passee en argument a l'objet. Le -type de la valeur doit correspondre au type interne de l'objet si -celui-ci a deja ete affecte, sinon une exception @emph{TypeMismatchException} est -levee. @xref{Classe TypeMismatchException}. - -Si la taille maximale de la liste est depasse, une exception @emph{ListIsFullException} est -levee. @xref{Classe ListIsFullException}. - -@item -@b{Versatile & operator = (const Versatile & V) throw(TypeMismatchException)} - -L'operateur d'affectation duplique l'objet passe en argument dans -l'objet. Toutes les valeurs internes sont dupliquees de maniere a avoir -une independance totale entre les deux objets a l'issue de -l'affectation. - -Il est a noter qu'il est possible d'affecter a un objet un objet -possedant un type different, auquel cas l'objet courant change de type -pour acquerir celui de l'objet passe en argument. C'est le seul cas de -changement de type autorise pour un objet. - -@item -@b{operator long() const throw(TypeMismatchException)@* -operator string() const throw(TypeMismatchException)@* -operator Couple() const throw(TypeMismatchException)@* -string str() const throw(TypeMismatchException)} - -Ces operateur de conversion dans les types de base permettent de -recuperer la valeur interne de l'objet. Lorsque le type interne est -incompatible avec la conversion une exception @emph{TypeMismatchException} est -levee. @xref{Classe TypeMismatchException}. - -@item -@b{ostream & operator << (ostream & os, const Versatile & )} - -Cet operateur permet de voir le contenu de l'objet sur un flot de sortie. - -@item -@b{void setType(DiscriminatorType) throw(TypeMismatchException)} - -Cette methode change le type interne de l'objet en celui passe en -argument. Ceci n'est possible que pour un objet non encore affecte. Si -le nouveau type est different du type actuel une exception @emph{TypeMismatchException} est -levee. @xref{Classe TypeMismatchException}. - -@item -@b{DiscriminatorType getType() const} - -Cet accesseur renvoie le type interne de l'objet. - -@item -@b{void setMaxSize(int i)} - -Cette methode permet de changer le nombre d'elements que l'objet est -capable de stocker. Par defaut ce nombre est 1 a la construction de -l'objet, signifiant qu'il ne peut contenir qu'une seule valeur a la fois -(scalaire). - -Si ce nombre est superieur a 1 alors il represente une -limite qui ne pourra etre depassee par l'objet sans lever d'exception -@emph{ListIsFullException}. @xref{Classe ListIsFullException}. - -Si ce nombre vaut 0 (zero) alors il n'y a aucune limite superieure au -nombre d'element dans l'objet. - -@item -@b{int getMaxSize() const} - -Cet accesseur renvoie la taille maximale admise par l'objet. - -@item -@b{void setName(const string & name)} - -Cette methode permet de positionner le nom de l'objet. Par defaut ce nom -vaut @samp{undefined} a la construction de l'objet. - -Il est interessant de positionner le nom a une valeur significative -comme par exemple le nom de la variable contenant l'objet car lorsqu'une -exception est levee ce nom apparait en clair et aide au debugging. - -@item -@b{string getName() const} - -Cet accesseur renvoie le nom interne de l'objet. - -@end itemize - -@end itemize - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Exceptions, Classe APIInternalFailureException, Classe Versatile, Classes generiques -@comment node-name, next, previous, up -@page -@subsection Exceptions -@cindex exceptions - -La bibliotheque de classes Batch definit un certain nombre d'exceptions -qui sont levees par les classes lors d'evenements qui traduisent un -comportement anormal de la bibliotheque. - -@menu -* Classe APIInternalFailureException:: Erreur d'utilisation de l'API. -* Classe ConnexionFailureException:: Probleme de connexion de l'API. -* Classe GenericException:: Classe-mere de toutes les exceptions. -* Classe InvalidArgumentException:: Parametre errone d'une methode. -* Classe InvalidKeyException:: Clef erronee d'une map. -* Classe ListIsFullException:: Debordement de taille d'une liste. -* Classe NotYetImplementedException:: Methodes non encore implementee. -* Classe RunTimeException:: Erreur d'execution imprevue. -* Classe TypeMismatchException:: Probleme de conversion de type. -@end menu - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe APIInternalFailureException, Classe ConnexionFailureException, Exceptions, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection APIInternalFailureException -@findex APIInternalFailureException - -Cette exception est levee par les classes d'implementation de la -bibliotheque lorsqu'une erreur est detectee au moment de la -communication avec l'API du gestionnaire de batch. En general l'erreur -renvoyee par l'API est incluse dans le message de l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class APIInternalFailureException : public GenericException -@{ - public: - // Constructeur - APIInternalFailureException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{APIInternalFailureException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{APIInternalFailureException}. - -@end itemize - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe ConnexionFailureException, Classe GenericException, Classe APIInternalFailureException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection ConnexionFailureException -@findex ConnexionFailureException - -Cette exception est levee par les classes d'implementation de la -bibliotheque lorsqu'une erreur est detectee au moment de la -connexion au gestionnaire de batch. En general l'erreur -renvoyee par l'API de connexion est incluse dans le message de l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class ConnexionFailureException : public GenericException -@{ - public: - // Constructeur - ConnexionFailureException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{ConnexionFailureException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{ConnexionFailureException}. - -@end itemize - -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe GenericException, Classe InvalidArgumentException, Classe ConnexionFailureException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection GenericException -@findex GenericException - -Cette classe est generique comme son nom l'indique et definit une -interface commune pour toutes les exceptions de la -bibliotheque. - -Cette exception definit uniquement un constructeur et deux membres -publics constants : @emph{type} et @emph{message}. @xref{Classe -GenericException}. - - -@itemize @bullet{} -@item Entete - -@example -class GenericException -@{ - public: - const string type; // la nature de l'exception - const string message; // la raison de l'exception - - // Constructeur - GenericException(const string tp = "GenericException", - const string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{GenericException(const string tp = "GenericException", const string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le parametre -@emph{tp} qui contient generalement le nom de la classe. - -@end itemize - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe InvalidArgumentException, Classe InvalidKeyException, Classe GenericException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection InvalidArgumentException -@findex InvalidArgumentException - -Cette exception est levee par les classes de la bibliotheque lorsqu'un -parametre erronne est passe en argument a une methode. En general -le nom de l'arguement erronne est inclus dans le message de -l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class InvalidArgumentException : public GenericException -@{ - public: - // Constructeur - InvalidArgumentException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{InvalidArgumentException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{InvalidArgumentException}. - -@end itemize - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe InvalidKeyException, Classe ListIsFullException, Classe InvalidArgumentException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection InvalidKeyException -@findex InvalidKeyException - - -Cette exception est levee par les methodes de la classe @emph{Parametre} -lorsqu'une clef erronnee est utilisee. En general le nom de la clef -erronnee est inclus dans le message de l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class InvalidKeyException : public GenericException -@{ - public: - // Constructeur - InvalidKeyException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{InvalidKeyException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{InvalidKeyException}. - -@end itemize - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe ListIsFullException, Classe NotYetImplementedException, Classe InvalidKeyException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection ListIsFullException -@findex ListIsFullException - -Cette exception est levee par les methodes de la classe @emph{Versatile} -lorsque la taille maximale de la liste interne est depasse. En general -le nom de l'objet en erreur est inclus dans le message de l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class ListIsFullException : public GenericException -@{ - public: - // Constructeur - ListIsFullException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{ListIsFullException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{ListIsFullException}. - -@end itemize - -@end itemize - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe NotYetImplementedException, Classe RunTimeException, Classe ListIsFullException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection NotYetImplementedException -@findex NotYetImplementedException - -Cette exception est levee par les classes de la bibliotheque lorsqu'une -methode declaree mais non encore implementee est utilisee. En general -le nom de l'objet en erreur est inclus dans le message de l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class NotYetImplementedException : public GenericException -@{ - public: - // Constructeur - NotYetImplementedException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{NotYetImplementedException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{NotYetImplementedException}. - -@end itemize - -@end itemize - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe RunTimeException, Classe TypeMismatchException, Classe NotYetImplementedException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection RunTimeException -@findex RunTimeException - -Cette exception est levee par les classes de la bibliotheque lorsqu'une -erreur inconnue et imprevue apparait. Cette exception est le -comportement par defaut que doit gerer le gestionnaire d'exception en ce -qui concerne les classes de la bibliotheque. En general le nom de -l'objet en erreur est inclus dans le message de l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class RunTimeException : public GenericException -@{ - public: - // Constructeur - RunTimeException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{RunTimeException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{RunTimeException}. - -@end itemize - -@end itemize - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe TypeMismatchException, Classes specifiques, Classe RunTimeException, Exceptions -@comment node-name, next, previous, up -@page -@subsubsection TypeMismatchException -@findex TypeMismatchException - -Cette exception est levee par les methodes de la classe @emph{Versatile} -lorsque qu'une erreur de type est rencontree dans un objet. Ce genre -d'erreur survient lorsqu'on essaie d'affecter une valeur d'un type -different du type interne de l'objet @emph{Versatile} a ce meme objet, -ou bien lorsqu'on ajoute une valeur d'un type different a une liste. En -general le nom de l'objet en erreur est inclus dans le message de -l'exception. - -Cette exception herite de la classe @emph{GenericException} qui definit -uniquement un constructeur et deux membres publics constants : @emph{type} et -@emph{message}. @xref{Classe GenericException}. - -@itemize @bullet{} -@item Entete - -@example -class TypeMismatchException : public GenericException -@{ - public: - // Constructeur - TypeMismatchException(string msg = "undefined"); -@}; -@end example - - -@item Methodes -@itemize @minus{} -@item -@b{TypeMismatchException(string msg = "undefined")} - -Ce contructeur prend la chaine @emph{msg} comme message d'erreur a -renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le -membre public constant @emph{message}. - -Le membre public constant @emph{type} est initialise avec le nom de la -classe, soit @emph{TypeMismatchException}. - -@end itemize - -@end itemize - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classes specifiques, Classes PBS, Classe TypeMismatchException, Classes -@comment node-name, next, previous, up -@page -@section Classes specifiques -@cindex classes specifiques - -Afin de pouvoir se connecter aux gestionnaires de batch reels a travers -leurs API, les classes generiques ont ete derivees pour offrir une -implementation correspondant a l'interface qu'elles definissent. - -Pour traduire a la fois le fait que les nouvelles classes derivent d'une -classe generique et qu'elles sont une implementation d'une API -particuliere, on adopte la convention de nom suivante : la classe se -nomme comme sa classe generique mais est suffixee par le nom de l'API du -gestionnaire de batch, les deux termes etant separes par un caractere -@kbd{_} (souligne). - -Actuellement, seul le gestionnaire de batch OpenPBS, @xref{Prerequis}, est -supporte. Mais ce catalogue devrait s'enrichir par la suite. - -Les classes de la bibliotheque sont egalement accessibles a travers un -interpreteur Python, ce qui a necessite la creation de certaines classes -d'interface avec l'interpreteur. - -@menu -* Classes PBS:: Classes d'implementation pour OpenPBS -* Classes Python:: Classes d'interfacage avec Python. -@end menu - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classes PBS, Classe FactBatchManager_PBS, Classes specifiques, Classes specifiques -@comment node-name, next, previous, up -@page -@subsection Classes PBS -@cindex classes PBS - -Actuellement seules les classes @emph{BatchManager}, @emph{JobInfo} et -@emph{Job} ont besoin d'etre derivees pour implementer la communication -et l'interfacage avec l'API du gestionnaire de batch OpenPBS. - - -@menu -* Classe FactBatchManager_PBS:: Description de la classe FactBatchManager_PBS. -* Classe BatchManager_PBS:: Description de la classe BatchManager_PBS. -* Classe JobInfo_PBS:: Description de la classe JobInfo_PBS. -* Classe Job_PBS:: Description de la classe Job_PBS. -@end menu - - -@node Classe FactBatchManager_PBS, Classe BatchManager_PBS, Classes PBS, Classes PBS -@comment node-name, next, previous, up -@subsubsection FactBatchManager_PBS -@cindex FactBatchManager_PBS - -Cette classe derive de la classe generique @emph{FactBatchManager}, -@xref{Classe FactBatchManager}. - -Les objets de la classe @emph{BatchManager_PBS} realisent l'interface de -la bibliotheque avec l'API du gestionnaire de batch OpenPBS. - -@itemize @bullet{} -@item Entete - -@example -class FactBatchManager_PBS : public FactBatchManager -@{ -public: - // Constructeur et destructeur - FactBatchManager_PBS(); - virtual ~FactBatchManager_PBS(); - - virtual BatchManager_PBS * operator() (const char * hostname) const; - -protected: - -private: - -@}; -@end example - -@item Exemple - -@example -@dots{} - -// On instancie le catalogue de gestionnaires de batch -Batch::BatchManagerCatalog cata; - -// On cree une fabrique de BatchManager de type PBS -Batch::FactBatchManager & fbm = * cata("PBS"); - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{FactBatchManager_PBS()} - -Ce constructeur instancie un objet de la classe -@emph{FactBatchManager_PBS} et l'enregistre automatiquement aupres du -catalogue de fabrique. @xref{Classe BatchManagerCatalog}. - -Le type est positionne a la valeur PBS. - -@item -@b{~FactBatchManager_PBS()} - -Le destructeur ne fait rien de particulier. - -@item -@b{BatchManager_PBS * operator() (const char * hostname) const} - -Cet operateur renvoie un objet nouvellement cree de type -@emph{BatchManager_PBS} derivant de @emph{BatchManager} et oeuvrant sur -la machine @emph{hostname}. La destruction de l'objet est a la charge de -l'appelant. - -@end itemize - -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classe BatchManager_PBS, Classe JobInfo_PBS, Classe FactBatchManager_PBS, Classes PBS -@comment node-name, next, previous, up -@page -@subsubsection BatchManager_PBS -@cindex BatchManager_PBS - -Cette classe derive de la classe generique @emph{BatchManager}, -@xref{Classe BatchManager}. - -Les objets de la classe @emph{BatchManager_PBS} realisent l'interface de -la bibliotheque avec l'API du gestionnaire de batch OpenPBS. - -@itemize @bullet{} -@item Entete - -@example -class BatchManager_PBS : public BatchManager -@{ - public: - // Constructeur et destructeur - BatchManager_PBS(FactBatchManager * parent, - const char * host) throw(InvalidArgumentException); - virtual ~BatchManager_PBS(); - - // Recupere le nom du serveur par defaut - static string getDefaultServer(); - - // Recupere le l'identifiant d'un job deja soumis au BatchManager - virtual const JobId getJobIdByReference(const string & ref); - - // Methodes pour le controle des jobs : virtuelles pures - // soumet un job au gestionnaire - virtual const JobId submitJob(const Job & job); - - // retire un job du gestionnaire - virtual void deleteJob(const JobId & jobid); - - // suspend un job en file d'attente - virtual void holdJob(const JobId & jobid); - - // relache un job suspendu - virtual void releaseJob(const JobId & jobid); - - // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, - const Parametre & param, - const Environnement & env); - virtual void alterJob(const JobId & jobid, - const Parametre & param); - virtual void alterJob(const JobId & jobid, - const Environnement & env); - - // renvoie l'etat du job - virtual JobInfo queryJob(const JobId & jobid); - - // modifie un job en file d'attente - virtual void setParametre(const JobId & jobid, - const Parametre & param); - virtual void setEnvironnement(const JobId & jobid, - const Environnement & env); - - protected: - string _hostname; // serveur ou tourne le BatchManager - - private: - -@}; -@end example - -@item Exemple - -@example -@dots{} - -// On instancie le catalogue de gestionnaires de batch -Batch::BatchManagerCatalog cata; - -// On cree une fabrique de BatchManager de type PBS -Batch::BatchManager & myBM = (* cata("PBS"))("serveur.domaine.fr") - -// Maintenant, on peut utiliser toutes les fonctionnalites du -// gestionnaire de batch a travers le variable myBM - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{BatchManager_PBS(FactBatchManager * parent, -const char * host) throw(InvalidArgumentException)} - -Excepte un pointeur sur la fabrique qui a produit l'objet, le -constructeur accepte zero ou un argument de type @emph{string} decrivant -soit le nom de domaine completement qualifie (FQDN, @i{fully qualified -domain name}) du serveur de batch, soit son adresse IP dans un format -decimal "aaa.bbb.ccc.ddd". - -Si aucun parametre n'est passe au constructeur, celui-ci prend le -serveur par defaut tel que renvoye par la methode @emph{getDefaultServer}. - -Une resolution du nom ou de l'adresse peut etre realisee en fonction des -capacites de la plate-forme pour s'assurer que le serveur est connu et -joignable. En cas d'echec, une exception InvalidArgumentException est -levee. @xref{Classe InvalidArgumentException}. - -Ceci fait, une connexion est etablie avec le gestionnaire de batch qui -est maintenue jusqu'a destruction de l'objet. - -@item -@b{~BatchManager()} - -Le destructeur supprime la connexion precedemment etablie par le -constructeur lorsque celle-ci a reussi. - -@item -@b{const JobId submitJob(const Job & job)} - -Cette methode soumet le job passe en argument au gestionnaire de -batch. Etant donne que le job ne peut pas etre envoye tel quel puisqu'il -a un format generique au sein de la bibliotheque de classes Batch, cette -methode est chargee de le convertir dans un format adapte au -gestionnaire de batch sous-jacent. - -La methode opere ici une conversion du job de la classe @emph{Job} en @emph{Job_PBS}. - -Ce n'est que lorsque cette conversion est realisee que le job est soumis -au gestionnaire a travers son API. L'identifiant propose par le -gestionnaire est alors renvoye a l'appelant. Si la soumission echoue -pour une raison ou une autre, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - -@item -@b{void deleteJob(const JobId & jobid)} - -Cette methode retire le job dont l'identifiant est passe en argument de -la file d'attente du gestionnaire, ou bien l'arrete en cours -d'execution. Cette methode est inoperante sur des travaux deja termines, -auquel cas une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - - -@item -@b{void holdJob(const JobId & jobid)} - -Cette methode suspend le job dont l'identifiant est passe en argument au -sein de la file d'attente du gestionnaire. Cette methode est inoperante -sur des travaux en cours d'execution ou deja termines, ainsi que sur des -travaux deja suspendus. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - -@item -@b{void releaseJob(const JobId & jobid)} - -Cette methode relache un job precedemment suspendu en file -d'attente dont l'identifiant est passe en argument. Elle est inoperante -sur des travaux deja reclaches, en cours d'execution ou termines. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - - -@item -@b{void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)@* -void alterJob(const JobId & jobid, const Parametre & param)@* -void alterJob(const JobId & jobid, const Environnement & env)} - -Ces methodes permettent de modifier les parametres d'execution et -d'environnement d'un job dont l'identifiant est passe en -argument. @xref{Classe Parametre}. @xref{Classe Environnement}. Il -est important de noter que le job doit etre encore place en file -d'attente sinon la methode est inoperante. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - -@item -@b{JobInfo queryJob(const JobId & jobid)} - -Cette methode permet de recuperer les informations concernant le job -dont l'identifiant est passe en argument dans un objet de classe -@emph{JobInfo}. @xref{Classe JobInfo}. On y retrouve les parametres -d'execution et d'environnement du job tels qu'ils ont ete passes au -gestionnaire au moment de la soumission, ainsi que des informations -concernant l'execution du job comme par exemple la machine d'execution, -le temps consomme, la memoire consommee, etc. - -Il n'est pas toujours possible d'interroger un job deja termine. -En cas de probleme, une exception APIInternalFailureException est -levee. @xref{Classe APIInternalFailureException}. - - -@item -@b{const JobId getJobIdByReference(const string & ref)} - -Cette methode permet de recuperer au sein de la classe un identifiant de -job a partir d'une chaine de caracteres obtenue par un biais -externe. Cet identifiant pourra etre utilise par la suite au sein de la -biliotheque de classes pour controler le job comme s'il avait ete cree -et soumis depuis la biliotheque-meme. - -@item -@b{void setParametre(const JobId & jobid, const Parametre & param)} - -Cette methode n'est utile que pour l'interfacage avec Python, car Python -ne sait pas gerer la surcharge de methode, et de fait leve des -exceptions lors d'appels a de telles methodes. - -Elle est equivalente a la methode @samp{void alterJob(const JobId & jobid, const Parametre & param)}. - -@item -@b{void setEnvironnement(const JobId & jobid, const Environnement & env)} - -Cette methode n'est utile que pour l'interfacage avec Python, car Python -ne sait pas gerer la surcharge de methode, et de fait leve des -exceptions lors d'appels a de telles methodes. - -Elle est equivalente a la methode @samp{void alterJob(const JobId & jobid, const Environnement & env)}. - -@end itemize - - -@end itemize - -@c ---------------------- -@c ---------------------- -@c ---------------------- - - -@node Classe JobInfo_PBS, Classe Job_PBS, Classe BatchManager_PBS, Classes PBS -@comment node-name, next, previous, up -@page -@subsubsection JobInfo_PBS -@cindex JobInfo_PBS - -Un objet de classe @emph{JobInfo} represente l'ensemble des informations -disponibles sur un travail actif, c'est-a-dire soumis au gestionnaire de -batch, a un instant donne. - -Cet objet reprend des informations issues du job tel qu'il a ete soumis, -@xref{Classe Job}, mais aussi des informations produites par le -gestionnaire de batch a partir de la soumission et du transit du job en -son sein : nom de la queue dans laquelle le job est inscrit, duree -d'execution, date de soumission, etc. - -Ces informations sont disponibles aupres de l'utilisateur de la classe a -travers les objets @emph{Parametre} et @emph{Environnement} que l'objet -@emph{JobInfo} peut fournir. - -@itemize @bullet{} -@item Entete - -@example -class JobInfo_PBS : public JobInfo -@{ - public: - // Constructeur standard et destructeur - JobInfo_PBS(); - JobInfo_PBS(struct batch_status * stat_list, - bool tobedeleted = false); - virtual ~JobInfo_PBS(); - - // Constructeur par recopie - JobInfo_PBS(const JobInfo_PBS & jinfo); - - // Methodes pour l'interfacage avec Python (SWIG) - string __str__() const; // SWIG : affichage en Python - string __repr__() const; // SWIG : affichage en Python - - protected: - Parametre _param; // parametres du job - Environnement _env; // variables d'environnement du job - - private: -@}; -@end example - - -@item Exemple -@example -@dots{} (ici on cree un BatchManager bm et un Job job) - -// On soumet le job et on recupere un identifiant -JobId jobid = bm.submitJob(job); - -// Ce qui permet d'interroger l'etat du job en cours -// Nota : l'objet retourne est un JobInfo_PBS -JobInfo jinfo = jobid.queryJob(); - -@dots{} -@end example - -@item Methodes -@itemize @minus{} -@item -@b{JobInfo_PBS()} - -Ce constructeur cree un objet @emph{JobInfo_PBS} vide. - -@item -@b{~JobInfo_PBS()} - -Le destructeur libere l'espace memoire alloue pour l'objet si la -desollacation n'a pas eu deja lieu dans le constructeur. - -@item -@b{JobInfo_PBS(const JobInfo_PBS & jinfo)} - -Le constructeur par recopie produit un objet identique a celui passe en -argument. Les deux objets sont totalement independants l'un de l'autre. - -@item -@b{JobInfo_PBS(struct batch_status * stat_list, bool tobedeleted = false)} - -Ce constructeur recupere une liste chainee du type interne OpenPBS -@emph{struct batch_status *}, la parcoure et l'analyse pour en extraire -les informations utilisables par la bibliotheque de classes et les -stocker dans deux objets internes @emph{Parametre} et -@emph{Environnement}. - -Si le parametre @emph{tobedeleted} vaut @emph{true} alors la liste -chainee @emph{stat_list} sera desallouee a la fin du constructeur. Sinon -elle sera desalloue dans le destructeur au plus tard. - -@item -@b{string __str__() const} - -Cette methode n'est utile que pour l'interfacage avec Python. Elle -permet d'afficher l'etat de l'objet @emph{JobInfo}. - -@item -@b{string __repr__() const} - -Cette methode n'est utile que pour l'interfacage avec Python. Elle -permet d'afficher l'etat de l'objet @emph{JobInfo}. - -@end itemize - -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - - -@node Classe Job_PBS, Classes Python, Classe JobInfo_PBS, Classes PBS -@comment node-name, next, previous, up -@page -@subsubsection Job_PBS -@cindex Job_PBS - -Un objet de classe @emph{Job} possede une structure generique -potentiellement utilisable par tout gestionnaire de batch mais pas en -l'etat. Une conversion dans un format lisible par le gestionnaire doit -etre realisee. - -Ceci se fait en produisant a partir des donnees generiques de la classe -@emph{Job} des structures de donnees specifiques qui peuvent etre -directement passees a l'API du gestionnaire. - -La classe @emph{Job_PBS} se distingue donc de la classe @emph{Job} par son -constructeur et par des accesseurs specifiques qui produisent des -donnees lisibles par OpenPBS. - -Etant donnee la specificite de cette classe, elle ne devrait concerner -que les developpeurs de la bibliotheque de classes Batch. - -@itemize @bullet{} -@item Entete - -@example -class Job_PBS -@{ - public: - // Constructeurs et destructeur - Job_PBS(const Job & job); - virtual ~Job_PBS(); - - // Accesseurs - struct attropl * getAttributesOP(); - struct attrl * getAttributes(); - char * getScript(); - char * getDestination(); - - protected: - struct attropl * _p_attropl; // liste d'attributs + operateur - struct attrl * _p_attrl; // liste d'attributs - char * _script; // chemin d'acces au script du job - char * _destination; // queue dans laquelle le job est soumis - - private: - -@}; -@end example - - -@item Exemple -@example -@dots{} - -Parametre param; -Environnement env; - -@dots{} (ici on cree les parametres du job) - -Job job(param, env); - -// On fabrique un job specifique a OpenPBS a partir du job generique -// Ceci ne concerne en general pas l'utilisateur de la bibliotheque -Job_PBS jobpbs(job); - -@dots{} -@end example - -@item Methodes -@itemize @minus{} - -@item -@b{Job_PBS(const Job & job)} - -Le constructeur convertit les objets internes @emph{Parametre} et -@emph{Environnement} de l'objet passe en argument en un ensemble de -quatre structures C @emph{AttributesOP}, @emph{Attributes}, -@emph{Script} et @emph{Destination} directement utilisable par l'API de -OpenPBS. - -@item -@b{~Job_PBS()} - -Le destructeur libere simplement les espaces alloues pour les structures -@emph{AttributesOP}, @emph{Attributes}, @emph{Script} et -@emph{Destination}. - -@item -@b{struct attropl * getAttributesOP()} - -Cet accesseur retourne un pointeur sur la structure interne -@emph{AttributesOP} de l'objet. Cette structure n'est pas protogee -contre les modifications accidentelles de l'utilisateur. Par consequent -il est recommande d'eviter d'y apporter toute alteration sous peine de -dysfonctionnement. - -Pour la definition de la structure @emph{AttributesOP}, voir la -documentation OpenPBS. - -@item -@b{struct attrl * getAttributes()} - -Cet accesseur retourne un pointeur sur la structure interne -@emph{Attributes} de l'objet. Cette structure n'est pas protogee -contre les modifications accidentelles de l'utilisateur. Par consequent -il est recommande d'eviter d'y apporter toute alteration sous peine de -dysfonctionnement. - -Pour la definition de la structure @emph{Attributes}, voir la -documentation OpenPBS. - -@item -@b{char * getScript()} - -Cet accesseur retourne un parametre @emph{Script} qui est une chaine de -caracteres C contenant le chemin absolu (sur la machine d'execution) -du script a soumettre au gestionnaire de batch. - -Cette chaine n'est pas protegee contre les modifications accidentelles -de l'utilisateur. Il est donc recommande de ne pas y apporter de modification. - -@item -@b{char * getDestination()} - -Cet accesseur retourne un parametre @emph{Destination} qui est une chaine de -caracteres C contenant le nom de la queue, ou classe ou file selon les terminologies, -du gestionnaire de batch dans laquelle le job doit etre soumis. - -Cette chaine n'est pas protegee contre les modifications accidentelles -de l'utilisateur. Il est donc recommande de ne pas y apporter de modification. - - -@end itemize -@end itemize - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Classes Python, Classe PyVersatile, Classe Job_PBS, Classes specifiques -@comment node-name, next, previous, up -@page -@subsection Classes Python -@cindex classes Python - -L'integration de la bibliotheque de classes Batch dans l'interpreteur -Python a beaucoup progresse depuis la precedente version et se trouve -etre quasiment iso-fonctionelle avec le C++. - -Actuellement, l'interface avec Python s'appuie a la fois sur les -fonctionnalites de l'utilitaire SWIG, et sur la definition d'une classe -specifique qui permet de voir en Python la classe @emph{Versatile}. - -Certaines classes ont de plus des methodes specifiques pour le wrapping -Python qui simplifient grandement le developpement des classes -d'interface au detriment, il est vrai, d'une bonne independance entre -les langages. Ce choix n'est pas definitif et pourra etre revu si -l'occasion s'en presente. - -Quoi qu'il en soit toutes les classes de haut niveau sont interfacees en -Python sous le meme nom et proposent les memes methodes (sauf celles -surchargees en C++ qui sot parfois renommees pour lever -l'ambiguite). Pour ne pas refaire un expose detaille et fastidieux des -fonctionnalites Python de la bibliotheque de classes, il est propose de -retrouver les noms et la syntaxe de ces classe dans la partie -Utilisation de ce document. @xref{Utilisation}. - -@menu -* Classe PyVersatile:: Description de la classe PyVersatile. -@end menu - -@c ---------------------- -@c ---------------------- -@c ---------------------- - - -@node Classe PyVersatile, Utilisation, Classes Python, Classes Python -@comment node-name, next, previous, up -@page -@subsubsection PyVersatile -@cindex PyVersatile - - -La classe @emph{PyVersatile} derive de la classe @emph{Versatile} et -offre la possibilite de convertir un tel objet en objet Python et -@i{vice versa}. - - -@itemize @bullet{} -@item Entete - -@example -class PyVersatile : public Versatile -@{ - public: - // Constructeur a partir d'un objet Versatile - PyVersatile(const Versatile &); - - // Constructeur a partir d'un PyObject - PyVersatile(const PyObject *) throw(TypeMismatchException, - ListIsFullException, - InvalidArgumentException); - - // Conversion de type vers un PyObject - operator PyObject *() const; - - // Operateur d'affectation a partir d'un objet Versatile - PyVersatile & operator =(const Versatile &); - - protected: - - private: - -@}; -@end example - - -@item Exemple -@example -@dots{} - -// On cree un objet Versatile contenant -// une liste de chaine de caracteres -Versatile V; -V = "a", "b", "c"; - -// On convertit cet objet Versatile en PyVersatile -PyVersatile PyV(V); - -// De la on produit un objet Python -// qui est une liste de chaine de caracteres -PyObject * PyO = PyV; - -@dots{} -@end example - -@item Methodes -@itemize @minus{} - -@item -@b{PyVersatile(const Versatile &)} - -Ce constructeur convertit un objet @emph{Versatile} en objet @emph{PyVersatile}. - -@item -@b{PyVersatile(const PyObject *) throw(TypeMismatchException, ListIsFullException, InvalidArgumentException)} - -Ce constructeur convertit un objet Python passe en argument en un objet -@emph{PyVersatile}. - -Seuls certains objets Python peuvent etre convertis : les @emph{string} -et les @emph{long}, ainsi que les listes homogenes de ces types, ce qui -est coherent avec la nature de l'objet @emph{Versatile}. Si tel n'est -pas le cas, une exception Python est renvoyee a l'interpreteur. - - -@item -@b{operator PyObject *() const} - -Cet operateur convertit l'objet en objet Python. Selon le cas, l'objet -retourne est soit un scalaire soit une liste. L'objet retourne est -alloue dynamiquement et doit donc etre pris en charge par l'interpreteur. - -@item -@b{PyVersatile & operator =(const Versatile &)} - -L'affectation d'un objet @emph{Versatile} passe en argument est -similaire a l'affectation entre objets @emph{Versatile}. Les structures -de donnees internes initiales de l'objet sont effacees et remplacees par -une copie des donnees internes de l'objet passe en argument. Les deux -objets restent independants l'un de l'autre a l'issue de l'affectation. - -@end itemize -@end itemize - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Utilisation, Connexion, Classe PyVersatile, Top -@comment node-name, next, previous, up -@page -@chapter Utilisation -@cindex utilisation - -Ce chapitre presente les differentes actions qu'il est possible de -realiser avec les classes de la bilbiotheque. - -On presente un cas hypothetique ou un utilisateur voudrait soumettre et -controler un job depuis un code C++. Les sections suivantes decrivent -les operations a faire ainsi que leur action sur le travail soumis. - -@menu -* Connexion:: Creation d'un gestionnaire de batch. -* Creation:: Declaration d'un job (travail). -* Soumission:: Demande d'execution du job. -* Interrogation:: Recuperation des informations sur le job. -* Destruction:: Arret du job en cours. -* Suspension:: Suspension du job en file d'attente. -* Reprise:: Liberation du job en file d'attente. -* Modification:: Modification d'un job en file d'attente. -@end menu - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Connexion, Creation, Utilisation, Utilisation -@comment node-name, next, previous, up -@section Connexion -@cindex connexion -@cindex deconnexion - -La premiere etape avant toute utilisation pratique des classes de la -bibliotheque consiste a se connecter a un gestionnaire de batch. - -Ce concept de connexion est purement interne a la bibliotheque car il -est tout a fait possible d'imaginer le controle de jobs a travers l'API -d'un gestionnaire sans jamais etablir ni maintenir une quelconque -connexion avec celui-ci. D'autres par contre reclament l'etablissement -d'une connexion. - -Quoiqu'il en soit ceci n'est pas genant et l'etablissement et le -maintien de la connexion avec le gestionnaire de batch se fait par la -creation d'un objet de classe @emph{BatchManager} ou d'une classe -derivee. - -En pratique, la classe @emph{BatchManager} se comporte comme une -interface et seules les classes d'implementation derivee doivent etre -instanciees. - -Si l'on prend le cas d'un serveur @samp{serveur.domaine.fr} supportant -un gestionnaire de batch OpenPBS, on peut s'y connecter de la maniere -suivante : - -@itemize @bullet{} -@item Exemple C++ : - -@example -BatchManagerCatalog cata; -BatchManager_PBS & bm = * (* cata('PBS'))("serveur.domaine.fr"); -@end example - -@item Exemple Python: - -@example -cata = BatchManagerCatalog() -bm = cata('PBS')('serveur.domaine.fr') -@end example - -@end itemize - -Tant que l'objet @emph{bm} sera present --- tant que son destructeur -n'aura pas ete appele --- la connexion sera maintenue. La deconnexion -aura lieu a la destruction de l'objet. - -@xref{Classe BatchManager}. -@xref{Classe BatchManager_PBS}. - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Creation, Soumission, Connexion, Utilisation -@comment node-name, next, previous, up -@section Creation -@cindex creation - -La creation du job est l'etape qui precede toute soumission. Elle -necessite de decrire d'un maniere ou d'un autre ce que l'on va demander -a la machine d'executer. - -Pour cela on passe par deux objets intermediaires qui sont l'objet -@emph{Parametre} et l'objet @emph{Environnement}. - -Le minimum a preciser est en general le chemin absolu d'acces a -l'executable, quoique ceci depende fortement de la configuration du -gestionnaire auquel on se connecte. Celui-ci peut reclamer des -parametres supplementaires. - -Pour connaitre l'ensemble des parametres disponibles : @xref{Classe -Parametre}. - -On supposera dans cet exemple que l'application en question sait -reconnaitre une variable d'environnement @var{myapp_loglevel} qui prend -une valeur numerique correspondant au niveau d'information affiche en -sortie. - -Cette application imaginaire utilise egalement trois fichiers : - -@itemize @bullet{} -@item -un fichier d'entree nomme @file{Cas1.data} sur la machine locale qu'il -faudra renommer @file{fort.9} pour que l'application puisse le lire -(notre application imaginaire est ecrite en FORTRAN et attend un fichier -d'entree sur son descripteur 9); - -@item -un fichier de sortie standard que l'on voudra recuperer sous le nom -@file{Cas1.out}; - -@item -un fichier d'erreur standard que l'on voudra recuperer sous le nom -@file{Cas1.err}. - -@end itemize - -Le job est ensuite cree simplement a l'aide des deux objets precedents. - -@itemize @bullet{} -@item Exemple C++ : - -@example -Parametre param; -param[EXECUTABLE] = "/home/user/my_app/bin/exec_app.sh"; -param[INFILE] = Couple("/home/user/my_app/data/Cas1.data","fort.9"); -param[OUTFILE] = Couple("/home/user/my_app/data/Cas1.out", "stdout"), - Couple("/home/user/my_app/data/Cas1.err", "stderr"); - -Environnement env; -env["MYAPP_LOGLEVEL"] = "3"; - -Job job(param, env); -@end example - -@item Exemple Python: - -@example -param = @{@} -param["EXECUTABLE"] = "/home/user/my_app/bin/exec_app.sh" -param["INFILE"] = [ ("/home/user/my_app/data/Cas1.data","fort.9") ] -param["OUTFILE"] = [ ("/home/user/my_app/data/Cas1.out", "stdout"), - ("/home/user/my_app/data/Cas1.err", "stderr") ] - -env = @{@} -env["MYAPP_LOGLEVEL"] = "3" - -job = Job() -job.setParametre(param) -job.setEnvironnement(env) -@end example - -@end itemize - - -@xref{Classe Parametre}. -@xref{Classe Environnement}. -@xref{Classe Job}. - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Soumission, Interrogation, Creation, Utilisation -@comment node-name, next, previous, up -@section Soumission -@cindex soumission -@findex submitJob - -Une fois le job cree, il est alors tres simple de le soumettre au -gestionnaire de batch en passant par l'intermediaire de l'objet -@emph{BatchManager} cree precedemment. - -Cette soumission produira un objet @emph{JobId} qui servira a controler -le job par la suite. - -Cependant des exceptions peuvent etre levees au moment de la soumission -et il convient de fournir un gestionnaire d'exception pour gerer -proprement ces incidents. - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - const JobId jobid = bm.submitJob(job); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -try : - jobid = bm.submitJob(job) -except : - @dots{} -@end example - -@end itemize - - -@xref{Classe Job}. -@xref{Classe JobId}. -@xref{Exceptions}. - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Interrogation, Destruction, Soumission, Utilisation -@comment node-name, next, previous, up -@section Interrogation -@cindex interrogation -@findex queryJob - -La fourniture d'un objet @emph{JobId} permet d'avoir tout controle sur -le job en cours. En particulier il est possible de l'interroger : -ceci generera un objet @emph{JobInfo} qui donnera l'ensemble des -informations disponibles sur l'etat du job aupres du gestionnaire de -batch. - -Ces informations sont disponibles a travers deux objets internes de -classes @emph{Parametre} et @emph{Environnement}, les memes que pour la -classe @emph{Job}, mais modifies et completes avec les donnees les plus -a jour du gestionnaire de batch. - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - const JobInfo jinfo = jobid.queryJob(); - - Parametre newparam = jinfo.getParametre(); - Environnement newenv = jinfo.getEnvironnement(); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -try : - jobinfo = jobid.queryJob() - - newparam = jinfo.getParametre() - newenv = jinfo.getEnvironnement() -except : - @dots{} -@end example - -@end itemize - - -@xref{Classe JobId}. -@xref{Classe JobInfo}. -@xref{Exceptions}. - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Destruction, Suspension, Interrogation, Utilisation -@comment node-name, next, previous, up -@section Destruction -@cindex destruction -@cindex suppression -@findex deleteJob - - -Il est possible de detruire un job que celui-ci soit encore en file -d'attente ou bien que son execution ait deja commence, auquel cas elle -serait immediatement interrompue. - - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - jobid.deleteJob(); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -try : - jobid.deleteJob() - -except : - @dots{} -@end example - -@end itemize - - -@xref{Classe JobId}. -@xref{Exceptions}. - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Suspension, Reprise, Destruction, Utilisation -@comment node-name, next, previous, up -@section Suspension -@cindex suspension -@findex holdJob - -La suspension consiste a figer en file d'attente un job qui n'aurait pas -encore commence son execution. Il n'est pas possible de suspendre un job -qui s'execute. - -Il y a deux manieres de suspendre un job en file d'attente : -@itemize @bullet{} -@item en utilisant la methode @samp{holdJob}; -@item en modifiant les parametres du job a l'aide de la methode @samp{alterJob}. -@end itemize - -Exemple 1 : - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - jobid.holdJob(); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -try : - jobid.holdJob() - -except : - @dots{} -@end example - -@end itemize - -Exemple 2 : - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - Parametre altparam; - altparam[HOLD] = 1; - jobid.alterJob(altparam); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -// Compte tenu de la surcharge d'operateur, cet exemple peut ne pas -// fonctionner encore -try : - altparam = @{@} - altparam["HOLD"] = 1 - jobid.alterJob(altparam) - -except : - @dots{} -@end example - -@end itemize - - - -@xref{Classe JobId}. -@xref{Exceptions}. -@xref{Reprise}. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Reprise, Modification, Suspension, Utilisation -@comment node-name, next, previous, up -@section Reprise -@cindex reprise -@findex releaseJob - -La reprise est l'operation inverse de la suspension en ceci qu'elle -libere un job precedemment suspendu en file d'attente. Le job continuera -alors son cheminement normal au sein du gestionnaire de batch. - -Il y a deux manieres de suspendre un job en file d'attente : -@itemize @bullet{} -@item en utilisant la methode @samp{releaseJob}; -@item en modifiant les parametres du job a l'aide de la methode @samp{alterJob}. -@end itemize - -Exemple 1 : - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - jobid.releaseJob(); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -try : - jobid.releaseJob() - -except : - @dots{} -@end example - -@end itemize - -Exemple 2 : - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - Parametre altparam; - altparam[HOLD] = 0; - jobid.alterJob(altparam); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -// Compte tenu de la surcharge d'operateur, cet exemple peut ne pas -// fonctionner encore -try : - altparam = @{@} - altparam["HOLD"] = 0 - jobid.alterJob(altparam) - -except : - @dots{} -@end example - -@end itemize - - -@xref{Classe JobId}. -@xref{Exceptions}. -@xref{Suspension}. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Modification, Installation de la bibliotheque, Reprise, Utilisation -@comment node-name, next, previous, up -@section Modification -@cindex modification -@findex alterJob - -Il est possible de modifier tout ou partie des parametres et des -variables d'un job a condition que celui-ci soit encore en file -d'attente. Un job dont l'execution a deja debute devient inalterable, -sauf a l'arreter definitvement. - -La modification se fait en declarant un objet @emph{Parametre} et/ou un -objet @emph{Environnement} contenant l'ensemble des alterations a -apporter a la description du job. Ces alterations peuvent porter sur des -parametres ou des variables deja definies ou non. - -En reprenant le cas du job imaginaire utilise jusqu'ici, on peut -souhaiter changer le script qui tient lieu d'executable car le precedent -etait incomplet, modifier le niveau d'affichage de la log et ajouter une -variable nommee @var{myapp_debug} qui indique au code de passer en mode -debug. Ceci pourrait se faire de la maniere suivante : - -@itemize @bullet{} -@item Exemple C++ : - -@example -try @{ - Parametre altparam; - altparam[EXECUTABLE] = "/home/user/my_app/bin/exec_app.sh"; - - Environnement altenv; - altenv["MYAPP_LOGLEVEL"] = "4"; - altenv["MYAPP_DEBUG"] = "1"; - jobid.alterJob(altparam, altenv); - -@} catch (GenericException & ex) @{ - @dots{} -@} -@end example - -@item Exemple Python: - -@example -// Compte tenu de la surcharge d'operateur, cet exemple peut ne pas -// fonctionner encore -try : - altparam = @{@} - altparam["EXECUTABLE"] = "/home/user/my_app/bin/exec_app.sh" - - altenv = @{@} - altenv["MYAPP_LOGLEVEL"] = "4"; - altenv["MYAPP_DEBUG"] = "1"; - - jobid.alterJob(altparam, altenv) - -except : - @dots{} -@end example - -@end itemize - - -@xref{Classe JobId}. -@xref{Exceptions}. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Installation de la bibliotheque, Prerequis, Modification, Top -@comment node-name, next, previous, up -@chapter Installation -@cindex installation - -Cette section montre comment installer l'ensemble de la bibliotheque de -classes Batch sur une machine Unix. - -@menu -* Prerequis:: -* Installation rapide:: -* Configuration:: -* Compilation:: -* Compilation de la documentation:: -* Tests:: -* Installation:: -@end menu - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Prerequis, Installation rapide, Installation de la bibliotheque, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Prerequis -@cindex prerequis - -@unnumberedsubsec GCC/G++ - -A l'heure actuelle, la bibliotheque de classes Batch est developpee en -C++ et necessite de fait un compilateur pour ce langage. GCC/G++ -version 2.95.3 (@inforef{Top, ,gcc} pour plus de detail) ou une version -ulterieure est un choix judicieux. - -@unnumberedsubsec Gestionnaires de batch - -Comme la bibliotheque utilise les fonctionnalites de certains -gestionnaires de batch, il est indispensable de pouvoir acceder aux -bibliotheques et aux fichiers d'entete de ces produits, ou du moins des -produits dont on se servira par la suite, ceci pour pouvoir communiquer -a travers l'API qu'ils ont developpe. - -Le cas le plus simple est d'avoir le produit directement installe sur la -machine sur laquelle sera compilee la bibliotheque de classes Batch. - -@unnumberedsubsubsec OpenPBS -@cindex OpenPBS -@cindex PBS - -A ce jour, seul le gestionnaire de batch PBS (OpenPBS et PBS Pro) est -supporte (voir le site officiel @uref{http://www.openpbs.org}). Il doit -avoir une version au moins egale a 2.3.16. - -@unnumberedsubsubsec LSF -@cindex LSF - -Il est prevu d'avoir un support de LSF dans les mois qui viennent. - -@unnumberedsubsubsec LoadLeveler -@cindex LoadLeveler - -Il est prevu d'avoir un support de LoadLeveler mais dans un futur plus -lointain en fonction de la disponibilite du produit mais surtout d'une -machine sur lequel il serait installe. - -@unnumberedsubsubsec Sun Grid Engine - -Ce choix-la est beaucoup plus hypothetique, et risque bien de ne jamais -etre mene a bien. - -@unnumberedsubsubsec Rsh/Ssh - -Il est prevu de simuler le fonctionnement d'un gestionnaire de batch a -l'aide de commandes Unix Rsh et Ssh dans la mesure de leurs capacites -lorsque qu'il n'est pas possible d'avoir un gestionnaire de batch sur -certaines machines ou de s'y connecter (par exemple lorsqu'on traverse -un coupe-feu). - -@unnumberedsubsec Python -@cindex Python - -Les classes de haut-niveau de la bibliotheque de classes Batch disposent -d'une interface en Python qui leur permet d'etre utilisables dans ce -langage. L'usage de cette fonctionnalite necessite d'avoir a disposition -une version de Python (voir le site officiel -@uref{http://www.python.org}) au moins egale a 2.2. - -@unnumberedsubsec SWIG -@cindex SWIG - -De plus l'interfacage avec Python est automatise a l'aide de -l'utilitaire SWIG (voir le site officiel @uref{http://www.swig.org}) qui -transcrit les definitions des classes C++ en classes Python. Il faut -pour cela disposer de la version 1.3.17 ou ulterieure. - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Installation rapide, Configuration, Prerequis, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Installation rapide -@cindex installation rapide - -Il faut commencer par decompresser le fichier @file{.tar.gz} ou -@file{.tgz} et descendre dans le repertoire qu'il a cree : - -@example -$ tar -xzvf Batch-@value{VERSION}.tar.gz -$ cd Batch-@value{VERSION} -@end example - -Pour ceux qui sont vraiment presses, le minimum requis est : - -@example -$ ./configure -$ make -$ make install -@end example - -Pour ceux qui ont le temps de lire la suite, les sections suivantes -decrivent plus en detail ces etapes et les differents tests que l'on -peut mener. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Configuration, Compilation, Installation rapide, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Configuration -@cindex configuration - -La phase de configuration, tres classique dans le domaine des logiciels -libres, est basee sur les produits autoconf (voir @inforef{Top, -,autoconf}), automake (voir @inforef{Top, ,automake}) et libtool (voir -@inforef{Top, ,libtool}). - -La configuration est faite a l'aide du programme @file{configure} -present dans le repertoire racine de la bibliotheque de classes -Batch. Ce programme analyse l'ensemble des elements du systeme sur -lequel se deroulera la compilation pour determiner les parametres -optimaux et la presence de tous les produits necessaires a la -compilation. - -On n'oubliera pas de se referer a la documentation de @file{configure} -notamment pour determiner l'emplacement definitif de l'installation : - -@example -$ ./configure --help -@end example - -C'est aussi au cours de cette phase de configuration qu'il est -indispensable de preciser avec quelles options la bibliotheque doit etre -generee. En particulier il est necessaire d'indiquer avec quel(s) -gestionnaire(s) de batch doit se faire la compilation de maniere a avoir -acces a l'API. - -Par exemple dans le cas de OpenPBS, il est necessaire de preciser : - -@example -$ ./configure --with-openpbs=/path/to/PBS/root/dir -@end example - -Le chemin @file{/path/to/PBS/root/dir} est optionnel si la variable -d'environnement @var{openpbs} est definie avec cette meme valeur. - -De meme pour Python que l'on indique de la maniere suivante : - -@example -$ ./configure --with-python=/path/to/Python/root/dir -@end example - -ou bien a l'aide de la variable d'environnement @var{pythonhome}. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Compilation, Compilation de la documentation, Configuration, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Compilation -@cindex compilation - -La compilation proprement dite n'appelle pas de remarque particuliere : - -@example -$ make -@end example - -On n'oubliera pas d'utiliser les focntionnalites de chaque @file{make}, -comme par exemple la compilation parallele pour reduire les temps de -compilation (voir @inforef{Top, ,make}). - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Compilation de la documentation, Tests, Compilation, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Compilation de la documentation -@cindex compilation de la documentation - -Normalement la documentation est automatiquement compilee lors de la -compilation de la bibliotheque, mais uniquement sous la forme d'un -fichier @file{.info}. Il est egalement possible d'obtenir un fichier -@file{.dvi} qui permettra de generer d'autres formats comme le -PostScript (fichier @file{.ps}) ou le PDF (fichier @file{.pdf}), ou bien -une documentation sous forme HTML (fichier @file{.html}). - -Pour fabriquer le fichier @file{.dvi} il faut executer la commande -suivante : - -@example -$ make dvi -@end example - -Il est alors possible de produire une documentation sous forme -PostScript : - -@example -$ cd doc -$ dvips Batch.dvi -o Batch.ps -@end example - -ou PDF : - -@example -$ cd doc -$ dvipdf Batch.dvi Batch.pdf -@end example - -Pour la documentation HTML, on l'obtient a l'aide de le commande -suivante : - -@example -$ cd doc -$ texi2html -split_node Batch.texi -@end example - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Tests, Installation, Compilation de la documentation, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Tests -@cindex tests - -@unnumberedsubsec Tests de pre-installation - -La bibliotheque de classes Batch dispose d'un ensemble de tests -unitaires pour verifier le fonctionnement de chaque classe -individuellement. Ces tests ne sont pas compiles lors de la compilation -de la bibliotheque; ils ne le sont qu'au moment du test. - -Les tests sont executes de la maniere suivante : - -@example -$ make check -@end example - -A la fin des tests, un compte rendu est fait qui avertit l'utilisateur -des tests reussis et des echecs rencontres. Chaque test peut etre rejoue -individuellement en se placant dans le repertoire @file{test} et en -executant les tests manuellement comme par exemple : - -@example -$ cd test -$ ./t_Versatile.sh -@end example - -@unnumberedsubsec Tests de post-installation - -Certains tests ne sont pas executes lorsque la commande @file{make -check} est lancee car ceux-ci necessitent l'installation prealable de -certains fichiers qui ne l'ont pas encore ete, l'installation definitive -n'ayant pas eu lieu encore. C'est pour cela que ces tests ne doivent et -ne peuvent etre lances qu'une fois l'installation terminee. @xref{Installation}. - -Il faut pour cela executer : - -@example -$ make installcheck -@end example - -De la meme maniere que pour les tests de pre-installation, une compte -rendu est fait et les tests defaillants peuvent etre rejoues -manuellement pour determiner le probleme. - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Installation, Divers, Tests, Installation de la bibliotheque -@comment node-name, next, previous, up -@section Installation -@cindex installation - -L'installation est la mise a disposition definitive dans le systeme de -la bibliotheque de classes Batch. C'est la derniere etape de la -procedure apres la configuration et la compilation. - -On l'execute de la maniere suivante : - -@example -$ make install -@end example - -Tous les fichiers compiles, la bibliotheque et les fichiers d'entete -sont installes dans le repertoire definitif. Les fichiers de test de -post-installation sont egalement copies (@xref{Tests}.) ainsi que la -documentation. - - - - - - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Divers, Index, Installation, Top -@comment node-name, next, previous, up -@chapter Divers -@cindex divers - - - - - -@c ---------------------- -@c ---------------------- -@c ---------------------- - -@node Index, Top , Divers, Top -@comment node-name, next, previous, up -@unnumbered Index - -@heading Index des concepts -@printindex cp - -@heading Index des fonctions et des methodes -@printindex fn - -@bye - diff --git a/doc/salome/batch.dox b/doc/salome/batch.dox deleted file mode 100644 index 7e0e4e29b..000000000 --- a/doc/salome/batch.dox +++ /dev/null @@ -1,10 +0,0 @@ -/*! - -\page batch_page Batch - - Batch documentation - -*/ - - - diff --git a/doc/salome/gui/Makefile.am b/doc/salome/gui/Makefile.am index aad10ecc2..4b12d80d3 100644 --- a/doc/salome/gui/Makefile.am +++ b/doc/salome/gui/Makefile.am @@ -1,14 +1,11 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am -usr_docs: doxyfile ../Batch.html +usr_docs: doxyfile echo "Running doxygen in directory: "`pwd`; \ - $(DOXYGEN) $< ; \ - cp -rf ../Batch.html KERNEL + $(DOXYGEN) $< ; docs: usr_docs -info_TEXINFOS = ../Batch.texi - install-data-local: usr_docs $(INSTALL) -d $(DESTDIR)$(docdir)/gui cp -rp KERNEL $(DESTDIR)$(docdir)/gui diff --git a/doc/salome/gui/doxyfile.in b/doc/salome/gui/doxyfile.in index b81ddc6ed..a0f94189b 100644 --- a/doc/salome/gui/doxyfile.in +++ b/doc/salome/gui/doxyfile.in @@ -91,7 +91,7 @@ INPUT = \ FILE_PATTERNS = *.dox *.idl *.hxx *.cxx *.py RECURSIVE = YES -EXCLUDE = @top_srcdir@/doc/salome/batch.dox +EXCLUDE = EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXAMPLE_PATH = @top_srcdir@/doc/salome/examples diff --git a/doc/salome/main.dox b/doc/salome/main.dox index 7861f0e77..34311ed4f 100644 --- a/doc/salome/main.dox +++ b/doc/salome/main.dox @@ -55,7 +55,6 @@ - \subpage kernel_salome - \subpage dsc_page : DSC documentation page. - \subpage salome_file_page : Salome_file documentation page. - - Batch documentation */ diff --git a/doc/salome/tui/pythfilter.py b/doc/salome/tui/pythfilter.py index 4a7f180c2..e6d0450f7 100644 --- a/doc/salome/tui/pythfilter.py +++ b/doc/salome/tui/pythfilter.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/idl/Calcium_Ports.idl b/idl/Calcium_Ports.idl.in similarity index 78% rename from idl/Calcium_Ports.idl rename to idl/Calcium_Ports.idl.in index 9f1096498..7556d945d 100644 --- a/idl/Calcium_Ports.idl +++ b/idl/Calcium_Ports.idl.in @@ -19,7 +19,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File : Calcium_Ports.idl +// File : SALOME_Ports.idl // Author : Eric Fayolle, EDF // #ifndef _CALCIUM_PORTS_IDL_ @@ -27,13 +27,8 @@ #include "SALOME_Ports.idl" -/*! \file Calcium_Ports.idl \brief interfaces for Calcium ports -*/ - module Ports { -/*! \brief module that contains interfaces to define Calcium ports -*/ module Calcium_Ports { const long UNLIMITED_STORAGE_LEVEL = -70; @@ -51,17 +46,30 @@ module Ports { 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; + typedef sequence seq_long; + typedef sequence seq_long_long; + typedef sequence< @CALCIUM_IDL_INT_F77@ > seq_integer; + + typedef sequence seq_float; + typedef sequence seq_double; + typedef sequence seq_string; + typedef sequence seq_boolean; + typedef seq_float seq_complex; + //Fortran int size conforming port interface Calcium_Integer_Port : Calcium_Port { + void put (in seq_integer data, in double time, in long tag); + }; + + interface Calcium_Intc_Port : Calcium_Port { void put (in seq_long data, in double time, in long tag); }; + interface Calcium_Long_Port : Calcium_Port { + void put (in seq_long_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); }; diff --git a/idl/Makefile.am b/idl/Makefile.am index 6da3cef76..744d555d5 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -26,7 +26,7 @@ # include $(top_srcdir)/salome_adm/unix/make_common_starter.am -AM_CXXFLAGS = -fPIC +AM_CXXFLAGS += -fPIC BASEIDL_FILES = \ SALOME_Exception.idl \ @@ -46,7 +46,7 @@ BASEIDL_FILES = \ nstest.idl \ DSC_Engines.idl \ SALOME_Ports.idl \ - Calcium_Ports.idl \ + SALOME_PyNode.idl \ Palm_Ports.idl \ SALOME_PACOExtension.idl \ SALOME_ParamPorts.idl @@ -71,7 +71,8 @@ EXTRA_DIST= $(BASEIDL_FILES) $(MPIIDL_FILES) $(OTHER_IDL_FILES) \ SALOME_PACOExtension.xml SALOME_ParamPorts.xml # This variable defines the files to be installed -salomeidl_DATA = $(IDL_FILES) +salomeidl_DATA = $(IDL_FILES) +nodist_salomeidl_DATA = Calcium_Ports.idl # Sources built from idl files # BUILT_SOURCE = first thing done on make all @@ -95,6 +96,7 @@ BASEIDL_SOURCES =\ nstestSK.cc \ DSC_EnginesSK.cc \ SALOME_PortsSK.cc \ + SALOME_PyNodeSK.cc \ Calcium_PortsSK.cc \ Palm_PortsSK.cc \ SALOME_PACOExtensionSK.cc \ @@ -106,7 +108,7 @@ DYNIDL_SRCS = \ 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 SALOME_PACOExtensionDynSK.cc SALOME_ParamPortsDynSK.cc + LoggerDynSK.cc SALOME_PACOExtensionDynSK.cc SALOME_ParamPortsDynSK.cc SALOME_PyNodeDynSK.cc MPIIDL_SOURCES = \ SALOME_MPIObjectSK.cc \ @@ -212,8 +214,8 @@ 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} +nodist_idl_DATA = ${XML} ${IDL_PACO} Calcium_Ports.idl +nodist_salomeinclude_HEADERS = ${INCLUDES_PACO} BUILT_SOURCES = $(IDL_SOURCES) $(PAR) $(PAR_INCLUDES) @@ -226,54 +228,49 @@ SALOME_ParamPortsPaCO.idl SALOME_ParamPortsPaCO.hxx SALOME_ParamPortsPaCO.cxx : lib_LTLIBRARIES = libSalomeIDLKernel.la $(PAR_LIB) nodist_libSalomeIDLKernel_la_SOURCES = $(IDL_SOURCES) $(DYNIDL_SRCS) -libSalomeIDLKernel_la_CPPFLAGS =-I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h \ - -I$(top_builddir)/idl \ +libSalomeIDLKernel_la_CPPFLAGS =-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)/salome_adm/unix -include SALOMEconfig.h \ - -I$(top_builddir)/idl \ +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@ -Wba -I$(top_builddir)/salome/idl -IDLPYFLAGS = @IDLPYFLAGS@ +IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(srcdir) -I$(top_builddir)/salome/idl +IDLPYFLAGS = @IDLPYFLAGS@ -I$(srcdir) # potential problem on parallel make on the following - multiple outputs SUFFIXES = .idl .hh SK.cc .idlSK.cc: - $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + $(IDL) $(IDLCXXFLAGS) $< SK.cc.hh: #Dummy rule to replace the following one (for parallel make) #.idl.hh: -# $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< +# $(IDL) $(IDLCXXFLAGS) $< if WITH_PACO_PARALLEL %PaCO.idl %PaCO.hxx %PaCO.cxx : %.idl %.xml - $(OMNIORB_IDL) -p@PACOPATH@/lib/python -bpaco -Wb$(top_srcdir)/idl/$*.xml,$(srcdir):@PACOPATH@/idl $(top_srcdir)/idl/$*.idl + $(IDL) -p@PACOPATH@/lib/python -bpaco -Wb$(top_srcdir)/idl/$*.xml,$(srcdir):@PACOPATH@/idl $(top_srcdir)/idl/$*.idl -%.hxx: %.idl - $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) -Wbh=.hxx -Wbs=.cxx $< +.idl.hxx: + $(IDL) $(IDLCXXFLAGS) -Wbh=.hxx -Wbs=.cxx $< endif -install-exec-local: $(IDL_FILES:%=$(top_srcdir)/idl/%) +install-exec-local: $(IDL_FILES:%=$(top_srcdir)/idl/%) Calcium_Ports.idl $(INSTALL) -d $(DESTDIR)$(salomepythondir) ls $^ | while read file; do \ - $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \ + $(IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \ done if WITH_PACO_PARALLEL ls $(top_builddir)/idl/*.idl | while read file; do \ - $(OMNIORB_IDL) $(IDLPYFLAGS) -I$(top_srcdir)/idl -I@PACOPATH@/idl -C$(DESTDIR)$(salomepythondir) $$file ; \ + $(IDL) $(IDLPYFLAGS) -I$(top_srcdir)/idl -I@PACOPATH@/idl -C$(DESTDIR)$(salomepythondir) $$file ; \ done endif @@ -282,13 +279,13 @@ uninstall-local: rm -rf $(DESTDIR)$(salomepythondir)/* mostlyclean-local: - -rm -f *.hh *.cc .depidl + -rm -f *.hh *.cc .depidl Calcium_Ports.idl # we use cpp to generate dependencies between idl files. # option x c tells the preprocessor to consider idl as a c file. # if an idl is modified, all idl dependencies are rebuilt -.depidl: $(IDL_FILES) +.depidl: $(IDL_FILES) Calcium_Ports.idl @echo "" > $@ @for dep in $^ dummy; do \ if [ $$dep != "dummy" ]; then \ @@ -300,5 +297,6 @@ mostlyclean-local: -include .depidl -CLEANFILES = *PaCO* *.hxx *.cxx +CLEANFILES = *PaCO* *.hxx *.cxx Calcium_Ports.idl + diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 80b69b51a..4325a3875 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -34,7 +34,7 @@ #include "SALOME_GenericObj.idl" /*! \brief - This package contains the interfaces used for creation, managment + This package contains the interfaces used for creation, management and modification of the %Study */ module SALOMEDS @@ -427,6 +427,18 @@ during each working session. */ void SetBoolean( in string theVarName, in boolean theValue ); +/*! \brief Create string variable with Name theVarName and value theValue + + (or set if variable value into theValue already exists) + \param theVarName is a name of the variable + \param theVarName is a value of the variable. +*/ + void SetString( in string theVarName, in string theValue ); + +/*! \brief Set current value as double for string variable +*/ + void SetStringAsDouble( in string theVarName, in double theValue ); + /*! \brief Get value of a real variable \param theVarName is a name of the variable. @@ -444,6 +456,12 @@ during each working session. \param theVarName is a name of the variable. */ boolean GetBoolean( in string theVarName ); + +/*! \brief Get value of a string variable + + \param theVarName is a name of the variable. +*/ + string GetString( in string theVarName ); /*! \brief Indicate if a variable is real @@ -467,6 +485,13 @@ during each working session. */ boolean IsBoolean( in string theVarName ); +/*! \brief Indicate if a variable is string + + Return true if variable is string otherwise return false. + \param theVarName is a name of the variable. +*/ + boolean IsString( in string theVarName ); + /*! \brief Indicate if a variable exists in the study Return true if variable exists in the study, diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index db817c063..fc555dc34 100644 --- a/idl/SALOME_Component.idl +++ b/idl/SALOME_Component.idl @@ -28,6 +28,7 @@ #include "SALOMEDS.idl" #include "SALOME_Exception.idl" +#include "SALOME_PyNode.idl" /*! \file SALOME_Component.idl \brief interfaces for Component and Container */ @@ -52,6 +53,12 @@ module Engines any value; }; + //! Structure data type to hold reference on data + struct dataref + { + string ref; + }; + typedef sequence FieldsDict; interface Component ; @@ -186,6 +193,13 @@ module Engines \param localFile the local file to create by copy */ void copyFile(in Container contai, in string remoteFile, in string localFile); + + //! Create a PyNode in the container + /*! + \param nodeName the name of the PyNode + \param code python code as text to load in the node + */ + PyNode createPyNode(in string nodeName, in string code) raises(SALOME::SALOME_Exception); }; /*! \brief Interface of the %component. @@ -203,15 +217,6 @@ module Engines //! Determines whether the server has already been loaded or not. void ping(); -// -// Set study associated to component instance -// \param studyId -// (=0: multistudy component instance, -// >0: study id associated to this instance -// \return false if already set with a different value (change not possible) -// -// boolean setStudyId(in long studyId); - //! Get study associated to component instance /*! get study associated to component instance diff --git a/src/Batch/Batch_InvalidArgumentException.hxx b/idl/SALOME_PyNode.idl similarity index 54% rename from src/Batch/Batch_InvalidArgumentException.hxx rename to idl/SALOME_PyNode.idl index b8dd07289..cde0a0ad8 100644 --- a/src/Batch/Batch_InvalidArgumentException.hxx +++ b/idl/SALOME_PyNode.idl @@ -19,35 +19,39 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/* - * InvalidArgumentException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Oct 16 16:18:00 2003 - * Projet : Salome 2 - * - */ +// File : SALOME_PyNode.idl +// Author : Christian CAREMOLI, EDF +// $Header: +// +#ifndef _SALOME_PYNODE_IDL_ +#define _SALOME_PYNODE_IDL_ -#ifndef _INVALIDARGUMENTEXCEPTION_H_ -#define _INVALIDARGUMENTEXCEPTION_H_ +#include "SALOME_GenericObj.idl" +#include "SALOME_Exception.idl" +/*! \file SALOME_PyNode.idl \brief interface for remote python execution +*/ -#include "Batch_Defines.hxx" +/*! \brief +This is a package of interfaces used for executing Python code on remote container +*/ +module Engines +{ + typedef sequence pickledArgs; -#include "Batch_GenericException.hxx" -#include "Batch_GenericException.hxx" + interface PyNode : SALOME::GenericObj + { -namespace Batch { + /*! \brief execute a python function defined in the node - class BATCH_EXPORT InvalidArgumentException : public GenericException - { - public: - // Constructeur - InvalidArgumentException(std::string ch = "undefined") : GenericException("InvalidArgumentException", ch) {} - }; + \param functionName the python function defined in the node to execute + \param inargs input argument values provided as a python pickle + \return output argument values as a python pickle + */ + pickledArgs execute(in string functionName,in pickledArgs inargs) raises (SALOME::SALOME_Exception); -} + } ; -#endif +}; +#endif diff --git a/resources/KERNELCatalog.xml.in b/resources/KERNELCatalog.xml.in index 917418b52..35b2edea4 100644 --- a/resources/KERNELCatalog.xml.in +++ b/resources/KERNELCatalog.xml.in @@ -23,6 +23,9 @@ + + + diff --git a/salome_adm/cmake_files/FindBOOST.cmake b/salome_adm/cmake_files/FindBOOST.cmake index 581560ef7..9d87a7400 100644 --- a/salome_adm/cmake_files/FindBOOST.cmake +++ b/salome_adm/cmake_files/FindBOOST.cmake @@ -102,26 +102,29 @@ IF(BOOST_STATUS) ENDIF(BOOST_STATUS) IF(BOOST_STATUS) - IF(WINDOWS) - IF(CMAKE_BUILD_TYPE STREQUAL Debug) - SET(EXTENSION -gd) - ELSE(CMAKE_BUILD_TYPE STREQUAL Debug) - SET(EXTENSION) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug) - FIND_LIBRARY(BOOST_LIB_THREAD libboost_thread-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS}) - FIND_LIBRARY(BOOST_LIB_DATE_TIME libboost_date_time-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS}) - FIND_LIBRARY(BOOST_LIB_SIGNALS libboost_signals-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS}) - FIND_LIBRARY(BOOST_LIB_FILESYSTEM libboost_filesystem-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS}) - FIND_LIBRARY(BOOST_LIB_SYSTEM libboost_system-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS}) - ELSE(WINDOWS) - FIND_LIBRARY(BOOST_LIB_THREAD boost_thread ${BOOST_LIB_PATHS}) - ENDIF(WINDOWS) SET(BOOST_LIBS) - SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_THREAD}) - SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_DATE_TIME}) - SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_SIGNALS}) - SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_FILESYSTEM}) - SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_SYSTEM}) + FOREACH(name thread date_time signals filesystem system regex) + IF(WINDOWS) + IF(CMAKE_BUILD_TYPE STREQUAL Debug) + SET(EXTENSION -gd) + ELSE(CMAKE_BUILD_TYPE STREQUAL Debug) + SET(EXTENSION) + ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug) + SET(LIB_NAMES) + FOREACH(version 1_35 1_38) + SET(LIB_NAMES ${LIB_NAMES} libboost_${name}-vc90-mt${EXTENSION}-${version}) + ENDFOREACH(version 1_35 1_38) + FIND_LIBRARY(BOOST_LIB_${name} NAMES ${LIB_NAMES} PATHS ${BOOST_LIB_PATHS}) + ELSE(WINDOWS) + FIND_LIBRARY(BOOST_LIB_${name} boost_${name} PATHS ${BOOST_LIB_PATHS}) + ENDIF(WINDOWS) + IF(NOT BOOST_LIB_${name}) + SET(BOOST_STATUS 0) + ENDIF(NOT BOOST_LIB_${name}) + STRING(TOUPPER ${name} upname) + SET(BOOST_LIB_${upname} ${BOOST_LIB_${name}}) + SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_${name}}) + ENDFOREACH(name thread date_time signals filesystem system) ENDIF(BOOST_STATUS) # ------ diff --git a/salome_adm/cmake_files/FindDOXYGEN.cmake b/salome_adm/cmake_files/FindDOXYGEN.cmake new file mode 100644 index 000000000..72dbe31a9 --- /dev/null +++ b/salome_adm/cmake_files/FindDOXYGEN.cmake @@ -0,0 +1,93 @@ +# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-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 +# +# ------ + +MESSAGE(STATUS "Check for doxygen ...") + +# ------ + +IF(DOXYGEN_IS_MANDATORY STREQUAL 0) + SET(DOXYGEN_IS_MANDATORY 0) + SET(DOXYGEN_IS_OPTIONAL 1) +ENDIF(DOXYGEN_IS_MANDATORY STREQUAL 0) +IF(DOXYGEN_IS_OPTIONAL STREQUAL 0) + SET(DOXYGEN_IS_MANDATORY 1) + SET(DOXYGEN_IS_OPTIONAL 0) +ENDIF(DOXYGEN_IS_OPTIONAL STREQUAL 0) +IF(NOT DOXYGEN_IS_MANDATORY AND NOT DOXYGEN_IS_OPTIONAL) + SET(DOXYGEN_IS_MANDATORY 0) + SET(DOXYGEN_IS_OPTIONAL 1) +ENDIF(NOT DOXYGEN_IS_MANDATORY AND NOT DOXYGEN_IS_OPTIONAL) + +# ------ + +SET(DOXYGEN_STATUS 1) +IF(WITHOUT_DOXYGEN OR WITH_DOXYGEN STREQUAL 0) + SET(DOXYGEN_STATUS 0) + MESSAGE(STATUS "doxygen disabled from command line.") +ENDIF(WITHOUT_DOXYGEN OR WITH_DOXYGEN STREQUAL 0) + +# ------ + +IF(DOXYGEN_STATUS) + IF(WITH_DOXYGEN) + SET(DOXYGEN_ROOT_USER ${WITH_DOXYGEN}) + ENDIF(WITH_DOXYGEN) + IF(NOT DOXYGEN_ROOT_USER) + SET(DOXYGEN_ROOT_USER $ENV{DOXYGEN_ROOT}) + ENDIF(NOT DOXYGEN_ROOT_USER) + IF(NOT DOXYGEN_ROOT_USER) + SET(DOXYGEN_ROOT_USER $ENV{DOXYGENHOME}) + ENDIF(NOT DOXYGEN_ROOT_USER) +ENDIF(DOXYGEN_STATUS) + +# ------ + +IF(DOXYGEN_STATUS) + SET(DOXYGEN_EXECUTABLE_TO_FIND doxygen) + IF(DOXYGEN_ROOT_USER) + FIND_PROGRAM(DOXYGEN_EXECUTABLE ${DOXYGEN_EXECUTABLE_TO_FIND} PATHS ${DOXYGEN_ROOT_USER}/bin NO_DEFAULT_PATH) + ELSE(DOXYGEN_ROOT_USER) + FIND_PROGRAM(DOXYGEN_EXECUTABLE ${DOXYGEN_EXECUTABLE_TO_FIND}) + ENDIF(DOXYGEN_ROOT_USER) + IF(DOXYGEN_EXECUTABLE) + MESSAGE(STATUS "${DOXYGEN_EXECUTABLE_TO_FIND} found: ${DOXYGEN_EXECUTABLE}") + ELSE(DOXYGEN_EXECUTABLE) + MESSAGE(STATUS "${DOXYGEN_EXECUTABLE_TO_FIND} not found, try to use WITH_DOXYGEN option or DOXYGEN_ROOT (or DOXYGENHOME) environment variable") + SET(DOXYGEN_STATUS 0) + ENDIF(DOXYGEN_EXECUTABLE) +ENDIF(DOXYGEN_STATUS) + +# ---- + +IF(DOXYGEN_STATUS) + SET(DOXYGEN_IS_OK 1) +ELSE(DOXYGEN_STATUS) + SET(DOXYGEN_IS_OK 0) + IF(DOXYGEN_IS_MANDATORY) + MESSAGE(FATAL_ERROR "doxygen not found ... mandatory ... abort") + ELSE(DOXYGEN_IS_MANDATORY) + MESSAGE(STATUS "doxygen not found ... optional ... disabled") + ENDIF(DOXYGEN_IS_MANDATORY) +ENDIF(DOXYGEN_STATUS) + +# ---- diff --git a/salome_adm/cmake_files/FindPLATFORM.cmake b/salome_adm/cmake_files/FindPLATFORM.cmake index dfc8242c3..f0ab69771 100644 --- a/salome_adm/cmake_files/FindPLATFORM.cmake +++ b/salome_adm/cmake_files/FindPLATFORM.cmake @@ -70,6 +70,8 @@ ELSE(WINDOWS) SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl) ENDIF(WINDOWS) +SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4) + # SET(PLATFORM_CPPFLAGS) # # # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT -D_CRT_SECURE_NO_WARNINGS) # # SET(RM del) diff --git a/salome_adm/cmake_files/FindPYTHON.cmake b/salome_adm/cmake_files/FindPYTHON.cmake index a03b563a4..6c6768139 100644 --- a/salome_adm/cmake_files/FindPYTHON.cmake +++ b/salome_adm/cmake_files/FindPYTHON.cmake @@ -199,6 +199,7 @@ ENDIF(PYTHON_STATUS) # ---- IF(PYTHON_STATUS) + SET(PYTHON_CPPFLAGS ${PYTHON_INCLUDES}) ELSE(PYTHON_STATUS) IF(PYTHON_IS_MANDATORY) MESSAGE(FATAL_ERROR "python not found ... mandatory ... abort") diff --git a/salome_adm/cmake_files/Makefile.am b/salome_adm/cmake_files/Makefile.am index 740e93a23..fc18d6d4a 100644 --- a/salome_adm/cmake_files/Makefile.am +++ b/salome_adm/cmake_files/Makefile.am @@ -25,6 +25,7 @@ dist_salome_cmake_DATA = \ am2cmake.py \ FindBOOST.cmake \ FindCPPUNIT.cmake \ +FindDOXYGEN.cmake \ FindHDF5.cmake \ FindKERNEL.cmake \ FindLIBXML2.cmake \ diff --git a/salome_adm/cmake_files/am2cmake.py b/salome_adm/cmake_files/am2cmake.py index b0624ab09..314fe54c2 100644 --- a/salome_adm/cmake_files/am2cmake.py +++ b/salome_adm/cmake_files/am2cmake.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -200,6 +201,11 @@ class CMakeFile(object): "XmlTObjPlugin", "XmlXCAFPlugin", ] + vtk_list = [ + "vtkCommonPythonD", + "vtkGraphicsPythonD", + "vtkImagingPythonD", + ] kernel_list = [ "DF", "Launcher", @@ -339,7 +345,8 @@ class CMakeFile(object): "StdMeshersGUI", "StdMeshers", ] - full_list = cas_list + kernel_list + gui_list + full_list = cas_list + vtk_list + full_list += kernel_list + gui_list full_list += geom_list + med_list + smesh_list # -- # E.A. : sort by len before substitution ... @@ -432,6 +439,7 @@ class CMakeFile(object): INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake) INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSWIG.cmake) INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake) + INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake) """) pass else: @@ -446,6 +454,7 @@ class CMakeFile(object): INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake) INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake) INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake) + INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake) INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake) """) if self.module == "gui": @@ -504,21 +513,61 @@ class CMakeFile(object): INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindBLSURF.cmake) """) pass + if self.module == "hexoticplugin": + newlines.append(""" + SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR}) + SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) + SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR}) + INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake) + INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) + INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake) + """) + pass + if self.module == "ghs3dplugin": + newlines.append(""" + SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR}) + SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) + SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR}) + INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake) + INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) + INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake) + """) + pass if self.module == "visu": newlines.append(""" SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) """) pass + if self.module == "yacs": + newlines.append(""" + INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindEXPAT.cmake) + INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindGRAPHVIZ.cmake) + """) + pass pass pass # -- + newlines.append(""" + SET(DOXYGEN_IS_OK 0) + """) + if self.module not in ['med']: + newlines.append(""" + IF(WINDOWS) + SET(CPPUNIT_IS_OK 0) + ENDIF(WINDOWS) + """) + pass + # -- if self.module == "kernel": newlines.append(""" SET(WITH_LOCAL 1) SET(WITH_BATCH 1) - set(VERSION 5.1.2) - set(XVERSION 0x050102) + set(VERSION 5.1.3) + set(XVERSION 0x050103) + SET(CALCIUM_IDL_INT_F77 long) + SET(CALCIUM_CORBA_INT_F77 CORBA::Long) + SET(LONG_OR_INT int) """) elif self.module == "gui": newlines.append(""" @@ -530,9 +579,9 @@ class CMakeFile(object): SET(ENABLE_PLOT2DVIEWER ON) SET(ENABLE_PYCONSOLE ON) SET(ENABLE_SUPERVGRAPHVIEWER ON) - # SET(ENABLE_QXGRAPHVIEWER ON) - set(VERSION 5.1.2) - set(XVERSION 0x050102) + SET(ENABLE_QXGRAPHVIEWER ON) + set(VERSION 5.1.3) + set(XVERSION 0x050103) """) pass elif self.module == "geom": @@ -554,6 +603,9 @@ class CMakeFile(object): elif self.module == "med": newlines.append(""" SET(MED_ENABLE_KERNEL ON) + IF(NOT WINDOWS) + SET(MED_ENABLE_SPLITTER ON) + ENDIF(NOT WINDOWS) SET(MED_ENABLE_GUI ON) """) pass @@ -572,6 +624,17 @@ class CMakeFile(object): SET(BLSURFPLUGIN_ENABLE_GUI ON) """) pass + elif self.module == "ghs3dplugin": + newlines.append(""" + SET(GHS3DPLUGIN_ENABLE_GUI ON) + """) + pass + elif self.module == "yacs": + newlines.append(""" + SET(SALOME_KERNEL ON) + SET(HAS_GUI ON) + """) + pass # -- pass # -- @@ -583,6 +646,19 @@ class CMakeFile(object): SET(AM_CXXFLAGS) SET(LDADD) """) + if self.module == "kernel": + newlines.append(r''' + SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h) + SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h) + ''') + else: + if self.module not in ["yacs"]: + newlines.append(r''' + SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h) + SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h) + ''') + pass + pass # -- return @@ -773,6 +849,12 @@ class CMakeFile(object): # -- # Convert the .in files in build dir # -- + if self.module == "yacs": + key = "salomegui" + if self.root[-len(key):] == key: + self.files.append("resources/YACSCatalog.xml.in") + pass + pass for f in self.files: if f[-3:] == ".in": if f == "sstream.in": @@ -824,7 +906,7 @@ class CMakeFile(object): # -- # -- - for key in ["bin_PROGRAMS"]: + for key in ["bin_PROGRAMS", "check_PROGRAMS"]: if self.__thedict__.has_key(key): self.addBinTarget(key, newlines) pass @@ -846,6 +928,11 @@ class CMakeFile(object): key = "IDL_FILES" if self.__thedict__.has_key(key): + if self.module == "kernel": + newlines.append(''' + SET(IDL_FILES ${IDL_FILES} Calcium_Ports.idl) + ''') + pass newlines.append(''' FOREACH(input ${IDL_FILES}) STRING(REGEX REPLACE ".idl" "" base ${input}) @@ -853,9 +940,21 @@ class CMakeFile(object): SET(outputs ${src}) SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc) SET(outputs ${outputs} ${dynsrc}) + SET(inc ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh) + SET(outputs ${outputs} ${inc}) + IF(input STREQUAL Calcium_Ports.idl) + SET(input ${CMAKE_CURRENT_BINARY_DIR}/${input}) + ELSE(input STREQUAL Calcium_Ports.idl) + SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) + ENDIF(input STREQUAL Calcium_Ports.idl) + SET(flags ${IDLCXXFLAGS} ${OMNIORB_IDLCXXFLAGS}) + STRING(REGEX MATCH "-bcxx" ISBCXX ${flags}) + IF(NOT ISBCXX) + SET(flags -bcxx ${flags}) + ENDIF(NOT ISBCXX) ADD_CUSTOM_COMMAND( OUTPUT ${outputs} - COMMAND ${OMNIORB_IDL} ${IDLCXXFLAGS} ${OMNIORB_IDLCXXFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${input} + COMMAND ${OMNIORB_IDL} ${flags} ${input} MAIN_DEPENDENCY ${input} ) install(FILES ${input} DESTINATION idl/salome) @@ -870,6 +969,10 @@ class CMakeFile(object): FOREACH(f ${IDLPYFLAGS}) SET(flags "${flags} ${f}") ENDFOREACH(f ${IDLPYFLAGS}) + STRING(REGEX MATCH "-bpython" ISBPYTHON ${flags}) + IF(NOT ISBPYTHON) + SET(flags "-bpython ${flags}") + ENDIF(NOT ISBPYTHON) SET(IDLPYFLAGS ${flags}) STRING(REPLACE "\\\\" "/" IDLPYFLAGS ${IDLPYFLAGS}) INSTALL(CODE "SET(IDLPYFLAGS ${IDLPYFLAGS})") @@ -918,13 +1021,41 @@ class CMakeFile(object): ''') pass + # -- + # -- + if self.__thedict__.has_key("BUILT_SOURCES"): + newlines.append(''' + FOREACH(f ${BUILT_SOURCES}) + IF(f MATCHES "WRAP.cxx$") + # STRING(REGEX REPLACE "WRAP.cxx" "WRAP.h" inc ${f}) + STRING(REGEX REPLACE "WRAP.cxx" ".i" input ${f}) + ADD_CUSTOM_COMMAND( + OUTPUT ${f} # ${inc} + COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} ${SWIG_PYTHON_INCLUDES} ${MYSWIG_FLAGS} -o ${f} ${CMAKE_CURRENT_SOURCE_DIR}/${input} + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${input} + ) + ENDIF(f MATCHES "WRAP.cxx$") + ENDFOREACH(f ${BUILT_SOURCES}) + ''') + pass + # -- # -- key = "MOC_FILES" if self.__thedict__.has_key(key): newlines.append(''' FOREACH(output ${MOC_FILES}) - STRING(REGEX REPLACE _moc.cxx .h input ${output}) + ''') + if self.module == "yacs": + newlines.append(''' + STRING(REGEX REPLACE _moc.cxx .hxx input ${output}) + ''') + else: + newlines.append(''' + STRING(REGEX REPLACE _moc.cxx .h input ${output}) + ''') + pass + newlines.append(''' SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output}) ADD_CUSTOM_COMMAND( @@ -1017,6 +1148,7 @@ class CMakeFile(object): "nodist_salomescript_DATA" : "bin/salome", "salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome", "nodist_salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome", + "dist_salomepython_DATA" : "lib/python${PYTHON_VERSION}/site-packages/salome", "sharedpkgpython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome/shared_modules", } if self.module == "medfile": @@ -1059,9 +1191,11 @@ class CMakeFile(object): # -- newlines.append(r''' SET(libs ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS}) - IF(name STREQUAL SALOMEBasics) + FOREACH(lib SALOMEBasics SalomeBatch) + IF(name STREQUAL lib) SET(libs ${libs} ${PTHREAD_LIBS}) - ENDIF(name STREQUAL SALOMEBasics) + ENDIF(name STREQUAL lib) + ENDFOREACH(lib SALOMEBasics SalomeBatch) ''') if key == "bin_PROGRAMS": newlines.append(r''' @@ -1074,10 +1208,11 @@ class CMakeFile(object): GET_FILENAME_COMPONENT(ext ${lib} EXT) IF(ext STREQUAL .la) GET_FILENAME_COMPONENT(lib ${lib} NAME_WE) - STRING(REPLACE "lib" "" lib ${lib}) + STRING(REGEX REPLACE "^lib" "" lib ${lib}) ENDIF(ext STREQUAL .la) SET(vars) SET(vars ${vars} -no-undefined) + SET(vars ${vars} -lvtkWidgets) IF(WINDOWS) SET(vars ${vars} -module) SET(vars ${vars} -Wl,-E) @@ -1086,7 +1221,7 @@ class CMakeFile(object): SET(vars ${vars} -lm) SET(vars ${vars} -lboost_thread) SET(vars ${vars} -lboost_signals) - SET(vars ${vars} -lvtkWidgets) + SET(vars ${vars} -pthread -lpthread -ldl) ENDIF(WINDOWS) FOREACH(v ${vars}) IF(lib STREQUAL v) @@ -1136,6 +1271,14 @@ class CMakeFile(object): ENDIF(WINDOWS) ''') # -- + if self.module in ["medfile", "yacs"]: + newlines.append(r''' + IF(WINDOWS) + SET(var ${var} -DNOGDI) + ENDIF(WINDOWS) + ''') + pass + # -- newlines.append(r''' IF(WINDOWS) SET(targets) @@ -1145,6 +1288,7 @@ class CMakeFile(object): SET(dir $ENV{F2CHOME}) STRING(REPLACE "\\\\" "/" dir ${dir}) SET(var ${var} -I${dir}) + SET(var ${var} -DF2C_BUILD) ENDIF(name STREQUAL ${target}) ENDFOREACH(target ${targets}) ENDIF(WINDOWS) @@ -1156,10 +1300,17 @@ class CMakeFile(object): SET(var ${var} -I${CMAKE_CURRENT_BINARY_DIR}) ''') pass - if key == "bin_PROGRAMS": + newlines.append(r''' + SET(var ${var} ${AM_CPPFLAGS}) + SET(var ${var} ${AM_CXXFLAGS}) + ''') + if self.module == "yacs": newlines.append(r''' - SET(var ${var} ${AM_CPPFLAGS}) - SET(var ${var} ${AM_CXXFLAGS}) + SET(var ${var} -DYACS_PTHREAD) + SET(var ${var} -DCMAKE_BUILD) + SET(var ${var} -DSALOME_KERNEL) + SET(var ${var} -DDSC_PORTS) + SET(var ${var} -DOMNIORB) ''') pass newlines.append(r''' @@ -1172,6 +1323,8 @@ class CMakeFile(object): IF(WINDOWS) SET(vars ${vars} -include SALOMEconfig.h) SET(vars ${vars} -ftemplate-depth-32) + SET(vars ${vars} -fPIC) + SET(vars ${vars} -g) ENDIF(WINDOWS) SET(flags) FOREACH(f ${var}) @@ -1275,12 +1428,15 @@ class CMakeFile(object): ENDFOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES}) ''') newlines.append(r''' - SET(build_srcs) + SET(l ${nodist_${amname}_SOURCES} ${UIC_FILES}) + FOREACH(f ${l}) + SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f}) + SET(srcs ${srcs} ${src}) + ENDFOREACH(f ${l}) ''') newlines.append(r''' + SET(build_srcs) SET(l ${nodist_${amname}_SOURCES} ${BUILT_SOURCES}) - ''') - newlines.append(r''' FOREACH(f ${l}) GET_FILENAME_COMPONENT(ext ${f} EXT) IF(ext STREQUAL .py) @@ -1288,7 +1444,6 @@ class CMakeFile(object): SET(build_srcs ${build_srcs} ${CMAKE_CURRENT_BINARY_DIR}/${f}) ENDIF(ext STREQUAL .py) ENDFOREACH(f ${l}) - SET(srcs ${build_srcs} ${srcs}) ''') # -- # Add the library to cmake @@ -1321,6 +1476,34 @@ class CMakeFile(object): IF(BEGIN_WITH_lib) INSTALL(TARGETS ${name} DESTINATION ${DEST}) ''') + if self.module == "gui": + newlines.append(r''' + FOREACH(lib SalomePyQt) + IF(name STREQUAL lib) + IF(WINDOWS) + IF(CMAKE_BUILD_TYPE STREQUAL Release) + INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}.pyd) + ELSE(CMAKE_BUILD_TYPE STREQUAL Release) + INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}_d.pyd) + ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) + ELSE(WINDOWS) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so DESTINATION ${DEST} RENAME ${name}.so) + ENDIF(WINDOWS) + ENDIF(name STREQUAL lib) + ENDFOREACH(lib SalomePyQt) + FOREACH(lib SalomePy) + IF(name STREQUAL lib) + IF(WINDOWS) + IF(CMAKE_BUILD_TYPE STREQUAL Release) + INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.pyd) + ELSE(CMAKE_BUILD_TYPE STREQUAL Release) + INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}_d.pyd) + ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) + ENDIF(WINDOWS) + ENDIF(name STREQUAL lib) + ENDFOREACH(lib SalomePy) + ''') + pass if self.module == "geom": newlines.append(r''' IF(WINDOWS) @@ -1336,11 +1519,6 @@ class CMakeFile(object): ''') pass newlines.append(r''' - # IF(name STREQUAL SalomePyQt) - # INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so DESTINATION ${DEST} RENAME ${name}.so) - # ENDIF(name STREQUAL SalomePyQt) - ''') - newlines.append(r''' ELSE(BEGIN_WITH_lib) ''') newlines.append(r''' @@ -1373,12 +1551,17 @@ class CMakeFile(object): def addBinTarget(self, key, newlines): # -- newlines.append(r''' - FOREACH(amname ${bin_PROGRAMS}) + FOREACH(amname ${bin_PROGRAMS} ${check_PROGRAMS}) ''') # -- newlines.append(r''' SET(name "${amname}_exe") SET(srcs ${${amname}_SOURCES} ${dist_${amname}_SOURCES}) + SET(l ${nodist_${amname}_SOURCES}) + FOREACH(f ${l}) + SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f}) + SET(srcs ${srcs} ${src}) + ENDFOREACH(f ${l}) LIST(LENGTH srcs nb) IF(nb) ADD_EXECUTABLE(${name} ${srcs}) @@ -1398,26 +1581,28 @@ class CMakeFile(object): ''') pass # -- - newlines.append(r''' - IF(WINDOWS) - INSTALL(TARGETS ${name} DESTINATION ${DEST}) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe DESTINATION ${DEST} RENAME ${amname}.exe) - INSTALL(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe)") - ELSE(WINDOWS) - SET(PERMS) - SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE) - SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE) - SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name} DESTINATION ${DEST} PERMISSIONS ${PERMS} RENAME ${amname}) - ENDIF(WINDOWS) - ''') + if key == "bin_PROGRAMS": + newlines.append(r''' + IF(WINDOWS) + INSTALL(TARGETS ${name} DESTINATION ${DEST}) + INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe DESTINATION ${DEST} RENAME ${amname}.exe) + INSTALL(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe)") + ELSE(WINDOWS) + SET(PERMS) + SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE) + SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE) + SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name} DESTINATION ${DEST} PERMISSIONS ${PERMS} RENAME ${amname}) + ENDIF(WINDOWS) + ''') + pass # -- newlines.append(r''' ENDIF(nb) ''') # -- newlines.append(r''' - ENDFOREACH(amname ${bin_PROGRAMS}) + ENDFOREACH(amname ${bin_PROGRAMS} ${check_PROGRAMS}) ''') # -- return @@ -1448,7 +1633,20 @@ class CMakeFile(object): ''') else: newlines.append(r''' + GET_FILENAME_COMPONENT(ext ${f} EXT) + IF(ext STREQUAL .py) + IF(DEST STREQUAL bin/salome) + SET(PERMS) + SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE) + SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE) + SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE) + INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS}) + ELSE(DEST STREQUAL bin/salome) + INSTALL(FILES ${f} DESTINATION ${DEST}) + ENDIF(DEST STREQUAL bin/salome) + ELSE(ext STREQUAL .py) INSTALL(FILES ${f} DESTINATION ${DEST}) + ENDIF(ext STREQUAL .py) ''') pass newlines.append(r''' @@ -1457,7 +1655,7 @@ class CMakeFile(object): IF(ext STREQUAL .qm) STRING(REGEX REPLACE .qm .ts input ${f}) ''') - if self.module in ["kernel", "gui"]: + if self.module in ["kernel", "gui", "yacs"]: newlines.append(r''' SET(input ${CMAKE_CURRENT_SOURCE_DIR}/resources/${input}) ''') @@ -1560,8 +1758,14 @@ if __name__ == "__main__": except ValueError: pass # -- + if "Makefile.am.cmake" in files: + if "Makefile.am" in files: + files.remove("Makefile.am") + pass + pass + # -- for f in files: - if f == "Makefile.am": + if f in ["Makefile.am", "Makefile.am.cmake"]: convertAmFile(the_root, root, dirs, files, f, module) pass pass diff --git a/salome_adm/cmake_files/install_python_from_idl.cmake b/salome_adm/cmake_files/install_python_from_idl.cmake index da4eed0e2..b37544c52 100644 --- a/salome_adm/cmake_files/install_python_from_idl.cmake +++ b/salome_adm/cmake_files/install_python_from_idl.cmake @@ -22,4 +22,4 @@ SET(FULLDIR ${CMAKE_INSTALL_PREFIX}/${DIR}) FILE(MAKE_DIRECTORY ${FULLDIR}) MESSAGE(STATUS "Compiling ${IDL_FILE} into ${FULLDIR}") -EXECUTE_PROCESS(COMMAND ${OMNIORB_IDL_PYTHON} ${IDLPYFLAGS} -C${FULLDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${IDL_FILE}) +EXECUTE_PROCESS(COMMAND ${OMNIORB_IDL_PYTHON} ${IDLPYFLAGS} -C${FULLDIR} ${IDL_FILE}) diff --git a/salome_adm/unix/SALOMEconfig.ref.in b/salome_adm/unix/SALOMEconfig.ref.in index add14555f..68fa375a2 100644 --- a/salome_adm/unix/SALOMEconfig.ref.in +++ b/salome_adm/unix/SALOMEconfig.ref.in @@ -20,42 +20,27 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifndef SALOME_CONFIG_H -#define SALOME_CONFIG_H - -#define DEBUG +/* Debug mode ??? */ +#ifndef DEBUG +# define DEBUG +#endif -#define QUOTE(x) #x -#define CORBA_CLIENT_HEADER(x) QUOTE(x@IDL_CLN_H@) -#define CORBA_SERVER_HEADER(x) QUOTE(x@IDL_SRV_H@) +/* CORBA headers include rules */ +#ifndef CORBA_CLIENT_HEADER +# define QUOTE(x) #x +# define CORBA_CLIENT_HEADER(x) QUOTE(x@IDL_CLN_H@) +# define CORBA_SERVER_HEADER(x) QUOTE(x@IDL_SRV_H@) +#endif +/* Platform definition */ #ifndef @MACHINE@ #define @MACHINE@ #endif - -/* A path to a rcp-like command */ -#define RCP "@RCP@" - -/* A path to a rm-like command */ -#define RM "@RM@" - -/* A path to a cp-like command */ -#define CP "@CP@" - -/* A path to a rsh-like command */ -#define RSH "@RSH@" - -/* A path to a scp-like command */ -#define SCP "@SCP@" - -/* A path to a sh-like command */ -#define SH "@SH@" - -/* 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 +#undef PACKAGE +#endif #ifdef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif @@ -71,9 +56,10 @@ #ifdef PACKAGE_VERSION #undef PACKAGE_VERSION #endif +#ifdef VERSION +#undef VERSION +#endif #ifdef _POSIX_C_SOURCE #undef _POSIX_C_SOURCE #endif - -#endif diff --git a/salome_adm/unix/config_files/Makefile.am b/salome_adm/unix/config_files/Makefile.am index 68649d934..e66ea7cab 100644 --- a/salome_adm/unix/config_files/Makefile.am +++ b/salome_adm/unix/config_files/Makefile.am @@ -52,6 +52,7 @@ ac_cxx_template_options.m4 \ ac_cxx_use_std_iostream.m4 \ ac_cxx_warnings.m4 \ ac_linker_options.m4 \ +ac_check_sizeof_fortran.m4 \ acx_pthread.m4 \ check_Kernel.m4 \ check_boost.m4 \ @@ -59,15 +60,15 @@ check_cas.m4 \ check_corba.m4 \ check_cppunit.m4 \ check_f77.m4 \ +check_calcium.m4 \ check_hdf5.m4 \ check_htmlgen.m4 \ check_lam.m4 \ -check_lsf.m4 \ +check_libbatch.m4 \ check_mpi.m4 \ check_openmpi.m4 \ check_mpich.m4 \ check_omniorb.m4 \ -check_openpbs.m4 \ check_sockets.m4 \ check_swig.m4 \ check_withihm.m4 \ @@ -76,8 +77,8 @@ production.m4 \ pyembed.m4 \ python.m4 \ check_libxml.m4 \ -check_local.m4 \ -check_paco++.m4 +check_paco++.m4 \ +local_install.m4 dist_salome4depr_DATA=\ $(DEPRECATED_FILES) diff --git a/salome_adm/unix/config_files/ac_check_sizeof_fortran.m4 b/salome_adm/unix/config_files/ac_check_sizeof_fortran.m4 new file mode 100644 index 000000000..29a1d3074 --- /dev/null +++ b/salome_adm/unix/config_files/ac_check_sizeof_fortran.m4 @@ -0,0 +1,49 @@ +AC_DEFUN([AC_CHECK_SIZEOF_FORTRAN], [ + AC_REQUIRE([AC_F77_WRAPPERS]) + AC_CACHE_CHECK([size of Fortran [$1]], [ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])],[ + AC_LANG_SAVE() + AC_LANG([Fortran 77]) + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine fsize() + $1 i(2) + call csize(i(1), i(2)) + end + ]) + ],[ + AC_LANG([C]) + cp conftest.$ac_objext conftestf.$ac_objext + old_LDFLAGS="$LDFLAGS" + LDFLAGS="conftestf.$ac_objext $LDFLAGS" +#"$ac_cv_f77_libs" + AC_TRY_RUN([ +# include +# define CSIZE F77_FUNC(csize,CSIZE) +# define FSIZE F77_FUNC(fsize,FSIZE) + static long size_val; + /* Called by Fortran */ + void CSIZE (i1p, i2p) + char *i1p, *i2p; + { + size_val = (i2p - i1p); + } + main() { + FILE *f=fopen ("conftestval","w"); + if (!f) return 1; + /* Call the Fortran function */ + FSIZE (); + fprintf (f, "%d\n", size_val); + return 0; + } + ]) + LDFLAGS="$old_LDFLAGS" + ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])=`cat conftestval` + rm -f conftestval conftestf.$ac_objext + ]) + AC_LANG_RESTORE() + ]) + AC_DEFINE_UNQUOTED(SIZEOF_FORTRAN_[]translit($1, [a-z *], [A-Z_p]), + [$ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])], + [The size of a Fortran `$1', as computed by sizeof.]) + +]) 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 3473cf26e..3625d5902 100644 --- a/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 +++ b/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 @@ -25,10 +25,9 @@ dnl define CXX_DEPEND_FLAG dnl @version $Id$ dnl @author Marc Tajchman dnl -AC_DEFUN([AC_DEPEND_FLAG], -[AC_CACHE_CHECK(which flag for dependency information generation, -ac_cv_depend_flag, -[AC_LANG_SAVE +AC_DEFUN([AC_DEPEND_FLAG],[ + AC_MSG_CHECKING([which flag for dependency information generation]) + AC_LANG_SAVE AC_LANG_C echo "conftest.o: conftest.c" > conftest.verif echo "int main() { return 0; }" > conftest.c @@ -213,6 +212,8 @@ dnl use g++ option -MG : asume unknown file will be construct later printf " C++ : ${DEPCXX} ${CXX_DEPEND_FLAG}" AC_LANG_RESTORE + AC_MSG_RESULT([ ... done]) + AC_SUBST(DEPCC) AC_SUBST(DEPCXX) AC_SUBST(DEPCXXFLAGS) @@ -220,4 +221,3 @@ dnl use g++ option -MG : asume unknown file will be construct later AC_SUBST(CXX_DEPEND_FLAG) AC_SUBST(MACHINE) ]) -]) diff --git a/salome_adm/unix/config_files/ac_cxx_have_sstream.m4 b/salome_adm/unix/config_files/ac_cxx_have_sstream.m4 index 24be4c5d9..852bc6ccb 100644 --- a/salome_adm/unix/config_files/ac_cxx_have_sstream.m4 +++ b/salome_adm/unix/config_files/ac_cxx_have_sstream.m4 @@ -26,18 +26,23 @@ dnl @version $Id$ dnl modified by Marc Tajchman (CEA) - 10/10/2002 dnl -AC_DEFUN([AC_CXX_HAVE_SSTREAM], -[AC_CACHE_CHECK(whether the compiler has stringstream, -HAVE_SSTREAM, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[stringstream message; message << "Hello"; return 0;], - HAVE_SSTREAM=yes, HAVE_SSTREAM=no) - AC_LANG_RESTORE -]) -AC_SUBST(HAVE_SSTREAM) +AC_DEFUN([AC_CXX_HAVE_SSTREAM],[ + AC_CACHE_CHECK([whether the compiler has stringstream], + [ac_cv_prog_cxx_have_sstream], + [ac_cv_prog_cxx_have_sstream=no + AC_REQUIRE([AC_CXX_NAMESPACES]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + #include + #ifdef HAVE_NAMESPACES + using namespace std; + #endif + ], + [stringstream message; message << "Hello"; return 0;], + [ac_cv_prog_cxx_have_sstream=yes],[ac_cv_prog_cxx_have_sstream=no]) + AC_LANG_RESTORE + ]) + HAVE_SSTREAM=$ac_cv_prog_cxx_have_sstream + AC_SUBST(HAVE_SSTREAM) ]) diff --git a/salome_adm/unix/config_files/ac_linker_options.m4 b/salome_adm/unix/config_files/ac_linker_options.m4 index dd2abdbf4..580b38b24 100644 --- a/salome_adm/unix/config_files/ac_linker_options.m4 +++ b/salome_adm/unix/config_files/ac_linker_options.m4 @@ -37,6 +37,11 @@ AC_DEFUN([AC_LINKER_OPTIONS],[ done AC_SUBST(LDEXPDYNFLAGS) + for opt in "-Xlinker -enable-new-dtags" ; do + AC_CXX_OPTION($opt,LDFLAGS) + done + AC_SUBST(LDFLAGS) + dnl case $host_os in osf*) diff --git a/salome_adm/unix/config_files/check_boost.m4 b/salome_adm/unix/config_files/check_boost.m4 index 1c8d1ce40..3df49c3f4 100644 --- a/salome_adm/unix/config_files/check_boost.m4 +++ b/salome_adm/unix/config_files/check_boost.m4 @@ -133,6 +133,18 @@ if test "x${boost_binaries_ok}" = "xno" ; then else AC_MSG_RESULT(\$BOOST_LIBSUFFIX = ${BOOST_LIBSUFFIX}) AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS}) + AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so, + BOOST_LIB_THREAD="${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}", + BOOST_LIB_THREAD="") + AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_signals${BOOST_LIBSUFFIX}.so, + BOOST_LIB_SIGNALS="${BOOST_LIBS} -lboost_signals${BOOST_LIBSUFFIX}", + BOOST_LIB_SIGNALS="") + AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_system${BOOST_LIBSUFFIX}.so, + BOOST_LIB_SYSTEM="${BOOST_LIBS} -lboost_system${BOOST_LIBSUFFIX}", + BOOST_LIB_SYSTEM="") + AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_regex${BOOST_LIBSUFFIX}.so, + BOOST_LIB_REGEX="${BOOST_LIBS} -lboost_regex${BOOST_LIBSUFFIX}", + BOOST_LIB_REGEX="") fi AC_MSG_RESULT(for boost binaries: $boost_binaries_ok) @@ -150,6 +162,10 @@ AC_MSG_RESULT(for boost: $boost_ok) AC_SUBST(BOOST_CPPFLAGS) AC_SUBST(BOOST_LIBSUFFIX) AC_SUBST(BOOST_LIBS) +AC_SUBST(BOOST_LIB_THREAD) +AC_SUBST(BOOST_LIB_SIGNALS) +AC_SUBST(BOOST_LIB_SYSTEM) +AC_SUBST(BOOST_LIB_REGEX) AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) AC_LANG_RESTORE diff --git a/salome_adm/unix/config_files/check_calcium.m4 b/salome_adm/unix/config_files/check_calcium.m4 new file mode 100644 index 000000000..7a81e0164 --- /dev/null +++ b/salome_adm/unix/config_files/check_calcium.m4 @@ -0,0 +1,58 @@ +AC_DEFUN([CHECK_CALCIUM], [ + +## Guess where as cal_int type is provided by --with-cal_int option +## or auto-detection must be used + +AC_ARG_WITH([cal_int], + AC_HELP_STRING([--with-cal_int=], + [Use for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.]), + [], + [withval=no]) + +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(int) + +if test "x$withval" = "xno" +then + AC_REQUIRE([CHECK_F77]) + AC_CHECK_SIZEOF_FORTRAN(integer) + + if test "x$ac_cv_sizeof_fortran_integer" = "x8" ; then + AC_DEFINE(HAVE_F77INT64,[], + [The size of a Fortran integer, as computed by sizeof.]) + test "x$ac_cv_sizeof_long" = "x8" || AC_MSG_ERROR([Size of C type long expected to be eight bytes]) + LONG_OR_INT="long" + CALCIUM_IDL_INT_F77="long long" + CALCIUM_CORBA_INT_F77="CORBA::LongLong" + elif test "x$ac_cv_sizeof_fortran_integer" = "x4" ; then + test "x$ac_cv_sizeof_int" = "x4" || AC_MSG_ERROR([Size of C type int expected to be four bytes]) + LONG_OR_INT="int" + CALCIUM_IDL_INT_F77="long" + CALCIUM_CORBA_INT_F77="CORBA::Long" + else + AC_MSG_ERROR([Size of Fortran type integer is neither four nor eigth bytes]) + fi + +elif test "x$withval" = "xint" +then + LONG_OR_INT="int" + CALCIUM_IDL_INT_F77="long" + CALCIUM_CORBA_INT_F77="CORBA::Long" + AC_MSG_NOTICE([Using C type int for cal_int]) + +elif test "x$withval" = "xlong" +then + LONG_OR_INT="long" + CALCIUM_IDL_INT_F77="long long" + CALCIUM_CORBA_INT_F77="CORBA::LongLong" + AC_MSG_NOTICE([Using C type long for cal_int]) +else + AC_MSG_ERROR([Fortran type integer must be mapped to C type int or C type long]) +fi + +AC_SUBST(CALCIUM_IDL_INT_F77) +AC_SUBST(CALCIUM_CORBA_INT_F77) +AC_SUBST(LONG_OR_INT) +AC_DEFINE_UNQUOTED([CAL_INT],[$LONG_OR_INT], + [The C type to be used for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.]) +]) diff --git a/salome_adm/unix/config_files/check_f77.m4 b/salome_adm/unix/config_files/check_f77.m4 index e03c6c165..668026e1e 100644 --- a/salome_adm/unix/config_files/check_f77.m4 +++ b/salome_adm/unix/config_files/check_f77.m4 @@ -22,7 +22,6 @@ dnl AC_DEFUN([CHECK_F77],[ AC_PROG_F77 - AC_F77_LIBRARY_LDFLAGS AC_F77_WRAPPERS diff --git a/salome_adm/unix/config_files/check_hdf5.m4 b/salome_adm/unix/config_files/check_hdf5.m4 index 96afbc5ae..966a47098 100644 --- a/salome_adm/unix/config_files/check_hdf5.m4 +++ b/salome_adm/unix/config_files/check_hdf5.m4 @@ -48,12 +48,15 @@ LOCAL_RLIBS="" if test -z $HDF5HOME then AC_MSG_WARN(undefined HDF5HOME variable which specify hdf5 installation directory) + AC_MSG_NOTICE(Trying native Hdf5...) else LOCAL_INCLUDES="-I$HDF5HOME/include" if test "x$HDF5HOME" = "x/usr" then + AC_MSG_NOTICE(Trying native Hdf5...) LOCAL_LIBS="" else + AC_MSG_NOTICE(Trying Hdf5 from $HDF5HOME ...) LOCAL_LIBS="-L$HDF5HOME/lib" LOCAL_RLIBS="-R$HDF5HOME/lib" fi @@ -86,6 +89,11 @@ then HDF5_MT_LIBS="$LOCAL_LIBS -lhdf5 $LOCAL_RLIBS" fi +if test "x$hdf5_ok" = "xyes" +then + HDF5_INCLUDES="$HDF5_INCLUDES -DH5_USE_16_API" +fi + AC_MSG_RESULT(for hdf5: $hdf5_ok) ])dnl diff --git a/salome_adm/unix/config_files/check_libbatch.m4 b/salome_adm/unix/config_files/check_libbatch.m4 new file mode 100644 index 000000000..52a95f39a --- /dev/null +++ b/salome_adm/unix/config_files/check_libbatch.m4 @@ -0,0 +1,115 @@ +dnl Copyright (C) 2007-2009 CEA/DEN, EDF R&D, OPEN CASCADE +dnl +dnl Copyright (C) 2003-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 +dnl email : webmaster.salome@opencascade.com +dnl + +# CHECK_LIBBATCH +# This macro can be used to find libBatch and set the associated variables in +# a project based on autoconf. You can copy this file in your own project and +# eventually modify it according to your own needs. +# ---------------------------------------------------------------------------- + +AC_DEFUN([CHECK_LIBBATCH],[ + +AC_MSG_NOTICE(Checking for libBatch library) + +AC_SUBST(LIBBATCH_INCLUDES) +AC_SUBST(LIBBATCH_LIBS) + +LIBBATCH_INCLUDES="" +LIBBATCH_LIBS="" + +libbatch_ok=no + +AC_ARG_WITH([libbatch], + [AS_HELP_STRING([--with-libbatch=DIR], + [root directory path of libBatch installation])], + [LIBBATCH_DIR="$withval"], + [LIBBATCH_DIR=""]) + +if test "x$LIBBATCH_DIR" = "x" ; then + # no --with-libbatch option used + if test "x$LIBBATCH_ROOT_DIR" != "x" ; then + # LIBBATCH_ROOT_DIR environment variable defined + LIBBATCH_DIR=$LIBBATCH_ROOT_DIR + fi +fi + +LOCAL_INCLUDES="" +LOCAL_LIBS="" + +if test "x$LIBBATCH_DIR" != "x" ; then + LOCAL_INCLUDES="-I$LIBBATCH_DIR/include" + if test "x$LIBBATCH_DIR" = "x/usr" ; then + LOCAL_LIBS="-lBatch" + else + LOCAL_LIBS="-L$LIBBATCH_DIR/lib -lBatch" + fi +else + LOCAL_INCLUDES="-I/usr/include" + LOCAL_LIBS="-lBatch" +fi + +# libBatch headers + +CPPFLAGS_old="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES" +AC_CHECK_HEADER(Batch/Batch_BatchManager.hxx, + libbatch_ok="yes", + libbatch_ok="no") +CPPFLAGS="$CPPFLAGS_old" + + +if test "x$libbatch_ok" = "xyes" ; then + # libBatch library + + LIBS_old=$LIBS + LIBS="$LIBS $LOCAL_LIBS" + # Can't use AC_SEARCH_LIBS or AC_CHECK_LIB here because + # they don't work with C++ namespaces + # AC_SEARCH_LIBS(Batch::BatchManagerCatalog::getInstance,Batch, + # libbatch_ok="yes",libbatch_ok="no") + AC_MSG_CHECKING( + [for library containing Batch::BatchManagerCatalog::getInstance]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + namespace Batch { + class BatchManagerCatalog { + public: static void getInstance(); + }; + } + ]], + [using namespace Batch; + BatchManagerCatalog::getInstance();])], + [libbatch_ok="yes"], + [libbatch_ok="no"]) + AC_MSG_RESULT($libbatch_ok) + + LIBS=$LIBS_old +fi + +if test "x$libbatch_ok" = "xyes" ; then + LIBBATCH_INCLUDES="$LOCAL_INCLUDES" + LIBBATCH_LIBS="$LOCAL_LIBS" +fi + +AC_MSG_RESULT(for libBatch: $libbatch_ok) + +]) diff --git a/salome_adm/unix/config_files/check_libxml.m4 b/salome_adm/unix/config_files/check_libxml.m4 index d5104cd42..a9bba03a3 100644 --- a/salome_adm/unix/config_files/check_libxml.m4 +++ b/salome_adm/unix/config_files/check_libxml.m4 @@ -39,11 +39,14 @@ then LOCAL_INCLUDES="-I$LIBXML_DIR/include/libxml2" if test "x$LIBXML_DIR" = "x/usr" then + AC_MSG_NOTICE(Trying native Libxml2...) LOCAL_LIBS="-lxml2" else + AC_MSG_NOTICE(Trying Libxml2 from $LIBXML_DIR ...) LOCAL_LIBS="-L$LIBXML_DIR/lib -lxml2" fi else + AC_MSG_NOTICE(Trying native Libxml2...) LOCAL_INCLUDES="-I/usr/include/libxml2" LOCAL_LIBS="-lxml2" fi diff --git a/salome_adm/unix/config_files/check_local.m4 b/salome_adm/unix/config_files/check_local.m4 deleted file mode 100755 index df683e86f..000000000 --- a/salome_adm/unix/config_files/check_local.m4 +++ /dev/null @@ -1,90 +0,0 @@ -dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -dnl -dnl Copyright (C) 2003-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 -# Check for Local -AC_DEFUN([CHECK_LOCAL], -[ - dnl AC_ARG_VAR([LOCAL], []) - AC_ARG_WITH([local], - AC_HELP_STRING([--with-local], - [tell configure script to use local submission. Default is --with-local.]), - [], - [withval=yes]) - - AC_MSG_CHECKING([for Local]) - - if test "x$withval" = "xyes" - then - WITH_LOCAL=yes - - AC_MSG_RESULT([$withval]) - - AC_ARG_VAR([RM], [A path to a rm-like command]) - AC_PATH_PROG([RM], [rm], [/bin/false]) - AC_DEFINE_UNQUOTED(RM, "$RM", [A path to a rm-like command]) - - AC_ARG_VAR([SH], [A path to a sh-like command]) - AC_PATH_PROG([SH], [sh], [/bin/false]) - AC_DEFINE_UNQUOTED(SH, "$SH", [A path to a sh-like command]) - AC_ARG_VAR([CP], [A path to a cp-like command]) - AC_PATH_PROG([CP], [cp], [/bin/false]) - AC_DEFINE_UNQUOTED(CP, "$CP", [A path to a cp-like command]) - - AC_ARG_VAR([RSH], [A path to a rsh-like command]) - AC_PATH_PROG([RSH], [rsh], [/bin/false]) - AC_DEFINE_UNQUOTED(RSH, "$RSH", [A path to a rsh-like command]) - AC_ARG_VAR([RCP], [A path to a rcp-like command]) - AC_PATH_PROG([RCP], [rcp], [/bin/false]) - AC_DEFINE_UNQUOTED(RCP, "$RCP", [A path to a rcp-like command]) - - AC_ARG_VAR([SSH], [A path to a ssh-like command]) - AC_PATH_PROG([SSH], [ssh], [/bin/false]) - AC_DEFINE_UNQUOTED(SSH, "$SSH", [A path to a ssh-like command]) - AC_ARG_VAR([SCP], [A path to a scp-like command]) - AC_PATH_PROG([SCP], [scp], [/bin/false]) - AC_DEFINE_UNQUOTED(SCP, "$SCP", [A path to a scp-like command]) - - - else - WITH_LOCAL=no - - AC_MSG_RESULT([no]) - - fi - - AM_CONDITIONAL(WITH_LOCAL, test $WITH_LOCAL = yes) - - localbatch_ok=$WITH_LOCAL - AC_SUBST(WITH_LOCAL) - AC_SUBST(RM) - AC_SUBST(SH) - AC_SUBST(CP) - AC_SUBST(RSH) - AC_SUBST(RCP) - AC_SUBST(SSH) - AC_SUBST(SCP) - - dnl _CS_gbo Pour forcer l'utilisation du config.h, inclu - dnl par les fichiers Batch_BatchManager_Local_*.cxx - dnl OWN_CONFIG_H=yes - dnl AC_SUBST(OWN_CONFIG_H) -]) - diff --git a/salome_adm/unix/config_files/check_lsf.m4 b/salome_adm/unix/config_files/check_lsf.m4 deleted file mode 100755 index 59e6694ba..000000000 --- a/salome_adm/unix/config_files/check_lsf.m4 +++ /dev/null @@ -1,105 +0,0 @@ -dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -dnl -dnl Copyright (C) 2003-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 -# Check for LSF -AC_DEFUN([CHECK_LSF], -[ - AC_ARG_WITH([lsf], - AC_HELP_STRING([--with-lsf[[[[[=path] ]]]]], - [tell configure script to use LSF that is located at . Default is no. If path is not given, it is automaticaly determined from LSF_ENVDIR variable.]), - [], - [withval=no]) - - AC_MSG_CHECKING([for LSF]) - - if test ! "x$withval" = "xno" - then - if test "x$withval" = "xyes" - then - if test ! "x$LSF_ENVDIR" = "x" - then - test -f "$LSF_ENVDIR/lsf.conf" && . "$LSF_ENVDIR/lsf.conf" - LSF=$LSF_TOP - else - dnl some default values ... - LSF=/usr - LSF_INCLUDEDIR=$LSF/include - LSF_LIBDIR=$LSF/lib - fi - else - LSF=$withval - LSF_INCLUDEDIR=$LSF/include - LSF_LIBDIR=$LSF/lib - fi - - AC_MSG_RESULT([$LSF]) - - dnl INCLUDE directory - - LSF_INCLUDES="-I${LSF_INCLUDEDIR}" - saved_CPPFLAGS=${CPPFLAGS} - CPPFLAGS="${CPPFLAGS} ${LSF_INCLUDES}" - AC_CHECK_HEADER([lsf/lsbatch.h], [lsf_header_found=yes], [lsf_header_found=no], []) - test x${lsf_header_found} = xno && AC_MSG_WARN([LSF include file not found]) - CPPFLAGS=${saved_CPPFLAGS} - AC_SUBST(LSF_INCLUDES) - - dnl LIB directory - - if test "x${LSF_LIBDIR}" = "x/usr/lib" - then - LSF_LDFLAGS="" - else - LSF_LDFLAGS="-L${LSF_LIBDIR}" - fi - LSF_LIBS="-lbat -llsf" - saved_LDFLAGS=${LDFLAGS} - saved_LIBS=${LIBS} - LDFLAGS="${LDFLAGS} ${LSF_LDFLAGS}" - lsf_lib_found=yes - AC_CHECK_LIB([lsf], [ls_load], [lsf_libs="-llsf ${lsf_libs}"], [lsf_lib_found=no], []) - AC_CHECK_LIB([bat], [lsb_init], [lsf_libs="-lbat ${lsf_libs}"], [lsf_lib_found=no], [-llsf]) - test x${lsf_lib_found} = xno && AC_MSG_WARN([LSF library not found]) - LIBS="${LSF_LIBS} ${LIBS}" - LDFLAGS=${saved_LDFLAGS} - LIBS=${saved_LIBS} - AC_SUBST(LSF_LDFLAGS) - AC_SUBST(LSF_LIBS) - - test x${lsf_lib_found} = xyes && test x${lsf_header_found} = xyes && WITH_LSF=yes - - else - WITH_LSF=no - - AC_MSG_RESULT([no]) - - fi - - AM_CONDITIONAL(WITH_LSF, test $WITH_LSF = yes) - - lsf_ok=$WITH_LSF - if test $lsf_ok = no ; then - lsf_ok= - fi - AC_SUBST(WITH_LSF) - -]) - diff --git a/salome_adm/unix/config_files/check_openpbs.m4 b/salome_adm/unix/config_files/check_openpbs.m4 deleted file mode 100644 index a0247bd9f..000000000 --- a/salome_adm/unix/config_files/check_openpbs.m4 +++ /dev/null @@ -1,88 +0,0 @@ -dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -dnl -dnl Copyright (C) 2003-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 -# Check for OpenPBS -AC_DEFUN([CHECK_OPENPBS], -[ - AC_ARG_VAR([OPENPBS], [OpenPBS home directory]) - AC_ARG_WITH([openpbs], - AC_HELP_STRING([--with-openpbs=], - [tell configure script to use OpenPBS that is located at ]), - [test ! x"${withval}" = xyes && OPENPBS=${withval}], - []) - - dnl AC_ARG_VAR([OPENPBSSERVERNAME], [OpenPBS server_name file]) - dnl AC_ARG_WITH([openpbs-server-name], - dnl AC_HELP_STRING([--with-openpbs-server-name=], - dnl [tell configure script to use OpenPBS server_name file that is located at ]), - dnl [test ! x"${withval}" = xyes && OPENPBSSERVERNAME=${withval}], - dnl [with_openpbs_server_name=""]) - - - if test -z "${OPENPBS}" - then - AC_MSG_WARN([Environment variable OPENPBS not set. Skipping OpenPBS configuration.]) - - else - - OPENPBS_INCLUDES="-I${OPENPBS}/include" - saved_CPPFLAGS=${CPPFLAGS} - CPPFLAGS="${CPPFLAGS} ${OPENPBS_INCLUDES}" - AC_CHECK_HEADER([pbs_ifl.h], [openpbs_header_found=yes], [openpbs_header_found=no], []) - test x${openpbs_header_found} = xno && AC_MSG_WARN([OpenPBS include file not found]) - CPPFLAGS=${saved_CPPFLAGS} - AC_SUBST(OPENPBS_INCLUDES) - - if test "x${OPENPBS}" = "x/usr" - then - OPENPBS_LIBDIR="" - else - OPENPBS_LIBDIR="-L${OPENPBS}/lib" - fi - OPENPBS_LIBS="-lpbs" - saved_LDFLAGS=${LDFLAGS} - saved_LIBS=${LIBS} - LDFLAGS="${LDFLAGS} ${OPENPBS_LIBDIR}" - AC_CHECK_LIB([pbs], [pbs_connect], [openpbs_lib_found=yes], [openpbs_lib_found=no], []) - test x${openpbs_lib_found} = xno && AC_MSG_WARN([OpenPBS library not found]) - LIBS="${LIBS} ${OPENPBS_LIBS}" - LDFLAGS=${saved_LDFLAGS} - LIBS=${saved_LIBS} - AC_SUBST(OPENPBS_LIBDIR) - AC_SUBST(OPENPBS_LIBS) - - dnl test -z "${OPENPBSSERVERNAME}" && OPENPBSSERVERNAME="/usr/spool/PBS/server_name" - dnl AC_CHECK_FILE([${OPENPBSSERVERNAME}], [openpbs_server_name_found=yes], [openpbs_server_name_found=no]) - - test x${openpbs_header_found} = xyes && test x${openpbs_lib_found} = xyes && openpbs_ok="yes" - - fi - - WITHOPENPBS=$openpbs_ok - if test x$WITHOPENPBS = x ; then - WITHOPENPBS=no - fi - AC_SUBST(WITHOPENPBS) - - AM_CONDITIONAL(WITH_OPENPBS, test $WITHOPENPBS = yes) - -]) - diff --git a/salome_adm/unix/config_files/local_install.m4 b/salome_adm/unix/config_files/local_install.m4 new file mode 100644 index 000000000..34c523a87 --- /dev/null +++ b/salome_adm/unix/config_files/local_install.m4 @@ -0,0 +1,65 @@ +dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +dnl +dnl Copyright (C) 2003-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 --- +dnl File : local_install.m4 +dnl Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +dnl --- +dnl + +dnl The purpose of below autoconf macro is to generate custom install script +dnl to be used instead of global /usr/bin/install one. +dnl The difference is that resulting install script does not install file passed +dnl as parameter if its target copy exists and the file is not changed, i.e +dnl source and target files are the identical. +dnl The check is performed by the diff command. + +AC_DEFUN([AC_LOCAL_INSTALL], +[ +GLOBAL_INSTALL=$INSTALL +absdir=`pwd` +INSTALL=${absdir}/local-install.sh +cat > ${INSTALL} << EOF +#!/bin/sh + +nb_args=\$[#] +args=\$[*] +if test \$nb_args -gt 1 ; then + nb=\$(expr \$nb_args - 2) + shift \$nb + target=\$[2] + if test -f \$target ; then + orig=\$[1] + if test -f \$orig ; then + diff \$orig \$target > /dev/null 2>&1 + if test \$[?] = 0 ; then + echo \$orig and \$target are identical + exit 0 + fi + fi + fi +fi +${GLOBAL_INSTALL} \$args +EOF +chmod +x ${INSTALL} +AC_SUBST(INSTALL) +AC_SUBST(GLOBAL_INSTALL) +])dnl diff --git a/salome_adm/unix/make_common_starter.am b/salome_adm/unix/make_common_starter.am index 13a4014ad..deb5ea9b3 100644 --- a/salome_adm/unix/make_common_starter.am +++ b/salome_adm/unix/make_common_starter.am @@ -19,6 +19,19 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + +# ============================================================ +# The following is to avoid PACKAGE_... env variable +# redefinition compilation warnings +# ============================================================ +if !WITHONLYLAUNCHER + AM_CXXFLAGS = -I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h + AM_CPPFLAGS = -I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h +else WITHONLYLAUNCHER + AM_CXXFLAGS = + AM_CPPFLAGS = +endif + # ============================================================ # This file defines the common definitions used in several # Makefile. This file must be included, if needed, by the file diff --git a/src/Batch/Batch_APIInternalFailureException.hxx b/src/Batch/Batch_APIInternalFailureException.hxx deleted file mode 100644 index a270a6a9f..000000000 --- a/src/Batch/Batch_APIInternalFailureException.hxx +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * APIInternalFailureException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 20 15:15:41 2003 - * Projet : Salome 2 - * - */ - -#ifndef _APIINTERNALFAILUREEXCEPTION_H_ -#define _APIINTERNALFAILUREEXCEPTION_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_GenericException.hxx" -#include "Batch_GenericException.hxx" - -namespace Batch { - - class BATCH_EXPORT APIInternalFailureException : public GenericException - { - public: - // Constructeur - APIInternalFailureException(std::string ch = "undefined") : GenericException("APIInternalFailureException", ch) {} - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager.cxx b/src/Batch/Batch_BatchManager.cxx deleted file mode 100644 index d4744af18..000000000 --- a/src/Batch/Batch_BatchManager.cxx +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include -#ifdef WIN32 -# include -#else -# include -#endif - -//#include "MEDMEM_STRING.hxx" -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_FactBatchManager.hxx" -#include "Batch_BatchManager.hxx" -using namespace std; - -namespace Batch { - - // Constructeur -// BatchManager::BatchManager(string host) throw(InvalidArgumentException) : _hostname(host), jobid_map() -// { -// // On verifie que le hostname est correct -// if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network -// string msg = "hostname \""; -// msg += _hostname; -// msg += "\" unknown from the network"; -// throw InvalidArgumentException(msg.c_str()); -// } -// } - BatchManager::BatchManager(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException) : _hostname(host), jobid_map(), _parent(parent) - { - // On verifie que le hostname est correct - if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network - string msg = "hostname \""; - msg += _hostname; - msg += "\" unknown from the network"; - throw InvalidArgumentException(msg.c_str()); - } - } - - // Destructeur - BatchManager::~BatchManager() - { - // Nothing to do - } - - string BatchManager::__repr__() const - { - ostringstream oss; - oss << "getType() : "unknown (no factory)") << "' connected to server '" << _hostname << "'>"; - return oss.str(); - } - - // Recupere le l'identifiant d'un job deja soumis au BatchManager -// const JobId BatchManager::getJobIdByReference(const string & ref) -// { -// return JobId(this, ref); -// } - const JobId BatchManager::getJobIdByReference(const char * ref) - { - return JobId(this, ref); - } - -// // Methode pour le controle des jobs : soumet un job au gestionnaire -// const JobId BatchManager::submitJob(const Job & job) -// { -// static int idx = 0; -// //MEDMEM::STRING sst; -// ostringstream sst; -// sst << "Jobid_" << idx++; -// JobId id(this, sst.str()); -// return id; -// } - -// // Methode pour le controle des jobs : retire un job du gestionnaire -// void BatchManager::deleteJob(const JobId & jobid) -// { -// // Nothing to do -// } - -// // Methode pour le controle des jobs : suspend un job en file d'attente -// void BatchManager::holdJob(const JobId & jobid) -// { -// // Nothing to do -// } - -// // Methode pour le controle des jobs : relache un job suspendu -// void BatchManager::releaseJob(const JobId & jobid) -// { -// // Nothing to do -// } - -// // Methode pour le controle des jobs : modifie un job en file d'attente -// void BatchManager::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) -// { -// // Nothing to do -// } - -// // Methode pour le controle des jobs : modifie un job en file d'attente -// void BatchManager::alterJob(const JobId & jobid, const Parametre & param) -// { -// // Nothing to do -// } - -// // Methode pour le controle des jobs : modifie un job en file d'attente -// void BatchManager::alterJob(const JobId & jobid, const Environnement & env) -// { -// // Nothing to do -// } - -// // Methode pour le controle des jobs : renvoie l'etat du job -// JobInfo BatchManager::queryJob(const JobId & jobid) -// { -// return JobInfo(); -// } - -} diff --git a/src/Batch/Batch_BatchManager.hxx b/src/Batch/Batch_BatchManager.hxx deleted file mode 100644 index bda29616c..000000000 --- a/src/Batch/Batch_BatchManager.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _BATCHMANAGER_H_ -#define _BATCHMANAGER_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_InvalidArgumentException.hxx" - -namespace Batch { - - class Job; - class JobId; - class JobInfo; - class FactBatchManager; - - class BATCH_EXPORT BatchManager - { - public: - // Constructeur et destructeur - //BatchManager(std::string host="localhost") throw(InvalidArgumentException); // connexion a la machine host - BatchManager(const Batch::FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException); // connexion a la machine host - virtual ~BatchManager(); - virtual std::string __repr__() const; - - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const std::string & ref); - virtual const Batch::JobId getJobIdByReference(const char * ref); - - // Methodes pour le controle des jobs : virtuelles pures - virtual const Batch::JobId submitJob(const Batch::Job & job) = 0; // soumet un job au gestionnaire - virtual void deleteJob(const Batch::JobId & jobid) = 0; // retire un job du gestionnaire - virtual void holdJob(const Batch::JobId & jobid) = 0; // suspend un job en file d'attente - virtual void releaseJob(const Batch::JobId & jobid) = 0; // relache un job suspendu - virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param, const Batch::Environnement & env) = 0; // modifie un job en file d'attente - virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param) = 0; // modifie un job en file d'attente - virtual void alterJob(const Batch::JobId & jobid, const Batch::Environnement & env) = 0; // modifie un job en file d'attente - virtual Batch::JobInfo queryJob(const Batch::JobId & jobid) = 0; // renvoie l'etat du job - - protected: - std::string _hostname; // serveur ou tourne le BatchManager - // std::map< const std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis - std::map< std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis - const Batch::FactBatchManager * _parent; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManagerCatalog.cxx b/src/Batch/Batch_BatchManagerCatalog.cxx deleted file mode 100644 index e2d341ec6..000000000 --- a/src/Batch/Batch_BatchManagerCatalog.cxx +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManagerCatalog.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include -#include -#include "Batch_BatchManagerCatalog.hxx" -#include "Batch_FactBatchManager.hxx" -using namespace std; - -namespace Batch { - - pthread_mutex_t BatchManagerCatalog::_mutex = PTHREAD_MUTEX_INITIALIZER; - std::map * BatchManagerCatalog::_p_catalog = 0; - BatchManagerCatalog BatchManagerCatalog::theCatalog; - - // Constructeur - BatchManagerCatalog::BatchManagerCatalog() - { - // Nothing to do - } - - // Destructeur - BatchManagerCatalog::~BatchManagerCatalog() - { - delete BatchManagerCatalog::_p_catalog; - } - - // Functor - FactBatchManager * BatchManagerCatalog::getFactBatchManager(const char * type) - { - return (* BatchManagerCatalog::_p_catalog)[type]; - } - - void BatchManagerCatalog::addFactBatchManager(const char * type, FactBatchManager * pFBM) - { - if (pFBM) { // *** section critique *** - pthread_mutex_lock(&_mutex); - - if (! BatchManagerCatalog::_p_catalog) BatchManagerCatalog::_p_catalog = new std::map; - (*BatchManagerCatalog::_p_catalog)[type] = pFBM; - - pthread_mutex_unlock(&_mutex); - } - } - - FactBatchManager * BatchManagerCatalog::operator() (const char * type) const - { - return BatchManagerCatalog::getFactBatchManager(type); - } - - std::map * BatchManagerCatalog::dict() const - { - return _p_catalog; - } - - string BatchManagerCatalog::__repr__() const - { - ostringstream oss; - oss << "::const_iterator it = (*_p_catalog).begin(); it != (*_p_catalog).end(); it++, sep=", ") { - oss << sep << "'" << (*it).first << "' : '" << (*it).second->__repr__() << "'"; - } - oss << "}>"; - return oss.str(); - } - -} diff --git a/src/Batch/Batch_BatchManagerCatalog.hxx b/src/Batch/Batch_BatchManagerCatalog.hxx deleted file mode 100644 index 0e95cc622..000000000 --- a/src/Batch/Batch_BatchManagerCatalog.hxx +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManagerCatalog.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _CATALOG_H_ -#define _CATALOG_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include - -namespace Batch { - - class FactBatchManager; - - class BATCH_EXPORT BatchManagerCatalog - { - public: - // Constructeur - BatchManagerCatalog(); - // Destructeur - virtual ~BatchManagerCatalog(); - - static Batch::FactBatchManager * getFactBatchManager(const char * type); - static void addFactBatchManager(const char * type, Batch::FactBatchManager * pFBM); - virtual Batch::FactBatchManager * operator() (const char * type) const; - - virtual std::map * dict() const; - virtual std::string __repr__() const; - - protected: - static BatchManagerCatalog theCatalog; - static std::map * _p_catalog; - static pthread_mutex_t _mutex; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_LSF.cxx b/src/Batch/Batch_BatchManager_LSF.cxx deleted file mode 100644 index ae8afada9..000000000 --- a/src/Batch/Batch_BatchManager_LSF.cxx +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_LSF.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -extern "C" { -#include -#include -} -#include -#include -#include -#include -#include "Batch_BatchManager_LSF.hxx" - -using namespace std; - -namespace Batch { - - BatchManager_LSF::BatchManager_LSF(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host) - { - // On se connecte au serveur LSF - _connect = lsb_init("Salome2 Batch library"); - if (_connect < 0) { // si erreur - char * errmsg = lsb_sysmsg(); - string msg = "LSF Server on host \""; - msg += _hostname; - msg += "\" : "; - msg += errmsg ? errmsg : "Reason unknown"; - throw ConnexionFailureException(msg.c_str()); - } - } - - // Destructeur - BatchManager_LSF::~BatchManager_LSF() - { - // Nothing to do - } - - // Methode pour le controle des jobs : soumet un job au gestionnaire - const JobId BatchManager_LSF::submitJob(const Job & job) - { - Job_LSF joblsf = job; - struct submitReply reply; - int ref = lsb_submit(joblsf.getSubmitStruct(), - &reply); - if (ref < 0) { // si erreur - char * msg = lsb_sysmsg(); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("LSF submit error. Reason : ") + msg); - } - - ostringstream oss; - oss << ref; - JobId id(this, oss.str()); - return id; - } - - // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager_LSF::deleteJob(const JobId & jobid) - { - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - int rc = lsb_deletejob(ref, 0, 0); - if (rc < 0) { // si erreur - char * msg = lsb_sysmsg(); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("LSF deljob error. Reason : ") + msg); - } - } - - // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager_LSF::holdJob(const JobId & jobid) - { - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - int rc = lsb_signaljob(ref, SIGSTOP); - if (rc < 0) { // si erreur - char * msg = lsb_sysmsg(); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("LSF signaljob error. Reason : ") + msg); - } - } - - // Methode pour le controle des jobs : relache un job suspendu - void BatchManager_LSF::releaseJob(const JobId & jobid) - { - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - int rc = lsb_signaljob(ref, SIGCONT); - if (rc < 0) { // si erreur - char * msg = lsb_sysmsg(); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("LSF signaljob error. Reason : ") + msg); - } - } - - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_LSF::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) - { - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - - Job_LSF joblsf = Job(param, env); - struct submitReply reply; - ref = lsb_modify(joblsf.getSubmitStruct(), - &reply, - ref); - if (ref < 0) { // si erreur - ostringstream msg_sst; - char * msg = lsb_sysmsg(); - if (!msg) msg = "unknown"; - msg_sst << msg << endl; -// msg_sst << "BadJobId = " << (long) reply.badJobId << endl -// << "BadJobName = " << reply.badJobName << endl -// << "BadReqIndx = " << reply.badReqIndx << endl; - throw APIInternalFailureException(string("LSF modify error. Reason : ") + msg_sst.str()); - } - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_LSF::alterJob(const JobId & jobid, const Parametre & param) - { - alterJob(jobid, param, Environnement()); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_LSF::alterJob(const JobId & jobid, const Environnement & env) - { - alterJob(jobid, Parametre(), env); - } - - - - // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager_LSF::queryJob(const JobId & jobid) - { - int id; - istringstream iss(jobid.getReference()); - iss >> id; - - JobInfo_LSF ji = JobInfo_LSF(id); - - return ji; - } - - - - // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_LSF::isRunning(const JobId & jobid) - { - int id; - istringstream iss(jobid.getReference()); - iss >> id; - - JobInfo_LSF ji = JobInfo_LSF(id); - - return ji.isRunning(); - } - - - -} diff --git a/src/Batch/Batch_BatchManager_LSF.hxx b/src/Batch/Batch_BatchManager_LSF.hxx deleted file mode 100644 index 283be2f8d..000000000 --- a/src/Batch/Batch_BatchManager_LSF.hxx +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_LSF.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifndef _BATCHMANAGER_LSF_H_ -#define _BATCHMANAGER_LSF_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_Job.hxx" -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_LSF.hxx" -#include "Batch_Job_LSF.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager.hxx" - -namespace Batch { - - class Job; - class JobId; - class JobInfo; - class FactBatchManager; - - class BATCH_EXPORT BatchManager_LSF : public BatchManager - { - public: - // Constructeur et destructeur - BatchManager_LSF(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_LSF(); - - // Recupere le nom du serveur par defaut - // static string BatchManager_LSF::getDefaultServer(); - - // Methodes pour le controle des jobs - virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire - virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire - virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente - virtual void releaseJob(const JobId & jobid); // relache un job suspendu - virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente - virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job - virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine - - virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente - virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente - - - protected: - int _connect; // LSF connect id - - private: - -#ifdef SWIG - public: - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); } - virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); } -#endif - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_Local.cxx b/src/Batch/Batch_BatchManager_Local.cxx deleted file mode 100644 index 373547060..000000000 --- a/src/Batch/Batch_BatchManager_Local.cxx +++ /dev/null @@ -1,828 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* -* BatchManager_Local.cxx : -* -* Auteur : Ivan DUTKA-MALEN - EDF R&D -* Mail : mailto:ivan.dutka-malen@der.edf.fr -* Date : Thu Nov 6 10:17:22 2003 -* Projet : Salome 2 -* -*/ - -#include -#include -#include -#include -#include - -#include -#ifdef WIN32 -# include -#else -# include -# include -#endif -#include -#include -#include -#include -#include -#include "Batch_IOMutex.hxx" -#include "Batch_BatchManager_Local.hxx" - -using namespace std; - -namespace Batch { - - - // Constructeur - BatchManager_Local::BatchManager_Local(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host), _connect(0), _threads_mutex(), _threads(), _thread_id_id_association_mutex(), _thread_id_id_association_cond() -#ifndef WIN32 //TODO: porting of following functionality - ,_thread_id_id_association() -#endif - { - pthread_mutex_init(&_threads_mutex, NULL); - pthread_mutex_init(&_thread_id_id_association_mutex, NULL); - pthread_cond_init(&_thread_id_id_association_cond, NULL); - } - - // Destructeur - BatchManager_Local::~BatchManager_Local() - { - pthread_mutex_destroy(&_threads_mutex); - pthread_mutex_destroy(&_thread_id_id_association_mutex); - pthread_cond_destroy(&_thread_id_id_association_cond); - } - - // Methode pour le controle des jobs : soumet un job au gestionnaire - const JobId BatchManager_Local::submitJob(const Job & job) - { - Job_Local jobLocal = job; - - pthread_t thread_id = submit(jobLocal); - - ostringstream oss; - oss << getIdByThread_id(thread_id); - - JobId id(this, oss.str()); - - return id; - } - - // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager_Local::deleteJob(const JobId & jobid) - { - Id id; - - istringstream iss(jobid.getReference()); - iss >> id; - - // On retrouve le thread_id du thread - pthread_t thread_id; - - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_threads_mutex); - if (_threads.find(id) != _threads.end()) - thread_id = _threads[id].thread_id; - pthread_mutex_unlock(&_threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - - cancel(thread_id); - } - - // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager_Local::holdJob(const JobId & jobid) - { - Id id; - istringstream iss(jobid.getReference()); - iss >> id; - - UNDER_LOCK( cout << "BatchManager is sending HOLD command to the thread " << id << endl ); - - // On introduit une commande dans la queue du thread - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_threads_mutex); - if (_threads.find(id) != _threads.end()) - _threads[id].command_queue.push(HOLD); - pthread_mutex_unlock(&_threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - } - - // Methode pour le controle des jobs : relache un job suspendu - void BatchManager_Local::releaseJob(const JobId & jobid) - { - Id id; - istringstream iss(jobid.getReference()); - iss >> id; - - UNDER_LOCK( cout << "BatchManager is sending RELEASE command to the thread " << id << endl ); - - // On introduit une commande dans la queue du thread - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_threads_mutex); - if (_threads.find(id) != _threads.end()) - _threads[id].command_queue.push(RELEASE); - pthread_mutex_unlock(&_threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - } - - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_Local::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) - { - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_Local::alterJob(const JobId & jobid, const Parametre & param) - { - alterJob(jobid, param, Environnement()); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_Local::alterJob(const JobId & jobid, const Environnement & env) - { - alterJob(jobid, Parametre(), env); - } - - - - // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager_Local::queryJob(const JobId & jobid) - { - Id id; - istringstream iss(jobid.getReference()); - iss >> id; - - Parametre param; - Environnement env; - - //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : AVANT section critique" << endl ); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_threads_mutex); - param = _threads[id].param; - env = _threads[id].env; - pthread_mutex_unlock(&_threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : APRES section critique" << endl ); - - JobInfo_Local ji(param, env); - return ji; - } - - - - // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_Local::isRunning(const JobId & jobid) - { - Id id; - istringstream iss(jobid.getReference()); - iss >> id; - - Status status; - - //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : AVANT section critique" << endl ); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_threads_mutex); - status = _threads[id].status; - pthread_mutex_unlock(&_threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : APRES section critique" << endl ); - - return (status == RUNNING); - } - - - // Methode d'execution d'un job - pthread_t BatchManager_Local::submit(const Job_Local & job) - { - // L'id du thread a creer - pthread_t thread_id = -#ifdef WIN32 - {0,0}; -#else - 0; -#endif - - // Les attributs du thread a sa creation - pthread_attr_t thread_attr; - pthread_attr_init(&thread_attr); - pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); - - ThreadAdapter * p_ta = new ThreadAdapter(*this, job); - - // Creation du thread qui va executer la commande systeme qu'on lui passe - int rc = pthread_create(&thread_id, - &thread_attr, - &ThreadAdapter::run, - static_cast(p_ta)); - if (rc) { - } - - // Liberation des zones memoire maintenant inutiles occupees par les attributs du thread - pthread_attr_destroy(&thread_attr); - - return thread_id; - } - - - // Methode de destruction d'un job - void BatchManager_Local::cancel(pthread_t thread_id) - { - pthread_cancel(thread_id); - } - - - // Fabrique un identifiant unique pour les threads puisque le thread_id n'est pas unique - // au cours du temps (il peut etre reutilise lorsqu'un thread se termine) - // ATTENTION : cette methode est uniquement protegee par la section critique de l'association - // Thread_id / Id (_thread_id_id_association_mutex) - BatchManager_Local::Id BatchManager_Local::nextId() - { - static Id id = 0; - Id nextId = id++; - //UNDER_LOCK( cout << "BatchManager_Local::Id BatchManager_Local::nextId() : Id = " << nextId << endl ); - return nextId; - } - - - // Retourne l'Id enregistre dans l'association Thread_id / Id et le detruit immediatement - BatchManager_Local::Id BatchManager_Local::getIdByThread_id(pthread_t thread_id) - { - Id id = -1; - - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_thread_id_id_association_mutex); -#ifndef WIN32 //TODO: porting of following functionality - while (_thread_id_id_association.find(thread_id) == _thread_id_id_association.end()) - pthread_cond_wait(&_thread_id_id_association_cond, &_thread_id_id_association_mutex); - - id = _thread_id_id_association[thread_id]; - _thread_id_id_association.erase(thread_id); -#endif - - pthread_mutex_unlock(&_thread_id_id_association_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - - //UNDER_LOCK( cout << "BatchManager_Local::Id BatchManager_Local::getIdByThread_id(pthread_t thread_id) : Id = " << id << " - thread_id = " << thread_id << endl ); - return id; - } - - - // Associe un Thread_id a un Id nouvellement cree - BatchManager_Local::Id BatchManager_Local::registerThread_id(pthread_t thread_id) - { - Id id = -1; - - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_thread_id_id_association_mutex); -#ifndef WIN32 //TODO: porting of following functionality - if (_thread_id_id_association.find(thread_id) == _thread_id_id_association.end()) { - id = _thread_id_id_association[thread_id] = nextId(); - pthread_cond_signal(&_thread_id_id_association_cond); - - } else { - UNDER_LOCK( cerr << "ERROR : Pthread Inconstency. Two threads own the same thread_id." << endl ); - } -#endif - pthread_mutex_unlock(&_thread_id_id_association_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - - //UNDER_LOCK( cout << "BatchManager_Local::Id BatchManager_Local::registerThread_id(pthread_t thread_id) : Id = " << id << " - thread_id = " << thread_id << endl ); - return id; - } - - - // Constructeur de la classe ThreadAdapter - BatchManager_Local::ThreadAdapter::ThreadAdapter(BatchManager_Local & bm, const Job_Local & job) : - _bm(bm), _job(job) - { - // Nothing to do - } - - - - // Methode d'execution du thread - void * BatchManager_Local::ThreadAdapter::run(void * arg) - { -#ifndef WIN32 //TODO: porting of following functionality - // On bloque tous les signaux pour ce thread - sigset_t setmask; - sigfillset(&setmask); - pthread_sigmask(SIG_BLOCK, &setmask, NULL); - - // On autorise la terminaison differee du thread - // (ces valeurs sont les valeurs par defaut mais on les force par precaution) - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); - - // On enregistre la fonction de suppression du fils en cas d'arret du thread - // Cette fontion sera automatiquement appelee lorsqu'une demande d'annulation - // sera prise en compte par pthread_testcancel() - pid_t child; - pthread_cleanup_push(BatchManager_Local::kill_child_on_exit, static_cast (&child)); - pthread_cleanup_push(BatchManager_Local::delete_on_exit, arg); - - ThreadAdapter * p_ta = static_cast(arg); - - - - - // Le code retour cumule (ORed) de tous les appels - // Nul en cas de reussite de l'ensemble des operations - int rc = 0; - - // Cette table contient la liste des fichiers a detruire a la fin du processus - std::vector files_to_delete; - - - - // On copie les fichiers d'entree pour le fils - const Parametre param = p_ta->_job.getParametre(); - Parametre::const_iterator it; - - // On initialise la variable workdir a la valeur du Current Working Directory - char * cwd = -#ifdef WIN32 - _getcwd(NULL, 0); -#else - new char [PATH_MAX]; - getcwd(cwd, PATH_MAX); -#endif - string workdir = cwd; - delete [] cwd; - - if ( (it = param.find(WORKDIR)) != param.end() ) { - workdir = static_cast( (*it).second ); - } - - string executionhost = string(param[EXECUTIONHOST]); - - if ( (it = param.find(INFILE)) != param.end() ) { - Versatile V = (*it).second; - Versatile::iterator Vit; - - for(Vit=V.begin(); Vit!=V.end(); Vit++) { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple cp = cpt; - string local = cp.getLocal(); - string remote = cp.getRemote(); - - string copy_cmd = p_ta->getBatchManager().copy_command("", local, executionhost, workdir + "/" + remote); - UNDER_LOCK( cout << "Copying : " << copy_cmd << endl ); - - if (system(copy_cmd.c_str()) ) { - // Echec de la copie - rc |= 1; - } else { - // On enregistre le fichier comme etant a detruire - files_to_delete.push_back(workdir + "/" + remote); - } - - } - } - - - - -#ifdef WIN32 - //TODO - //Using CreateThread instead fork() POSIX function -#else - // On forke/exec un nouveau process pour pouvoir controler le fils - // (plus finement qu'avec un appel system) - // int rc = system(commande.c_str()); - child = fork(); - if (child < 0) { // erreur - UNDER_LOCK( cerr << "Fork impossible (rc=" << child << ")" << endl ); - - } else if (child > 0) { // pere - p_ta->pere(child); - - } else { // fils - p_ta->fils(); - } -#endif - - - - // On copie les fichiers de sortie du fils - if ( (it = param.find(OUTFILE)) != param.end() ) { - Versatile V = (*it).second; - Versatile::iterator Vit; - - for(Vit=V.begin(); Vit!=V.end(); Vit++) { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple cp = cpt; - string local = cp.getLocal(); - string remote = cp.getRemote(); - - string copy_cmd = p_ta->getBatchManager().copy_command(executionhost, workdir + "/" + remote, "", local); - UNDER_LOCK( cout << "Copying : " << copy_cmd << endl ); - - if (system(copy_cmd.c_str()) ) { - // Echec de la copie - rc |= 1; - } else { - // On enregistre le fichier comme etant a detruire - files_to_delete.push_back(workdir + "/" + remote); - } - - } - } - - - - - // On efface les fichiers d'entree et de sortie du fils si les copies precedentes ont reussi - // ou si la creation du fils n'a pu avoir lieu - if ( (rc == 0) || (child < 0) ) { - std::vector::const_iterator it; - for(it=files_to_delete.begin(); it!=files_to_delete.end(); it++) { - string remove_cmd = p_ta->getBatchManager().remove_command(executionhost, *it); - UNDER_LOCK( cout << "Removing : " << remove_cmd << endl ); - system(remove_cmd.c_str()); - } - } - - - - // On retire la fonction de nettoyage de la memoire - pthread_cleanup_pop(0); - - // On retire la fonction de suppression du fils - pthread_cleanup_pop(0); - - - - // On invoque la fonction de nettoyage de la memoire - delete_on_exit(arg); - - UNDER_LOCK( cout << "Father is leaving" << endl ); - pthread_exit(NULL); -#endif - return NULL; - } - - - - - void BatchManager_Local::ThreadAdapter::pere(pid_t child) - { -#ifndef WIN32 //TODO: porting of following functionality - time_t child_starttime = time(NULL); - - // On enregistre le fils dans la table des threads - pthread_t thread_id = pthread_self(); - Id id = _bm.registerThread_id(thread_id); - - Parametre param = _job.getParametre(); - Environnement env = _job.getEnvironnement(); - - ostringstream thread_id_sst; - thread_id_sst << id; - param[ID] = thread_id_sst.str(); - param[STATE] = "Running"; - param[PID] = child; - - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - _bm._threads[id].thread_id = thread_id; - _bm._threads[id].pid = child; - _bm._threads[id].status = RUNNING; - _bm._threads[id].param = param; - _bm._threads[id].env = env; - _bm._threads[id].command_queue.push(NOP); - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - - - - - - // on boucle en attendant que le fils ait termine - while (1) { - int child_rc = 0; - pid_t child_wait_rc = waitpid(child, &child_rc, WNOHANG /* | WUNTRACED */); - if (child_wait_rc > 0) { - if (WIFSTOPPED(child_rc)) { - // NOTA : pour rentrer dans cette section, il faut que le flag WUNTRACED - // soit positionne dans l'appel a waitpid ci-dessus. Ce flag est couramment - // desactive car s'il est possible de detecter l'arret d'un process, il est - // plus difficile de detecter sa reprise. - - // Le fils est simplement stoppe - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - _bm._threads[id].status = STOPPED; - _bm._threads[id].param[STATE] = "Stopped"; - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - UNDER_LOCK( cout << "Father sees his child is STOPPED : " << child_wait_rc << endl ); - - } - else { - // Le fils est termine, on sort de la boucle et du if englobant - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - _bm._threads[id].status = DONE; - _bm._threads[id].param[STATE] = "Done"; - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - UNDER_LOCK( cout << "Father sees his child is DONE : " << child_wait_rc << " (child_rc=" << (WIFEXITED(child_rc) ? WEXITSTATUS(child_rc) : -1) << ")" << endl ); - break; - } - } - else if (child_wait_rc == -1) { - // Le fils a disparu ... - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - _bm._threads[id].status = DEAD; - _bm._threads[id].param[STATE] = "Dead"; - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - UNDER_LOCK( cout << "Father sees his child is DEAD : " << child_wait_rc << " (Reason : " << strerror(errno) << ")" << endl ); - break; - } - - - - // On teste si le thread doit etre detruit - pthread_testcancel(); - - - - // On regarde si le fils n'a pas depasse son temps (wallclock time) - time_t child_currenttime = time(NULL); - time_t child_elapsedtime = child_currenttime - child_starttime; - if (param.find(MAXWALLTIME) != param.end()) { - int maxwalltime = param[MAXWALLTIME]; - // cout << "child_starttime = " << child_starttime << endl - // << "child_currenttime = " << child_currenttime << endl - // << "child_elapsedtime = " << child_elapsedtime << endl - // << "maxwalltime = " << maxwalltime << endl - // << "int(maxwalltime * 1.1) = " << int(maxwalltime * 1.1) << endl; - if (child_elapsedtime > int(maxwalltime * 1.1) ) { // On se donne 10% de marge avant le KILL - UNDER_LOCK( cout << "Father is sending KILL command to the thread " << id << endl ); - // On introduit une commande dans la queue du thread - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - if (_bm._threads.find(id) != _bm._threads.end()) - _bm._threads[id].command_queue.push(KILL); - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - - - } else if (child_elapsedtime > maxwalltime ) { - UNDER_LOCK( cout << "Father is sending TERM command to the thread " << id << endl ); - // On introduit une commande dans la queue du thread - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - if (_bm._threads.find(id) != _bm._threads.end()) - _bm._threads[id].command_queue.push(TERM); - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - } - } - - - - // On regarde s'il y a quelque chose a faire dans la queue de commande - // @@@ --------> SECTION CRITIQUE <-------- @@@ - pthread_mutex_lock(&_bm._threads_mutex); - if (_bm._threads.find(id) != _bm._threads.end()) { - while (_bm._threads[id].command_queue.size() > 0) { - Commande cmd = _bm._threads[id].command_queue.front(); - _bm._threads[id].command_queue.pop(); - - switch (cmd) { - case NOP: - UNDER_LOCK( cout << "Father does nothing to his child" << endl ); - break; - - case HOLD: - UNDER_LOCK( cout << "Father is sending SIGSTOP signal to his child" << endl ); - kill(child, SIGSTOP); - break; - - case RELEASE: - UNDER_LOCK( cout << "Father is sending SIGCONT signal to his child" << endl ); - kill(child, SIGCONT); - break; - - case TERM: - UNDER_LOCK( cout << "Father is sending SIGTERM signal to his child" << endl ); - kill(child, SIGTERM); - break; - - case KILL: - UNDER_LOCK( cout << "Father is sending SIGKILL signal to his child" << endl ); - kill(child, SIGKILL); - break; - - case ALTER: - break; - - default: - break; - } - } - - } - pthread_mutex_unlock(&_bm._threads_mutex); - // @@@ --------> SECTION CRITIQUE <-------- @@@ - - // On fait une petite pause pour ne pas surcharger inutilement le processeur - sleep(1); - - } -#endif - - - } - - - - - void BatchManager_Local::ThreadAdapter::fils() - { -#ifndef WIN32 //TODO: porting of following functionality - Parametre param = _job.getParametre(); - Parametre::iterator it; - - try { - - // On se place dans le repertoire de travail - if ( (it = param.find(WORKDIR)) != param.end() ) { - string workdir = static_cast( (*it).second ); - chdir(workdir.c_str()); - } - - - - - // EXECUTABLE is MANDATORY, if missing, we exit with failure notification - char * execpath = NULL; - if (param.find(EXECUTABLE) != param.end()) { - string executable = _bm.exec_command(param); - execpath = new char [executable.size() + 1]; - strncpy(execpath, executable.c_str(), executable.size() + 1); - } else exit(1); - - string debug_command = execpath; - - string name = (param.find(NAME) != param.end()) ? param[NAME] : param[EXECUTABLE]; - - char ** argv = NULL; - if (param.find(ARGUMENTS) != param.end()) { - Versatile V = param[ARGUMENTS]; - - argv = new char * [V.size() + 2]; // 1 pour name et 1 pour le NULL terminal - - argv[0] = new char [name.size() + 1]; - strncpy(argv[0], name.c_str(), name.size() + 1); - - debug_command += string(" # ") + argv[0]; - - int i = 1; - for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++, i++) { - StringType argt = * static_cast(*it); - string arg = argt; - argv[i] = new char [arg.size() + 1]; - strncpy(argv[i], arg.c_str(), arg.size() + 1); - debug_command += string(" # ") + argv[i]; - } - - // assert (i == V.size() + 1) - argv[i] = NULL; - } - - - UNDER_LOCK( cout << "*** debug_command = " << debug_command << endl ); - - - - Environnement env = _job.getEnvironnement(); - - - char ** envp = NULL; - if(env.size() > 0) { - envp = new char * [env.size() + 1]; // 1 pour le NULL terminal - int i = 0; - for(Environnement::const_iterator it=env.begin(); it!=env.end(); it++, i++) { - const string & key = (*it).first; - const string & value = (*it).second; - ostringstream oss; - oss << key << "=" << value; - envp[i] = new char [oss.str().size() + 1]; - strncpy(envp[i], oss.str().c_str(), oss.str().size() + 1); - } - - // assert (i == env.size()) - envp[i] = NULL; - } - - - - - // On positionne les limites systeme imposees au fils - if (param.find(MAXCPUTIME) != param.end()) { - int maxcputime = param[MAXCPUTIME]; - struct rlimit limit; - limit.rlim_cur = maxcputime; - limit.rlim_max = int(maxcputime * 1.1); - setrlimit(RLIMIT_CPU, &limit); - } - - if (param.find(MAXDISKSIZE) != param.end()) { - int maxdisksize = param[MAXDISKSIZE]; - struct rlimit limit; - limit.rlim_cur = maxdisksize * 1024; - limit.rlim_max = int(maxdisksize * 1.1) * 1024; - setrlimit(RLIMIT_FSIZE, &limit); - } - - if (param.find(MAXRAMSIZE) != param.end()) { - int maxramsize = param[MAXRAMSIZE]; - struct rlimit limit; - limit.rlim_cur = maxramsize * 1024; - limit.rlim_max = int(maxramsize * 1.1) * 1024; - setrlimit(RLIMIT_AS, &limit); - } - - - - // On cree une session pour le fils de facon a ce qu'il ne soit pas - // detruit lorsque le shell se termine (le shell ouvre une session et - // tue tous les process appartenant a la session en quittant) - setsid(); - - - // On ferme les descripteurs de fichiers standards - //close(STDIN_FILENO); - //close(STDOUT_FILENO); - //close(STDERR_FILENO); - - - // On execute la commande du fils - execve(execpath, argv, envp); - - // No need to deallocate since nothing happens after a successful exec - - // Normalement on ne devrait jamais arriver ici - ofstream file_err("error.log"); - UNDER_LOCK( file_err << "Echec de l'appel a execve" << endl ); - - } catch (GenericException & e) { - - std::cerr << "Caught exception : " << e.type << " : " << e.message << std::endl; - } - - exit(99); -#endif - } - - - - - void BatchManager_Local::kill_child_on_exit(void * p_pid) - { -#ifndef WIN32 - //TODO: porting of following functionality - pid_t child = * static_cast(p_pid); - - // On tue le fils - kill(child, SIGTERM); - - // Nota : on pourrait aussi faire a la suite un kill(child, SIGKILL) - // mais cette option n'est pas implementee pour le moment, car il est - // preferable de laisser le process fils se terminer normalement et seul. -#endif - } - - void BatchManager_Local::delete_on_exit(void * arg) - { - ThreadAdapter * p_ta = static_cast(arg); - delete p_ta; - } - -} diff --git a/src/Batch/Batch_BatchManager_Local.hxx b/src/Batch/Batch_BatchManager_Local.hxx deleted file mode 100644 index 894c75a21..000000000 --- a/src/Batch/Batch_BatchManager_Local.hxx +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_Local.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifndef _BATCHMANAGER_LOCAL_H_ -#define _BATCHMANAGER_LOCAL_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include -#include -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_Local.hxx" -#include "Batch_Job_Local.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager.hxx" - -namespace Batch { - - class FactBatchManager; - - class BATCH_EXPORT BatchManager_Local : public BatchManager - { - private: - friend class ThreadAdapter; - class ThreadAdapter{ - public: - ThreadAdapter(BatchManager_Local & bm, const Job_Local & job); - static void * run(void * arg); - BatchManager_Local & getBatchManager() const { return _bm; }; - - protected: - BatchManager_Local & _bm; - const Job_Local _job; - - private: - void pere(pid_t child); - void fils(); - - }; - - typedef int Id; - - enum Commande { - NOP = 0, - HOLD, - RELEASE, - TERM, - KILL, - ALTER, - }; - - enum Status { - UNKNOWN = 0, - RUNNING, - STOPPED, - DONE, - DEAD, - }; - - struct Child { - pthread_t thread_id; - std::queue > command_queue; - pid_t pid; - int exit_code; - Status status; - Parametre param; - Environnement env; - }; - - - - public: - // Constructeur et destructeur - BatchManager_Local(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_Local(); - - // Recupere le nom du serveur par defaut - // static string BatchManager_Local::getDefaultServer(); - - // Methodes pour le controle des jobs - virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire - virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire - virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente - virtual void releaseJob(const JobId & jobid); // relache un job suspendu - virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente - virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job - virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine - - virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente - virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente - - - protected: - int _connect; // Local connect id - pthread_mutex_t _threads_mutex; - std::map _threads; - - // Methode abstraite qui renvoie la commande de copie du fichier source en destination - virtual std::string copy_command( const std::string & host_source, - const std::string & source, - const std::string & host_destination, - const std::string & destination) const = 0; - - // Methode abstraite qui renvoie la commande a executer - virtual std::string exec_command(Parametre & param) const = 0; - - // Methode abstraite qui renvoie la commande d'effacement du fichier - virtual std::string remove_command( const std::string & host_destination, - const std::string & destination) const = 0; - - private: - virtual pthread_t submit(const Job_Local & job); - virtual void cancel(pthread_t thread_id); - static void kill_child_on_exit(void * p_pid); - static void delete_on_exit(void * arg); - Id nextId(); // Retourne un identifiant unique pour un thread (clef de la map) - Id getIdByThread_id(pthread_t thread_id); - Id registerThread_id(pthread_t thread_id); - pthread_mutex_t _thread_id_id_association_mutex; - pthread_cond_t _thread_id_id_association_cond; -#ifndef WIN32 //TODO: porting of following functionality - //reason: pthread_t on win32 is a struct of pointer and int members - std::map _thread_id_id_association; -#endif - -#ifdef SWIG - public: - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); } - virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); } -#endif - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_Local_RSH.cxx b/src/Batch/Batch_BatchManager_Local_RSH.cxx deleted file mode 100644 index 5165ba981..000000000 --- a/src/Batch/Batch_BatchManager_Local_RSH.cxx +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_Local_RSH.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#ifndef WIN32 -#include -#include -#endif -#include -#include -#include -#include -#include -#include "Batch_IOMutex.hxx" -#include "Batch_BatchManager_Local_RSH.hxx" - -#ifndef RM -#error "RM undefined. You must set RM to a valid path to a rm-like command." -#endif - -#ifndef RCP -#error "RCP undefined. You must set RCP to a valid path to a rcp-like command." -#endif - -#ifndef RSH -#error "RSH undefined. You must set RSH to a valid path to a rsh-like command." -#endif - -using namespace std; - -namespace Batch { - - - // Constructeur - BatchManager_Local_RSH::BatchManager_Local_RSH(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_Local(parent, host) - { - } - - // Destructeur - BatchManager_Local_RSH::~BatchManager_Local_RSH() - { - } - - - // Methode abstraite qui renvoie la commande de copie du fichier source en destination - string BatchManager_Local_RSH::copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const - { - ostringstream fullsource; - if (host_source.size() == 0) { - fullsource << "localhost:"; - } else { - fullsource << host_source << ":"; - } - fullsource << source; - - ostringstream fulldestination; - if (host_destination.size() == 0) { - fulldestination << "localhost:"; - } else { - fulldestination << host_destination << ":"; - } - fulldestination << destination; - - ostringstream copy_cmd; - copy_cmd << RCP << " " << fullsource.str() << " " << fulldestination.str(); - return copy_cmd.str(); - } - - // Methode abstraite qui renvoie la commande a executer - string BatchManager_Local_RSH::exec_command(Parametre & param) const - { - ostringstream exec_sub_cmd; - exec_sub_cmd << param[EXECUTABLE]; - - if (param.find(ARGUMENTS) != param.end()) { - Versatile V = param[ARGUMENTS]; - for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) { - StringType argt = * static_cast(*it); - string arg = argt; - exec_sub_cmd << " " << arg; - } - } - - - Versatile new_arguments; - new_arguments.setMaxSize(0); - new_arguments = string(param[EXECUTIONHOST]); - - - if (param.find(USER) != param.end()) { - new_arguments += "-l"; - new_arguments += string(param[USER]); - } - - new_arguments += exec_sub_cmd.str(); - - param[ARGUMENTS] = new_arguments; - - // Sous Linux on est oblige de modifier ces deux parametres pour faire fonctionner la commande rsh - param[EXECUTABLE] = RSH; - param.erase(NAME); - - return RSH; - } - - // Methode qui renvoie la commande d'effacement du fichier - string BatchManager_Local_RSH::remove_command(const string & host_destination, const string & destination) const - { - string host = (host_destination.size()) ? host_destination : "localhost:"; - - ostringstream remove_cmd; - remove_cmd << RSH << " " << host << " \"" << RM << " " << destination << "\""; - return remove_cmd.str(); - } -} diff --git a/src/Batch/Batch_BatchManager_Local_RSH.hxx b/src/Batch/Batch_BatchManager_Local_RSH.hxx deleted file mode 100644 index c5c660425..000000000 --- a/src/Batch/Batch_BatchManager_Local_RSH.hxx +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_Local_RSH.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifndef _BATCHMANAGER_LOCAL_RSH_H_ -#define _BATCHMANAGER_LOCAL_RSH_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include -#include -#include -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_Local.hxx" -#include "Batch_Job_Local.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager_Local.hxx" - -namespace Batch { - - class FactBatchManager; - - class BATCH_EXPORT BatchManager_Local_RSH : public BatchManager_Local - { - public: - // Constructeur et destructeur - BatchManager_Local_RSH(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_Local_RSH(); - - protected: - // Methode abstraite qui renvoie la commande de copie du fichier source en destination - virtual std::string copy_command( const std::string & host_source, - const std::string & source, - const std::string & host_destination, - const std::string & destination) const; - - // Methode abstraite qui renvoie la commande a executer - virtual std::string exec_command(Parametre & param) const; - - // Methode qui renvoie la commande d'effacement du fichier - virtual std::string remove_command( const std::string & host_destination, - const std::string & destination) const; - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_Local_SH.cxx b/src/Batch/Batch_BatchManager_Local_SH.cxx deleted file mode 100644 index 797f55c42..000000000 --- a/src/Batch/Batch_BatchManager_Local_SH.cxx +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_Local_SH.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#ifndef WIN32 -#include -#include -#endif -#include -#include -#include -#include -#include -#include "Batch_IOMutex.hxx" -#include "Batch_BatchManager_Local_SH.hxx" - -#ifndef RM -#error "RM undefined. You must set RM to a valid path to a rm-like command." -#endif - -#ifndef CP -#error "CP undefined. You must set CP to a valid path to a cp-like command." -#endif - -#ifndef SH -#error "SH undefined. You must set SH to a valid path to a sh-like command." -#endif - -using namespace std; - -namespace Batch { - - - // Constructeur - BatchManager_Local_SH::BatchManager_Local_SH(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_Local(parent, host) - { - } - - // Destructeur - BatchManager_Local_SH::~BatchManager_Local_SH() - { - } - - - // Methode qui renvoie la commande de copie du fichier source en destination - string BatchManager_Local_SH::copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const - { - ostringstream copy_cmd; - copy_cmd << CP << " " << source << " " << destination; - return copy_cmd.str(); - } - - // Methode qui renvoie la commande a executer - string BatchManager_Local_SH::exec_command(Parametre & param) const - { - ostringstream exec_sub_cmd; - exec_sub_cmd << param[EXECUTABLE]; - - if (param.find(ARGUMENTS) != param.end()) { - Versatile V = param[ARGUMENTS]; - for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) { - StringType argt = * static_cast(*it); - string arg = argt; - exec_sub_cmd << " " << arg; - } - } - - param[ARGUMENTS] = "-c"; - param[ARGUMENTS] += exec_sub_cmd.str(); - - return SH; - } - - // Methode qui renvoie la commande d'effacement du fichier - string BatchManager_Local_SH::remove_command(const string & host_destination, const string & destination) const - { - ostringstream remove_cmd; - remove_cmd << RM << " " << destination; - return remove_cmd.str(); - } - -} diff --git a/src/Batch/Batch_BatchManager_Local_SH.hxx b/src/Batch/Batch_BatchManager_Local_SH.hxx deleted file mode 100644 index 23b59097a..000000000 --- a/src/Batch/Batch_BatchManager_Local_SH.hxx +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_Local_SH.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifndef _BATCHMANAGER_LOCAL_SH_H_ -#define _BATCHMANAGER_LOCAL_SH_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include -#include -#include -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_Local.hxx" -#include "Batch_Job_Local.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager_Local.hxx" - -namespace Batch { - - class FactBatchManager; - - class BATCH_EXPORT BatchManager_Local_SH : public BatchManager_Local - { - public: - // Constructeur et destructeur - BatchManager_Local_SH(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_Local_SH(); - - protected: - // Methode qui renvoie la commande de copie du fichier source en destination - virtual std::string copy_command( const std::string & host_source, - const std::string & source, - const std::string & host_destination, - const std::string & destination) const; - - // Methode qui renvoie la commande a executer - virtual std::string exec_command(Parametre & param) const; - - // Methode qui renvoie la commande d'effacement du fichier - virtual std::string remove_command( const std::string & host_destination, - const std::string & destination) const; - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_Local_SSH.cxx b/src/Batch/Batch_BatchManager_Local_SSH.cxx deleted file mode 100644 index 723f91dbe..000000000 --- a/src/Batch/Batch_BatchManager_Local_SSH.cxx +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_Local_SSH.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#ifndef WIN32 -#include -#include -#endif -#include - -#include -#include -#include -#include -#include "Batch_IOMutex.hxx" -#include "Batch_BatchManager_Local_SSH.hxx" - -#ifndef RM -#error "RM undefined. You must set RM to a valid path to a rm-like command." -#endif - -#ifndef RCP -#error "RCP undefined. You must set RCP to a valid path to a scp-like command." -#endif - -#ifndef SSH -#error "SSH undefined. You must set SSH to a valid path to a ssh-like command." -#endif - -using namespace std; - -namespace Batch { - - - // Constructeur - BatchManager_Local_SSH::BatchManager_Local_SSH(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_Local(parent, host) - { - } - - // Destructeur - BatchManager_Local_SSH::~BatchManager_Local_SSH() - { - } - - - // Methode abstraite qui renvoie la commande de copie du fichier source en destination - string BatchManager_Local_SSH::copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const - { - ostringstream fullsource; - if (host_source.size() == 0) { - fullsource << "localhost:"; - } else { - fullsource << host_source << ":"; - } - fullsource << source; - - ostringstream fulldestination; - if (host_destination.size() == 0) { - fulldestination << "localhost:"; - } else { - fulldestination << host_destination << ":"; - } - fulldestination << destination; - - ostringstream copy_cmd; - copy_cmd << RCP << " " << fullsource.str() << " " << fulldestination.str(); - return copy_cmd.str(); - } - - // Methode abstraite qui renvoie la commande a executer - string BatchManager_Local_SSH::exec_command(Parametre & param) const - { - ostringstream exec_sub_cmd; - exec_sub_cmd << param[EXECUTABLE]; - - if (param.find(ARGUMENTS) != param.end()) { - Versatile V = param[ARGUMENTS]; - for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) { - StringType argt = * static_cast(*it); - string arg = argt; - exec_sub_cmd << " " << arg; - } - } - - - Versatile new_arguments; - new_arguments.setMaxSize(0); - new_arguments = string(param[EXECUTIONHOST]); - - - if (param.find(USER) != param.end()) { - new_arguments += "-l"; - new_arguments += string(param[USER]); - } - - new_arguments += exec_sub_cmd.str(); - - param[ARGUMENTS] = new_arguments; - - // Sous Linux on est oblige de modifier ces deux parametres pour faire fonctionner la commande rsh - param[EXECUTABLE] = SSH; - param.erase(NAME); - - return SSH; - } - - // Methode qui renvoie la commande d'effacement du fichier - string BatchManager_Local_SSH::remove_command(const string & host_destination, const string & destination) const - { - string host = (host_destination.size()) ? host_destination : "localhost:"; - - ostringstream remove_cmd; - remove_cmd << SSH << " " << host << " \"" << RM << " " << destination << "\""; - return remove_cmd.str(); - } -} diff --git a/src/Batch/Batch_BatchManager_Local_SSH.hxx b/src/Batch/Batch_BatchManager_Local_SSH.hxx deleted file mode 100644 index 12772fb46..000000000 --- a/src/Batch/Batch_BatchManager_Local_SSH.hxx +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_Local_SSH.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifndef _BATCHMANAGER_LOCAL_SSH_H_ -#define _BATCHMANAGER_LOCAL_SSH_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include -#include -#include -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_Local.hxx" -#include "Batch_Job_Local.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager_Local.hxx" - -namespace Batch { - - class FactBatchManager; - - class BATCH_EXPORT BatchManager_Local_SSH : public BatchManager_Local - { - public: - // Constructeur et destructeur - BatchManager_Local_SSH(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_Local_SSH(); - - protected: - // Methode abstraite qui renvoie la commande de copie du fichier source en destination - virtual std::string copy_command( const std::string & host_source, - const std::string & source, - const std::string & host_destination, - const std::string & destination) const; - - // Methode abstraite qui renvoie la commande a executer - virtual std::string exec_command(Parametre & param) const; - - // Methode qui renvoie la commande d'effacement du fichier - virtual std::string remove_command( const std::string & host_destination, - const std::string & destination) const; - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_PBS.cxx b/src/Batch/Batch_BatchManager_PBS.cxx deleted file mode 100644 index dd2b1b812..000000000 --- a/src/Batch/Batch_BatchManager_PBS.cxx +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_PBS.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -extern "C" { -#include -#include -} -#include -#include -#include -//#include "MEDMEM_STRING.hxx" -#include "Batch_BatchManager_PBS.hxx" -using namespace std; - -namespace Batch { - - // Recupere le nom du serveur par defaut -// string BatchManager_PBS::getDefaultServer() { -// string server_name = "localhost"; - -// const char * server_name_path = "@openpbsspooldir@/server_name"; -// ifstream server_name_file(server_name_path); -// if (server_name_file) { -// server_name_file >> server_name; -// server_name_file.close(); -// } - -// return server_name; -// } - - // Constructeur -// BatchManager_PBS::BatchManager_PBS() throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(BatchManager_PBS::getDefaultServer()) -// { -// // On se connecte au serveur PBS -// _connect = pbs_connect(const_cast< char * >(_hostname.c_str())); -// if (_connect < 0) { // si erreur -// char * errmsg = pbs_geterrmsg(_connect); -// string msg = "PBS Server on host \""; -// msg += _hostname; -// msg += "\" : "; -// msg += errmsg ? errmsg : "Reason unknown"; -// throw ConnexionFailureException(msg.c_str()); -// } -// } - - // Constructeur -// BatchManager_PBS::BatchManager_PBS(string host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(host) -// { -// // On se connecte au serveur PBS -// _connect = pbs_connect(const_cast< char * >(_hostname.c_str())); -// if (_connect < 0) { // si erreur -// char * errmsg = pbs_geterrmsg(_connect); -// string msg = "PBS Server on host \""; -// msg += _hostname; -// msg += "\" : "; -// msg += errmsg ? errmsg : "Reason unknown"; -// throw ConnexionFailureException(msg.c_str()); -// } -// } - BatchManager_PBS::BatchManager_PBS(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host) - { - // On se connecte au serveur PBS - _connect = pbs_connect(const_cast< char * >(_hostname.c_str())); - if (_connect < 0) { // si erreur - char * errmsg = pbs_geterrmsg(_connect); - string msg = "PBS Server on host \""; - msg += _hostname; - msg += "\" : "; - msg += errmsg ? errmsg : "Reason unknown"; - throw ConnexionFailureException(msg.c_str()); - } - } - - // Destructeur - BatchManager_PBS::~BatchManager_PBS() - { - // On se deconnecte du serveur PBS - int rc = pbs_disconnect(_connect); - if (rc < 0) { // si erreur - string msg = "PBS Server on host \""; - msg += _hostname; - msg += "\" : "; - msg += pbs_geterrmsg(_connect); - throw ConnexionFailureException(msg.c_str()); - } - } - - // Methode pour le controle des jobs : soumet un job au gestionnaire - const JobId BatchManager_PBS::submitJob(const Job & job) - { - Job_PBS jobpbs = job; - char * ref = pbs_submit(_connect, - jobpbs.getAttributesOP(), - jobpbs.getScript(), - jobpbs.getDestination(), - NULL); - if (!ref) { // si erreur - char * msg = pbs_geterrmsg(_connect); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("PBS submit error. Reason : ") + msg); - } - - JobId id(this, string(ref)); - free(ref); - return id; - } - - // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager_PBS::deleteJob(const JobId & jobid) - { - char * ref = const_cast< char * >(jobid.getReference().c_str()); - int rc = pbs_deljob(_connect, ref, 0); - if (rc) { // si erreur - char * msg = pbs_geterrmsg(_connect); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("PBS deljob error. Reason : ") + msg); - } - } - - // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager_PBS::holdJob(const JobId & jobid) - { - char * ref = const_cast< char * >(jobid.getReference().c_str()); - int rc = pbs_holdjob(_connect, ref, USER_HOLD, 0); - if (rc) { // si erreur - char * msg = pbs_geterrmsg(_connect); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("PBS holdjob error. Reason : ") + msg); - } - } - - // Methode pour le controle des jobs : relache un job suspendu - void BatchManager_PBS::releaseJob(const JobId & jobid) - { - char * ref = const_cast< char * >(jobid.getReference().c_str()); - int rc = pbs_rlsjob(_connect, ref, USER_HOLD, 0); - if (rc) { // si erreur - char * msg = pbs_geterrmsg(_connect); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("PBS rlsjob error. Reason : ") + msg); - } - } - - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_PBS::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) - { - Job job(param, env); - Job_PBS jobpbs(job); - - char * ref = const_cast< char * >(jobid.getReference().c_str()); - int rc = pbs_alterjob(_connect, - ref, - jobpbs.getAttributes(), - NULL); - if (rc) { // si erreur - char * msg = pbs_geterrmsg(_connect); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("PBS alterjob error. Reason : ") + msg); - } - - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_PBS::alterJob(const JobId & jobid, const Parametre & param) - { - alterJob(jobid, param, Environnement()); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_PBS::alterJob(const JobId & jobid, const Environnement & env) - { - alterJob(jobid, Parametre(), env); - } - - - - // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager_PBS::queryJob(const JobId & jobid) - { - char * id = const_cast< char * >(jobid.getReference().c_str()); - JobInfo_PBS ji = JobInfo_PBS(pbs_statjob(_connect, id, 0, 0), true); - return ji; - } - - - -} diff --git a/src/Batch/Batch_BatchManager_PBS.hxx b/src/Batch/Batch_BatchManager_PBS.hxx deleted file mode 100644 index ee6ac8218..000000000 --- a/src/Batch/Batch_BatchManager_PBS.hxx +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_PBS.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:17:22 2003 - * Projet : Salome 2 - * - */ - -#ifndef _BATCHMANAGER_PBS_H_ -#define _BATCHMANAGER_PBS_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_Job.hxx" -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_PBS.hxx" -#include "Batch_Job_PBS.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager.hxx" - -namespace Batch { - - class Job; - class JobId; - class JobInfo; - class FactBatchManager; - - class BATCH_EXPORT BatchManager_PBS : public BatchManager - { - public: - // Constructeur et destructeur - //BatchManager_PBS() throw(InvalidArgumentException,ConnexionFailureException); // connexion au serveur par defaut - //BatchManager_PBS(std::string host) throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - BatchManager_PBS(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_PBS(); - - // Recupere le nom du serveur par defaut - // static std::string BatchManager_PBS::getDefaultServer(); - - // Methodes pour le controle des jobs - virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire - virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire - virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente - virtual void releaseJob(const JobId & jobid); // relache un job suspendu - virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente - virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job - - virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente - virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente - - - protected: - int _connect; // PBS connect id - - private: - -#ifdef SWIG - public: - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const std::string & ref) { return BatchManager::getJobIdByReference(ref); } - virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); } -#endif - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_eClient.cxx b/src/Batch/Batch_BatchManager_eClient.cxx deleted file mode 100644 index ebdd30895..000000000 --- a/src/Batch/Batch_BatchManager_eClient.cxx +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* -* BatchManager_eLSF.cxx : emulation of LSF client -* -* Auteur : Bernard SECHER - CEA DEN -* Mail : mailto:bernard.secher@cea.fr -* Date : Thu Apr 24 10:17:22 2008 -* Projet : PAL Salome -* -*/ - -#include "Batch_BatchManager_eClient.hxx" -#include "Basics_DirUtils.hxx" - -#include -#include -#include -#include -#include -#include - -using namespace std; - - -namespace Batch { - - BatchManager_eClient::BatchManager_eClient(const Batch::FactBatchManager * parent, const char* host, const char* protocol, const char* mpiImpl) : BatchManager(parent, host), _protocol(protocol), _username("") - { - // instanciation of mpi implementation needed to launch executable in batch script - _mpiImpl = FactoryMpiImpl(mpiImpl); - } - - // Destructeur - BatchManager_eClient::~BatchManager_eClient() - { - // Nothing to do - delete _mpiImpl; - } - - void BatchManager_eClient::exportInputFiles(const Job& job) throw(EmulationException) - { - int status; - Parametre params = job.getParametre(); - Versatile V = params[INFILE]; - Versatile::iterator Vit; - string command; - string copy_command; - _username = string(params[USER]); - - // Test protocol - if( _protocol == "rsh" ) - copy_command = "rcp "; - else if( _protocol == "ssh" ) - copy_command = "scp "; - else - throw EmulationException("Unknown protocol : only rsh and ssh are known !"); - - // First step : creating batch tmp files directory - command = _protocol; - command += " "; - if(_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += " \"mkdir -p "; - command += string(params[TMPDIR]); - command += "\"" ; - cerr << command.c_str() << endl; - 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 EmulationException(ex_mess.c_str()); - } - - // Second step : copy fileToExecute into - // batch tmp files directory - string executeFile = params[EXECUTABLE]; - if( executeFile.size() > 0 ){ - command = copy_command; - command += string(params[EXECUTABLE]); - command += " "; - if(_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += ":"; - command += string(params[TMPDIR]); - cerr << command.c_str() << endl; - 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 EmulationException(ex_mess.c_str()); - } - } - - // Third step : copy filesToExportList into - // batch tmp files directory - for(Vit=V.begin(); Vit!=V.end(); Vit++) { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple inputFile = cpt; - command = copy_command; - command += inputFile.getLocal(); - command += " "; - if(_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += ":"; - command += inputFile.getRemote(); - cerr << command.c_str() << endl; - 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 EmulationException(ex_mess.c_str()); - } - } - - } - - void BatchManager_eClient::importOutputFiles( const Job & job, const string directory ) throw(EmulationException) - { - string command; - int status; - - Parametre params = job.getParametre(); - Versatile V = params[OUTFILE]; - Versatile::iterator Vit; - - for(Vit=V.begin(); Vit!=V.end(); Vit++) { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple outputFile = cpt; - if( _protocol == "rsh" ) - command = "rcp "; - else if( _protocol == "ssh" ) - command = "scp "; - else - throw EmulationException("Unknown protocol"); - - if (_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += ":"; - command += outputFile.getRemote(); - command += " "; - command += directory; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - { - // Try to get what we can (logs files) - // throw BatchException("Error of connection on remote host"); - std::string mess("Copy command failed ! status is :"); - ostringstream status_str; - status_str << status; - mess += status_str.str(); - cerr << mess << endl; - } - } - - } - - MpiImpl *BatchManager_eClient::FactoryMpiImpl(string mpiImpl) throw(EmulationException) - { - 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 == "slurm") - return new MpiImpl_SLURM(); - else if(mpiImpl == "prun") - return new MpiImpl_PRUN(); - else if(mpiImpl == "nompi") - throw EmulationException("you must specified an mpi implementation for batch manager"); - else{ - ostringstream oss; - oss << mpiImpl << " : not yet implemented"; - throw EmulationException(oss.str().c_str()); - } - } - - string BatchManager_eClient::BuildTemporaryFileName() const - { - //build more complex file name to support multiple salome session - string aFileName = Kernel_Utils::GetTmpFileName(); -#ifndef WIN32 - aFileName += ".sh"; -#else - aFileName += ".bat"; -#endif - return aFileName; - } - - void BatchManager_eClient::RmTmpFile(std::string & TemporaryFileName) - { -#ifdef WIN32 - string command = "del /F "; -#else - string command = "rm "; -#endif - command += TemporaryFileName; - char *temp = strdup(command.c_str()); - int lgthTemp = strlen(temp); - temp[lgthTemp - 3] = '*'; - temp[lgthTemp - 2] = '\0'; - system(temp); - free(temp); - } -} diff --git a/src/Batch/Batch_BatchManager_eClient.hxx b/src/Batch/Batch_BatchManager_eClient.hxx deleted file mode 100644 index 172ca4abd..000000000 --- a/src/Batch/Batch_BatchManager_eClient.hxx +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_eLSF.hxx : emulation of client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#ifndef _BATCHMANAGER_eClient_H_ -#define _BATCHMANAGER_eClient_H_ - -#include "Batch_Defines.hxx" - -#include "MpiImpl.hxx" -#include "Batch_BatchManager.hxx" - -#include - -namespace Batch { - - class Job; - - class BATCH_EXPORT EmulationException - { - public: - const std::string msg; - - EmulationException(const std::string m) : msg(m) {} - }; - - class BATCH_EXPORT BatchManager_eClient : public BatchManager - { - public: - // Constructeur et destructeur - BatchManager_eClient(const Batch::FactBatchManager * parent, const char* host="localhost", const char* protocol="ssh", const char* mpiImpl="mpich1"); - virtual ~BatchManager_eClient(); - void importOutputFiles( const Job & job, const std::string directory ) throw(EmulationException); - - protected: - std::string _protocol; // protocol to access _hostname - std::string _username; // username to access _hostname - MpiImpl *_mpiImpl; // Mpi implementation to launch executable in batch script - - std::string BuildTemporaryFileName() const; - void RmTmpFile(std::string & TemporaryFileName); - MpiImpl* FactoryMpiImpl(std::string mpiImpl) throw(EmulationException); - void exportInputFiles(const Job & job) throw(EmulationException); - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_eLSF.cxx b/src/Batch/Batch_BatchManager_eLSF.cxx deleted file mode 100644 index 009d4c6a4..000000000 --- a/src/Batch/Batch_BatchManager_eLSF.cxx +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_eLSF.cxx : emulation of LSF client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#include -#include -#include -#include -#include -#include - -#include "Batch_BatchManager_eLSF.hxx" -#ifdef WIN32 -# include -# include -#else -# include -#endif - -using namespace std; - -namespace Batch { - - BatchManager_eLSF::BatchManager_eLSF(const FactBatchManager * parent, const char * host, const char * protocol, const char * mpiImpl) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_eClient(parent,host,protocol,mpiImpl) - { - // Nothing to do - } - - // Destructeur - BatchManager_eLSF::~BatchManager_eLSF() - { - // Nothing to do - } - - // Methode pour le controle des jobs : soumet un job au gestionnaire - const JobId BatchManager_eLSF::submitJob(const Job & job) - { - int status; - Parametre params = job.getParametre(); - const std::string dirForTmpFiles = params[TMPDIR]; - const string fileToExecute = params[EXECUTABLE]; - std::string fileNameToExecute; - if( fileToExecute.size() > 0 ){ - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - } - else - fileNameToExecute = "command"; - - // export input files on cluster - exportInputFiles(job); - - // build batch script for job - buildBatchScript(job); - - // 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; - - // define command to submit batch - command = _protocol; - command += " "; - - if(_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"cd " ; - command += dirForTmpFiles ; - command += "; bsub < " ; - command += fileNameToExecute ; - command += "_Batch.sh\" > "; - command += logFile; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("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); - - JobId id(this, strjob); - return id; - } - - // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager_eLSF::deleteJob(const JobId & jobid) - { - int status; - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - - // define command to submit batch - string command; - command = _protocol; - command += " "; - - if (_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"bkill " ; - command += iss.str(); - command += "\""; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - cerr << "jobId = " << ref << "killed" << endl; - } - - // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager_eLSF::holdJob(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - // Methode pour le controle des jobs : relache un job suspendu - void BatchManager_eLSF::releaseJob(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_eLSF::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) - { - throw EmulationException("Not yet implemented"); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_eLSF::alterJob(const JobId & jobid, const Parametre & param) - { - alterJob(jobid, param, Environnement()); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_eLSF::alterJob(const JobId & jobid, const Environnement & env) - { - alterJob(jobid, Parametre(), env); - } - - // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager_eLSF::queryJob(const JobId & jobid) - { - int id; - istringstream iss(jobid.getReference()); - iss >> id; - - // 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 - command = _protocol; - command += " "; - - if (_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"bjobs " ; - command += iss.str(); - command += "\" > "; - command += logFile; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - JobInfo_eLSF ji = JobInfo_eLSF(id,logFile); - return ji; - } - - - - // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_eLSF::isRunning(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - void BatchManager_eLSF::buildBatchScript(const Job & job) throw(EmulationException) - { -#ifndef WIN32 //TODO: need for porting on Windows - int status; - Parametre params = job.getParametre(); - Environnement env = job.getEnvironnement(); - const int nbproc = params[NBPROC]; - const long edt = params[MAXWALLTIME]; - const long mem = params[MAXRAMSIZE]; - const string workDir = params[WORKDIR]; - const std::string dirForTmpFiles = params[TMPDIR]; - const string fileToExecute = params[EXECUTABLE]; - const string home = params[HOMEDIR]; - const std::string queue = params[QUEUE]; - std::string rootNameToExecute; - std::string fileNameToExecute; - std::string filelogtemp; - if( fileToExecute.size() > 0 ){ - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - char* basec=strdup(fileToExecute.c_str()); - fileNameToExecute = "~/" + dirForTmpFiles + "/" + string(basename(basec)); - free(basec); - - int idx = dirForTmpFiles.find("Batch/"); - filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); - } - else{ - rootNameToExecute = "command"; - } - - std::string TmpFileName = BuildTemporaryFileName(); - ofstream tempOutputFile; - tempOutputFile.open(TmpFileName.c_str(), ofstream::out ); - - tempOutputFile << "#! /bin/sh -f" << endl ; - if (queue != "") - tempOutputFile << "#BSUB -q " << queue << endl; - if( edt > 0 ) - tempOutputFile << "#BSUB -W " << getWallTime(edt) << endl ; - if( mem > 0 ) - tempOutputFile << "#BSUB -M " << mem*1024 << endl ; - tempOutputFile << "#BSUB -n " << nbproc << endl ; - if( fileToExecute.size() > 0 ){ - tempOutputFile << "#BSUB -o " << home << "/" << dirForTmpFiles << "/output.log." << filelogtemp << endl ; - tempOutputFile << "#BSUB -e " << home << "/" << dirForTmpFiles << "/error.log." << filelogtemp << endl ; - } - else{ - tempOutputFile << "#BSUB -o " << dirForTmpFiles << "/" << env["LOGFILE"] << ".output.log" << endl ; - tempOutputFile << "#BSUB -e " << dirForTmpFiles << "/" << env["LOGFILE"] << ".error.log" << endl ; - } - if( workDir.size() > 0 ) - tempOutputFile << "cd " << workDir << endl ; - if( fileToExecute.size() > 0 ){ - tempOutputFile << _mpiImpl->boot("",nbproc); - tempOutputFile << _mpiImpl->run("",nbproc,fileNameToExecute); - tempOutputFile << _mpiImpl->halt(); - } - else{ - tempOutputFile << "source " << env["SOURCEFILE"] << endl ; - tempOutputFile << env["COMMAND"]; - } - - tempOutputFile.flush(); - tempOutputFile.close(); -#ifdef WIN32 - _chmod( -#else - chmod( -#endif - TmpFileName.c_str(), 0x1ED); - cerr << TmpFileName.c_str() << endl; - - string command; - if( _protocol == "rsh" ) - command = "rcp "; - else if( _protocol == "ssh" ) - command = "scp "; - else - throw EmulationException("Unknown protocol"); - command += TmpFileName; - command += " "; - if(_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += ":"; - command += dirForTmpFiles ; - command += "/" ; - command += rootNameToExecute ; - command += "_Batch.sh" ; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - RmTmpFile(TmpFileName); -#endif - - } - - std::string BatchManager_eLSF::getWallTime(const long edt) - { - long h, m; - h = edt / 60; - m = edt - h*60; - ostringstream oss; - if( m >= 10 ) - oss << h << ":" << m; - else - oss << h << ":0" << m; - return oss.str(); - } - -} diff --git a/src/Batch/Batch_BatchManager_eLSF.hxx b/src/Batch/Batch_BatchManager_eLSF.hxx deleted file mode 100644 index 599d90c68..000000000 --- a/src/Batch/Batch_BatchManager_eLSF.hxx +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_eLSF.hxx : emulation of LSF client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#ifndef _BATCHMANAGER_eLSF_H_ -#define _BATCHMANAGER_eLSF_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_eLSF.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager.hxx" -#include "Batch_BatchManager_eClient.hxx" - -namespace Batch { - - class Job; - class JobId; - class JobInfo; - class FactBatchManager; - - class BATCH_EXPORT BatchManager_eLSF : public BatchManager_eClient - { - public: - // Constructeur et destructeur - BatchManager_eLSF(const FactBatchManager * parent, const char * host="localhost", const char * protocol="ssh", const char * mpiImpl="nompi") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_eLSF(); - - // Recupere le nom du serveur par defaut - // static string BatchManager_LSF::getDefaultServer(); - - // Methodes pour le controle des jobs - virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire - virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire - virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente - virtual void releaseJob(const JobId & jobid); // relache un job suspendu - virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente - virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job - virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine - - virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente - virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente - - - protected: - void buildBatchScript(const Job & job) throw(EmulationException); - std::string getWallTime(const long edt); - - private: - -#ifdef SWIG - public: - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); } - virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); } -#endif - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_ePBS.cxx b/src/Batch/Batch_BatchManager_ePBS.cxx deleted file mode 100644 index 177319c32..000000000 --- a/src/Batch/Batch_BatchManager_ePBS.cxx +++ /dev/null @@ -1,342 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_ePBS.cxx : emulation of PBS client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#include -#include -#include -#include -#include -#include - -#include "Batch_BatchManager_ePBS.hxx" -#ifdef WIN32 -# include -# include -#else -# include -#endif - -using namespace std; - -namespace Batch { - - BatchManager_ePBS::BatchManager_ePBS(const FactBatchManager * parent, const char * host, const char * protocol, const char * mpiImpl) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_eClient(parent,host,protocol,mpiImpl) - { - // Nothing to do - } - - // Destructeur - BatchManager_ePBS::~BatchManager_ePBS() - { - // Nothing to do - } - - // Methode pour le controle des jobs : soumet un job au gestionnaire - const JobId BatchManager_ePBS::submitJob(const Job & job) - { - int status; - Parametre params = job.getParametre(); - const std::string dirForTmpFiles = params[TMPDIR]; - const string fileToExecute = params[EXECUTABLE]; - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - std::string fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - - // export input files on cluster - exportInputFiles(job); - - // build batch script for job - buildBatchScript(job); - - // 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; - - // define command to submit batch - command = _protocol; - command += " "; - - if(_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"cd " ; - command += dirForTmpFiles ; - command += "; qsub " ; - command += fileNameToExecute ; - command += "_Batch.sh\" > "; - command += logFile; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("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); - - JobId id(this, strjob); - return id; - } - - // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager_ePBS::deleteJob(const JobId & jobid) - { - int status; - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - - // define command to submit batch - string command; - command = _protocol; - command += " "; - - if (_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"qdel " ; - command += iss.str(); - command += "\""; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - cerr << "jobId = " << ref << "killed" << endl; - } - - // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager_ePBS::holdJob(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - // Methode pour le controle des jobs : relache un job suspendu - void BatchManager_ePBS::releaseJob(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_ePBS::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) - { - throw EmulationException("Not yet implemented"); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_ePBS::alterJob(const JobId & jobid, const Parametre & param) - { - alterJob(jobid, param, Environnement()); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_ePBS::alterJob(const JobId & jobid, const Environnement & env) - { - alterJob(jobid, Parametre(), env); - } - - // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager_ePBS::queryJob(const JobId & jobid) - { - int id; - istringstream iss(jobid.getReference()); - iss >> id; - - // define name of log file - string logFile="/tmp/logs/"; - logFile += getenv("USER"); - logFile += "/batchSalome_"; - - ostringstream oss; - oss << this << "_" << id; - logFile += oss.str(); - logFile += ".log"; - - string command; - int status; - - // define command to submit batch - command = _protocol; - command += " "; - - if (_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"qstat -f " ; - command += iss.str(); - command += "\" > "; - command += logFile; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status && status != 153 && status != 256*153) - throw EmulationException("Error of connection on remote host"); - - JobInfo_ePBS ji = JobInfo_ePBS(id,logFile); - return ji; - } - - // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_ePBS::isRunning(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - void BatchManager_ePBS::buildBatchScript(const Job & job) throw(EmulationException) - { -#ifndef WIN32 //TODO: need for porting on Windows - int status; - Parametre params = job.getParametre(); - Environnement env = job.getEnvironnement(); - const long nbproc = params[NBPROC]; - const long edt = params[MAXWALLTIME]; - const long mem = params[MAXRAMSIZE]; - const string workDir = params[WORKDIR]; - const std::string dirForTmpFiles = params[TMPDIR]; - const string fileToExecute = params[EXECUTABLE]; - const string home = params[HOMEDIR]; - const std::string queue = params[QUEUE]; - std::string rootNameToExecute; - std::string fileNameToExecute; - std::string filelogtemp; - if( fileToExecute.size() > 0 ){ - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - char* basec=strdup(fileToExecute.c_str()); - fileNameToExecute = "~/" + dirForTmpFiles + "/" + string(basename(basec)); - free(basec); - - int idx = dirForTmpFiles.find("Batch/"); - filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); - } - else{ - rootNameToExecute = "command"; - } - - std::string TmpFileName = BuildTemporaryFileName(); - ofstream tempOutputFile; - tempOutputFile.open(TmpFileName.c_str(), ofstream::out ); - - tempOutputFile << "#! /bin/sh -f" << endl; - if (queue != "") - tempOutputFile << "#BSUB -q " << queue << endl; - if( edt > 0 ) - tempOutputFile << "#PBS -l walltime=" << edt*60 << endl ; - if( mem > 0 ) - tempOutputFile << "#PBS -l mem=" << mem << "mb" << endl ; - if( fileToExecute.size() > 0 ){ - tempOutputFile << "#PBS -o " << home << "/" << dirForTmpFiles << "/output.log." << filelogtemp << endl ; - tempOutputFile << "#PBS -e " << home << "/" << dirForTmpFiles << "/error.log." << filelogtemp << endl ; - } - else{ - tempOutputFile << "#PBS -o " << dirForTmpFiles << "/" << env["LOGFILE"] << ".output.log" << endl ; - tempOutputFile << "#PBS -e " << dirForTmpFiles << "/" << env["LOGFILE"] << ".error.log" << endl ; - } - if( workDir.size() > 0 ) - tempOutputFile << "cd " << workDir << endl ; - if( fileToExecute.size() > 0 ){ - tempOutputFile << _mpiImpl->boot("${PBS_NODEFILE}",nbproc); - tempOutputFile << _mpiImpl->run("${PBS_NODEFILE}",nbproc,fileNameToExecute); - tempOutputFile << _mpiImpl->halt(); - } - else{ - tempOutputFile << "source " << env["SOURCEFILE"] << endl ; - tempOutputFile << env["COMMAND"]; - } - - tempOutputFile.flush(); - tempOutputFile.close(); -#ifdef WIN32 - _chmod( -#else - chmod( -#endif - TmpFileName.c_str(), 0x1ED); - cerr << TmpFileName.c_str() << endl; - - string command; - if( _protocol == "rsh" ) - command = "rcp "; - else if( _protocol == "ssh" ) - command = "scp "; - else - throw EmulationException("Unknown protocol"); - command += TmpFileName; - command += " "; - if(_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += ":"; - command += dirForTmpFiles ; - command += "/" ; - command += rootNameToExecute ; - command += "_Batch.sh" ; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - RmTmpFile(TmpFileName); -#endif - } - -} diff --git a/src/Batch/Batch_BatchManager_ePBS.hxx b/src/Batch/Batch_BatchManager_ePBS.hxx deleted file mode 100644 index 9effa53cf..000000000 --- a/src/Batch/Batch_BatchManager_ePBS.hxx +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_ePBS.hxx : emulation of PBS client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#ifndef _BATCHMANAGER_eLSF_H_ -#define _BATCHMANAGER_eLSF_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_ePBS.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager.hxx" -#include "Batch_BatchManager_eClient.hxx" - -namespace Batch { - - class Job; - class JobId; - class JobInfo; - class FactBatchManager; - - class BATCH_EXPORT BatchManager_ePBS : public BatchManager_eClient - { - public: - // Constructeur et destructeur - BatchManager_ePBS(const FactBatchManager * parent, const char * host="localhost", const char * protocol="ssh", const char * mpiImpl="nompi") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_ePBS(); - - // Recupere le nom du serveur par defaut - // static string BatchManager_LSF::getDefaultServer(); - - // Methodes pour le controle des jobs - virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire - virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire - virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente - virtual void releaseJob(const JobId & jobid); // relache un job suspendu - virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente - virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job - virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine - - virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente - virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente - - - protected: - void buildBatchScript(const Job & job) throw(EmulationException); - - private: - -#ifdef SWIG - public: - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); } - virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); } -#endif - - }; - -} - -#endif diff --git a/src/Batch/Batch_BatchManager_eSGE.cxx b/src/Batch/Batch_BatchManager_eSGE.cxx deleted file mode 100644 index 56130df01..000000000 --- a/src/Batch/Batch_BatchManager_eSGE.cxx +++ /dev/null @@ -1,344 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_eSGE.cxx : emulation of SGE client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#include -#include -#include -#include -#include "Batch_BatchManager_eSGE.hxx" -#include -#ifdef WIN32 -# include -# include -#else -#include -#endif - -using namespace std; - -namespace Batch { - - BatchManager_eSGE::BatchManager_eSGE(const FactBatchManager * parent, const char * host, const char * protocol, const char * mpiImpl) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_eClient(parent,host,protocol,mpiImpl) - { - // Nothing to do - } - - // Destructeur - BatchManager_eSGE::~BatchManager_eSGE() - { - // Nothing to do - } - - // Methode pour le controle des jobs : soumet un job au gestionnaire - const JobId BatchManager_eSGE::submitJob(const Job & job) - { - int status; - Parametre params = job.getParametre(); - const std::string dirForTmpFiles = params[TMPDIR]; - const string fileToExecute = params[EXECUTABLE]; - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - std::string fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - - // export input files on cluster - exportInputFiles(job); - - // build batch script for job - buildBatchScript(job); - - // 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; - - // define command to submit batch - command = _protocol; - command += " "; - - if(_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"cd " ; - command += dirForTmpFiles ; - command += "; qsub " ; - command += fileNameToExecute ; - command += "_Batch.sh\" > "; - command += logFile; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("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 strjob; - istringstream iss(line); - iss >> strjob >> strjob >> strjob; - - JobId id(this, strjob); - return id; - } - - // Methode pour le controle des jobs : retire un job du gestionnaire - void BatchManager_eSGE::deleteJob(const JobId & jobid) - { - int status; - int ref; - istringstream iss(jobid.getReference()); - iss >> ref; - - // define command to submit batch - string command; - command = _protocol; - command += " "; - - if (_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"qdel " ; - command += iss.str(); - command += "\""; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - cerr << "jobId = " << ref << "killed" << endl; - } - - // Methode pour le controle des jobs : suspend un job en file d'attente - void BatchManager_eSGE::holdJob(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - // Methode pour le controle des jobs : relache un job suspendu - void BatchManager_eSGE::releaseJob(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_eSGE::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env) - { - throw EmulationException("Not yet implemented"); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_eSGE::alterJob(const JobId & jobid, const Parametre & param) - { - alterJob(jobid, param, Environnement()); - } - - // Methode pour le controle des jobs : modifie un job en file d'attente - void BatchManager_eSGE::alterJob(const JobId & jobid, const Environnement & env) - { - alterJob(jobid, Parametre(), env); - } - - // Methode pour le controle des jobs : renvoie l'etat du job - JobInfo BatchManager_eSGE::queryJob(const JobId & jobid) - { - int id; - istringstream iss(jobid.getReference()); - iss >> id; - - // define name of log file - string logFile="/tmp/logs/"; - logFile += getenv("USER"); - logFile += "/batchSalome_"; - - ostringstream oss; - oss << this << "_" << id; - logFile += oss.str(); - logFile += ".log"; - - string command; - int status; - - // define command to submit batch - command = _protocol; - command += " "; - - if (_username != ""){ - command += _username; - command += "@"; - } - - command += _hostname; - command += " \"qstat | grep " ; - command += iss.str(); - command += "\" > "; - command += logFile; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status && status != 256) - throw EmulationException("Error of connection on remote host"); - - JobInfo_eSGE ji = JobInfo_eSGE(id,logFile); - return ji; - } - - // Methode pour le controle des jobs : teste si un job est present en machine - bool BatchManager_eSGE::isRunning(const JobId & jobid) - { - throw EmulationException("Not yet implemented"); - } - - void BatchManager_eSGE::buildBatchScript(const Job & job) throw(EmulationException) - { -#ifndef WIN32 - //TODO porting on Win32 platform - int status; - Parametre params = job.getParametre(); - Environnement env = job.getEnvironnement(); - const long nbproc = params[NBPROC]; - const long edt = params[MAXWALLTIME]; - const long mem = params[MAXRAMSIZE]; - const string workDir = params[WORKDIR]; - const std::string dirForTmpFiles = params[TMPDIR]; - const string fileToExecute = params[EXECUTABLE]; - const string home = params[HOMEDIR]; - const std::string queue = params[QUEUE]; - std::string rootNameToExecute; - std::string fileNameToExecute; - std::string filelogtemp; - if( fileToExecute.size() > 0 ){ - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - fileNameToExecute = "~/" + dirForTmpFiles + "/" + string(basename((char *) fileToExecute.c_str())); - - int idx = dirForTmpFiles.find("Batch/"); - filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); - } - else{ - rootNameToExecute = "command"; - } - - std::string TmpFileName = BuildTemporaryFileName(); - ofstream tempOutputFile; - tempOutputFile.open(TmpFileName.c_str(), ofstream::out ); - - tempOutputFile << "#! /bin/sh -f" << endl; - if (queue != "") - tempOutputFile << "#$ -q " << queue << endl; - tempOutputFile << "#$ -pe mpich " << nbproc << endl; - if( edt > 0 ) - tempOutputFile << "#$ -l h_rt=" << getWallTime(edt) << endl ; - if( mem > 0 ) - tempOutputFile << "#$ -l h_vmem=" << mem << "M" << endl ; - if( fileToExecute.size() > 0 ){ - tempOutputFile << "#$ -o " << home << "/" << dirForTmpFiles << "/output.log." << filelogtemp << endl ; - tempOutputFile << "#$ -e " << home << "/" << dirForTmpFiles << "/error.log." << filelogtemp << endl ; - } - else{ - tempOutputFile << "#$ -o " << dirForTmpFiles << "/" << env["LOGFILE"] << ".output.log" << endl ; - tempOutputFile << "#$ -e " << dirForTmpFiles << "/" << env["LOGFILE"] << ".error.log" << endl ; - } - if( workDir.size() > 0 ) - tempOutputFile << "cd " << workDir << endl ; - if( fileToExecute.size() > 0 ){ - tempOutputFile << _mpiImpl->boot("",nbproc); - tempOutputFile << _mpiImpl->run("${TMPDIR}/machines",nbproc,fileNameToExecute); - tempOutputFile << _mpiImpl->halt(); - } - else{ - tempOutputFile << "source " << env["SOURCEFILE"] << endl ; - tempOutputFile << env["COMMAND"]; - } - - tempOutputFile.flush(); - tempOutputFile.close(); - chmod(TmpFileName.c_str(), 0x1ED); - cerr << TmpFileName.c_str() << endl; - - string command; - if( _protocol == "rsh" ) - command = "rcp "; - else if( _protocol == "ssh" ) - command = "scp "; - else - throw EmulationException("Unknown protocol"); - command += TmpFileName; - command += " "; - if(_username != ""){ - command += _username; - command += "@"; - } - command += _hostname; - command += ":"; - command += dirForTmpFiles ; - command += "/" ; - command += rootNameToExecute ; - command += "_Batch.sh" ; - cerr << command.c_str() << endl; - status = system(command.c_str()); - if(status) - throw EmulationException("Error of connection on remote host"); - - RmTmpFile(TmpFileName); -#endif //WIN32 - } - - std::string BatchManager_eSGE::getWallTime(const long edt) - { - long h, m; - h = edt / 60; - m = edt - h*60; - ostringstream oss; - if( m >= 10 ) - oss << h << ":" << m; - else - oss << h << ":0" << m; - return oss.str(); - } - -} diff --git a/src/Batch/Batch_BatchManager_eSGE.hxx b/src/Batch/Batch_BatchManager_eSGE.hxx deleted file mode 100644 index c2a0fecca..000000000 --- a/src/Batch/Batch_BatchManager_eSGE.hxx +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BatchManager_eSGE.hxx : emulation of SGE client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#ifndef _BATCHMANAGER_eLSF_H_ -#define _BATCHMANAGER_eLSF_H_ - -#include "Batch_Defines.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" -#include "Batch_JobInfo_eSGE.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_ConnexionFailureException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_NotYetImplementedException.hxx" -#include "Batch_BatchManager.hxx" -#include "Batch_BatchManager_eClient.hxx" - -namespace Batch { - - class Job; - class JobId; - class JobInfo; - class FactBatchManager; - - class BATCH_EXPORT BatchManager_eSGE : public BatchManager_eClient - { - public: - // Constructeur et destructeur - BatchManager_eSGE(const FactBatchManager * parent, const char * host="localhost", const char * protocol="ssh", const char * mpiImpl="nompi") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host - virtual ~BatchManager_eSGE(); - - // Recupere le nom du serveur par defaut - // static string BatchManager_LSF::getDefaultServer(); - - // Methodes pour le controle des jobs - virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire - virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire - virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente - virtual void releaseJob(const JobId & jobid); // relache un job suspendu - virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente - virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente - virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job - virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine - - virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente - virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente - - - protected: - void buildBatchScript(const Job & job) throw(EmulationException); - std::string getWallTime(const long edt); - - private: - -#ifdef SWIG - public: - // Recupere le l'identifiant d'un job deja soumis au BatchManager - //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); } - virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); } -#endif - - }; - -} - -#endif diff --git a/src/Batch/Batch_BoolType.cxx b/src/Batch/Batch_BoolType.cxx deleted file mode 100644 index 138b4aebf..000000000 --- a/src/Batch/Batch_BoolType.cxx +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BoolType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include "Batch_BoolType.hxx" -using namespace std; - -namespace Batch { - - // Conversion en chaine - string BoolType::affiche() const - { - return _data ? string("true") : string("false"); - } - - // Operateur d'affectation - BoolType & BoolType::operator =(bool b) - { - _data = b; - return *this; - } - - // Conversion en bool - BoolType::operator bool() const - { - return this->_data; - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * BoolType::clone() const - { - BoolType * pB = new BoolType(this->_data); - assert(pB != 0); - return pB; - } - -} diff --git a/src/Batch/Batch_BoolType.hxx b/src/Batch/Batch_BoolType.hxx deleted file mode 100644 index 99e87ad99..000000000 --- a/src/Batch/Batch_BoolType.hxx +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * BoolType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _BOOLTYPE_H_ -#define _BOOLTYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" - -namespace Batch { - - class BATCH_EXPORT BoolType : public GenericType - { - public: - // Constructeur - BoolType(const bool b=false) : _data(b) {} - - // Conversion en chaine - virtual std::string affiche() const; - - // Operateur d'affectation - virtual BoolType & operator =(bool); - - // Conversion en bool - virtual operator bool() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - bool _data; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_CharType.cxx b/src/Batch/Batch_CharType.cxx deleted file mode 100644 index d1649c358..000000000 --- a/src/Batch/Batch_CharType.cxx +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * CharType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include "Batch_CharType.hxx" -using namespace std; - -namespace Batch { - - // Conversion en chaine - string CharType::affiche() const - { - return string(1, _data); - } - - // Operateur d'affectation - CharType & CharType::operator =(char c) - { - _data = c; - return *this; - } - - // Conversion en char - CharType::operator char() const - { - return this->_data; - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * CharType::clone() const - { - CharType * pC = new CharType(this->_data); - assert(pC != 0); - return pC; - } - -} diff --git a/src/Batch/Batch_CharType.hxx b/src/Batch/Batch_CharType.hxx deleted file mode 100644 index 2a6afcaca..000000000 --- a/src/Batch/Batch_CharType.hxx +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * CharType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _CHARTYPE_H_ -#define _CHARTYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" - -namespace Batch { - - class BATCH_EXPORT CharType : public GenericType - { - public: - // Constructeur - CharType(const char c=0) : _data(c) {} - - // Conversion en chaine - virtual std::string affiche() const; - - // Operateur d'affectation - virtual CharType & operator =(char); - - // Conversion en char - virtual operator char() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - char _data; - - private: - - }; - -} - -#endif - diff --git a/src/Batch/Batch_ConnexionFailureException.cxx b/src/Batch/Batch_ConnexionFailureException.cxx deleted file mode 100644 index e1294f818..000000000 --- a/src/Batch/Batch_ConnexionFailureException.cxx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * ConnexionFailureException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 13 11:24:31 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_ConnexionFailureException.hxx" -using namespace std; - -namespace Batch { - -} diff --git a/src/Batch/Batch_Couple.cxx b/src/Batch/Batch_Couple.cxx deleted file mode 100644 index d70367ba7..000000000 --- a/src/Batch/Batch_Couple.cxx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Couple.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Dec 9 15:00:35 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_Couple.hxx" -using namespace std; - -namespace Batch { - - // Operateur d'affectation - Couple & Couple::operator =(const Couple & C) - { - _local = C._local; - _remote = C._remote; - return *this; - } - - // Conversion en chaine - string Couple::str() const - { - string res; - res = "Couple(local : "; - res += _local; - res += ", remote : "; - res += _remote; - res += ")"; - return res; - } - - // Operateur pour l'affichage sur un stream - ostream & operator << (ostream & os, const Couple & cp) - { - return os << cp.str(); - } - -} diff --git a/src/Batch/Batch_Couple.hxx b/src/Batch/Batch_Couple.hxx deleted file mode 100644 index 12c428a2a..000000000 --- a/src/Batch/Batch_Couple.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Couple.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Dec 9 15:00:35 2003 - * Projet : Salome 2 - * - */ - -#ifndef _COUPLE_H_ -#define _COUPLE_H_ - -#include "Batch_Defines.hxx" - -#include - -namespace Batch { - - class BATCH_EXPORT Couple - { - public: - // Constructeur standard - Couple(const std::string & local="", const std::string & remote="") : _local(local), _remote(remote) {} - - // Constructeur par recopie - Couple(const Couple & C) : _local(C._local), _remote(C._remote) {} - - // Operateur pour l'affichage sur un stream - friend std::ostream & operator << (std::ostream & os, const Couple & cp); - - // Operateur d'affectation - virtual Couple & operator =(const Couple &); - - // Conversion en chaine - virtual std::string str() const; - - // Accesseurs - virtual std::string getLocal() const { return _local; } - virtual std::string getRemote() const { return _remote; } - - protected: - std::string _local; // chemin d'acces au fichier local - std::string _remote; // chemin d'acees au fichier distant - - private: - - }; - -} - -#endif - diff --git a/src/Batch/Batch_CoupleType.cxx b/src/Batch/Batch_CoupleType.cxx deleted file mode 100644 index 2b6bfea63..000000000 --- a/src/Batch/Batch_CoupleType.cxx +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * CoupleType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Dec 9 14:51:53 2003 - * Projet : Salome 2 - * - */ - -#include -#include "Batch_CoupleType.hxx" -using namespace std; - -namespace Batch { - - // Conversion en chaine - string CoupleType::affiche() const - { - return _data.str(); - } - - // Operateur d'affectation - CoupleType & CoupleType::operator =(const Couple & C) - { - _data = C; - return *this; - } - - // Conversion en char - CoupleType::operator Couple() const - { - return _data; - } - - // Conversion en chaine - CoupleType::operator string() const - { - return _data.str(); - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * CoupleType::clone() const - { - CoupleType * pC = new CoupleType(this->_data); - assert(pC != 0); - return pC; - } - -} - diff --git a/src/Batch/Batch_CoupleType.hxx b/src/Batch/Batch_CoupleType.hxx deleted file mode 100644 index ca2e7e9b6..000000000 --- a/src/Batch/Batch_CoupleType.hxx +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * CoupleType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Dec 9 14:51:53 2003 - * Projet : Salome 2 - * - */ - -#ifndef _COUPLETYPE_H_ -#define _COUPLETYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" -#include "Batch_Couple.hxx" - -namespace Batch { - - class BATCH_EXPORT CoupleType : public GenericType - { - public: - // Constructeur - CoupleType(const Couple & C) : _data(C) {} - - // Conversion en chaine - virtual std::string affiche() const; - virtual operator std::string() const; - - // Operateur d'affectation - virtual CoupleType & operator =(const Couple & C); - - // Conversion en char - virtual operator Couple() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - Couple _data; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_Date.cxx b/src/Batch/Batch_Date.cxx deleted file mode 100644 index bc99d9764..000000000 --- a/src/Batch/Batch_Date.cxx +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Date.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Nov 26 14:11:42 2003 - * Projet : Salome 2 - * - */ - -#include -#include -#include "Batch_Date.hxx" -using namespace std; - -namespace Batch { - - Date::Date(const long l) - { - time_t l_t = l; - struct tm * p_tm = localtime(&l_t); - _day = p_tm->tm_mday; - _month = p_tm->tm_mon + 1; - _year = p_tm->tm_year + 1900; - _hour = p_tm->tm_hour; - _min = p_tm->tm_min; - _sec = p_tm->tm_sec; - } - - Date::Date(const string s) - { - if ((s == "now") || (s == "Now") || (s == "NOW")) { - long l = time(0); - time_t l_t = l; - struct tm * p_tm = localtime(&l_t); - _day = p_tm->tm_mday; - _month = p_tm->tm_mon + 1; - _year = p_tm->tm_year + 1900; - _hour = p_tm->tm_hour; - _min = p_tm->tm_min; - _sec = p_tm->tm_sec; - - } else { -// char c; -// istringstream ist(s); -// ist >> _day >> c -// >> _month >> c -// >> _year >> c -// >> _hour >> c -// >> _min >> c -// >> _sec; - sscanf(s.c_str(), "%ld/%ld/%ld-%ld:%ld:%ld", &_day, &_month, &_year, &_hour, &_min, &_sec); - } - } - - Date & Date::operator =(long l) - { - time_t l_t = l; - struct tm * p_tm = localtime(&l_t); - _day = p_tm->tm_mday; - _month = p_tm->tm_mon + 1; - _year = p_tm->tm_year + 1900; - _hour = p_tm->tm_hour; - _min = p_tm->tm_min; - _sec = p_tm->tm_sec; - - return *this; - } - - Date & Date::operator +(long l) - { - *this = epoch() + l; - return *this; - } - - Date & Date::operator -(long l) - { - *this = epoch() - l; - return *this; - } - - Date & Date::operator +=(long l) - { - *this = epoch() + l; - return *this; - } - - Date & Date::operator -=(long l) - { - *this = epoch() - l; - return *this; - } - - Date & Date::operator =(const string & s) - { - if ((s == "now") || (s == "Now") || (s == "NOW")) { - long l = time(0); - time_t l_t = l; - struct tm * p_tm = localtime(&l_t); - _day = p_tm->tm_mday; - _month = p_tm->tm_mon + 1; - _year = p_tm->tm_year + 1900; - _hour = p_tm->tm_hour; - _min = p_tm->tm_min; - _sec = p_tm->tm_sec; - - } else { -// char c; -// istringstream ist(s); -// ist >> _day >> c -// >> _month >> c -// >> _year >> c -// >> _hour >> c -// >> _min >> c -// >> _sec; - sscanf(s.c_str(), "%ld/%ld/%ld-%ld:%ld:%ld", &_day, &_month, &_year, &_hour, &_min, &_sec); - } - - return *this; - } - - string Date::str() const - { - char buf[64]; - string datestr; - - // _day to char * - sprintf(buf, "%02ld", _day); - datestr += buf; - datestr += "/"; - - // _month to char * - sprintf(buf, "%02ld", _month); - datestr += buf; - datestr += "/"; - - // _year to char * - sprintf(buf, "%04ld", _year); - datestr += buf; - datestr += "-"; - - // _hour to char * - sprintf(buf, "%02ld", _hour); - datestr += buf; - datestr += ":"; - - // _min to char * - sprintf(buf, "%02ld", _min); - datestr += buf; - datestr += ":"; - - // _sec to char * - sprintf(buf, "%02ld", _sec); - datestr += buf; - - return datestr; - } - - long Date::epoch() const - { - struct tm T; - T.tm_mday = _day; - T.tm_mon = _month - 1; - T.tm_year = _year - 1900; - T.tm_hour = _hour; - T.tm_min = _min; - T.tm_sec = _sec; - return mktime(&T); - } - -} - - -// COMMENTS diff --git a/src/Batch/Batch_Date.hxx b/src/Batch/Batch_Date.hxx deleted file mode 100644 index acbe81ff3..000000000 --- a/src/Batch/Batch_Date.hxx +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Date.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Nov 26 14:11:42 2003 - * Projet : Salome 2 - * - */ - -#ifndef _DATE_H_ -#define _DATE_H_ - -#include "Batch_Defines.hxx" - -#include - -namespace Batch { - - class BATCH_EXPORT Date - { - public: - Date(const long l=0); - Date(const std::string s); - virtual Date & operator =(long l); - virtual Date & operator +(long l); - virtual Date & operator -(long l); - virtual Date & operator +=(long l); - virtual Date & operator -=(long l); - virtual Date & operator =(const std::string & s); - virtual std::string str() const; - virtual long epoch() const; - - protected: - int _day, _month, _year; - int _hour, _min, _sec; - - private: - - }; - -} - -#endif - -// COMMENTS diff --git a/src/Batch/Batch_DateType.cxx b/src/Batch/Batch_DateType.cxx deleted file mode 100644 index 43d78d966..000000000 --- a/src/Batch/Batch_DateType.cxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * DateType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Nov 26 11:15:34 2003 - * Projet : Salome 2 - * - */ -extern "C" { -#include -} -#include -#include "Batch_DateType.hxx" -using namespace std; - -namespace Batch { - - // Conversion en chaine - string DateType::affiche() const - { - return _data.str(); - } - - // Operateur d'affectation - DateType & DateType::operator =(const Date & d) - { - _data = d; - return *this; - } - - // Conversion en Date - DateType::operator Date() const - { - return _data; - } - - // Conversion en long - DateType::operator long() const - { - return _data.epoch(); - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * DateType::clone() const - { - DateType * pD = new DateType(this->_data); - assert(pD != 0); - return pD; - } - -} diff --git a/src/Batch/Batch_DateType.hxx b/src/Batch/Batch_DateType.hxx deleted file mode 100644 index bed284683..000000000 --- a/src/Batch/Batch_DateType.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * DateType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Nov 26 11:15:34 2003 - * Projet : Salome 2 - * - */ - -#ifndef _DATETYPE_H_ -#define _DATETYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" -#include "Batch_Date.hxx" - -namespace Batch { - - class BATCH_EXPORT DateType : public GenericType - { - public: - // Constructeur - DateType(const Date & d) : _data(d) {}; - - // Conversion en chaine - virtual std::string affiche() const; - - // Operateur d'affectation - virtual DateType & operator =(const Date &); - - // Conversion en Date - virtual operator Date() const; - - // Conversion en long - virtual operator long() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - Date _data; - - private: - }; - -} - -#endif - diff --git a/src/Batch/Batch_Defines.hxx b/src/Batch/Batch_Defines.hxx deleted file mode 100755 index 84548ad42..000000000 --- a/src/Batch/Batch_Defines.hxx +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 : Batch_Defines.hxx -// Author : Alexander A. BORODIN -// Module : SALOME -// -#ifndef _BATCH_Defines_HXX_ -#define _BATCH_Defines_HXX_ - -#ifdef WIN32 -# if defined BATCH_EXPORTS || defined SalomeBatch_EXPORTS -# define BATCH_EXPORT __declspec( dllexport ) -# else -# define BATCH_EXPORT __declspec( dllimport ) -# endif -# define RM "rm" -# define RCP "rpc" -# define RSH "rsh" -#else -# define BATCH_EXPORT -#endif - -#endif diff --git a/src/Batch/Batch_Environnement.cxx b/src/Batch/Batch_Environnement.cxx deleted file mode 100644 index f74b03025..000000000 --- a/src/Batch/Batch_Environnement.cxx +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Environnement.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Oct 16 11:37:47 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_Environnement.hxx" -using namespace std; - -namespace Batch { - - -} diff --git a/src/Batch/Batch_Environnement.hxx b/src/Batch/Batch_Environnement.hxx deleted file mode 100644 index 354be1b1a..000000000 --- a/src/Batch/Batch_Environnement.hxx +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Environnement.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Oct 16 11:37:47 2003 - * Projet : Salome 2 - * - */ - -#ifndef _ENVIRONNEMENT_H_ -#define _ENVIRONNEMENT_H_ - -#include "Batch_Defines.hxx" - - -#include -#include - -namespace Batch { - - typedef std::map < std::string, std::string > Environnement; - -} - -#endif - diff --git a/src/Batch/Batch_FactBatchManager.cxx b/src/Batch/Batch_FactBatchManager.cxx deleted file mode 100644 index 0adc4e7d0..000000000 --- a/src/Batch/Batch_FactBatchManager.cxx +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include -#include -#include "Batch_BatchManagerCatalog.hxx" -#include "Batch_FactBatchManager.hxx" -using namespace std; - -namespace Batch { - - // Constructeur - FactBatchManager::FactBatchManager(const string & _t) : type(_t) - { - BatchManagerCatalog::addFactBatchManager(type.c_str(), this); - ostringstream msg; - msg << "FactBatchManager of type '" << type << "' inserted into catalog"; - cerr << msg.str().c_str() << endl; - } - - // Destructeur - FactBatchManager::~FactBatchManager() - { - // Nothing to do - } - - // Accesseur - string FactBatchManager::getType() const - { - return type; - } - - string FactBatchManager::__repr__() const - { - ostringstream oss; - oss << ""; - return oss.str(); - } - -} diff --git a/src/Batch/Batch_FactBatchManager.hxx b/src/Batch/Batch_FactBatchManager.hxx deleted file mode 100644 index 6b73b0159..000000000 --- a/src/Batch/Batch_FactBatchManager.hxx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_H_ -#define _FACTBATCHMANAGER_H_ - -#include "Batch_Defines.hxx" - -#include -#include - -namespace Batch { - - class BatchManager; - - class BATCH_EXPORT FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager(const std::string & type); - virtual ~FactBatchManager(); - - virtual Batch::BatchManager * operator() (const char * hostname) const = 0; - std::string getType() const; - std::string __repr__() const; - - protected: - std::string type; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_LSF.cxx b/src/Batch/Batch_FactBatchManager_LSF.cxx deleted file mode 100644 index 6149947ff..000000000 --- a/src/Batch/Batch_FactBatchManager_LSF.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_LSF.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include "Batch_BatchManager_LSF.hxx" -#include "Batch_FactBatchManager_LSF.hxx" -//#include "utilities.h" - -namespace Batch { - - static FactBatchManager_LSF sFBM_LSF; - - // Constructeur - FactBatchManager_LSF::FactBatchManager_LSF() : FactBatchManager("LSF") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_LSF::~FactBatchManager_LSF() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_LSF::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'"); - return new BatchManager_LSF(this, hostname); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_LSF.hxx b/src/Batch/Batch_FactBatchManager_LSF.hxx deleted file mode 100644 index 59ef2ad4f..000000000 --- a/src/Batch/Batch_FactBatchManager_LSF.hxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_LSF.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_LSF_H_ -#define _FACTBATCHMANAGER_LSF_H_ - -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_LSF; - - class FactBatchManager_LSF : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_LSF(); - virtual ~FactBatchManager_LSF(); - - virtual BatchManager * operator() (const char * hostname) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_Local.cxx b/src/Batch/Batch_FactBatchManager_Local.cxx deleted file mode 100644 index 46fb1302f..000000000 --- a/src/Batch/Batch_FactBatchManager_Local.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_Local.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include "Batch_BatchManager_Local.hxx" -#include "Batch_FactBatchManager_Local.hxx" -//#include "utilities.h" - -namespace Batch { - -// static FactBatchManager_Local sFBM_Local; - - // Constructeur - FactBatchManager_Local::FactBatchManager_Local() : FactBatchManager("Local") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_Local::~FactBatchManager_Local() - { - // Nothing to do - } - - // Functor -// BatchManager * FactBatchManager_Local::operator() (const char * hostname) const -// { -// // MESSAGE("Building new BatchManager_Local on host '" << hostname << "'"); -// return new BatchManager_Local(this, hostname); -// } - - -} diff --git a/src/Batch/Batch_FactBatchManager_Local.hxx b/src/Batch/Batch_FactBatchManager_Local.hxx deleted file mode 100644 index 4b2f0d497..000000000 --- a/src/Batch/Batch_FactBatchManager_Local.hxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_Local.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_LOCAL_H_ -#define _FACTBATCHMANAGER_LOCAL_H_ - -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_Local; - - class FactBatchManager_Local : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_Local(); - virtual ~FactBatchManager_Local(); - - virtual BatchManager * operator() (const char * hostname) const = 0; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_Local_RSH.cxx b/src/Batch/Batch_FactBatchManager_Local_RSH.cxx deleted file mode 100644 index 8e21bb577..000000000 --- a/src/Batch/Batch_FactBatchManager_Local_RSH.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_Local_RSH.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include "Batch_BatchManager_Local_RSH.hxx" -#include "Batch_FactBatchManager_Local_RSH.hxx" -//#include "utilities.h" - -namespace Batch { - - // Constructeur - FactBatchManager_Local_RSH::FactBatchManager_Local_RSH() : FactBatchManager("RSH") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_Local_RSH::~FactBatchManager_Local_RSH() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_Local_RSH::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_Local_RSH on host '" << hostname << "'"); - return new BatchManager_Local_RSH(this, hostname); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_Local_RSH.hxx b/src/Batch/Batch_FactBatchManager_Local_RSH.hxx deleted file mode 100644 index 8b11c5d00..000000000 --- a/src/Batch/Batch_FactBatchManager_Local_RSH.hxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_Local_RSH.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_LOCAL_RSH_H_ -#define _FACTBATCHMANAGER_LOCAL_RSH_H_ - -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_Local_RSH; - - class FactBatchManager_Local_RSH : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_Local_RSH(); - virtual ~FactBatchManager_Local_RSH(); - - virtual BatchManager * operator() (const char * hostname) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_Local_SH.cxx b/src/Batch/Batch_FactBatchManager_Local_SH.cxx deleted file mode 100644 index a317e3c5a..000000000 --- a/src/Batch/Batch_FactBatchManager_Local_SH.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_Local_SH.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include "Batch_BatchManager_Local_SH.hxx" -#include "Batch_FactBatchManager_Local_SH.hxx" -//#include "utilities.h" - -namespace Batch { - - static FactBatchManager_Local_SH sFBM_Local_SH; - - // Constructeur - FactBatchManager_Local_SH::FactBatchManager_Local_SH() : FactBatchManager("SH") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_Local_SH::~FactBatchManager_Local_SH() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_Local_SH::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_Local_SH on host '" << hostname << "'"); - return new BatchManager_Local_SH(this, hostname); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_Local_SH.hxx b/src/Batch/Batch_FactBatchManager_Local_SH.hxx deleted file mode 100644 index 499eafef4..000000000 --- a/src/Batch/Batch_FactBatchManager_Local_SH.hxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_Local_SH.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_LOCAL_SH_H_ -#define _FACTBATCHMANAGER_LOCAL_SH_H_ - -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_Local_SH; - - class FactBatchManager_Local_SH : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_Local_SH(); - virtual ~FactBatchManager_Local_SH(); - - virtual BatchManager * operator() (const char * hostname) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_Local_SSH.cxx b/src/Batch/Batch_FactBatchManager_Local_SSH.cxx deleted file mode 100644 index d96237451..000000000 --- a/src/Batch/Batch_FactBatchManager_Local_SSH.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_Local_SSH.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include -#include "Batch_BatchManager_Local_SSH.hxx" -#include "Batch_FactBatchManager_Local_SSH.hxx" -//#include "utilities.h" - -namespace Batch { - - static FactBatchManager_Local_SSH sFBM_Local_SSH; - - // Constructeur - FactBatchManager_Local_SSH::FactBatchManager_Local_SSH() : FactBatchManager("SSH") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_Local_SSH::~FactBatchManager_Local_SSH() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_Local_SSH::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_Local_SSH on host '" << hostname << "'"); - return new BatchManager_Local_SSH(this, hostname); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_Local_SSH.hxx b/src/Batch/Batch_FactBatchManager_Local_SSH.hxx deleted file mode 100644 index 7f64f0e26..000000000 --- a/src/Batch/Batch_FactBatchManager_Local_SSH.hxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_Local_SSH.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_LOCAL_SSH_H_ -#define _FACTBATCHMANAGER_LOCAL_SSH_H_ - -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_Local_SSH; - - class FactBatchManager_Local_SSH : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_Local_SSH(); - virtual ~FactBatchManager_Local_SSH(); - - virtual BatchManager * operator() (const char * hostname) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_PBS.cxx b/src/Batch/Batch_FactBatchManager_PBS.cxx deleted file mode 100644 index 43c79e213..000000000 --- a/src/Batch/Batch_FactBatchManager_PBS.cxx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_PBS.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#include "Batch_BatchManager_PBS.hxx" -#include "Batch_FactBatchManager_PBS.hxx" -using namespace std; - -namespace Batch { - - static FactBatchManager_PBS sFBM_PBS; - - // Constructeur - FactBatchManager_PBS::FactBatchManager_PBS() : FactBatchManager("PBS") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_PBS::~FactBatchManager_PBS() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_PBS::operator() (const char * hostname) const - { - return new BatchManager_PBS(this, hostname); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_PBS.hxx b/src/Batch/Batch_FactBatchManager_PBS.hxx deleted file mode 100644 index cc43b6e2d..000000000 --- a/src/Batch/Batch_FactBatchManager_PBS.hxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_PBS.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2004 - * Projet : SALOME 2 - * - */ - -#ifndef _FACTBATCHMANAGER_PBS_H_ -#define _FACTBATCHMANAGER_PBS_H_ - -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_PBS; - - class FactBatchManager_PBS : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_PBS(); - virtual ~FactBatchManager_PBS(); - - virtual BatchManager * operator() (const char * hostname) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_eClient.cxx b/src/Batch/Batch_FactBatchManager_eClient.cxx deleted file mode 100644 index 528bed807..000000000 --- a/src/Batch/Batch_FactBatchManager_eClient.cxx +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_eClient.cxx : emulation of client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#include -#include -#include "Batch_FactBatchManager_eClient.hxx" -using namespace std; - -namespace Batch { - - // Constructeur - FactBatchManager_eClient::FactBatchManager_eClient(const string & _t) : FactBatchManager(_t) - { - } - - // Destructeur - FactBatchManager_eClient::~FactBatchManager_eClient() - { - // Nothing to do - } - -} diff --git a/src/Batch/Batch_FactBatchManager_eClient.hxx b/src/Batch/Batch_FactBatchManager_eClient.hxx deleted file mode 100644 index 82192d714..000000000 --- a/src/Batch/Batch_FactBatchManager_eClient.hxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_eClient.hxx : emulation of client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#ifndef _FACTBATCHMANAGER_eClient_H_ -#define _FACTBATCHMANAGER_eClient_H_ - -#include -#include -#include "Batch_FactBatchManager.hxx" - -namespace Batch { - - class BatchManager_eClient; - - class FactBatchManager_eClient : public FactBatchManager - { - public: - // Constructeur et destructeur - FactBatchManager_eClient(const std::string & type); - virtual ~FactBatchManager_eClient(); - - virtual Batch::BatchManager_eClient * operator() (const char * hostname,const char * protocol, const char * mpi) const = 0; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_eLSF.cxx b/src/Batch/Batch_FactBatchManager_eLSF.cxx deleted file mode 100644 index e46b355bd..000000000 --- a/src/Batch/Batch_FactBatchManager_eLSF.cxx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_eLSF.cxx : - * - * Auteur : Bernard SECHER - CEA DEN - * Date : Avril 2008 - * Projet : PAL Salome - * - */ - -#include -#include "Batch_BatchManager_eLSF.hxx" -#include "Batch_FactBatchManager_eLSF.hxx" -//#include "utilities.h" - -namespace Batch { - - // Constructeur - FactBatchManager_eLSF::FactBatchManager_eLSF() : FactBatchManager_eClient("eLSF") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_eLSF::~FactBatchManager_eLSF() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_eLSF::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'"); - return new BatchManager_eLSF(this, hostname); - } - - BatchManager_eClient * FactBatchManager_eLSF::operator() (const char * hostname, const char * protocol, const char * mpiImpl) const - { - // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'"); - return new BatchManager_eLSF(this, hostname, protocol, mpiImpl); - } - -} diff --git a/src/Batch/Batch_FactBatchManager_eLSF.hxx b/src/Batch/Batch_FactBatchManager_eLSF.hxx deleted file mode 100644 index d2dec68b1..000000000 --- a/src/Batch/Batch_FactBatchManager_eLSF.hxx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_eLSF.hxx : - * - * Auteur : Bernard SECHER : CEA DEN - * Date : Avril 2008 - * Projet : PAL Salome - * - */ - -#ifndef _FACTBATCHMANAGER_eLSF_H_ -#define _FACTBATCHMANAGER_eLSF_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include "Batch_BatchManager_eClient.hxx" -#include "Batch_FactBatchManager_eClient.hxx" - -namespace Batch { - - class BatchManager_eLSF; - - class BATCH_EXPORT FactBatchManager_eLSF : public FactBatchManager_eClient - { - public: - // Constructeur et destructeur - FactBatchManager_eLSF(); - virtual ~FactBatchManager_eLSF(); - - virtual BatchManager * operator() (const char * hostname) const; - virtual BatchManager_eClient * operator() (const char * hostname, const char * protocol, const char * mpiImpl) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_ePBS.cxx b/src/Batch/Batch_FactBatchManager_ePBS.cxx deleted file mode 100644 index 863ed5212..000000000 --- a/src/Batch/Batch_FactBatchManager_ePBS.cxx +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_ePBS.cxx : - * - * Auteur : Bernard SECHER - CEA DEN - * Date : Avril 2008 - * Projet : PAL Salome - * - */ - -#include -#include "Batch_BatchManager_ePBS.hxx" -#include "Batch_FactBatchManager_ePBS.hxx" -//#include "utilities.h" - -namespace Batch { - - // Constructeur - FactBatchManager_ePBS::FactBatchManager_ePBS() : FactBatchManager_eClient("ePBS") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_ePBS::~FactBatchManager_ePBS() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_ePBS::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_PBS on host '" << hostname << "'"); - return new BatchManager_ePBS(this, hostname); - } - - BatchManager_eClient * FactBatchManager_ePBS::operator() (const char * hostname, const char * protocol, const char * mpiImpl) const - { - // MESSAGE("Building new BatchManager_PBS on host '" << hostname << "'"); - return new BatchManager_ePBS(this, hostname, protocol, mpiImpl); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_ePBS.hxx b/src/Batch/Batch_FactBatchManager_ePBS.hxx deleted file mode 100644 index 027e9ed62..000000000 --- a/src/Batch/Batch_FactBatchManager_ePBS.hxx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_ePBS.hxx : - * - * Auteur : Bernard SECHER : CEA DEN - * Date : Avril 2008 - * Projet : PAL Salome - * - */ - -#ifndef _FACTBATCHMANAGER_ePBS_H_ -#define _FACTBATCHMANAGER_ePBS_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include "Batch_BatchManager_eClient.hxx" -#include "Batch_FactBatchManager_eClient.hxx" - -namespace Batch { - - class BatchManager_ePBS; - - class BATCH_EXPORT FactBatchManager_ePBS : public FactBatchManager_eClient - { - public: - // Constructeur et destructeur - FactBatchManager_ePBS(); - virtual ~FactBatchManager_ePBS(); - - virtual BatchManager * operator() (const char * hostname) const; - virtual BatchManager_eClient * operator() (const char * hostname, const char * protocol, const char * mpiImpl) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_FactBatchManager_eSGE.cxx b/src/Batch/Batch_FactBatchManager_eSGE.cxx deleted file mode 100644 index c7a6c9f90..000000000 --- a/src/Batch/Batch_FactBatchManager_eSGE.cxx +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_eSGE.cxx : - * - * Auteur : Bernard SECHER - CEA DEN - * Date : Avril 2008 - * Projet : PAL Salome - * - */ - -#include -#include "Batch_BatchManager_eSGE.hxx" -#include "Batch_FactBatchManager_eSGE.hxx" -//#include "utilities.h" - -namespace Batch { - - static FactBatchManager_eSGE sFBM_eSGE; - - // Constructeur - FactBatchManager_eSGE::FactBatchManager_eSGE() : FactBatchManager_eClient("eSGE") - { - // Nothing to do - } - - // Destructeur - FactBatchManager_eSGE::~FactBatchManager_eSGE() - { - // Nothing to do - } - - // Functor - BatchManager * FactBatchManager_eSGE::operator() (const char * hostname) const - { - // MESSAGE("Building new BatchManager_SGE on host '" << hostname << "'"); - return new BatchManager_eSGE(this, hostname); - } - - BatchManager_eClient * FactBatchManager_eSGE::operator() (const char * hostname, const char * protocol, const char * mpiImpl) const - { - // MESSAGE("Building new BatchManager_SGE on host '" << hostname << "'"); - return new BatchManager_eSGE(this, hostname, protocol, mpiImpl); - } - - -} diff --git a/src/Batch/Batch_FactBatchManager_eSGE.hxx b/src/Batch/Batch_FactBatchManager_eSGE.hxx deleted file mode 100644 index 44f7f6ce0..000000000 --- a/src/Batch/Batch_FactBatchManager_eSGE.hxx +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * FactBatchManager_eSGE.hxx : - * - * Auteur : Bernard SECHER : CEA DEN - * Date : Avril 2008 - * Projet : PAL Salome - * - */ - -#ifndef _FACTBATCHMANAGER_eSGE_H_ -#define _FACTBATCHMANAGER_eSGE_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_BatchManager_eClient.hxx" -#include "Batch_FactBatchManager_eClient.hxx" - -namespace Batch { - - class BatchManager_eSGE; - - class BATCH_EXPORT FactBatchManager_eSGE : public FactBatchManager_eClient - { - public: - // Constructeur et destructeur - FactBatchManager_eSGE(); - virtual ~FactBatchManager_eSGE(); - - virtual BatchManager * operator() (const char * hostname) const; - virtual BatchManager_eClient * operator() (const char * hostname, const char * protocol, const char * mpiImpl) const; - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_GenericException.cxx b/src/Batch/Batch_GenericException.cxx deleted file mode 100644 index 4303e1c57..000000000 --- a/src/Batch/Batch_GenericException.cxx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * GenericException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Nov 26 10:15:57 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_GenericException.hxx" -using namespace std; - -namespace Batch { - -} diff --git a/src/Batch/Batch_GenericException.hxx b/src/Batch/Batch_GenericException.hxx deleted file mode 100644 index ed80ab193..000000000 --- a/src/Batch/Batch_GenericException.hxx +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * GenericException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Nov 26 10:15:56 2003 - * Projet : Salome 2 - * - */ - -#ifndef _GENERICEXCEPTION_H_ -#define _GENERICEXCEPTION_H_ - -#include "Batch_Defines.hxx" - - -#include - -namespace Batch { - - class BATCH_EXPORT GenericException - { - public: - const std::string type; // la nature de l'exception - const std::string message; // la raison de l'exception - - // Constructeur - GenericException(const std::string tp = "GenericException", const std::string ch = "undefined") : type(tp), message(ch) {} - }; - -} - -#endif diff --git a/src/Batch/Batch_GenericType.cxx b/src/Batch/Batch_GenericType.cxx deleted file mode 100644 index 95a5a16a2..000000000 --- a/src/Batch/Batch_GenericType.cxx +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * GenericType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - - -#include -#include -#include -#include "Batch_GenericType.hxx" -using namespace std; - -namespace Batch { - - // nombre total d'objet GenericType et al. - int GenericType::_nb = 0; - - // Operateur pour l'affichage sur un stream - ostream & operator << (ostream & os, const GenericType & obj) - { - return os << obj.affiche(); - } - - // Conversion en chaine - string GenericType::affiche() const - { - return string("(GenericType : si ce message apparait, vous devez avoir un probleme)"); - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * GenericType::clone() const - { - GenericType * pG = new GenericType; - assert(pG != 0); - return pG; - } - -} - diff --git a/src/Batch/Batch_GenericType.hxx b/src/Batch/Batch_GenericType.hxx deleted file mode 100644 index 613d1f5ff..000000000 --- a/src/Batch/Batch_GenericType.hxx +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * GenericType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _GENERICTYPE_H_ -#define _GENERICTYPE_H_ - -#include "Batch_Defines.hxx" - - -#include -#include - -namespace Batch { - - class BATCH_EXPORT GenericType - { - public: - // Constructeur et destructeur - GenericType() { _nb++; } - virtual ~GenericType() { _nb--; } - - // Operateur pour l'affichage sur un stream - friend std::ostream & operator << (std::ostream & os, const GenericType & obj); - - // Conversion en chaine - virtual std::string affiche() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - // Retourne le nombre d'objets GenericType et al. - static int getNb() { return _nb; } - - protected: - - private: - static int _nb; // nombre total d'objets GenericType et al. - - }; - -} - -#endif - diff --git a/src/Batch/Batch_IOMutex.hxx b/src/Batch/Batch_IOMutex.hxx deleted file mode 100644 index a047b380f..000000000 --- a/src/Batch/Batch_IOMutex.hxx +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * IOMutex.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#ifndef _IOMUTEX_H_ -#define _IOMUTEX_H_ - -#include - -#define LOCK_IO { pthread_mutex_lock(&Batch::IOMutex) ; } -#define UNLOCK_IO { pthread_mutex_unlock(&Batch::IOMutex) ; } -#define UNDER_LOCK(statement) { LOCK_IO ; { statement ; } ; UNLOCK_IO ; } - -namespace Batch { - - extern pthread_mutex_t IOMutex; - -} - -#endif diff --git a/src/Batch/Batch_IntType.cxx b/src/Batch/Batch_IntType.cxx deleted file mode 100644 index aa704ef27..000000000 --- a/src/Batch/Batch_IntType.cxx +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * IntType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include -//#include "MEDMEM_STRING.hxx" -#include "Batch_IntType.hxx" -using namespace std; - - -namespace Batch { - - // Conversion en chaine - string IntType::affiche() const - { - //MEDMEM::STRING sst; - ostringstream sst; - sst << _data; - return sst.str(); - } - - // Operateur d'affectation - IntType & IntType::operator =(int i) - { - _data = i; - return *this; - } - - // Conversion en int - IntType::operator int() const - { - return this->_data; - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * IntType::clone() const - { - IntType * pI = new IntType(this->_data); - assert(pI != 0); - return pI; - } - -} diff --git a/src/Batch/Batch_IntType.hxx b/src/Batch/Batch_IntType.hxx deleted file mode 100644 index 79db3b734..000000000 --- a/src/Batch/Batch_IntType.hxx +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * IntType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _INTTYPE_H_ -#define _INTTYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" - -namespace Batch { - - class BATCH_EXPORT IntType : public GenericType - { - public: - // Constructeur - IntType(const int i=0) : _data(i) {} - - // Conversion en chaine - virtual std::string affiche() const; - - // Operateur d'affectation - virtual IntType & operator =(int); - - // Conversion en int - virtual operator int() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - int _data; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_InvalidArgumentException.cxx b/src/Batch/Batch_InvalidArgumentException.cxx deleted file mode 100644 index b57b83453..000000000 --- a/src/Batch/Batch_InvalidArgumentException.cxx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * InvalidArgumentException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Oct 16 16:18:00 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_InvalidArgumentException.hxx" -using namespace std; - -namespace Batch { - -} diff --git a/src/Batch/Batch_InvalidKeyException.cxx b/src/Batch/Batch_InvalidKeyException.cxx deleted file mode 100644 index 2daaabfd1..000000000 --- a/src/Batch/Batch_InvalidKeyException.cxx +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * InvalidKeyException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Oct 15 10:39:51 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_InvalidKeyException.hxx" -using namespace std; - -namespace Batch { - -} - diff --git a/src/Batch/Batch_InvalidKeyException.hxx b/src/Batch/Batch_InvalidKeyException.hxx deleted file mode 100644 index 9fc8c70de..000000000 --- a/src/Batch/Batch_InvalidKeyException.hxx +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * InvalidKeyException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Wed Oct 15 10:39:51 2003 - * Projet : Salome 2 - * - */ - -#ifndef _INVALIDKEYEXCEPTION_H_ -#define _INVALIDKEYEXCEPTION_H_ - -#include "Batch_Defines.hxx" - - -#include "Batch_GenericException.hxx" -#include "Batch_GenericException.hxx" - -namespace Batch { - - class BATCH_EXPORT InvalidKeyException : public GenericException - { - public: - // Constructeur - InvalidKeyException(std::string ch = "undefined") : GenericException("InvalidKeyException", ch) {} - - protected: - - private: - - }; - -} - -#endif - diff --git a/src/Batch/Batch_Job.cxx b/src/Batch/Batch_Job.cxx deleted file mode 100644 index 276037296..000000000 --- a/src/Batch/Batch_Job.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Job.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include "Batch_Job.hxx" -#include "Batch_Parametre.hxx" -#include -//#include "MEDMEM_STRING.hxx" -using namespace std; - -namespace Batch { - - // Constructeur - Job::Job() : _param(), _env() - { - // Nothing to do - } - - - // Constructeur - Job::Job(Parametre param) : _param(param), _env() - { - // Nothing to do - } - - - // Constructeur - Job::Job(Environnement env) : _param(), _env(env) - { - // Nothing to do - } - - - // Constructeur - Job::Job(Parametre param, Environnement env) : _param(param), _env(env) - { - // Nothing to do - } - - // Operateur pour l'affichage sur un stream - ostream & operator <<(ostream & os, const Job & job) - { - return os << job.__str__(); - } - - // Accesseur - Batch::Parametre Job::getParametre() const - { - return _param; - } - - // Accesseur - void Job::setParametre(const Batch::Parametre & param) - { - _param = param; - } - - // Accesseur - Environnement Job::getEnvironnement() const - { - return _env; - } - - // Accesseur - void Job::setEnvironnement(const Environnement & env) - { - _env = env; - } - - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string Job::__str__() const { - //MEDMEM::STRING str; - ostringstream str; - str << ""; - return str.str(); - } - - -} diff --git a/src/Batch/Batch_Job.hxx b/src/Batch/Batch_Job.hxx deleted file mode 100644 index 264fb8e82..000000000 --- a/src/Batch/Batch_Job.hxx +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Job.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _JOB_H_ -#define _JOB_H_ - -#include "Batch_Defines.hxx" - - -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" - -namespace Batch { - - class BATCH_EXPORT Job - { - public: - // Constructeurs et destructeur - Job(); - Job(Batch::Parametre param); - Job(Batch::Environnement env); - Job(Batch::Parametre param, Batch::Environnement env); - virtual ~Job() {} - - // Operateur pour l'affichage sur un stream - friend std::ostream & operator <<(std::ostream & os, const Job & job); - - // Accesseurs - Batch::Parametre getParametre() const; - void setParametre(const Batch::Parametre &); - - // Accesseurs - Batch::Environnement getEnvironnement() const; - void setEnvironnement(const Batch::Environnement &); - - // Methodes pour l'interfacage avec Python (SWIG) - // TODO : supprimer ces methodes et transferer leur definitions dans SWIG - std::string __str__() const; // SWIG : affichage en Python - std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python - - protected: - Batch::Parametre _param; // table des parametres batch du job - Batch::Environnement _env; // table des variables d'environnement - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobId.cxx b/src/Batch/Batch_JobId.cxx deleted file mode 100644 index c465ada53..000000000 --- a/src/Batch/Batch_JobId.cxx +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * JobId.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include "Batch_JobId.hxx" -#include "Batch_BatchManager.hxx" -#include -#include -//#include "MEDMEM_STRING.hxx" -using namespace std; - -namespace Batch { - - // Constructeur standard - JobId::JobId() : _p_batchmanager(), _reference("undefined") - { - // Nothing to do - } - - // Constructeur avec le pointeur sur le BatchManager associe et avec une reference - JobId::JobId(BatchManager * _p_bm, string ref) : _p_batchmanager(_p_bm), _reference(ref) - { - // Nothing to do - } - - // Destructeur - JobId::~JobId() - { - // Nothing to do - } - - // Operateur d'affectation entre objets - JobId & JobId::operator =(const JobId & jobid) - { - _p_batchmanager = jobid._p_batchmanager; - _reference = jobid._reference; - - return *this; - } - - // Constructeur par recopie - JobId::JobId(const JobId & jobid) : _p_batchmanager(jobid._p_batchmanager), _reference(jobid._reference) - { - // Nothing to do - } - - // Accesseur pour la reference interne - string JobId::getReference() const - { - return _reference; - } - - // Methode pour le controle du job : retire le job du gestionnaire - void JobId::deleteJob() const - { - assert(_p_batchmanager != 0); - _p_batchmanager->deleteJob(*this); - } - - // Methode pour le controle du job : suspend le job en file d'attente - void JobId::holdJob() const - { - assert(_p_batchmanager != 0); - _p_batchmanager->holdJob(*this); - } - - // Methode pour le controle du job : relache le job suspendu - void JobId::releaseJob() const - { - assert(_p_batchmanager != 0); - _p_batchmanager->releaseJob(*this); - } - - // Methode pour le controle du job : modifie le job en file d'attente - void JobId::alterJob(const Parametre & param, const Environnement & env) const - { - assert(_p_batchmanager != 0); - _p_batchmanager->alterJob(*this, param, env); - } - - // Methode pour le controle du job : modifie le job en file d'attente - void JobId::alterJob(const Parametre & param) const - { - assert(_p_batchmanager != 0); - _p_batchmanager->alterJob(*this, param); - } - - // Methode pour le controle du job : modifie le job en file d'attente - void JobId::alterJob(const Environnement & env) const - { - assert(_p_batchmanager != 0); - _p_batchmanager->alterJob(*this, env); - } - - // Methode pour le controle du job : renvoie l'etat du job - JobInfo JobId::queryJob() const - { - assert(_p_batchmanager != 0); - return _p_batchmanager->queryJob(*this); - } - - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string JobId::__str__() const { - //MEDMEM::STRING str; - ostringstream str; - str << ""; - return str.str(); - } - -} diff --git a/src/Batch/Batch_JobId.hxx b/src/Batch/Batch_JobId.hxx deleted file mode 100644 index efd26321d..000000000 --- a/src/Batch/Batch_JobId.hxx +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * JobId.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _JOBID_H_ -#define _JOBID_H_ - - -#include "Batch_Defines.hxx" - -#include "Batch_JobInfo.hxx" -#include "Batch_BatchManager.hxx" - -namespace Batch { - - class BatchManager; - - class BATCH_EXPORT JobId - { - friend class BatchManager; - - public: - // Constructeur standard et destructeur - JobId(); - virtual ~JobId(); - - // Constructeur avec le pointeur sur le BatchManager associe et avec une reference - JobId(Batch::BatchManager *, std::string ref); - - // Operateur d'affectation entre objets - virtual JobId & operator =(const Batch::JobId &); - - // Constructeur par recopie - JobId(const Batch::JobId &); - - // Accesseur pour la reference interne - virtual std::string getReference() const; - - // Methodes pour le controle du job - virtual void deleteJob() const; // retire un job du gestionnaire - virtual void holdJob() const; // suspend un job en file d'attente - virtual void releaseJob() const; // relache un job suspendu - virtual void alterJob(const Batch::Parametre & param, const Batch::Environnement & env) const; // modifie un job en file d'attente - virtual void alterJob(const Batch::Parametre & param) const; // modifie un job en file d'attente - virtual void alterJob(const Batch::Environnement & env) const; // modifie un job en file d'attente - virtual void setParametre(const Batch::Parametre & param) { return alterJob(param); } // modifie un job en file d'attente - virtual void setEnvironnement(const Batch::Environnement & env) { return alterJob(env); } // modifie un job en file d'attente - virtual Batch::JobInfo queryJob() const; // renvoie l'etat du job - - // Methodes pour l'interfacage avec Python (SWIG) - // TODO : supprimer ces methodes et transferer leur definitions dans SWIG - std::string __str__() const; // SWIG : affichage en Python - std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python - - protected: - Batch::BatchManager * _p_batchmanager; // pointeur sur le BatchManager qui controle le job - std::string _reference; // reference du job au sein du BatchManager - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobInfo.cxx b/src/Batch/Batch_JobInfo.cxx deleted file mode 100644 index 63c85024f..000000000 --- a/src/Batch/Batch_JobInfo.cxx +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * JobInfo.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:05:30 2003 - * Projet : Salome 2 - * - */ - -#include -#include -#include -//#include "MEDMEM_STRING.hxx" -#include "Batch_JobInfo.hxx" - -using namespace std; - -namespace Batch { - - // Destructeur - JobInfo::~JobInfo() - { - // Nothing to do - } - - - // Operateur pour l'affichage sur un stream - ostream & operator <<(ostream & os, const JobInfo & ji) - { - return os << ji.__str__(); - } - - - // Methodes pour l'interfacage avec Python (SWIG) : affichage en Python - string JobInfo::__str__() const - { - //MEDMEM::STRING sst; - ostringstream sst; - sst << ""; - - return sst.str(); - } - - // Accesseur - Parametre JobInfo::getParametre() const - { - return _param; - } - - // Accesseur - Environnement JobInfo::getEnvironnement() const - { - return _env; - } - - -} diff --git a/src/Batch/Batch_JobInfo.hxx b/src/Batch/Batch_JobInfo.hxx deleted file mode 100644 index f4b54f115..000000000 --- a/src/Batch/Batch_JobInfo.hxx +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * JobInfo.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 6 10:05:30 2003 - * Projet : Salome 2 - * - */ - -#ifndef _JOBINFO_H_ -#define _JOBINFO_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" - -namespace Batch { - - class BATCH_EXPORT JobInfo - { - public: - // Constructeur standard et destructeur - JobInfo() : _param(), _env() {}; - virtual ~JobInfo(); - - // Constructeur par recopie - JobInfo(const JobInfo & jinfo) : _param(jinfo._param), _env(jinfo._env) {}; - - // Operateur pour l'affichage sur un stream - friend std::ostream & operator <<(std::ostream & os, const JobInfo & ji); - - // Accesseurs - // _CS_gbo Ajout explicite du namespace pour les besoins de swig (mauvaise gestion - // des namespace par swig. - virtual Batch::Parametre getParametre() const; - virtual Batch::Environnement getEnvironnement() const; - - // Methodes pour l'interfacage avec Python (SWIG) - // TODO : supprimer ces methodes et transferer leur definitions dans SWIG - std::string __str__() const; // SWIG : affichage en Python - std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python - - protected: - Parametre _param; // parametres du job - Environnement _env; // variables d'environnement du job - JobInfo(const Parametre & param, const Environnement & env) : _param(param), _env(env) {}; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobInfo_LSF.cxx b/src/Batch/Batch_JobInfo_LSF.cxx deleted file mode 100644 index b964aba9b..000000000 --- a/src/Batch/Batch_JobInfo_LSF.cxx +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * JobInfo_LSF.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 21 09:42:06 2003 - * Projet : Salome 2 - * - */ - -#include -#include -#include -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_RunTimeException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_JobInfo_LSF.hxx" - -using namespace std; - -namespace Batch { - - - - // Constructeurs - JobInfo_LSF::JobInfo_LSF(int id) : JobInfo() - { - struct loadIndexLog * p_ld = new struct loadIndexLog; - struct jobInfoHead * p_jInfoHead = lsb_openjobinfo_a(id, NULL, NULL, NULL, NULL, ALL_JOB); - - int more = p_jInfoHead->numJobs; - if (more != 1) { - char * msg = lsb_sysmsg(); - if (!msg) msg = "unknown"; - throw APIInternalFailureException(string("LSF lsb_openjobinfo error. Reason : ") + msg); - } - - // on remplit une structure contenant elements - struct jobInfoEnt & jobInfo = * lsb_readjobinfo(&more); - - - // On remplit les membres _param et _env - _param[ACCOUNT] = jobInfo.submit.projectName; - _param[CHECKPOINT] = jobInfo.submit.chkpntPeriod != 0; - _param[CKPTINTERVAL] = jobInfo.submit.chkpntPeriod; - _param[CREATIONTIME] = jobInfo.submitTime; - // _param[EGROUP] = jobInfo.; - _param[ELIGIBLETIME] = jobInfo.reserveTime; - _param[ENDTIME] = jobInfo.endTime; - _param[EUSER] = jobInfo.execUsername; - _param[EXECUTABLE] = jobInfo.submit.command; - _param[EXITCODE] = jobInfo.exitStatus; - _param[HOLD] = jobInfo.status & (JOB_STAT_PSUSP | JOB_STAT_SSUSP | JOB_STAT_USUSP); - _param[MAIL] = jobInfo.submit.mailUser; - _param[MAXCPUTIME] = jobInfo.submit.rLimits[LSF_RLIMIT_CPU]; - _param[MAXDISKSIZE] = jobInfo.submit.rLimits[LSF_RLIMIT_FSIZE]; - _param[MAXRAMSIZE] = jobInfo.submit.rLimits[LSF_RLIMIT_SWAP]; - _param[MAXWALLTIME] = jobInfo.submit.rLimits[LSF_RLIMIT_RUN]; - _param[MODIFICATIONTIME] = jobInfo.lastEvent; - _param[NAME] = jobInfo.jName; - _param[NBPROC] = jobInfo.submit.numProcessors; - _param[PID] = jobInfo.jobPid; - _param[QUEUE] = jobInfo.submit.queue; - _param[QUEUEDTIME] = jobInfo.submitTime; - // _param[SERVER] = jobInfo.; - _param[STARTTIME] = jobInfo.startTime; - _param[TEXT] = jobInfo.numReasons ? lsb_pendreason(jobInfo.numReasons, - jobInfo.reasonTb, - p_jInfoHead, - p_ld,0) : ""; - // _param[TMPDIR] = jobInfo.; - _param[USEDCPUTIME] = static_cast(jobInfo.cpuTime); - // _param[USEDDISKSIZE] = jobInfo.; - _param[USEDRAMSIZE] = jobInfo.runRusage.mem; - _param[USEDWALLTIME] = jobInfo.duration * 60L; - _param[USER] = jobInfo.user; - - - ostringstream oss; - int jobid = jobInfo.jobId; - oss << jobid; - _param[ID] = oss.str(); - - - string hosts, sep; - for(int i=0; i < jobInfo.numExHosts; i++, sep="+") { - hosts += jobInfo.exHosts[i]; - hosts += sep; - } - _param[EXECUTIONHOST] = hosts; - - ostringstream status; - - if (IS_PEND(jobInfo.status)) - status << " Job is pending;"; - if (IS_START(jobInfo.status)) - status << " Job is started;"; - if (IS_FINISH(jobInfo.status)) - status << " Job is finished;"; - if (IS_SUSP(jobInfo.status)) - status << " Job is suspended;"; - if (IS_POST_DONE(jobInfo.status)) - status << " Job is post-done;"; - if (IS_POST_ERR(jobInfo.status)) - status << " Job is post-error;"; - - _param[STATE] = status.str(); - _running = IS_FINISH(jobInfo.status) ? false : true; - - - if (strlen(jobInfo.submit.inFile)) - _param[INFILE] += Couple(jobInfo.submit.inFile, "stdin"); - if (strlen(jobInfo.submit.outFile)) - _param[OUTFILE] += Couple(jobInfo.submit.outFile, "stdout"); - if (strlen(jobInfo.submit.errFile)) - _param[OUTFILE] += Couple(jobInfo.submit.errFile, "stderr"); - - for(int i=0; i < jobInfo.submit.nxf; i++) { - switch (jobInfo.submit.xf[i].options) { - case XF_OP_SUB2EXEC: - _param[INFILE] += Couple(jobInfo.submit.xf[i].subFn, jobInfo.submit.xf[i].execFn); - break; - - case XF_OP_EXEC2SUB: - _param[OUTFILE] += Couple(jobInfo.submit.xf[i].subFn, jobInfo.submit.xf[i].execFn); - break; - - default: - break; - } - } - - - lsb_closejobinfo(); - delete p_ld; - } - - - - // Teste si un job est present en machine - bool JobInfo_LSF::isRunning() const - { - return _running; - } - - - // Destructeur - JobInfo_LSF::~JobInfo_LSF() - { - // Nothing to do - } - - - - // Convertit une date HH:MM:SS en secondes - long JobInfo_LSF::HMStoLong(const string & s) - { - long hour, min, sec; - - sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec); - return ( ( ( hour * 60L ) + min ) * 60L ) + sec; - } - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string JobInfo_LSF::__str__() const - { - ostringstream sst; - sst << " -#include -} -#include -#include "Batch_RunTimeException.hxx" -#include "Batch_JobInfo.hxx" - -namespace Batch { - - class JobInfo_LSF : public JobInfo - { - public: - // Constructeurs et destructeur - JobInfo_LSF() : _running(false) {}; - JobInfo_LSF(int id); - virtual ~JobInfo_LSF(); - - // Constructeur par recopie - JobInfo_LSF(const JobInfo_LSF & jinfo) : JobInfo(jinfo) {}; - - // Teste si un job est present en machine - virtual bool isRunning() const; - - // Methodes pour l'interfacage avec Python (SWIG) - // TODO : supprimer ces methodes et transferer leur definitions dans SWIG - std::string __str__() const; // SWIG : affichage en Python - std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python - - protected: - bool _running; // etat du job en machine - - private: - // Convertit une date HH:MM:SS en secondes - long HMStoLong(const std::string &); - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobInfo_Local.cxx b/src/Batch/Batch_JobInfo_Local.cxx deleted file mode 100644 index da7a32ca4..000000000 --- a/src/Batch/Batch_JobInfo_Local.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * JobInfo_Local.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 21 09:42:06 2003 - * Projet : Salome 2 - * - */ - -#include -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_JobInfo_Local.hxx" - -namespace Batch { - - // Constructeurs - JobInfo_Local::JobInfo_Local(const Parametre & param, const Environnement & env) : - JobInfo(param, env) - { - // Nothing to do - } - - - // Destructeur - JobInfo_Local::~JobInfo_Local() - { - // Nothing to do - } - - -} diff --git a/src/Batch/Batch_JobInfo_Local.hxx b/src/Batch/Batch_JobInfo_Local.hxx deleted file mode 100644 index ed325b4e8..000000000 --- a/src/Batch/Batch_JobInfo_Local.hxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * JobInfo_Local.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 21 09:42:05 2003 - * Projet : Salome 2 - * - */ - -#ifndef _JOBINFO_LOCAL_H_ -#define _JOBINFO_LOCAL_H_ - -#include -#include "Batch_JobInfo.hxx" - -namespace Batch { - - class JobInfo_Local : public JobInfo - { - public: - // Constructeurs et destructeur - JobInfo_Local() {}; - JobInfo_Local(const Parametre & param, const Environnement & env); - virtual ~JobInfo_Local(); - - // Constructeur par recopie - JobInfo_Local(const JobInfo_Local & jinfo) : JobInfo(jinfo) {}; - - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobInfo_PBS.cxx b/src/Batch/Batch_JobInfo_PBS.cxx deleted file mode 100644 index 3a474fc69..000000000 --- a/src/Batch/Batch_JobInfo_PBS.cxx +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * JobInfo_PBS.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 21 09:42:06 2003 - * Projet : Salome 2 - * - */ - -#include -#include -//#include "MEDMEM_STRING.hxx" -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_RunTimeException.hxx" -#include "Batch_JobInfo_PBS.hxx" -using namespace std; - -namespace Batch { - - // Constructeurs - JobInfo_PBS::JobInfo_PBS(struct batch_status * list, bool tobedeleted) : JobInfo() - { - // On ne considere que le premier element de la liste - // Si tout est OK, la liste ne devrait contenir qu'un element - // Sinon on leve une exception. - struct batch_status * p_job = list; - int i; - for(i=0; p_job; p_job = p_job->next) i++; - if (i == 0) throw RunTimeException("Liste vide (le job est absent de la file)"); - if (i > 1) { - //MEDMEM::STRING sst; - ostringstream sst; - sst << "JobInfo_PBS::JobInfo_PBS(struct batch_status * list, bool tobedeleted) : la liste contient " - << i << " elements" << " (1 seul requis)" << endl; - throw RunTimeException(sst.str()); - } - p_job = list; - - // On remplit les membres _param et _env - - if (p_job->name && strlen(p_job->name)) _param[ID] = p_job->name; - if (p_job->text && strlen(p_job->text)) _param[TEXT] = p_job->text; - - for(struct attrl * p_attr = p_job->attribs; p_attr; p_attr = p_attr->next) { - - string name, res, value; - if (p_attr->name && strlen(p_attr->name)) name = p_attr->name; - if (p_attr->resource && strlen(p_attr->resource)) res = p_attr->resource; - if (p_attr->value && strlen(p_attr->value)) value = p_attr->value; - - if (name == ATTR_N) { - _param[NAME] = value; - - } else if (name == ATTR_owner) { - _param[USER] = value; - - } else if (name == ATTR_state) { - _param[STATE] = value; - - } else if (name == ATTR_queue) { - _param[QUEUE] = value; - - } else if (name == ATTR_A) { - _param[ACCOUNT] = value; - - } else if (name == ATTR_M) { - _param[MAIL] = value; - - } else if (name == ATTR_c) { - if (!strcmp(value.c_str(), CHECKPOINT_UNSPECIFIED)) _param[CHECKPOINT] = 1L; - else _param[CHECKPOINT] = 0L; - - } else if (name == ATTR_h) { - if (!strcmp(value.c_str(), NO_HOLD)) _param[HOLD] = 0L; - else _param[HOLD] = 1L; - - } else if (name == ATTR_ctime) { - _param[CREATIONTIME] = atol(value.c_str()); - - } else if (name == ATTR_etime) { - _param[ELIGIBLETIME] = atol(value.c_str()); - - } else if (name == ATTR_mtime) { - _param[MODIFICATIONTIME] = atol(value.c_str()); - - } else if (name == ATTR_qtime) { - _param[QUEUEDTIME] = atol(value.c_str()); - - } else if (name == ATTR_exechost) { - _param[EXECUTIONHOST] = value; - - } else if (name == ATTR_session) { - _param[PID] = atol(value.c_str()); - - } else if (name == ATTR_euser) { - _param[EUSER] = value; - - } else if (name == ATTR_egroup) { - _param[EGROUP] = value; - - } else if (name == ATTR_l) { - if (res == "cput") { - _param[MAXCPUTIME] = HMStoLong(value); - - } else if (res == "walltime") { - _param[MAXWALLTIME] = HMStoLong(value); - - } - - } else if (name == ATTR_used) { - if (res == "cput") { - _param[USEDCPUTIME] = HMStoLong(value); - - } else if (res == "walltime") { - _param[USEDWALLTIME] = HMStoLong(value); - - } - - } else if (name == ATTR_v) { - int deb = 0; - int pos = 0; - bool ok = true; - - while (ok) { - pos = value.find(",", deb); - string sub = value.substr(deb, pos-deb); - deb = pos + 1; - if (pos < 0) ok = false; - - int eq = sub.find("="); - _env[sub.substr(0, eq)] = sub.substr(eq+1); - } - - } - } - - - if (tobedeleted) pbs_statfree(list); - } - - // Destructeur - JobInfo_PBS::~JobInfo_PBS() - { - // Nothing to do - } - - // Convertit une date HH:MM:SS en secondes - long JobInfo_PBS::HMStoLong(const string & s) - { - long hour, min, sec; - - sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec); - return ( ( ( hour * 60L ) + min ) * 60L ) + sec; - } - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string JobInfo_PBS::__str__() const - { - //MEDMEM::STRING sst; - ostringstream sst; - sst << " -#include -} -#include -#include "Batch_RunTimeException.hxx" -#include "Batch_JobInfo.hxx" - -namespace Batch { - - class JobInfo_PBS : public JobInfo - { - public: - // Constructeurs et destructeur - JobInfo_PBS() : JobInfo() {}; - JobInfo_PBS(struct batch_status * stat_list, bool tobedeleted = false); - virtual ~JobInfo_PBS(); - - // Constructeur par recopie - JobInfo_PBS(const JobInfo_PBS & jinfo) : JobInfo(jinfo) {}; - - // Methodes pour l'interfacage avec Python (SWIG) - // TODO : supprimer ces methodes et transferer leur definitions dans SWIG - std::string __str__() const; // SWIG : affichage en Python - std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python - - protected: - - private: - // Convertit une date HH:MM:SS en secondes - long HMStoLong(const std::string &); - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobInfo_eLSF.cxx b/src/Batch/Batch_JobInfo_eLSF.cxx deleted file mode 100644 index 6f6f06312..000000000 --- a/src/Batch/Batch_JobInfo_eLSF.cxx +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * JobInfo_eLSF.cxx : emulation of LSF client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#include -#include -#include -#include -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_RunTimeException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_JobInfo_eLSF.hxx" - -using namespace std; - -namespace Batch { - - - - // Constructeurs - JobInfo_eLSF::JobInfo_eLSF(int id, string logFile) : JobInfo() - { - // On remplit les membres _param et _env - ostringstream oss; - oss << id; - _param[ID] = oss.str(); - - // read status of job in log file - char line[128]; - ifstream fp(logFile.c_str(),ios::in); - fp.getline(line,80,'\n'); - - string sjobid, username, status; - fp >> sjobid; - fp >> username; - fp >> status; - - _param[STATE] = status; - - if( status.find("RUN") != string::npos) - _running = true; - - } - - // Teste si un job est present en machine - bool JobInfo_eLSF::isRunning() const - { - return _running; - } - - - // Destructeur - JobInfo_eLSF::~JobInfo_eLSF() - { - // Nothing to do - } - - // Convertit une date HH:MM:SS en secondes - long JobInfo_eLSF::HMStoLong(const string & s) - { - long hour, min, sec; - - sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec); - return ( ( ( hour * 60L ) + min ) * 60L ) + sec; - } - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string JobInfo_eLSF::__str__() const - { - ostringstream sst; - sst << " - -namespace Batch { - - class JobInfo_eLSF : public JobInfo - { - public: - // Constructeurs et destructeur - JobInfo_eLSF() : _running(false) {}; - JobInfo_eLSF(int id,std::string logFile); - virtual ~JobInfo_eLSF(); - - // Constructeur par recopie - JobInfo_eLSF(const JobInfo_eLSF & jinfo) : JobInfo(jinfo) {}; - - // Teste si un job est present en machine - virtual bool isRunning() const; - - // Methodes pour l'interfacage avec Python (SWIG) - // TODO : supprimer ces methodes et transferer leur definitions dans SWIG - std::string __str__() const; // SWIG : affichage en Python - std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python - - protected: - bool _running; // etat du job en machine - - private: - // Convertit une date HH:MM:SS en secondes - long HMStoLong(const std::string &); - - }; - -} - -#endif diff --git a/src/Batch/Batch_JobInfo_ePBS.cxx b/src/Batch/Batch_JobInfo_ePBS.cxx deleted file mode 100644 index b8cd1e888..000000000 --- a/src/Batch/Batch_JobInfo_ePBS.cxx +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * JobInfo_ePBS.cxx : emulation of PBS client - * - * Auteur : Bernard SECHER - CEA DEN - * Mail : mailto:bernard.secher@cea.fr - * Date : Thu Apr 24 10:17:22 2008 - * Projet : PAL Salome - * - */ - -#include -#include -#include -#include -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_RunTimeException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_JobInfo_ePBS.hxx" - -using namespace std; - -namespace Batch { - - - - // Constructeurs - JobInfo_ePBS::JobInfo_ePBS(int id, string logFile) : JobInfo() - { - // On remplit les membres _param et _env - ostringstream oss; - oss << id; - _param[ID] = oss.str(); - - // read of log file - char line[128]; - ifstream fp(logFile.c_str(),ios::in); - - string status; - string sline; - int pos = string::npos; - while( (pos == string::npos) && fp.getline(line,80,'\n') ){ - sline = string(line); - pos = sline.find("job_state"); - }; - - if(pos!=string::npos){ - istringstream iss(sline); - iss >> status; - iss >> status; - iss >> status; - } - else - status = "U"; - - _param[STATE] = status; - - if( status.find("R") != string::npos) - _running = true; - - } - - // Teste si un job est present en machine - bool JobInfo_ePBS::isRunning() const - { - return _running; - } - - - // Destructeur - JobInfo_ePBS::~JobInfo_ePBS() - { - // Nothing to do - } - - // Convertit une date HH:MM:SS en secondes - long JobInfo_ePBS::HMStoLong(const string & s) - { - long hour, min, sec; - - sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec); - return ( ( ( hour * 60L ) + min ) * 60L ) + sec; - } - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string JobInfo_ePBS::__str__() const - { - ostringstream sst; - sst << " -#include -#include -#include -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_RunTimeException.hxx" -#include "Batch_APIInternalFailureException.hxx" -#include "Batch_JobInfo_eSGE.hxx" - -using namespace std; - -namespace Batch { - - - - // Constructeurs - JobInfo_eSGE::JobInfo_eSGE(int id, string logFile) : JobInfo() - { - // On remplit les membres _param et _env - ostringstream oss; - oss << id; - _param[ID] = oss.str(); - - // read of log file - char line[128]; - ifstream fp(logFile.c_str(),ios::in); - - string status; - string sline; - fp.getline(line,80,'\n'); - sline = string(line); - - if( sline.length() > 0 ){ - istringstream iss(sline); - iss >> status >> status >> status >> status >> status; - } - else - status = "e"; - - _param[STATE] = status; - - if( status.find("r") != string::npos) - _running = true; - - } - - // Teste si un job est present en machine - bool JobInfo_eSGE::isRunning() const - { - return _running; - } - - - // Destructeur - JobInfo_eSGE::~JobInfo_eSGE() - { - // Nothing to do - } - - // Convertit une date HH:MM:SS en secondes - long JobInfo_eSGE::HMStoLong(const string & s) - { - long hour, min, sec; - - sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec); - return ( ( ( hour * 60L ) + min ) * 60L ) + sec; - } - - // Methode pour l'interfacage avec Python (SWIG) : affichage en Python - string JobInfo_eSGE::__str__() const - { - ostringstream sst; - sst << " -#include -#include -#include -#include -#include "Batch_Job_LSF.hxx" - -using namespace std; - -namespace Batch { - - - // Constructeur - Job_LSF::Job_LSF(const Job & job) : _p_submit(0) - { - Parametre P = job.getParametre(); - _p_submit = ParametreToSubmitStruct(P); - } - - - // Destructeur - Job_LSF::~Job_LSF() - { - if (_p_submit) { - if (_p_submit->jobName) delete [] _p_submit->jobName; - if (_p_submit->queue) delete [] _p_submit->queue; - if (_p_submit->askedHosts) { - delete [] *(_p_submit->askedHosts); - delete [] _p_submit->askedHosts; - } - if (_p_submit->resReq) delete [] _p_submit->resReq; - if (_p_submit->hostSpec) delete [] _p_submit->hostSpec; - if (_p_submit->dependCond) delete [] _p_submit->dependCond; - if (_p_submit->timeEvent) delete [] _p_submit->timeEvent; - if (_p_submit->inFile) delete [] _p_submit->inFile; - if (_p_submit->outFile) delete [] _p_submit->outFile; - if (_p_submit->errFile) delete [] _p_submit->errFile; - if (_p_submit->command) delete [] _p_submit->command; - if (_p_submit->newCommand) delete [] _p_submit->newCommand; - if (_p_submit->chkpntDir) delete [] _p_submit->chkpntDir; - if (_p_submit->xf) delete [] _p_submit->xf; - if (_p_submit->preExecCmd) delete [] _p_submit->preExecCmd; - if (_p_submit->mailUser) delete [] _p_submit->mailUser; - if (_p_submit->projectName) delete [] _p_submit->projectName; - if (_p_submit->loginShell) delete [] _p_submit->loginShell; - if (_p_submit->exceptList) delete [] _p_submit->exceptList; - delete _p_submit; - } - } - - - // Accesseur - struct submit * Job_LSF::getSubmitStruct() - { - return _p_submit; - } - - - char * Job_LSF::string2char(const string & s) - { - char * ch = new char [s.size() + 1]; - memset(ch, 0, s.size() + 1); - strncat(ch, s.c_str(), s.size()); - return ch; - } - - - struct submit * Job_LSF::ParametreToSubmitStruct(const Parametre & P) - { - if (! _p_submit) _p_submit = new struct submit; - - memset( (void *) _p_submit, 0, sizeof(struct submit)); - - struct submit & sub = * _p_submit; - sub.options = 0; - sub.options2 = 0; - - sub.beginTime = 0; // job can run as soon as possible (default) - sub.termTime = 0; // job can run as long as it wishes (default) - - sub.numProcessors = 1; // job can run on one single processor (default) - sub.maxNumProcessors = 1; // job can run on one single processor (default) - - for(int i = 0; i< LSF_RLIM_NLIMITS; i++) sub.rLimits[i] = DEFAULT_RLIMIT; - - typedef std::vector< struct xFile > XFTAB; - XFTAB xf_tab; - - string st_second; - for(Parametre::const_iterator it = P.begin(); it != P.end(); it++) { - if ( (*it).first == ACCOUNT ) { - sub.options |= SUB_PROJECT_NAME; - st_second = (*it).second.str(); - sub.projectName = string2char(st_second); - - } else if ( (*it).first == CHECKPOINT ) { - if (static_cast< long >((*it).second)) - sub.options |= SUB_CHKPNT_PERIOD; - else - sub.options &= ~ SUB_CHKPNT_PERIOD; - - } else if ( (*it).first == CKPTINTERVAL ) { - sub.chkpntPeriod = static_cast< long >((*it).second); - - } else if ( (*it).first == EXECUTABLE ) { - st_second = (*it).second.str(); - sub.command = string2char(st_second); - - } else if ( (*it).first == EXECUTIONHOST ) { - sub.options |= SUB_HOST; - if (! sub.numAskedHosts) { - sub.numAskedHosts = 1; - sub.askedHosts = new char* [1]; - } - st_second = (*it).second.str(); - sub.askedHosts[0] = string2char(st_second); - - } else if ( (*it).first == HOLD ) { - if (static_cast< long >((*it).second)) - sub.options2 |= SUB2_HOLD; - else - sub.options2 &= ~ SUB2_HOLD; - - } else if ( (*it).first == INFILE ) { - Versatile V = (*it).second; - Versatile::iterator Vit; - - for(Vit=V.begin(); Vit!=V.end(); Vit++) { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple cp = cpt; - string local = cp.getLocal(); - string remote = cp.getRemote(); - - // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur - if (remote == "stdin"){ - sub.options |= SUB_IN_FILE; - sub.inFile = string2char(local); - - } else { - struct xFile xf; - strncpy(xf.subFn, local.c_str(), MAXFILENAMELEN - 1); xf.subFn[MAXFILENAMELEN - 1] = 0; - strncpy(xf.execFn, remote.c_str(), MAXFILENAMELEN - 1); xf.execFn[MAXFILENAMELEN - 1] = 0; - xf.options = XF_OP_SUB2EXEC; - xf_tab.push_back(xf); - } - } - - } else if ( (*it).first == MAIL ) { - sub.options |= SUB_MAIL_USER; - st_second = (*it).second.str(); - sub.mailUser = string2char(st_second); - - } else if ( (*it).first == MAXCPUTIME ) { - sub.rLimits[LSF_RLIMIT_CPU] = static_cast< long >((*it).second); - - } else if ( (*it).first == MAXDISKSIZE ) { - sub.rLimits[LSF_RLIMIT_FSIZE] = static_cast< long >((*it).second); - - } else if ( (*it).first == MAXRAMSIZE ) { - sub.rLimits[LSF_RLIMIT_SWAP] = static_cast< long >((*it).second); - - } else if ( (*it).first == MAXWALLTIME ) { - sub.rLimits[LSF_RLIMIT_RUN] = static_cast< long >((*it).second); - - } else if ( (*it).first == NAME ) { - sub.options |= SUB_JOB_NAME; - st_second = (*it).second.str(); - sub.jobName = string2char(st_second); - - } else if ( (*it).first == NBPROC ) { - sub.numProcessors = static_cast< long >((*it).second); - sub.maxNumProcessors = static_cast< long >((*it).second); - - } else if ( (*it).first == OUTFILE ) { - Versatile V = (*it).second; - Versatile::iterator Vit; - - for(Vit=V.begin(); Vit!=V.end(); Vit++) { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple cp = cpt; - string local = cp.getLocal(); - string remote = cp.getRemote(); - - // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur - if (remote == "stdout"){ - sub.options |= SUB_OUT_FILE; - sub.outFile = string2char(local); - - } else if (remote == "stderr"){ - sub.options |= SUB_ERR_FILE; - sub.errFile = string2char(local); - - } else { - struct xFile xf; - strncpy(xf.subFn, local.c_str(), MAXFILENAMELEN - 1); xf.subFn[MAXFILENAMELEN - 1] = 0; - strncpy(xf.execFn, remote.c_str(), MAXFILENAMELEN - 1); xf.execFn[MAXFILENAMELEN - 1] = 0; - xf.options = XF_OP_EXEC2SUB; - xf_tab.push_back(xf); - } - } - - - } else if ( (*it).first == QUEUE ) { - sub.options |= SUB_QUEUE; - st_second = (*it).second.str(); - sub.queue = string2char(st_second); - - } else if ( (*it).first == STARTTIME ) { - sub.beginTime = static_cast< long >((*it).second); - - } else if ( (*it).first == TMPDIR ) { - // TODO - - } else if ( (*it).first == USER ) { - // TODO - - } - } - - - // Transfert de fichiers en entree et sortie - sub.options |= SUB_OTHER_FILES; - sub.nxf = xf_tab.size(); - sub.xf = new struct xFile [sub.nxf]; - int ixf = 0; - for(XFTAB::const_iterator it_xf=xf_tab.begin(); it_xf != xf_tab.end(); it_xf++, ixf++) - sub.xf[ixf] = *it_xf; // *it_xf == xf_tab[ixf] - - - return _p_submit; - } - -} diff --git a/src/Batch/Batch_Job_LSF.hxx b/src/Batch/Batch_Job_LSF.hxx deleted file mode 100644 index 8db076685..000000000 --- a/src/Batch/Batch_Job_LSF.hxx +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Job_LSF.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#ifndef _JOB_LSF_H_ -#define _JOB_LSF_H_ - -extern "C" { - -#include -#include -} -#include -#include "Batch_Job.hxx" - -namespace Batch { - - class Job_LSF - { - public: - // Constructeur et destructeur - Job_LSF(const Job & job); - virtual ~Job_LSF(); - - // Accesseurs - struct submit * getSubmitStruct(); - - protected: - struct submit * _p_submit; // structure pour soumettre les jobs - - private: - struct submit * ParametreToSubmitStruct(const Parametre & P); - char * string2char(const std::string &); - }; - -} - -#endif diff --git a/src/Batch/Batch_Job_Local.cxx b/src/Batch/Batch_Job_Local.cxx deleted file mode 100644 index 3fa1062d1..000000000 --- a/src/Batch/Batch_Job_Local.cxx +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Job_Local.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#include -#include -#ifndef WIN32 -#include -#endif -#include "Batch_Job_Local.hxx" - -using namespace std; - -namespace Batch { - - // Constructeur - Job_Local::Job_Local(const Job & job) : - _command(), _param(job.getParametre()), _env(job.getEnvironnement()) - { - // On positionne le nom du EXECUTIONHOST a "localhost" s'il n'est pas precise - if ( _param.find(EXECUTIONHOST) == _param.end() ) { - _param[EXECUTIONHOST] = "localhost"; - } - - // On convertit les objets Parametre et Environnement en liste chainee d'attributs + operateur - addEnvironnement( _env ); - addParametre ( _param ); - - } - - - // Destructeur - Job_Local::~Job_Local() - { - } - - - void Job_Local::addParametre(const Parametre & P) - { - // En dernier, on ajoute le chemin complet de la commande - _command += P[EXECUTABLE].str(); - } - - - void Job_Local::addEnvironnement(const Environnement & E) - { - for(Environnement::const_iterator it=E.begin(); it != E.end(); it++) { - string variable = (*it).first; - string value = (*it).second; - - // On remplace toutes les occurences de single-quote par backslash-single-quote - for(int pos=0; pos < value.size(); pos++) { - pos = value.find("'", pos); - if ( (pos < 0) || (pos > value.size()) ) break; - value.replace(pos, 1, "\'"); - } - _command += variable + "='" + value + "' "; - } - } - - string Job_Local::getCommand(void) const { - return _command; - } - - - // Retourne l'objet Parametre - Parametre Job_Local::getParametre() const - { - return _param; - } - - // Retourne l'objet Environnement - Environnement Job_Local::getEnvironnement() const - { - return _env; - } - - -} diff --git a/src/Batch/Batch_Job_Local.hxx b/src/Batch/Batch_Job_Local.hxx deleted file mode 100644 index 30e8ffde8..000000000 --- a/src/Batch/Batch_Job_Local.hxx +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Job_Local.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#ifndef _JOB_LOCAL_H_ -#define _JOB_LOCAL_H_ - -#include "Batch_Parametre.hxx" -#include "Batch_Environnement.hxx" -#include "Batch_Job.hxx" - -namespace Batch { - - class Job_Local - { - public: - // Constructeur et destructeur - Job_Local(const Job & job); - virtual ~Job_Local(); - - // Retourne la commande _command - virtual std::string getCommand(void) const; - - // Retourne l'objet Parametre - virtual Parametre getParametre() const; - - // Retourne l'objet Environnement - virtual Environnement getEnvironnement() const; - - - protected: - std::string _command; - Parametre _param; - Environnement _env; - - private: - void addParametre(const Parametre & P); - void addEnvironnement(const Environnement & E); - - }; - -} - -#endif diff --git a/src/Batch/Batch_Job_PBS.cxx b/src/Batch/Batch_Job_PBS.cxx deleted file mode 100644 index cb4369731..000000000 --- a/src/Batch/Batch_Job_PBS.cxx +++ /dev/null @@ -1,472 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Job_PBS.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#include -#include -#include -#include "Batch_Job_PBS.hxx" -using namespace std; - -namespace Batch { - - // Ajoute un element (name,resource,value) a la liste chainee d'attributs + operateur - void Job_PBS::setResourceAttributeOP(struct attropl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value) - { - // L'element (name,resource,value) existe-t-il deja ? si oui ptr != 0 - struct attropl * ptr = findResourceAttributeOP(*attr_list, attr_name, attr_resource); - - if (!ptr) { // L'element n'existe pas, il faut le creer - if (ptr = lastAttributeOP(*attr_list)) { // la liste n'est pas vide - ptr->next = new struct attropl; - ptr = ptr->next; - ptr->next = 0; - - } else { // la liste est completement vide - ptr = *attr_list = new struct attropl; - ptr->next = 0; - } - - // On remplit les champs (name,resource,value) - ptr->name = new char[strlen(attr_name) + 1]; - strncpy(ptr->name, attr_name, strlen(attr_name)); - ptr->name[strlen(attr_name)] = 0; - - ptr->resource = new char[strlen(attr_resource) + 1]; - strncpy(ptr->resource, attr_resource, strlen(attr_resource)); - ptr->resource[strlen(attr_resource)] = 0; - - ptr->value = new char[strlen(attr_value) + 1]; - strncpy(ptr->value, attr_value, strlen(attr_value)); - ptr->value[strlen(attr_value)] = 0; - - } else { // L'attribut existe, on change sa valeur - delete[] ptr->value; // On efface la valeur precedente - ptr->value = new char[strlen(attr_value) + 1]; - strncpy(ptr->value, attr_value, strlen(attr_value)); - ptr->value[strlen(attr_value)] = 0; - - } - } - - - // Recherche un element (name,resource,value) dans la liste chainee d'attributs + operateur - struct attropl * Job_PBS::findResourceAttributeOP(struct attropl * attr_list, const char * attr_name, const char * attr_resource) - { - // On parcoure la liste chainee pour trouver l'element dont les champs name et resource coincident - struct attropl * ptr = attr_list; - while (ptr) { - if (!strcmp(ptr->name, attr_name) && !strcmp(ptr->resource, attr_resource)) break; - ptr = ptr->next; - } - return ptr; - } - - - // Recherche le dernier element de la liste chainee d'attributs + operateur - struct attropl * Job_PBS::lastAttributeOP(struct attropl * attr_list) - { - struct attropl * ptr = attr_list; - while (ptr && ptr->next) { - ptr = ptr->next; - } - return ptr; - } - - - // Convertit un objet Parametre en liste chainee d'attributs + operateur - struct attropl * Job_PBS::ParametreToAttributeOPList(struct attropl ** _p_attr_list, Parametre & P) - { - Parametre::iterator it; - string st_second; - for(it=P.begin(); it!=P.end(); it++) { - if ( (*it).first == ACCOUNT ) { - st_second = (*it).second.str(); - setResourceAttributeOP(_p_attr_list, ATTR_A, "", st_second.c_str()); - - - } else if ( (*it).first == CHECKPOINT ) { - setResourceAttributeOP(_p_attr_list, ATTR_c, "", "u"); - - - } else if ( (*it).first == CKPTINTERVAL ) { - // Not significant - - } else if ( (*it).first == EXECUTABLE ) { - // Already done - - } else if ( (*it).first == HOLD ) { - if (static_cast< long >((*it).second)) - setResourceAttributeOP(_p_attr_list, ATTR_h, "", USER_HOLD); - else - setResourceAttributeOP(_p_attr_list, ATTR_h, "", NO_HOLD); - - } else if ( (*it).first == INFILE ) { - Versatile V = (*it).second; - Versatile::iterator Vit; - - string sep = ""; - string stagein; - - for(Vit=V.begin(); Vit!=V.end(); Vit++, sep=",") { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple cp = cpt; - string local = cp.getLocal(); - string remote = cp.getRemote(); - - // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur - stagein += sep + remote + "@" + local; - } - - if (stagein.size()) - setResourceAttributeOP(_p_attr_list, ATTR_stagein, "", stagein.c_str()); - - - } else if ( (*it).first == MAIL ) { - st_second = (*it).second.str(); - setResourceAttributeOP(_p_attr_list, ATTR_M, "", st_second.c_str()); - - } else if ( (*it).first == MAXCPUTIME ) { - char attr_value[32]; - long secondes = (*it).second; - long heures = secondes / 3600L; - long minutes = (secondes - 3600L * heures) / 60L; - secondes = secondes % 60L; - sprintf(attr_value, "%02ld:%02ld:%02ld", heures, minutes, secondes); - - setResourceAttributeOP(_p_attr_list, ATTR_l, "cput", attr_value); - - - } else if ( (*it).first == MAXDISKSIZE ) { - - } else if ( (*it).first == MAXRAMSIZE ) { - - } else if ( (*it).first == MAXWALLTIME ) { - char attr_value[32]; - long secondes = (*it).second; - long heures = secondes / 3600L; - long minutes = (secondes - 3600L * heures) / 60L; - secondes = secondes % 60L; - sprintf(attr_value, "%02ld:%02ld:%02ld", heures, minutes, secondes); - - setResourceAttributeOP(_p_attr_list, ATTR_l, "walltime", attr_value); - - - } else if ( (*it).first == NAME ) { - st_second = (*it).second.str(); - setResourceAttributeOP(_p_attr_list, ATTR_N, "", st_second.c_str()); - - - } else if ( (*it).first == OUTFILE ) { - Versatile V = (*it).second; - Versatile::iterator Vit; - - string sep = ""; - string stageout; - - for(Vit=V.begin(); Vit!=V.end(); Vit++, sep=",") { - CoupleType cpt = *static_cast< CoupleType * >(*Vit); - Couple cp = cpt; - string local = cp.getLocal(); - string remote = cp.getRemote(); - - if (remote == "stdout") - setResourceAttributeOP(_p_attr_list, ATTR_o, "", local.c_str()); - - else if (remote == "stderr") - setResourceAttributeOP(_p_attr_list, ATTR_e, "", local.c_str()); - - else - // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur - stageout += sep + remote + "@" + local; - } - - if (stageout.size()) - setResourceAttributeOP(_p_attr_list, ATTR_stageout, "", stageout.c_str()); - - } else if ( (*it).first == QUEUE ) { - // Already done - - } else if ( (*it).first == STARTTIME ) { - - } else if ( (*it).first == TMPDIR ) { - - } else if ( (*it).first == USER ) { - st_second = (*it).second.str(); - setResourceAttributeOP(_p_attr_list, ATTR_u, "", st_second.c_str()); - - } - } - return *_p_attr_list; - } - - - // Convertit un objet Environnement en liste chainee d'attributs + operateur - struct attropl * Job_PBS::EnvironnementToAttributeOPList(struct attropl ** _p_attr_list, Environnement & E) - { - Environnement::iterator it; - for(it=E.begin(); it!=E.end(); it++) { - setResourceAttributeOP(_p_attr_list, ATTR_v, (*it).first.c_str(), ( (*it).first + "=" + (*it).second ).c_str()); - } - return *_p_attr_list; - } - - - // Ajoute les variables d'environnement presentes dans tout job PBS - void Job_PBS::addPBSEnvironnement(Environnement & E) - { - char * c; - - c = getenv("HOME"); - if (c) E["PBS_O_HOME"] = c; - - c = getenv("LANG"); - if (c) E["PBS_O_LANG"] = c; - - c = getenv("LOGNAME"); - if (c) E["PBS_O_LOGNAME"] = c; - - c = getenv("PATH"); - if (c) E["PBS_O_PATH"] = c; - - c = getenv("LD_LIBRARY_PATH"); - if (c) E["PBS_O_LD_LIBRARY_PATH"] = c; - - c = getenv("MAIL"); - if (c) E["PBS_O_MAIL"] = c; - - c = getenv("SHELL"); - if (c) E["PBS_O_SHELL"] = c; - - c = getenv("TZ"); - if (c) E["PBS_O_TZ"] = c; - - /* Recuperation du working directory */ - size_t size = 256; - char * buf = 0; - char * rc = 0; - do { - if (buf) delete[] buf; - buf = new char[size]; - rc = getcwd(buf, size); - size += size; - } while (!rc); - E["PBS_O_WORKDIR"] = buf; - delete[] buf; - } - - - // Ajoute un element (name,resource,value) a la liste chainee d'attributs - void Job_PBS::setResourceAttribute(struct attrl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value) - { - // L'element (name,resource,value) existe-t-il deja ? si oui ptr != 0 - struct attrl * ptr = findResourceAttribute(*attr_list, attr_name, attr_resource); - - if (!ptr) { // L'attribut n'existe pas, il faut le creer - if (ptr = lastAttribute(*attr_list)) { // la liste n'est pas vide - ptr->next = new struct attrl; - ptr = ptr->next; - ptr->next = 0; - - } else { // la liste est completement vide - ptr = *attr_list = new struct attrl; - ptr->next = 0; - } - - // On remplit les champs (name,resource,value) - ptr->name = new char[strlen(attr_name) + 1]; - strncpy(ptr->name, attr_name, strlen(attr_name)); - ptr->name[strlen(attr_name)] = 0; - - ptr->resource = new char[strlen(attr_resource) + 1]; - strncpy(ptr->resource, attr_resource, strlen(attr_resource)); - ptr->resource[strlen(attr_resource)] = 0; - - ptr->value = new char[strlen(attr_value) + 1]; - strncpy(ptr->value, attr_value, strlen(attr_value)); - ptr->value[strlen(attr_value)] = 0; - - } else { // L'attribut existe, on change sa valeur - delete[] ptr->value; // On efface la valeur precedente - ptr->value = new char[strlen(attr_value) + 1]; - strncpy(ptr->value, attr_value, strlen(attr_value)); - ptr->value[strlen(attr_value)] = 0; - - } - } - - // Recherche un element (name,resource,value) dans la liste chainee d'attributs - struct attrl * Job_PBS::findResourceAttribute(struct attrl * attr_list, const char * attr_name, const char * attr_resource) - { - // On parcoure la liste chainee pour trouver l'element dont les champs name et resource coincident - struct attrl * ptr = attr_list; - while (ptr) { - if (!strcmp(ptr->name, attr_name) && !strcmp(ptr->resource, attr_resource)) break; - ptr = ptr->next; - } - return ptr; - } - - - // Recherche le dernier element de la liste chainee d'attributs - struct attrl * Job_PBS::lastAttribute(struct attrl * attr_list) - { - struct attrl * ptr = attr_list; - while (ptr && ptr->next) { - ptr = ptr->next; - } - return ptr; - } - - - // Constructeur - Job_PBS::Job_PBS(const Job & job) : _p_attropl(0), _p_attrl(0), _script(0), _destination(0) - { - Parametre P = job.getParametre(); - Parametre::iterator it; - - // On extrait de l'objet Parametre le champ EXECUTABLE qui deviendra le script PBS - if ( (it=P.find(EXECUTABLE)) != P.end()) { - Versatile V = (*it).second; - string st_exe = V.str(); - const char * exe = st_exe.c_str(); - int lg = strlen(exe); - _script = new char[lg + 1]; - for (int ii=0; iinext; - delete[] current_p_attropl->name; - delete[] current_p_attropl->resource; - delete[] current_p_attropl->value; - delete current_p_attropl; - current_p_attropl = next; - } - - // On detruit la liste chainee d'attributs - struct attrl * current_p_attrl = _p_attrl; - while (current_p_attrl) { - struct attrl * next = current_p_attrl->next; - delete[] current_p_attrl->name; - delete[] current_p_attrl->resource; - delete[] current_p_attrl->value; - delete current_p_attrl; - current_p_attrl = next; - } - - // On detruit les champs alloues - delete[] _script; - delete[] _destination; - } - - - // Accesseur - struct attropl * Job_PBS::getAttributesOP() - { - return _p_attropl; - } - - // Accesseur - // Cette methode sert pour les pbs_alter de PBS - // Pbs_alter est buggé par rapport a la specification ers_all.ps car les - // variables d'environnement ne sont pas supportees (ATTR_v) - struct attrl * Job_PBS::getAttributes() - { - if (_p_attrl == 0) { - - // On remplit la structure attrl a partir de la strucuture attropl - // (elles ne different que par le parametre op, mais elles ne sont pas interchangeables - // dans les appels) - - struct attropl * current_p_attropl = _p_attropl; - while (current_p_attropl) { - if (strcmp(current_p_attropl->name, ATTR_v)) // Bug fix for ATTR_v - setResourceAttribute(&_p_attrl, - current_p_attropl->name, - current_p_attropl->resource, - current_p_attropl->value); - - current_p_attropl = current_p_attropl->next; - } - - } - - return _p_attrl; - } - - // Accesseur - char * Job_PBS::getScript() - { - return _script; - } - - // Accesseur - char * Job_PBS::getDestination() - { - return _destination; - } - -} diff --git a/src/Batch/Batch_Job_PBS.hxx b/src/Batch/Batch_Job_PBS.hxx deleted file mode 100644 index 8124f1c61..000000000 --- a/src/Batch/Batch_Job_PBS.hxx +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Job_PBS.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ - -#ifndef _JOB_PBS_H_ -#define _JOB_PBS_H_ - -extern "C" { - -#include -#include -} -#include "Batch_Job.hxx" - -namespace Batch { - - class Job_PBS - { - public: - // Constructeur et destructeur - Job_PBS(const Job & job); - virtual ~Job_PBS(); - - // Accesseurs - struct attropl * getAttributesOP(); - struct attrl * getAttributes(); - char * getScript(); - char * getDestination(); - - protected: - struct attropl * _p_attropl; // liste chainee d'attributs + operateur - struct attrl * _p_attrl; // liste chainee d'attributs - char * _script; // chemin d'acces au script du job - char * _destination; // queue dans laquelle le job est soumis - - private: - // Ajoute un element (name,resource,value) a la liste chainee d'attributs + operateur - void setResourceAttributeOP(struct attropl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value); - - // Recherche un element (name,resource,value) dans la liste chainee d'attributs + operateur - struct attropl * findResourceAttributeOP(struct attropl * attr_list, const char * attr_name, const char * attr_resource); - - // Recherche le dernier element de la liste chainee d'attributs + operateur - struct attropl * lastAttributeOP(struct attropl * attr_list); - - // Convertit un objet Parametre en liste chainee d'attributs + operateur - struct attropl * ParametreToAttributeOPList(struct attropl ** _p_attr_list, Parametre & param); - - // Convertit un objet Environnement en liste chainee d'attributs + operateur - struct attropl * EnvironnementToAttributeOPList(struct attropl ** _p_attr_list, Environnement & env); - - // Ajoute les variables d'environnement presentes dans tout job PBS - void addPBSEnvironnement(Environnement & E); - - - // Ajoute un element (name,resource,value) a la liste chainee d'attributs - void setResourceAttribute(struct attrl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value); - - // Recherche un element (name,resource,value) dans la liste chainee d'attributs - struct attrl * findResourceAttribute(struct attrl * attr_list, const char * attr_name, const char * attr_resource); - - // Recherche le dernier element de la liste chainee d'attributs - struct attrl * lastAttribute(struct attrl * attr_list); - - }; - -} - -#endif diff --git a/src/Batch/Batch_ListIsFullException.cxx b/src/Batch/Batch_ListIsFullException.cxx deleted file mode 100644 index 1da8c0e6d..000000000 --- a/src/Batch/Batch_ListIsFullException.cxx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * ListIsFullException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include "Batch_ListIsFullException.hxx" -using namespace std; - - -namespace Batch { - -} diff --git a/src/Batch/Batch_ListIsFullException.hxx b/src/Batch/Batch_ListIsFullException.hxx deleted file mode 100644 index bfb7ff88d..000000000 --- a/src/Batch/Batch_ListIsFullException.hxx +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * ListIsFullException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _LISTISFULLEXCEPTION_H_ -#define _LISTISFULLEXCEPTION_H_ - -#include "Batch_Defines.hxx" - -#include "Batch_GenericException.hxx" - -namespace Batch { - - class BATCH_EXPORT ListIsFullException : public GenericException - { - public: - // Constructeur - ListIsFullException(std::string ch = "undefined") : GenericException("ListIsFullException", ch) {} - }; - -} - -#endif - diff --git a/src/Batch/Batch_LongType.cxx b/src/Batch/Batch_LongType.cxx deleted file mode 100644 index 867c2bcbb..000000000 --- a/src/Batch/Batch_LongType.cxx +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * LongType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include -//#include "MEDMEM_STRING.hxx" -#include "Batch_LongType.hxx" -using namespace std; - -namespace Batch { - - // Conversion en chaine - string LongType::affiche() const - { - //MEDMEM::STRING sst; - ostringstream sst; - sst << _data; - return sst.str(); - } - - // Operateur d'affectation - LongType & LongType::operator =(long l) - { - _data = l; - return *this; - } - - // Conversion en long - LongType::operator long() const - { - return this->_data; - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * LongType::clone() const - { - LongType * pL = new LongType(this->_data); - assert(pL != 0); - return pL; - } - -} diff --git a/src/Batch/Batch_LongType.hxx b/src/Batch/Batch_LongType.hxx deleted file mode 100644 index 448035bfa..000000000 --- a/src/Batch/Batch_LongType.hxx +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * LongType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _LONGTYPE_H_ -#define _LONGTYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" - -namespace Batch { - - class BATCH_EXPORT LongType : public GenericType - { - public: - // Constructeur - LongType(const long l=0L) : _data(l) {} - - // Conversion en chaine - virtual std::string affiche() const; - - // Operateur d'affectation - virtual LongType & operator =(long); - - // Conversion en long - virtual operator long() const; - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - long _data; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_MapKey.cxx b/src/Batch/Batch_MapKey.cxx deleted file mode 100644 index 0a4d40198..000000000 --- a/src/Batch/Batch_MapKey.cxx +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * MapKey.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Oct 14 14:00:30 2003 - * Projet : Salome 2 - * - */ - -#include -#include "Batch_MapKey.hxx" -using namespace std; - -namespace Batch { - - -} - - -// COMMENTS diff --git a/src/Batch/Batch_MapKey.hxx b/src/Batch/Batch_MapKey.hxx deleted file mode 100644 index c4a7afe2a..000000000 --- a/src/Batch/Batch_MapKey.hxx +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * MapKey.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Oct 14 14:00:29 2003 - * Projet : Salome 2 - * - */ - -#ifndef _MAPKEY_H_ -#define _MAPKEY_H_ - -#include "Batch_Defines.hxx" - - -#include - -namespace Batch { - - // une classe privee pour les differents types - // ces types ne peuvent pas etre redefinis - class BATCH_EXPORT MapKey : public std::string - { - private: - friend class Parametre; // seule la classe Parametre peut creer des MapKey - MapKey() : std::string() {} - MapKey(const MapKey & mk, size_type pos, size_type npos) : std::string(mk, pos, npos) {} - MapKey(const char * s, size_type n) : std::string(s, n) {} - MapKey(const char * s) : std::string(s) {} - MapKey(size_type n, char c) : std::string(n, c) {} -#ifdef __STL_MEMBER_TEMPLATES - template - MapKey(InputIterator __begin, InputIterator __end) : std::string(__begin, __end) {} -#else - MapKey(const_iterator __begin, const_iterator __end) : std::string(__begin, __end) {} -#endif - - public: - MapKey(const MapKey & mk) : std::string(mk) {} - - }; - -} - -#endif - -// COMMENTS diff --git a/src/Batch/Batch_NotYetImplementedException.cxx b/src/Batch/Batch_NotYetImplementedException.cxx deleted file mode 100644 index b9ef409f9..000000000 --- a/src/Batch/Batch_NotYetImplementedException.cxx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * NotYetImplementedException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Nov 25 11:35:07 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_NotYetImplementedException.hxx" - -namespace Batch { - -} - diff --git a/src/Batch/Batch_NotYetImplementedException.hxx b/src/Batch/Batch_NotYetImplementedException.hxx deleted file mode 100644 index 2f3b8b446..000000000 --- a/src/Batch/Batch_NotYetImplementedException.hxx +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * NotYetImplementedException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Nov 25 11:35:07 2003 - * Projet : Salome 2 - * - */ - -#ifndef _NOTYETIMPLEMENTEDEXCEPTION_H_ -#define _NOTYETIMPLEMENTEDEXCEPTION_H_ - -#include "Batch_Defines.hxx" -#include "Batch_GenericException.hxx" - -#include - -namespace Batch { - - class BATCH_EXPORT NotYetImplementedException : public GenericException - { - public: - // Constructeur - NotYetImplementedException(std::string ch = "undefined") : GenericException("NotYetImplementedException", ch) {} - }; - -} - -#endif - diff --git a/src/Batch/Batch_Parametre.cxx b/src/Batch/Batch_Parametre.cxx deleted file mode 100644 index c9d35f602..000000000 --- a/src/Batch/Batch_Parametre.cxx +++ /dev/null @@ -1,295 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Parametre.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include "Batch_Versatile.hxx" -#include "Batch_InvalidKeyException.hxx" -#include "Batch_Parametre.hxx" - -using namespace std; - -// Definition des membres constants statiques -// Definition des noms globaux pour les clefs en tant que references -// TODO : supprimer les declarations statiques des clefs de la map -def_static_MapKey(ACCOUNT); -def_static_MapKey(ARGUMENTS); -def_static_MapKey(CHECKPOINT); -def_static_MapKey(CKPTINTERVAL); -def_static_MapKey(CREATIONTIME); -def_static_MapKey(EGROUP); -def_static_MapKey(ELIGIBLETIME); -def_static_MapKey(ENDTIME); -def_static_MapKey(EUSER); -def_static_MapKey(EXECUTABLE); -def_static_MapKey(EXECUTIONHOST); -def_static_MapKey(EXITCODE); -def_static_MapKey(HOLD); -def_static_MapKey(ID); -def_static_MapKey(INFILE); -def_static_MapKey(MAIL); -def_static_MapKey(MAXCPUTIME); -def_static_MapKey(MAXDISKSIZE); -def_static_MapKey(MAXRAMSIZE); -def_static_MapKey(MAXWALLTIME); -def_static_MapKey(MODIFICATIONTIME); -def_static_MapKey(NAME); -def_static_MapKey(NBPROC); -def_static_MapKey(OUTFILE); -def_static_MapKey(PID); -def_static_MapKey(QUEUE); -def_static_MapKey(QUEUEDTIME); -def_static_MapKey(SERVER); -def_static_MapKey(STARTTIME); -def_static_MapKey(STATE); -def_static_MapKey(TEXT); -def_static_MapKey(TMPDIR); -def_static_MapKey(USEDCPUTIME); -def_static_MapKey(USEDDISKSIZE); -def_static_MapKey(USEDRAMSIZE); -def_static_MapKey(USEDWALLTIME); -def_static_MapKey(USER); -def_static_MapKey(WORKDIR); -def_static_MapKey(HOMEDIR); - -namespace Batch { - - // Constructeur standard - // La map interne TypeMap possede les memes clefs que la map principale, mais les - // valeurs associees contiennent le type des clefs de la map principale ainsi que - // le nombre de valeurs autorisees dans l'objet Versatile (0=nombre quelconque, - // sinon valeur precisee) - Parametre::Parametre() : map< string, Versatile >() - { - TypeMap[ACCOUNT].type = STRING; - TypeMap[ACCOUNT].maxelem = 1; - - TypeMap[ARGUMENTS].type = STRING; - TypeMap[ARGUMENTS].maxelem = 0; - - TypeMap[CHECKPOINT].type = LONG; - TypeMap[CHECKPOINT].maxelem = 1; - - TypeMap[CKPTINTERVAL].type = LONG; - TypeMap[CKPTINTERVAL].maxelem = 1; - - TypeMap[CREATIONTIME].type = LONG; - TypeMap[CREATIONTIME].maxelem = 1; - - TypeMap[EGROUP].type = STRING; - TypeMap[EGROUP].maxelem = 1; - - TypeMap[ELIGIBLETIME].type = LONG; - TypeMap[ELIGIBLETIME].maxelem = 1; - - TypeMap[ENDTIME].type = LONG; - TypeMap[ENDTIME].maxelem = 1; - - TypeMap[EUSER].type = STRING; - TypeMap[EUSER].maxelem = 1; - - TypeMap[EXECUTABLE].type = STRING; - TypeMap[EXECUTABLE].maxelem = 1; - - TypeMap[EXECUTIONHOST].type = STRING; - TypeMap[EXECUTIONHOST].maxelem = 0; - - TypeMap[EXITCODE].type = LONG; - TypeMap[EXITCODE].maxelem = 1; - - TypeMap[HOLD].type = LONG; - TypeMap[HOLD].maxelem = 1; - - TypeMap[ID].type = STRING; - TypeMap[ID].maxelem = 1; - - TypeMap[INFILE].type = COUPLE; - TypeMap[INFILE].maxelem = 0; - - TypeMap[MAIL].type = STRING; - TypeMap[MAIL].maxelem = 1; - - TypeMap[MAXCPUTIME].type = LONG; - TypeMap[MAXCPUTIME].maxelem = 1; - - TypeMap[MAXDISKSIZE].type = LONG; - TypeMap[MAXDISKSIZE].maxelem = 1; - - TypeMap[MAXRAMSIZE].type = LONG; - TypeMap[MAXRAMSIZE].maxelem = 1; - - TypeMap[MAXWALLTIME].type = LONG; - TypeMap[MAXWALLTIME].maxelem = 1; - - TypeMap[MODIFICATIONTIME].type = LONG; - TypeMap[MODIFICATIONTIME].maxelem = 1; - - TypeMap[NAME].type = STRING; - TypeMap[NAME].maxelem = 1; - - TypeMap[NBPROC].type = LONG; - TypeMap[NBPROC].maxelem = 1; - - TypeMap[OUTFILE].type = COUPLE; - TypeMap[OUTFILE].maxelem = 0; - - TypeMap[PID].type = LONG; - TypeMap[PID].maxelem = 1; - - TypeMap[QUEUE].type = STRING; - TypeMap[QUEUE].maxelem = 1; - - TypeMap[QUEUEDTIME].type = LONG; - TypeMap[QUEUEDTIME].maxelem = 1; - - TypeMap[SERVER].type = STRING; - TypeMap[SERVER].maxelem = 1; - - TypeMap[STARTTIME].type = LONG; - TypeMap[STARTTIME].maxelem = 1; - - TypeMap[STATE].type = STRING; - TypeMap[STATE].maxelem = 1; - - TypeMap[TEXT].type = STRING; - TypeMap[TEXT].maxelem = 1; - - TypeMap[TMPDIR].type = STRING; - TypeMap[TMPDIR].maxelem = 1; - - TypeMap[USEDCPUTIME].type = LONG; - TypeMap[USEDCPUTIME].maxelem = 1; - - TypeMap[USEDDISKSIZE].type = LONG; - TypeMap[USEDDISKSIZE].maxelem = 1; - - TypeMap[USEDRAMSIZE].type = LONG; - TypeMap[USEDRAMSIZE].maxelem = 1; - - TypeMap[USEDWALLTIME].type = LONG; - TypeMap[USEDWALLTIME].maxelem = 1; - - TypeMap[USER].type = STRING; - TypeMap[USER].maxelem = 1; - - TypeMap[WORKDIR].type = STRING; - TypeMap[WORKDIR].maxelem = 1; - - TypeMap[HOMEDIR].type = STRING; - TypeMap[HOMEDIR].maxelem = 1; - } - - // Operateur de recherche dans la map - // Cet operateur agit sur les objets NON CONSTANTS, il autorise la modification de - // la valeur associée à la clef car il retourne une reference non constante - Versatile & Parametre::operator [] (const string & mk) - { - // On controle que la clef est valide - if (TypeMap.find(mk) == TypeMap.end()) throw InvalidKeyException(mk.c_str()); - - // On recherche la valeur associee... - Versatile & V = map< string, Versatile >::operator [] (mk); - - // ... et on l'initialise systematiquement - // ATTENTION : si un probleme de type survient (ie, on stocke une valeur d'un type - // different de celui inscrit dans TypeMap) une exception TypeMismatchException est - // levee - V.setName(mk); - V.setType(TypeMap[mk].type); - V.setMaxSize(TypeMap[mk].maxelem); - - return V; - } - - // Operateur de recherche dans la map - // Cet operateur agit sur les objets CONSTANTS - const Versatile & Parametre::operator [] (const string & mk) const - { - // On controle que la clef est valide - if (TypeMap.find(mk) == TypeMap.end()) throw InvalidKeyException(mk.c_str()); - - // On recherche la valeur associee - Parametre::const_iterator it = find(mk); - if (it == end()) throw InvalidKeyException(mk.c_str()); - const Versatile & V = (*it).second; - - return V; - } - - // Operateur d'affectation - Parametre & Parametre::operator =(const Parametre & PM) - { - // On ne reaffecte pas l'objet a lui-meme, sinon aie, aie, aie - if (this == &PM) return *this; - - // On efface toute la map - erase(begin(), end()); - - // On recopie la map interne - // Meme si cela ne sert a rien pour le moment car les maps internes sont identiques, - // il n'est pas exclu que dans un avenir proche elles puissent etre differentes - (*this).TypeMap = PM.TypeMap; - - // On recree la structure interne de la map avec les valeurs de celle passee en argument - Parametre::const_iterator it; - for(it=PM.begin(); it!=PM.end(); it++) - insert(make_pair( (*it).first , - Versatile( (*it).second) - ) ); - - return *this; - } - - // Constructeur par recopie - Parametre::Parametre(const Parametre & PM) - { - // inutile car l'objet est vierge : il vient d'etre cree - // On efface toute la map - // erase(begin(), end()); - - // On recopie la map interne - (*this).TypeMap = PM.TypeMap; - - // On cree la structure interne de la map avec les valeurs de celle passee en argument - Parametre::const_iterator it; - for(it=PM.begin(); - it!=PM.end(); - it++) - insert( - make_pair( - (*it).first , - Versatile( (*it).second) - ) ); - } - - // map< string, TypeParam > Parametre::getTypeMap() const - // { - // return TypeMap; - // } - -} diff --git a/src/Batch/Batch_Parametre.hxx b/src/Batch/Batch_Parametre.hxx deleted file mode 100644 index c572a73bf..000000000 --- a/src/Batch/Batch_Parametre.hxx +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Parametre.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _PARAMETRE_H_ -#define _PARAMETRE_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include "Batch_InvalidKeyException.hxx" -#include "Batch_Versatile.hxx" - -// Ces macros permettent de simplifier l'ajout de nouvelles -// clefs dans la map Parametre -// TODO : remplacer ce mecanisme statique par la lecture -// TODO : d'une descrption dans un fichier exterieur (genre XML) - -#define def_extern_MapKey(mk) extern BATCH_EXPORT const std::string & mk; -#define def_static_MapKey(mk) const std::string Batch::Parametre::mk(#mk); \ - const std::string & mk = Batch::Parametre::mk; - -namespace Batch { - - class BATCH_EXPORT Parametre : public std::map< std::string, Versatile > - { - public: - // Constructeur standard - Parametre(); - - // Constructeur par recopie - Parametre(const Parametre & PM); - - // Operateur de recherche dans la map - Versatile & operator [] (const std::string &); - const Versatile & operator [] (const std::string &) const; - - // Operateur d'affectation - Parametre & operator =(const Parametre & PM); - - // Declarations statique des clefs de la map - // TODO : supprimer les declarations statiques des clefs de la map - static const std::string ACCOUNT; - static const std::string ARGUMENTS; - static const std::string CHECKPOINT; - static const std::string CKPTINTERVAL; - static const std::string CREATIONTIME; - static const std::string EGROUP; - static const std::string ELIGIBLETIME; - static const std::string ENDTIME; - static const std::string EUSER; - static const std::string EXECUTABLE; - static const std::string EXECUTIONHOST; - static const std::string EXITCODE; - static const std::string HOLD; - static const std::string ID; - static const std::string INFILE; - static const std::string MAIL; - static const std::string MAXCPUTIME; - static const std::string MAXDISKSIZE; - static const std::string MAXRAMSIZE; - static const std::string MAXWALLTIME; - static const std::string MODIFICATIONTIME; - static const std::string NAME; - static const std::string NBPROC; - static const std::string OUTFILE; - static const std::string PID; - static const std::string QUEUE; - static const std::string QUEUEDTIME; - static const std::string SERVER; - static const std::string STARTTIME; - static const std::string STATE; - static const std::string TEXT; - static const std::string TMPDIR; - static const std::string USEDCPUTIME; - static const std::string USEDDISKSIZE; - static const std::string USEDRAMSIZE; - static const std::string USEDWALLTIME; - static const std::string USER; - static const std::string WORKDIR; - static const std::string HOMEDIR; - - protected: - std::map< std::string, TypeParam > TypeMap; // map interne servant a controler le type de la valeur associee a chaque clef - - private: - - }; - -} - -def_extern_MapKey(ACCOUNT); -def_extern_MapKey(ARGUMENTS); -def_extern_MapKey(CHECKPOINT); -def_extern_MapKey(CKPTINTERVAL); -def_extern_MapKey(CREATIONTIME); -def_extern_MapKey(EGROUP); -def_extern_MapKey(ELIGIBLETIME); -def_extern_MapKey(ENDTIME); -def_extern_MapKey(EUSER); -def_extern_MapKey(EXECUTABLE); -def_extern_MapKey(EXECUTIONHOST); -def_extern_MapKey(EXITCODE); -def_extern_MapKey(HOLD); -def_extern_MapKey(ID); -def_extern_MapKey(INFILE); -def_extern_MapKey(MAIL); -def_extern_MapKey(MAXCPUTIME); -def_extern_MapKey(MAXDISKSIZE); -def_extern_MapKey(MAXRAMSIZE); -def_extern_MapKey(MAXWALLTIME); -def_extern_MapKey(MODIFICATIONTIME); -def_extern_MapKey(NAME); -def_extern_MapKey(NBPROC); -def_extern_MapKey(OUTFILE); -def_extern_MapKey(PID); -def_extern_MapKey(QUEUE); -def_extern_MapKey(QUEUEDTIME); -def_extern_MapKey(SERVER); -def_extern_MapKey(STARTTIME); -def_extern_MapKey(STATE); -def_extern_MapKey(TEXT); -def_extern_MapKey(TMPDIR); -def_extern_MapKey(USEDCPUTIME); -def_extern_MapKey(USEDDISKSIZE); -def_extern_MapKey(USEDRAMSIZE); -def_extern_MapKey(USEDWALLTIME); -def_extern_MapKey(USER); -def_extern_MapKey(WORKDIR); -def_extern_MapKey(HOMEDIR); - -#endif diff --git a/src/Batch/Batch_PyVersatile.cxx b/src/Batch/Batch_PyVersatile.cxx deleted file mode 100644 index 620cf5eca..000000000 --- a/src/Batch/Batch_PyVersatile.cxx +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * PyVersatile.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Mon Oct 13 12:01:12 2003 - * Projet : Salome 2 - * - */ - -#include -#include "Batch_TypeMismatchException.hxx" -#include "Batch_ListIsFullException.hxx" -#include "Batch_InvalidArgumentException.hxx" -#include "Batch_PyVersatile.hxx" -#include - -using namespace std; - -namespace Batch { - - // Constructeur a partir d'un objet Versatile - PyVersatile::PyVersatile(const Versatile & V) : Versatile(V) - { - // Nothing to do - } - - - // Constructeur a partir d'un PyObject - // Les objets autorises sont les strings et les ints, - // ainsi que les listes de strings - PyVersatile::PyVersatile(const PyObject * PyO) throw(TypeMismatchException, ListIsFullException, InvalidArgumentException) : Versatile() - { - PyObject * _PyO = const_cast(PyO); - - if (PyList_Check(_PyO)) { // c'est une liste - _maxsize = PyList_Size(_PyO); - for(int i=0; i<_maxsize; i++) { - PyObject * val = PyList_GetItem(_PyO, i); - if (PyString_Check(val)) { - *this += PyString_AsString(val); - - } else if (PyTuple_Check(val) && - (PyTuple_Size(val) == 2) && - PyString_Check( PyTuple_GetItem(val,0) ) && - PyString_Check( PyTuple_GetItem(val,1) ) ) { - *this += Couple( PyString_AsString( PyTuple_GetItem(val,0) ), - PyString_AsString( PyTuple_GetItem(val,1) ) - ); - - } else { - PyErr_SetString(PyExc_RuntimeWarning, "PyVersatile::PyVersatile(const PyObject * PyO) : invalid PyObject"); - } - } - - } else if (PyString_Check(_PyO)) { // c'est une string - const char * s = PyString_AsString(_PyO); - Versatile V = string(s); - *this = V; - - } else if (PyInt_Check(_PyO)) { // c'est un int - *this = PyInt_AsLong(_PyO); - - } else { // erreur - PyErr_SetString(PyExc_RuntimeWarning, "PyVersatile::PyVersatile(const PyObject * PyO) : invalid PyObject"); - } - } - - - - // Conversion de type vers un PyObject - PyVersatile::operator PyObject *() const - { - PyObject * obj; - - if (_maxsize != 1) { // une liste - obj = PyList_New(0); - for(Versatile::const_iterator it=begin(); it!=end(); it++) { -// char ch[2] = {0, 0}; - string st; - Couple cp; -// PyObject * tuple; - switch (_discriminator) { - // case BOOL: - // PyList_Append(obj, PyInt_FromLong(* static_cast(*it))); - // break; - - // case CHAR: - // *ch = * static_cast(*it); - // PyList_Append(obj, PyString_FromString(ch)); - // break; - - // case INT: - // PyList_Append(obj, PyInt_FromLong(* static_cast(*it))); - // break; - - case LONG: - PyList_Append(obj, PyInt_FromLong(* static_cast(*it))); - break; - - case STRING: - st = * static_cast(*it); - PyList_Append(obj, PyString_FromString(st.c_str())); - break; - - case COUPLE: - cp = * static_cast(*it); -// tuple = PyTuple_New(2); -// PyTuple_SetItem(tuple, 0, PyString_FromString( cp.getLocal().c_str() ) ); -// PyTuple_SetItem(tuple, 1, PyString_FromString( cp.getRemote().c_str() ) ); -// PyList_Append(obj, tuple); - PyList_Append(obj, Py_BuildValue("(ss)", cp.getLocal().c_str(), cp.getRemote().c_str() )); - break; - - case UNDEFINED: - PyList_Append(obj, Py_None); - break; - } - - } - - } else { // un scalaire -// char ch[2] = {0, 0}; - string st; - Couple cp; -// PyObject * tuple; - switch (_discriminator) { - // case BOOL: - // obj = PyInt_FromLong(* static_cast(front())); - // break; - - // case CHAR: - // *ch = * static_cast(front()); - // obj = PyString_FromString(ch); - // break; - - // case INT: - // obj = PyInt_FromLong(* static_cast(front())); - // break; - - case LONG: - obj = PyInt_FromLong(* static_cast(front())); - break; - - case STRING: - st = * static_cast(front()); - obj = PyString_FromString(st.c_str()); - break; - - case COUPLE: - cp = * static_cast(front()); -// tuple = PyTuple_New(2); -// PyTuple_SetItem(tuple, 0, PyString_FromString( cp.getLocal().c_str() ) ); -// PyTuple_SetItem(tuple, 1, PyString_FromString( cp.getRemote().c_str() ) ); -// obj = PyList_New(0); -// PyList_Append(obj, tuple); - obj = Py_BuildValue("[(ss)]", cp.getLocal().c_str(), cp.getRemote().c_str() ); - break; - - case UNDEFINED: - obj = Py_None; - break; - } - } - - return obj; - } - - - // Operateur d'affectation a partir d'un objet Versatile - PyVersatile & PyVersatile::operator =(const Versatile & V) - { - Versatile * me = this; - *me = V; - return *this; - } - -} - - -// COMMENTS diff --git a/src/Batch/Batch_PyVersatile.hxx b/src/Batch/Batch_PyVersatile.hxx deleted file mode 100644 index 41439fc6d..000000000 --- a/src/Batch/Batch_PyVersatile.hxx +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * PyVersatile.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Mon Oct 13 12:01:12 2003 - * Projet : Salome 2 - * - */ - -#ifndef _PYVERSATILE_H_ -#define _PYVERSATILE_H_ - - -#include "Batch_Defines.hxx" - -#include -#include "Batch_Versatile.hxx" -#include "Batch_TypeMismatchException.hxx" -#include "Batch_ListIsFullException.hxx" -#include "Batch_InvalidArgumentException.hxx" - -namespace Batch { - - class BATCH_EXPORT PyVersatile : public Versatile - { - public: - // Constructeur a partir d'un objet Versatile - PyVersatile(const Versatile &); - - // Constructeur a partir d'un PyObject - PyVersatile(const PyObject *) throw(TypeMismatchException, ListIsFullException, InvalidArgumentException); - - // Conversion de type vers un PyObject - operator PyObject *() const; - - // Operateur d'affectation a partir d'un objet Versatile - PyVersatile & operator =(const Versatile &); - - protected: - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_RunTimeException.cxx b/src/Batch/Batch_RunTimeException.cxx deleted file mode 100644 index 3db54fdaf..000000000 --- a/src/Batch/Batch_RunTimeException.cxx +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * RunTimeException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Nov 25 14:04:13 2003 - * Projet : Salome 2 - * - */ - -#include "Batch_RunTimeException.hxx" -using namespace std; - -namespace Batch { - -} diff --git a/src/Batch/Batch_RunTimeException.hxx b/src/Batch/Batch_RunTimeException.hxx deleted file mode 100644 index bdb31489f..000000000 --- a/src/Batch/Batch_RunTimeException.hxx +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * RunTimeException.hxx : - * - * Auteur : %author% - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Tue Nov 25 14:04:13 2003 - * Projet : Salome 2 - * - */ - -#ifndef _RUNTIMEEXCEPTION_H_ -#define _RUNTIMEEXCEPTION_H_ - -#include "Batch_Defines.hxx" - - -#include "Batch_GenericException.hxx" - -namespace Batch { - - class BATCH_EXPORT RunTimeException : public GenericException - { - public: - // Constructeur - RunTimeException(std::string ch = "undefined") : GenericException("RunTimeException", ch) {} - }; - -} - -#endif diff --git a/src/Batch/Batch_StringType.cxx b/src/Batch/Batch_StringType.cxx deleted file mode 100644 index 33c7c5fd3..000000000 --- a/src/Batch/Batch_StringType.cxx +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * StringType.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include "Batch_StringType.hxx" -using namespace std; - -namespace Batch { - - // Conversion en chaine - string StringType::affiche() const - { - return _data; - } - - // Operateur d'affectation - StringType & StringType::operator =(string s) - { - _data = s; - return *this; - } - - // Conversion en chaine - StringType::operator string() const - { - return this->_data; - } - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - GenericType * StringType::clone() const - { - StringType * pS = new StringType(this->_data); - assert(pS != 0); - return pS; - } - -} diff --git a/src/Batch/Batch_StringType.hxx b/src/Batch/Batch_StringType.hxx deleted file mode 100644 index fb5a80e0d..000000000 --- a/src/Batch/Batch_StringType.hxx +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * StringType.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _STRINGTYPE_H_ -#define _STRINGTYPE_H_ - -#include "Batch_Defines.hxx" - -#include -#include "Batch_GenericType.hxx" - -namespace Batch { - - class BATCH_EXPORT StringType : public GenericType - { - public: - // Constructeur - StringType(const std::string & s="") : _data(s) {} - - // Conversion en chaine - virtual std::string affiche() const; - virtual operator std::string() const; - - // Operateur d'affectation - virtual StringType & operator =(std::string); - - // Clone duplique l'objet et en fabrique un nouveau a l'aide de new - // qu'il faudra detruire ensuite manuellement - virtual GenericType * clone() const; - - protected: - std::string _data; - - private: - - }; - -} - -#endif diff --git a/src/Batch/Batch_TypeMismatchException.cxx b/src/Batch/Batch_TypeMismatchException.cxx deleted file mode 100644 index 96b30be4c..000000000 --- a/src/Batch/Batch_TypeMismatchException.cxx +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * TypeMismatchException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include "Batch_TypeMismatchException.hxx" -using namespace std; - -namespace Batch { - -} diff --git a/src/Batch/Batch_TypeMismatchException.hxx b/src/Batch/Batch_TypeMismatchException.hxx deleted file mode 100644 index 10912f6fb..000000000 --- a/src/Batch/Batch_TypeMismatchException.hxx +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * TypeMismatchException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _TYPEMISMATCHEXCEPTION_H_ -#define _TYPEMISMATCHEXCEPTION_H_ - -#include "Batch_Defines.hxx" - - -#include "Batch_GenericException.hxx" - -namespace Batch { - - class BATCH_EXPORT TypeMismatchException : public GenericException - { - public: - // Constructeur - TypeMismatchException(std::string ch = "undefined") : GenericException("TypeMismatchException", ch) {} - }; - -} - -#endif - diff --git a/src/Batch/Batch_Versatile.cxx b/src/Batch/Batch_Versatile.cxx deleted file mode 100644 index 00746006a..000000000 --- a/src/Batch/Batch_Versatile.cxx +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Versatile.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#include -#include -#include -#include -#include -//#include "MEDMEM_STRING.hxx" -#include "Batch_GenericType.hxx" -#include "Batch_IntType.hxx" -#include "Batch_BoolType.hxx" -#include "Batch_CharType.hxx" -#include "Batch_LongType.hxx" -#include "Batch_StringType.hxx" -#include "Batch_Versatile.hxx" -#include "Batch_TypeMismatchException.hxx" -#include "Batch_ListIsFullException.hxx" -using namespace std; - -namespace Batch { - - // Constructeur par recopie - Versatile::Versatile(const Versatile & V) : _discriminator(V._discriminator), _maxsize(V._maxsize), _name(V._name) // , _str_value(0) - { - Versatile::const_iterator it; - - // On prend un a un les elements de l'objet passe en argument qu'on duplique - for(it=V.begin(); it!=V.end(); it++) - push_back( (*it)->clone() ); // Attention, la methode clone fait un new implicite - } - - // Destructeur - Versatile::~Versatile() - { - eraseAll(); - } - - // Operateur d'affectation entre objets - Versatile & Versatile::operator = (const Versatile & Vrhs) throw(TypeMismatchException) - { - // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit - setType(Vrhs._discriminator); - setMaxSize(Vrhs._maxsize); - _name = Vrhs._name; - - // On efface les donnees precedentes - eraseAll(); - - // On copie les donnees de Vrhs - Versatile::const_iterator it; - - for(it=Vrhs.begin(); it!=Vrhs.end(); it++) - push_back( (*it)->clone() ); // Attention, la methode clone fait un new implicite - - return *this; - } - - // Operateur d'affectation a partir d'un long - Versatile & Versatile::operator = (const long l) throw(TypeMismatchException) - { - // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit - setType(LONG); - - // On efface les donnees precedentes - eraseAll(); - - // On ajoute un element interne de type long a l'objet - LongType * pL = new LongType(l); - assert(pL != 0); - push_back(pL); - return *this; - } - - // Operateur d'affectation a partir d'une string - Versatile & Versatile::operator = (const string & ch) throw(TypeMismatchException) - { - // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit - setType(STRING); - - // On efface les donnees precedentes - eraseAll(); - - // On ajoute un element interne de type string a l'objet - StringType * pS = new StringType(ch); - assert(pS != 0); - push_back(pS); - - return *this; - } - - // Operateur de concatenation a partir d'une string - Versatile & Versatile::operator +=(const string & ch) throw(TypeMismatchException,ListIsFullException) - { - // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit - setType(STRING); - - // Si la taille maximale est atteinte, on leve une exception ListIsFullException - if (_maxsize == 0) push_back(new StringType(ch)); - else if ((_maxsize > 0) && (size() < _maxsize)) push_back(new StringType(ch)); - else { - //MEDMEM::STRING msg; - ostringstream msg; - msg << "Taille maximum : " << _maxsize; - throw(ListIsFullException(msg.str())); - } - return *this; - } - - // Operateur de concatenation a partir d'une string - Versatile & Versatile::operator , (const string & ch) throw(TypeMismatchException,ListIsFullException) - { - *this += ch; - return *this; - } - - // Operateur d'affectation a partir d'un Couple - Versatile & Versatile::operator = (const Couple & cp) throw(TypeMismatchException) - { - // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit - setType(COUPLE); - - // On efface les donnees precedentes - eraseAll(); - - // On ajoute un element interne de type Couple a l'objet - CoupleType * pC = new CoupleType(cp); - assert(pC != 0); - push_back(pC); - - return *this; - } - - // Operateur de concatenation a partir d'un Couple - Versatile & Versatile::operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException) - { - // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit - setType(COUPLE); - - // Si la taille maximale est atteinte, on leve une exception ListIsFullException - if (_maxsize == 0) push_back(new CoupleType(cp)); - else if ((_maxsize > 0) && (size() < _maxsize)) push_back(new CoupleType(cp)); - else { - //MEDMEM::STRING msg; - ostringstream msg; - msg << "Taille maximum : " << _maxsize; - throw(ListIsFullException(msg.str())); - } - return *this; - } - - // Operateur de concatenation a partir d'un Couple - Versatile & Versatile::operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException) - { - *this += cp; - return *this; - } - - ostream & operator << (ostream & os, const Versatile & V) - { - Versatile::const_iterator it; - const char * sep = ""; - - for(it=V.begin(); it!=V.end(); it++, sep=" ") { - string s = (*it)->affiche(); - os << sep << s; - } - return os; - } - - // Positionnement du type de l'element interne - void Versatile::setType(DiscriminatorType t) throw(TypeMismatchException) - { - // Si le type est deja defini et ne correspond pas au type en argument - // une exception TypeMismatchException est levee - if ( (_discriminator == UNDEFINED) || (_discriminator == t) ) - _discriminator = t; - else { - //MEDMEM::STRING sst; - ostringstream sst; - sst << "Trying to change type of Versatile object \"" - << _name << "\""; - throw(TypeMismatchException(sst.str())); - } - } - - // Positionnement du nombre d'elements internes - void Versatile::setMaxSize(int i) - { - _maxsize = i; - if (i <= 0) return; - // Si la nouvelle taille est inferieure au nombre d'elements deja - // presents, les elements en surplus sont effaces (troncature) - if (size() > _maxsize) - { - int reste = size() - _maxsize; - Versatile::iterator it; - for(it=end(); (it!=begin()) && reste; it--, reste--) - { - delete back(); - pop_back(); - } - } - } - - - // Conversion de type vers un long - Versatile::operator long() const throw(TypeMismatchException) - { - // Si le type ne correspond pas ou si la liste contient plus d'un element, - // la conversion est impossible et une exception TypeMismatchException - // est levee - if ( (_maxsize != 1) || (_discriminator != LONG) || (size() == 0) ) { - //MEDMEM::STRING sst; - ostringstream sst; - sst << "Cannot cast Versatile object \"" - << _name << "\" to long"; - throw(TypeMismatchException(sst.str())); - } - return *( static_cast(this->front()) ); - } - - // Conversion de type vers un Couple - Versatile::operator Couple() const throw(TypeMismatchException) - { - // Si le type ne correspond pas ou si la liste contient plus d'un element, - // la conversion est impossible et une exception TypeMismatchException - // est levee - if ( (_maxsize != 1) || (_discriminator != COUPLE) || (size() == 0) ) { - //MEDMEM::STRING sst; - ostringstream sst; - sst << "Cannot cast Versatile object \"" - << _name << "\" to Couple"; - throw(TypeMismatchException(sst.str())); - } - return *( static_cast(this->front()) ); - } - - // Conversion de type vers une string - string Versatile::str() const throw(TypeMismatchException) - { - // Si le type ne correspond pas, la conversion est impossible et - // une exception TypeMismatchException est levee - if ( (_discriminator != STRING) || (size() == 0) ) { - //MEDMEM::STRING sst; - ostringstream sst; - sst << "Cannot cast Versatile object \"" - << _name << "\" to string"; - throw(TypeMismatchException(sst.str())); - } - - // La chaine renvoyee est la concatenation des chaines internes - string s; - Versatile::const_iterator it; - const char * sep = ""; - for(it=begin(); it!=end(); it++, s+=sep, sep=" ") - s += *( static_cast(*it)); - - return s; - } - - // Conversion de type vers une string - Versatile::operator string () const throw(TypeMismatchException) - { - return str(); - } - - // Efface tous les elements internes de l'objet - void Versatile::eraseAll() - { - while(!empty()) - { - delete back(); - pop_back(); - } - } - - - // Recuperation du type de l'element interne - DiscriminatorType Versatile::getType() const - { - return _discriminator; - } - - // Recuperation du nom de l'objet - string Versatile::getName() const - { - return _name; - } - - // Positionnement du nom de l'objet - void Versatile::setName(const string & name) - { - _name = name; - } -} diff --git a/src/Batch/Batch_Versatile.hxx b/src/Batch/Batch_Versatile.hxx deleted file mode 100644 index 92278b8f8..000000000 --- a/src/Batch/Batch_Versatile.hxx +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * Versatile.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -#ifndef _VERSATILE_H_ -#define _VERSATILE_H_ - -#include "Batch_Defines.hxx" - -#include -#include -#include -#include "Batch_GenericType.hxx" -#include "Batch_IntType.hxx" -#include "Batch_BoolType.hxx" -#include "Batch_CharType.hxx" -#include "Batch_LongType.hxx" -#include "Batch_StringType.hxx" -#include "Batch_CoupleType.hxx" -#include "Batch_TypeMismatchException.hxx" -#include "Batch_ListIsFullException.hxx" - -namespace Batch { - - // Les types autorises - // enum DiscriminatorType { UNDEFINED, BOOL, CHAR, INT, LONG, STRING}; - enum DiscriminatorType { UNDEFINED, LONG, STRING, COUPLE }; - - typedef struct { - DiscriminatorType type; // le type de l'element interne - int maxelem; // le nombre d'elements autorises - } TypeParam; - - class BATCH_EXPORT Versatile : public std::list< GenericType * > - { - public: - // Constructeur standard et destructeur - Versatile() : _discriminator(UNDEFINED), _maxsize(1), _name("undefined") {} - virtual ~Versatile(); - - // Constructeur par recopie - Versatile(const Versatile & V); - - // Constructeur depuis le type de "base" - Versatile(long l) : _discriminator(LONG), _maxsize(1), _name("long") { push_back(new LongType(l)); } - Versatile(const std::string & s) : _discriminator(STRING), _maxsize(1), _name("string") { push_back(new StringType(s)); } - Versatile(const Couple & c) : _discriminator(COUPLE), _maxsize(1), _name("couple") { push_back(new CoupleType(c)); } - - // Operateur d'affectation et de concatenation a partir d'un type de "base" - Versatile & operator = (const long l) throw(TypeMismatchException); - Versatile & operator = (const std::string & ch) throw(TypeMismatchException); - Versatile & operator +=(const std::string & ch) throw(TypeMismatchException,ListIsFullException); - Versatile & operator , (const std::string & ch) throw(TypeMismatchException,ListIsFullException); - Versatile & operator = (const Couple & cp) throw(TypeMismatchException); - Versatile & operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException); - Versatile & operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException); - - // Operateur d'affectation entre objets - Versatile & operator = (const Versatile & V) throw(TypeMismatchException); - - // Conversion de type vers un type de "base" - operator long() const throw(TypeMismatchException); - operator std::string() const throw(TypeMismatchException); - operator Couple() const throw(TypeMismatchException); - std::string str() const throw(TypeMismatchException); - - // Operateur pour l'affichage sur un stream - friend std::ostream & operator << (std::ostream & os, const Versatile & ); - - // Positionnement et recuperation du type de l'element interne - void setType(DiscriminatorType) throw(TypeMismatchException); - DiscriminatorType getType() const; - - // Positionnement et recuperation du nombre d'elements internes - void setMaxSize(int i); - int getMaxSize() const { return _maxsize; } - - // Positionnement et recuperation du nom de l'objet - std::string getName() const; - void setName(const std::string & name); - - protected: - // Efface tous les elements internes de l'objet - virtual void eraseAll(); - - DiscriminatorType _discriminator; // type de l'element interne - int _maxsize; // nombre max d'elements internes - std::string _name; // nom de l'objet (sert pour les exceptions) - - private: - - }; - -} - -#endif - diff --git a/src/Batch/Makefile.am b/src/Batch/Makefile.am deleted file mode 100644 index e0bc1b719..000000000 --- a/src/Batch/Makefile.am +++ /dev/null @@ -1,237 +0,0 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-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 -# -####################################### library -# SALOME Container : implementation of container and engine for Kernel -# File : Makefile.in -# Author : EDF -# Module : SALOME -# $Header$ -# -include $(top_srcdir)/salome_adm/unix/make_common_starter.am - -# header files -LIB_INCLUDES = \ - Batch_APIInternalFailureException.hxx \ - Batch_BatchManager.hxx \ - Batch_BatchManagerCatalog.hxx \ - Batch_BoolType.hxx \ - Batch_CharType.hxx \ - Batch_ConnexionFailureException.hxx \ - Batch_Couple.hxx \ - Batch_CoupleType.hxx \ - Batch_Date.hxx \ - Batch_DateType.hxx \ - Batch_Environnement.hxx \ - Batch_FactBatchManager.hxx \ - Batch_GenericException.hxx \ - Batch_GenericType.hxx \ - Batch_IntType.hxx \ - Batch_InvalidArgumentException.hxx \ - Batch_InvalidKeyException.hxx \ - Batch_Job.hxx \ - Batch_JobId.hxx \ - Batch_JobInfo.hxx \ - Batch_ListIsFullException.hxx \ - Batch_LongType.hxx \ - Batch_MapKey.hxx \ - Batch_NotYetImplementedException.hxx \ - Batch_Parametre.hxx \ - Batch_PyVersatile.hxx \ - Batch_RunTimeException.hxx \ - Batch_StringType.hxx \ - Batch_TypeMismatchException.hxx \ - Batch_BatchManager_eClient.hxx \ - Batch_FactBatchManager_eClient.hxx \ - Batch_BatchManager_eLSF.hxx \ - Batch_FactBatchManager_eLSF.hxx \ - Batch_JobInfo_eLSF.hxx \ - Batch_BatchManager_ePBS.hxx \ - Batch_FactBatchManager_ePBS.hxx \ - Batch_JobInfo_ePBS.hxx \ - MpiImpl.hxx \ - Batch_Defines.hxx \ - Batch_BatchManager_eSGE.hxx \ - Batch_FactBatchManager_eSGE.hxx \ - Batch_JobInfo_eSGE.hxx \ - MpiImpl.hxx - - -LIB_SRC = \ - Batch_APIInternalFailureException.cxx \ - Batch_BatchManager.cxx \ - Batch_BatchManagerCatalog.cxx \ - Batch_BoolType.cxx \ - Batch_CharType.cxx \ - Batch_ConnexionFailureException.cxx \ - Batch_Couple.cxx \ - Batch_CoupleType.cxx \ - Batch_Date.cxx \ - Batch_DateType.cxx \ - Batch_Environnement.cxx \ - Batch_FactBatchManager.cxx \ - Batch_GenericException.cxx \ - Batch_GenericType.cxx \ - Batch_IntType.cxx \ - Batch_InvalidArgumentException.cxx \ - Batch_InvalidKeyException.cxx \ - Batch_Job.cxx \ - Batch_JobId.cxx \ - Batch_JobInfo.cxx \ - Batch_ListIsFullException.cxx \ - Batch_LongType.cxx \ - Batch_MapKey.cxx \ - Batch_NotYetImplementedException.cxx \ - Batch_Parametre.cxx \ - Batch_PyVersatile.cxx \ - Batch_RunTimeException.cxx \ - Batch_StringType.cxx \ - Batch_TypeMismatchException.cxx \ - Batch_BatchManager_eClient.cxx \ - Batch_FactBatchManager_eClient.cxx \ - Batch_BatchManager_eLSF.cxx \ - Batch_FactBatchManager_eLSF.cxx \ - Batch_JobInfo_eLSF.cxx \ - Batch_BatchManager_ePBS.cxx \ - Batch_FactBatchManager_ePBS.cxx \ - Batch_JobInfo_ePBS.cxx \ - Batch_BatchManager_eSGE.cxx \ - Batch_FactBatchManager_eSGE.cxx \ - Batch_JobInfo_eSGE.cxx \ - MpiImpl.cxx - - -LIB_CPPFLAGS = \ - ${PYTHON_INCLUDES} -if !WITHONLYLAUNCHER - LIB_CPPFLAGS += \ - -I$(srcdir)/../Basics \ - -I$(top_builddir)/salome_adm/unix -endif - -LIB_LIBADD = -if !WITHONLYLAUNCHER - LIB_LIBADD += \ - ../Basics/libSALOMEBasics.la -endif - -LIB_LIBADD += $(PYTHON_LIBS) - -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Special add for local batch system -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -if WITH_LOCAL -LIB_INCLUDES +=\ - Batch_Versatile.hxx \ - Batch_BatchManager_Local.hxx \ - Batch_BatchManager_Local_RSH.hxx \ - Batch_BatchManager_Local_SH.hxx \ - Batch_BatchManager_Local_SSH.hxx \ - Batch_FactBatchManager_Local.hxx \ - Batch_FactBatchManager_Local_RSH.hxx \ - Batch_FactBatchManager_Local_SH.hxx \ - Batch_FactBatchManager_Local_SSH.hxx \ - Batch_JobInfo_Local.hxx \ - Batch_Job_Local.hxx \ - Batch_IOMutex.hxx - -LIB_SRC +=\ - Batch_Versatile.cxx \ - Batch_BatchManager_Local.cxx \ - Batch_BatchManager_Local_RSH.cxx \ - Batch_BatchManager_Local_SH.cxx \ - Batch_BatchManager_Local_SSH.cxx \ - Batch_FactBatchManager_Local.cxx \ - Batch_FactBatchManager_Local_RSH.cxx \ - Batch_FactBatchManager_Local_SH.cxx \ - Batch_FactBatchManager_Local_SSH.cxx \ - Batch_JobInfo_Local.cxx \ - Batch_Job_Local.cxx \ - Batch_IOMutex.cxx - -if !WITHONLYLAUNCHER - LIB_CPPFLAGS += -DHAVE_CONFIG_H -endif - -endif - -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Special add for openpbs batch system -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -if WITH_OPENPBS -LIB_INCLUDES += \ - Batch_BatchManager_PBS.hxx \ - Batch_FactBatchManager_PBS.hxx \ - Batch_JobInfo_PBS.hxx \ - Batch_Job_PBS.hxx - -LIB_SRC +=\ - Batch_BatchManager_PBS.cxx \ - Batch_FactBatchManager_PBS.cxx \ - Batch_JobInfo_PBS.cxx \ - Batch_Job_PBS.cxx - -LIB_CPPFLAGS += @OPENPBS_INCLUDES@ -LIB_LIBADD += @OPENPBS_LIBDIR@ @OPENPBS_LIBS@ - -endif - -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Special add for lsf batch system -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -if WITH_LSF -LIB_INCLUDES += \ - Batch_BatchManager_LSF.hxx \ - Batch_FactBatchManager_LSF.hxx \ - Batch_JobInfo_LSF.hxx \ - Batch_Job_LSF.hxx - -LIB_SRC += \ - Batch_BatchManager_LSF.cxx \ - Batch_FactBatchManager_LSF.cxx \ - Batch_JobInfo_LSF.cxx \ - Batch_Job_LSF.cxx - -LIB_CPPFLAGS += ${LSF_INCLUDES} -LIB_LIBADD += ${LSF_LDFLAGS} ${LSF_LIBS} -endif - - - - -salomeinclude_HEADERS = $(LIB_INCLUDES) - -# -# =============================================================== -# Libraries targets -# =============================================================== -# -lib_LTLIBRARIES = libSalomeBatch.la -libSalomeBatch_la_SOURCES = $(LIB_SRC) -libSalomeBatch_la_CPPFLAGS = ${LIB_CPPFLAGS} -libSalomeBatch_la_LDFLAGS = -no-undefined -version-info=0:0:0 -libSalomeBatch_la_LIBADD = $(LIB_LIBADD) diff --git a/src/Batch/MpiImpl.cxx b/src/Batch/MpiImpl.cxx deleted file mode 100644 index 549158419..000000000 --- a/src/Batch/MpiImpl.cxx +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -#include -#include -#include "MpiImpl.hxx" - -using namespace std; - -// Constructor -MpiImpl::MpiImpl() -{ -} - -// Destructor -MpiImpl::~MpiImpl() -{ -} - -// lam implementation -// Constructor -MpiImpl_LAM::MpiImpl_LAM() : MpiImpl() -{ -} - -// Destructor -MpiImpl_LAM::~MpiImpl_LAM() -{ -} - -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() -{ -} - -string MpiImpl_MPICH1::size() -{ - return "${MPIRUN_NPROCS}"; -} - -string MpiImpl_MPICH1::rank() -{ - return "${MPIRUN_RANK}"; -} - -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() -{ -} - -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; - if (machinefile!="") - oss << " -f " << machinefile; - oss << 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() -{ -} - -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 ""; -} - -// slurm implementation -// Constructor -MpiImpl_SLURM::MpiImpl_SLURM() : MpiImpl() -{ -} - -// Destructor -MpiImpl_SLURM::~MpiImpl_SLURM() -{ -} - -string MpiImpl_SLURM::size() -{ - return "${SLURM_NPROCS}"; -} - -string MpiImpl_SLURM::rank() -{ - return "${SLURM_PROCID}"; -} - -string MpiImpl_SLURM::boot(const string machinefile, const unsigned int nbnodes) -{ - return ""; -} - -string MpiImpl_SLURM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) -{ - ostringstream oss; - oss << "srun " << fileNameToExecute << endl; - return oss.str(); -} - -string MpiImpl_SLURM::halt() -{ - return ""; -} - -// prun implementation -// Constructor -MpiImpl_PRUN::MpiImpl_PRUN() : MpiImpl() -{ -} - -// Destructor -MpiImpl_PRUN::~MpiImpl_PRUN() -{ -} - -string MpiImpl_PRUN::size() -{ - return "${RMS_NPROCS}"; -} - -string MpiImpl_PRUN::rank() -{ - return "${RMS_RANK}"; -} - -string MpiImpl_PRUN::boot(const string machinefile, const unsigned int nbnodes) -{ - return ""; -} - -string MpiImpl_PRUN::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) -{ - ostringstream oss; - oss << "prun -n " << nbproc << " " << "-p mpi " << fileNameToExecute << endl; - return oss.str(); -} - -string MpiImpl_PRUN::halt() -{ - return ""; -} diff --git a/src/Batch/MpiImpl.hxx b/src/Batch/MpiImpl.hxx deleted file mode 100644 index 4639e6e85..000000000 --- a/src/Batch/MpiImpl.hxx +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// - -#ifndef _BL_MPIIMPL_H_ -#define _BL_MPIIMPL_H_ - -#include "Batch_Defines.hxx" -#include - -class BATCH_EXPORT MpiImplException -{ -public: - const std::string msg; - - MpiImplException(const std::string m) : msg(m) {} -}; - -class BATCH_EXPORT 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 BATCH_EXPORT 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 BATCH_EXPORT 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 BATCH_EXPORT 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 BATCH_EXPORT 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: - -}; - -class BATCH_EXPORT MpiImpl_SLURM : public MpiImpl -{ -public: - // Constructeur et destructeur - MpiImpl_SLURM(); // constructor - virtual ~MpiImpl_SLURM(); //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 BATCH_EXPORT MpiImpl_PRUN : public MpiImpl -{ -public: - // Constructeur et destructeur - MpiImpl_PRUN(); // constructor - virtual ~MpiImpl_PRUN(); //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/Batch_SWIG/Batch_test.py b/src/Batch_SWIG/Batch_test.py deleted file mode 100644 index 500ef1b04..000000000 --- a/src/Batch_SWIG/Batch_test.py +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-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 -# -#Batch_test.py -# pratique -# -import readline -import rlcompleter -readline.parse_and_bind('tab: complete') - -# Importation de la bibliotheque de classes Batch -from libBatch_Swig import * - -def work(): - # Definition d'un job... - job=Job() - # ... de ses parametres ... - p={} - p['EXECUTABLE']='/home/dutka/tmp/job' - p['NAME']='MonJob' - p['OUTFILE']=[('/tmp/stdout', 'stdout'), ('/tmp/stderr', 'stderr')] - job.setParametre(p) - # ... et de son environnement - job.setEnvironnement({}) - print job - - # Appel au catalogue de BatchManager pour accéder au serveur cli70cu - # Instanciation du catalogue (quasi-singleton) - c=BatchManagerCatalog() - # Instanciation d'une Factory de BatchManager de type 'PBS' - # fbm=c('PBS') - - # Creation d'un BatchManager de type PBS sur le serveur cli70cu - bm=c('PBS')('cli70cu') - - # Soumission du job au BatchManager - jobid=bm.submitJob(job) - print jobid - - # Interrogation de l'etat du job - jobid.queryJob() - - # On attend que le job soit termine - try: - while 1: jinfo = jobid.queryJob() - except: - print "Job", jobid, "is done" - - pass - -if __name__ == "__main__": - work() - pass - - - diff --git a/src/Batch_SWIG/Makefile.am b/src/Batch_SWIG/Makefile.am deleted file mode 100644 index 2d18ed2e0..000000000 --- a/src/Batch_SWIG/Makefile.am +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-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 : Guillaume Boulant (CSSI) -# Module : KERNEL -# $Header$ -# -include $(top_srcdir)/salome_adm/unix/make_common_starter.am - -# -# =============================================================== -# Swig targets -# =============================================================== -# (cf. http://www.geocities.com/foetsch/python/swig_linux.htm) -# -# Step 1: build the wrapping source files with swig -# -# libBatch_Swig.i -- swig --> swig_wrap.cpp -# libBatch_Swig.py -# -# Step 2: build the dynamic library from cpp built source files and -# dependant libraries. -# -# swig_wrap.cpp -- gcc --> swig_wrap.o |-- link --> _libBatch_Swig.la -# + | -# dependant libs | -# -# The file libBatch_Swig.py will be installed in -# /lib/python/site-package/salome. -# The library will be installed in the common place. -# - -BUILT_SOURCES = swig_wrap.cpp libBatch_Swig.py - -SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../Batch -SWIGSOURCES = libBatch_Swig.i libBatch_Swig_exception.i libBatch_Swig_typemap.i - -salomepython_PYTHON = libBatch_Swig.py -salomepyexec_LTLIBRARIES = _libBatch_Swig.la -_libBatch_Swig_la_SOURCES = swig_wrap.cpp -_libBatch_Swig_la_CPPFLAGS = @PYTHON_INCLUDES@ -I$(srcdir) -I$(srcdir)/../Batch -_libBatch_Swig_la_LDFLAGS = -module -_libBatch_Swig_la_LIBADD = ../Batch/libSalomeBatch.la @PYTHON_LIBS@ - -if WITH_OPENPBS -_libBatch_Swig_la_CPPFLAGS += @OPENPBS_INCLUDES@ -_libBatch_Swig_la_LIBADD += @OPENPBS_LIBDIR@ @OPENPBS_LIBS@ -endif - -swig_wrap.cpp libBatch_Swig.py : $(SWIGSOURCES) - $(SWIG) $(SWIG_FLAGS) -o swig_wrap.cpp $< - -CLEANFILES = swig_wrap.cpp - -EXTRA_DIST = $(SWIGSOURCES) - -# -# =============================================================== -# Files to be installed -# =============================================================== -# - -# Scripts to be installed. -dist_salomescript_PYTHON = Batch_test.py - -# You don't need to specify libBatch_Swig.py. It is automatically -# installed by means of the swig target salomepython_PYTHON. - -install-data-hook: - @for f in $(dist_salomescript_PYTHON) ; do \ - chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \ - done diff --git a/src/Batch_SWIG/libBatch_Swig.i b/src/Batch_SWIG/libBatch_Swig.i deleted file mode 100644 index fc610e787..000000000 --- a/src/Batch_SWIG/libBatch_Swig.i +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * libBatch_Swig.i : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -/* ATTENTION: - ========== - Certaines classes ont des methodes surchargees et SWIG ne gere pas bien - ces surcharges, d'ou un probleme d'utilisation en Python de celles-ci. - En bref, ça ne marche pas et il faudra corriger le probleme... - - TODO : corriger le probleme de surcharge des methodes en Python - - IDM. -*/ - - -/* Le nom du module Python tel qu'il est importe */ -%module libBatch_Swig - -/* generate docstrings with types */ -%feature("autodoc", "1"); - -/* Inclusion des conversions de type */ -%include libBatch_Swig_typemap.i - -/* Inclusion de la gestion des exceptions */ -%include libBatch_Swig_exception.i - -%{ -#include "Batch_Defines.hxx" -#include "Batch_Job.hxx" -#include "Batch_JobId.hxx" -#include "Batch_JobInfo.hxx" - -#include "Batch_BatchManager.hxx" -#include "Batch_BatchManagerCatalog.hxx" -#include "Batch_FactBatchManager.hxx" -%} - -/* Les classes exportees en Python */ -%include Batch_Defines.hxx -%include Batch_Job.hxx -%include Batch_JobId.hxx -%include Batch_JobInfo.hxx - -%include Batch_BatchManager.hxx -%include Batch_BatchManagerCatalog.hxx -%include Batch_FactBatchManager.hxx - - - -/* Les methodes alterJob (surchargees et mal gerees en Python) sont - remplacees par des methodes setParametre et setEnvironnement. - cf. remarque ci-dessus. -*/ -%ignore JobId::alterJob(const Parametre & param, const Environnement & env) const; -%ignore JobId::alterJob(const Parametre & param) const; -%ignore JobId::alterJob(const Environnement & env) const; diff --git a/src/Batch_SWIG/libBatch_Swig_exception.i b/src/Batch_SWIG/libBatch_Swig_exception.i deleted file mode 100644 index 03c2b0e44..000000000 --- a/src/Batch_SWIG/libBatch_Swig_exception.i +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * _exception.i : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -%exception { - try { - $action - } - catch (Batch::GenericException & ex) { - std::string msg = ex.type + " : " + ex.message; - PyErr_SetString(PyExc_RuntimeWarning, msg.c_str()); - return NULL; - } - catch (...) { - PyErr_SetString(PyExc_RuntimeWarning, "unknown exception"); - return NULL; - } -} - diff --git a/src/Batch_SWIG/libBatch_Swig_typemap.i b/src/Batch_SWIG/libBatch_Swig_typemap.i deleted file mode 100644 index 6b2a01123..000000000 --- a/src/Batch_SWIG/libBatch_Swig_typemap.i +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-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 -// -/* - * _typemap.i : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Date : Septembre 2003 - * Projet : SALOME 2 - * - */ - -%{ -#include -#include -#include -#include "Batch_Parametre.hxx" -#include "Batch_PyVersatile.hxx" -#include "Batch_JobId.hxx" -#include "Batch_FactBatchManager.hxx" -#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) -typedef int Py_ssize_t; -#define PY_SSIZE_T_MAX INT_MAX -#define PY_SSIZE_T_MIN INT_MIN -#endif -%} - -# // supprime toutes les definitions par defaut => sert au debug -# %typemap(in) SWIGTYPE ; - - -# // construction d'un dictionnaire Python a partir d'un objet BatchManagerCatalog C++ -%typemap(out) std::map * -{ - $result = PyDict_New(); - - // on itere sur toutes les clefs de la map - for(std::map::const_iterator it=(* $1).begin(); it!=(* $1).end(); it++) { - std::string key = (*it).first; - PyObject * obj = SWIG_NewPointerObj((void *) (*it).second, SWIGTYPE_p_Batch__FactBatchManager, 0); - PyDict_SetItem($result, PyString_FromString(key.c_str()), obj); - } -} - -%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) Batch::Parametre -{ - $1 = PyDict_Check($input)? 1 : 0; -} - -# // construction d'un dictionnaire Python a partir d'un objet Parametre C++ -%typemap(out) Batch::Parametre -{ - $result = PyDict_New(); - - // on itere sur toutes les clefs de la map, et on passe par la classe PyVersatile - // qui convertit un Versatile en PyObject et vice versa - for(Batch::Parametre::const_iterator it=$1.begin(); it!=$1.end(); it++) { - std::string key = (*it).first; - Batch::PyVersatile PyV = (*it).second; - PyDict_SetItem($result, PyString_FromString(key.c_str()), PyV); - } -} - - -# // construction d'un objet Parametre C++ a partir d'un dictionnaire Python -%typemap(in) Batch::Parametre & (Batch::Parametre PM) -{ - if (!PyDict_Check($input)) { - PyErr_SetString(PyExc_ValueError,"Expected a dictionnary"); - return NULL; - } - - try { - // on itere sur toutes les clefs du dictionnaire, et on passe par la classe PyVersatile - // qui convertit un Versatile en PyObject et vice versa - PyObject *key, *value; - Py_ssize_t pos = 0; - while (PyDict_Next($input, &pos, &key, &value)) { - std::string mk = PyString_AsString(key); - Batch::PyVersatile PyV = value; - PyV.setName(mk); - PM[mk] = PyV; - } - - $1 = &PM; // $1 est une reference donc on lui passe une adresse - } - catch (Batch::GenericException & ex) { - std::string msg = ex.type + " : " + ex.message; - PyErr_SetString(PyExc_RuntimeWarning, msg.c_str()); - return NULL; - } - catch (...) { - PyErr_SetString(PyExc_RuntimeWarning, "unknown exception"); - return NULL; - } -} - - -# // construction d'un objet Parametre C++ a partir d'un dictionnaire Python -%typemap(in) Batch::Parametre (Batch::Parametre PM) -{ - if (!PyDict_Check($input)) { - PyErr_SetString(PyExc_ValueError,"Expected a dictionnary"); - return NULL; - } - - try { - // on itere sur toutes les clefs du dictionnaire, et on passe par la classe PyVersatile - // qui convertit un Versatile en PyObject et vice versa - PyObject *key, *value; - Py_ssize_t pos = 0; - while (PyDict_Next($input, &pos, &key, &value)) { - std::string mk = PyString_AsString(key); - Batch::PyVersatile PyV = value; - PyV.setName(mk); - PM[mk] = PyV; - } - - $1 = PM; - } - catch (Batch::GenericException & ex) { - std::string msg = ex.type + " : " + ex.message; - PyErr_SetString(PyExc_RuntimeWarning, msg.c_str()); - return NULL; - } - catch (...) { - PyErr_SetString(PyExc_RuntimeWarning, "unknown exception"); - return NULL; - } -} - -%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) Batch::Environnement -{ - $1 = PyDict_Check($input)? 1 : 0; -} - -# // construction d'un dictionnaire Python a partir d'un objet Environnement C++ -%typemap(out) Batch::Environnement -{ - $result = PyDict_New(); - - // on itere sur toutes les clefs de la map - for(Batch::Environnement::const_iterator it=$1.begin(); it!=$1.end(); it++) { - std::string key = (*it).first; - std::string val = (*it).second; - PyDict_SetItem($result, - PyString_FromString(key.c_str()), - PyString_FromString(val.c_str())); - } -} - - -# // construction d'un objet Environnement C++ a partir d'un dictionnaire Python -%typemap(in) Batch::Environnement & (Batch::Environnement E) -{ - if (!PyDict_Check($input)) { - PyErr_SetString(PyExc_ValueError,"Expected a dictionnary"); - return NULL; - } - - // on itere sur toutes les clefs du dictionnaire - PyObject *key, *value; - Py_ssize_t pos = 0; - while (PyDict_Next($input, &pos, &key, &value)) { - std::string mk = PyString_AsString(key); - std::string val = PyString_AsString(value); - E[mk] = val; - } - - $1 = &E; // $1 est une reference donc on lui passe une adresse -} - - - -# // construction d'un objet Environnement C++ a partir d'un dictionnaire Python -%typemap(in) Batch::Environnement (Batch::Environnement E) -{ - if (!PyDict_Check($input)) { - PyErr_SetString(PyExc_ValueError,"Expected a dictionnary"); - return NULL; - } - - // on itere sur toutes les clefs du dictionnaire - PyObject *key, *value; - Py_ssize_t pos = 0; - while (PyDict_Next($input, &pos, &key, &value)) { - std::string mk = PyString_AsString(key); - std::string val = PyString_AsString(value); - E[mk] = val; - } - - $1 = E; -} - - - -# // construction d'une string Python a partir d'une string STL -%typemap(python,out) std::string -{ - $result = PyString_FromString($1.c_str()); -} - - - -# // construction d'une string STL a partir d'une string Python -#%typemap(in) string & (string S) -#{ -## if (!PyString_Check($input)) { -# PyErr_SetString(PyExc_ValueError,"Expected a string"); -# return NULL; -# } -# -# S = string(PyString_AsString($input)); -# $1 = &S; // $1 est une reference donc on lui passe une adresse -#} - - - -# // construction d'une string STL a partir d'une string Python -#%typemap(in) string (string S) -#{ -## if (!PyString_Check($input)) { -# PyErr_SetString(PyExc_ValueError,"Expected a string"); -# return NULL; -# } -# -# S = string(PyString_AsString($input)); -# $1 = S; -#} diff --git a/src/Communication/Makefile.am b/src/Communication/Makefile.am index 936d52524..53acb4558 100644 --- a/src/Communication/Makefile.am +++ b/src/Communication/Makefile.am @@ -50,7 +50,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/Communication_SWIG/Makefile.am b/src/Communication_SWIG/Makefile.am index 48ef7c401..4b2074d20 100644 --- a/src/Communication_SWIG/Makefile.am +++ b/src/Communication_SWIG/Makefile.am @@ -64,7 +64,6 @@ _libSALOME_Comm_la_CPPFLAGS =\ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index eca25186b..66d3cd22a 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -67,7 +67,7 @@ bool Engines_Component_i::_isMultiInstance = false; */ //============================================================================= -Engines_Component_i::Engines_Component_i():_myConnexionToRegistry(0), _notifSupplier(0) +Engines_Component_i::Engines_Component_i():_myConnexionToRegistry(0), _notifSupplier(0), _id(0) { //ASSERT(0); MESSAGE("Default Constructor, not for normal use..."); @@ -88,10 +88,10 @@ Engines_Component_i::Engines_Component_i():_myConnexionToRegistry(0), _notifSupp //============================================================================= Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName, bool notif, bool regist ) : _instanceName(instanceName), @@ -104,6 +104,8 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, _graphName("") , _nodeName(""), _studyId(-1), + _id(0), + _contId(0), _CanceledThread(false) { MESSAGE("Component constructor with instanceName "<< _instanceName); @@ -154,21 +156,14 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, _graphName("") , _nodeName(""), _studyId(-1), + _id(0), + _contId(0), _CanceledThread(false) { MESSAGE("Component constructor with instanceName "<< _instanceName); _orb = CORBA::ORB::_duplicate(orb); _poa = PortableServer::POA::_duplicate(poa); _container=Engines::Container::_duplicate(container); - try - { - _contId=_poa->reference_to_id(container); - } - catch(PortableServer::POA::WrongAdapter) - { - //not created by this poa - _contId = 0; - } const CORBA::String_var ior = _orb->object_to_string(_container); if(regist) _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str()); @@ -189,7 +184,11 @@ Engines_Component_i::~Engines_Component_i() MESSAGE("Component destructor"); Engines_Container_i::decInstanceCnt(_interfaceName); if(_myConnexionToRegistry)delete _myConnexionToRegistry; + _myConnexionToRegistry = 0 ; if(_notifSupplier)delete _notifSupplier; + _notifSupplier = 0; + if(_id) delete _id; + _id=0; } //============================================================================= @@ -259,17 +258,11 @@ void Engines_Component_i::ping() void Engines_Component_i::destroy() { MESSAGE("Engines_Component_i::destroy()"); - //SCRUTE(pd_refCount); - - if(_myConnexionToRegistry)delete _myConnexionToRegistry; - _myConnexionToRegistry = 0 ; - if(_notifSupplier)delete _notifSupplier; - _notifSupplier = 0; - if(_id) - delete(_id) ; - //SCRUTE(pd_refCount); - _thisObj->_remove_ref(); - //SCRUTE(pd_refCount); + //SCRUTE(_refcount_value()); + _poa->deactivate_object(*_id); + //SCRUTE(_refcount_value()); + _remove_ref(); + //SCRUTE(_refcount_value()); MESSAGE("Engines_Component_i::destroyed") ; } @@ -448,17 +441,17 @@ bool Engines_Component_i::Suspend_impl() #endif { if ( _Sleeping ) - { - return false ; - } + { + return false ; + } else { #ifndef WIN32 - RetVal = Killer( _ThreadId ,SIGINT ) ; + RetVal = Killer( _ThreadId ,SIGINT ) ; #else - RetVal = Killer( *_ThreadId ,SIGINT ) ; + RetVal = Killer( *_ThreadId ,SIGINT ) ; #endif - //if ( RetVal ) _Sleeping = true; + //if ( RetVal ) _Sleeping = true; } } @@ -495,12 +488,12 @@ bool Engines_Component_i::Resume_impl() { if ( _Sleeping ) { - _Sleeping = false ; - RetVal = true ; + _Sleeping = false ; + RetVal = true ; } else { - RetVal = false ; + RetVal = false ; } } return RetVal ; @@ -524,35 +517,35 @@ CORBA::Long Engines_Component_i::CpuUsed_impl() #else if ( pthread_self().p != _ThreadId->p ) #endif - { + { if ( _Sleeping ) - { - } + { + } else - { - // Get Cpu in the appropriate thread with that object !... - theEngines_Component = this ; + { + // Get Cpu in the appropriate thread with that object !... + theEngines_Component = this ; #ifndef WIN32 - Killer( _ThreadId ,SIGUSR1 ) ; + Killer( _ThreadId ,SIGUSR1 ) ; #else - Killer( *_ThreadId ,SIGUSR11 ) ; + Killer( *_ThreadId ,SIGUSR11 ) ; #endif - } + } cpu = _ThreadCpuUsed ; - } + } else - { - _ThreadCpuUsed = CpuUsed() ; - cpu = _ThreadCpuUsed ; - // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl " - // << _serviceName << " " << cpu << endl ; + { + _ThreadCpuUsed = CpuUsed() ; + cpu = _ThreadCpuUsed ; + // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl " + // << _serviceName << " " << cpu << endl ; } } else { - cpu = _ThreadCpuUsed ; - // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl " - // << _serviceName << " " << cpu<< endl ; + cpu = _ThreadCpuUsed ; + // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl " + // << _serviceName << " " << cpu<< endl ; } } else @@ -572,7 +565,8 @@ CORBA::Long Engines_Component_i::CpuUsed_impl() Engines_Container_i *Engines_Component_i::GetContainerPtr() { - return dynamic_cast(_poa->id_to_servant(*_contId)) ; + PortableServer::ObjectId_var contId=_poa->reference_to_id(_container); + return dynamic_cast(_poa->id_to_servant(contId)) ; } //============================================================================= @@ -621,13 +615,8 @@ PortableServer::ObjectId * Engines_Component_i::getId() void Engines_Component_i::beginService(const char *serviceName) { -#ifndef WIN32 - MESSAGE(pthread_self() << "Send BeginService notification for " <::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: "<>= value; + std::string s(cle); + s+='='; + s+=value; + putenv((char *)s.c_str()); + MESSAGE("--- setenv: "<name(); + std::string name(containerName); + name.erase(0,12); + string::size_type slash =name.find_first_of('/'); + if(slash != std::string::npos) + name[slash]='_'; + return name; +} diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index 065c5b4b5..f7124ac82 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -83,6 +83,11 @@ map Engines_Container_i::_library_map; map Engines_Container_i::_toRemove_map; omni_mutex Engines_Container_i::_numInstanceMutex ; +static PyObject* _pyCont; + +int checkifexecutable(const std::string&); +int findpathof(std::string&, const std::string&); + /*! \class Engines_Container_i * \brief C++ implementation of Engines::Container interface * @@ -191,14 +196,7 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, if (!_isSupervContainer) { -#ifdef WIN32 - - PyEval_AcquireLock(); - PyThreadState *myTstate = PyThreadState_New(KERNEL_PYTHON::_interp); - PyThreadState *myoldTstate = PyThreadState_Swap(myTstate); -#else - Py_ACQUIRE_NEW_THREAD; -#endif + PyGILState_STATE gstate = PyGILState_Ensure(); #ifdef WIN32 // mpv: this is temporary solution: there is a unregular crash if not @@ -210,7 +208,11 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, #endif PyRun_SimpleString("import SALOME_Container\n"); PyRun_SimpleString((char*)myCommand.c_str()); - Py_RELEASE_NEW_THREAD; + PyObject *mainmod = PyImport_AddModule("__main__"); + PyObject *globals = PyModule_GetDict(mainmod); + _pyCont = PyDict_GetItemString(globals, "pyCont"); + + PyGILState_Release(gstate); } fileTransfer_i* aFileTransfer = new fileTransfer_i(); @@ -350,11 +352,10 @@ void Engines_Container_i::Shutdown() // ignore this entry and continue } } + _listInstances_map.clear(); _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..."); @@ -404,8 +405,8 @@ int findpathof(string& pth, const string& exe) { string path( getenv("PATH") ); if ( path.size() == 0 ) - return 0; - + return 0; + char path_spr = #ifdef WIN32 ';'; @@ -519,9 +520,11 @@ Engines_Container_i::load_component_Library(const char* componentName) return true; } + std::string retso=""; #ifndef WIN32 void* handle; handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ; + if ( !handle )retso=dlerror(); #else HINSTANCE handle; handle = LoadLibrary( impl_name.c_str() ); @@ -538,6 +541,7 @@ Engines_Container_i::load_component_Library(const char* componentName) // --- try import Python component INFOS("try import Python component "<(_poa->reference_to_servant(iobject)); ASSERT(servant); - //SCRUTE(servant->pd_refCount); - servant->_remove_ref(); // compensate previous id_to_reference - //SCRUTE(servant->pd_refCount); + //SCRUTE(servant->_refcount_value()); _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); -#if defined(_DEBUG_) || defined(_DEBUG) - bool ret_studyId = servant->setStudyId(studyId); - ASSERT(ret_studyId); -#else servant->setStudyId(studyId); -#endif + servant->_remove_ref(); // do not need servant any more (remove ref from reference_to_servant) + //SCRUTE(servant->_refcount_value()); // --- register the engine under the name // containerName(.dir)/instanceName(.object) @@ -1243,6 +1238,7 @@ void ActSigIntHandler() #ifndef WIN32 struct sigaction SigIntAct ; SigIntAct.sa_sigaction = &SigIntHandler ; + sigemptyset(&SigIntAct.sa_mask); SigIntAct.sa_flags = SA_SIGINFO ; #endif @@ -1415,3 +1411,49 @@ void Engines_Container_i::copyFile(Engines::Container_ptr container, const char* } } +/*! \brief create a PyNode object to execute remote python code + * \param nodeName the name of the node + * \param code the python code to load + * \return the PyNode + */ +Engines::PyNode_ptr Engines_Container_i::createPyNode(const char* nodeName, const char* code) +{ + Engines::PyNode_var node= Engines::PyNode::_nil(); + + PyGILState_STATE gstate = PyGILState_Ensure(); + PyObject *res = PyObject_CallMethod(_pyCont, + (char*)"create_pynode", + (char*)"ss", + nodeName, + code); + if(res==NULL) + { + //internal error + PyErr_Print(); + PyGILState_Release(gstate); + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = "can not create a python node"; + throw SALOME::SALOME_Exception(es); + } + long ierr=PyInt_AsLong(PyTuple_GetItem(res,0)); + PyObject* result=PyTuple_GetItem(res,1); + std::string astr=PyString_AsString(result); + Py_DECREF(res); + PyGILState_Release(gstate); + + if(ierr==0) + { + CORBA::Object_var obj = _orb->string_to_object(astr.c_str()); + node = Engines::PyNode::_narrow(obj); + return node._retn(); + } + else + { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + es.text = astr.c_str(); + throw SALOME::SALOME_Exception(es); + } + +} diff --git a/src/Container/Makefile.am b/src/Container/Makefile.am index 9c6bffe17..c3a870cbe 100644 --- a/src/Container/Makefile.am +++ b/src/Container/Makefile.am @@ -46,6 +46,7 @@ salomeinclude_HEADERS = \ # Scripts to be installed dist_salomescript_PYTHON =\ SALOME_ComponentPy.py \ + SALOME_PyNode.py \ SALOME_Container.py # These files are executable scripts @@ -62,7 +63,6 @@ dist_salomescript_SCRIPTS=\ COMMON_CPPFLAGS=\ @PYTHON_INCLUDES@ \ @HDF5_INCLUDES@ \ - -I$(srcdir)/../Batch \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ @@ -71,7 +71,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Notification \ -I$(srcdir)/../ResourcesManager \ -I$(srcdir)/../HDFPersist \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@ @@ -86,7 +85,6 @@ COMMON_LIBS =\ ../SALOMELocalTrace/libSALOMELocalTrace.la \ ../Basics/libSALOMEBasics.la \ ../HDFPersist/libSalomeHDFPersist.la \ - ../Batch/libSalomeBatch.la \ $(top_builddir)/idl/libSalomeIDLKernel.la \ @CORBA_LIBS@ \ $(PYTHON_LIBS) diff --git a/src/Container/SALOME_ComponentPy.py b/src/Container/SALOME_ComponentPy.py index 1d5722ad9..ca42cc60b 100755 --- a/src/Container/SALOME_ComponentPy.py +++ b/src/Container/SALOME_ComponentPy.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -36,7 +37,7 @@ import sys import time import string import signal -from omniORB import CORBA, PortableServer +from omniORB import CORBA, PortableServer, any import Engines, Engines__POA import Registry from Utils_Identity import * @@ -151,16 +152,14 @@ class SALOME_ComponentPy_i (Engines__POA.Component): def destroy(self): MESSAGE( "SALOME_ComponentPy_i::destroy" ) - #id = self._poa.servant_to_id(self) - #self._poa.deactivate_object(id) + id = self._poa.servant_to_id(self) + self._poa.deactivate_object(id) return #------------------------------------------------------------------------- def GetContainerRef(self): MESSAGE( "SALOME_ComponentPy_i::GetContainerRef" ) - #corbaObj_ptr = self._poa.id_to_reference(self._contId) - #return corbaObj_ptr._narrow(Engines.Container) return self._contId._narrow(Engines.Container) #------------------------------------------------------------------------- @@ -174,7 +173,13 @@ class SALOME_ComponentPy_i (Engines__POA.Component): self._StartUsed = self.CpuUsed_impl() self._ThreadCpuUsed = 0 self._Executed = 1 + print "beginService for ",serviceName," Component instance : ",self._instanceName MESSAGE( "SALOME_ComponentPy_i::beginService _StartUsed " + str( self._ThreadId ) + " " + str( self._StartUsed ) ) + for e in self._fieldsDict: + key=e.key + value=any.from_any(e.value) + if isinstance(value,str): + os.environ[key]=value #------------------------------------------------------------------------- @@ -182,6 +187,8 @@ class SALOME_ComponentPy_i (Engines__POA.Component): def endService(self , serviceName ): MESSAGE( "Send EndService notification for " + str( self._ThreadId ) + " " + str(serviceName) + " for graph/node " + str(self._graphName) + " " + str(self._nodeName) + " CpuUsed " + str( self.CpuUsed_impl() ) ) MESSAGE( "Component instance : " + str(self._instanceName) ) + print "endService for",serviceName,"Component instance :",self._instanceName,"Cpu Used:",self.CpuUsed_impl()," (s) " + #------------------------------------------------------------------------- @@ -276,7 +283,7 @@ class SALOME_ComponentPy_i (Engines__POA.Component): if ( self._ThreadId | self._Executed ) : if self._ThreadId == get_ident() : cpu = time.clock() - self._ThreadCpuUsed = int(cpu) - self._StartUsed + self._ThreadCpuUsed = cpu - self._StartUsed MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl " + self._serviceName + " " + str( int(cpu) ) + " - " + str( self._StartUsed ) + " = " + str( self._ThreadCpuUsed ) ) return self._ThreadCpuUsed MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl " + self._serviceName + " " + str( self._ThreadCpuUsed ) ) @@ -288,7 +295,7 @@ class SALOME_ComponentPy_i (Engines__POA.Component): def DumpPython(self, theStudy, isPublished): aBuffer = "def RebuildData(theStudy): pass\n\0" - return (aBuffer, 1) + return (aBuffer, 1) #------------------------------------------------------------------------- @@ -298,7 +305,7 @@ class SALOME_ComponentPy_i (Engines__POA.Component): #------------------------------------------------------------------------- def hasObjectInfo(self): - return 0 + return 0 #------------------------------------------------------------------------- diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index 2285e5f4d..652f637a7 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -55,18 +55,18 @@ class CONTAINER_EXPORT Engines_Component_i: public: Engines_Component_i(); Engines_Component_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName, bool notif = false, bool regist = true); //Constructor for standalone component Engines_Component_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - Engines::Container_ptr container, - const char *instanceName, - const char *interfaceName, + PortableServer::POA_ptr poa, + Engines::Container_ptr container, + const char *instanceName, + const char *interfaceName, bool notif = false, bool regist = true); @@ -119,8 +119,9 @@ public: PortableServer::ObjectId * getId(); Engines_Container_i *GetContainerPtr(); + std::string getContainerName(); - bool setStudyId(CORBA::Long studyId); + virtual bool setStudyId(CORBA::Long studyId); static bool isMultiStudy(); static bool isMultiInstance(); static std::string GetDynLibraryName(const char *componentName); diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index cdcfc64a9..c4a1e0dba 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -200,7 +200,10 @@ int main(int argc, char* argv[]) if (!isSupervContainer) { PyGILState_Ensure(); - //Delete python container that destroy orb from python (pyCont._orb.destroy()) + //Destroy orb from python (for chasing memory leaks) + //PyRun_SimpleString("from omniORB import CORBA"); + //PyRun_SimpleString("orb=CORBA.ORB_init([''], CORBA.ORB_ID)"); + //PyRun_SimpleString("orb.destroy()"); Py_Finalize(); } else @@ -235,9 +238,6 @@ int main(int argc, char* argv[]) #endif #endif - //END_OF(argv[0]); - //LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); - //bp1->deleteInstance(bp1); return 0 ; } diff --git a/src/Container/SALOME_Container.py b/src/Container/SALOME_Container.py index 1a92f6b54..df05365d5 100644 --- a/src/Container/SALOME_Container.py +++ b/src/Container/SALOME_Container.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -34,11 +35,13 @@ import os import sys import string +import traceback from omniORB import CORBA, PortableServer import SALOMEDS import Engines, Engines__POA from SALOME_NamingServicePy import * from SALOME_ComponentPy import * +import SALOME_PyNode from SALOME_utilities import * from Utils_Identity import getShortHostName @@ -46,7 +49,7 @@ from launchConfigureParser import verbose #============================================================================= -#define an implementation of the container interface +#define an implementation of the container interface for embedding in Container implemented in C++ class SALOME_Container_i: _orb = None @@ -67,20 +70,17 @@ class SALOME_Container_i: #------------------------------------------------------------------------- - #def __del__(self ): - # self._orb.destroy() - def import_component(self, componentName): MESSAGE( "SALOME_Container_i::import_component" ) - ret=0 + ret="" try: if verbose(): print "try import ",componentName __import__(componentName) if verbose(): print "import ",componentName," successful" - ret=1 except: + import traceback + ret=traceback.format_exc(10) if verbose(): - import traceback traceback.print_exc() print "import ",componentName," not possible" return ret @@ -110,3 +110,14 @@ class SALOME_Container_i: return comp_iors + def create_pynode(self,nodeName,code): + try: + node=SALOME_PyNode.PyNode_i(nodeName,code,self._poa) + id_o = self._poa.activate_object(node) + comp_o = self._poa.id_to_reference(id_o) + comp_iors = self._orb.object_to_string(comp_o) + return 0,comp_iors + except: + exc_typ,exc_val,exc_fr=sys.exc_info() + l=traceback.format_exception(exc_typ,exc_val,exc_fr) + return 1,"".join(l) diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 0ac18204f..8afbc5f2f 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -31,7 +31,6 @@ #endif #include #include "Utils_CorbaException.hxx" -#include "Batch_Date.hxx" #include #ifdef WITH_PACO_PARALLEL @@ -81,6 +80,21 @@ SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableSer _NS->Register(refContMan,_ContainerManagerNameInNS); _isAppliSalomeDefined = (getenv("APPLI") != 0); + +#ifdef HAVE_MPI2 +#ifdef WITHOPENMPI + if( getenv("OMPI_URI_FILE") != NULL ){ + system("killall ompi-server"); + string command; + command = "ompi-server -r "; + command += getenv("OMPI_URI_FILE"); + int status=system(command.c_str()); + if(status!=0) + throw SALOME_Exception("Error when launching ompi-server"); + } +#endif +#endif + MESSAGE("constructor end"); } @@ -93,6 +107,12 @@ SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableSer SALOME_ContainerManager::~SALOME_ContainerManager() { MESSAGE("destructor"); +#ifdef HAVE_MPI2 +#ifdef WITHOPENMPI + if( getenv("OMPI_URI_FILE") != NULL ) + system("killall ompi-server"); +#endif +#endif } //============================================================================= @@ -147,28 +167,28 @@ void SALOME_ContainerManager::ShutdownContainers() { try { - 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)); + 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)); } catch(CORBA::SystemException& e) { - INFOS("CORBA::SystemException ignored : " << e); + INFOS("CORBA::SystemException ignored : " << e); } catch(CORBA::Exception&) { - INFOS("CORBA::Exception ignored."); + INFOS("CORBA::Exception ignored."); } catch(...) { - INFOS("Unknown exception ignored."); + INFOS("Unknown exception ignored."); } } } @@ -273,7 +293,11 @@ SALOME_ContainerManager::StartContainer(const Engines::MachineParameters& params //check if an entry exists in Naming service //if params.mode == "start" or "" shutdown the existing container before launching a new one with that name //if params.mode == "getorstart" or "get" use the existing container - containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str()); + if(params.isMPI) + // A parallel container register on zero node in NS + containerNameInNS = _NS->BuildContainerNameForNS(params,GetMPIZeroNode(theMachine).c_str()); + else + containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str()); SCRUTE(containerNameInNS); CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str()); @@ -287,7 +311,10 @@ SALOME_ContainerManager::StartContainer(const Engines::MachineParameters& params if(std::string(params.mode.in())=="getorstart"||std::string(params.mode.in())=="get") return cont._retn(); /* the container exists and params.mode is getorstart or get use it*/ else - cont->Shutdown(); // shutdown the registered container if it exists + { + INFOS("A container is already registered with the name: " << containerNameInNS << ", shutdown the existing container"); + cont->Shutdown(); // shutdown the registered container if it exists + } } } catch(CORBA::Exception&) @@ -310,8 +337,29 @@ SALOME_ContainerManager::StartContainer(const Engines::MachineParameters& params command = BuildCommandToLaunchRemoteContainer(theMachine,params,container_exe); //redirect stdout and stderr in a file - string logFilename="/tmp/"+_NS->ContainerName(params)+"_"+ theMachine +"_"+getenv( "USER" )+".log" ; - command += " > " + logFilename + " 2>&1 &"; +#ifdef WNT + string logFilename=getenv("TEMP"); + logFilename += "\\"; +#else + string logFilename="/tmp"; + char* val = getenv("SALOME_TMP_DIR"); + if(val) + { + struct stat file_info; + stat(val, &file_info); + bool is_dir = S_ISDIR(file_info.st_mode); + if (is_dir)logFilename=val; + else std::cerr << "SALOME_TMP_DIR environment variable is not a directory use /tmp instead" << std::endl; + } + logFilename += "/"; +#endif + logFilename += _NS->ContainerName(params)+"_"+ theMachine +"_"+getenv( "USER" )+".log" ; + command += " > " + logFilename + " 2>&1"; +#ifdef WNT + command = "%PYTHONBIN% -c \"import win32pm ; win32pm.spawnpid(r'" + command + "', '')\""; +#else + command += " &"; +#endif // launch container with a system call int status=system(command.c_str()); @@ -599,12 +647,12 @@ SALOME_ContainerManager::StartParallelContainer(const Engines::MachineParameters // Il faut tuer le proxy try { - Engines::Container_var proxy = Engines::Container::_narrow(container_proxy); - proxy->Shutdown(); + Engines::Container_var proxy = Engines::Container::_narrow(container_proxy); + proxy->Shutdown(); } catch (...) { - INFOS("[StartParallelContainer] Exception catched from proxy Shutdown..."); + INFOS("[StartParallelContainer] Exception catched from proxy Shutdown..."); } return ret; } @@ -622,34 +670,34 @@ SALOME_ContainerManager::StartParallelContainer(const Engines::MachineParameters obj = _NS->Resolve(containerNameInNS.c_str()); if (CORBA::is_nil(obj)) { - INFOS("[StartParallelContainer] CONNECTION FAILED From Naming Service !"); - INFOS("[StartParallelContainer] Container name is " << containerNameInNS); - return ret; + INFOS("[StartParallelContainer] CONNECTION FAILED From Naming Service !"); + INFOS("[StartParallelContainer] Container name is " << containerNameInNS); + return ret; } try { - MESSAGE("[StartParallelContainer] Deploying node : " << container_node_name); - PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj); - node->deploy(); - MESSAGE("[StartParallelContainer] node " << container_node_name << " is deployed"); + MESSAGE("[StartParallelContainer] Deploying node : " << container_node_name); + PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj); + node->deploy(); + MESSAGE("[StartParallelContainer] node " << container_node_name << " is deployed"); } catch(CORBA::SystemException& e) { - INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS); - INFOS("CORBA::SystemException : " << e); - return ret; + INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS); + INFOS("CORBA::SystemException : " << e); + return ret; } catch(CORBA::Exception& e) { - INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS); - INFOS("CORBA::Exception" << e); - return ret; + INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS); + INFOS("CORBA::Exception" << e); + return ret; } catch(...) { - INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS); - INFOS("Unknown exception !"); - return ret; + INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS); + INFOS("Unknown exception !"); + return ret; } } @@ -715,9 +763,9 @@ SALOME_ContainerManager::StartParallelContainer(const Engines::MachineParameters //============================================================================= CORBA::Object_ptr SALOME_ContainerManager::LaunchParallelContainer(const std::string& command, - const Engines::MachineParameters& params, - const std::string& name, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine) + const Engines::MachineParameters& params, + const std::string& name, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine) { CORBA::Object_ptr obj = CORBA::Object::_nil(); std::string containerNameInNS; @@ -768,17 +816,17 @@ SALOME_ContainerManager::LaunchParallelContainer(const std::string& command, INFOS("[LaunchParallelContainer] Waiting for Parallel Container node " << containerNameInNS << " on " << theMachine); while (CORBA::is_nil(obj) && count) { #ifndef WIN32 - sleep(1) ; + sleep(1) ; #else - Sleep(1000); + Sleep(1000); #endif - count-- ; - obj = _NS->Resolve(containerNameInNS.c_str()); + count-- ; + obj = _NS->Resolve(containerNameInNS.c_str()); } if (CORBA::is_nil(obj)) { - INFOS("[LaunchParallelContainer] Launch of node failed (or not found) !"); - return obj; + INFOS("[LaunchParallelContainer] Launch of node failed (or not found) !"); + return obj; } } } @@ -851,7 +899,7 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer { string command; int nbproc; - + if ( ! _isAppliSalomeDefined ) command = BuildTempFileToLaunchRemoteContainer(machine, params); @@ -882,21 +930,21 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer throw SALOME_Exception("Unknown protocol"); if (resInfo.UserName != "") - { - command += resInfo.UserName; - command += "@"; - } + { + command += resInfo.UserName; + command += "@"; + } command += machine; command += " "; if (resInfo.AppliPath != "") - command += resInfo.AppliPath; // path relative to user@machine $HOME + command += resInfo.AppliPath; // path relative to user@machine $HOME else - { - ASSERT(getenv("APPLI")); - command += getenv("APPLI"); // path relative to user@machine $HOME - } + { + ASSERT(getenv("APPLI")); + command += getenv("APPLI"); // path relative to user@machine $HOME + } command += "/runRemote.sh "; @@ -919,23 +967,23 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer } if(params.isMPI) - { - command += " mpirun -np "; - std::ostringstream o; - o << nbproc << " "; - command += o.str(); + { + command += " mpirun -np "; + std::ostringstream o; + o << nbproc << " "; + command += o.str(); #ifdef WITHLAM - command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace "; + command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace "; #elif defined(WITHOPENMPI) - if( getenv("OMPI_URI_FILE") == NULL ) - command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; - else{ - command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; - command += getenv("OMPI_URI_FILE"); - } -#endif - command += " SALOME_MPIContainer "; - } + if( getenv("OMPI_URI_FILE") == NULL ) + command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; + else{ + command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; + command += getenv("OMPI_URI_FILE"); + } +#endif + command += " SALOME_MPIContainer "; + } else command += " " +container_exe+ " "; @@ -991,7 +1039,7 @@ SALOME_ContainerManager::BuildCommandToLaunchLocalContainer #elif defined(WITHOPENMPI) //command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace "; if( getenv("OMPI_URI_FILE") == NULL ) - command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; + command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; else { command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; @@ -1197,10 +1245,10 @@ SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer tempOutputFile << "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace "; #elif defined(WITHOPENMPI) if( getenv("OMPI_URI_FILE") == NULL ) - tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; + tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; else{ - tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; - tempOutputFile << getenv("OMPI_URI_FILE"); + tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; + tempOutputFile << getenv("OMPI_URI_FILE"); } #endif } @@ -1283,9 +1331,9 @@ SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer //============================================================================= string SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string& exe_name, - const Engines::MachineParameters& params, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine, - const std::string proxy_hostname) + const Engines::MachineParameters& params, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine, + const std::string proxy_hostname) { // 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 @@ -1338,14 +1386,14 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string if (is_a_proxy) { machine_file_name = _ResManager->getMachineFile(hostname, - 1, - parallelLib); + 1, + parallelLib); } else { machine_file_name = _ResManager->getMachineFile(hostname, - params.nb_component_nodes, - parallelLib); + params.nb_component_nodes, + parallelLib); } if (machine_file_name == "") { @@ -1393,32 +1441,32 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string std::string command_remote(""); if (remote) { - std::string machine_name; - std::ifstream machine_file(machine_file_name.c_str()); - std::getline(machine_file, machine_name); - MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name) - - // We want to launch a command like : - // ssh user@machine distantPath/runRemote.sh hostNS portNS - const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name); - if (resInfo.Protocol == rsh) - command_remote = "rsh "; - else - command_remote = "ssh "; - command_remote += resInfo.UserName; - command_remote += "@"; - command_remote += machine_name; - command_remote += " "; - command_remote += resInfo.AppliPath; // path relative to user@machine $HOME - command_remote += "/runRemote.sh "; - ASSERT(getenv("NSHOST")); - command_remote += getenv("NSHOST"); // hostname of CORBA name server - command_remote += " "; - ASSERT(getenv("NSPORT")); - command_remote += getenv("NSPORT"); // port of CORBA name server - command_remote += " "; - - hostname = machine_name; + std::string machine_name; + std::ifstream machine_file(machine_file_name.c_str()); + std::getline(machine_file, machine_name); + MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name) + + // We want to launch a command like : + // ssh user@machine distantPath/runRemote.sh hostNS portNS + const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name); + if (resInfo.Protocol == rsh) + command_remote = "rsh "; + else + command_remote = "ssh "; + command_remote += resInfo.UserName; + command_remote += "@"; + command_remote += machine_name; + command_remote += " "; + command_remote += resInfo.AppliPath; // path relative to user@machine $HOME + command_remote += "/runRemote.sh "; + ASSERT(getenv("NSHOST")); + command_remote += getenv("NSHOST"); // hostname of CORBA name server + command_remote += " "; + ASSERT(getenv("NSPORT")); + command_remote += getenv("NSPORT"); // port of CORBA name server + command_remote += " "; + + hostname = machine_name; } command = real_exe_name; @@ -1436,63 +1484,63 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string { std::ifstream * machine_file = NULL; if (remote) - machine_file = new std::ifstream(machine_file_name.c_str()); + machine_file = new std::ifstream(machine_file_name.c_str()); for (int i= 0; i < nb_nodes; i++) { - std::string command_remote(""); - if (remote) - { - std::string machine_name; - std::getline(*machine_file, machine_name); - MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name) - - // We want to launch a command like : - // ssh user@machine distantPath/runRemote.sh hostNS portNS - const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name); - if (resInfo.Protocol == rsh) - command_remote = "rsh "; - else - command_remote = "ssh "; - command_remote += resInfo.UserName; - command_remote += "@"; - command_remote += machine_name; - command_remote += " "; - command_remote += resInfo.AppliPath; // path relative to user@machine $HOME - command_remote += "/runRemote.sh "; - ASSERT(getenv("NSHOST")); - command_remote += getenv("NSHOST"); // hostname of CORBA name server - command_remote += " "; - ASSERT(getenv("NSPORT")); - command_remote += getenv("NSPORT"); // port of CORBA name server - command_remote += " "; - - hostname = machine_name; - } - - std::ostringstream tmp; - tmp << i; - std::string proc_number = tmp.str(); - - std::string command_tmp(""); - command_tmp += real_exe_name; - command_tmp += " " + _NS->ContainerName(rtn); - command_tmp += " " + parallelLib; - command_tmp += " " + proxy_hostname; - command_tmp += " " + proc_number; - command_tmp += " -"; - AddOmninamesParams(command_tmp); - - // On change _Node_ par _Nodex_ pour avoir chaque noeud - // sur un fichier - std::string command_end_tmp = command_end; - std::string::size_type loc_node = command_end_tmp.find("_Node_"); - if (loc_node != std::string::npos) - command_end_tmp.insert(loc_node+5, proc_number); - command += command_begin + command_remote + command_tmp + command_end_tmp; - vect_machine.push_back(hostname); + std::string command_remote(""); + if (remote) + { + std::string machine_name; + std::getline(*machine_file, machine_name); + MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name) + + // We want to launch a command like : + // ssh user@machine distantPath/runRemote.sh hostNS portNS + const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name); + if (resInfo.Protocol == rsh) + command_remote = "rsh "; + else + command_remote = "ssh "; + command_remote += resInfo.UserName; + command_remote += "@"; + command_remote += machine_name; + command_remote += " "; + command_remote += resInfo.AppliPath; // path relative to user@machine $HOME + command_remote += "/runRemote.sh "; + ASSERT(getenv("NSHOST")); + command_remote += getenv("NSHOST"); // hostname of CORBA name server + command_remote += " "; + ASSERT(getenv("NSPORT")); + command_remote += getenv("NSPORT"); // port of CORBA name server + command_remote += " "; + + hostname = machine_name; + } + + std::ostringstream tmp; + tmp << i; + std::string proc_number = tmp.str(); + + std::string command_tmp(""); + command_tmp += real_exe_name; + command_tmp += " " + _NS->ContainerName(rtn); + command_tmp += " " + parallelLib; + command_tmp += " " + proxy_hostname; + command_tmp += " " + proc_number; + command_tmp += " -"; + AddOmninamesParams(command_tmp); + + // On change _Node_ par _Nodex_ pour avoir chaque noeud + // sur un fichier + std::string command_end_tmp = command_end; + std::string::size_type loc_node = command_end_tmp.find("_Node_"); + if (loc_node != std::string::npos) + command_end_tmp.insert(loc_node+5, proc_number); + command += command_begin + command_remote + command_tmp + command_end_tmp; + vect_machine.push_back(hostname); } if (machine_file) - delete machine_file; + delete machine_file; } } else if (parallelLib == "Mpi") @@ -1516,9 +1564,9 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string std::string command_remote(""); const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine); if (resInfo.Protocol == rsh) - command_remote = "rcp "; + command_remote = "rcp "; else - command_remote = "scp "; + command_remote = "scp "; command_remote += machine_file_name; command_remote += " "; @@ -1531,8 +1579,8 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string int status = system(command_remote.c_str()); if (status == -1) { - INFOS("copy of the mpi machine file failed !"); - return ""; + INFOS("copy of the mpi machine file failed !"); + return ""; } } @@ -1541,27 +1589,27 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string std::string command_remote(""); if (remote) { - // We want to launch a command like : - // ssh user@machine distantPath/runRemote.sh hostNS portNS - const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine); - if (resInfo.Protocol == rsh) - command_remote = "rsh "; - else - command_remote = "ssh "; - command_remote += resInfo.UserName; - command_remote += "@"; - command_remote += remote_machine; - command_remote += " "; - command_remote += resInfo.AppliPath; // path relative to user@machine $HOME - command_remote += "/runRemote.sh "; - ASSERT(getenv("NSHOST")); - command_remote += getenv("NSHOST"); // hostname of CORBA name server - command_remote += " "; - ASSERT(getenv("NSPORT")); - command_remote += getenv("NSPORT"); // port of CORBA name server - command_remote += " "; - - hostname = remote_machine; + // We want to launch a command like : + // ssh user@machine distantPath/runRemote.sh hostNS portNS + const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine); + if (resInfo.Protocol == rsh) + command_remote = "rsh "; + else + command_remote = "ssh "; + command_remote += resInfo.UserName; + command_remote += "@"; + command_remote += remote_machine; + command_remote += " "; + command_remote += resInfo.AppliPath; // path relative to user@machine $HOME + command_remote += "/runRemote.sh "; + ASSERT(getenv("NSHOST")); + command_remote += getenv("NSHOST"); // hostname of CORBA name server + command_remote += " "; + ASSERT(getenv("NSPORT")); + command_remote += getenv("NSPORT"); // port of CORBA name server + command_remote += " "; + + hostname = remote_machine; } // We use Dummy proxy for MPI parallel containers @@ -1582,61 +1630,61 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string std::string command_remote(""); if (remote) { - const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine); - if (resInfo.Protocol == rsh) - command_remote = "rsh "; - else - command_remote = "ssh "; - command_remote += resInfo.UserName; - command_remote += "@"; - command_remote += remote_machine; - command_remote += " "; - - std::string new_real_exe_name(""); - new_real_exe_name += resInfo.AppliPath; // path relative to user@machine $HOME - new_real_exe_name += "/runRemote.sh "; - ASSERT(getenv("NSHOST")); - new_real_exe_name += getenv("NSHOST"); // hostname of CORBA name server - new_real_exe_name += " "; - ASSERT(getenv("NSPORT")); - new_real_exe_name += getenv("NSPORT"); // port of CORBA name server - new_real_exe_name += " "; - - real_exe_name = new_real_exe_name + real_exe_name; - hostname = remote_machine; + const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine); + if (resInfo.Protocol == rsh) + command_remote = "rsh "; + else + command_remote = "ssh "; + command_remote += resInfo.UserName; + command_remote += "@"; + command_remote += remote_machine; + command_remote += " "; + + std::string new_real_exe_name(""); + new_real_exe_name += resInfo.AppliPath; // path relative to user@machine $HOME + new_real_exe_name += "/runRemote.sh "; + ASSERT(getenv("NSHOST")); + new_real_exe_name += getenv("NSHOST"); // hostname of CORBA name server + new_real_exe_name += " "; + ASSERT(getenv("NSPORT")); + new_real_exe_name += getenv("NSPORT"); // port of CORBA name server + new_real_exe_name += " "; + + real_exe_name = new_real_exe_name + real_exe_name; + hostname = remote_machine; } const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(hostname); if (resInfo.mpi == lam) { - command = "mpiexec -ssi boot "; - if (resInfo.Protocol == rsh) - command += "rsh "; - else - command += "ssh "; - command += "-machinefile " + machine_file_name + " "; - command += "-n " + nbproc + " "; - command += real_exe_name; - command += " " + _NS->ContainerName(rtn); - command += " " + parallelLib; - command += " " + proxy_hostname; - command += " -"; - AddOmninamesParams(command); + command = "mpiexec -ssi boot "; + if (resInfo.Protocol == rsh) + command += "rsh "; + else + command += "ssh "; + command += "-machinefile " + machine_file_name + " "; + command += "-n " + nbproc + " "; + command += real_exe_name; + command += " " + _NS->ContainerName(rtn); + command += " " + parallelLib; + command += " " + proxy_hostname; + command += " -"; + AddOmninamesParams(command); } else { - command = "mpirun -np " + nbproc + " "; - command += real_exe_name; - command += " " + _NS->ContainerName(rtn); - command += " " + parallelLib; - command += " " + proxy_hostname; - command += " -"; - AddOmninamesParams(command); + command = "mpirun -np " + nbproc + " "; + command += real_exe_name; + command += " " + _NS->ContainerName(rtn); + command += " " + parallelLib; + command += " " + proxy_hostname; + command += " -"; + AddOmninamesParams(command); } command = command_begin + command_remote + command + command_end; for (int i= 0; i < nb_nodes; i++) - vect_machine.push_back(proxy_hostname); + vect_machine.push_back(proxy_hostname); } } else diff --git a/src/Container/SALOME_ContainerManager.hxx b/src/Container/SALOME_ContainerManager.hxx index d5f4b2b2d..e401de3be 100644 --- a/src/Container/SALOME_ContainerManager.hxx +++ b/src/Container/SALOME_ContainerManager.hxx @@ -77,14 +77,14 @@ protected: void fillBatchLaunchedContainers(); std::string BuildCommandToLaunchRemoteContainer(const std::string& machine, - const Engines::MachineParameters& params, - const std::string& container_exe="SALOME_Container"); + const Engines::MachineParameters& params, + const std::string& container_exe="SALOME_Container"); std::string BuildCommandToLaunchLocalContainer(const Engines::MachineParameters& params, const std::string& container_exe="SALOME_Container"); std::string BuildTempFileToLaunchRemoteContainer(const std::string& machine, - const Engines::MachineParameters& params) throw(SALOME_Exception); + const Engines::MachineParameters& params) throw(SALOME_Exception); void RmTmpFile(std::string& tmpFile); @@ -99,14 +99,14 @@ protected: // For PacO++ Parallel extension typedef std::vector actual_launch_machine_t; std::string BuildCommandToLaunchParallelContainer(const std::string& exe_name, - const Engines::MachineParameters& params, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine, - const std::string proxy_hostname = ""); + const Engines::MachineParameters& params, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine, + const std::string proxy_hostname = ""); CORBA::Object_ptr LaunchParallelContainer(const std::string& command, - const Engines::MachineParameters& params, - const std::string& name, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine); + const Engines::MachineParameters& params, + const std::string& name, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine); CORBA::ORB_var _orb; PortableServer::POA_var _poa; diff --git a/src/Container/SALOME_ContainerPy.py b/src/Container/SALOME_ContainerPy.py index 955a1d8d9..d9a09cd49 100755 --- a/src/Container/SALOME_ContainerPy.py +++ b/src/Container/SALOME_ContainerPy.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -42,7 +43,7 @@ from launchConfigureParser import verbose #============================================================================= -#define an implementation of the container interface +#define an implementation of the container interface for the container implemented in Python class SALOME_ContainerPy_i (Engines__POA.Container): _orb = None @@ -58,7 +59,6 @@ class SALOME_ContainerPy_i (Engines__POA.Container): self._poa = poa myMachine=getShortHostName() Container_path = "/Containers/" + myMachine + "/" + containerName - #self._containerName = containerName self._containerName = Container_path if verbose(): print "container name ",self._containerName @@ -174,10 +174,9 @@ class SALOME_ContainerPy_i (Engines__POA.Container): if verbose(): print "import ",componentName," successful" ret=1 except: - if verbose(): - import traceback - traceback.print_exc() - print "import ",componentName," not possible" + import traceback + traceback.print_exc() + print "import ",componentName," not possible" return ret #------------------------------------------------------------------------- @@ -187,24 +186,6 @@ class SALOME_ContainerPy_i (Engines__POA.Container): ret = 0 instanceName = componentName + "_inst_" + `self._numInstance` interfaceName = componentName - #the_command = "import " + componentName + "\n" - #the_command = the_command + "comp_i = " + componentName + "." + componentName - #the_command = the_command + "(self._orb, self._poa, self._this(), self._containerName, instanceName, interfaceName)\n" - #MESSAGE( "SALOME_ContainerPy_i::load_component_Library :" + str (the_command) ) - #exec the_command - #comp_o = comp_i._this() - #if comp_o is not None: - # ret = 1 - #else: - # --- try to import Python component - # retImpl = self.import_component(componentName) - # if retImpl == 1: - #import is possible - # ret = 1 - # else: - #import isn't possible - # ret = 0 - #return ret return self.import_component(componentName) #------------------------------------------------------------------------- diff --git a/src/Container/SALOME_Container_i.hxx b/src/Container/SALOME_Container_i.hxx index 9dae83fb6..91d40f96f 100644 --- a/src/Container/SALOME_Container_i.hxx +++ b/src/Container/SALOME_Container_i.hxx @@ -32,6 +32,7 @@ #include #include CORBA_SERVER_HEADER(SALOME_Component) +#include CORBA_SERVER_HEADER(SALOME_PyNode) #include #include @@ -53,11 +54,11 @@ class CONTAINER_EXPORT Engines_Container_i: public: Engines_Container_i(); Engines_Container_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - char * containerName , + PortableServer::POA_ptr poa, + char * containerName , int argc, char* argv[], - bool activAndRegist = true, - bool isServantAloneInProcess = true); + bool activAndRegist = true, + bool isServantAloneInProcess = true); virtual ~Engines_Container_i(); // --- CORBA methods @@ -66,15 +67,15 @@ public: virtual Engines::Component_ptr create_component_instance( const char* componentName, - CORBA::Long studyId); // 0 for multiStudy + CORBA::Long studyId); // 0 for multiStudy Engines::Component_ptr find_component_instance( const char* registeredName, - CORBA::Long studyId); // 0 for multiStudy + CORBA::Long studyId); // 0 for multiStudy Engines::Component_ptr load_impl(const char* nameToRegister, - const char* componentName); + const char* componentName); void remove_impl(Engines::Component_ptr component_i); @@ -97,16 +98,17 @@ public: virtual Engines::Salome_file_ptr createSalome_file(const char* origFileName); void copyFile(Engines::Container_ptr container, const char* remoteFile, const char* localFile); + Engines::PyNode_ptr createPyNode(const char* nodeName, const char* code); // --- local C++ methods Engines::Component_ptr find_or_create_instance( std::string genericRegisterName, - std::string componentLibraryName); + std::string componentLibraryName); Engines::Component_ptr createInstance(std::string genericRegisterName, - void *handle, - int studyId); + void *handle, + int studyId); static bool isPythonContainer(const char* ContainerName); static void decInstanceCnt(std::string genericRegisterName); diff --git a/src/Container/SALOME_FileRef_i.cxx b/src/Container/SALOME_FileRef_i.cxx index 62c06dbcb..f4b670be7 100644 --- a/src/Container/SALOME_FileRef_i.cxx +++ b/src/Container/SALOME_FileRef_i.cxx @@ -48,7 +48,7 @@ fileRef_i::fileRef_i() //============================================================================= fileRef_i::fileRef_i(Engines::Container_ptr container, - const char* origFileName) + const char* origFileName) { MESSAGE("fileRef_i::fileRef_i "<< origFileName); _container = Engines::Container::_duplicate(container); @@ -126,7 +126,7 @@ Engines::Container_ptr fileRef_i::getContainer() //============================================================================= CORBA::Boolean fileRef_i::addRef(const char* machine, - const char* fileName) + const char* fileName) { MESSAGE("fileRef_i::addRef " << machine << " " << fileName); string theMachine = machine; @@ -147,7 +147,7 @@ CORBA::Boolean fileRef_i::addRef(const char* machine, if (! _copies[theMachine].empty()) { INFOS("there is already a copy on " << theMachine << " under the path " - << _copies[theMachine] << " new ref not added! "); + << _copies[theMachine] << " new ref not added! "); return 0; } @@ -173,12 +173,12 @@ char* fileRef_i::getRef(const char* machine) if (_copies[theMachine].empty()) { MESSAGE("no copy of " << _machine << _origFileName << " available on " - << theMachine); + << theMachine); } else { MESSAGE("a copy of " << _machine << _origFileName << "is available on " - << theMachine << _copies[theMachine]); + << theMachine << _copies[theMachine]); } return CORBA::string_dup(_copies[theMachine].c_str()); } diff --git a/src/Container/SALOME_FileRef_i.hxx b/src/Container/SALOME_FileRef_i.hxx index 357473bf6..53266d217 100644 --- a/src/Container/SALOME_FileRef_i.hxx +++ b/src/Container/SALOME_FileRef_i.hxx @@ -42,7 +42,7 @@ class CONTAINER_EXPORT fileRef_i: public: fileRef_i(); fileRef_i(Engines::Container_ptr container, - const char* origFileName); + const char* origFileName); virtual ~fileRef_i(); char* origFileName(); @@ -52,7 +52,7 @@ public: Engines::Container_ptr getContainer(); CORBA::Boolean addRef(const char* machine, - const char* fileName); + const char* fileName); char* getRef(const char* machine); diff --git a/src/Container/SALOME_PyNode.py b/src/Container/SALOME_PyNode.py new file mode 100644 index 000000000..2bea7dccc --- /dev/null +++ b/src/Container/SALOME_PyNode.py @@ -0,0 +1,76 @@ +#! /usr/bin/env python +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-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_PyNode.py +# Author : Christian CAREMOLI, EDF +# Module : SALOME +# $Header$ +# + +import sys,traceback,string +import linecache +import cPickle +import Engines__POA +import SALOME__POA +import SALOME + +class Generic(SALOME__POA.GenericObj): + """A Python implementation of the GenericObj CORBA IDL""" + def __init__(self,poa): + self.poa=poa + self.cnt=1 + + def Register(self): + self.cnt+=1 + + def Destroy(self): + self.cnt-=1 + if self.cnt <= 0: + oid=self.poa.servant_to_id(self) + self.poa.deactivate_object(oid) + +class PyNode_i (Engines__POA.PyNode,Generic): + """The implementation of the PyNode CORBA IDL""" + def __init__(self, nodeName,code,poa): + """Initialize the node : compilation in the local context""" + Generic.__init__(self,poa) + self.nodeName=nodeName + self.code=code + linecache.cache[nodeName]=0,None,string.split(code,'\n'),nodeName + ccode=compile(code,nodeName,'exec') + self.context={} + exec ccode in self.context + + def execute(self,funcName,argsin): + """Execute the function funcName found in local context with pickled args (argsin)""" + try: + argsin,kws=cPickle.loads(argsin) + func=self.context[funcName] + argsout=func(*argsin,**kws) + argsout=cPickle.dumps(argsout,-1) + return argsout + except: + exc_typ,exc_val,exc_fr=sys.exc_info() + l=traceback.format_exception(exc_typ,exc_val,exc_fr) + raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyNode: %s, function: %s" % (self.nodeName,funcName),0)) + diff --git a/src/Container/Salome_file_i.cxx b/src/Container/Salome_file_i.cxx index 567fd1dc5..25949f9fc 100644 --- a/src/Container/Salome_file_i.cxx +++ b/src/Container/Salome_file_i.cxx @@ -175,66 +175,66 @@ Salome_file_i::load(const char* hdf5_file) { if (mode == "all") { - // Changing path, is now current directory - path = getcwd(NULL, _path_max); + // Changing path, is now current directory + path = getcwd(NULL, _path_max); - 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]; + 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; + 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; + 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; } } } @@ -631,7 +631,7 @@ Salome_file_i::connect(Engines::Salome_file_ptr source_Salome_file) _t_fileDistributedSource::iterator it = _fileDistributedSource.find(file_name); if (it == _fileDistributedSource.end()) { - _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file); + _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file); } } } @@ -671,7 +671,7 @@ Salome_file_i::connect(Engines::Salome_file_ptr source_Salome_file) //============================================================================= void Salome_file_i::connectDistributedFile(const char * file_name, - Engines::Salome_file_ptr source_Salome_file) + Engines::Salome_file_ptr source_Salome_file) { // Test if this file is added _t_fileManaged::iterator it = _fileManaged.find(file_name); @@ -697,7 +697,7 @@ Salome_file_i::connectDistributedFile(const char * file_name, //============================================================================= void Salome_file_i::setDistributedSourceFile(const char* file_name, - const char * source_file_name) + const char * source_file_name) { std::string fname(file_name); @@ -738,12 +738,12 @@ Salome_file_i::recvFiles() { if (std::string(file_infos.type.in()) == "local") { if (std::string(file_infos.status.in()) == "not_ok") - result = checkLocalFile(file_infos.file_name.in()); + result = checkLocalFile(file_infos.file_name.in()); } else { if (std::string(file_infos.status.in()) == "not_ok") - result = getDistributedFile(file_infos.file_name.in()); + result = getDistributedFile(file_infos.file_name.in()); } // if the result is false // we add this file to files_not_ok diff --git a/src/Container/Salome_file_i.hxx b/src/Container/Salome_file_i.hxx index d92ab4f4c..d493dc089 100644 --- a/src/Container/Salome_file_i.hxx +++ b/src/Container/Salome_file_i.hxx @@ -58,9 +58,9 @@ class CONTAINER_EXPORT Salome_file_i: // 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); + Engines::Salome_file_ptr source_Salome_file); virtual void setDistributedSourceFile(const char* file_name, - const char * source_file_name); + const char * source_file_name); // Recv and check files virtual void recvFiles(); diff --git a/src/DF/DF_Attribute.cxx b/src/DF/DF_Attribute.cxx index 64cd7de7b..a3560c60c 100644 --- a/src/DF/DF_Attribute.cxx +++ b/src/DF/DF_Attribute.cxx @@ -41,8 +41,9 @@ DF_Attribute::~DF_Attribute() map::iterator mi; for(mi =_node->_attributes.begin(); mi != _node->_attributes.end(); mi++) { if(mi->second == this) { - _node->_attributes.erase(mi); - } + _node->_attributes.erase(mi); + return; + } } } } diff --git a/src/DF/DF_Document.cxx b/src/DF/DF_Document.cxx index 5840bc330..68fe98559 100644 --- a/src/DF/DF_Document.cxx +++ b/src/DF/DF_Document.cxx @@ -103,6 +103,7 @@ void DF_Document::Clear() delete vn[i]; _root._node->Reset(); + _root.Nullify(); } //Returns true if this document is empty diff --git a/src/DSC/DSC_Basic/DSC_i.cxx b/src/DSC/DSC_Basic/DSC_i.cxx index 75f3f05c7..b4a98493f 100644 --- a/src/DSC/DSC_Basic/DSC_i.cxx +++ b/src/DSC/DSC_Basic/DSC_i.cxx @@ -25,6 +25,8 @@ // #include "DSC_i.hxx" +//#define MYDEBUG + Engines_DSC_i:: Engines_DSC_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, @@ -37,7 +39,7 @@ Engines_DSC_i(CORBA::ORB_ptr orb, instanceName, interfaceName) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl; #endif } @@ -52,7 +54,7 @@ Engines_DSC_i(CORBA::ORB_ptr orb, bool regist) : Engines_Component_i(orb, poa, container, instanceName, interfaceName,notif,regist) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl; #endif } diff --git a/src/DSC/DSC_Basic/DSC_interface.cxx b/src/DSC/DSC_Basic/DSC_interface.cxx index eb6db311c..3c15326a6 100644 --- a/src/DSC/DSC_Basic/DSC_interface.cxx +++ b/src/DSC/DSC_Basic/DSC_interface.cxx @@ -25,6 +25,16 @@ // #include #include "DSC_interface.hxx" +#ifdef WNT +#else +#include +#endif +#include +#include +#include +#include + +//#define MYDEBUG Engines_DSC_interface::Engines_DSC_interface() {} @@ -154,7 +164,9 @@ Engines_DSC_interface::get_uses_port(const char* uses_port_name) 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()); +#ifdef MYDEBUG std::cout << "---- DSC_Interface : MARK 1 ---- exception : " << uses_port_name << "----" << std::endl; +#endif throw BPT; } @@ -164,7 +176,9 @@ Engines_DSC_interface::get_uses_port(const char* uses_port_name) } else { +#ifdef MYDEBUG std::cout << "---- DSC_Interface : MARK 2 ---- exception : " << uses_port_name << "----" << std::endl; +#endif throw Engines::DSC::PortNotConnected(); } @@ -379,3 +393,182 @@ Engines_DSC_interface::get_port_properties(const char* port_name) rtn_properties = Ports::PortProperties::_duplicate(my_ports[port_name]->port_prop); return rtn_properties; } + +//Trace functions for DSC operations: a local function (initTrace) and a class method (Engines_DSC_interface::writeEvent) +static int traceType=-1; // 0=stderr;1=file; +static int traceLevel=-1; // 0=no trace;1=normal trace;2=detailed trace +static std::ofstream traceFile; +static std::ostream *out; + +//! Initialize the trace file +/*! + * The trace file depends on an environment variable (DSC_TRACE). If this variable + * is equal to 1, the trace file is a file with the name : /.tce. + * In all other cases, the trace file is stderr + * The environment variable DSC_TRACELEVEL can be used to suppress the trace (value 0) + * + * \param containerName the name of the container where the trace is built + */ +static void initTrace(const std::string& containerName) +{ + // if initialization has already been done do nothing + if(traceLevel >= 0)return; + + std::string typeenv="0"; + std::string levelenv="1"; + char* valenv=0; + valenv=getenv("DSC_TRACE"); + if(valenv)typeenv=valenv; + valenv=getenv("DSC_TRACELEVEL"); + if(valenv)levelenv=valenv; + + if(levelenv=="0") + traceLevel=0; // no trace + else if(levelenv=="2") + traceLevel=2; //detailed trace + else + traceLevel=1; // normal trace (default) + + if(traceLevel==0) + return; + + if(typeenv=="1") + { + //trace in file + traceType=1; +#ifdef WNT + std::string logFilename=getenv("TEMP"); + logFilename += "\\"; +#else + std::string logFilename="/tmp"; + char* val = getenv("SALOME_TMP_DIR"); + if(val) + { + struct stat file_info; + stat(val, &file_info); + bool is_dir = S_ISDIR(file_info.st_mode); + if (is_dir)logFilename=val; + } + logFilename += "/"; +#endif + + logFilename=logFilename+containerName+".tce"; + traceFile.open(logFilename.c_str(), std::ios::out | std::ios::app); + out=&traceFile; + } + else + { + //trace to stderr (default) + traceType=0; + out=&std::cerr; + } + //trace heading + out->width(17); + *out << "Elapsed time" ; + *out << " | " ; + out->width(16); + *out << "Request" ; + *out << " | " ; + out->width(16); + *out << "Container" ; + *out << " | " ; + out->width(16); + *out << "Instance" ; + *out << " | " ; + out->width(16); + *out << "Port" ; + *out << " | " ; + out->width(24); + *out << "Error"; + *out << " | " ; + *out << "Infos" ; + *out << std::endl; +} + + +//! Write a record in the trace file +/*! + * \param request the name of the request executed + * \param containerName the name of the container where the request is executed + * \param instance_name the name of the component where the request is executed + * \param port_name the name of the port that is concerned + * \param error if an error has occured, a string that identifies the error + * \param message informations about error or about the request + */ +void Engines_DSC_interface::writeEvent(const char* request,const std::string& containerName, const char* instance_name, + const char* port_name, const char* error, const char* message) +{ + if(traceLevel < 0) + initTrace(containerName); + if(traceLevel == 0)return; + +#ifdef WNT +#else + struct timeval tv; + gettimeofday(&tv,0); + long tt0=tv.tv_sec/3600; //hours + + if(traceType == 2) + { + //notifier (not used: salome notifier is now obsolete) + std::ostringstream msg; + msg.width(7); + msg << tt0 ; + msg << ":" ; + long tt1=(tv.tv_sec-3600*tt0)/60;//minutes + msg.width(2); + msg << tt1 ; + msg << ":" ; + long tt2=tv.tv_sec - 3600*tt0-60*tt1; //seconds + msg.width(2); + msg << tt2 ; + msg << ":" ; + long tt3=tv.tv_usec/1000; //milliseconds + msg.width(3); + msg << tt3 ; + msg << " | " ; + msg.width(24); + msg << error; + msg << " | " ; + msg << message ; + //send event to notifier (containerName.c_str(),instance_name, request, msg.str().c_str()) + } + else + { + //cerr or file + out->width(7); + *out << tt0 ; + *out << ":" ; + long tt1=(tv.tv_sec-3600*tt0)/60;//minutes + out->width(2); + *out << tt1 ; + *out << ":" ; + long tt2=tv.tv_sec - 3600*tt0-60*tt1; //seconds + out->width(2); + *out << tt2 ; + *out << ":" ; + long tt3=tv.tv_usec/1000; //milliseconds + out->width(3); + *out << tt3 ; + *out << " | " ; + out->width(16); + *out << request ; + *out << " | " ; + out->width(16); + *out << containerName ; + *out << " | " ; + out->width(16); + *out << instance_name ; + *out << " | " ; + out->width(16); + *out << port_name ; + *out << " | " ; + out->width(24); + *out << error; + *out << " | " ; + *out << message ; + *out << std::endl; + } +#endif +} + diff --git a/src/DSC/DSC_Basic/DSC_interface.hxx b/src/DSC/DSC_Basic/DSC_interface.hxx index af7d7f5b2..ad0eb3539 100644 --- a/src/DSC/DSC_Basic/DSC_interface.hxx +++ b/src/DSC/DSC_Basic/DSC_interface.hxx @@ -148,6 +148,9 @@ public: virtual Ports::PortProperties_ptr get_port_properties(const char* port_name) throw (Engines::DSC::PortNotDefined); + static void writeEvent(const char* request,const std::string& containerName, const char* instance_name, + const char* port_name, const char* error, const char* message); + protected: /*-------------------------------------------------*/ diff --git a/src/DSC/DSC_Basic/Makefile.am b/src/DSC/DSC_Basic/Makefile.am index e29f456d5..532edf0b7 100644 --- a/src/DSC/DSC_Basic/Makefile.am +++ b/src/DSC/DSC_Basic/Makefile.am @@ -50,7 +50,6 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \ -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@ diff --git a/src/DSC/DSC_Python/Makefile.am b/src/DSC/DSC_Python/Makefile.am index e5d9bf04a..034a89778 100644 --- a/src/DSC/DSC_Python/Makefile.am +++ b/src/DSC/DSC_Python/Makefile.am @@ -20,7 +20,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # File : Makefile.am -# Author : André RIBES (EDF), Eric Fayolle (EDF) +# Author : André RIBES (EDF), Eric Fayolle (EDF) # Module : KERNEL # include $(top_srcdir)/salome_adm/unix/make_common_starter.am @@ -37,6 +37,7 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \ -I$(top_srcdir)/src/DSC/DSC_User/Datastream \ -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Palm \ -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Calcium \ + -I$(top_builddir)/src/DSC/DSC_User/Datastream/Calcium \ -I$(top_srcdir)/src/DSC/DSC_User/Basic \ -I$(top_srcdir)/src/DSC/DSC_Basic \ -I$(top_srcdir)/src/SALOMELocalTrace \ @@ -44,7 +45,6 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \ -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@ @@ -71,7 +71,7 @@ _calcium_la_LIBADD = ../DSC_User/Datastream/Calcium/libCalciumC.la \ ../DSC_Basic/libSalomeDSCContainer.la \ ../../Container/libSalomeContainer.la -_calcium_la_CXXFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS) +_calcium_la_CPPFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS) EXTRA_DIST=calcium_wrap.cpp calcium.i diff --git a/src/DSC/DSC_Python/calcium.i b/src/DSC/DSC_Python/calcium.i index 768cb438c..bc504c30f 100644 --- a/src/DSC/DSC_Python/calcium.i +++ b/src/DSC/DSC_Python/calcium.i @@ -419,7 +419,6 @@ struct stringArray } ~stringArray() { - std::cerr << "~stringArray() " << nelem << std::endl; for(int i=0;icxxObjRefToPyObjRef($1, 1); - //All output Ports::Port_ptr variables are duplicated by security. Need to release them for python . Explanation ?? + //All output Ports::Port_ptr variables are duplicated by security. Need to release them for python. CORBA::release($1); } %typemap(out) Ports::PortProperties_ptr, Engines::Salome_file_ptr { $result = api->cxxObjRefToPyObjRef($1, 1); + //the _ptr is duplicated by the routine called. + //Need to release it for Python because the call to cxxObjRefToPyObjRef has created another ref with a count of 1 + CORBA::release($1); } %typemap(out) Engines::DSC::uses_port * @@ -801,6 +803,7 @@ class PySupervCompo:public Superv_Component_i CORBA::Boolean is_connected(const char* port_name) throw (Engines::DSC::PortNotDefined); // End of DSC interface for python components + static void setTimeOut(); %extend diff --git a/src/DSC/DSC_Python/dsccalcium.py b/src/DSC/DSC_Python/dsccalcium.py index 6aa2d6c4b..dbdc4aa5d 100644 --- a/src/DSC/DSC_Python/dsccalcium.py +++ b/src/DSC/DSC_Python/dsccalcium.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -96,3 +97,7 @@ class PyDSCComponent(SALOME_ComponentPy.SALOME_ComponentPy_i, def checkOutputFilesToService(self,service_name): return self.proxy.checkOutputFilesToService(service_name) + def beginService(self,service_name): + SALOME_ComponentPy.SALOME_ComponentPy_i.beginService(self,service_name) + self.proxy.setTimeOut() + diff --git a/src/DSC/DSC_User/Basic/Makefile.am b/src/DSC/DSC_User/Basic/Makefile.am index 9b77a6a6e..0acf127aa 100644 --- a/src/DSC/DSC_User/Basic/Makefile.am +++ b/src/DSC/DSC_User/Basic/Makefile.am @@ -50,7 +50,6 @@ COMMON_CPPFLAGS= -I$(top_builddir)/idl \ -I$(top_srcdir)/src/SALOMELocalTrace \ -I$(top_srcdir)/src/Basics \ -I$(top_srcdir)/src/Utils \ - -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. diff --git a/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx b/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx index f53198c76..7f909cc19 100644 --- a/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx +++ b/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx @@ -34,6 +34,8 @@ #include "DisplayPair.hxx" // +//#define MYDEBUG + // Suppose que le container est trié template < typename T > struct AdjacentFunctor { @@ -50,14 +52,14 @@ template < typename T > struct AdjacentFunctor { // Suppose que les valeurs passées en paramètres sont triées par ordre croissant bool operator()(const T &v1) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "AdjacentFunctor: " << _minValue << _maxValue << std::endl; std::cout << "AdjacentFunctor: " << _min << _max << std::endl; #endif if ( v1 <= _minValue && v1 >= _maxValue) { _equal= true; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "AdjacentFunctor: _equal : " << v1 << std::endl; #endif return true; @@ -65,14 +67,14 @@ template < typename T > struct AdjacentFunctor { if ( v1 < _minValue ) { _min=v1;_minFound=true; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "AdjacentFunctor: _minFound : " <<_min << std::endl; #endif } else if ( v1 > _maxValue ) { _max=v1;_maxFound=true; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "AdjacentFunctor: _maxFound : " <<_max << std::endl; #endif } @@ -101,7 +103,7 @@ template < typename T > struct AdjacentFunctor { bool isEqual() const { return _equal;} bool isBounded() const { return _minFound && _maxFound;} bool getBounds(TNoConst & min, TNoConst & max) const { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "_minFound : " <<_minFound << ", _maxFound " << _maxFound << std::endl; #endif if (_minFound && _maxFound ) { min=_min; max=_max; return true; } diff --git a/src/DSC/DSC_User/Datastream/Calcium/Calcium.c b/src/DSC/DSC_User/Datastream/Calcium/Calcium.c index 94d41020e..20c11ada4 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Calcium.c +++ b/src/DSC/DSC_User/Datastream/Calcium/Calcium.c @@ -24,15 +24,19 @@ // Module : KERNEL #include "calcium.h" +#include "calciumf.h" +#include "CalciumFortranInt.h" #include #include #include +#include // Interface C de SalomeCalcium typedef int InfoType; typedef char bool; + /************************************/ /* INTERFACES DE LECTURE EN 0 COPIE */ /************************************/ @@ -53,8 +57,6 @@ typedef char bool; long _i=*i; \ fflush(stdout); \ fflush(stderr); \ - fprintf(stderr,"Beginning of ecp_" #_name " : %s %d %f\n",nomvar,*i,*ti); \ - \ \ InfoType info = ecp_lecture_##_typeName (component, mode, ti, tf, &_i, \ nomvar, bufferLength, &_nRead, \ @@ -77,13 +79,6 @@ typedef char bool; 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,int,bool,); -CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,); -/* CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]); */ /* L'interface de cette routine diffère de celle obtenue par la macro : CALCIUM_LECT_INTERFACE_C_. @@ -97,8 +92,6 @@ InfoType ecp_lch(void * component, int mode, float * ti, float * tf, int * i, size_t _nRead; long _i=*i; fflush(stdout);fflush(stderr); - fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti); - InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, nomvar, bufferLength, &_nRead, @@ -108,7 +101,6 @@ InfoType ecp_lch(void * component, int mode, float * ti, float * tf, int * i, 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; @@ -119,30 +111,42 @@ void ecp_lch_free (char* * data) { \ }; +#define STAR * +/*REVERIFIER MAINTENANT 0 COPY avec int2integer*/ +CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int2integer,); +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,int,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 ) { \ +#define CALCIUM_LECT_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \ + _calInt cp_##_name (void * component, _calInt mode, \ + _timeType * ti, _timeType * tf, _calInt * i, \ + char * nomvar, _calInt bufferLength, \ + _calInt * nRead, _type _qual * data \ + lastarg ) { \ + \ + int _mode = (int) mode; \ + size_t _bufferLength = bufferLength; \ size_t _nRead; \ - long _i=*i; \ + 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; \ + if ( (data == NULL) || (_bufferLength < 1) ) return CPNTNULL; \ \ - InfoType info = ecp_lecture_##_typeName (component, mode, ti, tf, &_i, \ - nomvar, bufferLength, &_nRead, \ + _calInt 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); \ \ @@ -158,42 +162,66 @@ void ecp_lch_free (char* * data) { \ Le paramètre supplémentaire strSize indique la taille fixe et identique des chaînes stockées dans data (les ports CALCIUM n'en n'ont pas besoin) */ -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); +/* 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; +/* if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; */ - InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, - nomvar, bufferLength, &_nRead, - &data);/*, strSize ); - strSize est inutile pour les ports CALCIUM - qui gèrent des tailles quelconques de chaines. */ - if(mode == CP_SEQUENTIEL) - *i = _i; - *nRead=_nRead; - fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i); - fflush(stdout);fflush(stderr); +/* InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, */ +/* nomvar, bufferLength, &_nRead, */ +/* &data);*/ +/*, strSize ); */ +/* strSize est inutile pour les ports CALCIUM */ +/* qui gèrent des tailles quelconques de chaines. */ +/* 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; -}; +/* 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,int,bool,); -CALCIUM_LECT_INTERFACE_C_(lcp,float,float,cplx,); +/* CALCIUM_LECT_INTERFACE_C_( , , , + , , ,)*/ + +CALCIUM_LECT_INTERFACE_C_(len,float ,int,int ,int2integer,,); +/*llg ne sera pas disponible si sizeof(long) == 64 bits && cal_int==int + sinon problème de conversion de 64bits vers 32bits */ +CALCIUM_LECT_INTERFACE_C_(llg,float ,int,long ,long2integer,,); + +CALCIUM_LECT_INTERFACE_C_(lre,float ,int,float ,float,,); +CALCIUM_LECT_INTERFACE_C_(ldb,double,int,double ,double,,); +CALCIUM_LECT_INTERFACE_C_(llo,float ,int,int ,bool,,); +CALCIUM_LECT_INTERFACE_C_(lcp,float ,int,float ,cplx,,); #define STAR * -/* CALCIUM_LECT_INTERFACE_C_(lch,float,char,STAR); */ +#define LCH_LAST_PARAM ,int strsize +CALCIUM_LECT_INTERFACE_C_(lch,float ,int,char ,str,STAR, LCH_LAST_PARAM ); + + +/* Definition des méthodes calcium destinées à l'interfaçage fortran + avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */ +CALCIUM_LECT_INTERFACE_C_(len_fort_,float ,cal_int,cal_int ,integer,,); +CALCIUM_LECT_INTERFACE_C_(lin_fort_,float ,cal_int,int ,int2integer,,); +/*llg ne sera pas disponible si sizeof(long) == 64 bits && cal_int==int + sinon problème de conversion de 64bits vers 32bits */ +CALCIUM_LECT_INTERFACE_C_(llg_fort_,float ,cal_int,long ,long2integer,,); + +CALCIUM_LECT_INTERFACE_C_(lre_fort_,float ,cal_int,float ,float,,); +CALCIUM_LECT_INTERFACE_C_(ldb_fort_,double,cal_int,double ,double,,); +CALCIUM_LECT_INTERFACE_C_(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ +CALCIUM_LECT_INTERFACE_C_(lcp_fort_,float ,cal_int,float ,cplx,,); +CALCIUM_LECT_INTERFACE_C_(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_PARAM ); /**********************************************/ @@ -201,10 +229,10 @@ CALCIUM_LECT_INTERFACE_C_(lcp,float,float,cplx,); /**********************************************/ InfoType cp_cd (void * component, char * instanceName) { - /* TODO : Trouver le nom de l'instance SALOME*/ - if (instanceName) strcpy(instanceName,"UNDEFINED"); - return CPOK; + InfoType info = ecp_cd_(component,instanceName); + return info; } + InfoType cp_fin (void * component, int code) { /* TODO : gérer avec les callbacks des ports DSC */ @@ -214,27 +242,28 @@ InfoType cp_fin (void * component, int code) { } - /***************************/ /* 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 ) { \ +#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \ + _calInt cp_##_name (void * component, _calInt mode, \ + _timeType t, _calInt i, \ + char * nomvar, _calInt nbelem, \ + _type _qual * data \ + lastarg ) { \ \ - /*long _i=i;*/ \ + int _mode = mode; \ + long _i = i; \ + size_t _nbelem = nbelem; \ + _timeType _t = t; \ 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, \ + \ + _calInt 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); \ \ @@ -242,33 +271,46 @@ InfoType cp_fin (void * component, int code) { }; \ -/* Definition des méthodes calcium standard */ -CALCIUM_ECR_INTERFACE_C_(een,float,int,int,); -CALCIUM_ECR_INTERFACE_C_(ere,float,float,float,); -CALCIUM_ECR_INTERFACE_C_(edb,double,double,double,); -/*CALCIUM_ECR_INTERFACE_C_(elo,float,bool,bool,);*/ -CALCIUM_ECR_INTERFACE_C_(elo,float,int,bool,); -CALCIUM_ECR_INTERFACE_C_(ecp,float,float,cplx,); - -InfoType cp_ech(void * component, int mode, float t, int i, - char * nomvar, int nbelem, - char ** data, int strSize) { +/* 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; +/*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); +/* 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; -}; - +/* return info; */ +/* }; */ +/* Definition des méthodes calcium standard */ +/* CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,type,_typeName,_qual) */ +CALCIUM_ECR_INTERFACE_C_(een,float ,int,int ,int2integer,,); +CALCIUM_ECR_INTERFACE_C_(elg,float ,int,long ,long2integer,,); +CALCIUM_ECR_INTERFACE_C_(ere,float ,int,float ,float,,); +CALCIUM_ECR_INTERFACE_C_(edb,double,int,double,double,,); +CALCIUM_ECR_INTERFACE_C_(elo,float ,int,int ,bool,,); +CALCIUM_ECR_INTERFACE_C_(ecp,float ,int,float ,cplx,,); +CALCIUM_ECR_INTERFACE_C_(ech,float ,int,char ,str,STAR,LCH_LAST_PARAM ); + +/* Definition des méthodes calcium destinées à l'interfaçage fortran + avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */ + +CALCIUM_ECR_INTERFACE_C_(een_fort_,float ,cal_int,cal_int,integer,,); +CALCIUM_ECR_INTERFACE_C_(elg_fort_,float ,cal_int,long ,long2integer,,); +CALCIUM_ECR_INTERFACE_C_(ein_fort_,float ,cal_int,int ,int2integer,,); +CALCIUM_ECR_INTERFACE_C_(ere_fort_,float ,cal_int,float ,float,,); +CALCIUM_ECR_INTERFACE_C_(edb_fort_,double,cal_int,double,double,,); +CALCIUM_ECR_INTERFACE_C_(elo_fort_,float ,cal_int,int ,bool,,); +CALCIUM_ECR_INTERFACE_C_(ecp_fort_,float ,cal_int,float ,cplx,,); +CALCIUM_ECR_INTERFACE_C_(ech_fort_,float ,cal_int,char ,str,STAR,LCH_LAST_PARAM ); diff --git a/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx b/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx index eec2ea22f..2b6429f8a 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx @@ -23,11 +23,10 @@ #include "CalciumInterface.hxx" #include "calcium.h" #include +#include #include #include -//#define _DEBUG_ - PySupervCompo::PySupervCompo( CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, Engines::Container_ptr contain, @@ -45,6 +44,9 @@ PySupervCompo::~PySupervCompo() extern "C" { + void cp_exit(int); + void setDependency(provides_port*, char*, CalciumTypes::DependencyType); + void cp_exit(int err) { throw CalciumException(err,LOC("Abort coupling")); @@ -84,9 +86,11 @@ extern "C" 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 + std::stringstream msg; + msg << type << " " << mode << " " << depend; + CORBA::String_var componentName=compo->instanceName(); + std::string containerName=compo->getContainerName(); + Engines_DSC_interface::writeEvent("create_calcium_port",containerName,componentName,name,"",msg.str().c_str()); if(std::string(mode) == "IN") { diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx new file mode 100644 index 000000000..43dc0cc82 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx @@ -0,0 +1,155 @@ +#include "CalciumCInterface.hxx" +#include "CalciumCxxInterface.hxx" + +#include + + +//#define MYDEBUG +#ifdef MYDEBUG +#define DEBTRACE(msg) {std::cerr<(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; +}; + +extern "C" CalciumTypes::InfoType +ecp_cd_ (void * component, char * instanceName) { + Superv_Component_i * _component = static_cast(component); + std::string name; + CalciumInterface::ecp_cd( *_component,name); + strcpy(instanceName,name.c_str()); + return CalciumTypes::CPOK; +} + +// 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*,); +// 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; +// }; diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx new file mode 100644 index 000000000..92eff648b --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx @@ -0,0 +1,93 @@ +/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE + + Copyright (C) 2003-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_C_INTERFACE_H_ +#define _CALCIUM_C_INTERFACE_H_ + +#include "CalciumMacroCInterface.hxx" +#include "CalciumTypes.hxx" +#include "CalciumFortranInt.h" +#include + +/* Déclaration de l'Interface entre l'API C et l'API C++ + L'utilisateur CALCIUM n'a normalement pas a utliser cette interface + En C/C++ il utilisera celle définie dans Calcium.c (calcium.h) +2 En C++/CORBA directement celle de CalciumCxxInterface.hxx +*/ + +/* En CALCIUM l'utilisation de données de type double + implique des dates de type double, pour les autres + types de données les dates sont de type float +*/ +template struct CalTimeType { + typedef float TimeType; +}; + +template <> struct CalTimeType { + typedef double TimeType; +}; + +/* Déclaration de ecp_lecture_... , ecp_ecriture_..., ecp_free_... */ + +/* Le premier argument est utilisé : + - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_ + Le second argument est utilisé : + - comme argument template à l'appel de la méthode C++ correspondante + ( le type CORBA de port correspondant est alors obtenu par un trait) + Le troisième 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 + (pour typer les données passées en paramètre ) + Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas + en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode + C++ CALCIUM de lecture repère cette différence de type et charge + le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles). + Notons qu'en CORBA CORBA:Long est mappé sur long uniquement si celui-ci est 32bits sinon + il sera mappé sur le type int (si il est 32bits). Le type CORBA:LongLong est mappé sur le type long + s'il est 64 bits sinon celà peut être un long long (s'il existe). +*/ +CALCIUM_C2CPP_INTERFACE_HXX_(intc,int,int,); +CALCIUM_C2CPP_INTERFACE_HXX_(long,long,long,); + +CALCIUM_C2CPP_INTERFACE_HXX_(integer,integer,cal_int,); +CALCIUM_C2CPP_INTERFACE_HXX_(int2integer,integer,int,); +CALCIUM_C2CPP_INTERFACE_HXX_(long2integer,integer, long,); + +CALCIUM_C2CPP_INTERFACE_HXX_(float,float,float, ); +CALCIUM_C2CPP_INTERFACE_HXX_(double,double,double,); +/* Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/ +CALCIUM_C2CPP_INTERFACE_HXX_(bool,bool,int,); +CALCIUM_C2CPP_INTERFACE_HXX_(cplx,cplx,float,); +CALCIUM_C2CPP_INTERFACE_HXX_(str,str,char*,); + +/* Déclaration de ecp_fin */ +extern "C" CalciumTypes::InfoType ecp_fin_ (void * component, int code); +extern "C" CalciumTypes::InfoType ecp_cd_ (void * component, char* instanceName); + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx index cd8dc62ec..d64d28a39 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx @@ -38,60 +38,52 @@ void CalciumCouplingPolicy::setDependencyType (CalciumTypes::DependencyType depe CalciumTypes::DependencyType CalciumCouplingPolicy::getDependencyType () const { return _dependencyType;} void CalciumCouplingPolicy::setStorageLevel (size_t storageLevel) { -#ifdef _DEBUG_ - std::cerr << "CalciumCouplingPolicy::setStorageLevel: " << storageLevel << std::endl; -#endif + MESSAGE( "CalciumCouplingPolicy::setStorageLevel: " << storageLevel ); if ( storageLevel < 1 && (storageLevel != CalciumTypes::UNLIMITED_STORAGE_LEVEL) ) - throw CalciumException(CalciumTypes::CPRENA,LOC("Un niveau < 1 n'est pas autorisé")); + throw CalciumException(CalciumTypes::CPRENA,LOC("StorageLevel < 1 is not allowed")); _storageLevel = storageLevel; } size_t CalciumCouplingPolicy::getStorageLevel () const {return _storageLevel;} void CalciumCouplingPolicy::setDateCalSchem (CalciumTypes::DateCalSchem dateCalSchem) { -#ifdef _DEBUG_ - std::cerr << "CalciumCouplingPolicy::setDateCalSchem: " << dateCalSchem << std::endl; -#endif + MESSAGE( "CalciumCouplingPolicy::setDateCalSchem: " << 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")); + throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set a temporal scheme on a port that is not time dependent")); _dateCalSchem = dateCalSchem; } CalciumTypes::DateCalSchem CalciumCouplingPolicy::getDateCalSchem () const { return _dateCalSchem; } void CalciumCouplingPolicy::setAlpha(double alpha) { -#ifdef _DEBUG_ - std::cerr << "CalciumCouplingPolicy::setAlpha: " << alpha << std::endl; -#endif + MESSAGE( "CalciumCouplingPolicy::setAlpha: " << 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")); + throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set alpha on a port that is not time dependent")); - if ( 0 <= alpha <= 1 ) _alpha = alpha; + if ( 0 <= alpha && alpha <= 1 ) _alpha = alpha; else - throw CalciumException(CalciumTypes::CPRENA,LOC("Le paramètre alpha doit être compris entre [0,1]")); + throw CalciumException(CalciumTypes::CPRENA,LOC("alpha must be between [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; + throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set deltaT on a port that is not time dependent")); + if ( 0 <= deltaT && deltaT <= 1 ) _deltaT = deltaT; else - throw(CalciumException(CalciumTypes::CPRENA,LOC("Le paramètre deltaT doit être compris entre [0,1]"))); + throw(CalciumException(CalciumTypes::CPRENA,LOC("deltaT must be between [0,1]"))); } double CalciumCouplingPolicy::getDeltaT() const {return _deltaT;} void CalciumCouplingPolicy::setInterpolationSchem (CalciumTypes::InterpolationSchem interpolationSchem) { -#ifdef _DEBUG_ - std::cerr << "CalciumCouplingPolicy::setInterpolationSchem: " << interpolationSchem << std::endl; -#endif + MESSAGE( "CalciumCouplingPolicy::setInterpolationSchem: " << 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")); + throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set InterpolationSchem on a port that is not time dependent")); _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")); + throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set ExtrapolationSchem on a port that is not time dependent")); _extrapolationSchem=extrapolationSchem; } @@ -112,10 +104,14 @@ CalciumCouplingPolicy::getEffectiveTime(CalciumCouplingPolicy::TimeType ti, void CalciumCouplingPolicy::disconnect(bool provideLastGivenValue) { if (provideLastGivenValue) { +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::disconnect CP_CONT ------------------" << std::endl; +#endif _disconnectDirective = CalciumTypes::CONTINUE; } else { +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::disconnect CP_ARRET ------------------" << std::endl; +#endif _disconnectDirective = CalciumTypes::STOP; } diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx index 383f7a698..962794c26 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx @@ -39,6 +39,8 @@ #include "CalciumTypes.hxx" #include "CalciumException.hxx" +//#define MYDEBUG + class CalciumCouplingPolicy : public CouplingPolicy { @@ -169,7 +171,9 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor{ const DataId & dataId, const Iterator & it1) const { typedef typename iterator_t::value_type value_type; +#ifdef MYDEBUG std::cout << "-------- Calcium Generic BoundedDataIdProcessor.apply() called " << std::endl; +#endif } }; @@ -196,14 +200,14 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor< MapIterator it2=it1; ++it2; size_t dataSize1 = DataManipulator::size(it1->second); -#ifdef _DEBUG_ +#ifdef MYDEBUG 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_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId2 : " << dataSize2 << std::endl; #endif @@ -212,31 +216,31 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor< DataId dataId1 = it1->first; TimeType t2 = dataId2.first; TimeType t1 = dataId1.first; -#ifdef _DEBUG_ +#ifdef MYDEBUG 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_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t : " << t << std::endl; #endif TimeType timeDiff = t2-t1; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de timeDiff : " << timeDiff << std::endl; #endif TimeType coeff = (t2-t)/timeDiff; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de coeff : " << coeff << std::endl; #endif InnerType const * const InIt1 = DataManipulator::getPointer(it1->second); -#ifdef _DEBUG_ +#ifdef MYDEBUG 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_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t2 : " << std::endl; std::copy(InIt2,InIt2+dataSize2,std::ostream_iterator(std::cout," ")); std::cout << std::endl; @@ -244,7 +248,7 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor< Type dataOut = DataManipulator::create(dataSize); InnerType * const OutIt = DataManipulator::getPointer(dataOut); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : interpolationSchem : " << _couplingPolicy._interpolationSchem << std::endl; std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : alpha : " << _couplingPolicy._alpha << std::endl; std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : datecalschem : " << _couplingPolicy._dateCalSchem << std::endl; @@ -265,7 +269,7 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor< // } } -#ifdef _DEBUG_ +#ifdef MYDEBUG 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; @@ -290,7 +294,7 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co AdjacentFunctor< key_type > af(expectedDataId); if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY ) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- time expected : " << expectedDataId.first << std::endl; std::cout << "-------- time expected corrected : " << expectedDataId.first*(1.0-_deltaT) << std::endl; #endif @@ -317,8 +321,8 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co typename AssocContainer::iterator current = prev; while ( (current != storedDatas.end()) && !af(current->first) ) { -#ifdef _DEBUG_ - std::cout << "------- stored time : " << current->first << std::endl; +#ifdef MYDEBUG + std::cerr << "------- stored time : " << current->first << std::endl; #endif // if ( af(current->first) ) break; prev = current++; @@ -336,7 +340,7 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co else wDataIt1 = storedDatas.end(); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl; #endif @@ -366,7 +370,7 @@ struct CalciumCouplingPolicy::EraseDataIdProcessor { typedef typename Container::value_type value_type; typedef typename Container::iterator iterator; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::eraseDataId, storedDatasSize : " << storedDatas.size() << std::endl; #endif @@ -383,12 +387,12 @@ struct CalciumCouplingPolicy::EraseDataIdProcessor { } // Si l'itérateur pointait sur une valeur que l'on vient de supprimer if (dist < s ) { - throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "La gestion du niveau CALCIUM " + throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "StorageLevel management " << _couplingPolicy._storageLevel << - " vient d'entraîner la suppression de la donnée à renvoyer"))); + " has just removed the data to send"))); } } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::eraseDataId, new storedDatasSize : " << storedDatas.size() << std::endl; #endif return; @@ -422,20 +426,20 @@ struct CalciumCouplingPolicy::DisconnectProcessor { typedef typename Container::iterator iterator; // Pas de traitement particulier a effectuer -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK1 ("<< _couplingPolicy._disconnectDirective<<") --------" << std::endl; #endif if ( (_couplingPolicy._disconnectDirective) == (CalciumTypes::UNDEFINED_DIRECTIVE) ) return false; -#ifdef _DEBUG_ +#ifdef MYDEBUG 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_ + throw(CalciumException(CalciumTypes::CPINARRET,LOC(OSS()<< "CP_ARRET directive" + << " interrupts all further data reading"))); +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK3 --------" << std::endl; #endif @@ -443,20 +447,20 @@ struct CalciumCouplingPolicy::DisconnectProcessor { // 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."))); + throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "CP_CONT directive" + << " is active but no data is available."))); // 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_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK4 " << expectedDataId <<" --------" << std::endl; #endif // >= expectedDataId iterator it1 = storedDatas.lower_bound(expectedDataId); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK5 " << std::endl; for (iterator it=storedDatas.begin();it!=storedDatas.end();++it) std::cout <<" "<<(*it).first ; @@ -465,16 +469,16 @@ struct CalciumCouplingPolicy::DisconnectProcessor { // TODO : Il faut en fait renvoyer le plus proche cf IT ou DT if (it1 == storedDatas.end()) - throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "La directive CP_CONT" - << " est active mais le dataId demandé est inférieur ou égal au dernier reçu."))); + throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "CP_CONT directive" + << " is active but the requested dataId is less or equal to the last one received."))); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK6 " << std::endl; #endif wDataIt1 = storedDatas.end(); --wDataIt1; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor, CP_CONT : " << (*wDataIt1).first << std::endl; #endif diff --git a/src/Batch/Batch_IOMutex.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.cxx similarity index 73% rename from src/Batch/Batch_IOMutex.cxx rename to src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.cxx index 06a9f7e84..8b05780c4 100644 --- a/src/Batch/Batch_IOMutex.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.cxx @@ -19,20 +19,21 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/* - * IOMutex.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Fri Nov 14 11:00:39 2003 - * Projet : Salome 2 - * - */ +// File : CalciumCxxInterface.cxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $ +// Id : $Id$ +// -#include "Batch_IOMutex.hxx" +#include "CalciumCxxInterface.hxx" +#define PRG_MAIN +#include "calciumP.h" -namespace Batch { +using namespace std; - pthread_mutex_t IOMutex = PTHREAD_MUTEX_INITIALIZER; +namespace CalciumInterface +{ +}; -} diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx index a0af9e501..e1129154c 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx @@ -42,7 +42,7 @@ #include -//#define _DEBUG_ +#include template struct IsSameType { @@ -53,24 +53,33 @@ struct IsSameType { static const bool value = true; }; +extern const char * CPMESSAGE[]; + +//#define MYDEBUG #include namespace CalciumInterface { - /********************* INTERFACE DE DECONNEXION *****************/ + /********************* CONNECTION INTERFACE *****************/ static inline void ecp_cd (Superv_Component_i & component, std::string & instanceName) { /* TODO : Trouver le nom de l'instance SALOME*/ - if (instanceName.empty()) instanceName="UNDEFINED"; - + CORBA::String_var componentName=component.instanceName(); + std::string containerName=component.getContainerName(); + if (instanceName.empty()) instanceName=componentName; + Engines_DSC_interface::writeEvent("CP_CD",containerName,componentName,"","",""); } static void ecp_fin (Superv_Component_i & component, bool provideLastGivenValue) { + CORBA::String_var componentName=component.instanceName(); + std::string containerName=component.getContainerName(); + Engines_DSC_interface::writeEvent("CP_FIN",containerName,componentName,"","",""); + std::vector usesPortNames; std::vector::const_iterator it; component.get_uses_port_names(usesPortNames); @@ -81,46 +90,48 @@ namespace CalciumInterface { // 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; + 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 MYDEBUG + std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|"<< *it <<"|----"<< + // typeid(myUsesPort).name() <<"-------------" << + typeid(myCalciumUsesPort).name() <<"-------------" << 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; + +// 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) + { + Engines_DSC_interface::writeEvent("CP_FIN",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPTPVR],ex.what()); + throw (CalciumException(CalciumTypes::CPTPVR,ex)); + } + catch ( const DSC_Exception & ex) + { + Engines_DSC_interface::writeEvent("CP_FIN",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPOK],ex.what()); + // Exception venant de SupervComponent : + // PortNotDefined(CPNMVR), PortNotConnected(CPLIEN) + // ou du port uses : Dsc_Exception + // On continue à traiter la deconnexion des autres ports uses + } + catch (...) + { + Engines_DSC_interface::writeEvent("CP_FIN",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPATAL],"Unexpected exception"); + throw (CalciumException(CalciumTypes::CPATAL,"Unexpected exception")); + // En fonction du mode de gestion des erreurs throw; + } } - } } @@ -149,212 +160,263 @@ namespace CalciumInterface { } - /********************* INTERFACES DE LECTURE *****************/ + /********************* READING INTERFACE *****************/ // T1 est le type de données // T2 est un de type Calcium permettant de sélectionner le port CORBA correspondant - // T1 et T2 sont dissociés pour discriminer le cas des nombres complexes + // T1 et T2 sont dissociés pour discriminer par exemple 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, - int const & dependencyType, - double & ti, - double const & tf, - long & i, - const std::string & nomVar, - size_t bufferLength, - size_t & nRead, - T1 * &data ) + int const & dependencyType, + double & ti, + double const & tf, + long & i, + const std::string & nomVar, + size_t bufferLength, + size_t & nRead, + T1 * &data ) { assert(&component); + CORBA::String_var componentName=component.instanceName(); + std::string containerName=component.getContainerName(); typedef typename ProvidesPortTraits::PortType PortType; typedef typename PortType::DataManipulator DataManipulator; typedef typename DataManipulator::Type CorbaDataType; // Attention != T1 typedef typename DataManipulator::InnerType InnerType; - CalciumTypes::DependencyType _dependencyType= + CalciumTypes::DependencyType _dependencyType= static_cast(dependencyType); CorbaDataType corbaData; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl; #endif if (nomVar.empty()) - throw CalciumException(CalciumTypes::CPNMVR, - LOC("Le nom de la variable est ")); + { + Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPNMVR],""); + throw CalciumException(CalciumTypes::CPNMVR, LOC("Empty variable name")); + } PortType * port; -#ifdef _DEBUG_ - std::cout << "-------- CalciumInterface(ecp_lecture) MARK 2 ------------------" << std::endl; +#ifdef MYDEBUG + std::cout << "-------- CalciumInterface(lecture) MARK 2 --"< (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; + try + { + port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str()); +#ifdef MYDEBUG + std::cout << "-------- CalciumInterface(ecp_lecture) MARK 3 ------------------" << std::endl; #endif - throw (CalciumException(CalciumTypes::CPTPVR,ex)); - } + } + catch ( const Superv_Component_i::PortNotDefined & ex) + { + Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPNMVR],ex.what()); + throw (CalciumException(CalciumTypes::CPNMVR,ex)); + } + catch ( const Superv_Component_i::PortNotConnected & ex) + { + Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPLIEN],ex.what()); + throw (CalciumException(CalciumTypes::CPLIEN,ex)); + // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN + } + catch ( const Superv_Component_i::BadCast & ex) + { + Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPTPVR],ex.what()); + 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.")); + { + Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPIT],"Dependency mode is undefined"); + throw CalciumException(CalciumTypes::CPIT, LOC(OSS()<<"Dependency mode of variable " << nomVar << " is undefined.")); + } - 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 ( ( portDependencyType != _dependencyType ) && ( _dependencyType != CalciumTypes::SEQUENCE_DEPENDENCY ) ) + { + Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPIT], + "Dependency mode is not the same as the required one"); + throw CalciumException(CalciumTypes::CPITVR, LOC(OSS()<<"Dependency mode of variable " << nomVar << ": " + << portDependencyType << " is not the same as the required one.")); + } - if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY ) { - corbaData = port->get(ti,tf, 0); -#ifdef _DEBUG_ - std::cout << "-------- CalciumInterface(ecp_lecture) MARK 5 ------------------" << std::endl; + std::stringstream msgout,msg; + if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY ) + { + try + { + double tt=ti; + msg << "ti=" << ti << ", tf=" << tf ; + Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"",msg.str().c_str()); + corbaData = port->get(tt,tf, 0); + msgout << "read t=" << tt ; +#ifdef MYDEBUG + 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; + } + catch ( const DSC_Exception & ex) + { + Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),"",ex.what()); + throw; + } + } + else if ( _dependencyType == CalciumTypes::ITERATION_DEPENDENCY ) + { + try + { + msg << "i=" << i ; + Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"",msg.str().c_str()); + corbaData = port->get(0, i); + msgout << "read i=" << i ; +#ifdef MYDEBUG + 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; + } + catch ( const DSC_Exception & ex) + { + Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),"",ex.what()); + throw; + } + } + else + { + // Sequential read + try + { +#ifdef MYDEBUG + std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl; #endif - corbaData = port->next(ti,i); - } + Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"","Sequential read"); + corbaData = port->next(ti,i); + msgout << "read "; + if(i==0)msgout<< "t=" <::value) data = new T1[nRead]; -#ifdef _DEBUG_ - std::cout << "-------- CalciumInterface(ecp_lecture) MARK 9 ------------------" << std::endl; + 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 T1 et InnerType sont différents, il faudra effectuer tout de même une recopie + if (!IsSameType::value) data = new T1[nRead]; +#ifdef MYDEBUG + 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 : - // La raison d'être du foncteur Copy2UserSpace est que le compilateur n'acceptera - // pas une expresion d'affectation sur des types incompatibles même - // si cette expression se trouve dans une branche non exécuté d'un test - // sur la compatibilité des types. - // En utilisant le foncteur Copy2UserSpace, seul la spécialisation en adéquation - // avec la compatibilité des types sera compilée - Copy2UserSpace< IsSameType::value, DataManipulator >::apply(data,corbaData,nRead); -#ifdef _DEBUG_ - std::cout << "-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl; + // On essaye de faire du 0 copy si les types T1 et InnerType sont les mêmes. + // Copy2UserSpace : + // La raison d'être du foncteur Copy2UserSpace est qu'il n'est pas possible de compiler + // une expression d'affectation sur des types incompatibles ; même + // si cette expression se trouve dans une branche non exécuté d'un test + // portant sur la compatibilité des types. + // En utilisant le foncteur Copy2UserSpace, seule la spécialisation en adéquation + // avec la compatibilité des types sera compilée + Copy2UserSpace< IsSameType::value, DataManipulator >::apply(data,corbaData,nRead); +#ifdef MYDEBUG + 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); - // ni DataManipulator::getPointer(corbaData,true); qui détruit la sequence lorsque l'on - // prend la propriété du buffer - // 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 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; + // 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); + // ni DataManipulator::getPointer(corbaData,true); qui détruit la sequence lorsque l'on + // prend la propriété du buffer + // 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 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 MYDEBUG + std::cout << "-------- CalciumInterface(ecp_lecture) MARK 11 ------------------" << std::endl; #endif - Copy2UserSpace::apply(data,corbaData,nRead); - DataManipulator::copy(corbaData,data,nRead); - -#ifdef _DEBUG_ - std::cout << "-------- CalciumInterface(ecp_lecture) MARK 12 ------------------" << std::endl; + Copy2UserSpace::apply(data,corbaData,nRead); + //Déjà fait ci-dessus : + //DataManipulator::copy(corbaData,data,nRead); +#ifdef MYDEBUG + 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_ + } +#ifdef MYDEBUG 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 - - + Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPOK],msgout.str().c_str()); return; } - // T1 est le type de données + // T1 is the data type template static void ecp_lecture ( Superv_Component_i & component, - int const & dependencyType, - double & ti, - double const & tf, - long & i, - const std::string & nomVar, - size_t bufferLength, - size_t & nRead, - T1 * &data ) + int const & dependencyType, + double & ti, + double const & tf, + long & i, + const std::string & nomVar, + size_t bufferLength, + size_t & nRead, + T1 * &data ) { ecp_lecture (component,dependencyType,ti,tf, - i,nomVar,bufferLength,nRead,data); + i,nomVar,bufferLength,nRead,data); } - /********************* INTERFACES D'ECRITURE *****************/ + /********************* WRITING INTERFACE *****************/ // T1 : DataType // T2 : PortType template static void ecp_ecriture ( Superv_Component_i & component, - int const & dependencyType, - double const & t, - long const & i, - const std::string & nomVar, - size_t bufferLength, - T1 const & data ) + int const & dependencyType, + double const & t, + long const & i, + const std::string & nomVar, + size_t bufferLength, + T1 const & data ) { assert(&component); + CORBA::String_var componentName=component.instanceName(); + std::string containerName=component.getContainerName(); //typedef typename StarTrait::NonStarType T; - typedef typename boost::remove_all_extents< T2 >::type T2_without_extent; typedef typename boost::remove_all_extents< T1 >::type T1_without_extent; - + typedef typename boost::remove_all_extents< T2 >::type T2_without_extent; typedef typename UsesPortTraits ::PortType UsesPortType; typedef typename ProvidesPortTraits::PortType ProvidesPortType;// pour obtenir un manipulateur de données typedef typename ProvidesPortType::DataManipulator DataManipulator; @@ -365,41 +427,49 @@ namespace CalciumInterface { T1_without_extent const & _data = data; - CalciumTypes::DependencyType _dependencyType= + CalciumTypes::DependencyType _dependencyType= static_cast(dependencyType); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl; #endif - if ( nomVar.empty() ) throw CalciumException(CalciumTypes::CPNMVR, - LOC("Le nom de la variable est ")); + if ( nomVar.empty() ) + { + Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPNMVR],""); + throw CalciumException(CalciumTypes::CPNMVR, LOC("Empty variable name")); + } UsesPortType * port; -#ifdef _DEBUG_ - std::cout << "-------- CalciumInterface(ecriture) MARK 2 ------------------" << std::endl; +#ifdef MYDEBUG + std::cout << "-------- CalciumInterface(ecriture) MARK 2 ---"< (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; + try + { + port = component.Superv_Component_i::get_port< UsesPortType > (nomVar.c_str()); +#ifdef MYDEBUG + std::cout << "-------- CalciumInterface(ecriture) MARK 3 ------------------" << std::endl; #endif - throw (CalciumException(CalciumTypes::CPTPVR,ex)); - } + } + catch ( const Superv_Component_i::PortNotDefined & ex) + { + Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPNMVR],ex.what()); + throw (CalciumException(CalciumTypes::CPNMVR,ex)); + } + catch ( const Superv_Component_i::PortNotConnected & ex) + { + Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPLIEN],ex.what()); + throw (CalciumException(CalciumTypes::CPLIEN,ex)); + // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN + } + catch ( const Superv_Component_i::BadCast & ex) + { + Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPTPVR],ex.what()); + throw (CalciumException(CalciumTypes::CPTPVR,ex)); + } // mode == mode du port // On pourrait créer la méthode CORBA dans le mode de Couplage CALCIUM. @@ -415,14 +485,18 @@ namespace CalciumInterface { // } if ( _dependencyType == CalciumTypes::UNDEFINED_DEPENDENCY ) - throw CalciumException(CalciumTypes::CPIT, - LOC(OSS()<<"Le mode de dépendance demandé pour la variable " - << nomVar << " est indéfini.")); + { + Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPIT],"Dependency mode is undefined"); + throw CalciumException(CalciumTypes::CPIT, LOC(OSS()<<"Dependency mode of variable " << nomVar << " is undefined.")); + } 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.")); + { + Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPIT], + "SEQUENCE_DEPENDENCY mode is not possible when writing"); + throw CalciumException(CalciumTypes::CPIT, LOC(OSS()<<"Dependency mode SEQUENCE_DEPENDENCY for variable " << nomVar + << " is not possible when writing.")); + } // 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 @@ -431,20 +505,20 @@ namespace CalciumInterface { // ----> // if ( portDependencyType != _dependencyType ) // throw CalciumException(CalciumTypes::CPITVR, -// LOC(OSS()<<"Le mode de dépendance de la variable " -// << nomVar << " ne correspond pas au mode demandé.")); +// 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 ")); - + { + Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPNTNULL],"Buffer to send is empty"); + throw CalciumException(CalciumTypes::CPNTNULL, LOC(OSS()<<"Buffer to send is empty")); + } -#ifdef _DEBUG_ + CorbaDataType corbaData; +#ifdef MYDEBUG 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 @@ -466,40 +540,56 @@ namespace CalciumInterface { // 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. +#ifdef MYDEBUG + T1_without_extent t1b; + InnerType t2b; + std::cout << "-------- CalciumInterface(ecriture) MARK 4b1 -----" << typeid(t1b).name() << "-------------" << std::endl; + std::cout << "-------- CalciumInterface(ecriture) MARK 4b2 -----" << typeid(t2b).name() << "-------------" << std::endl; +#endif + Copy2CorbaSpace::value, DataManipulator >::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) + //TODO : GERER LES EXCEPTIONS ICI : ex le port n'est pas connecte + if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY ) { - 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; + try + { + port->put(*corbaData,t, -1); + std::stringstream msg; + msg << "t=" << t ; + Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPOK],msg.str().c_str()); + } + catch ( const DSC_Exception & ex) + { + Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPATAL],ex.what()); + 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 MYDEBUG + std::cout << "-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl; #endif - } - else if ( _dependencyType == CalciumTypes::ITERATION_DEPENDENCY ) { - try + } + else if ( _dependencyType == CalciumTypes::ITERATION_DEPENDENCY ) { - 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; + try + { + port->put(*corbaData,-1, i); + std::stringstream msg; + msg << "i=" << i ; + Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPOK],msg.str().c_str()); + } + catch ( const DSC_Exception & ex) + { + Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPATAL],ex.what()); + throw (CalciumException(CalciumTypes::CPATAL,ex.what())); + } +#ifdef MYDEBUG + std::cout << "-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl; #endif - } - + } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumInterface(ecriture), Valeur de corbaData : " << std::endl; for (int i = 0; i < corbaData->length(); ++i) std::cout << "-------- CalciumInterface(ecriture), corbaData[" << i << "] = " << (*corbaData)[i] << std::endl; @@ -509,7 +599,7 @@ namespace CalciumInterface { // Supprime l'objet CORBA avec eventuellement les données qu'il contient (cas de la recopie) delete corbaData; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl; #endif @@ -518,12 +608,13 @@ namespace CalciumInterface { template static void ecp_ecriture ( Superv_Component_i & component, - int const & dependencyType, - double const & t, - long const & i, - const std::string & nomVar, - size_t bufferLength, - T1 const & data ) { + int const & dependencyType, + double const & t, + long const & i, + const std::string & nomVar, + size_t bufferLength, + T1 const & data ) + { ecp_ecriture (component,dependencyType,t,i,nomVar,bufferLength,data); }; diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumFortranInt.h.in b/src/DSC/DSC_User/Datastream/Calcium/CalciumFortranInt.h.in new file mode 100644 index 000000000..8e4d2a0ff --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumFortranInt.h.in @@ -0,0 +1,42 @@ +/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE + + Copyright (C) 2003-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_FORTRAN_INT_H_ +#define _CALCIUM_FORTRAN_INT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef @LONG_OR_INT@ cal_int; + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx index 50ae4bd53..bfd6b3fdc 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx @@ -180,21 +180,21 @@ try { \ \ if (key == "StorageLevel" ) \ - {if ( ok=(value >>= sl) ) Port::setStorageLevel(sl);} \ + {if ( ( ok=(value >>= sl) ) ) Port::setStorageLevel(sl);} \ else if (key == "Alpha" ) \ - {if ( ok=(value >>= alpha) ) Port::setAlpha(alpha);} \ + {if ( ( ok=(value >>= alpha) ) ) Port::setAlpha(alpha);} \ else if (key == "DeltaT" ) \ - {if ( ok=(value >>= delta) ) Port::setDeltaT(delta);} \ + {if ( ( ok=(value >>= delta) ) ) Port::setDeltaT(delta);} \ else if (key == "DependencyType" ) \ - {if ( ok=( value >>= dt) ) Port::setDependencyType(dependencyType[dt]);} \ + {if ( ( ok=( value >>= dt) ) ) Port::setDependencyType(dependencyType[dt]);} \ else if (key == "DateCalSchem" ) \ - {if ( ok=(value >>= dcs) ) \ + {if ( ( ok=(value >>= dcs) ) ) \ Port::setDateCalSchem(dateCalSchem[dcs]);} \ else if (key == "InterpolationSchem") \ - {if ( ok=(value >>= is) ) \ + {if ( ( ok=(value >>= is) ) ) \ Port::setInterpolationSchem(interpolationSchem[is]);} \ else if (key == "ExtrapolationSchem") \ - {if ( ok=(value >>= es) ) \ + {if ( ( ok=(value >>= es) ) ) \ Port::setExtrapolationSchem(extrapolationSchem[es]);} \ else \ throw Ports::NotDefined(); \ diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericUsesPort.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericUsesPort.hxx index f42338ea9..8524723df 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericUsesPort.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericUsesPort.hxx @@ -53,7 +53,9 @@ CalciumGenericUsesPort< DataManipulator,CorbaPortType, repositoryName >::disconn for(int i = 0; i < this->_my_ports->length(); i++) { CorbaPortTypePtr port = CorbaPortType::_narrow((*this->_my_ports)[i]); try { +#ifdef MYDEBUG std::cerr << "-------- CalciumGenericUsesPort<>::disconnect: "<< i << std::endl; +#endif port->disconnect(provideLastGivenValue); } catch(const CORBA::SystemException& ex){ diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx index 5d2422fa0..7b991a210 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx @@ -32,229 +32,14 @@ //Interface CALCIUM des utilisateurs en C++ #include "CalciumCxxInterface.hxx" -#include "CalciumException.hxx" -#include "CalciumTypes.hxx" +/* Déclaration de l'Interface entre l'API C et l'API C++ + L'utilisateur CALCIUM n'a normalement pas a utliser cette interface + En C/C++ il utilisera celle définie dans Calcium.c (calcium.h) + En C++/CORBA directement celle de CalciumCxxInterface.hxx +*/ +#include "CalciumCInterface.hxx" -#include -//Ce fichier déclare et défini l'interfaçage entre l'API utilisteur C et C++ -//Les procédures déclarées n'ont pas vocation à être utilisées directement (celà est -// cependant possible). -//#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; \ - \ - 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(); \ - } catch ( ... ) { \ - std::cerr << "Unexpected exception " << std::endl; \ - return CalciumTypes::CPATAL; \ - } \ - 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);*/ \ - DEBTRACE( "----------->-" << nomvar ) \ - CalciumInterface::ecp_ecriture< _type, _name >( *_component, \ - dependencyType, \ - _t,i,nomvar,_bufferLength,*data); \ - } catch ( const CalciumException & ex) { \ - std::cerr << ex.what() << std::endl; \ - return ex.getInfo(); \ - } catch ( ... ) { \ - std::cerr << "Unexpected exception " << std::endl; \ - return CalciumTypes::CPATAL; \ - } \ - 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_ et ecp_free_ -// - comme second argument template à l'appel de la méthode C++ correspondante -// ( le type de 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 -// (pour typer les données passées en paramètre ) -// Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas -// en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode -// C++ CALCIUM de lecture repère cette différence de type et charge -// le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles). -CALCIUM_C2CPP_INTERFACE_(int,int,); -CALCIUM_C2CPP_INTERFACE_(float,float, ); -CALCIUM_C2CPP_INTERFACE_(double,double,); -// Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,); -CALCIUM_C2CPP_INTERFACE_(bool,int,); -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*,); -// 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/CalciumMacroCInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumMacroCInterface.hxx new file mode 100644 index 000000000..999619c1b --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumMacroCInterface.hxx @@ -0,0 +1,148 @@ +/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE + +Copyright (C) 2003-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_MACRO_C_INTERFACE_H_ +#define _CALCIUM_MACRO_C_INTERFACE_H_ + + + +/****** CALCIUM_C2CPP_INTERFACE_HXX_ : ******/ +/****** Declarations: ecp_lecture_... , ecp_ecriture_..., ecp_free_... ******/ + +#define CALCIUM_C2CPP_INTERFACE_HXX_(_name,_porttype,_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 ); \ + \ + \ + extern "C" void ecp_lecture_##_name##_free ( _type _qual * 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 ); \ + + + + + +/****** CALCIUM_C2CPP_INTERFACE_CXX_ : ******/ +/******Definitions: ecp_lecture_... , ecp_ecriture_..., ecp_free_... ******/ +#define CALCIUM_C2CPP_INTERFACE_CXX_(_name,_porttype,_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; \ + \ + if ( IsSameType< _porttype , cplx >::value ) _bufferLength*=2; \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \ + try \ + { \ + CalciumInterface::ecp_lecture< _type,_porttype >( *_component, dependencyType, _ti, _tf, *i, nomvar, \ + _bufferLength, _nRead, *data); \ + } \ + catch ( const CalciumException & ex) \ + { \ + DEBTRACE( ex.what() ); \ + return ex.getInfo(); \ + } \ + catch ( ... ) \ + { \ + DEBTRACE( "Unexpected exception ") ; \ + return CalciumTypes::CPATAL; \ + } \ + if ( IsSameType< _porttype , 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, _porttype >(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 ) \ + { \ + DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 0 ------------------" ) \ + 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< _porttype , 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);*/ \ + DEBTRACE( "----------->-" << nomvar ) \ + CalciumInterface::ecp_ecriture< _type, _porttype >( *_component, dependencyType, \ + _t,i,nomvar,_bufferLength,*data); \ + } \ + catch ( const CalciumException & ex) \ + { \ + DEBTRACE( ex.what() ); \ + return ex.getInfo(); \ + } \ + catch ( ... ) \ + { \ + DEBTRACE("Unexpected exception " ); \ + return CalciumTypes::CPATAL; \ + } \ + 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 index b607de119..10fb323fc 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx @@ -38,11 +38,15 @@ template struct UnknownProvidesPortType {}; template struct ProvidesPortTraits { typedef UnknownProvidesPortType PortType; }; -template <> struct ProvidesPortTraits { +struct integer {}; +template <> struct ProvidesPortTraits { typedef calcium_integer_port_provides PortType; }; +template <> struct ProvidesPortTraits { + typedef calcium_intc_port_provides PortType; +}; template <> struct ProvidesPortTraits { - typedef calcium_integer_port_provides PortType; + typedef calcium_long_port_provides PortType; }; template <> struct ProvidesPortTraits { typedef calcium_real_port_provides PortType; @@ -65,6 +69,12 @@ struct str {}; template <> struct ProvidesPortTraits { typedef calcium_string_port_provides PortType; }; +// Définition du type intc pour obtenir le type de port +// correspondant +struct intc {}; +template <> struct ProvidesPortTraits { + typedef calcium_intc_port_provides PortType; +}; template < typename T > struct StarTrait { typedef T NonStarType; }; @@ -76,11 +86,14 @@ template struct UnknownUsesPortType {}; template struct UsesPortTraits { typedef UnknownUsesPortType PortType; }; -template <> struct UsesPortTraits { +template <> struct UsesPortTraits { typedef calcium_integer_port_uses PortType; }; +template <> struct UsesPortTraits { + typedef calcium_intc_port_uses PortType; +}; template <> struct UsesPortTraits { - typedef calcium_integer_port_uses PortType; + typedef calcium_long_port_uses PortType; }; template <> struct UsesPortTraits { typedef calcium_real_port_uses PortType; @@ -97,5 +110,8 @@ template <> struct UsesPortTraits { template <> struct UsesPortTraits { typedef calcium_complex_port_uses PortType; }; +template <> struct UsesPortTraits { + typedef calcium_intc_port_uses PortType; +}; #endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx index b6a25e6f9..7baab48d9 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx @@ -24,6 +24,10 @@ CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_integer_port_provides) +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_long_port_provides) + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_intc_port_provides) + CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_real_port_provides) CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_double_port_provides) diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx.in similarity index 85% rename from src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx rename to src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx.in index d22453a39..efa4b7bf1 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx.in @@ -35,6 +35,14 @@ 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_long_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Long_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_intc_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Intc_Port, \ seq_u_manipulation ) \ CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_real_port_provides, \ diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes.hxx index 328e50910..24e893447 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes.hxx @@ -35,11 +35,11 @@ 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 */ + /* 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 */ @@ -65,144 +65,144 @@ namespace CalciumTypes { 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 + 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 */ + /* Codes d'erreur */ - /* Pas d'erreur */ + /* Pas d'erreur */ const int CPOK = 0; - /* Emetteur inconnu */ + /* Emetteur inconnu */ const int CPERIU = 1; - /* Nom de variable inconnu */ + /* Nom de variable inconnu */ const int CPNMVR = 2; - /* Type entree/sortie incompatible */ + /* Type entree/sortie incompatible */ const int CPIOVR = 3; - /* Type inconnu */ + /* Type inconnu */ const int CPTP = 4; - /* Type de variable incompatible */ + /* Type de variable incompatible */ const int CPTPVR = 5; - /* Mode de dependance inconnu */ + /* Mode de dependance inconnu */ // Déclaré au dessus // const int CPIT = 6; - /* Mode dependance incompatible */ + /* Mode dependance incompatible */ const int CPITVR = 7; - /* Requete non autorisee */ + /* Requete non autorisee */ const int CPRENA = 8; - /* Type de deconnexion incorrect */ + /* Type de deconnexion incorrect */ const int CPDNTP = 9; - /* Directive de deconnexion incorrecte */ + /* Directive de deconnexion incorrecte */ const int CPDNDI = 10; - /* Nom de code inconnu */ + /* Nom de code inconnu */ const int CPNMCD = 11; - /* Nom d'instance inconnu */ + /* Nom d'instance inconnu */ const int CPNMIN = 12; - /* Attente */ + /* Attente */ const int CPATTENTE = 13; - /* Blocage */ + /* Blocage */ const int CPBLOC = 14; - /* Nombre de valeurs transmises egal a zero */ + /* Nombre de valeurs transmises egal a zero */ const int CPNTNULL = 15; - /* Longueur de variable insuffisante */ + /* Longueur de variable insuffisante */ const int CPLGVR = 16; - /* L'instance doit s'arreter */ + /* L'instance doit s'arreter */ const int CPSTOP = 17; - /* Arret anormal */ + /* Arret anormal */ const int CPATAL = 18; - /* Coupleur absent */ + /* Coupleur absent */ const int CPNOCP = 19; - /* Variable sortante non connectee */ + /* Variable sortante non connectee */ const int CPCTVR = 20; - /* Nombre de pas a executer egal a zero */ + /* Nombre de pas a executer egal a zero */ const int CPPASNULL = 21; - /* Machine inconnue */ + /* Machine inconnue */ const int CPMACHINE = 22; - /* COUPLAGE_GROUPE non positionnee */ + /* COUPLAGE_GROUPE non positionnee */ const int CPGRNU = 23; - /* Groupe d'instances incorrect */ + /* Groupe d'instances incorrect */ const int CPGRIN = 24; - /* Fin du fichier d'entree */ + /* Fin du fichier d'entree */ const int CPFINFICH = 25; - /* Erreur de format dans un fichier */ + /* Erreur de format dans un fichier */ const int CPERRFICH = 26; - /* Requete d'avance de n pas annulee */ - /* par passage en mode NORMAL */ + /* 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_* */ + /* Coupleur en mode NORMAL pour une */ + /* requete RUN_N_PAS ou DEF_* */ const int CPRUNERR = 28; - /* Option inconnue */ + /* Option inconnue */ const int CPOPT = 29; - /* Valeur d'option inconnue */ + /* Valeur d'option inconnue */ const int CPVALOPT = 30; - /* Ecriture impossible par effacement */ + /* 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 */ + /* 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 */ + /* deconnectee avec directive CP_ARRET */ const int CPINARRET = 33; - /* Les lectures sequentielles ne pourront plus */ - /* etre satisfaites : instance productrice arretee */ + /* Les lectures sequentielles ne pourront plus */ + /* etre satisfaites : instance productrice arretee */ const int CPSTOPSEQ = 34; - /* Erreur dans la chaine de declaration */ + /* Erreur dans la chaine de declaration */ const int CPDECL = 35; /* Erreur dans l'execution de l'instance ajoutee */ const int CPINEXEC = 36; - /* Erreur PVM */ + /* Erreur PVM */ // const int CPPVM = 37; // const int CPCOM = 37; /* Erreur detectee au niveau de l'int CPERRINST = 38; - /* Mode d'execution non defini */ + /* Mode d'execution non defini */ // const int CPMODE = 39; - /* Instance deconnectee */ + /* Instance deconnectee */ const int CPINSTDEC = 40; } diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx index e99de9a6a..b94d092f7 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx @@ -24,6 +24,7 @@ // Id : $Id$ // #include "CalciumTypes2CorbaTypes.hxx" +#include "utilities.h" #include using namespace std; @@ -61,21 +62,16 @@ CORBA_DEPENDENCY_TYPE::CORBA_DEPENDENCY_TYPE() : map & table = ( map & ) *this ; + Ports::Calcium_Ports::DependencyType > & ) *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 ; + 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 ; + Ports::Calcium_Ports::DependencyType >& ) *this ; -#ifdef _DEBUG_ -std::cerr << "CORBA_DEPENDENCY_TYPE() : ::operator["< #include #include "CalciumPortTraits.hxx" +//#define MYDEBUG + template struct Copy2CorbaSpace { @@ -44,7 +47,7 @@ struct Copy2CorbaSpace { //ESSAI: typedef typename PortType::DataManipulator DataManipulator; typedef typename DataManipulator::InnerType InnerType; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- Copy2CorbaSpace MARK 1 ------------------" << std::endl; #endif // Crée le type corba à partir du data sans lui en donner la propriété. @@ -52,7 +55,7 @@ struct Copy2CorbaSpace { // DataManipulator::create n'a pas le caractère const sur son paramètre data pour le // cas de figure où la propriété de la donnée lui est donnée. corbaData = DataManipulator::create(nRead,const_cast (&data),false); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- Copy2CorbaSpace MARK 2 --(dataPtr : " << DataManipulator::getPointer(corbaData,false)<<")----------------" << std::endl; #endif @@ -75,14 +78,14 @@ Copy2CorbaSpace { corbaData = DataManipulator::create(nRead); InnerType * dataPtr = DataManipulator::getPointer(corbaData,false); -#ifdef _DEBUG_ +#ifdef MYDEBUG 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_ +#ifdef MYDEBUG std::cerr << "-------- Copy2CorbaSpace MARK 2 --(nRead: "< MARK 3 : " ; diff --git a/src/DSC/DSC_User/Datastream/Calcium/Copy2UserSpace.hxx b/src/DSC/DSC_User/Datastream/Calcium/Copy2UserSpace.hxx index 9d5054126..c97876d51 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Copy2UserSpace.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/Copy2UserSpace.hxx @@ -35,6 +35,8 @@ #include +//#define MYDEBUG + //Les demandes de copies vers l'espace utilisateur //proviennent d'une procédure de lecture @@ -69,11 +71,11 @@ struct Copy2UserSpace{ // Le PORT doit être capable de répondre aux demandes de lecture // multiples d'une donnée pour une même estampille et doit donc garder un pointeur valide // sur le buffer. Il se pose cependant un problème s'il décide - // de supprimer la donnée alors que des client utilise le buffer (historique) ! + // de supprimer la donnée alors que des client utilise le buffer (historique calcium) ! // La seule façon de gérer proprement cette situation est d'utiliser un shared_pointer (TODO). // Pour l'instant l'utilisateur du mode zero copie doit s'assurer que le niveau d'historique // utilisé par le port est compatible avec son utilisation des buffers. Il doit - // être également conscient que s'il modifie le buffer, il est modifier pour tous les + // être également conscient que s'il modifie le buffer, il est modifié pour tous les // utilisateurs actuels et futurs. //REF: InnerType * dataPtr = DataManipulator::getPointer(corbaData,true); @@ -84,7 +86,7 @@ struct Copy2UserSpace{ // 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 + // C'est l'objet de la spécialisation ci-dessous. data = dataPtr; // En zero copie l'utilisateur doit appeler ecp_free ( cas ou un buffer intermédiaire @@ -106,7 +108,7 @@ struct Copy2UserSpace { typedef typename DataManipulator::InnerType InnerType; -#ifdef _DEBUG_ +#ifdef MYDEBUG InnerType * dataPtr = NULL; // Affiche la valeur du pointeur de la structure corba // et les pointeurs contenus le cas échéant @@ -139,7 +141,7 @@ struct Copy2UserSpace { //std::copy(dataPtr,dataPtr+nRead,data); DataManipulator::copy(corbaData,data,nRead); -#ifdef _DEBUG_ +#ifdef MYDEBUG tmpData = data; std::cerr << "-------- Copy2UserSpace MARK 1c --data("< using namespace std; @@ -61,21 +62,15 @@ DEPENDENCY_TYPE::DEPENDENCY_TYPE() : map & table = ( map & ) *this ; + CalciumTypes::DependencyType > & ) *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 ; + 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["<= b ? a : b) +#define SUP(a,b) (a >= b ? a : b) #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 index e212303ff..bd35d42e9 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_destructors_port_uses.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_destructors_port_uses.cxx @@ -24,6 +24,8 @@ // Module : KERNEL // #include "calcium_integer_port_uses.hxx" +#include "calcium_long_port_uses.hxx" +#include "calcium_intc_port_uses.hxx" #include "calcium_real_port_uses.hxx" #include "calcium_double_port_uses.hxx" #include "calcium_string_port_uses.hxx" @@ -33,6 +35,8 @@ 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_long_port_uses::~calcium_long_port_uses(void) {}; +calcium_intc_port_uses::~calcium_intc_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/Batch/Batch_APIInternalFailureException.cxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_intc_port_uses.hxx similarity index 58% rename from src/Batch/Batch_APIInternalFailureException.cxx rename to src/DSC/DSC_User/Datastream/Calcium/calcium_intc_port_uses.hxx index b75e3bd60..8d76a41c9 100644 --- a/src/Batch/Batch_APIInternalFailureException.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_intc_port_uses.hxx @@ -19,19 +19,34 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/* - * APIInternalFailureException.cxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 20 15:15:42 2003 - * Projet : Salome 2 - * - */ +// File : calcium_int_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_INTC_PORT_USES_HXX_ +#define _CALCIUM_INTC_PORT_USES_HXX_ + +#include + +#include "Calcium_Ports.hh" +#include "CalciumGenericUsesPort.hxx" + +extern char _repository_Calcium_Intc_Port_name[]; + +class calcium_intc_port_uses : + public virtual CalciumGenericUsesPort< seq_u_manipulation, + Ports::Calcium_Ports::Calcium_Intc_Port, + _repository_Calcium_Intc_Port_name + > +{ + public : -#include "Batch_APIInternalFailureException.hxx" -using namespace std; + virtual ~calcium_intc_port_uses(); -namespace Batch { +}; -} +#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.in similarity index 90% rename from src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx rename to src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx.in index a19dab7cc..ddc228a8d 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx.in @@ -37,11 +37,11 @@ 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 CalciumGenericUsesPort< seq_u_manipulation, + Ports::Calcium_Ports::Calcium_Integer_Port, + _repository_Calcium_Integer_Port_name + > { public : diff --git a/src/Batch/Batch_ConnexionFailureException.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_long_port_uses.hxx similarity index 56% rename from src/Batch/Batch_ConnexionFailureException.hxx rename to src/DSC/DSC_User/Datastream/Calcium/calcium_long_port_uses.hxx index 178fecd45..7c2e4222f 100644 --- a/src/Batch/Batch_ConnexionFailureException.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_long_port_uses.hxx @@ -19,35 +19,34 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/* - * ConnexionFailureException.hxx : - * - * Auteur : Ivan DUTKA-MALEN - EDF R&D - * Mail : mailto:ivan.dutka-malen@der.edf.fr - * Date : Thu Nov 13 11:24:31 2003 - * Projet : Salome 2 - * - */ - -#ifndef _CONNEXIONFAILUREEXCEPTION_H_ -#define _CONNEXIONFAILUREEXCEPTION_H_ - -#include "Batch_Defines.hxx" +// File : calcium_long_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_LONG_PORT_USES_HXX_ +#define _CALCIUM_LONG_PORT_USES_HXX_ +#include -#include "Batch_GenericException.hxx" +#include "Calcium_Ports.hh" +#include "CalciumGenericUsesPort.hxx" -namespace Batch { +extern char _repository_Calcium_Long_Port_name[]; - class BATCH_EXPORT ConnexionFailureException : public GenericException - { - public: - // Constructeur - ConnexionFailureException(std::string ch = "undefined") : GenericException("ConnexionFailureException", ch) {} +class calcium_long_port_uses : + public virtual CalciumGenericUsesPort< seq_u_manipulation, + Ports::Calcium_Ports::Calcium_Long_Port, + _repository_Calcium_Long_Port_name + > +{ + public : - }; + virtual ~calcium_long_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 index a99ec947f..a7fc37f3c 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx @@ -43,6 +43,10 @@ calcium_port_factory::create_data_servant(string type) { if ( type == "integer") rtn_port = new calcium_integer_port_provides(); + if ( type == "long") + rtn_port = new calcium_long_port_provides(); + if ( type == "intc") + rtn_port = new calcium_intc_port_provides(); if ( type == "real") rtn_port = new calcium_real_port_provides(); if ( type == "double") @@ -63,6 +67,10 @@ calcium_port_factory::create_data_proxy(string type) { if ( type == "integer") rtn_port = new calcium_integer_port_uses(); + if ( type == "long") + rtn_port = new calcium_long_port_uses(); + if ( type == "intc") + rtn_port = new calcium_intc_port_uses(); if ( type == "real") rtn_port = new calcium_real_port_uses(); if ( type == "double") diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx index cd019e80a..48aa6e20b 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx @@ -37,6 +37,8 @@ #include "CalciumProvidesPort.hxx" #include "calcium_integer_port_uses.hxx" +#include "calcium_long_port_uses.hxx" +#include "calcium_intc_port_uses.hxx" #include "calcium_real_port_uses.hxx" #include "calcium_double_port_uses.hxx" #include "calcium_string_port_uses.hxx" diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_repository_types.cxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_repository_types.cxx index 89852ed1f..08b3f1a50 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_repository_types.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_repository_types.cxx @@ -27,6 +27,8 @@ // Id : $Id$ // #include "calcium_integer_port_uses.hxx" +#include "calcium_long_port_uses.hxx" +#include "calcium_intc_port_uses.hxx" #include "calcium_real_port_uses.hxx" #include "calcium_double_port_uses.hxx" #include "calcium_complex_port_uses.hxx" @@ -34,6 +36,8 @@ #include "calcium_string_port_uses.hxx" char _repository_Calcium_Integer_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0"; +char _repository_Calcium_Long_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Long_Port:1.0"; +char _repository_Calcium_Intc_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Intc_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"; diff --git a/src/DSC/DSC_User/Datastream/Calcium/calciumf.c b/src/DSC/DSC_User/Datastream/Calcium/calciumf.c index 4ebb051fb..3fa9d6295 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calciumf.c +++ b/src/DSC/DSC_User/Datastream/Calcium/calciumf.c @@ -23,6 +23,8 @@ #include #include "fortoc.h" #include "calcium.h" +#include "calciumf.h" +#include "CalciumFortranInt.h" #include static void* COMPO=0; @@ -31,9 +33,10 @@ static void* COMPO=0; extern "C" { #endif -static void fstrtocstr(char *cstr, char *fstr,int fstr_len) + +static void fstrtocstr(char *cstr, char *fstr,cal_int fstr_len) { - int i,iend; + cal_int i,iend; for (iend = fstr_len-1; iend >= 0; iend--) if (fstr[iend] != ' ') break; for (i = 0; i <= iend; i++) @@ -41,9 +44,9 @@ static void fstrtocstr(char *cstr, char *fstr,int fstr_len) cstr[i] = '\0'; } -static void cstrtofstr(char *cstr, char *fstr,int fstr_len) +static void cstrtofstr(char *cstr, char *fstr,cal_int fstr_len) { - int i, len; + cal_int i, len; len = strlen(cstr); if (len > fstr_len) len = fstr_len; for (i = 0; i < len; i++) @@ -52,19 +55,26 @@ static void cstrtofstr(char *cstr, char *fstr,int fstr_len) fstr[i++] = ' '; } -static char * fstr1(char *nom,int nnom) +static char * fstr1(char *nom,cal_int nnom) { char * cnom=(char*)malloc((nnom+1)*sizeof(char)); fstrtocstr(cnom,nom,nnom); return cnom; } -static char * free_str1(char *nom) +static void free_str1(char *nom) { free(nom); } -void F_FUNC(cpcd,CPCD)(long *compo,STR_PSTR(nom),int *info STR_PLEN(nom)) +/**********************************************/ +/* INTERFACES DE DÉBUT ET DE FIN DE COUPLAGE */ +/**********************************************/ + +void F_FUNC(cpcd,CPCD)(long *compo,STR_PSTR(nom),cal_int *info STR_PLEN(nom)); +void F_FUNC(cpfin,CPFIN)(long *compo,cal_int *dep,cal_int *err); + +void F_FUNC(cpcd,CPCD)(long *compo,STR_PSTR(nom),cal_int *info STR_PLEN(nom)) { /* nom is OUT argument */ cp_cd((void *)*compo,STR_PTR(nom)); @@ -72,74 +82,121 @@ void F_FUNC(cpcd,CPCD)(long *compo,STR_PSTR(nom),int *info STR_PLEN(nom)) 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)) +void F_FUNC(cpfin,CPFIN)(long *compo,cal_int *dep,cal_int *err) +{ + *err=cp_fin((void *)*compo,(int)*dep); +} + +/**************************************/ +/* INTERFACES DE LECTURE */ +/**************************************/ + +void F_FUNC(cplin,CPLIN)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, int *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cpllg,CPLLG)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, long *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cplen,CPLEN)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, cal_int *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cpllo,CPLLO)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, int *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cpldb,CPLDB)(long *compo,cal_int *dep,double *ti,double *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, double *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cplre,CPLRE)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cplcp,CPLCP)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cplch,CPLCH)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, char *tab,cal_int *err STR_PLEN(nom) STR_PLEN(tab) ); + + +void F_FUNC(cplin,CPLIN)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, int *tab,cal_int *err STR_PLEN(nom)) +{ + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + +#if !SIZEOF_INT +#error "The macro SIZEOF_INT must be defined." +#elif SIZEOF_INT == 4 + *err=cp_lin_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); +#else + fprintf(stderr,"End of CPLIN: %s : Can't use fortran INTEGER*4 because int C is not 32bits long on this machine.\n", + cnom); +#endif + free_str1(cnom); +} + +void F_FUNC(cpllg,CPLLG)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, long *tab,cal_int *err STR_PLEN(nom)) +{ + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); +#if !SIZEOF_LONG +#error "The macro SIZEOF_LONG must be defined." +#elif SIZEOF_LONG == 8 + *err=cp_llg_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); +#else + fprintf(stderr,"End of CPLLG: %s : Can't use fortran INTEGER*8 because long C is not 64bits long on this machine.\n", + cnom); +#endif + free_str1(cnom); +} + +void F_FUNC(cplen,CPLEN)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, cal_int *tab,cal_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); + *err=cp_len_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); 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)) + +void F_FUNC(cpllo,CPLLO)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, int *tab,cal_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); + *err=cp_llo_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); 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)) +void F_FUNC(cpldb,CPLDB)(long *compo,cal_int *dep,double *ti,double *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, double *tab,cal_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); + *err=cp_ldb_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); 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)) +void F_FUNC(cplre,CPLRE)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, float *tab,cal_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); + *err=cp_lre_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); 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)) +void F_FUNC(cplcp,CPLCP)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, float *tab,cal_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); + *err=cp_lcp_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); 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) ) +void F_FUNC(cplch,CPLCH)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom), + cal_int *max,cal_int *n, char *tab,cal_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); + char **tabChaine = NULL; + cal_int index = 0; + char* cnom = fstr1(STR_PTR(nom),STR_LEN(nom)); 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)); + *err=cp_lch_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tabChaine,STR_LEN(tab)); for (index = 0; index < *n; index++) strncpy(&tab[index * STR_LEN(tab)], tabChaine[index], strlen(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]); @@ -148,13 +205,26 @@ void F_FUNC(cplch,CPLCH)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_ 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 + +/***************************/ +/* INTERFACES D'ECRITURE */ +/***************************/ +void F_FUNC(cpech,CPECH)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, char *tab,cal_int *err + STR_PLEN(nom) STR_PLEN(tab)); +void F_FUNC(cpedb,CPEDB)(long *compo,cal_int *dep,double *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cpere,CPERE)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cpecp,CPECP)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cpein,CPEIN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cpelg,CPELG)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, long *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cpeen,CPEEN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, cal_int *tab,cal_int *err STR_PLEN(nom)); +void F_FUNC(cpelo,CPELO)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_int *err STR_PLEN(nom)); + +void F_FUNC(cpech,CPECH)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, char *tab,cal_int *err STR_PLEN(nom) STR_PLEN(tab)) { char ** tabChaine=NULL; - int index=0,index2=0; + cal_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++) { @@ -169,9 +239,8 @@ void F_FUNC(cpech,CPECH)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom), } } - *err=cp_ech((void *)*compo,*dep,*ti,*iter,cnom,*n,tabChaine,STR_LEN(tab) ); + *err=cp_ech_fort_((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]); @@ -181,57 +250,73 @@ void F_FUNC(cpech,CPECH)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom), 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)) +void F_FUNC(cpedb,CPEDB)(long *compo,cal_int *dep,double *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_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); + *err=cp_edb_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); 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)) +void F_FUNC(cpere,CPERE)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_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); + *err=cp_ere_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); 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)) +void F_FUNC(cpecp,CPECP)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_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); + *err=cp_ecp_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); 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)) + +void F_FUNC(cpein,CPEIN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_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); +#if !SIZEOF_INT +#error "The macro SIZEOF_INT must be defined." +#elif SIZEOF_INT == 4 + *err=cp_ein_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); +#else + fprintf(stderr,"CPEIN: %s %f %d : Can't use fortran INTEGER*4 because int C is not 32bits long on this machine.\n", + cnom, *ti,*iter); +#endif 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)) +void F_FUNC(cpelg,CPELG)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, long *tab,cal_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); +#if !SIZEOF_LONG +#error "The macro SIZEOF_LONG must be defined." +#elif SIZEOF_LONG == 8 + *err=cp_elg_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); +#else + fprintf(stderr,"CPELG: %s %f %d : Can't use fortran INTEGER*8 because long C is not 64bits long on this machine.\n", + cnom, *ti,*iter); +#endif free_str1(cnom); } -void F_FUNC(cpfin,CPFIN)(long *compo,int *dep,int *err) +void F_FUNC(cpeen,CPEEN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, cal_int *tab,cal_int *err STR_PLEN(nom)) { - fprintf(stderr,"CPFIN: \n"); - *err=cp_fin((void *)*compo,*dep); + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + *err=cp_een_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); + free_str1(cnom); } +void F_FUNC(cpelo,CPELO)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_int *err STR_PLEN(nom)) +{ + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + *err=cp_elo_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); + free_str1(cnom); +} + + #ifdef __cplusplus } #endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calciumf.h b/src/DSC/DSC_User/Datastream/Calcium/calciumf.h new file mode 100644 index 000000000..d4056e3f1 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calciumf.h @@ -0,0 +1,78 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-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 __CALCIUMF_H +#define __CALCIUMF_H + +#include "CalciumFortranInt.h" + +/*TODO CPCD... */ + +#define STAR * +#define LCH_LAST_PARAM ,int strsize + + +#define CALCIUM_ECR_INTERFACE_C_H(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \ + extern _calInt cp_##_name (void * component, _calInt mode, \ + _timeType t, _calInt i, \ + char * nomvar, _calInt nbelem, \ + _type _qual * data \ + lastarg ) ; \ + + +CALCIUM_ECR_INTERFACE_C_H(een_fort_,float ,cal_int,cal_int,integer,,); +CALCIUM_ECR_INTERFACE_C_H(elg_fort_,float ,cal_int,long ,long2integer,,); +CALCIUM_ECR_INTERFACE_C_H(ein_fort_,float ,cal_int,int ,int2integer,,); +CALCIUM_ECR_INTERFACE_C_H(ere_fort_,float ,cal_int,float ,float,,); +CALCIUM_ECR_INTERFACE_C_H(edb_fort_,double,cal_int,double,double,,); +CALCIUM_ECR_INTERFACE_C_H(elo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ +CALCIUM_ECR_INTERFACE_C_H(ecp_fort_,float ,cal_int,float ,cplx,,); +CALCIUM_ECR_INTERFACE_C_H(ech_fort_,float ,cal_int,char ,str,STAR,LCH_LAST_PARAM ); + + + +#define CALCIUM_LECT_INTERFACE_C_H(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \ + extern _calInt cp_##_name (void * component, _calInt mode, \ + _timeType * ti, _timeType * tf, _calInt * i, \ + char * nomvar, _calInt bufferLength, \ + _calInt * nRead, _type _qual * data \ + lastarg ) ; \ + \ + + +CALCIUM_LECT_INTERFACE_C_H(len_fort_,float ,cal_int,cal_int ,integer,,); +CALCIUM_LECT_INTERFACE_C_H(llg_fort_,float ,cal_int,long ,long2integer,,); +CALCIUM_LECT_INTERFACE_C_H(lin_fort_,float ,cal_int,int ,int2integer,,); +CALCIUM_LECT_INTERFACE_C_H(lre_fort_,float ,cal_int,float ,float,,); +CALCIUM_LECT_INTERFACE_C_H(ldb_fort_,double,cal_int,double ,double,,); +CALCIUM_LECT_INTERFACE_C_H(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ +CALCIUM_LECT_INTERFACE_C_H(lcp_fort_,float ,cal_int,float ,cplx,,); +CALCIUM_LECT_INTERFACE_C_H(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_PARAM ); + + + +#endif diff --git a/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx b/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx index 7cf7501c2..ada58a3c7 100644 --- a/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx +++ b/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx @@ -33,6 +33,7 @@ #include #include +//#define MYDEBUG // Classes manipulation // ------------------- @@ -227,7 +228,7 @@ public: // En non collocalisé on recrée une séquence avec le buffer de la première dont on // a demandé la propriété. -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1 ------------------" << std::endl; #endif if ( data.release() ) { @@ -236,13 +237,13 @@ public: // Crée une nouvelle sequence propriétaire des données du buffer (pas de recopie) // Les données de la nouvelle 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_ +#ifdef MYDEBUG 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_ +#ifdef MYDEBUG 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) @@ -397,12 +398,12 @@ public: // 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_ +#ifdef MYDEBUG 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_ +#ifdef MYDEBUG 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) diff --git a/src/DSC/DSC_User/Datastream/GenericPort.hxx b/src/DSC/DSC_User/Datastream/GenericPort.hxx index ac7e29411..a760ee011 100644 --- a/src/DSC/DSC_User/Datastream/GenericPort.hxx +++ b/src/DSC/DSC_User/Datastream/GenericPort.hxx @@ -31,10 +31,13 @@ #include "CorbaTypeManipulator.hxx" +#include "Superv_Component_i.hxx" // SALOME CORBA Exception #include "Utils_CorbaException.hxx" // SALOME C++ Exception #include "Utils_SALOME_Exception.hxx" +#include "DSC_Exception.hxx" +#include "utilities.h" #include #include @@ -43,6 +46,8 @@ #include #include +//#define MYDEBUG + // Classe GenericPort // -------------------------------- // @@ -64,7 +69,7 @@ public: 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 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(); @@ -104,7 +109,7 @@ template < typename DataManipulator, typename COUPLING_POLICY> GenericPort::~GenericPort() { typename DataTable::iterator it; for (it=storedDatas.begin(); it!=storedDatas.end(); ++it) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "~GenericPort() : destruction de la donnnée associée au DataId :"<< (*it).first << std::endl; #endif DataManipulator::delete_data( (*it).second ); @@ -113,7 +118,7 @@ GenericPort::~GenericPort() { template < typename DataManipulator, typename COUPLING_POLICY> void GenericPort::close (PortableServer::POA_var poa, - PortableServer::ObjectId_var id) { + PortableServer::ObjectId_var id) { // Ferme le port en supprimant le servant // La desactivation du servant du POA provoque sa suppression poa->deactivate_object (id); @@ -122,12 +127,12 @@ GenericPort::close (PortableServer::POA_var po template < typename DataManipulator, typename COUPLING_POLICY> void GenericPort::wakeupWaiting() { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- wakeupWaiting ------------------" << std::endl; #endif storedDatas_mutex.lock(); if (waitingForAnyDataId || waitingForConvenientDataId) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- wakeupWaiting:signal --------" << std::endl; std::cout << std::flush; #endif @@ -145,12 +150,12 @@ GenericPort::wakeupWaiting() template < typename DataManipulator, typename COUPLING_POLICY> template < typename TimeType,typename TagType> void GenericPort::put(CorbaInDataType dataParam, - TimeType time, - TagType tag) { + TimeType time, + TagType tag) { fflush(stdout); fflush(stderr); try { -#ifdef _DEBUG_ +#ifdef MYDEBUG // Affichage des donnees pour DEBUGging std::cerr << "parametres emis: " << time << ", " << tag << std::endl; DataManipulator::dump(dataParam); @@ -173,11 +178,11 @@ void GenericPort::put(CorbaInDataType dataPara bool expectedDataReceived = false; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 1 ------------------" << std::endl; #endif if ( dataIds.empty() ) return; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 1bis ------------------" << std::endl; #endif @@ -188,7 +193,7 @@ void GenericPort::put(CorbaInDataType dataPara int nbOfIter = 0; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 2 ------ "<< (dataIdIt == dataIds.end()) << "------------" << std::endl; std::cout << "-------- Put : MARK 2bis "<< (*dataIdIt) <<"------------------" << std::endl; #endif @@ -196,18 +201,18 @@ void GenericPort::put(CorbaInDataType dataPara for (;dataIdIt != dataIds.end();++dataIdIt) { -#ifdef _DEBUG_ +#ifdef MYDEBUG 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_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 3bis -----"<< dataIdIt.operator*() <<"------------" << std::endl; #endif DataId currentDataId=*dataIdIt; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "processing dataId : "<< currentDataId << std::endl; std::cout << "-------- Put : MARK 4 ------------------" << std::endl; @@ -221,39 +226,39 @@ void GenericPort::put(CorbaInDataType dataPara // <=> premier emplacement où l'on pourrait insérer notre DataId // <=> en général équivaux à (*wDataIt).first >= currentDataId typename DataTable::iterator wDataIt = storedDatas.lower_bound(currentDataId); -#ifdef _DEBUG_ +#ifdef MYDEBUG 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 + // 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; +#ifdef MYDEBUG + std::cout << "-------- Put : MARK 6 ------------------" << std::endl; #endif - // Ajoute la donnee dans la table - wDataIt = storedDatas.insert(wDataIt, make_pair (currentDataId, data)); + // 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); + // 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 MYDEBUG + 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_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 8 ------------------" << std::endl; #endif // Compte le nombre de dataIds à traiter ++nbOfIter; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Put : waitingForConvenientDataId : " << waitingForConvenientDataId <<"---" << std::endl; std::cout << "-------- Put : waitingForAnyDataId : " << waitingForAnyDataId <<"---" << std::endl; std::cout << "-------- Put : currentDataId : " << currentDataId <<"---" << std::endl; @@ -275,27 +280,27 @@ void GenericPort::put(CorbaInDataType dataPara // 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; + ( waitingForConvenientDataId && + isDataIdConveniant(storedDatas, expectedDataId, dummy1, dummy2, dummy3) ) + ) { +#ifdef MYDEBUG + std::cout << "-------- Put : MARK 10 ------------------" << std::endl; +#endif + //Doit pouvoir réveiller le get ici (a vérifier) + expectedDataReceived = true; } } if (expectedDataReceived) { -#ifdef _DEBUG_ +#ifdef MYDEBUG 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; + waitingForAnyDataId = false; else - waitingForConvenientDataId = false; + 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 @@ -305,20 +310,20 @@ void GenericPort::put(CorbaInDataType dataPara // Pb2 : également si deux attentes de DataIds même différents car on n'en stocke qu'un ! // Conclusion : Pour l'instant on ne gère pas un service multithreadé qui effectue // des lectures simultanées sur le même port ! -#ifdef _DEBUG_ - std::cout << "-------- Put : new datas available ------------------" << std::endl; +#ifdef MYDEBUG + std::cerr << "-------- Put : new datas available ------------------" << std::endl; #endif fflush(stdout);fflush(stderr); cond_instance.signal(); } -#ifdef _DEBUG_ +#ifdef MYDEBUG 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_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 13 ------------------" << std::endl; #endif fflush(stdout); @@ -345,7 +350,7 @@ template < typename DataManipulator, typename COUPLING_POLICY > template < typename TimeType,typename TagType> typename DataManipulator::Type GenericPort::get(TimeType time, - TagType tag) + 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 @@ -357,11 +362,11 @@ GenericPort::get(TimeType time, bool isEqual, isBounded; typedef typename DataManipulator::InnerType InnerType; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 1 ------------------" << std::endl; #endif expectedDataId = DataId(time,tag); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 2 ------------------" << std::endl; #endif @@ -379,44 +384,44 @@ GenericPort::get(TimeType time, // - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first // Méthode provenant de la COUPLING_POLICY isDataIdConveniant(storedDatas,expectedDataId,isEqual,isBounded,wDataIt1); -#ifdef _DEBUG_ +#ifdef MYDEBUG 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 MYDEBUG + 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 MYDEBUG + 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 MYDEBUG + std::cout << "-------- Get : MARK 6 ------------------" << std::endl; +#endif + break; } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 7 ------------------" << std::endl; #endif @@ -424,45 +429,45 @@ GenericPort::get(TimeType time, // 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); + // 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 MYDEBUG + 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); + // 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 MYDEBUG + 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; + 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); + typename COUPLING_POLICY::template EraseDataIdProcessor processEraseDataId(*this); + processEraseDataId.apply(storedDatas,wDataIt1); - break; + break; } // Délègue au mode de couplage la gestion d'une demande de donnée non disponible @@ -472,21 +477,38 @@ GenericPort::get(TimeType time, // Réception bloquante sur le dataId demandé // Si l'instance de donnée n'est pas trouvee -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 10 ------------------" << std::endl; #endif //Positionné à faux dans la méthode put waitingForConvenientDataId = true; -#ifdef _DEBUG_ +#ifdef MYDEBUG 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_ + unsigned long ts, tns,rs=Superv_Component_i::dscTimeOut; + if(rs==0) + cond_instance.wait(); + else + { + //Timed wait on omni condition + omni_thread::get_time(&ts,&tns, rs,0); + int success=cond_instance.timedwait(ts,tns); + if(!success) + { + // Waiting too long probably blocking + std::stringstream msg; + msg<<"Timeout ("<::get(TimeType time, // Deverouille l'acces a la table storedDatas_mutex.unlock(); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 13 ------------------" << std::endl; #endif @@ -514,11 +536,11 @@ GenericPort::get(TimeType time, 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); +GenericPort::get(TimeType& ti, + TimeType tf, + TagType tag ) { + ti = COUPLING_POLICY::getEffectiveTime(ti,tf); + return get(ti,tag); } @@ -528,7 +550,7 @@ template < typename DataManipulator, typename COUPLING_POLICY > template < typename TimeType,typename TagType> typename DataManipulator::Type GenericPort::next(TimeType &t, - TagType &tag ) { + TagType &tag ) { typedef typename COUPLING_POLICY::DataId DataId; @@ -538,7 +560,7 @@ GenericPort::next(TimeType &t, try { storedDatas_mutex.lock();// Gérer les Exceptions ds le corps de la méthode -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 1 ---lastDataIdSet ("<::next(TimeType &t, // 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; + waitingForAnyDataId = false; break; } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 2 ------------------" << std::endl; #endif //Positionné à faux dans la méthode put waitingForAnyDataId = true; -#ifdef _DEBUG_ +#ifdef MYDEBUG 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(); + unsigned long ts, tns,rs=Superv_Component_i::dscTimeOut; + if(rs==0) + cond_instance.wait(); + else + { + //Timed wait on omni condition + omni_thread::get_time(&ts,&tns, rs,0); + int success=cond_instance.timedwait(ts,tns); + if(!success) + { + // Waiting too long probably blocking + std::stringstream msg; + msg<<"Timeout ("<::next(TimeType &t, tag = getTag ( (*wDataIt1).first ); dataToTransmit = (*wDataIt1).second; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 7 ------------------" << std::endl; #endif lastDataId = (*wDataIt1).first; @@ -614,11 +652,11 @@ GenericPort::next(TimeType &t, typename COUPLING_POLICY::template EraseDataIdProcessor processEraseDataId(*this); processEraseDataId.apply(storedDatas, wDataIt1); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 8 ------------------" << std::endl; #endif } catch (...) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 8bis ------------------" << std::endl; #endif waitingForAnyDataId = false; @@ -627,7 +665,7 @@ GenericPort::next(TimeType &t, } storedDatas_mutex.unlock(); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 9 ------------------" << std::endl; #endif diff --git a/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx b/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx index 0d397e172..351388554 100644 --- a/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx +++ b/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx @@ -107,8 +107,8 @@ GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::put CorbaPortTypeVar port = CorbaPortType::_narrow((*_my_ports)[i]); //if (i) { PB1 //OLD : copyOfData = DataManipulator::clone(data); -#ifdef _DEBUG_ - std::cout << "-------- GenericUsesPort::put -------- " << std::endl; +#ifdef MYDEBUG + std::cerr << "-------- GenericUsesPort::put -------- " << std::endl; #endif //} PB1 try { @@ -116,7 +116,7 @@ GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::put // 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°" + throw DSC_Exception(LOC(OSS() << "Can't invoke put method on port number " << i << "( i>= 0)")); } @@ -137,7 +137,7 @@ GenericUsesPort< DataManipulator, CorbaPortType, repositoryName, UsesPort { if (_my_ports) delete _my_ports; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "GenericUsesPort::uses_port_changed" << std::endl; #endif _my_ports = new_uses_port; diff --git a/src/DSC/DSC_User/Datastream/Palm/Makefile.am b/src/DSC/DSC_User/Datastream/Palm/Makefile.am index 8d663d52d..d47ea5789 100644 --- a/src/DSC/DSC_User/Datastream/Palm/Makefile.am +++ b/src/DSC/DSC_User/Datastream/Palm/Makefile.am @@ -51,7 +51,6 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \ -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@ diff --git a/src/DSC/DSC_User/Makefile.am b/src/DSC/DSC_User/Makefile.am index 9c6f39364..2248445c1 100644 --- a/src/DSC/DSC_User/Makefile.am +++ b/src/DSC/DSC_User/Makefile.am @@ -52,7 +52,6 @@ COMMON_CPPFLAGS= \ -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@ diff --git a/src/DSC/DSC_User/Superv_Component_i.cxx b/src/DSC/DSC_User/Superv_Component_i.cxx index 15bb1894f..c35017d3d 100644 --- a/src/DSC/DSC_User/Superv_Component_i.cxx +++ b/src/DSC/DSC_User/Superv_Component_i.cxx @@ -36,6 +36,8 @@ DSC_EXCEPTION_CXX(Superv_Component_i,NilPort); DSC_EXCEPTION_CXX(Superv_Component_i,BadProperty); std::map Superv_Component_i::_factory_map; +long Superv_Component_i::dscTimeOut=0; + Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, @@ -45,9 +47,10 @@ Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb, bool notif) : Engines_DSC_i(orb, poa, contId, instanceName, interfaceName) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl; #endif + setTimeOut(); } Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, @@ -58,9 +61,10 @@ Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb, bool regist) : Engines_DSC_i(orb, poa, container, instanceName, interfaceName,notif,regist) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl; #endif + setTimeOut(); } @@ -116,7 +120,7 @@ Superv_Component_i::create_provides_data_port(const std::string& port_fab_type) } if (rtn_port == NULL) - throw BadFabType( LOC(OSS()<< "Impossible d'accéder à la fabrique " + throw BadFabType( LOC(OSS()<< "No way to get the port factory " <p_ref; } catch (const Engines::DSC::PortNotDefined&) { - throw PortNotDefined( LOC(OSS()<< "Le port provides " - << provides_port_name <<" n'existe pas.")); + throw PortNotDefined( LOC(OSS()<< "provides port " + << provides_port_name <<" does not exist.")); } catch (const Engines::DSC::PortNotConnected&) { - throw PortNotConnected( LOC(OSS()<< "Le port provides " << provides_port_name - << " n'est pas connecté.")); + throw PortNotConnected( LOC(OSS()<< "provides port " << provides_port_name + << " is not connected.")); } } @@ -271,11 +275,11 @@ Superv_Component_i::get_port(uses_port *& port, 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.")); + throw PortNotDefined( LOC(OSS()<< "uses port " + << uses_port_name <<" does not exist.")); } catch (const Engines::DSC::PortNotConnected&) { - throw PortNotConnected( LOC(OSS()<< "Le port uses " << uses_port_name - << " n'est pas connecté.")); + throw PortNotConnected( LOC(OSS()<< "uses port " << uses_port_name + << " is not connected.")); } } @@ -318,3 +322,22 @@ Superv_Component_i::get_uses_port_names(std::vector & port_names, for (it=my_superv_ports.begin(); it!=my_superv_ports.end();++it) if( (*it).second->p_ref == NULL ) port_names.push_back((*it).first); } + +void Superv_Component_i::setTimeOut() +{ + char* valenv=getenv("DSC_TIMEOUT"); + if(valenv) + { + std::istringstream iss(valenv); + long temp; + if (iss >> temp) + if(temp >=0) + Superv_Component_i::dscTimeOut=temp; + } +} + +void Superv_Component_i::beginService(const char *serviceName) +{ + Engines_DSC_i::beginService(serviceName); + setTimeOut(); +} diff --git a/src/DSC/DSC_User/Superv_Component_i.hxx b/src/DSC/DSC_User/Superv_Component_i.hxx index ec6d8abcb..246118160 100644 --- a/src/DSC/DSC_User/Superv_Component_i.hxx +++ b/src/DSC/DSC_User/Superv_Component_i.hxx @@ -35,6 +35,7 @@ #include "DSC_Exception.hxx" #include +//#define MYDEBUG /*! \class Superv_Component_i * \brief This class implements DSC_User component. @@ -43,7 +44,7 @@ * 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. + * operations to add ports that are provided by default by SALOME 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. @@ -255,6 +256,12 @@ public: */ virtual port_factory * get_factory(const std::string & factory_name); + /*! + */ + static long dscTimeOut; + static void setTimeOut(); + void beginService(const char *serviceName); + private: // Factory map typedef std::map factory_map_t; @@ -267,7 +274,18 @@ private: ~superv_port_t() { if(u_ref)delete u_ref; - if(p_ref)delete p_ref; + if(p_ref) + { + // do not delete CORBA servant : deactivate it and then call _remove_ref or delete + PortableServer::ServantBase* servant=dynamic_cast(p_ref); + if(servant) + { + PortableServer::POA_var poa =servant->_default_POA(); + PortableServer::ObjectId_var oid = poa->servant_to_id(servant); + poa->deactivate_object(oid); + servant->_remove_ref(); + } + } }; // For uses ports. uses_port * u_ref; @@ -297,7 +315,7 @@ Superv_Component_i::add_port(const char * port_fab_type, assert(port_name); SpecificPortType * retPort; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "---- Superv_Component_i::add_port : Mark 0 ---- " << port_name << "----" << std::endl; #endif @@ -307,26 +325,26 @@ Superv_Component_i::add_port(const char * 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 " )); + throw BadCast( LOC("Can't cast to asked port type " )); } } else if (s_port_type == "uses") { uses_port * port = create_uses_data_port(port_fab_type); add_port(port, port_name); -#ifdef _DEBUG_ +#ifdef MYDEBUG 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_ +#ifdef MYDEBUG 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 " )); + throw BadCast( LOC("Can't cast to asked port type " )); } } else - throw BadType(LOC(OSS()<< "Le port_type doit être soit 'provides' soit 'uses' not " + throw BadType(LOC(OSS()<< "port_type must be either 'provides' either 'uses' not " << port_type)); return retPort; @@ -363,17 +381,16 @@ Superv_Component_i::get_port( const char * port_name) } } catch (const Engines::DSC::PortNotDefined&) { - throw PortNotDefined( LOC(OSS()<< "Le port " - << port_name <<" n'existe pas.")); + throw PortNotDefined( LOC(OSS()<< "port " + << port_name <<" does not exist.")); } catch (const Engines::DSC::PortNotConnected&) { - throw PortNotConnected( LOC(OSS()<< "Le port " << port_name - << " n'est pas connecté.")); + throw PortNotConnected( LOC(OSS()<< "port " << port_name + << " is not connected.")); } retPort = dynamic_cast(port); if ( retPort == NULL ) { - delete port; - throw BadCast( LOC("La conversion vers le type de port demandé n'est pas possible " )); + throw BadCast( LOC("Can't cast to required port type " )); } return retPort; diff --git a/src/DSC/DSC_User/base_port.cxx b/src/DSC/DSC_User/base_port.cxx index 791a3a208..b66ba734a 100644 --- a/src/DSC/DSC_User/base_port.cxx +++ b/src/DSC/DSC_User/base_port.cxx @@ -20,6 +20,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "base_port.hxx" +#include base_port::base_port() @@ -29,7 +30,11 @@ base_port::base_port() base_port::~base_port() { - delete default_properties; + //do not call delete on corba servant: deactivate it and then call _remove_ref or delete + PortableServer::POA_var poa =default_properties->_default_POA(); + PortableServer::ObjectId_var oid = poa->servant_to_id(default_properties); + poa->deactivate_object(oid); + default_properties->_remove_ref(); } Ports::PortProperties_ptr diff --git a/src/DSC/ParallelDSC/Makefile.am b/src/DSC/ParallelDSC/Makefile.am index 64346973e..d98dc9a5b 100644 --- a/src/DSC/ParallelDSC/Makefile.am +++ b/src/DSC/ParallelDSC/Makefile.am @@ -50,7 +50,6 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \ -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 \ diff --git a/src/GenericObj/Makefile.am b/src/GenericObj/Makefile.am index 115e2b722..d159e87be 100644 --- a/src/GenericObj/Makefile.am +++ b/src/GenericObj/Makefile.am @@ -39,7 +39,6 @@ libSalomeGenericObj_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeGenericObj_la_CPPFLAGS = \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ libSalomeGenericObj_la_LIBADD = \ diff --git a/src/HDFPersist/HDFobjectIdentify.c b/src/HDFPersist/HDFobjectIdentify.c index 5ec213de8..a5bc7710f 100644 --- a/src/HDFPersist/HDFobjectIdentify.c +++ b/src/HDFPersist/HDFobjectIdentify.c @@ -26,6 +26,7 @@ SALOME HDFPersist : implementation of HDF persitent ( save/ restore ) ----------------------------------------------------------------------------*/ #include "hdfi.h" +#include /* * - Name: HDFobjectIdentify diff --git a/src/KERNEL_PY/Help.py b/src/KERNEL_PY/Help.py index 9087a8191..7bb0872f0 100755 --- a/src/KERNEL_PY/Help.py +++ b/src/KERNEL_PY/Help.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/KERNEL_PY/Makefile.am b/src/KERNEL_PY/Makefile.am index 869e2f913..98200fc09 100755 --- a/src/KERNEL_PY/Makefile.am +++ b/src/KERNEL_PY/Makefile.am @@ -36,18 +36,17 @@ if CORBA_GEN Help.py \ PyInterp.py \ salome.py \ - salome_shared_modules.py \ batchmode_salome.py \ - import_hook.py \ salome_test.py \ salome_kernel.py \ salome_study.py \ salome_iapp.py \ salome_ComponentGUI.py \ - omnipatch.py \ iparameters.py \ salome_version.py \ - salome_notebook.py + salome_notebook.py \ + salome_pynode.py \ + salome_genericobj.py endif sharedpkgpython_PYTHON = kernel_shared_modules.py diff --git a/src/KERNEL_PY/PyInterp.py b/src/KERNEL_PY/PyInterp.py index 8b6bf075a..dc9b3b785 100755 --- a/src/KERNEL_PY/PyInterp.py +++ b/src/KERNEL_PY/PyInterp.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/KERNEL_PY/batchmode_salome.py b/src/KERNEL_PY/batchmode_salome.py index d4aeb6c43..0c53d18a6 100755 --- a/src/KERNEL_PY/batchmode_salome.py +++ b/src/KERNEL_PY/batchmode_salome.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/KERNEL_PY/import_hook.py b/src/KERNEL_PY/import_hook.py index e1a48d354..05781dd93 100755 --- a/src/KERNEL_PY/import_hook.py +++ b/src/KERNEL_PY/import_hook.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -149,14 +150,14 @@ def ensure_fromlist(m, fromlist, recursive=0): l.append((subname,submod)) return l -def import_hook(name, globals=None, locals=None, fromlist=None): +def import_hook(name, globals=None, locals=None, fromlist=None, *args): """ Import replacement for sharing modules among multiple interpreters Mostly update sys.modules before doing real import """ #print "import_hook",name,fromlist m=get_shared_imported(name,fromlist) - module= original_import(name, globals, locals, fromlist) + module= original_import(name, globals, locals, fromlist, *args) if fromlist: #when fromlist is specified, module is the real module diff --git a/src/KERNEL_PY/iparameters.py b/src/KERNEL_PY/iparameters.py index e3d77df2b..fe37b2ec7 100755 --- a/src/KERNEL_PY/iparameters.py +++ b/src/KERNEL_PY/iparameters.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/KERNEL_PY/kernel_shared_modules.py b/src/KERNEL_PY/kernel_shared_modules.py index 74ddf9587..386e6b61e 100755 --- a/src/KERNEL_PY/kernel_shared_modules.py +++ b/src/KERNEL_PY/kernel_shared_modules.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/KERNEL_PY/omnipatch.py b/src/KERNEL_PY/omnipatch.py index e1534408e..7f72b3d95 100644 --- a/src/KERNEL_PY/omnipatch.py +++ b/src/KERNEL_PY/omnipatch.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/KERNEL_PY/salome.py b/src/KERNEL_PY/salome.py index 446c3e08d..00371c488 100755 --- a/src/KERNEL_PY/salome.py +++ b/src/KERNEL_PY/salome.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/KERNEL_PY/salome_ComponentGUI.py b/src/KERNEL_PY/salome_ComponentGUI.py index a2b0f42de..d98cb0638 100644 --- a/src/KERNEL_PY/salome_ComponentGUI.py +++ b/src/KERNEL_PY/salome_ComponentGUI.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/KERNEL_PY/salome_genericobj.py b/src/KERNEL_PY/salome_genericobj.py new file mode 100644 index 000000000..60ad5cc9c --- /dev/null +++ b/src/KERNEL_PY/salome_genericobj.py @@ -0,0 +1,26 @@ +# -*- coding: iso-8859-1 -*- + +""" + When imported this module adds to CORBA objref from GenericObj type + automatic management of reference count + The reference count is incremented when the local proxy is created (assignment of __omni_obj attribute) + and is decremented when the local proxy is deleted (call of __del__) + + The GenericObj class for proxy is modified by adding two methods : __del__ and __setattr__ + The module must be imported before any other import of SALOME CORBA module +""" +import omniORB +import SALOME + +def mydel(self): + self.Destroy() + omniORB.CORBA.Object.__del__(self) + +def mysetattr(self,attr,value): + self.__dict__[attr]=value + if attr == "__omni_obj": + self.Register() + +SALOME._objref_GenericObj.__del__=mydel +SALOME._objref_GenericObj.__setattr__=mysetattr + diff --git a/src/KERNEL_PY/salome_iapp.py b/src/KERNEL_PY/salome_iapp.py index b8e394ae6..e37caf2cf 100644 --- a/src/KERNEL_PY/salome_iapp.py +++ b/src/KERNEL_PY/salome_iapp.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/KERNEL_PY/salome_kernel.py b/src/KERNEL_PY/salome_kernel.py index 162ab6cd1..2c949285d 100644 --- a/src/KERNEL_PY/salome_kernel.py +++ b/src/KERNEL_PY/salome_kernel.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/KERNEL_PY/salome_notebook.py b/src/KERNEL_PY/salome_notebook.py index cdc5a5ad1..92e49c991 100644 --- a/src/KERNEL_PY/salome_notebook.py +++ b/src/KERNEL_PY/salome_notebook.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # @@ -29,6 +30,44 @@ Module salome_notebook gives access to Salome Notebook. import salome +class PseudoStudyForNoteBook(object): + + def __init__(self, **kwargs): + self.kwargs = kwargs + pass + + def GetVariableNames(self): + return self.kwargs.keys() + + def IsVariable(self, variableName): + return variableName in self.kwargs + + def IsReal(self, variableName): + val = self.kwargs[variableName] + try: + float(val) + return True + except: + pass + return False + + IsInteger = IsReal + IsBoolean = IsReal + + def IsString(self, variableName): + return not self.IsReal(variableName) + + def GetString(self, variableName): + return self.kwargs[variableName] + + def GetReal(self, variableName): + return float(self.kwargs[variableName]) + + GetInteger = GetReal + GetBoolean = GetReal + + pass + class NoteBook: def __init__(self, Study): @@ -48,6 +87,9 @@ class NoteBook: elif type(variable) == bool: self.myStudy.SetBoolean(variableName, variable) + elif type(variable) == str: + self.myStudy.SetString(variableName, variable) + def get(self, variableName): """ Return value of the variable with name "variableName". @@ -63,6 +105,36 @@ class NoteBook: elif self.myStudy.IsBoolean(variableName): aResult = self.myStudy.GetBoolean(variableName) + + elif self.myStudy.IsString(variableName): + aResult = self.myStudy.GetString(variableName) + aResult_orig = aResult + l = self.myStudy.GetVariableNames() + l.remove(variableName) + # -- + # To avoid the smallest strings to be replaced first, + # the list is sorted by decreasing lengths + # -- + l.sort(key=str.__len__) + l.reverse() + for name in l: + if aResult.find(name) >= 0: + val = self.get(name) + aResult = aResult.replace(name, "%s"%(val)) + pass + pass + try: + aResult = eval(aResult) + except Exception, e: + msg = str(e) + msg += "\n" + msg += "A problem occurs while parsing " + msg += "the variable %s "%(variableName.__repr__()) + msg += "with value %s ..."%(aResult_orig.__repr__()) + msg += "\n" + msg += "Please, check your notebook !" + raise Exception(msg) + pass return aResult @@ -72,5 +144,37 @@ class NoteBook: exists in the study, otherwise return false. """ return self.myStudy.IsVariable(variableName) - -notebook = NoteBook(salome.myStudy) \ No newline at end of file + + def setAs(self, variableName, typ): + value = self.get(variableName) + value = float(typ(value)) + self.myStudy.SetStringAsDouble(variableName, value) + return + + def setAsReal(self, variableName): + self.setAs(variableName, float) + return + + def setAsInteger(self, variableName): + self.setAs(variableName, int) + return + + def setAsBool(self, variableName): + self.setAs(variableName, bool) + return + + def check(self): + for variableName in self.myStudy.GetVariableNames(): + self.get(variableName) + pass + return + + pass + +def checkThisNoteBook(**kwargs): + study = PseudoStudyForNoteBook(**kwargs) + note_book = NoteBook(study) + note_book.check() + return + +notebook = NoteBook(salome.myStudy) diff --git a/src/KERNEL_PY/salome_pynode.py b/src/KERNEL_PY/salome_pynode.py new file mode 100644 index 000000000..0a8182b9f --- /dev/null +++ b/src/KERNEL_PY/salome_pynode.py @@ -0,0 +1,61 @@ +# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-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_pynode.py +# Author : Christian CAREMOLI, EDF +# Module : SALOME +# $Header$ +# + +""" + When imported this module adds to CORBA proxy (from PyNode type) automatic pickle and unpickle + of arguments and results when calling execute method. It also converts the SALOME exception into a standard python + exception +""" +import omniORB +import cPickle +import SALOME +import Engines + +class SmartPyNode(Engines._objref_PyNode): + def __init__(self): + Engines._objref_PyNode.__init__(self) + + def execute(self,functionName,*args,**kws): + try: + args=cPickle.dumps((args,kws),-1) + results=Engines._objref_PyNode.execute(self,functionName,args) + x=cPickle.loads(results) + return x + except SALOME.SALOME_Exception, e: + raise ValueError(e.details.text) + + def __getattr__(self,name): + """ a trick to be able to call directly a remote method by its name : no need to use execute""" + if name[0]== '_': + raise AttributeError, name + def afunc(*args,**kws): + return self.execute(name,*args,**kws) + return afunc + +#Register the new proxy for PyNode +omniORB.registerObjref(Engines._objref_PyNode._NP_RepositoryId, SmartPyNode) + diff --git a/src/KERNEL_PY/salome_shared_modules.py b/src/KERNEL_PY/salome_shared_modules.py index 57c128cc6..2dc216650 100755 --- a/src/KERNEL_PY/salome_shared_modules.py +++ b/src/KERNEL_PY/salome_shared_modules.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/KERNEL_PY/salome_study.py b/src/KERNEL_PY/salome_study.py index a6352447c..1c73f3926 100644 --- a/src/KERNEL_PY/salome_study.py +++ b/src/KERNEL_PY/salome_study.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/KERNEL_PY/salome_test.py b/src/KERNEL_PY/salome_test.py index a62cbafe9..c0818f45f 100755 --- a/src/KERNEL_PY/salome_test.py +++ b/src/KERNEL_PY/salome_test.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -479,7 +480,11 @@ import VISU import visu_gui medFileName = "pointe.med" -medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFileName +if sys.platform != "win32": + medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFileName +else: + medFile = os.getenv('DATA_DIR') + '\\MedFiles\\' + medFileName + pass print "Load ", medFile studyCurrent = salome.myStudyName @@ -494,7 +499,7 @@ try: if sys.platform != "win32": tmpDir = "/tmp/" else: - tmpDir = os.getenv('TEMP') + '/' + tmpDir = os.getenv('TEMP') + '\\' medFileNew = tmpDir + str(random.randint(0,1000000)) + "_" + medFileName print " -- Copy " + medFile + " to " + medFileNew @@ -505,7 +510,9 @@ try: os.system(copyCommand + " " + medFile + " " + medFileNew) medFile = medFileNew - os.system("chmod 755 " + medFile) + if sys.platform != "win32": + os.system("chmod 755 " + medFile) + pass if os.access(medFile, os.W_OK) : med_comp.readStructFileWithFieldType(medFile,studyCurrent) diff --git a/src/KERNEL_PY/salome_version.py b/src/KERNEL_PY/salome_version.py index 696cd48db..bd0609ade 100644 --- a/src/KERNEL_PY/salome_version.py +++ b/src/KERNEL_PY/salome_version.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/Launcher/BatchTest.cxx b/src/Launcher/BatchTest.cxx index 727cedc5f..23ff34abe 100644 --- a/src/Launcher/BatchTest.cxx +++ b/src/Launcher/BatchTest.cxx @@ -20,9 +20,13 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "BatchTest.hxx" +#include "Launcher.hxx" + +#ifdef WITH_LIBBATCH +#include +#include +#endif -#include "Batch_Date.hxx" -#include "MpiImpl.hxx" #include "utilities.h" #include @@ -33,6 +37,7 @@ #endif BatchTest::BatchTest(const Engines::MachineDefinition& batch_descr) { +#ifdef WITH_LIBBATCH _batch_descr = batch_descr; // Getting date @@ -54,6 +59,7 @@ BatchTest::BatchTest(const Engines::MachineDefinition& batch_descr) _test_filename += _date + "_test_cluster_file_"; _test_filename += _batch_descr.alias.in(); _base_filename = _date + "_test_cluster_file_" + _batch_descr.alias.in(); +#endif } BatchTest::~BatchTest() {} @@ -438,6 +444,7 @@ BatchTest::test_jobsubmit_simple() std::string BatchTest::test_jobsubmit_mpi() { +#ifdef WITH_LIBBATCH int status; std::string home; std::string command; @@ -629,6 +636,10 @@ BatchTest::test_jobsubmit_mpi() } result = "OK"; return result; +#else + throw LauncherException("Method BatchTest::test_jobsubmit_mpi is not available " + "(libBatch was not present at compilation time)"); +#endif } std::string diff --git a/src/Launcher/Launcher.cxx b/src/Launcher/Launcher.cxx index b6a6ea2ca..17dfdaa4b 100644 --- a/src/Launcher/Launcher.cxx +++ b/src/Launcher/Launcher.cxx @@ -19,13 +19,15 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "Launcher.hxx" -#include "Batch_Date.hxx" -#include "Batch_FactBatchManager_eLSF.hxx" -#include "Batch_FactBatchManager_ePBS.hxx" -#include "Batch_BatchManager_eClient.hxx" -#include "Batch_FactBatchManager_eSGE.hxx" +#ifdef WITH_LIBBATCH +#include +#include +#include +#include +#include +#endif + #include "SALOME_Launcher_Handler.hxx" #include "Launcher.hxx" #include @@ -62,12 +64,15 @@ Launcher_cpp::~Launcher_cpp() #if defined(_DEBUG_) || defined(_DEBUG) cerr << "Launcher_cpp destructor" << endl; #endif + +#ifdef WITH_LIBBATCH std::map < string, Batch::BatchManager_eClient * >::const_iterator it1; for(it1=_batchmap.begin();it1!=_batchmap.end();it1++) delete it1->second; std::map < std::pair , Batch::Job* >::const_iterator it2; for(it2=_jobmap.begin();it2!=_jobmap.end();it2++) delete it2->second; +#endif } //============================================================================= @@ -80,6 +85,7 @@ Launcher_cpp::~Launcher_cpp() long Launcher_cpp::submitJob( const std::string xmlExecuteFile, const std::string clusterName) throw(LauncherException) { +#ifdef WITH_LIBBATCH #if defined(_DEBUG_) || defined(_DEBUG) cout << "BEGIN OF Launcher_cpp::submitJob" << endl; #endif @@ -171,10 +177,14 @@ long Launcher_cpp::submitJob( const std::string xmlExecuteFile, _jobmap[ pair(cname,jobId) ] = job; } catch(const Batch::EmulationException &ex){ - throw LauncherException(ex.msg.c_str()); + throw LauncherException(ex.message.c_str()); } return jobId; +#else + throw LauncherException("Method Launcher_cpp::submitJob is not available " + "(libBatch was not present at compilation time)"); +#endif } //============================================================================= @@ -192,6 +202,7 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute , const batchParams& batch_params, const machineParams& params) throw(LauncherException) { +#ifdef WITH_LIBBATCH #if defined(_DEBUG_) || defined(_DEBUG) cerr << "BEGIN OF Launcher_cpp::submitSalomeJob" << endl; #endif @@ -241,18 +252,11 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute , for(int i=0;i(clustername,jobId) ] = job; } catch(const Batch::EmulationException &ex){ - throw LauncherException(ex.msg.c_str()); + throw LauncherException(ex.message.c_str()); } return jobId; +#else + throw LauncherException("Method Launcher_cpp::submitSalomeJob is not available " + "(libBatch was not present at compilation time)"); +#endif } //============================================================================= @@ -292,6 +300,7 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute , string Launcher_cpp::queryJob( long id, const machineParams& params) throw(LauncherException) { +#ifdef WITH_LIBBATCH if(!_ResManager) throw LauncherException("You must set Resources Manager to Launcher!!"); @@ -315,14 +324,18 @@ string Launcher_cpp::queryJob( long id, par = jinfo.getParametre(); } catch(const Batch::EmulationException &ex){ - throw LauncherException(ex.msg.c_str()); + throw LauncherException(ex.message.c_str()); } return par[STATE]; +#else + throw LauncherException("Method Launcher_cpp::queryJob is not available " + "(libBatch was not present at compilation time)"); +#endif } string Launcher_cpp::queryJob( long id, - const std::string clusterName) + const std::string clusterName) throw (LauncherException) { machineParams params; params.hostname = clusterName; @@ -339,6 +352,7 @@ string Launcher_cpp::queryJob( long id, void Launcher_cpp::deleteJob( const long id, const machineParams& params) throw(LauncherException) { +#ifdef WITH_LIBBATCH if(!_ResManager) throw LauncherException("You must set Resources Manager to Launcher!!"); @@ -357,10 +371,14 @@ void Launcher_cpp::deleteJob( const long id, Batch::JobId jobId( _batchmap[clustername], oss.str() ); jobId.deleteJob(); +#else + throw LauncherException("Method Launcher_cpp::deleteJob is not available " + "(libBatch was not present at compilation time)"); +#endif } void Launcher_cpp::deleteJob( long id, - const std::string clusterName) + const std::string clusterName) throw (LauncherException) { machineParams params; params.hostname = clusterName; @@ -378,6 +396,7 @@ void Launcher_cpp::getResultsJob( const string directory, const long id, const machineParams& params) throw(LauncherException) { +#ifdef WITH_LIBBATCH if(!_ResManager) throw LauncherException("You must set Resources Manager to Launcher!!"); @@ -393,11 +412,15 @@ void Launcher_cpp::getResultsJob( const string directory, Batch::Job* job = _jobmap[ pair(clustername,id) ]; _batchmap[clustername]->importOutputFiles( *job, directory ); +#else + throw LauncherException("Method Launcher_cpp::getResultsJob is not available " + "(libBatch was not present at compilation time)"); +#endif } void Launcher_cpp::getResultsJob( const std::string directory, long id, - const std::string clusterName) + const std::string clusterName) throw (LauncherException) { machineParams params; params.hostname = clusterName; @@ -412,17 +435,18 @@ void Launcher_cpp::getResultsJob( const std::string directory, Batch::BatchManager_eClient *Launcher_cpp::FactoryBatchManager( const ParserResourcesType& params ) throw(LauncherException) { - - std::string hostname, protocol, mpi; +#ifdef WITH_LIBBATCH + std::string hostname, mpi; + Batch::CommunicationProtocolType protocol; Batch::FactBatchManager_eClient* fact; hostname = params.Alias; switch(params.Protocol){ case rsh: - protocol = "rsh"; + protocol = Batch::RSH; break; case ssh: - protocol = "ssh"; + protocol = Batch::SSH; break; default: throw LauncherException("unknown protocol"); @@ -482,14 +506,20 @@ Batch::BatchManager_eClient *Launcher_cpp::FactoryBatchManager( const ParserReso #endif throw LauncherException("no batchmanager for that cluster"); } - return (*fact)(hostname.c_str(),protocol.c_str(),mpi.c_str()); + return (*fact)(hostname.c_str(), protocol, mpi.c_str()); +#else + throw LauncherException("Method Launcher_cpp::FactoryBatchManager is not available " + "(libBatch was not present at compilation time)"); +#endif } string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const string dirForTmpFiles, const ParserResourcesType& params) { +#ifdef WITH_LIBBATCH #ifndef WIN32 //TODO: need for porting on Windows int idx = dirForTmpFiles.find("Batch/"); std::string filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); + std::string dfilelogtemp = params.AppliPath + "/" + filelogtemp; string::size_type p1 = fileToExecute.find_last_of("/"); string::size_type p2 = fileToExecute.find_last_of("."); @@ -503,8 +533,8 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const // Begin tempOutputFile << "#! /bin/sh -f" << endl ; - tempOutputFile << "cd " ; - tempOutputFile << params.AppliPath << endl ; + tempOutputFile << "cd ~/" ; + tempOutputFile << dirForTmpFiles << endl ; tempOutputFile << "export SALOME_BATCH=1\n"; tempOutputFile << "export PYTHONPATH=~/" ; tempOutputFile << dirForTmpFiles ; @@ -523,9 +553,9 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const // Code for rank 0 : launch runAppli and a container // RunAppli if(params.ModulesList.size()>0) - tempOutputFile << " ./runAppli --terminal --modules=" ; + tempOutputFile << " " << params.AppliPath << "/runAppli --terminal --modules=" ; else - tempOutputFile << " ./runAppli --terminal "; + tempOutputFile << " " << params.AppliPath << "/runAppli --terminal "; for ( int i = 0 ; i < params.ModulesList.size() ; i++ ) { tempOutputFile << params.ModulesList[i] ; if ( i != params.ModulesList.size()-1 ) @@ -538,7 +568,7 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const // Wait NamingService tempOutputFile << " current=0\n" << " stop=20\n" - << " while ! test -f " << filelogtemp << "\n" + << " while ! test -f " << dfilelogtemp << "\n" << " do\n" << " sleep 2\n" << " let current=current+1\n" @@ -547,7 +577,7 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const << " exit\n" << " fi\n" << " done\n" - << " port=`cat " << filelogtemp << "`\n"; + << " port=`cat " << dfilelogtemp << "`\n"; // Wait other containers tempOutputFile << " for ((ip=1; ip < "; @@ -557,14 +587,14 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const tempOutputFile << " arglist=\"$arglist YACS_Server_\"$ip" << endl ; tempOutputFile << " done" << endl ; tempOutputFile << " sleep 5" << endl ; - tempOutputFile << " ./runSession waitContainers.py $arglist" << endl ; + tempOutputFile << " " << params.AppliPath << "/runSession waitContainers.py $arglist" << endl ; // Launch user script - tempOutputFile << " ./runSession python ~/" << dirForTmpFiles << "/" << fileNameToExecute << ".py" << endl; + tempOutputFile << " " << params.AppliPath << "/runSession python ~/" << dirForTmpFiles << "/" << fileNameToExecute << ".py" << endl; // Stop application - tempOutputFile << " rm " << filelogtemp << "\n" - << " ./runSession shutdownSalome.py" << endl; + tempOutputFile << " rm " << dfilelogtemp << "\n" + << " " << params.AppliPath << "/runSession shutdownSalome.py" << endl; // ------------------------------------- // Other nodes launch a container @@ -573,7 +603,7 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const // Wait NamingService tempOutputFile << " current=0\n" << " stop=20\n" - << " while ! test -f " << filelogtemp << "\n" + << " while ! test -f " << dfilelogtemp << "\n" << " do\n" << " sleep 2\n" << " let current=current+1\n" @@ -582,10 +612,10 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const << " exit\n" << " fi\n" << " done\n" - << " port=`cat " << filelogtemp << "`\n"; + << " port=`cat " << dfilelogtemp << "`\n"; // Launching container - tempOutputFile << " ./runSession SALOME_Container YACS_Server_"; + tempOutputFile << " " << params.AppliPath << "/runSession SALOME_Container YACS_Server_"; tempOutputFile << mpiImpl->rank() << " > ~/" << dirForTmpFiles << "/YACS_Server_" << mpiImpl->rank() << "_container_log." << filelogtemp @@ -605,10 +635,15 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const return ""; #endif +#else + throw LauncherException("Method Launcher_cpp::buildSalomeCouplingScript is not available " + "(libBatch was not present at compilation time)"); +#endif } MpiImpl *Launcher_cpp::FactoryMpiImpl(MpiImplType mpi) throw(LauncherException) { +#ifdef WITH_LIBBATCH switch(mpi){ case lam: return new MpiImpl_LAM(); @@ -629,11 +664,15 @@ MpiImpl *Launcher_cpp::FactoryMpiImpl(MpiImplType mpi) throw(LauncherException) oss << mpi << " : not yet implemented"; throw LauncherException(oss.str().c_str()); } - +#else + throw LauncherException("Method Launcher_cpp::FactoryMpiImpl is not available " + "(libBatch was not present at compilation time)"); +#endif } string Launcher_cpp::getTmpDirForBatchFiles() { +#ifdef WITH_LIBBATCH string ret; string thedate; @@ -652,6 +691,10 @@ string Launcher_cpp::getTmpDirForBatchFiles() ret = string("Batch/"); ret += thedate; return ret; +#else + throw LauncherException("Method Launcher_cpp::getTmpDirForBatchFiles is not available " + "(libBatch was not present at compilation time)"); +#endif } string Launcher_cpp::getRemoteFile( std::string remoteDir, std::string localFile ) diff --git a/src/Launcher/Launcher.hxx b/src/Launcher/Launcher.hxx index 33e7fd76c..279adbdc3 100644 --- a/src/Launcher/Launcher.hxx +++ b/src/Launcher/Launcher.hxx @@ -78,11 +78,11 @@ public: const machineParams& params) throw(LauncherException); std::string queryJob( const long jobId, const machineParams& params) throw(LauncherException); - std::string queryJob( const long jobId, const std::string clusterName); + std::string queryJob( const long jobId, const std::string clusterName) throw(LauncherException); void deleteJob( const long jobId, const machineParams& params) throw(LauncherException); - void deleteJob( const long jobId, const std::string clusterName); + void deleteJob( const long jobId, const std::string clusterName) throw(LauncherException); void getResultsJob( const std::string directory, const long jobId, const machineParams& params ) throw(LauncherException); - void getResultsJob( const std::string directory, const long jobId, const std::string clusterName ); + void getResultsJob( const std::string directory, const long jobId, const std::string clusterName ) throw (LauncherException); void SetResourcesManager( ResourcesManager_cpp* rm ) { _ResManager = rm; } diff --git a/src/Launcher/Makefile.am b/src/Launcher/Makefile.am index ab797d703..fc49e1121 100644 --- a/src/Launcher/Makefile.am +++ b/src/Launcher/Makefile.am @@ -52,7 +52,7 @@ COMMON_CPPFLAGS=\ @PYTHON_INCLUDES@ \ @MPI_INCLUDES@ \ @LIBXML_INCLUDES@ \ - -I$(srcdir)/../Batch \ + @LIBBATCH_INCLUDES@ \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ @@ -61,10 +61,13 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Notification \ -I$(srcdir)/../ResourcesManager \ -I$(srcdir)/../Container \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ +if WITH_LIBBATCH + COMMON_CPPFLAGS += -DWITH_LIBBATCH +endif + # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ ../Registry/libRegistry.la \ @@ -75,8 +78,8 @@ COMMON_LIBS =\ ../Utils/libOpUtil.la \ ../SALOMELocalTrace/libSALOMELocalTrace.la \ ../Basics/libSALOMEBasics.la \ - ../Batch/libSalomeBatch.la \ $(top_builddir)/idl/libSalomeIDLKernel.la \ + @LIBBATCH_LIBS@ \ @MPI_LIBS@ \ @CORBA_LIBS@ \ @LIBXML_LIBS@ \ @@ -112,18 +115,22 @@ libLauncher_la_SOURCES=\ Launcher.cxx libLauncher_la_CPPFLAGS =\ - -I$(srcdir)/../Batch \ -I$(srcdir)/../ResourcesManager \ + @LIBBATCH_INCLUDES@ \ @MPI_INCLUDES@ \ @LIBXML_INCLUDES@ +if WITH_LIBBATCH + libLauncher_la_CPPFLAGS += -DWITH_LIBBATCH +endif + libLauncher_la_LDFLAGS =\ -no-undefined -version-info=0:0:0 \ @LDEXPDYNFLAGS@ libLauncher_la_LIBADD =\ - ../Batch/libSalomeBatch.la \ - ../ResourcesManager/libSalomeResourcesManager.la \ + ../ResourcesManager/libResourcesManager.la \ + @LIBBATCH_LIBS@ \ @MPI_LIBS@ \ @LIBXML_LIBS@ @@ -145,6 +152,7 @@ SALOME_LauncherServer_CPPFLAGS=\ SALOME_LauncherServer_LDADD =\ libSalomeLauncher.la \ ../Basics/libSALOMEBasics.la \ + $(LIBBATCH_LIBS) \ $(MPI_LIBS) \ $(CORBA_LIBS) \ $(LIBXML_LIBS) \ diff --git a/src/LifeCycleCORBA/LifeCycleCORBA.py b/src/LifeCycleCORBA/LifeCycleCORBA.py index 371affd1c..133ab610c 100644 --- a/src/LifeCycleCORBA/LifeCycleCORBA.py +++ b/src/LifeCycleCORBA/LifeCycleCORBA.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/LifeCycleCORBA/Makefile.am b/src/LifeCycleCORBA/Makefile.am index c24e369f9..a7d1e58d7 100644 --- a/src/LifeCycleCORBA/Makefile.am +++ b/src/LifeCycleCORBA/Makefile.am @@ -56,7 +56,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Utils \ -I$(srcdir)/../Container \ -I$(srcdir)/../ResourcesManager \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@ diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index eb2d2d914..534553609 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -85,9 +85,11 @@ SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns) char **argv = &xargv; CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + _NSnew=0; if (!ns) { _NS = new SALOME_NamingService(orb); + _NSnew=_NS; } else _NS = ns; //add try catch @@ -115,6 +117,7 @@ SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns) SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA() { + if(_NSnew)delete _NSnew; } //============================================================================= @@ -274,7 +277,7 @@ SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName, { // containerName doesn't contain "/" => Local container params->container_name=CORBA::string_dup(stContainer); - params->hostname=CORBA::string_dup(Kernel_Utils::GetHostname().c_str()); + params->hostname=""; } else { @@ -534,6 +537,8 @@ void SALOME_LifeCycleCORBA::killOmniNames() string portNumber (::getenv ("NSPORT") ); if ( !portNumber.empty() ) { +#ifdef WNT +#else string cmd ; cmd = string( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*") + portNumber @@ -544,6 +549,7 @@ void SALOME_LifeCycleCORBA::killOmniNames() } catch ( ... ) { } +#endif } // NPAL 18309 (Kill Notifd) @@ -731,3 +737,21 @@ void SALOME_LifeCycleCORBA::copyFile(const char* hostSrc, const char* fileSrc, c containerDest->copyFile(containerSrc,fileSrc,fileDest); } +/*! \brief get the naming service used by the life cycle + * + * \return the naming service + */ +SALOME_NamingService * SALOME_LifeCycleCORBA::namingService() +{ + return _NS; +} + +/*! \brief get the orb used by the life cycle + * + * \return the orb + */ +CORBA::ORB_ptr SALOME_LifeCycleCORBA::orb() +{ + return _NS->orb(); +} + diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx index 4083c428b..c22385796 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx @@ -102,6 +102,8 @@ public: Engines::ContainerManager_ptr getContainerManager(); Engines::ResourcesManager_ptr getResourcesManager(); + SALOME_NamingService * namingService(); + CORBA::ORB_ptr orb(); void copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest); void shutdownServers(); @@ -126,6 +128,7 @@ protected: int studyId); SALOME_NamingService *_NS; + SALOME_NamingService *_NSnew; Engines::ContainerManager_var _ContManager; Engines::ResourcesManager_var _ResManager; diff --git a/src/LifeCycleCORBA/Test/Makefile.am b/src/LifeCycleCORBA/Test/Makefile.am index c54e98603..3583ff67d 100644 --- a/src/LifeCycleCORBA/Test/Makefile.am +++ b/src/LifeCycleCORBA/Test/Makefile.am @@ -58,7 +58,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \ -I$(srcdir)/$(RPATH)/ResourcesManager \ -I$(srcdir)/$(RPATH)/LifeCycleCORBA \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py b/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py index 99e0d4cb1..f8f2af540 100644 --- a/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py +++ b/src/LifeCycleCORBA/Test/TestLifeCycleCORBA.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/LifeCycleCORBA/TestContainerManager.cxx b/src/LifeCycleCORBA/TestContainerManager.cxx index aaa52b195..d9a3a82e3 100644 --- a/src/LifeCycleCORBA/TestContainerManager.cxx +++ b/src/LifeCycleCORBA/TestContainerManager.cxx @@ -90,7 +90,7 @@ int main (int argc, char * argv[]) for(int i=0;i<10;i++){ sprintf(st,"first_%d",i); p.container_name = CORBA::string_dup(st); - p.policy="best"; + p.policy="first"; cont = _ContManager->GiveContainer(p); if(CORBA::is_nil(cont)) error = true; } diff --git a/src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py b/src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py index 7946e1d54..df7445c42 100644 --- a/src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py +++ b/src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/LifeCycleCORBA_SWIG/Makefile.am b/src/LifeCycleCORBA_SWIG/Makefile.am index 0b5126cbe..de1dfbe77 100644 --- a/src/LifeCycleCORBA_SWIG/Makefile.am +++ b/src/LifeCycleCORBA_SWIG/Makefile.am @@ -65,7 +65,6 @@ _libSALOME_LifeCycleCORBA_la_CPPFLAGS =\ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py b/src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py index ba9331b2f..25e7f98f4 100644 --- a/src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py +++ b/src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py b/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py index 40133b36f..d6a236c6a 100644 --- a/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py +++ b/src/LifeCycleCORBA_SWIG/Test/TestLifeCycleCORBA_SWIG.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py b/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py index 256d3373a..148d0df07 100644 --- a/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py +++ b/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py @@ -1,3 +1,5 @@ +# -*- coding: iso-8859-1 -*- + import unittest import salome import Engines diff --git a/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py b/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py index aba62953f..ae03273ef 100644 --- a/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py +++ b/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py @@ -1,3 +1,5 @@ +# -*- coding: iso-8859-1 -*- + import unittest import salome import LifeCycleCORBA diff --git a/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py b/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py index 8bc2683f0..cef07b0ed 100644 --- a/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py +++ b/src/LifeCycleCORBA_SWIG/TestLifeCycleCORBA.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/Logger/Makefile.am b/src/Logger/Makefile.am index e763aa4f6..9ffd07621 100644 --- a/src/Logger/Makefile.am +++ b/src/Logger/Makefile.am @@ -45,7 +45,6 @@ SALOME_Logger_Server_SOURCES = \ SALOME_Logger_Server_LDADD = libSalomeLoggerServer.la SALOME_Logger_Server_CPPFLAGS =\ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Basics \ @@ -58,7 +57,6 @@ libSalomeLoggerServer_la_SOURCES =\ SALOME_Logger_Server.cxx libSalomeLoggerServer_la_CPPFLAGS =\ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ libSalomeLoggerServer_la_LDFLAGS = -no-undefined -version-info=0:0:0 diff --git a/src/Logger/SALOME_Trace.py b/src/Logger/SALOME_Trace.py index e6ece2f01..17e4ed380 100644 --- a/src/Logger/SALOME_Trace.py +++ b/src/Logger/SALOME_Trace.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/Logger/Test/TestKiller.py b/src/Logger/Test/TestKiller.py index 9ad3961c0..3aa592872 100644 --- a/src/Logger/Test/TestKiller.py +++ b/src/Logger/Test/TestKiller.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/MPIContainer/MPIContainer_i.cxx b/src/MPIContainer/MPIContainer_i.cxx index 943238344..b127d2a32 100644 --- a/src/MPIContainer/MPIContainer_i.cxx +++ b/src/MPIContainer/MPIContainer_i.cxx @@ -187,17 +187,17 @@ bool Engines_MPIContainer_i::Lload_component_Library(const char* componentName) else { Py_ACQUIRE_NEW_THREAD; - PyObject *mainmod = PyImport_AddModule("__main__"); + PyObject *mainmod = PyImport_AddModule((char *)"__main__"); PyObject *globals = PyModule_GetDict(mainmod); PyObject *pyCont = PyDict_GetItemString(globals, "pyCont"); PyObject *result = PyObject_CallMethod(pyCont, - "import_component", - "s",componentName); - int ret= PyInt_AsLong(result); + (char*)"import_component", + (char*)"s",componentName); + std::string ret= PyString_AsString(result); SCRUTE(ret); Py_RELEASE_NEW_THREAD; - if (ret) // import possible: Python component + if (ret=="") // import possible: Python component { _library_map[aCompName] = (void *)pyCont; // any non O value OK MESSAGE("[" << _numproc << "] import Python: "<tior))[st->ip]))->load_component_Library(st->compoName.c_str()); + return NULL; } void *th_createcomponentinstance(void *s) { thread_st *st = (thread_st*)s; (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->create_component_instance(st->compoName.c_str(),st->studyId); + return NULL; } void *th_loadimpl(void *s) { thread_st *st = (thread_st*)s; (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->load_impl(st->nameToRegister.c_str(),st->compoName.c_str()); + return NULL; } void *th_removeimpl(void *s) { thread_st *st = (thread_st*)s; (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->remove_impl(st->cptr); + return NULL; } void *th_finalizeremoval(void *s) { thread_st *st = (thread_st*)s; (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->finalize_removal(); + return NULL; } - diff --git a/src/MPIContainer/MPIObject_i.cxx b/src/MPIContainer/MPIObject_i.cxx index af78c0f2c..075a0b16e 100644 --- a/src/MPIContainer/MPIObject_i.cxx +++ b/src/MPIContainer/MPIObject_i.cxx @@ -124,7 +124,7 @@ void MPIObject_i::BCastIOR(CORBA::ORB_ptr orb, Engines::MPIObject_ptr pobj, bool } #ifdef HAVE_MPI2 -void MPIObject_i::remoteMPI2Connect(bool high, string service) +void MPIObject_i::remoteMPI2Connect(string service) { int i; char port_name[MPI_MAX_PORT_NAME]; @@ -192,8 +192,8 @@ void MPIObject_i::remoteMPI2Connect(bool high, string service) else MPI_Comm_connect(port_name_clt, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &(_icom[service]) ); - /* create global communicator */ - MPI_Intercomm_merge(_icom[service],high,&(_gcom[service])); + /* create global communicator: servers have low index in global communicator*/ + MPI_Intercomm_merge(_icom[service],!_srv[service],&(_gcom[service])); /* only rank 0 can be server for unpublish name */ if(_numproc != 0) _srv[service] = false; diff --git a/src/MPIContainer/MPIObject_i.hxx b/src/MPIContainer/MPIObject_i.hxx index 66d24f58d..9b07b25b2 100644 --- a/src/MPIContainer/MPIObject_i.hxx +++ b/src/MPIContainer/MPIObject_i.hxx @@ -60,7 +60,7 @@ class MPIObject_i: public POA_Engines::MPIObject void BCastIOR(CORBA::ORB_ptr orb,Engines::MPIObject_ptr pobj,bool amiCont); #ifdef HAVE_MPI2 // MPI2 connection - void remoteMPI2Connect(bool high, std::string service); + void remoteMPI2Connect(std::string service); // MPI2 disconnection void remoteMPI2Disconnect(std::string service); #endif diff --git a/src/MPIContainer/Makefile.am b/src/MPIContainer/Makefile.am index 84bd2bbfe..ae8c2654e 100644 --- a/src/MPIContainer/Makefile.am +++ b/src/MPIContainer/Makefile.am @@ -60,7 +60,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Notification \ -I$(srcdir)/../ResourcesManager \ -I$(srcdir)/../Container \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/MPIContainer/SALOME_MPIContainer.cxx b/src/MPIContainer/SALOME_MPIContainer.cxx index c288ec8cf..7c3b2a672 100644 --- a/src/MPIContainer/SALOME_MPIContainer.cxx +++ b/src/MPIContainer/SALOME_MPIContainer.cxx @@ -30,7 +30,6 @@ using namespace std; int main(int argc, char* argv[]) { int nbproc, numproc; - Engines_MPIContainer_i * myContainer=NULL; MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&nbproc); @@ -51,39 +50,14 @@ int main(int argc, char* argv[]) // obtain the root poa manager PortableServer::POAManager_var pman = root_poa->the_POAManager(); - // define policy objects - PortableServer::ImplicitActivationPolicy_var implicitActivation = - root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ; - - // default = NO_IMPLICIT_ACTIVATION - PortableServer::ThreadPolicy_var threadPolicy = - root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ; - // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL - - // create policy list - CORBA::PolicyList policyList; - policyList.length(2); - policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ; - policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ; - - // create the child POA - PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ; - PortableServer::POA_var factory_poa = - root_poa->create_POA("factory_poa", pman, policyList) ; - //with nil_mgr instead of pman, a new POA manager is created with the new POA - - // destroy policy objects - implicitActivation->destroy() ; - threadPolicy->destroy() ; - - char *containerName = ""; + char *containerName = (char *)""; if (argc >1) { containerName = argv[1] ; } MESSAGE("[" << numproc << "] MPIContainer: load MPIContainer servant"); - new Engines_MPIContainer_i(nbproc,numproc,orb,factory_poa, containerName,argc,argv); + new Engines_MPIContainer_i(nbproc,numproc,orb,root_poa, containerName,argc,argv); pman->activate(); diff --git a/src/Makefile.am b/src/Makefile.am index 52b42f6c2..44deb4332 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -77,10 +77,6 @@ SUBDIR_MPI = \ MPIContainer \ TestMPIContainer -SUBDIR_BATCH= \ - Batch \ - Batch_SWIG - SUBDIR_PARALLEL= ParallelContainer @@ -89,7 +85,6 @@ DIST_SUBDIRS = \ $(SUBDIR_CORBA) \ $(SUBDIR_MPI) \ $(SUBDIR_PARALLEL) \ - $(SUBDIR_BATCH) \ $(SUBDIR_CPPUNIT_BASE) \ $(SUBDIR_CPPUNIT_CORBA) \ $(SUBDIR_CPPUNIT_GENERAL) @@ -101,15 +96,11 @@ DIST_SUBDIRS = \ # if WITHONLYLAUNCHER - SUBDIRS = Batch Batch_SWIG ResourcesManager Launcher + SUBDIRS = Basics ResourcesManager Launcher else SUBDIRS = $(SUBDIR_BASE) -if WITH_BATCH - SUBDIRS += $(SUBDIR_BATCH) -endif - if CORBA_GEN SUBDIRS += $(SUBDIR_CORBA) endif diff --git a/src/ModuleCatalog/Makefile.am b/src/ModuleCatalog/Makefile.am index 99160e72e..912622390 100644 --- a/src/ModuleCatalog/Makefile.am +++ b/src/ModuleCatalog/Makefile.am @@ -59,7 +59,6 @@ COMMON_CPPFLAGS=\ -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@ diff --git a/src/ModuleCatalog/TestModuleCatalog.py b/src/ModuleCatalog/TestModuleCatalog.py index aa22de9de..2d882e3dc 100755 --- a/src/ModuleCatalog/TestModuleCatalog.py +++ b/src/ModuleCatalog/TestModuleCatalog.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/ModuleGenerator/IDLparser.py b/src/ModuleGenerator/IDLparser.py index e22678cd5..ff199ddcf 100644 --- a/src/ModuleGenerator/IDLparser.py +++ b/src/ModuleGenerator/IDLparser.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/NOTIFICATION_SWIG/Makefile.am b/src/NOTIFICATION_SWIG/Makefile.am index a1b75ed3d..2ba0458ad 100644 --- a/src/NOTIFICATION_SWIG/Makefile.am +++ b/src/NOTIFICATION_SWIG/Makefile.am @@ -49,7 +49,6 @@ _libNOTIFICATION_la_CPPFLAGS =\ -I$(srcdir)/../Notification \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ - -I$(top_builddir)/salome_adm/unix \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/NamingService/Makefile.am b/src/NamingService/Makefile.am index 474f5f02e..93cfad682 100644 --- a/src/NamingService/Makefile.am +++ b/src/NamingService/Makefile.am @@ -52,7 +52,6 @@ libSalomeNS_la_CPPFLAGS = \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Basics \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/NamingService/SALOME_NamingService.cxx b/src/NamingService/SALOME_NamingService.cxx index 9b1d479f5..70d337008 100644 --- a/src/NamingService/SALOME_NamingService.cxx +++ b/src/NamingService/SALOME_NamingService.cxx @@ -90,6 +90,7 @@ SALOME_NamingService::~SALOME_NamingService() * * Initializes ORB reference and naming service root context. * For use after default constructor. + * If param orb is null, the orb is initialized * \param orb CORBA::ORB_ptr arguments */ // ============================================================================ @@ -99,7 +100,13 @@ void SALOME_NamingService::init_orb(CORBA::ORB_ptr orb) MESSAGE("SALOME_NamingService initialisation"); Utils_Locker lock (&_myMutex); - _orb = CORBA::ORB::_duplicate(orb); + if(orb) + _orb = CORBA::ORB::_duplicate(orb); + else + { + int argc=0; + _orb = CORBA::ORB_init(argc, 0); // Here we make the assumption that the orb has already been initialized + } _initialize_root_context(); } @@ -1825,3 +1832,12 @@ char * SALOME_NamingService::getIORaddr() return _orb->object_to_string(_root_context); } +/*! \brief get the orb used by the naming service + * + * \return the orb + */ +CORBA::ORB_ptr SALOME_NamingService::orb() +{ + return _orb; +} + diff --git a/src/NamingService/SALOME_NamingService.hxx b/src/NamingService/SALOME_NamingService.hxx index 6e54c5f7d..df06b2e1c 100644 --- a/src/NamingService/SALOME_NamingService.hxx +++ b/src/NamingService/SALOME_NamingService.hxx @@ -48,7 +48,7 @@ public: virtual ~SALOME_NamingService(); - void init_orb(CORBA::ORB_ptr orb); + void init_orb(CORBA::ORB_ptr orb=0); void Register(CORBA::Object_ptr ObjRef, const char* Path) throw(ServiceUnreachable); @@ -91,6 +91,7 @@ public: virtual void Destroy_FullDirectory(const char* Path) throw(ServiceUnreachable); char* getIORaddr(); + CORBA::ORB_ptr orb(); protected: Utils_Mutex _myMutex; diff --git a/src/NamingService/SALOME_NamingServicePy.py b/src/NamingService/SALOME_NamingServicePy.py index 3797ae961..86a6151b4 100644 --- a/src/NamingService/SALOME_NamingServicePy.py +++ b/src/NamingService/SALOME_NamingServicePy.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -52,13 +53,15 @@ class SALOME_NamingServicePy_i(object): #------------------------------------------------------------------------- - def __init__(self, orb): + def __init__(self, orb=None): """ Standard Constructor, with ORB reference. Initializes the naming service root context """ #MESSAGE ( "SALOME_NamingServicePy_i::__init__" ) + if orb is None: + orb=CORBA.ORB_init([''], CORBA.ORB_ID) self._orb = orb # initialize root context and current context ok = 0 diff --git a/src/NamingService/Test/Makefile.am b/src/NamingService/Test/Makefile.am index 166fd3388..c27525a35 100644 --- a/src/NamingService/Test/Makefile.am +++ b/src/NamingService/Test/Makefile.am @@ -54,7 +54,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/Basics \ -I$(srcdir)/$(RPATH)/SALOMELocalTrace \ -I$(srcdir)/$(RPATH)/Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/NamingService/Test/TestNamingService.py b/src/NamingService/Test/TestNamingService.py index d43bbb5cf..2db9c80ed 100644 --- a/src/NamingService/Test/TestNamingService.py +++ b/src/NamingService/Test/TestNamingService.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/Notification/Makefile.am b/src/Notification/Makefile.am index e0b458e4c..b70f2a301 100644 --- a/src/Notification/Makefile.am +++ b/src/Notification/Makefile.am @@ -56,7 +56,6 @@ 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/ParallelContainer/Makefile.am b/src/ParallelContainer/Makefile.am index 59ef7f32f..252c03742 100644 --- a/src/ParallelContainer/Makefile.am +++ b/src/ParallelContainer/Makefile.am @@ -52,7 +52,6 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \ -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 \ @PYTHON_INCLUDES@ \ diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx index ec268dc01..74d4edfe1 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx @@ -209,11 +209,11 @@ Container_proxy_impl_final::load_component_Library(const char* componentName) PyObject *result = PyObject_CallMethod(pyCont, (char*)"import_component", (char*)"s",componentName); - int ret_p= PyInt_AsLong(result); + std::string ret_p= PyString_AsString(result); Py_XDECREF(result); Py_RELEASE_NEW_THREAD; - if (ret_p) // import possible: Python component + if (ret_p=="") // import possible: Python component { MESSAGE("import Python: " << aCompName <<" OK"); } diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx index 1213347d2..d39f0a799 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx @@ -349,11 +349,11 @@ Engines_Parallel_Container_i::load_component_Library(const char* componentName) PyObject *result = PyObject_CallMethod(pyCont, (char*)"import_component", (char*)"s",componentName); - int ret_p= PyInt_AsLong(result); + std::string ret_p= PyString_AsString(result); Py_XDECREF(result); Py_RELEASE_NEW_THREAD; - if (ret_p) // import possible: Python component + if (ret_p=="") // import possible: Python component { _library_map[aCompName] = (void *)pyCont; // any non O value OK MESSAGE("import Python: " << aCompName <<" OK"); diff --git a/src/Registry/Makefile.am b/src/Registry/Makefile.am index 3502d99b7..e9a708e53 100644 --- a/src/Registry/Makefile.am +++ b/src/Registry/Makefile.am @@ -45,7 +45,6 @@ libRegistry_la_CPPFLAGS =\ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @@ -68,6 +67,5 @@ SALOME_Registry_Server_CPPFLAGS =\ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/Registry/RegistryConnexion.cxx b/src/Registry/RegistryConnexion.cxx index 2a505c764..d7686a97b 100644 --- a/src/Registry/RegistryConnexion.cxx +++ b/src/Registry/RegistryConnexion.cxx @@ -43,119 +43,115 @@ using namespace std; Registry::Components_var Connexion( int argc , char **argv , const char *ptrSessionName ) throw( CommException ) { - Registry::Components_var varComponents = 0 ; - ASSERT(ptrSessionName) ; - ASSERT(strlen(ptrSessionName)>0) ; - const char *registryName = "Registry" ; - - try - { - ORB_INIT &init = *SINGLETON_::Instance() ; - ASSERT(SINGLETON_::IsAlreadyExisting()) ; - CORBA::ORB_var &orb = init( argc , argv ) ; - - SALOME_NamingService &naming = *SINGLETON_::Instance() ; - ASSERT(SINGLETON_::IsAlreadyExisting()) ; - naming.init_orb( orb ) ; - - // Recuperation de la reference de l'objet - CORBA::Object_var object = naming.Resolve( registryName ) ; - if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ; - - // Specialisation de l'objet generique - varComponents = Registry::Components::_narrow( object ) ; - ASSERT(! CORBA::is_nil(varComponents)) ; - } - catch( ... ) - { - throw CommException ( "NamingService Connexion Error" ) ; - } - return varComponents ; + Registry::Components_var varComponents = 0 ; + ASSERT(ptrSessionName) ; + ASSERT(strlen(ptrSessionName)>0) ; + const char *registryName = "Registry" ; + + try + { + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()) ; + CORBA::ORB_var &orb = init( argc , argv ) ; + + SALOME_NamingService &naming = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()) ; + naming.init_orb( orb ) ; + + // Recuperation de la reference de l'objet + CORBA::Object_var object = naming.Resolve( registryName ) ; + if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ; + + // Specialisation de l'objet generique + varComponents = Registry::Components::_narrow( object ) ; + ASSERT(! CORBA::is_nil(varComponents)) ; + } + catch( ... ) + { + throw CommException ( "NamingService Connexion Error" ) ; + } + return varComponents ; } RegistryConnexion::RegistryConnexion( int argc , char **argv , const char *ior , const char *ptrSessionName, const char *componentName ): \ - _Ior(duplicate(ior)), _VarComponents( Connexion(argc,argv,ptrSessionName) ), _SessionName(ptrSessionName),_Name(""), _Id(0) + _Ior(duplicate(ior)), _VarComponents( Connexion(argc,argv,ptrSessionName) ), _SessionName(ptrSessionName),_Name(""), _Id(0) { - this->add( componentName ) ; + this->add( componentName ) ; } RegistryConnexion::RegistryConnexion( void ): _Ior(0), _VarComponents( 0 ), _Name(""), _Id(0) { - INTERRUPTION(EXIT_FAILURE) ; + INTERRUPTION(EXIT_FAILURE) ; } RegistryConnexion::~RegistryConnexion() { - BEGIN_OF("RegistryConnexion::~RegistryConnexion()" ) ; - if( _Id != 0 ) - { - ASSERT(_SessionName!="" ) ; - ASSERT(_Name!="" ) ; - _VarComponents->remove( _Id ) ; - } - _Id = 0 ; -#ifndef WIN32 - delete [] _Ior; -#else - delete [] (char*) _Ior; -#endif - _Ior = 0; - _SessionName = ""; - _Name = "" ; - END_OF("RegistryConnexion::~RegistryConnexion()" ) ; + BEGIN_OF("RegistryConnexion::~RegistryConnexion()" ) ; + if( _Id != 0 ) + { + ASSERT(_SessionName!="" ) ; + ASSERT(_Name!="" ) ; + _VarComponents->remove( _Id ) ; + } + _Id = 0 ; + delete [] (char*) _Ior; + _Ior = 0; + _SessionName = ""; + _Name = "" ; + END_OF("RegistryConnexion::~RegistryConnexion()" ) ; } void RegistryConnexion::add( const char *aName ) { - ASSERT(_SessionName!="" ) ; - ASSERT(_Name=="" ) ; - ASSERT(_Id==0 ) ; - ASSERT(aName) ; - SCRUTE(aName) ; - ASSERT(strlen( aName )>0) ; - - const Identity lesInfos( aName ) ; - Registry::Infos infos ; - infos.name = CORBA::string_dup( lesInfos.name() ) ; - infos.pid = lesInfos.pid() ; - infos.machine = CORBA::string_dup( lesInfos.host_char() ) ; - infos.adip = CORBA::string_dup( lesInfos.adip() ) ; - infos.uid = (long)lesInfos.uid() ; - infos.pwname = CORBA::string_dup( lesInfos.pwname() ) ; - infos.tc_start = lesInfos.start() ; - infos.tc_hello = 0 ; - infos.tc_end = 0 ; - infos.difftime = 0 ; - infos.cdir = CORBA::string_dup( lesInfos.rep() ) ; - infos.status = -1 ; - infos.ior = CORBA::string_dup(_Ior); - - ASSERT(!CORBA::is_nil(this->_VarComponents)) ; - - CORBA::ULong id = _VarComponents->add( infos ) ; - - SCRUTE(aName) ; SCRUTE(id) ; - ASSERT(id) ; - - _Id = id ; - _Name = aName ; - - return ; + ASSERT(_SessionName!="" ) ; + ASSERT(_Name=="" ) ; + ASSERT(_Id==0 ) ; + ASSERT(aName) ; + SCRUTE(aName) ; + ASSERT(strlen( aName )>0) ; + + const Identity lesInfos( aName ) ; + Registry::Infos infos ; + infos.name = CORBA::string_dup( lesInfos.name() ) ; + infos.pid = lesInfos.pid() ; + infos.machine = CORBA::string_dup( lesInfos.host_char() ) ; + infos.adip = CORBA::string_dup( lesInfos.adip() ) ; + infos.uid = (long)lesInfos.uid() ; + infos.pwname = CORBA::string_dup( lesInfos.pwname() ) ; + infos.tc_start = lesInfos.start() ; + infos.tc_hello = 0 ; + infos.tc_end = 0 ; + infos.difftime = 0 ; + infos.cdir = CORBA::string_dup( lesInfos.rep() ) ; + infos.status = -1 ; + infos.ior = CORBA::string_dup(_Ior); + + ASSERT(!CORBA::is_nil(this->_VarComponents)) ; + + CORBA::ULong id = _VarComponents->add( infos ) ; + + SCRUTE(aName) ; SCRUTE(id) ; + ASSERT(id) ; + + _Id = id ; + _Name = aName ; + + return ; } void RegistryConnexion::remove( void ) { - ASSERT(_Id>0) ; - ASSERT(!CORBA::is_nil(this->_VarComponents)) ; - _VarComponents->remove( _Id ) ; + ASSERT(_Id>0) ; + ASSERT(!CORBA::is_nil(this->_VarComponents)) ; + _VarComponents->remove( _Id ) ; - _Name = "" ; - _Id = 0 ; + _Name = "" ; + _Id = 0 ; - return ; + return ; } diff --git a/src/Registry/RegistryService.cxx b/src/Registry/RegistryService.cxx index d85e1e755..0dd569c61 100644 --- a/src/Registry/RegistryService.cxx +++ b/src/Registry/RegistryService.cxx @@ -42,223 +42,195 @@ extern "C" using namespace std; /* ------------------------------*/ -/* Constructeurs et Destructeurs */ +/* Constructors and Destructors */ /* ------------------------------*/ RegistryService::RegistryService( void ) : _SessionName(0), _Compteur(0) { - MESSAGE("Passage dans RegistryService::RegistryService()") ; - _orb = CORBA::ORB::_nil(); + MESSAGE("RegistryService::RegistryService()") ; + _orb = CORBA::ORB::_nil(); } - RegistryService::~RegistryService() { - BEGIN_OF("RegistryService::~RegistryService()") ; - map::iterator im; - for (im=_reg.begin();im!=_reg.end(); im++) - { -#if defined(_DEBUG_) || defined(_DEBUG) - const client_infos &lesInfos = *(*im).second ; - MESSAGE("Deletion") ; SCRUTE( lesInfos._name ) ; -#endif - _reg.erase ( im ) ; - } - ASSERT(_reg.size()==0) ; - for (im=_fin.begin();im!=_fin.end(); im++) - { -#if defined(_DEBUG_) || defined(_DEBUG) - const client_infos &lesInfos = *(*im).second ; - MESSAGE("Deletion") ; SCRUTE( lesInfos._name ) ; -#endif - _fin.erase ( im ) ; - } - ASSERT(_fin.size()==0) ; - _Compteur = -1 ; - if ( _SessionName ) - { -#ifndef WIN32 - delete [] _SessionName ; -#else - delete [] (char*)_SessionName ; -#endif - _SessionName = 0 ; - } - END_OF("RegistryService::~RegistryService()") ; + BEGIN_OF("RegistryService::~RegistryService()") ; + map::iterator im; + for (im=_reg.begin();im!=_reg.end(); im++) + { + MESSAGE("Delete _reg item " << im->second->_name) ; + delete im->second; + } + for (im=_fin.begin();im!=_fin.end(); im++) + { + MESSAGE("Delete _fin item " << im->second->_name) ; + delete im->second; + } + _Compteur = -1 ; + if ( _SessionName ) + { + delete [] (char*)_SessionName ; + _SessionName = 0 ; + } + END_OF("RegistryService::~RegistryService()") ; } /* ------------------------------*/ -/* Contrats IDL */ +/* IDL contracts */ /* ------------------------------*/ CORBA::ULong RegistryService::size ( void ) { - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - return _reg.size() ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + return _reg.size() ; } - CORBA::ULong RegistryService::add( const Registry::Infos & infos ) { - BEGIN_OF("RegistryService::add") ; - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - client_infos *ptr_Component = new client_infos( infos ) ; - ASSERT(ptr_Component) ; - SCRUTE(ptr_Component->_name) ; - - _Compteur++; - _reg[_Compteur]=ptr_Component; - - END_OF("RegistryService::add") ; - return (CORBA::ULong)_Compteur ; + BEGIN_OF("RegistryService::add") ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + client_infos *ptr_Component = new client_infos( infos ) ; + ASSERT(ptr_Component) ; + SCRUTE(ptr_Component->_name) ; + + _Compteur++; + _reg[_Compteur]=ptr_Component; + + END_OF("RegistryService::add") ; + return (CORBA::ULong)_Compteur ; } -#ifndef WIN32 -void RegistryService::remove( const CORBA::ULong id) -#else void RegistryService::remove( CORBA::ULong id) -#endif { - BEGIN_OF("RegistryService::remove") ; - SCRUTE(id) ; - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - - ASSERT(_reg.find(id)!=_reg.end()) - _reg[id]->_status=TERMINATED; - _reg[id]->_ts_end = time(NULL) ; - - _fin[id]=_reg[id]; - SCRUTE(_fin.size()) ; - - map::iterator pos = _reg.find ( id ) ; - _reg.erase ( pos ) ; - SCRUTE(_reg.size()) ; - SCRUTE(_fin.size()) ; - - END_OF("RegistryService::remove") ; - return ; + BEGIN_OF("RegistryService::remove") ; + SCRUTE(id) ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + + ASSERT(_reg.find(id)!=_reg.end()) + _reg[id]->_status=TERMINATED; + _reg[id]->_ts_end = time(NULL) ; + + _fin[id]=_reg[id]; + _reg.erase(id); + + SCRUTE(_reg.size()) ; + SCRUTE(_fin.size()) ; + + END_OF("RegistryService::remove") ; + return ; } -#ifndef WIN32 -void RegistryService::hello( const CORBA::ULong id ) -#else void RegistryService::hello( CORBA::ULong id ) -#endif { - BEGIN_OF("RegistryService::hello") ; - SCRUTE(id) ; - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - - ASSERT(_reg.find(id)!=_reg.end()) - _reg[id]->_ts_hello = time(NULL) ; - - END_OF("RegistryService::hello") ; - return ; -} + BEGIN_OF("RegistryService::hello") ; + SCRUTE(id) ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + ASSERT(_reg.find(id)!=_reg.end()) + _reg[id]->_ts_hello = time(NULL) ; + + END_OF("RegistryService::hello") ; + return ; +} void RegistryService::end( void ) { - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - BEGIN_OF( "RegistryService::end( void )" ) ; - exit( EXIT_SUCCESS ) ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + BEGIN_OF( "RegistryService::end( void )" ) ; + exit( EXIT_SUCCESS ) ; } - Registry::AllInfos* RegistryService::getall( void ) { - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - return RegistryService::makeseq(_reg) ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + return RegistryService::makeseq(_reg) ; } Registry::AllInfos* RegistryService::history( void ) { - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - return RegistryService::makeseq(_fin) ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + return RegistryService::makeseq(_fin) ; } Registry::AllInfos* RegistryService::makeseq(map &mymap ) { - int i=0 ; + int i=0 ; - Registry::AllInfos *all = new Registry::AllInfos ; - ASSERT(all) ; - const int RegLength = mymap.size(); - all->length(RegLength); + Registry::AllInfos *all = new Registry::AllInfos ; + ASSERT(all) ; + const int RegLength = mymap.size(); + all->length(RegLength); - map::iterator im; - for (im=mymap.begin();im!=mymap.end(); im++) + map::iterator im; + for (im=mymap.begin();im!=mymap.end(); im++) { - Registry::Infos &infos = (*all)[i] ; - const client_infos &lesInfos = *(*im).second ; - infos.name = CORBA::string_dup( lesInfos._name ) ; - infos.pid = lesInfos._pid ; - infos.pwname = lesInfos._pwname ; - infos.machine = CORBA::string_dup( lesInfos._machine ) ; - infos.adip = CORBA::string_dup( lesInfos._adip ) ; - infos.uid = lesInfos._uid ; - infos.tc_start = lesInfos._ts_start + lesInfos._difftime ; - infos.tc_hello = lesInfos._ts_hello + lesInfos._difftime ; - infos.tc_end = lesInfos._ts_end + lesInfos._difftime ; - infos.difftime = lesInfos._difftime ; - infos.cdir = CORBA::string_dup( lesInfos._cdir ) ; - infos.status = lesInfos._status ; - - i++; - } - - return all ; + Registry::Infos &infos = (*all)[i] ; + const client_infos &lesInfos = *(*im).second ; + infos.name = CORBA::string_dup( lesInfos._name ) ; + infos.pid = lesInfos._pid ; + infos.pwname = lesInfos._pwname ; + infos.machine = CORBA::string_dup( lesInfos._machine ) ; + infos.adip = CORBA::string_dup( lesInfos._adip ) ; + infos.uid = lesInfos._uid ; + infos.tc_start = lesInfos._ts_start + lesInfos._difftime ; + infos.tc_hello = lesInfos._ts_hello + lesInfos._difftime ; + infos.tc_end = lesInfos._ts_end + lesInfos._difftime ; + infos.difftime = lesInfos._difftime ; + infos.cdir = CORBA::string_dup( lesInfos._cdir ) ; + infos.status = lesInfos._status ; + + i++; + } + + return all ; } /* ------------------------------*/ -/* Autres */ +/* Others */ /* ------------------------------*/ RegistryService::client_infos::client_infos( const Registry::Infos &infos ):\ - _ior(duplicate(infos.ior)),\ - _name(duplicate(infos.name)),\ - _pid(infos.pid),\ - _machine(duplicate(infos.machine)),\ - _adip(duplicate(infos.adip)),\ - _uid(infos.uid),\ - _pwname(duplicate(infos.pwname)),\ - _ts_start(time(NULL)),\ - _difftime(infos.tc_start - _ts_start),\ - _cdir(duplicate(infos.cdir)),\ - _ts_hello(_ts_start),\ - _ts_end(0),\ - _status(RUNNING) + _ior(duplicate(infos.ior)),\ + _name(duplicate(infos.name)),\ + _pid(infos.pid),\ + _machine(duplicate(infos.machine)),\ + _adip(duplicate(infos.adip)),\ + _uid(infos.uid),\ + _pwname(duplicate(infos.pwname)),\ + _ts_start(time(NULL)),\ + _difftime(infos.tc_start - _ts_start),\ + _cdir(duplicate(infos.cdir)),\ + _ts_hello(_ts_start),\ + _ts_end(0),\ + _status(RUNNING) { - // SCRUTE(_ior) ; - ; } RegistryService::client_infos::~client_infos() { - delete [] (char*)_ior ; (char*&)_ior = NULL ; - delete [] (char*)_name ; (char*&)_name = NULL ; - delete [] (char*)_machine ; (char*&)_machine = NULL ; - delete [] (char*)_pwname ; (char*&)_pwname = NULL ; - delete [] (char*)_adip ; (char*&)_adip = NULL ; - delete [] (char*)_cdir ; (char*&)_cdir = NULL ; + delete [] (char*)_ior ; (char*&)_ior = NULL ; + delete [] (char*)_name ; (char*&)_name = NULL ; + delete [] (char*)_machine ; (char*&)_machine = NULL ; + delete [] (char*)_pwname ; (char*&)_pwname = NULL ; + delete [] (char*)_adip ; (char*&)_adip = NULL ; + delete [] (char*)_cdir ; (char*&)_cdir = NULL ; } void RegistryService::SessionName( const char *sessionName ) { - ASSERT(sessionName) ; - ASSERT(strlen(sessionName)>0) ; - _SessionName = duplicate(sessionName) ; - return ; + ASSERT(sessionName) ; + ASSERT(strlen(sessionName)>0) ; + _SessionName = duplicate(sessionName) ; + return ; } void RegistryService::ping() { diff --git a/src/ResourcesManager/Makefile.am b/src/ResourcesManager/Makefile.am index f24d8355d..90dd1def8 100755 --- a/src/ResourcesManager/Makefile.am +++ b/src/ResourcesManager/Makefile.am @@ -54,7 +54,6 @@ COMMON_CPPFLAGS=\ -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@ @@ -101,5 +100,5 @@ libResourcesManager_la_CPPFLAGS =\ libResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0 libResourcesManager_la_LIBADD =\ - ../Utils/libOpUtil.la \ + ../Basics/libSALOMEBasics.la \ @LIBXML_LIBS@ diff --git a/src/ResourcesManager/ResourcesManager.cxx b/src/ResourcesManager/ResourcesManager.cxx index e412a7911..c874c7781 100644 --- a/src/ResourcesManager/ResourcesManager.cxx +++ b/src/ResourcesManager/ResourcesManager.cxx @@ -160,7 +160,7 @@ ResourcesManager_cpp::GetFittingResources(const machineParams& params) throw(Res // PaCO++ parallel container case std::string parallelLib(params.parallelLib); - if (params.nb_component_nodes > 0 and parallelLib != "") + if (params.nb_component_nodes > 0 && parallelLib != "") { #if defined(_DEBUG_) || defined(_DEBUG) std::cerr << "[GetFittingResources] ParallelContainer case" << std::endl; diff --git a/src/ResourcesManager/ResourcesManager.hxx b/src/ResourcesManager/ResourcesManager.hxx index 1287d99b3..9d95ee3f7 100644 --- a/src/ResourcesManager/ResourcesManager.hxx +++ b/src/ResourcesManager/ResourcesManager.hxx @@ -33,7 +33,10 @@ #include "SALOME_LoadRateManager.hxx" #include #include +#ifdef WNT +#else #include +#endif // --- WARNING --- // The call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index 9c2ec5fea..4234cda85 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -377,6 +377,7 @@ SALOME_ResourcesCatalog_Handler::ProcessMember(xmlNodePtr member_descr, ParserRe std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl; return false; } + return true; } bool diff --git a/src/SALOMEDS/Makefile.am b/src/SALOMEDS/Makefile.am index 73c36db8d..8ee8a7fa0 100644 --- a/src/SALOMEDS/Makefile.am +++ b/src/SALOMEDS/Makefile.am @@ -69,7 +69,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../GenericObj \ -I$(srcdir)/../SALOMEDSClient \ -I$(srcdir)/../LifeCycleCORBA \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx index 121d87587..f82fbf353 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx @@ -46,7 +46,7 @@ std::string SALOMEDS_AttributeIOR::Value() SALOMEDS::Locker lock; aValue = dynamic_cast(_local_impl)->Value(); } - else aValue = SALOMEDS::AttributeIOR::_narrow(_corba_impl)->Value(); + else aValue = (CORBA::String_var)((SALOMEDS::AttributeIOR_var)SALOMEDS::AttributeIOR::_narrow(_corba_impl))->Value(); return aValue; } @@ -57,5 +57,5 @@ void SALOMEDS_AttributeIOR::SetValue(const std::string& value) SALOMEDS::Locker lock; dynamic_cast(_local_impl)->SetValue(value); } - else SALOMEDS::AttributeIOR::_narrow(_corba_impl)->SetValue(value.c_str()); + else ((SALOMEDS::AttributeIOR_var)SALOMEDS::AttributeIOR::_narrow(_corba_impl))->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx index 1ca91189e..7d46207e3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx @@ -36,6 +36,7 @@ char* SALOMEDS_AttributeIOR_i::Value() return c_s._retn(); } + void SALOMEDS_AttributeIOR_i::SetValue(const char* value) { SALOMEDS::Locker lock; @@ -44,3 +45,6 @@ void SALOMEDS_AttributeIOR_i::SetValue(const char* value) string anExtStr((char *)Str.in()); dynamic_cast(_impl)->SetValue(anExtStr); } + +SALOMEDS_AttributeIOR_i::~SALOMEDS_AttributeIOR_i() +{} diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx index c5f05dcb7..a1c415c3d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx @@ -39,7 +39,7 @@ public: SALOMEDS_AttributeIOR_i(SALOMEDSImpl_AttributeIOR* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; - ~SALOMEDS_AttributeIOR_i() {}; + ~SALOMEDS_AttributeIOR_i(); char* Value(); void SetValue(const char* value); diff --git a/src/SALOMEDS/SALOMEDS_AttributeName.cxx b/src/SALOMEDS/SALOMEDS_AttributeName.cxx index 86a384ddd..4fac58cbb 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName.cxx @@ -46,7 +46,7 @@ std::string SALOMEDS_AttributeName::Value() SALOMEDS::Locker lock; aValue = dynamic_cast(_local_impl)->Value(); } - else aValue = SALOMEDS::AttributeName::_narrow(_corba_impl)->Value(); + else aValue = (CORBA::String_var)((SALOMEDS::AttributeName_var)SALOMEDS::AttributeName::_narrow(_corba_impl))->Value(); return aValue; } @@ -57,5 +57,5 @@ void SALOMEDS_AttributeName::SetValue(const std::string& value) SALOMEDS::Locker lock; dynamic_cast(_local_impl)->SetValue(value); } - else SALOMEDS::AttributeName::_narrow(_corba_impl)->SetValue(value.c_str()); + else ((SALOMEDS::AttributeName_var)SALOMEDS::AttributeName::_narrow(_corba_impl))->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx b/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx index c7cd068cc..d18ed86b3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx @@ -46,7 +46,7 @@ bool SALOMEDS_AttributePixMap::HasPixMap() SALOMEDS::Locker lock; ret = dynamic_cast(_local_impl)->HasPixMap(); } - else ret = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->HasPixMap(); + else ret = ((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->HasPixMap(); return ret; } @@ -57,7 +57,7 @@ std::string SALOMEDS_AttributePixMap::GetPixMap() SALOMEDS::Locker lock; aValue = dynamic_cast(_local_impl)->GetPixMap(); } - else aValue = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->GetPixMap(); + else aValue = (CORBA::String_var)((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->GetPixMap(); return aValue; } @@ -68,5 +68,5 @@ void SALOMEDS_AttributePixMap::SetPixMap(const std::string& value) SALOMEDS::Locker lock; dynamic_cast(_local_impl)->SetPixMap(value); } - else SALOMEDS::AttributePixMap::_narrow(_corba_impl)->SetPixMap(value.c_str()); + else ((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->SetPixMap(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx index d8eacff0a..111ea32c7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx @@ -51,7 +51,7 @@ void SALOMEDS_AttributeStudyProperties::SetUserName(const std::string& theName) dynamic_cast(_local_impl); anImpl->ChangeCreatorName(theName); } else - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str()); + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetUserName(theName.c_str()); } std::string SALOMEDS_AttributeStudyProperties::GetUserName() @@ -62,9 +62,9 @@ std::string SALOMEDS_AttributeStudyProperties::GetUserName() aName = dynamic_cast(_local_impl)->GetCreatorName(); } #ifndef WIN32 - else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName(); + else aName = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUserName(); #else - else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserNameA(); + else aName = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUserNameA(); #endif return aName; } @@ -82,7 +82,7 @@ void SALOMEDS_AttributeStudyProperties::SetCreationDate string S; anImpl->SetModification(S, theMinute, theHour, theDay, theMonth, theYear); } else { - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute, + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetCreationDate(theMinute, theHour, theDay, theMonth, @@ -103,7 +103,7 @@ bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute, (_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear); } else { CORBA::Long aMinute, anHour, aDay, aMonth, anYear; - ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationDate(aMinute, + ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetCreationDate(aMinute, anHour, aDay, aMonth, @@ -129,7 +129,7 @@ void SALOMEDS_AttributeStudyProperties::SetCreationMode(const std::string& theMo else //Not defined dynamic_cast(_local_impl)->SetCreationMode(0); } - else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(theMode.c_str()); + else ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetCreationMode(theMode.c_str()); } std::string SALOMEDS_AttributeStudyProperties::GetCreationMode() @@ -142,7 +142,7 @@ std::string SALOMEDS_AttributeStudyProperties::GetCreationMode() if (mode == 2) aMode = "copy from"; } else - aMode = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationMode(); + aMode = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetCreationMode(); return aMode; } @@ -153,7 +153,7 @@ void SALOMEDS_AttributeStudyProperties::SetModified(int theModified) dynamic_cast(_local_impl)->SetModified(theModified); } else - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified); + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetModified(theModified); } bool SALOMEDS_AttributeStudyProperties::IsModified() @@ -164,7 +164,7 @@ bool SALOMEDS_AttributeStudyProperties::IsModified() ret = dynamic_cast(_local_impl)->IsModified(); } else - ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified(); + ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->IsModified(); return ret; } @@ -176,7 +176,7 @@ int SALOMEDS_AttributeStudyProperties::GetModified() isModified = dynamic_cast(_local_impl)->GetModified(); } else - isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified(); + isModified = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetModified(); return isModified; } @@ -187,7 +187,7 @@ void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked) dynamic_cast(_local_impl)->SetLocked(theLocked); } else - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked); + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetLocked(theLocked); } bool SALOMEDS_AttributeStudyProperties::IsLocked() @@ -198,7 +198,7 @@ bool SALOMEDS_AttributeStudyProperties::IsLocked() ret = dynamic_cast(_local_impl)->IsLocked(); } else - ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked(); + ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->IsLocked(); return ret; } @@ -215,7 +215,7 @@ void SALOMEDS_AttributeStudyProperties::SetModification(const std::string& theNa 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(), + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetModification(theName.c_str(), theMinute, theHour, theDay, @@ -252,7 +252,7 @@ void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vectorGetModificationsList(aNames.out(), + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetModificationsList(aNames.out(), aMinutes.out(), aHours.out(), aDays.out(), diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx index 5cbf2edc0..1f11e67d6 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx @@ -95,6 +95,9 @@ _PTR(SObject) SALOMEDS_ChildIterator::Value() SALOMEDS::Locker lock; aSO = new SALOMEDS_SObject(_local_impl->Value()); } - else aSO = new SALOMEDS_SObject(_corba_impl->Value()); + else { + SALOMEDS::SObject_var so=_corba_impl->Value(); + aSO = new SALOMEDS_SObject(so); + } return _PTR(SObject)(aSO); } diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx index 057312b44..09ac451e5 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx @@ -43,7 +43,7 @@ class SALOMEDS_ChildIterator_i: public virtual POA_SALOMEDS::ChildIterator, public virtual SALOME::GenericObj_i { private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_ChildIterator* _it; public: diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.cxx b/src/SALOMEDS/SALOMEDS_Driver_i.cxx index 1efad2868..4d851194c 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.cxx @@ -160,6 +160,7 @@ bool SALOMEDS_Driver_i::CanCopy(const SALOMEDSImpl_SObject& theObject) SALOMEDS::unlock(); bool isOk = _driver->CanCopy(so.in()); + so->Destroy(); SALOMEDS::lock(); return isOk; diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx index 827ea4714..a5a64b49b 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx @@ -99,7 +99,7 @@ std::string SALOMEDS_GenericAttribute::Type() aType = _local_impl->Type(); } else { - aType = _corba_impl->Type(); + aType = (CORBA::String_var)_corba_impl->Type(); } return aType; } @@ -112,7 +112,7 @@ std::string SALOMEDS_GenericAttribute::GetClassType() aType = _local_impl->GetClassType(); } else { - aType = _corba_impl->GetClassType(); + aType = (CORBA::String_var)_corba_impl->GetClassType(); } return aType; } @@ -125,7 +125,7 @@ _PTR(SObject) SALOMEDS_GenericAttribute::GetSObject() aSO = new SALOMEDS_SObject(_local_impl->GetSObject()); } else { - aSO = new SALOMEDS_SObject(_corba_impl->GetSObject()); + aSO = new SALOMEDS_SObject((SALOMEDS::SObject_var)_corba_impl->GetSObject()); } return _PTR(SObject)(aSO); @@ -148,7 +148,8 @@ SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDS:: { SALOMEDS_GenericAttribute* aGA = NULL; if(!CORBA::is_nil(theGA)) { - std::string aTypeOfAttribute = theGA->GetClassType(); + CORBA::String_var astr=theGA->GetClassType(); + std::string aTypeOfAttribute = astr.in(); __CreateGenericClientAttributeCORBA } return aGA; diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx index c68177b5c..29767e091 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx @@ -50,6 +50,10 @@ SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, _impl = theImpl; } +SALOMEDS_GenericAttribute_i::~SALOMEDS_GenericAttribute_i() +{ +} + void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection) { SALOMEDS::Locker lock; @@ -83,7 +87,7 @@ char* SALOMEDS_GenericAttribute_i::Type() return CORBA::string_dup(type.c_str()); } - return (char*)""; + return CORBA::string_dup(""); } char* SALOMEDS_GenericAttribute_i::GetClassType() @@ -94,7 +98,7 @@ char* SALOMEDS_GenericAttribute_i::GetClassType() return CORBA::string_dup(class_type.c_str()); } - return (char*)""; + return CORBA::string_dup(""); } diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx index 8b2893947..69fc111fb 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx @@ -41,11 +41,11 @@ class Standard_EXPORT SALOMEDS_GenericAttribute_i: public virtual POA_SALOMEDS:: protected: DF_Attribute* _impl; - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; public: SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb); - virtual ~SALOMEDS_GenericAttribute_i() {}; + virtual ~SALOMEDS_GenericAttribute_i(); void CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection); diff --git a/src/SALOMEDS/SALOMEDS_SComponent.cxx b/src/SALOMEDS/SALOMEDS_SComponent.cxx index fe7d379fc..30edcb280 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponent.cxx @@ -50,7 +50,12 @@ std::string SALOMEDS_SComponent::ComponentDataType() SALOMEDS::Locker lock; aType = (dynamic_cast(GetLocalImpl()))->ComponentDataType(); } - else aType = (SALOMEDS::SComponent::_narrow(GetCORBAImpl()))->ComponentDataType(); + else + { + SALOMEDS::SComponent_var aCompo=SALOMEDS::SComponent::_narrow(GetCORBAImpl()); + CORBA::String_var aString = aCompo->ComponentDataType(); + aType=aString.in(); + } return aType; } @@ -74,13 +79,13 @@ bool SALOMEDS_SComponent::ComponentIOR(std::string& theID) SALOMEDS::SComponent_ptr SALOMEDS_SComponent::GetSComponent() { if(_isLocal) { - if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl())); + if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_narrow(GetCORBAImpl()); SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(*(dynamic_cast(GetLocalImpl())), _orb); _corba_impl = SALOMEDS::SComponent::_duplicate(aSCO); return aSCO._retn(); } else { - return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl())); + return SALOMEDS::SComponent::_narrow(GetCORBAImpl()); } return SALOMEDS::SComponent::_nil(); } diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx index 9ee6a8e7d..5aea876c1 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx @@ -84,6 +84,6 @@ _PTR(SComponent) SALOMEDS_SComponentIterator::Value() SALOMEDS::Locker lock; aSCO = new SALOMEDS_SComponent(_local_impl->Value()); } - else aSCO = new SALOMEDS_SComponent(_corba_impl->Value()); + else aSCO = new SALOMEDS_SComponent((SALOMEDS::SComponent_var)_corba_impl->Value()); return _PTR(SComponent)(aSCO); } diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx index ff2e8f16d..1b9e1680c 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx @@ -45,7 +45,7 @@ class SALOMEDS_SComponentIterator_i:public virtual POA_SALOMEDS::SComponentItera private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_SComponentIterator* _impl; public: diff --git a/src/SALOMEDS/SALOMEDS_SComponent_i.cxx b/src/SALOMEDS/SALOMEDS_SComponent_i.cxx index cbe8ed337..48d71ed7d 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponent_i.cxx @@ -33,9 +33,8 @@ using namespace std; SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const SALOMEDSImpl_SComponent& theImpl, CORBA::ORB_ptr theORB) { SALOMEDS_SComponent_i* sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB); - SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this()); - return sco._retn(); + return sco_servant->_this(); } //============================================================================ diff --git a/src/SALOMEDS/SALOMEDS_SObject.cxx b/src/SALOMEDS/SALOMEDS_SObject.cxx index 1c6c05b4a..28df2a5c6 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -112,7 +112,7 @@ std::string SALOMEDS_SObject::GetID() SALOMEDS::Locker lock; aValue = _local_impl->GetID(); } - else aValue = _corba_impl->GetID(); + else aValue = (CORBA::String_var)_corba_impl->GetID(); return aValue; } @@ -122,7 +122,7 @@ _PTR(SComponent) SALOMEDS_SObject::GetFatherComponent() SALOMEDS::Locker lock; return _PTR(SComponent)(new SALOMEDS_SComponent(_local_impl->GetFatherComponent())); } - return _PTR(SComponent)(new SALOMEDS_SComponent(_corba_impl->GetFatherComponent())); + return _PTR(SComponent)(new SALOMEDS_SComponent((SALOMEDS::SComponent_var)_corba_impl->GetFatherComponent())); } _PTR(SObject) SALOMEDS_SObject::GetFather() @@ -131,7 +131,7 @@ _PTR(SObject) SALOMEDS_SObject::GetFather() SALOMEDS::Locker lock; return _PTR(SObject)(new SALOMEDS_SObject(_local_impl->GetFather())); } - return _PTR(SObject)(new SALOMEDS_SObject(_corba_impl->GetFather())); + return _PTR(SObject)(new SALOMEDS_SObject((SALOMEDS::SObject_var)_corba_impl->GetFather())); } bool SALOMEDS_SObject::FindAttribute(_PTR(GenericAttribute)& anAttribute, @@ -199,7 +199,8 @@ _PTR(Study) SALOMEDS_SObject::GetStudy() SALOMEDS::Locker lock; return _PTR(Study)(new SALOMEDS_Study(_local_impl->GetStudy())); } - return _PTR(Study)(new SALOMEDS_Study(_corba_impl->GetStudy())); + SALOMEDS::Study_var study=_corba_impl->GetStudy(); + return _PTR(Study)(new SALOMEDS_Study(study)); } std::string SALOMEDS_SObject::Name() @@ -209,7 +210,7 @@ std::string SALOMEDS_SObject::Name() SALOMEDS::Locker lock; aName = _local_impl->Name(); } - else aName = _corba_impl->Name(); + else aName = (CORBA::String_var)_corba_impl->Name(); return aName; } @@ -257,7 +258,7 @@ std::string SALOMEDS_SObject::GetName() SALOMEDS::Locker lock; aName = _local_impl->GetName(); } - else aName = _corba_impl->GetName(); + else aName = (CORBA::String_var) _corba_impl->GetName(); return aName; } @@ -269,7 +270,7 @@ std::string SALOMEDS_SObject::GetComment() SALOMEDS::Locker lock; aComment = _local_impl->GetComment(); } - else aComment = _corba_impl->GetComment(); + else aComment = (CORBA::String_var) _corba_impl->GetComment(); return aComment; } @@ -281,7 +282,7 @@ std::string SALOMEDS_SObject::GetIOR() SALOMEDS::Locker lock; anIOR = _local_impl->GetIOR(); } - else anIOR = _corba_impl->GetIOR(); + else anIOR = (CORBA::String_var) _corba_impl->GetIOR(); return anIOR; } diff --git a/src/SALOMEDS/SALOMEDS_SObject.hxx b/src/SALOMEDS/SALOMEDS_SObject.hxx index b20ceaf78..f4aec2742 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject.hxx @@ -71,7 +71,7 @@ public: CORBA::Object_ptr GetObject(); SALOMEDS::SObject_ptr GetSObject(); - SALOMEDS::SObject_ptr GetCORBAImpl() { return SALOMEDS::SObject::_duplicate(_corba_impl); } + SALOMEDS::SObject_var GetCORBAImpl() { return _corba_impl; } SALOMEDSImpl_SObject* GetLocalImpl() { return _local_impl; } private: diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index 985423a52..6398b8a6e 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -49,9 +49,8 @@ using namespace std; 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()); - return so._retn(); + return so_servant->_this(); } @@ -154,7 +153,7 @@ CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out SALOMEDS::Locker lock; DF_Attribute* anAttr = NULL; if(_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute)) { - anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb); return true; } @@ -180,7 +179,7 @@ SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes() 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)); + anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb); if (!CORBA::is_nil(anAttribute)) { SeqOfAttr[i] = anAttribute; } diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.hxx b/src/SALOMEDS/SALOMEDS_SObject_i.hxx index abf5fd3b3..7190778f3 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.hxx @@ -42,7 +42,7 @@ class Standard_EXPORT SALOMEDS_SObject_i: public virtual POA_SALOMEDS::SObject, public virtual SALOME::GenericObj_i { protected: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_SObject* _impl; public: diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index e97694d1b..d25086e27 100644 --- a/src/SALOMEDS/SALOMEDS_Study.cxx +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -104,7 +104,7 @@ std::string SALOMEDS_Study::GetPersistentReference() SALOMEDS::Locker lock; aRef = _local_impl->GetPersistentReference(); } - else aRef = _corba_impl->GetPersistentReference(); + else aRef = (CORBA::String_var)_corba_impl->GetPersistentReference(); return aRef; } @@ -567,7 +567,7 @@ _PTR(AttributeStudyProperties) SALOMEDS_Study::GetProperties() SALOMEDS::Locker lock; aProp = new SALOMEDS_AttributeStudyProperties(_local_impl->GetProperties()); } - else aProp = new SALOMEDS_AttributeStudyProperties(_corba_impl->GetProperties()); + else aProp = new SALOMEDS_AttributeStudyProperties((SALOMEDS::AttributeStudyProperties_var)_corba_impl->GetProperties()); return _PTR(AttributeStudyProperties)(aProp); } @@ -717,6 +717,30 @@ void SALOMEDS_Study::SetBoolean(const string& theVarName, const bool theValue) _corba_impl->SetBoolean((char*)theVarName.c_str(),theValue); } +void SALOMEDS_Study::SetString(const string& theVarName, const string& theValue) +{ + if (_isLocal) { + SALOMEDS::Locker lock; + _local_impl->SetStringVariable(theVarName, + theValue, + SALOMEDSImpl_GenericVariable::STRING_VAR); + } + else + _corba_impl->SetString((char*)theVarName.c_str(),(char*)theValue.c_str()); +} + +void SALOMEDS_Study::SetStringAsDouble(const string& theVarName, const double theValue) +{ + if (_isLocal) { + SALOMEDS::Locker lock; + _local_impl->SetStringVariableAsDouble(theVarName, + theValue, + SALOMEDSImpl_GenericVariable::STRING_VAR); + } + else + _corba_impl->SetStringAsDouble((char*)theVarName.c_str(),theValue); +} + double SALOMEDS_Study::GetReal(const string& theVarName) { double aResult; @@ -753,6 +777,18 @@ bool SALOMEDS_Study::GetBoolean(const string& theVarName) return aResult; } +std::string SALOMEDS_Study::GetString(const string& theVarName) +{ + std::string aResult; + if (_isLocal) { + SALOMEDS::Locker lock; + aResult = _local_impl->GetStringVariableValue(theVarName); + } + else + aResult = _corba_impl->GetString((char*)theVarName.c_str()); + return aResult; +} + bool SALOMEDS_Study::IsReal(const string& theVarName) { bool aResult; @@ -792,6 +828,19 @@ bool SALOMEDS_Study::IsBoolean(const string& theVarName) return aResult; } +bool SALOMEDS_Study::IsString(const string& theVarName) +{ + bool aResult; + if (_isLocal) { + SALOMEDS::Locker lock; + aResult = _local_impl->IsTypeOf(theVarName, + SALOMEDSImpl_GenericVariable::STRING_VAR); + } + else + aResult = _corba_impl->IsString((char*)theVarName.c_str()); + return aResult; +} + bool SALOMEDS_Study::IsVariable(const string& theVarName) { bool aResult; diff --git a/src/SALOMEDS/SALOMEDS_Study.hxx b/src/SALOMEDS/SALOMEDS_Study.hxx index d6784b0ec..91ae9d64c 100644 --- a/src/SALOMEDS/SALOMEDS_Study.hxx +++ b/src/SALOMEDS/SALOMEDS_Study.hxx @@ -101,14 +101,18 @@ public: virtual void SetReal(const std::string& theVarName, const double theValue); virtual void SetInteger(const std::string& theVarName, const int theValue); virtual void SetBoolean(const std::string& theVarName, const bool theValue); + virtual void SetString(const std::string& theVarName, const std::string& theValue); + virtual void SetStringAsDouble(const std::string& theVarName, const double theValue); virtual double GetReal(const std::string& theVarName); virtual int GetInteger(const std::string& theVarName); virtual bool GetBoolean(const std::string& theVarName); + virtual std::string GetString(const std::string& theVarName); virtual bool IsReal(const std::string& theVarName); virtual bool IsInteger(const std::string& theVarName); virtual bool IsBoolean(const std::string& theVarName); + virtual bool IsString(const std::string& theVarName); virtual bool IsVariable(const std::string& theVarName); virtual std::vector GetVariableNames(); diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx index 4f6cb0596..7ffd82dd7 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx @@ -96,7 +96,8 @@ void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr a { SALOMEDS::Locker lock; CheckLocked(); - SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID()); + CORBA::String_var anID=aComponent->GetID(); + SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anID.in()); CORBA::String_var iorstr = _orb->object_to_string(IOR); _impl->DefineComponentInstance(aSCO, (char*)iorstr.in()); @@ -112,7 +113,8 @@ void SALOMEDS_StudyBuilder_i::RemoveComponent(SALOMEDS::SComponent_ptr aComponen SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(aComponent)); - SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID()); + CORBA::String_var cid=aComponent->GetID(); + SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(cid.in()); _impl->RemoveComponent(aSCO); } @@ -127,7 +129,8 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyBuilder_i::NewObject(SALOMEDS::SObject_ptr t CheckLocked(); SALOMEDSImpl_SObject aFO, aSO; - aFO = _impl->GetOwner()->GetSObject(theFatherObject->GetID()); + CORBA::String_var anID=theFatherObject->GetID(); + aFO = _impl->GetOwner()->GetSObject(anID.in()); aSO = _impl->NewObject(aFO); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO,_orb); @@ -162,7 +165,8 @@ void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr anObject) { SALOMEDS::Locker lock; CheckLocked(); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + CORBA::String_var anID=anObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->RemoveObject(aSO); } @@ -175,7 +179,8 @@ void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr anO { SALOMEDS::Locker lock; CheckLocked(); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + CORBA::String_var anID=anObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->RemoveObjectWithChildren(aSO); } @@ -190,7 +195,8 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO, SALOMEDS::Locker lock; Unexpect aCatch(SBSalomeException); - SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anSCO->GetID()); + CORBA::String_var anID=anSCO->GetID(); + SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anID.in()); SALOMEDS_Driver_i* driver = new SALOMEDS_Driver_i(aDriver, _orb); bool isDone = _impl->LoadWith(aSCO, driver); delete driver; @@ -234,7 +240,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA SALOMEDS::GenericAttribute_var anAttribute; if(anAttr) - anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb); return anAttribute._retn(); } @@ -251,12 +257,13 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::FindAttribute(SALOMEDS::SObject_ptr anOb { SALOMEDS::Locker lock; ASSERT(!CORBA::is_nil(anObject)); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + CORBA::String_var anID = anObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); DF_Attribute* anAttr; if(!_impl->FindAttribute(aSO, anAttr, string(aTypeOfAttribute))) return false; - anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb); return true; } @@ -272,7 +279,8 @@ void SALOMEDS_StudyBuilder_i::RemoveAttribute(SALOMEDS::SObject_ptr anObject, SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(anObject)); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + CORBA::String_var anID = anObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->RemoveAttribute(aSO, string(aTypeOfAttribute)); } @@ -290,8 +298,10 @@ void SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me, ASSERT(!CORBA::is_nil(theReferencedObject)); SALOMEDSImpl_SObject aSO, aRefSO; - aSO = _impl->GetOwner()->GetSObject(me->GetID()); - aRefSO = _impl->GetOwner()->GetSObject(theReferencedObject->GetID()); + CORBA::String_var anID = me->GetID(); + aSO = _impl->GetOwner()->GetSObject(anID.in()); + anID=theReferencedObject->GetID(); + aRefSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->Addreference(aSO, aRefSO); } @@ -305,7 +315,8 @@ void SALOMEDS_StudyBuilder_i::RemoveReference(SALOMEDS::SObject_ptr me) SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(me)); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(me->GetID()); + CORBA::String_var anID = me->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->RemoveReference(aSO); } @@ -339,7 +350,8 @@ void SALOMEDS_StudyBuilder_i::SetGUID(SALOMEDS::SObject_ptr anObject, const char SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(anObject)); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + CORBA::String_var anID=anObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->SetGUID(aSO, string(theGUID)); } @@ -352,7 +364,8 @@ bool SALOMEDS_StudyBuilder_i::IsGUID(SALOMEDS::SObject_ptr anObject, const char* { SALOMEDS::Locker lock; ASSERT(!CORBA::is_nil(anObject)); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + CORBA::String_var anID=anObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); return _impl->IsGUID(aSO, string(theGUID)); } @@ -518,7 +531,8 @@ void SALOMEDS_StudyBuilder_i::SetName(SALOMEDS::SObject_ptr theSO, const char* t Unexpect aCatch(SBLockProtection); CheckLocked(); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID()); + CORBA::String_var anID=theSO->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->SetName(aSO, string(theValue)); } @@ -534,7 +548,8 @@ void SALOMEDS_StudyBuilder_i::SetComment(SALOMEDS::SObject_ptr theSO, const char Unexpect aCatch(SBLockProtection); CheckLocked(); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID()); + CORBA::String_var anID=theSO->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->SetComment(aSO, string(theValue)); } @@ -550,6 +565,7 @@ void SALOMEDS_StudyBuilder_i::SetIOR(SALOMEDS::SObject_ptr theSO, const char* th Unexpect aCatch(SBLockProtection); CheckLocked(); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID()); + CORBA::String_var anID=theSO->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->SetIOR(aSO, string(theValue)); } diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx index 99d0a3af4..caa92dea9 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx @@ -39,7 +39,7 @@ class SALOMEDS_StudyBuilder_i: public POA_SALOMEDS::StudyBuilder { private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_StudyBuilder* _impl; public: diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index c579fa47f..7a09d7a49 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -122,8 +122,9 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name) MESSAGE("NewStudy : Creating the CORBA servant holding it... "); - SALOMEDS_Study_i *Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); - SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); + SALOMEDS_Study_i *Study_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb); + PortableServer::ObjectId_var servantid = _poa->activate_object(Study_servant); // to use poa registered in _mapOfPOA + SALOMEDS::Study_var Study = Study_servant->_this(); // Register study in the naming service // Path to acces the study @@ -139,7 +140,7 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name) _mapOfPOA[Study->StudyId()] = _poa; - return Study; + return Study._retn(); } //============================================================================ @@ -163,19 +164,22 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) MESSAGE("Open : Creating the CORBA servant holding it... "); // Temporary aStudyUrl in place of study name - SALOMEDS_Study_i * Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); - SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); + SALOMEDS_Study_i * Study_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb); + PortableServer::ObjectId_var servantid = _poa->activate_object(Study_servant); // to use poa register in _mapOfPOA + SALOMEDS::Study_var Study = Study_servant->_this(); // Assign the value of the IOR in the study->root CORBA::String_var IORStudy = _orb->object_to_string(Study); aStudyImpl->SetTransientReference((char*)IORStudy.in()); + _mapOfPOA[Study->StudyId()] = _poa; + // 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().c_str())); - return Study; + return Study._retn(); } @@ -202,6 +206,14 @@ void SALOMEDS_StudyManager_i::Close(SALOMEDS::Study_ptr aStudy) SALOMEDS::unlock(); aStudy->Close(); SALOMEDS::lock(); + + //remove study servant + PortableServer::POA_ptr poa=GetPOA(aStudy); + PortableServer::ServantBase* aservant=poa->reference_to_servant(aStudy); + PortableServer::ObjectId_var anObjectId = poa->servant_to_id(aservant); + poa->deactivate_object(anObjectId.in()); + aservant->_remove_ref(); // decrement for the call to reference_to_servant + aservant->_remove_ref(); // to delete the object } //============================================================================ @@ -313,10 +325,8 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByName(const char* aStudyNa 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()); - - return aStudy._retn(); + SALOMEDS_Study_i* aStudy_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb); + return aStudy_servant->_this(); } //============================================================================ @@ -336,11 +346,8 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByID(CORBA::Short aStudyID) return SALOMEDS::Study::_nil(); } - SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); - CORBA::Object_var obj = aStudy_servant->_this(); - SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(obj); - - return aStudy._retn(); + SALOMEDS_Study_i* aStudy_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb); + return aStudy_servant->_this(); } @@ -355,7 +362,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::CanCopy(SALOMEDS::SObject_ptr theObject) SALOMEDS::Study_var aStudy = theObject->GetStudy(); SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); + CORBA::String_var anID = theObject->GetID(); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in()); SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); bool ret = _impl->CanCopy(anObject, aDriver); @@ -374,7 +382,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::Copy(SALOMEDS::SObject_ptr theObject) SALOMEDS::Study_var aStudy = theObject->GetStudy(); SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); + CORBA::String_var anID = theObject->GetID(); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in()); SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); bool ret = _impl->Copy(anObject, aDriver); @@ -393,7 +402,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::CanPaste(SALOMEDS::SObject_ptr theObject SALOMEDS::Study_var aStudy = theObject->GetStudy(); SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); + CORBA::String_var anID = theObject->GetID(); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in()); SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); bool ret = _impl->CanPaste(anObject, aDriver); @@ -415,7 +425,8 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyManager_i::Paste(SALOMEDS::SObject_ptr theOb SALOMEDS::Study_var aStudy = theObject->GetStudy(); SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); + CORBA::String_var anID = theObject->GetID(); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in()); SALOMEDSImpl_SObject aNewSO; try { diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index 3ec35db2b..bbb4855a6 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -25,6 +25,7 @@ // #include "utilities.h" #include "SALOMEDS_Study_i.hxx" +#include "SALOMEDS_StudyManager_i.hxx" #include "SALOMEDS_UseCaseIterator_i.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" #include "SALOMEDS_AttributeStudyProperties_i.hxx" @@ -55,6 +56,8 @@ using namespace std; +std::map SALOMEDS_Study_i::_mapOfStudies; + //============================================================================ /*! Function : SALOMEDS_Study_i * Purpose : SALOMEDS_Study_i constructor @@ -76,6 +79,15 @@ SALOMEDS_Study_i::SALOMEDS_Study_i(SALOMEDSImpl_Study* theImpl, //============================================================================ SALOMEDS_Study_i::~SALOMEDS_Study_i() { + //delete the builder servant + PortableServer::POA_var poa=_builder->_default_POA(); + PortableServer::ObjectId_var anObjectId = poa->servant_to_id(_builder); + poa->deactivate_object(anObjectId.in()); + _builder->_remove_ref(); + + //delete implementation + delete _impl; + _mapOfStudies.erase(_impl); } //============================================================================ @@ -421,14 +433,14 @@ SALOMEDS::ChildIterator_ptr SALOMEDS_Study_i::NewChildIterator(SALOMEDS::SObject { SALOMEDS::Locker lock; - SALOMEDSImpl_SObject aSO = _impl->GetSObject(theSO->GetID()); + CORBA::String_var anID=theSO->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetSObject(anID.in()); SALOMEDSImpl_ChildIterator anItr(aSO); //Create iterator SALOMEDS_ChildIterator_i* it_servant = new SALOMEDS_ChildIterator_i(anItr, _orb); - SALOMEDS::ChildIterator_var it = SALOMEDS::ChildIterator::_narrow(it_servant->_this()); - return it; + return it_servant->_this(); } @@ -582,6 +594,18 @@ SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const DF_Label& theLabel, CORBA:: return SALOMEDS::Study::_nil(); } +SALOMEDS_Study_i* SALOMEDS_Study_i::GetStudyServant(SALOMEDSImpl_Study* aStudyImpl, CORBA::ORB_ptr orb) +{ + if (_mapOfStudies.find(aStudyImpl) != _mapOfStudies.end()) + return _mapOfStudies[aStudyImpl]; + else + { + SALOMEDS_Study_i *Study_servant = new SALOMEDS_Study_i(aStudyImpl, orb); + _mapOfStudies[aStudyImpl]=Study_servant; + return Study_servant; + } +} + void SALOMEDS_Study_i::IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute) { SALOMEDS::Locker lock; @@ -661,12 +685,13 @@ void SALOMEDS_Study_i::Close() 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()); + CORBA::String_var compodatatype=sco->ComponentDataType(); + MESSAGE ( "Look for an engine for data type :"<< compodatatype); // if there is an associated Engine call its method for closing CORBA::String_var IOREngine; if (sco->ComponentIOR(IOREngine)) { // we have found the associated engine to write the data - MESSAGE ( "We have found an engine for data type :"<< sco->ComponentDataType()); + MESSAGE ( "We have found an engine for data type :"<< compodatatype); //_narrow can throw a corba exception try { @@ -685,8 +710,13 @@ void SALOMEDS_Study_i::Close() catch (CORBA::Exception&) {/*pass*/ } } + sco->Destroy(); } + //Does not need any more this iterator + itcomponent->Destroy(); + + _impl->Close(); } @@ -887,6 +917,30 @@ void SALOMEDS_Study_i::SetBoolean(const char* theVarName, CORBA::Boolean theValu SALOMEDSImpl_GenericVariable::BOOLEAN_VAR); } +//============================================================================ +/*! Function : SetString + * Purpose : + */ +//============================================================================ +void SALOMEDS_Study_i::SetString(const char* theVarName, const char* theValue) +{ + _impl->SetStringVariable(string(theVarName), + theValue, + SALOMEDSImpl_GenericVariable::STRING_VAR); +} + +//============================================================================ +/*! Function : SetStringAsDouble + * Purpose : + */ +//============================================================================ +void SALOMEDS_Study_i::SetStringAsDouble(const char* theVarName, CORBA::Double theValue) +{ + _impl->SetStringVariableAsDouble(string(theVarName), + theValue, + SALOMEDSImpl_GenericVariable::STRING_VAR); +} + //============================================================================ /*! Function : GetReal * Purpose : @@ -917,6 +971,16 @@ CORBA::Boolean SALOMEDS_Study_i::GetBoolean(const char* theVarName) return (bool)_impl->GetVariableValue(string(theVarName)); } +//============================================================================ +/*! Function : GetString + * Purpose : + */ +//============================================================================ +char* SALOMEDS_Study_i::GetString(const char* theVarName) +{ + return CORBA::string_dup(_impl->GetStringVariableValue(string(theVarName)).c_str()); +} + //============================================================================ /*! Function : IsReal * Purpose : @@ -950,6 +1014,17 @@ CORBA::Boolean SALOMEDS_Study_i::IsBoolean(const char* theVarName) SALOMEDSImpl_GenericVariable::BOOLEAN_VAR); } +//============================================================================ +/*! Function : IsString + * Purpose : + */ +//============================================================================ +CORBA::Boolean SALOMEDS_Study_i::IsString(const char* theVarName) +{ + return _impl->IsTypeOf(string(theVarName), + SALOMEDSImpl_GenericVariable::STRING_VAR); +} + //============================================================================ /*! Function : IsVariable * Purpose : diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index 307f09fb2..bd8fd2b5a 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -48,9 +48,10 @@ class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study { private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_Study* _impl; SALOMEDS_StudyBuilder_i* _builder; + static std::map _mapOfStudies; public: @@ -244,6 +245,7 @@ public: virtual void StudyId(CORBA::Short id); static SALOMEDS::Study_ptr GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb); + static SALOMEDS_Study_i* GetStudyServant(SALOMEDSImpl_Study*, CORBA::ORB_ptr orb); static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute); @@ -302,18 +304,26 @@ public: virtual void SetBoolean(const char* theVarName, CORBA::Boolean theValue); + virtual void SetString(const char* theVarName, const char* theValue); + + virtual void SetStringAsDouble(const char* theVarName, CORBA::Double theValue); + virtual CORBA::Double GetReal(const char* theVarName); virtual CORBA::Long GetInteger(const char* theVarName); virtual CORBA::Boolean GetBoolean(const char* theVarName); + virtual char* GetString(const char* theVarName); + virtual CORBA::Boolean IsReal(const char* theVarName); virtual CORBA::Boolean IsInteger(const char* theVarName); virtual CORBA::Boolean IsBoolean(const char* theVarName); + virtual CORBA::Boolean IsString(const char* theVarName); + virtual CORBA::Boolean IsVariable(const char* theVarName); virtual SALOMEDS::ListOfStrings* GetVariableNames(); diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx index 864646a0a..af1e5bbed 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx @@ -46,7 +46,7 @@ class SALOMEDS_UseCaseBuilder_i: public virtual POA_SALOMEDS::UseCaseBuilder, { private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_UseCaseBuilder* _impl; public: diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx index d40276d79..0c935f9ea 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx @@ -41,7 +41,7 @@ class SALOMEDS_UseCaseIterator_i: public virtual POA_SALOMEDS::UseCaseIterator, public virtual SALOME::GenericObj_i { private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_UseCaseIterator* _impl; public: diff --git a/src/SALOMEDS/SALOME_DriverPy.py b/src/SALOMEDS/SALOME_DriverPy.py index c47e814b9..87da46bd2 100644 --- a/src/SALOMEDS/SALOME_DriverPy.py +++ b/src/SALOMEDS/SALOME_DriverPy.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/SALOMEDS/Test/Makefile.am b/src/SALOMEDS/Test/Makefile.am index f1c357707..532aaa090 100644 --- a/src/SALOMEDS/Test/Makefile.am +++ b/src/SALOMEDS/Test/Makefile.am @@ -60,7 +60,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/SALOMEDSClient \ -I$(srcdir)/$(RPATH)/DF \ -I$(srcdir)/$(RPATH)/SALOMEDSImpl -I$(srcdir)/$(RPATH)/SALOMEDSImpl/Test \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@ diff --git a/src/SALOMEDS/Test/TestSALOMEDS.py b/src/SALOMEDS/Test/TestSALOMEDS.py index 71066f35c..92b47694b 100644 --- a/src/SALOMEDS/Test/TestSALOMEDS.py +++ b/src/SALOMEDS/Test/TestSALOMEDS.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/SALOMEDSClient/Makefile.am b/src/SALOMEDSClient/Makefile.am index f1534abe8..d9736b141 100644 --- a/src/SALOMEDSClient/Makefile.am +++ b/src/SALOMEDSClient/Makefile.am @@ -81,7 +81,6 @@ salomeinclude_HEADERS=\ # This local variable defines the list of CPPFLAGS common to all target in this package. COMMON_CPPFLAGS= \ @BOOST_CPPFLAGS@ \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/SALOMEDSClient/SALOMEDSClient_Study.hxx b/src/SALOMEDSClient/SALOMEDSClient_Study.hxx index 3177e9ba9..c63e258c9 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_Study.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_Study.hxx @@ -97,14 +97,18 @@ public: virtual void SetReal(const std::string& theVarName, const double theValue) = 0; virtual void SetInteger(const std::string& theVarName, const int theValue) = 0; virtual void SetBoolean(const std::string& theVarName, const bool theValue) = 0; + virtual void SetString(const std::string& theVarName, const std::string& theValue) = 0; + virtual void SetStringAsDouble(const std::string& theVarName, const double theValue) = 0; virtual double GetReal(const std::string& theVarName) = 0; virtual int GetInteger(const std::string& theVarName) = 0; virtual bool GetBoolean(const std::string& theVarName) = 0; + virtual std::string GetString(const std::string& theVarName) = 0; virtual bool IsReal(const std::string& theVarName) = 0; virtual bool IsInteger(const std::string& theVarName) = 0; virtual bool IsBoolean(const std::string& theVarName) = 0; + virtual bool IsString(const std::string& theVarName) = 0; virtual bool IsVariable(const std::string& theVarName) = 0; virtual std::vector GetVariableNames() = 0; diff --git a/src/SALOMEDSImpl/Makefile.am b/src/SALOMEDSImpl/Makefile.am index 3a16fc238..731cf625a 100644 --- a/src/SALOMEDSImpl/Makefile.am +++ b/src/SALOMEDSImpl/Makefile.am @@ -95,13 +95,16 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../HDFPersist \ -I$(srcdir)/../DF \ + -I$(srcdir)/../GenericObj \ + -I$(top_builddir)/idl \ @HDF5_INCLUDES@ \ - @BOOST_CPPFLAGS@ + @BOOST_CPPFLAGS@ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ ../HDFPersist/libSalomeHDFPersist.la \ ../DF/libDF.la \ + ../GenericObj/libSalomeGenericObj.la \ @HDF5_LIBS@ @@ -215,7 +218,7 @@ libSalomeDSImpl_la_SOURCES =\ libSalomeDSImpl_la_CPPFLAGS = $(COMMON_CPPFLAGS) libSalomeDSImpl_la_LDFLAGS = -no-undefined -version-info=0:0:0 -libSalomeDSImpl_la_LIBADD = $(COMMON_LIBS) +libSalomeDSImpl_la_LIBADD = $(COMMON_LIBS) $(CORBA_LIBS) # # =============================================================== @@ -226,4 +229,4 @@ bin_PROGRAMS = testDS testDS_SOURCES = testDS.cxx testDS_CPPFLAGS = $(COMMON_CPPFLAGS) testDS_LDADD = libSalomeDSImpl.la \ - $(HDF5_LIBS) + $(HDF5_LIBS) $(CORBA_LIBS) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx index fe83cfd63..1c049a87f 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx @@ -28,6 +28,62 @@ using namespace std; +//to disable automatic genericobj management comment the following line +#define WITHGENERICOBJ + +#ifdef WITHGENERICOBJ +#include "SALOME_GenericObj_i.hh" + +static CORBA::ORB_var getORB() +{ + int argc=0; + return CORBA::ORB_init(argc,0); +} + +void IORGenericObjDecref(const std::string& anIOR) +{ + CORBA::Object_var obj; + SALOME::GenericObj_var gobj; + try + { + obj = getORB()->string_to_object(anIOR.c_str()); + if(obj->_non_existent())return; + gobj = SALOME::GenericObj::_narrow(obj); + if(! CORBA::is_nil(gobj) ) + { + gobj->Destroy(); + } + } + catch(const CORBA::Exception& e) + { + } +} + +void IORGenericObjIncref(const std::string& anIOR) +{ + CORBA::Object_var obj; + SALOME::GenericObj_var gobj; + try + { + obj = getORB()->string_to_object(anIOR.c_str()); + if(obj->_non_existent())return; + gobj = SALOME::GenericObj::_narrow(obj); + if(! CORBA::is_nil(gobj) ) + { + gobj->Register(); + } + } + catch(const CORBA::Exception& e) + { + } +} +#else +void IORGenericObjDecref(const std::string& anIOR) +{} +void IORGenericObjIncref(const std::string& anIOR) +{} +#endif + //======================================================================= //function : GetID //purpose : @@ -47,7 +103,7 @@ const std::string& SALOMEDSImpl_AttributeIOR::GetID () //======================================================================= SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L, - const std::string& S) + const std::string& S) { SALOMEDSImpl_AttributeIOR* A = NULL; if (!(A=(SALOMEDSImpl_AttributeIOR*)L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { @@ -56,7 +112,6 @@ SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L, } A->SetValue(S); - SALOMEDSImpl_Study::IORUpdated(A); return A; } @@ -68,11 +123,20 @@ void SALOMEDSImpl_AttributeIOR::SetValue(const std::string& theValue) { CheckLocked(); - SALOMEDSImpl_Study::GetStudy(Label()); + SALOMEDSImpl_Study* study=SALOMEDSImpl_Study::GetStudy(Label()); Backup(); + //remove IOR entry in study + if(theValue != myString) + { + IORGenericObjIncref(theValue); + IORGenericObjDecref(myString); + study->DeleteIORLabelMapItem(myString); + } + myString = theValue; + //add IOR entry in study SALOMEDSImpl_Study::IORUpdated(this); } @@ -94,6 +158,11 @@ SALOMEDSImpl_AttributeIOR::SALOMEDSImpl_AttributeIOR() { } +SALOMEDSImpl_AttributeIOR::~SALOMEDSImpl_AttributeIOR() +{ + IORGenericObjDecref(myString); +} + //======================================================================= //function : ID //purpose : diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx index b0370d3f4..8ebef9533 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx @@ -51,7 +51,7 @@ public: void Restore(DF_Attribute* with); DF_Attribute* NewEmpty() const; void Paste(DF_Attribute* into); - ~SALOMEDSImpl_AttributeIOR() {} + ~SALOMEDSImpl_AttributeIOR() ; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_GenericVariable.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_GenericVariable.hxx index 5dc385cc0..3e74897a3 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_GenericVariable.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_GenericVariable.hxx @@ -35,7 +35,7 @@ class SALOMEDSIMPL_EXPORT SALOMEDSImpl_GenericVariable public: //Supported types of the nootebook variables - enum VariableTypes{REAL_VAR, INTEGER_VAR, BOOLEAN_VAR}; + enum VariableTypes{REAL_VAR, INTEGER_VAR, BOOLEAN_VAR, STRING_VAR}; SALOMEDSImpl_GenericVariable(VariableTypes theType, const std::string& theName); ~SALOMEDSImpl_GenericVariable(); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.cxx index 619e22ccc..d40db227c 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.cxx @@ -61,6 +61,21 @@ bool SALOMEDSImpl_ScalarVariable::setValue(const double theValue) return true; } +//============================================================================ +/*! Function : + * Purpose : + */ +//============================================================================ +bool SALOMEDSImpl_ScalarVariable::setStringValue(const string& theValue) +{ + + if(myStrValue == theValue) + return false; + + myStrValue = theValue; + return true; +} + //============================================================================ /*! Function : getValue() * Purpose : @@ -71,6 +86,16 @@ double SALOMEDSImpl_ScalarVariable::getValue() const return myValue; } +//============================================================================ +/*! Function : getStringValue() + * Purpose : + */ +//============================================================================ +string SALOMEDSImpl_ScalarVariable::getStringValue() const +{ + return myStrValue; +} + //============================================================================ /*! Function : Save() * Purpose : @@ -91,6 +116,11 @@ string SALOMEDSImpl_ScalarVariable::Save() const{ sprintf(buffer, "%d", (int)myValue); break; } + case SALOMEDSImpl_GenericVariable::STRING_VAR: + { + sprintf(buffer, "\"%s\"", myStrValue.c_str()); + break; + } default:break; } return string(buffer); @@ -124,6 +154,11 @@ string SALOMEDSImpl_ScalarVariable::SaveToScript() const sprintf(buffer, "%s", "False"); break; } + case SALOMEDSImpl_GenericVariable::STRING_VAR: + { + sprintf(buffer, "\"%s\"", myStrValue.c_str()); + break; + } default:break; } return string(buffer); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.hxx index 9684f6e06..acb897156 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.hxx @@ -38,6 +38,9 @@ public: bool setValue(const double theValue); double getValue() const; + bool setStringValue(const std::string& theValue); + std::string getStringValue() const; + virtual std::string Save() const; virtual std::string SaveToScript() const; virtual std::string SaveType() const; @@ -46,6 +49,7 @@ public: private: double myValue; + std::string myStrValue; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 2fa36c294..373058472 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -48,14 +48,13 @@ using namespace std; #define VARIABLE_SEPARATOR ':' #define OPERATION_SEPARATOR '|' - //============================================================================ /*! Function : SALOMEDSImpl_Study * Purpose : SALOMEDSImpl_Study constructor */ //============================================================================ SALOMEDSImpl_Study::SALOMEDSImpl_Study(const DF_Document* doc, - const string& study_name) + const string& study_name) { _name = study_name; _doc = (DF_Document*)doc; @@ -79,7 +78,11 @@ SALOMEDSImpl_Study::SALOMEDSImpl_Study(const DF_Document* doc, */ //============================================================================ SALOMEDSImpl_Study::~SALOMEDSImpl_Study() -{} +{ + delete _builder; + delete _cb; + delete _useCaseBuilder; +} //============================================================================ /*! Function : GetPersistentReference @@ -190,8 +193,8 @@ SALOMEDSImpl_SComponent SALOMEDSImpl_Study::FindComponentID(const string& aCompo ID = SC.GetID(); if(aComponentID == ID) { - // ComponentID found - _find = true; + // ComponentID found + _find = true; compo = SC; } } @@ -223,14 +226,14 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObject(const string& anObjectName) for (; it.More();it.Next()){ if(!_find) { - SALOMEDSImpl_SComponent SC = it.Value(); - if (SC.GetName() == anObjectName) - { - _find = true; - RefSO = SC; - - } - if (!_find) RefSO = _FindObject(SC, anObjectName, _find); + SALOMEDSImpl_SComponent SC = it.Value(); + if (SC.GetName() == anObjectName) + { + _find = true; + RefSO = SC; + + } + if (!_find) RefSO = _FindObject(SC, anObjectName, _find); } } if(!RefSO) _errorCode = "No object was found"; @@ -286,7 +289,7 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::CreateObjectID(const string& anObjectID */ //============================================================================ vector SALOMEDSImpl_Study::FindObjectByName(const string& anObjectName, - const string& aComponentName) + const string& aComponentName) { _errorCode = ""; @@ -308,8 +311,8 @@ vector SALOMEDSImpl_Study::FindObjectByName(const string& SALOMEDSImpl_SObject CSO = it.Value(); if ( CSO.GetName() == anObjectName ) { - /* add to list */ - listSO.push_back(CSO) ; + /* add to list */ + listSO.push_back(CSO) ; } /* looks also for eventual children */ @@ -395,14 +398,14 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectByPath(const string& thePath) for ( ; anIterator.More(); anIterator.Next() ) { aLabel = anIterator.Value(); if((anAttr=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { - if(anAttr->Value() == aToken) { - if(i == (len-1)) { //The searched label is found (no part of the path is left) - return GetSObject(aLabel); - } - - anIterator.Init(aLabel, false); - break; - } + if(anAttr->Value() == aToken) { + if(i == (len-1)) { //The searched label is found (no part of the path is left) + return GetSObject(aLabel); + } + + anIterator.Init(aLabel, false); + break; + } } } @@ -437,8 +440,8 @@ string SALOMEDSImpl_Study::GetObjectPath(const SALOMEDSImpl_SObject& theObject) if(aFather) { aName = aFather.GetName(); if(!aName.empty() && aName != "") { - aValue = GetObjectPath(aFather); - aPath = aValue + aPath; + aValue = GetObjectPath(aFather); + aPath = aValue + aPath; } } } @@ -597,10 +600,10 @@ vector SALOMEDSImpl_Study::GetDirectoryNames(const string& theContext) SALOMEDSImpl_AttributeLocalID* anID; if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) { if (anID->Value() == DIRECTORYID) { - SALOMEDSImpl_AttributeName* aName; - if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { - aResultSeq.push_back(aName->Value()); - } + SALOMEDSImpl_AttributeName* aName; + if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { + aResultSeq.push_back(aName->Value()); + } } } } @@ -638,12 +641,12 @@ vector SALOMEDSImpl_Study::GetFileNames(const string& theContext) SALOMEDSImpl_AttributeLocalID* anID; if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) { if (anID->Value() == FILELOCALID) { - 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())); - } + 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())); + } } } } @@ -814,8 +817,8 @@ void SALOMEDSImpl_Study::URL(const string& url) */ //============================================================================ SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObject(const SALOMEDSImpl_SObject& SO, - const string& theObjectName, - bool& _find) + const string& theObjectName, + bool& _find) { SALOMEDSImpl_SObject RefSO; if(!SO) return RefSO; @@ -829,16 +832,16 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObject(const SALOMEDSImpl_SObject& for (; it.More(); it.Next()){ if(!_find) { - if ((anAttr=(SALOMEDSImpl_AttributeName*)it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) - { + if ((anAttr=(SALOMEDSImpl_AttributeName*)it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) + { string Val(anAttr->Value()); - if (Val == theObjectName) - { - RefSO = GetSObject(it.Value()); - _find = true; - } - } - if (!_find) RefSO = _FindObject(GetSObject(it.Value()), theObjectName, _find); + if (Val == theObjectName) + { + RefSO = GetSObject(it.Value()); + _find = true; + } + } + if (!_find) RefSO = _FindObject(GetSObject(it.Value()), theObjectName, _find); } } return RefSO; @@ -851,8 +854,8 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObject(const SALOMEDSImpl_SObject& //============================================================================ SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObjectIOR(const SALOMEDSImpl_SObject& SO, - const string& theObjectIOR, - bool& _find) + const string& theObjectIOR, + bool& _find) { SALOMEDSImpl_SObject RefSO, aSO; if(!SO) return RefSO; @@ -865,17 +868,17 @@ SALOMEDSImpl_Study::_FindObjectIOR(const SALOMEDSImpl_SObject& SO, for (; it.More();it.Next()){ if(!_find) { - if ((anAttr=(SALOMEDSImpl_AttributeIOR*)it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) - { + if ((anAttr=(SALOMEDSImpl_AttributeIOR*)it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) + { string Val(anAttr->Value()); - if (Val == theObjectIOR) - { - RefSO = GetSObject(it.Value()); - _find = true; - } - } - aSO = GetSObject(it.Value()); - if (!_find) RefSO = _FindObjectIOR(aSO, theObjectIOR, _find); + if (Val == theObjectIOR) + { + RefSO = GetSObject(it.Value()); + _find = true; + } + } + aSO = GetSObject(it.Value()); + if (!_find) RefSO = _FindObjectIOR(aSO, theObjectIOR, _find); } } return RefSO; @@ -961,6 +964,15 @@ void SALOMEDSImpl_Study::UpdateIORLabelMap(const string& anIOR,const string& anE myIORLabels[anIOR] = aLabel; } +void SALOMEDSImpl_Study::DeleteIORLabelMapItem(const std::string& anIOR) +{ + if (myIORLabels.find(anIOR) != myIORLabels.end()) + { + //remove the ior entry and decref the genericobj (if it's one) + myIORLabels.erase(anIOR); + } +} + SALOMEDSImpl_Study* SALOMEDSImpl_Study::GetStudy(const DF_Label& theLabel) { SALOMEDSImpl_StudyHandle* Att; @@ -1041,7 +1053,7 @@ vector SALOMEDSImpl_Study::GetModificationsDate() char aDate[20]; sprintf(aDate, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d", (int)(aDays[anIndex]), (int)(aMonths[anIndex]), (int)(aYears[anIndex]), - (int)(aHours[anIndex]), (int)(aMinutes[anIndex])); + (int)(aHours[anIndex]), (int)(aMinutes[anIndex])); aDates.push_back(aDate); } return aDates; @@ -1140,7 +1152,7 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::GetSObject(const DF_Label& theLabel) */ //============================================================================ DF_Attribute* SALOMEDSImpl_Study::GetAttribute(const string& theEntry, - const string& theType) + const string& theType) { SALOMEDSImpl_SObject aSO = GetSObject(theEntry); DF_Attribute* anAttr; @@ -1154,9 +1166,9 @@ DF_Attribute* SALOMEDSImpl_Study::GetAttribute(const string& theEntry, */ //============================================================================ bool SALOMEDSImpl_Study::DumpStudy(const string& thePath, - const string& theBaseName, - bool isPublished, - SALOMEDSImpl_DriverFactory* theFactory) + const string& theBaseName, + bool isPublished, + SALOMEDSImpl_DriverFactory* theFactory) { _errorCode = ""; @@ -1208,26 +1220,17 @@ bool SALOMEDSImpl_Study::DumpStudy(const string& thePath, //Output to the main Study script required Python modules import, //set sys.path and add a creation of the study. + fp << "# -*- coding: iso-8859-1 -*-\n" << endl; + fp << GetDumpStudyComment() << endl << endl; fp << "import sys" << endl; - fp << "import os.path" << endl; fp << "import " << aBatchModeScript << endl << endl; fp << aBatchModeScript << ".salome_init()" << endl << endl; - fp << _GetNoteBookAccess() << endl; + fp << _GetNoteBookAccess(); - // IPAL21005 (Dump/load python script works only with absolute path) - // try to use '__file__' to get an absolute path to the generated scripts - // or use the path passed to this method (case of using execfile() command) - fp << "#Get absolute path to generated scripts:" << endl; - fp << "try:" << endl; - fp << " absPath = os.path.dirname(__file__)" << endl; - fp << "except NameError:" << endl; - fp << " absPath = \'" << thePath << "\'" << endl; - fp << " pass" << endl; - fp << "sys.path.insert( 0, absPath )" << endl << endl; - //fp << "sys.path.insert( 0, \'" << thePath << "\')" << endl << endl; + fp << "sys.path.insert( 0, r\'" << thePath << "\')" << endl << endl; //Dump NoteBook Variables fp << _GetStudyVariablesScript(); @@ -1257,22 +1260,22 @@ bool SALOMEDSImpl_Study::DumpStudy(const string& thePath, string IOREngine; try { if (!sco.ComponentIOR(IOREngine)) { - if (!aCompType.empty()) { - - aDriver = theFactory->GetDriverByType(aCompType); - - if (aDriver != NULL) { - SALOMEDSImpl_StudyBuilder* SB = NewBuilder(); - if(!SB->LoadWith(sco, aDriver)) { - _errorCode = SB->GetErrorCode(); - return false; - } - } - else continue; - } + if (!aCompType.empty()) { + + aDriver = theFactory->GetDriverByType(aCompType); + + if (aDriver != NULL) { + SALOMEDSImpl_StudyBuilder* SB = NewBuilder(); + if(!SB->LoadWith(sco, aDriver)) { + _errorCode = SB->GetErrorCode(); + return false; + } + } + else continue; + } } else { - aDriver = theFactory->GetDriverByIOR(IOREngine); + aDriver = theFactory->GetDriverByIOR(IOREngine); } } catch(...) { _errorCode = "Can not restore information to dump it"; @@ -1355,9 +1358,9 @@ string SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName) } void dumpSO(const SALOMEDSImpl_SObject& theSO, - fstream& fp, - const string& Tab, - SALOMEDSImpl_Study* theStudy); + fstream& fp, + const string& Tab, + SALOMEDSImpl_Study* theStudy); //============================================================================ /*! Function : dump @@ -1395,9 +1398,9 @@ void SALOMEDSImpl_Study::dump(const string& theFileName) void dumpSO(const SALOMEDSImpl_SObject& theSO, - fstream& fp, - const string& Tab, - SALOMEDSImpl_Study* theStudy) + fstream& fp, + const string& Tab, + SALOMEDSImpl_Study* theStudy) { string aTab(Tab), anID(theSO.GetID()); fp << aTab << anID << endl; @@ -1484,8 +1487,8 @@ SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetCommonParameters(const c */ //============================================================================ SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetModuleParameters(const char* theID, - const char* theModuleName, - int theSavePoint) + const char* theModuleName, + int theSavePoint) { if(theSavePoint <= 0) return NULL; SALOMEDSImpl_AttributeParameter* main_ap = GetCommonParameters(theID, theSavePoint); @@ -1589,6 +1592,50 @@ void SALOMEDSImpl_Study::SetVariable(const string& theVarName, Modify(); } +//============================================================================ +/*! Function : SetStringVariable + * Purpose : + */ +//============================================================================ +void SALOMEDSImpl_Study::SetStringVariable(const string& theVarName, + const string& theValue, + const SALOMEDSImpl_GenericVariable::VariableTypes theType) +{ + bool modified = false; + SALOMEDSImpl_GenericVariable* aGVar = GetVariable(theVarName); + + if( aGVar == NULL ) { + + SALOMEDSImpl_ScalarVariable* aSVar = new SALOMEDSImpl_ScalarVariable(theType, theVarName); + + aSVar->setStringValue(theValue); + myNoteBookVars.push_back(aSVar); + modified = true; + } + else { + if(SALOMEDSImpl_ScalarVariable* aSVar = dynamic_cast(aGVar)) { + modified = aSVar->setStringValue(theValue) || modified; + modified = aSVar->setType(theType) || modified; + } + } + if(modified) + Modify(); +} + +//============================================================================ +/*! Function : SetStringVariableAsDouble + * Purpose : + */ +//============================================================================ +void SALOMEDSImpl_Study::SetStringVariableAsDouble(const string& theVarName, + const double theValue, + const SALOMEDSImpl_GenericVariable::VariableTypes theType) +{ + SALOMEDSImpl_GenericVariable* aGVar = GetVariable(theVarName); + if(SALOMEDSImpl_ScalarVariable* aSVar = dynamic_cast(aGVar)) + aSVar->setValue(theValue); +} + //============================================================================ /*! Function : GetReal * Purpose : @@ -1605,6 +1652,22 @@ double SALOMEDSImpl_Study::GetVariableValue(const string& theVarName) return 0; } +//============================================================================ +/*! Function : GetString + * Purpose : + */ +//============================================================================ +string SALOMEDSImpl_Study::GetStringVariableValue(const string& theVarName) +{ + SALOMEDSImpl_GenericVariable* aGVar = GetVariable(theVarName); + + if(aGVar != NULL ) + if(SALOMEDSImpl_ScalarVariable* aSVar = dynamic_cast(aGVar)) + return aSVar->getStringValue(); + + return 0; +} + //============================================================================ /*! Function : IsTypeOf * Purpose : @@ -1748,8 +1811,8 @@ bool SALOMEDSImpl_Study::IsVariableUsed(const string& theVarName) */ //============================================================================ bool SALOMEDSImpl_Study::FindVariableAttribute(SALOMEDSImpl_StudyBuilder* theStudyBuilder, - SALOMEDSImpl_SObject theSObject, - const std::string& theName) + SALOMEDSImpl_SObject theSObject, + const std::string& theName) { SALOMEDSImpl_ChildIterator anIter = NewChildIterator( theSObject ); for( ; anIter.More(); anIter.Next() ) @@ -1766,13 +1829,13 @@ bool SALOMEDSImpl_Study::FindVariableAttribute(SALOMEDSImpl_StudyBuilder* theStu vector< vector > aSections = ParseVariables( aString ); for( int i = 0, n = aSections.size(); i < n; i++ ) { - vector aVector = aSections[i]; - for( int j = 0, m = aVector.size(); j < m; j++ ) - { - string aStr = aVector[j]; - if( aStr.compare( theName ) == 0 ) - return true; - } + vector aVector = aSections[i]; + for( int j = 0, m = aVector.size(); j < m; j++ ) + { + string aStr = aVector[j]; + if( aStr.compare( theName ) == 0 ) + return true; + } } } } @@ -1803,9 +1866,9 @@ bool SALOMEDSImpl_Study::FindVariableAttribute(const std::string& theName) */ //============================================================================ void SALOMEDSImpl_Study::ReplaceVariableAttribute(SALOMEDSImpl_StudyBuilder* theStudyBuilder, - SALOMEDSImpl_SObject theSObject, - const std::string& theSource, - const std::string& theDest) + SALOMEDSImpl_SObject theSObject, + const std::string& theSource, + const std::string& theDest) { SALOMEDSImpl_ChildIterator anIter = NewChildIterator( theSObject ); for( ; anIter.More(); anIter.Next() ) @@ -1822,26 +1885,26 @@ void SALOMEDSImpl_Study::ReplaceVariableAttribute(SALOMEDSImpl_StudyBuilder* the vector< vector > aSections = ParseVariables( aCurrentString ); for( int i = 0, n = aSections.size(); i < n; i++ ) { - vector aVector = aSections[i]; - for( int j = 0, m = aVector.size(); j < m; j++ ) - { - string aStr = aVector[j]; - if( aStr.compare( theSource ) == 0 ) - { - isChanged = true; - aStr = theDest; - } - - aNewString.append( aStr ); - if( j != m - 1 ) - aNewString.append( ":" ); - } - if( i != n - 1 ) - aNewString.append( "|" ); + vector aVector = aSections[i]; + for( int j = 0, m = aVector.size(); j < m; j++ ) + { + string aStr = aVector[j]; + if( aStr.compare( theSource ) == 0 ) + { + isChanged = true; + aStr = theDest; + } + + aNewString.append( aStr ); + if( j != m - 1 ) + aNewString.append( ":" ); + } + if( i != n - 1 ) + aNewString.append( "|" ); } if( isChanged ) - aStringAttr->SetValue( aNewString ); + aStringAttr->SetValue( aNewString ); } } } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx index 8e29584c3..f9833cb23 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx @@ -196,6 +196,7 @@ public: virtual void StudyId(int id); + virtual void DeleteIORLabelMapItem(const std::string& anIOR); virtual void UpdateIORLabelMap(const std::string& anIOR, const std::string& aLabel); virtual std::vector FindDependances(const SALOMEDSImpl_SObject& anObject); @@ -262,8 +263,18 @@ public: const double theValue, const SALOMEDSImpl_GenericVariable::VariableTypes); + void SetStringVariable(const std::string& theVarName, + const std::string& theValue, + const SALOMEDSImpl_GenericVariable::VariableTypes); + + void SetStringVariableAsDouble(const std::string& theVarName, + const double theValue, + const SALOMEDSImpl_GenericVariable::VariableTypes); + double GetVariableValue(const std::string& theVarName); + std::string GetStringVariableValue(const std::string& theVarName); + bool IsTypeOf(const std::string& theVarName, SALOMEDSImpl_GenericVariable::VariableTypes theType) const; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index 801307cec..4ec0d3b39 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -36,6 +36,7 @@ #include #include +#include using namespace std; @@ -204,6 +205,7 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObject(const SALOMEDSImpl_SObject& anObjec SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + _study->DeleteIORLabelMapItem(anAttr->Value()); } Lab.ForgetAllAttributes(); @@ -239,6 +241,7 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const SALOMEDSImpl_SObj } SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + _study->DeleteIORLabelMapItem(anAttr->Value()); } DF_ChildIterator it(Lab, true); @@ -251,6 +254,7 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const SALOMEDSImpl_SObj } SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map if ((anAttr=(SALOMEDSImpl_AttributeIOR*)aLabel.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + _study->DeleteIORLabelMapItem(anAttr->Value()); } } @@ -532,6 +536,7 @@ bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const SALOMEDSImpl_SObject& anOb if (aTypeOfAttribute == string("AttributeIOR")) { // Remove from IORLabel map SALOMEDSImpl_AttributeIOR* anAttr = NULL; if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + _study->DeleteIORLabelMapItem(anAttr->Value()); } } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index ee5457b34..cef6ad2b8 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -38,6 +38,16 @@ #include "HDFOI.hxx" #include #include +#include + +#ifdef WIN32 +#include +#endif + +//Warning undef of Ascii Winwows define +#ifdef WIN32 +# undef GetUserName +#endif using namespace std; @@ -70,6 +80,7 @@ SALOMEDSImpl_StudyManager::SALOMEDSImpl_StudyManager() //============================================================================ SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager() { + _appli->Close(_clipboard); // Destroy application delete _appli; } @@ -220,6 +231,8 @@ void SALOMEDSImpl_StudyManager::Close(SALOMEDSImpl_Study* aStudy) } aStudy->Close(); + DF_Document* doc=aStudy->GetDocument(); + _appli->Close(doc); } //============================================================================ @@ -442,7 +455,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, * Purpose : save the study in HDF file */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl, +bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aStudyUrl, SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile, @@ -474,6 +487,9 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl, return false; } + //Create a temporary url to which the study is saved + string aUrl = SALOMEDSImpl_Tool::GetTmpDir() + SALOMEDSImpl_Tool::GetNameFromPath(aStudyUrl); + int aLocked = aStudy->GetProperties()->IsLocked(); if (aLocked) aStudy->GetProperties()->SetLocked(false); @@ -512,7 +528,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl, } string anOldName = aStudy->Name(); - aStudy->URL(aUrl); + aStudy->URL(aStudyUrl); // To change for Save // Do not have to do a new file but just a Open??? Rewrite all informations after erasing evrything?? @@ -731,6 +747,55 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl, if (theASCII) { // save file in ASCII format HDFascii::ConvertFromHDFToASCII(aUrl.c_str(), true); } + + //Now it's necessary to copy files from the temporary directory to the user defined directory. + + // The easiest way to get a list of file in the temporary directory + + string aCmd, aTmpFileDir = SALOMEDSImpl_Tool::GetTmpDir(); + string aTmpFile = aTmpFileDir +"files"; + string aStudyTmpDir = SALOMEDSImpl_Tool::GetDirFromPath(aUrl); + +#ifdef WIN32 + aCmd = "dir /B \"" + aStudyTmpDir +"\" > " + aTmpFile; +#else + aCmd ="ls -1 \"" + aStudyTmpDir +"\" > " + aTmpFile; +#endif + system(aCmd.c_str()); + + // Iterate and move files in the temporary directory + FILE* fp = fopen(aTmpFile.c_str(), "r"); + if(!fp) return false; + char* buffer = new char[2047]; + while(!feof(fp)) { + if((fgets(buffer, 2046, fp)) == NULL) break; + size_t aLen = strlen(buffer); + if(buffer[aLen-1] == '\n') buffer[aLen-1] = char(0); +#ifdef WIN32 + aCmd = "move /Y \"" + aStudyTmpDir + string(buffer) + "\" \"" + SALOMEDSImpl_Tool::GetDirFromPath(aStudyUrl) +"\""; +#else + aCmd = "mv -f \"" + aStudyTmpDir + string(buffer) + "\" \"" + SALOMEDSImpl_Tool::GetDirFromPath(aStudyUrl)+"\""; +#endif + system(aCmd.c_str()); + } + + delete []buffer; + fclose(fp); + + // Perform cleanup +#ifdef WIN32 + DeleteFileA(aTmpFile.c_str()); +#else + unlink(aTmpFile.c_str()); +#endif + +#ifdef WIN32 + RemoveDirectoryA(aTmpFileDir.c_str()); + RemoveDirectoryA(aStudyTmpDir.c_str()); +#else + rmdir(aTmpFileDir.c_str()); + rmdir(aStudyTmpDir.c_str()); +#endif return true; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx index e19d888f6..a77876658 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx @@ -54,7 +54,7 @@ bool Exists(const string thePath) { #ifdef WIN32 if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { - if ( GetLastError () != ERROR_FILE_NOT_FOUND ) { + if ( GetLastError () == ERROR_FILE_NOT_FOUND ) { return false; } } @@ -184,31 +184,31 @@ string SALOMEDSImpl_Tool::GetNameFromPath(const string& thePath) { // purpose : Returns the dir by the path //============================================================================ string SALOMEDSImpl_Tool::GetDirFromPath(const string& thePath) { - if (thePath.empty()) return ""; +#ifdef WIN32 + string separator = "\\"; +#else + string separator = "/"; +#endif - 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+"/"; - } - + if (!thePath.empty()) { + int pos = thePath.rfind('/'); + if (pos < 0) pos = thePath.rfind('\\'); + if (pos < 0) pos = thePath.rfind('|'); + + if (pos > 0) + path = thePath.substr(0, pos+1); + else + path = string(".") + separator; + #ifdef WIN32 //Check if the only disk letter is given as path - if(path.size() == 2 && path[1] == ':') path +='\\'; + if (path.size() == 2 && path[1] == ':') path += separator; #endif - - for(int i = 0, len = path.size(); i= 0 ) + path.replace(pos, 1, separator); + } + return path; } diff --git a/src/SALOMEDSImpl/Test/Makefile.am b/src/SALOMEDSImpl/Test/Makefile.am index 3ac0c73a5..348d2c7c9 100644 --- a/src/SALOMEDSImpl/Test/Makefile.am +++ b/src/SALOMEDSImpl/Test/Makefile.am @@ -58,7 +58,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/LifeCycleCORBA \ -I$(srcdir)/$(RPATH)/DF \ -I$(srcdir)/$(RPATH)/SALOMEDSImpl \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@ diff --git a/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py b/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py index 97abd2542..516f7a830 100644 --- a/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py +++ b/src/SALOMEDSImpl/Test/TestSALOMEDSImpl.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py b/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py index 5128c21f1..f801f06f1 100644 --- a/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py +++ b/src/SALOMELocalTrace/Test/TestSALOMELocalTrace.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/SALOMETraceCollector/Makefile.am b/src/SALOMETraceCollector/Makefile.am index f9839cf5a..5ca841a30 100644 --- a/src/SALOMETraceCollector/Makefile.am +++ b/src/SALOMETraceCollector/Makefile.am @@ -42,7 +42,6 @@ libwith_loggerTraceCollector_la_SOURCES =\ libwith_loggerTraceCollector_la_CPPFLAGS =\ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/SALOMETraceCollector/Test/Makefile.am b/src/SALOMETraceCollector/Test/Makefile.am index fbe2bd53d..5c8d12654 100644 --- a/src/SALOMETraceCollector/Test/Makefile.am +++ b/src/SALOMETraceCollector/Test/Makefile.am @@ -56,8 +56,7 @@ COMMON_CPPFLAGS=\ @CPPUNIT_INCLUDES@ \ -I$(srcdir)/$(RPATH)/Basics -I$(srcdir)/$(RPATH)/Basics/Test \ -I$(srcdir)/$(RPATH)/SALOMELocalTrace -I$(srcdir)/$(RPATH)/SALOMELocalTrace/Test\ - -I$(srcdir)/$(RPATH)/SALOMETraceCollector \ - -I$(top_builddir)/salome_adm/unix + -I$(srcdir)/$(RPATH)/SALOMETraceCollector # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ diff --git a/src/SALOMETraceCollector/Test/TestSALOMETraceCollector.py b/src/SALOMETraceCollector/Test/TestSALOMETraceCollector.py index fd57974f1..f98afb694 100644 --- a/src/SALOMETraceCollector/Test/TestSALOMETraceCollector.py +++ b/src/SALOMETraceCollector/Test/TestSALOMETraceCollector.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/TOOLSDS/Makefile.am b/src/TOOLSDS/Makefile.am index 8ec3e98d2..306cf7eaf 100644 --- a/src/TOOLSDS/Makefile.am +++ b/src/TOOLSDS/Makefile.am @@ -40,7 +40,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Basics \ -I$(srcdir)/../Utils \ -I$(srcdir)/../SALOMELocalTrace \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \ @HDF5_INCLUDES@ \ diff --git a/src/TestContainer/Makefile.am b/src/TestContainer/Makefile.am index f69747c1c..f520293f0 100644 --- a/src/TestContainer/Makefile.am +++ b/src/TestContainer/Makefile.am @@ -55,7 +55,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Notification \ -I$(srcdir)/../ResourcesManager \ -I$(srcdir)/../Container \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/TestContainer/SALOME_TestComponentPy.py b/src/TestContainer/SALOME_TestComponentPy.py index 249ad3c50..d33445944 100755 --- a/src/TestContainer/SALOME_TestComponentPy.py +++ b/src/TestContainer/SALOME_TestComponentPy.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/TestContainer/TestLogger.py b/src/TestContainer/TestLogger.py index ab1a33fb1..f7fcedd6c 100644 --- a/src/TestContainer/TestLogger.py +++ b/src/TestContainer/TestLogger.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/TestMPIContainer/Makefile.am b/src/TestMPIContainer/Makefile.am index e1aeb27d9..ee4339847 100644 --- a/src/TestMPIContainer/Makefile.am +++ b/src/TestMPIContainer/Makefile.am @@ -58,7 +58,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../ResourcesManager \ -I$(srcdir)/../Container \ -I$(srcdir)/../MPIContainer \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/UnitTests/Makefile.am b/src/UnitTests/Makefile.am index 5a9efeced..085cf5eff 100644 --- a/src/UnitTests/Makefile.am +++ b/src/UnitTests/Makefile.am @@ -46,8 +46,7 @@ UnitTests_SOURCES = UnitTests.cxx UnitTests_CPPFLAGS =\ @CPPUNIT_INCLUDES@ \ -I$(srcdir)/../Basics -I$(srcdir)/../Basics/Test \ - -I$(srcdir)/../SALOMELocalTrace -I$(srcdir)/../SALOMELocalTrace/Test \ - -I$(top_builddir)/salome_adm/unix + -I$(srcdir)/../SALOMELocalTrace -I$(srcdir)/../SALOMELocalTrace/Test if CORBA_GEN UnitTests_CPPFLAGS +=\ diff --git a/src/UnitTests/UnitTests.py b/src/UnitTests/UnitTests.py index 19e947c60..4bffad6e6 100644 --- a/src/UnitTests/UnitTests.py +++ b/src/UnitTests/UnitTests.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/Utils/Makefile.am b/src/Utils/Makefile.am index 7b73b1066..599733463 100644 --- a/src/Utils/Makefile.am +++ b/src/Utils/Makefile.am @@ -64,7 +64,6 @@ libOpUtil_la_LDFLAGS = -no-undefined -version-info=0:0:0 libOpUtil_la_CPPFLAGS = \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/Utils/SALOME_utilities.py b/src/Utils/SALOME_utilities.py index 961fa3177..af4b64dc8 100644 --- a/src/Utils/SALOME_utilities.py +++ b/src/Utils/SALOME_utilities.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/Utils/Test/Makefile.am b/src/Utils/Test/Makefile.am index fe50c0501..fba0402a8 100644 --- a/src/Utils/Test/Makefile.am +++ b/src/Utils/Test/Makefile.am @@ -54,8 +54,7 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/Basics -I$(srcdir)/$(RPATH)/Basics/Test \ -I$(srcdir)/$(RPATH)/SALOMELocalTrace -I$(srcdir)/$(RPATH)/SALOMELocalTrace/Test \ -I$(srcdir)/$(RPATH)/SALOMETraceCollector -I$(srcdir)/$(RPATH)/SALOMETraceCollector/Test \ - -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \ - -I$(top_builddir)/salome_adm/unix + -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ diff --git a/src/Utils/Test/TestUtils.py b/src/Utils/Test/TestUtils.py index a5c33986e..4641d427a 100644 --- a/src/Utils/Test/TestUtils.py +++ b/src/Utils/Test/TestUtils.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/Utils/Utils_Identity.py b/src/Utils/Utils_Identity.py index 26d5a21ee..91a19e249 100644 --- a/src/Utils/Utils_Identity.py +++ b/src/Utils/Utils_Identity.py @@ -1,4 +1,5 @@ #! /usr/bin/env python +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, diff --git a/src/Utils/Utils_SALOME_Exception.hxx b/src/Utils/Utils_SALOME_Exception.hxx index f1caac758..75554924b 100644 --- a/src/Utils/Utils_SALOME_Exception.hxx +++ b/src/Utils/Utils_SALOME_Exception.hxx @@ -74,7 +74,7 @@ protected : public : SALOME_Exception( const char *text, const char *fileName=0, const unsigned int lineNumber=0 ); SALOME_Exception( const SALOME_Exception &ex ); - ~SALOME_Exception() throw (); + virtual ~SALOME_Exception() throw (); friend std::ostream & operator<<( std::ostream &os , const SALOME_Exception &ex ); virtual const char *what( void ) const throw () ; } ; diff --git a/src/win32pm/setup.py b/src/win32pm/setup.py index 017e19704..a9f4514ea 100755 --- a/src/win32pm/setup.py +++ b/src/win32pm/setup.py @@ -1,3 +1,4 @@ +# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -- 2.39.2