From: caremoli Date: Tue, 6 Jan 2009 15:19:44 +0000 (+0000) Subject: CCAR: merge last developments from KERNEL 4.1.4 (DSC ports, ResourceManager, ...) X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=752793d5a8f793fe3e02998c35821782c3ebf0d7;p=modules%2Fkernel.git CCAR: merge last developments from KERNEL 4.1.4 (DSC ports, ResourceManager, ...) --- diff --git a/Makefile.am b/Makefile.am index 489fc48c1..6d46bb852 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,7 +32,11 @@ endif ACLOCAL_AMFLAGS = -I salome_adm/unix/config_files -SUBDIRS = salome_adm $(IDLDIR) src doc bin resources +if WITHONLYLAUNCHER + SUBDIRS = src resources +else + SUBDIRS = salome_adm $(IDLDIR) src doc bin resources +endif DIST_SUBDIRS= salome_adm idl src doc bin resources diff --git a/README.FIRST.txt b/README.FIRST.txt index 6f939e9f6..021f43c35 100644 --- a/README.FIRST.txt +++ b/README.FIRST.txt @@ -1,23 +1,23 @@ - Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +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 +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 free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com ================================================================= General information, for developpers and users diff --git a/bin/appli_clean.sh b/bin/appli_clean.sh index b30b030da..9ea7ae8a7 100644 --- a/bin/appli_clean.sh +++ b/bin/appli_clean.sh @@ -22,4 +22,4 @@ # #clean appli # -rm -rf bin lib share doc env.d envd getAppliPath.py searchFreePort.sh runAppli runConsole runSession runRemote.sh runTests SalomeApp.xml *.pyc *~ .bashrc +rm -rf bin lib share doc idl env.d envd getAppliPath.py searchFreePort.sh runAppli runConsole runSession runRemote.sh runTests SalomeApp.xml *.pyc *~ .bashrc diff --git a/bin/appliskel/CatalogResources.xml b/bin/appliskel/CatalogResources.xml index a9cb9a1a9..9e09ed5fc 100644 --- a/bin/appliskel/CatalogResources.xml +++ b/bin/appliskel/CatalogResources.xml @@ -1,27 +1,4 @@ - diff --git a/bin/appliskel/README b/bin/appliskel/README index 21ee467ac..829437f15 100644 --- a/bin/appliskel/README +++ b/bin/appliskel/README @@ -1,3 +1,24 @@ +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 + ======================================= Set of scripts for a SALOME application ======================================= diff --git a/bin/appliskel/SalomeApp.xml b/bin/appliskel/SalomeApp.xml index e6b50aef3..7caea4e03 100644 --- a/bin/appliskel/SalomeApp.xml +++ b/bin/appliskel/SalomeApp.xml @@ -1,26 +1,3 @@ -
diff --git a/bin/config_appli.xml b/bin/config_appli.xml index 9d79f2d1b..2695ad7e5 100644 --- a/bin/config_appli.xml +++ b/bin/config_appli.xml @@ -1,26 +1,3 @@ - diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 7ec574f09..87630757e 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -622,10 +622,9 @@ def CreateOptionParser (theAdditionalOptions=[]): help_str = "Launch session with gdb" o_gdb = optparse.Option("--gdb-session", action="store_true", - dest="gdb_session", - default=False, - help=help_str) - + dest="gdb_session", default=False, + help=help_str) + # All options opt_list = [o_t,o_g, # GUI/Terminal o_d,o_o, # Desktop diff --git a/bin/runSalome.py b/bin/runSalome.py index e9b4cc804..3508a6cc8 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -314,8 +314,8 @@ class SessionServer(Server): self.CMD+=['-test'] + self.args['test'] elif self.args.has_key('play'): self.CMD+=['-play'] + self.args['play'] - - if self.args["gdb_session"]: + + if self.args["gdb_session"]: f = open(".gdbinit4salome", "w") f.write("set args ") args = " ".join(self.CMD[1:]) @@ -326,7 +326,7 @@ class SessionServer(Server): f.close() self.CMD = ["xterm", "-e", "gdb", "--command=.gdbinit4salome", self.CMD[0]] pass - + # --- class LauncherServer(Server): diff --git a/bin/setenv.py b/bin/setenv.py index 3c053c274..4eeff394b 100755 --- a/bin/setenv.py +++ b/bin/setenv.py @@ -228,7 +228,7 @@ def set_env(args, modules_list, modules_root_dir, silent=False): pass pass pass - + if sys.platform == 'win32': os.environ["SALOMEPATH"]=";".join(modules_root_dir_list) else: diff --git a/bin/virtual_salome.py b/bin/virtual_salome.py index 4e9d54596..b7f0e6708 100644 --- a/bin/virtual_salome.py +++ b/bin/virtual_salome.py @@ -100,11 +100,31 @@ def link_module(options): return home_dir = os.path.expanduser(options.prefix) + #try to find python version of salome application and put it in versio + pys=[os.path.split(s)[1] for s in glob.glob(os.path.join(home_dir,get_lib_dir(),"python*.*"))] + if not pys : + versio=None + else: + versio=pys[0] + + pys=[os.path.split(s)[1] for s in glob.glob(os.path.join(module_dir,get_lib_dir(),"python*.*"))] + #check if the module has a python version compatible with application version + if not pys : + pyversio=versio or py_version + elif versio is None: + pyversio=pys[0] + elif versio in pys: + pyversio=versio + else: + #incompatible python versions + print "incompatible python versions : application has version %s and module %s has not" % (versio,module_dir) + return module_bin_dir=os.path.join(module_dir,'bin','salome') + module_idl_dir=os.path.join(module_dir,'idl','salome') module_lib_dir=os.path.join(module_dir,get_lib_dir(),'salome') - module_lib_py_dir=os.path.join(module_dir,get_lib_dir(),py_version,'site-packages','salome') - module_lib_py_shared_dir=os.path.join(module_dir,get_lib_dir(),py_version, + module_lib_py_dir=os.path.join(module_dir,get_lib_dir(),pyversio,'site-packages','salome') + module_lib_py_shared_dir=os.path.join(module_dir,get_lib_dir(),pyversio, 'site-packages','salome','shared_modules') module_share_dir=os.path.join(module_dir,'share','salome','resources') module_doc_gui_dir=os.path.join(module_dir,'doc','salome','gui') @@ -115,9 +135,10 @@ def link_module(options): module_sharedoc_tui_dir=os.path.join(module_dir,'share','doc','salome','tui') bin_dir=os.path.join(home_dir,'bin','salome') + idl_dir=os.path.join(home_dir,'idl','salome') lib_dir=os.path.join(home_dir,'lib','salome') - lib_py_dir=os.path.join(home_dir,'lib',py_version,'site-packages','salome') - lib_py_shared_dir=os.path.join(home_dir,'lib',py_version, + lib_py_dir=os.path.join(home_dir,'lib',pyversio,'site-packages','salome') + lib_py_shared_dir=os.path.join(home_dir,'lib',pyversio, 'site-packages','salome','shared_modules') share_dir=os.path.join(home_dir,'share','salome','resources') doc_gui_dir=os.path.join(home_dir,'doc','salome','gui') @@ -131,6 +152,7 @@ def link_module(options): if options.clear: rmtree(bin_dir) + rmtree(idl_dir) rmtree(lib_dir) rmtree(lib_py_dir) rmtree(share_dir) @@ -149,6 +171,14 @@ def link_module(options): print module_bin_dir, " doesn't exist" pass + #directory idl/salome : create it and link content + if os.path.exists(module_idl_dir): + mkdir(idl_dir) + for fn in os.listdir(module_idl_dir): + symlink(os.path.join(module_idl_dir, fn), os.path.join(idl_dir, fn)) + else: + print module_idl_dir, " doesn't exist" + #directory lib/salome : create it and link content if os.path.exists(module_lib_dir): mkdir(lib_dir) @@ -160,7 +190,7 @@ def link_module(options): print module_lib_dir, " doesn't exist" pass - #directory lib/py_version/site-packages/salome : create it and link content + #directory lib/pyversio/site-packages/salome : create it and link content if not os.path.exists(module_lib_py_dir): print "Python directory %s does not exist" % module_lib_py_dir else: diff --git a/bin/waitNS.sh b/bin/waitNS.sh index bb89f620b..2727217cf 100755 --- a/bin/waitNS.sh +++ b/bin/waitNS.sh @@ -27,4 +27,4 @@ while [ $status -ne 0 ]; do sleep 1 echo -n "#" done -./runSession waitNS.py \ No newline at end of file +./runSession waitNS.py diff --git a/configure.ac b/configure.ac index 9dd62e36e..740153160 100644 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,12 @@ 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 +AC_ARG_WITH(onlylauncher, + --with-onlylauncher, + WITHONLYLAUNCHER="yes",WITHONLYLAUNCHER="no") +AM_CONDITIONAL(WITHONLYLAUNCHER, test x$WITHONLYLAUNCHER = xyes) + # ---------------------------------------------------------------------------- echo @@ -192,6 +198,15 @@ dnl _CS_gbo We should use here a variable given from the CHECK_PYTHON AM_PATH_PYTHON(2.3) CHECK_SWIG +echo +echo --------------------------------------------- +echo Testing libxml2 +echo --------------------------------------------- +echo + +CHECK_LIBXML + +if test x$WITHONLYLAUNCHER = xno; then echo echo --------------------------------------------- echo testing HDF5 @@ -256,18 +271,14 @@ echo CHECK_BOOST -echo -echo --------------------------------------------- -echo Testing libxml2 -echo --------------------------------------------- -echo - -CHECK_LIBXML - fi # --- end test corba # ---------------------------------------------------------------------------- +fi +# --- end test ONLYLAUNCHER +# ---------------------------------------------------------------------------- + echo echo ============================================================ echo testing parallel products @@ -428,10 +439,14 @@ function check_fatal_error { # -------------------------------------- -if test x$corba_gen = xtrue; then - basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok" +if test x$WITHONLYLAUNCHER = xno; then + if test x$corba_gen = xtrue; then + basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok libxml_ok" + else + basic_mandatory_products="cc_ok threads_ok hdf5_ok libxml_ok" + fi else - basic_mandatory_products="cc_ok threads_ok hdf5_ok" + basic_mandatory_products="cc_ok threads_ok libxml_ok" fi echo --- General mandatory products - Light configuration: @@ -439,19 +454,21 @@ summary $basic_mandatory_products check_fatal_error $basic_mandatory_products echo -corba_mandatory_products="omniORB_ok omniORBpy_ok boost_ok libxml_ok" -if test x$corba_gen = xtrue; then - echo --- CORBA mandatory products - default configuration: - summary $corba_mandatory_products - 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 +if test x$WITHONLYLAUNCHER = xno; then + corba_mandatory_products="omniORB_ok omniORBpy_ok boost_ok" + if test x$corba_gen = xtrue; then + echo --- CORBA mandatory products - default configuration: + summary $corba_mandatory_products + 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 @@ -474,9 +491,11 @@ echo --- Html documentation products: only required for doc production summary $htmldoc_products echo +if test x$WITHONLYLAUNCHER = xno; then echo echo "Default ORB : $DEFAULT_ORB" echo +fi dnl generals files which could be included in every makefile diff --git a/doc/salome/tui/KERNEL/doxydev.in b/doc/salome/tui/KERNEL/doxydev.in index 6defe5238..168d1c5ee 100644 --- a/doc/salome/tui/KERNEL/doxydev.in +++ b/doc/salome/tui/KERNEL/doxydev.in @@ -1,24 +1,3 @@ -# 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 -# # Doxyfile 1.4.6 #--------------------------------------------------------------------------- diff --git a/doc/salome/tui/KERNEL/doxyfile.in b/doc/salome/tui/KERNEL/doxyfile.in index 21780fbfe..a4f54eba4 100755 --- a/doc/salome/tui/KERNEL/doxyfile.in +++ b/doc/salome/tui/KERNEL/doxyfile.in @@ -1,24 +1,3 @@ -# 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 -# # Doxyfile 1.3-rc1 #--------------------------------------------------------------------------- diff --git a/doc/salome/tui/KERNEL/doxyuser.in b/doc/salome/tui/KERNEL/doxyuser.in index 7187e95d2..d3387500b 100644 --- a/doc/salome/tui/KERNEL/doxyuser.in +++ b/doc/salome/tui/KERNEL/doxyuser.in @@ -1,24 +1,3 @@ -# 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 -# # Doxyfile 1.4.6 #--------------------------------------------------------------------------- diff --git a/idl/DSC_Engines.xml b/idl/DSC_Engines.xml index 534d0f33e..bf519ac38 100644 --- a/idl/DSC_Engines.xml +++ b/idl/DSC_Engines.xml @@ -1,30 +1,29 @@ - - diff --git a/resources/CatalogModulePersonnel.xml_skel b/resources/CatalogModulePersonnel.xml_skel index a16b5de47..b5a892ba0 100644 --- a/resources/CatalogModulePersonnel.xml_skel +++ b/resources/CatalogModulePersonnel.xml_skel @@ -1,27 +1,4 @@ - diff --git a/resources/CatalogResources.xml.in b/resources/CatalogResources.xml.in index 2118a497f..11e6b6e26 100644 --- a/resources/CatalogResources.xml.in +++ b/resources/CatalogResources.xml.in @@ -1,27 +1,4 @@ - diff --git a/resources/KERNELCatalog.xml.in b/resources/KERNELCatalog.xml.in index f1a53c0d9..1452381ff 100644 --- a/resources/KERNELCatalog.xml.in +++ b/resources/KERNELCatalog.xml.in @@ -1,27 +1,4 @@ - diff --git a/resources/Makefile.am b/resources/Makefile.am index 2a92d94c5..336a0caeb 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -32,12 +32,15 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # =============================================================== # -dist_salomeres_DATA = \ - CatalogDataType.xml \ +if WITHONLYLAUNCHER + dist_salomeres_DATA=\ + CatalogResources.xml \ + CatalogModulePersonnel.xml_skel +else + dist_salomeres_DATA=\ + CatalogResources.xml \ CatalogModulePersonnel.xml_skel \ channel.cfg \ - SALOMEDS_Resources - -nodist_salomeres_DATA = \ - CatalogResources.xml \ - KERNELCatalog.xml + KERNELCatalog.xml \ + SALOMEDS_Resources +endif diff --git a/resources/channel.cfg b/resources/channel.cfg index 3cacd6c5c..afe59a75c 100755 --- a/resources/channel.cfg +++ b/resources/channel.cfg @@ -1,24 +1,3 @@ -# 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 -# # ================================================================= # PARAM SETTINGS # 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 de84d16e9..24be4c5d9 100644 --- a/salome_adm/unix/config_files/ac_cxx_have_sstream.m4 +++ b/salome_adm/unix/config_files/ac_cxx_have_sstream.m4 @@ -23,7 +23,9 @@ dnl @synopsis AC_CXX_HAVE_SSTREAM dnl If the C++ library has a working stringstream, define HAVE_SSTREAM. dnl @author Ben Stanley 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, diff --git a/salome_adm/unix/config_files/ac_cxx_use_std_iostream.m4 b/salome_adm/unix/config_files/ac_cxx_use_std_iostream.m4 index 665482d83..163568fbe 100644 --- a/salome_adm/unix/config_files/ac_cxx_use_std_iostream.m4 +++ b/salome_adm/unix/config_files/ac_cxx_use_std_iostream.m4 @@ -20,8 +20,11 @@ dnl dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com dnl dnl @synopsis AC_CXX_USE_STD_IOSTREAM +dnl dnl If the C++ library use std iostream dnl +dnl @author Bernard Secher (CEA) - 05/12/2003 +dnl AC_DEFUN([AC_CXX_USE_STD_IOSTREAM], [ diff --git a/src/Basics/Basics_Utils.cxx b/src/Basics/Basics_Utils.cxx index 1499881b8..10a12b74a 100644 --- a/src/Basics/Basics_Utils.cxx +++ b/src/Basics/Basics_Utils.cxx @@ -24,8 +24,7 @@ // Module : SALOME // #include "Basics_Utils.hxx" - -#include "string.h" +#include #ifndef WIN32 #include diff --git a/src/Batch/Batch_BatchManager_Local.cxx b/src/Batch/Batch_BatchManager_Local.cxx index 7cf2991aa..373547060 100644 --- a/src/Batch/Batch_BatchManager_Local.cxx +++ b/src/Batch/Batch_BatchManager_Local.cxx @@ -33,6 +33,8 @@ #include #include #include +#include + #include #ifdef WIN32 # include @@ -45,7 +47,6 @@ #include #include #include -#include #include "Batch_IOMutex.hxx" #include "Batch_BatchManager_Local.hxx" diff --git a/src/Batch/Batch_BatchManager_eClient.cxx b/src/Batch/Batch_BatchManager_eClient.cxx index e5a4377f0..ebdd30895 100644 --- a/src/Batch/Batch_BatchManager_eClient.cxx +++ b/src/Batch/Batch_BatchManager_eClient.cxx @@ -36,8 +36,8 @@ #include #include #include -#include #include +#include using namespace std; @@ -98,24 +98,27 @@ namespace Batch { // Second step : copy fileToExecute into // batch tmp files directory - 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()); + 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 @@ -202,6 +205,10 @@ namespace Batch { 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"; diff --git a/src/Batch/Batch_BatchManager_eClient.hxx b/src/Batch/Batch_BatchManager_eClient.hxx index 6afcdd623..172ca4abd 100644 --- a/src/Batch/Batch_BatchManager_eClient.hxx +++ b/src/Batch/Batch_BatchManager_eClient.hxx @@ -55,7 +55,7 @@ namespace Batch { { public: // Constructeur et destructeur - BatchManager_eClient(const Batch::FactBatchManager * parent, const char* host="localhost", const char* protocol="ssh", const char* mpiImpl="indif"); + 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); diff --git a/src/Batch/Batch_BatchManager_eLSF.cxx b/src/Batch/Batch_BatchManager_eLSF.cxx index 40a5caeb7..009d4c6a4 100644 --- a/src/Batch/Batch_BatchManager_eLSF.cxx +++ b/src/Batch/Batch_BatchManager_eLSF.cxx @@ -33,7 +33,9 @@ #include #include #include +#include #include + #include "Batch_BatchManager_eLSF.hxx" #ifdef WIN32 # include @@ -64,9 +66,14 @@ namespace Batch { 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); + 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); @@ -242,37 +249,65 @@ namespace Batch { #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]; - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - std::string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - std::string fileNameToExecute = "~/" + dirForTmpFiles + "/" + string(basename((char*)(fileToExecute.c_str()))); - - int idx = dirForTmpFiles.find("Batch/"); - std::string filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); + 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 ; - tempOutputFile << "#BSUB -o runSalome.output.log." << filelogtemp << endl ; - tempOutputFile << "#BSUB -e runSalome.error.log." << filelogtemp << 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 ; - tempOutputFile << _mpiImpl->boot("",nbproc); - tempOutputFile << _mpiImpl->run("",nbproc,fileNameToExecute); - tempOutputFile << _mpiImpl->halt(); + 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 diff --git a/src/Batch/Batch_BatchManager_eLSF.hxx b/src/Batch/Batch_BatchManager_eLSF.hxx index 5a0543feb..599d90c68 100644 --- a/src/Batch/Batch_BatchManager_eLSF.hxx +++ b/src/Batch/Batch_BatchManager_eLSF.hxx @@ -55,7 +55,7 @@ namespace Batch { { public: // Constructeur et destructeur - BatchManager_eLSF(const FactBatchManager * parent, const char * host="localhost", const char * protocol="ssh", const char * mpiImpl="indif") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host + 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 diff --git a/src/Batch/Batch_BatchManager_ePBS.cxx b/src/Batch/Batch_BatchManager_ePBS.cxx index 63b3318ac..177319c32 100644 --- a/src/Batch/Batch_BatchManager_ePBS.cxx +++ b/src/Batch/Batch_BatchManager_ePBS.cxx @@ -33,7 +33,9 @@ #include #include #include +#include #include + #include "Batch_BatchManager_ePBS.hxx" #ifdef WIN32 # include @@ -241,6 +243,7 @@ namespace Batch { #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]; @@ -248,30 +251,56 @@ namespace Batch { const std::string dirForTmpFiles = params[TMPDIR]; const string fileToExecute = params[EXECUTABLE]; const string home = params[HOMEDIR]; - string::size_type p1 = fileToExecute.find_last_of("/"); - string::size_type p2 = fileToExecute.find_last_of("."); - std::string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - std::string fileNameToExecute = "~/" + dirForTmpFiles + "/" + string(basename((char*)(fileToExecute.c_str()))); - - int idx = dirForTmpFiles.find("Batch/"); - std::string filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); + 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 ; - tempOutputFile << "#PBS -o " << home << "/" << dirForTmpFiles << "/runSalome.output.log." << filelogtemp << endl ; - tempOutputFile << "#PBS -e " << home << "/" << dirForTmpFiles << "/runSalome.error.log." << filelogtemp << 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 ; - tempOutputFile << _mpiImpl->boot("${PBS_NODEFILE}",nbproc); - tempOutputFile << _mpiImpl->run("${PBS_NODEFILE}",nbproc,fileNameToExecute); - tempOutputFile << _mpiImpl->halt(); + 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 diff --git a/src/Batch/Batch_BatchManager_ePBS.hxx b/src/Batch/Batch_BatchManager_ePBS.hxx index 15fc444b3..9effa53cf 100644 --- a/src/Batch/Batch_BatchManager_ePBS.hxx +++ b/src/Batch/Batch_BatchManager_ePBS.hxx @@ -55,7 +55,7 @@ namespace Batch { { public: // Constructeur et destructeur - BatchManager_ePBS(const FactBatchManager * parent, const char * host="localhost", const char * protocol="ssh", const char * mpiImpl="indif") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host + 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 diff --git a/src/Batch/Batch_BatchManager_eSGE.cxx b/src/Batch/Batch_BatchManager_eSGE.cxx new file mode 100644 index 000000000..56130df01 --- /dev/null +++ b/src/Batch/Batch_BatchManager_eSGE.cxx @@ -0,0 +1,344 @@ +// 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 new file mode 100644 index 000000000..c2a0fecca --- /dev/null +++ b/src/Batch/Batch_BatchManager_eSGE.hxx @@ -0,0 +1,95 @@ +// 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_FactBatchManager.cxx b/src/Batch/Batch_FactBatchManager.cxx index 6dfd81908..0adc4e7d0 100644 --- a/src/Batch/Batch_FactBatchManager.cxx +++ b/src/Batch/Batch_FactBatchManager.cxx @@ -30,9 +30,9 @@ #include #include +#include #include "Batch_BatchManagerCatalog.hxx" #include "Batch_FactBatchManager.hxx" -#include "utilities.h" using namespace std; namespace Batch { @@ -41,16 +41,9 @@ namespace Batch { FactBatchManager::FactBatchManager(const string & _t) : type(_t) { BatchManagerCatalog::addFactBatchManager(type.c_str(), this); - /* - #ifndef WIN32 - Win32 limitation: it's impossible to create new thread of LocalTraceCollector - during initialization of static objects of DLL - Be careful with static objects of types inherited from FactBatchManager class - */ ostringstream msg; msg << "FactBatchManager of type '" << type << "' inserted into catalog"; - MESSAGE(msg.str().c_str()); - //#endif + cerr << msg.str().c_str() << endl; } // Destructeur diff --git a/src/Batch/Batch_FactBatchManager_PBS.cxx b/src/Batch/Batch_FactBatchManager_PBS.cxx index 2995ee266..43c79e213 100644 --- a/src/Batch/Batch_FactBatchManager_PBS.cxx +++ b/src/Batch/Batch_FactBatchManager_PBS.cxx @@ -28,10 +28,8 @@ * */ -#include #include "Batch_BatchManager_PBS.hxx" #include "Batch_FactBatchManager_PBS.hxx" -#include "utilities.h" using namespace std; namespace Batch { @@ -53,7 +51,6 @@ namespace Batch { // Functor BatchManager * FactBatchManager_PBS::operator() (const char * hostname) const { - MESSAGE("Building new BatchManager_PBS on host '" << hostname << "'"); return new BatchManager_PBS(this, hostname); } diff --git a/src/Batch/Batch_FactBatchManager_eSGE.cxx b/src/Batch/Batch_FactBatchManager_eSGE.cxx new file mode 100644 index 000000000..c7a6c9f90 --- /dev/null +++ b/src/Batch/Batch_FactBatchManager_eSGE.cxx @@ -0,0 +1,66 @@ +// 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 new file mode 100644 index 000000000..44f7f6ce0 --- /dev/null +++ b/src/Batch/Batch_FactBatchManager_eSGE.hxx @@ -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 +// +/* + * 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_JobInfo.hxx b/src/Batch/Batch_JobInfo.hxx index 58fb2aeca..f4b54f115 100644 --- a/src/Batch/Batch_JobInfo.hxx +++ b/src/Batch/Batch_JobInfo.hxx @@ -39,8 +39,6 @@ #include "Batch_Parametre.hxx" #include "Batch_Environnement.hxx" -using namespace std; - namespace Batch { class BATCH_EXPORT JobInfo diff --git a/src/Batch/Batch_JobInfo_eSGE.cxx b/src/Batch/Batch_JobInfo_eSGE.cxx new file mode 100644 index 000000000..f4414379d --- /dev/null +++ b/src/Batch/Batch_JobInfo_eSGE.cxx @@ -0,0 +1,113 @@ +// 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_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_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 @@ -100,12 +92,12 @@ MpiImpl_MPICH1::~MpiImpl_MPICH1() string MpiImpl_MPICH1::size() { - throw MpiImplException("mpich1 doesn't work with this batch system to submit salome session"); + return "${MPIRUN_NPROCS}"; } string MpiImpl_MPICH1::rank() { - throw MpiImplException("mpich1 doesn't work with this batch system to submit salome session"); + return "${MPIRUN_RANK}"; } string MpiImpl_MPICH1::boot(const string machinefile, const unsigned int nbnodes) @@ -149,7 +141,10 @@ string MpiImpl_MPICH2::rank() string MpiImpl_MPICH2::boot(const string machinefile, const unsigned int nbnodes) { ostringstream oss; - oss << "mpdboot -n " << nbnodes << " -f " << machinefile << endl; + oss << "mpdboot" << " -n " << nbnodes; + if (machinefile!="") + oss << " -f " << machinefile; + oss << endl; return oss.str(); } @@ -243,3 +238,40 @@ 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 index 3c1414eb6..4639e6e85 100644 --- a/src/Batch/MpiImpl.hxx +++ b/src/Batch/MpiImpl.hxx @@ -19,14 +19,6 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/* - * BatchManager.hxx : - * - * Auteur : Bernard SECHER - CEA/DEN - * Date : Juillet 2007 - * Projet : SALOME - * - */ #ifndef _BL_MPIIMPL_H_ #define _BL_MPIIMPL_H_ @@ -156,4 +148,23 @@ 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/Makefile.am b/src/Batch_SWIG/Makefile.am index 72ad7740d..645567f97 100644 --- a/src/Batch_SWIG/Makefile.am +++ b/src/Batch_SWIG/Makefile.am @@ -49,13 +49,14 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # The library will be installed in the common place. # +BUILT_SOURCES = swig_wrap.cpp + SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../Batch SWIG_SOURCES = libBatch_Swig.i libBatch_Swig_exception.i libBatch_Swig_typemap.i -nodist_salomepython_PYTHON = libBatch_Swig.py -salomepyexec_LTLIBRARIES = _libBatch_Swig.la -nodist__libBatch_Swig_la_SOURCES = swig_wrap.cpp -_libBatch_Swig_la_SOURCES = $(SWIG_SOURCES) +salomepython_PYTHON = libBatch_Swig.py +salomepyexec_LTLIBRARIES = _libBatch_Swig.la +_libBatch_Swig_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES) _libBatch_Swig_la_CPPFLAGS = @PYTHON_INCLUDES@ -I$(srcdir) -I$(srcdir)/../Batch _libBatch_Swig_la_LDFLAGS = -module _libBatch_Swig_la_LIBADD = ../Batch/libSalomeBatch.la @PYTHON_LIBS@ @@ -68,7 +69,7 @@ endif swig_wrap.cpp : $(SWIG_SOURCES) $(SWIG) $(SWIG_FLAGS) -o $@ $< -CLEANFILES = swig_wrap.cpp libBatch_Swig.py +CLEANFILES = swig_wrap.cpp # diff --git a/src/Batch_SWIG/libBatch_Swig.i b/src/Batch_SWIG/libBatch_Swig.i index 04447f649..fc610e787 100644 --- a/src/Batch_SWIG/libBatch_Swig.i +++ b/src/Batch_SWIG/libBatch_Swig.i @@ -43,6 +43,9 @@ /* 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 diff --git a/src/Batch_SWIG/libBatch_Swig_typemap.i b/src/Batch_SWIG/libBatch_Swig_typemap.i index 242a18c6a..6b2a01123 100644 --- a/src/Batch_SWIG/libBatch_Swig_typemap.i +++ b/src/Batch_SWIG/libBatch_Swig_typemap.i @@ -36,6 +36,11 @@ #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 @@ -55,6 +60,10 @@ } } +%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 @@ -138,6 +147,10 @@ } } +%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 diff --git a/src/Communication/Receiver.cxx b/src/Communication/Receiver.cxx index 48ddf6556..d632318d4 100644 --- a/src/Communication/Receiver.cxx +++ b/src/Communication/Receiver.cxx @@ -1,21 +1,23 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// 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 "Receiver.hxx" #include diff --git a/src/Communication_SWIG/Makefile.am b/src/Communication_SWIG/Makefile.am index 99d80de40..8c66bb02e 100644 --- a/src/Communication_SWIG/Makefile.am +++ b/src/Communication_SWIG/Makefile.am @@ -49,14 +49,15 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # The library will be installed in the common place. # +BUILT_SOURCES = swig_wrap.cpp + SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../Communication SWIG_SOURCES = libSALOME_Comm.i -nodist_salomepython_PYTHON = libSALOME_Comm.py +salomepython_PYTHON = libSALOME_Comm.py salomepyexec_LTLIBRARIES = _libSALOME_Comm.la -nodist__libSALOME_Comm_la_SOURCES = swig_wrap.cpp -_libSALOME_Comm_la_SOURCES = $(SWIG_SOURCES) +_libSALOME_Comm_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES) _libSALOME_Comm_la_CPPFLAGS =\ @PYTHON_INCLUDES@ \ -I$(srcdir) -I$(srcdir)/../Communication \ @@ -83,7 +84,7 @@ endif swig_wrap.cpp : $(SWIG_SOURCES) $(SWIG) $(SWIG_FLAGS) -o $@ $< -CLEANFILES = swig_wrap.cpp libSALOME_Comm.py +CLEANFILES = swig_wrap.cpp # diff --git a/src/Communication_SWIG/libSALOME_Comm.i b/src/Communication_SWIG/libSALOME_Comm.i index 617618dd9..d13560473 100644 --- a/src/Communication_SWIG/libSALOME_Comm.i +++ b/src/Communication_SWIG/libSALOME_Comm.i @@ -21,6 +21,8 @@ // %module libSALOME_Comm +%feature("autodoc", "1"); + %{ #include "ReceiverFactory.hxx" #include "MatrixClient.hxx" diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 590020d44..93caf53ce 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -124,6 +124,7 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, * \param instanceName unique instance name for this object (see Container_i) * \param interfaceName component class name * \param notif use of notification + * \param regist (true or false) use of registry (default true) */ //============================================================================= @@ -132,7 +133,8 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, Engines::Container_ptr container, const char *instanceName, const char *interfaceName, - bool notif) : + bool notif, + bool regist) : _instanceName(instanceName), _interfaceName(interfaceName), _myConnexionToRegistry(0), @@ -159,7 +161,8 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, _contId = 0; } const CORBA::String_var ior = _orb->object_to_string(_container); - _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str()); + if(regist) + _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str()); _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif); } @@ -289,11 +292,10 @@ void Engines_Component_i::destroy() MESSAGE("Engines_Component_i::destroy()"); //SCRUTE(pd_refCount); - delete _notifSupplier; - _notifSupplier = 0; - - delete _myConnexionToRegistry; + if(_myConnexionToRegistry)delete _myConnexionToRegistry; _myConnexionToRegistry = 0 ; + if(_notifSupplier)delete _notifSupplier; + _notifSupplier = 0; if(_id) delete(_id) ; //SCRUTE(pd_refCount); diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index 8e41722ef..954c8fcf7 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -325,7 +325,20 @@ void Engines_Container_i::Shutdown() */ std::map::iterator itm; for (itm = _listInstances_map.begin(); itm != _listInstances_map.end(); itm++) - itm->second->destroy(); + { + try + { + itm->second->destroy(); + } + catch(const CORBA::Exception& e) + { + // ignore this entry and continue + } + catch(...) + { + // ignore this entry and continue + } + } _NS->Destroy_FullDirectory(_containerName.c_str()); _NS->Destroy_Name(_containerName.c_str()); diff --git a/src/Container/Container_init_python.cxx b/src/Container/Container_init_python.cxx index 2e48961ff..e5e1369db 100644 --- a/src/Container/Container_init_python.cxx +++ b/src/Container/Container_init_python.cxx @@ -51,6 +51,8 @@ void KERNEL_PYTHON::init_python(int argc, char **argv) MESSAGE("================================================================="); MESSAGE("Python Initialization..."); MESSAGE("================================================================="); + // set stdout to line buffering (aka C++ std::cout) + setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ); Py_SetProgramName(argv[0]); Py_Initialize(); // Initialize the interpreter PySys_SetArgv(argc, argv); diff --git a/src/Container/Makefile.am b/src/Container/Makefile.am index 0ae10c7e2..5f8172cff 100644 --- a/src/Container/Makefile.am +++ b/src/Container/Makefile.am @@ -141,7 +141,6 @@ SALOME_Container_CPPFLAGS =\ SALOME_Container_LDADD = \ libSalomeContainer.la \ ../Basics/libSALOMEBasics.la \ - ../HDFPersist/libSalomeHDFPersist.la \ $(HDF5_LIBS) \ $(MPI_LIBS) \ $(CORBA_LIBS) \ @@ -159,7 +158,6 @@ TestSalome_file_CPPFLAGS =\ TestSalome_file_LDADD =\ libSalomeContainer.la \ ../Basics/libSALOMEBasics.la \ - ../HDFPersist/libSalomeHDFPersist.la \ $(HDF5_LIBS) \ $(MPI_LIBS) \ $(CORBA_LIBS) \ diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index 715b843db..5c9080a30 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -66,8 +66,9 @@ public: Engines::Container_ptr container, const char *instanceName, const char *interfaceName, - bool notif = false); - // Consructeur pour composant parallele: ne pas faire appel au registry + bool notif = false, + bool regist=true); + // Constructor for parallel component : don't call registry Engines_Component_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, diff --git a/src/Container/SALOME_Container.py b/src/Container/SALOME_Container.py index 8a912a9f6..9b6d7f893 100644 --- a/src/Container/SALOME_Container.py +++ b/src/Container/SALOME_Container.py @@ -69,14 +69,15 @@ class SALOME_Container_i: MESSAGE( "SALOME_Container_i::import_component" ) ret=0 try: - print "try import ",componentName + if verbose(): print "try import ",componentName __import__(componentName) - print "import ",componentName," successful" + if verbose(): print "import ",componentName," successful" ret=1 except: - import traceback - traceback.print_exc() - print "import ",componentName," not possible" + if verbose(): + import traceback + traceback.print_exc() + print "import ",componentName," not possible" return ret #------------------------------------------------------------------------- diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 947cff6bd..3c7fdf021 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -37,7 +37,7 @@ #include "PaCO++.h" #endif -#define TIME_OUT_TO_LAUNCH_CONT 21 +#define TIME_OUT_TO_LAUNCH_CONT 61 using namespace std; @@ -127,13 +127,20 @@ void SALOME_ContainerManager::ShutdownContainers() if( isOK ){ vector vec = _NS->list_directory_recurs(); list lstCont; - for(vector::iterator iter = vec.begin();iter!=vec.end();iter++){ + for(vector::iterator iter = vec.begin();iter!=vec.end();iter++) + { SCRUTE((*iter)); CORBA::Object_var obj=_NS->Resolve((*iter).c_str()); - Engines::Container_var cont=Engines::Container::_narrow(obj); - if(!CORBA::is_nil(cont)){ - lstCont.push_back((*iter)); - } + try + { + Engines::Container_var cont=Engines::Container::_narrow(obj); + if(!CORBA::is_nil(cont)) + lstCont.push_back((*iter)); + } + catch(const CORBA::Exception& e) + { + // ignore this entry and continue + } } MESSAGE("Container list: "); for(list::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){ @@ -283,19 +290,17 @@ StartContainer(const Engines::MachineParameters& params, CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str()); if ( !CORBA::is_nil(obj) ) { - // shutdown the registered container if it exists - Engines::Container_var cont=Engines::Container::_narrow(obj); - if(!CORBA::is_nil(cont)) - { - try - { - cont->Shutdown(); - } - catch(CORBA::Exception&) - { - INFOS("CORBA::Exception ignored."); - } - } + try + { + // shutdown the registered container if it exists + Engines::Container_var cont=Engines::Container::_narrow(obj); + if(!CORBA::is_nil(cont)) + cont->Shutdown(); + } + catch(CORBA::Exception&) + { + INFOS("CORBA::Exception ignored."); + } } //redirect stdout and stderr in a file @@ -305,16 +310,17 @@ StartContainer(const Engines::MachineParameters& params, // launch container with a system call int status=system(command.c_str()); - RmTmpFile(); // command file can be removed here if (status == -1){ MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " << "(system command status -1)"); + RmTmpFile(); // command file can be removed here return Engines::Container::_nil(); } else if (status == 217){ MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " << "(system command status 217)"); + RmTmpFile(); // command file can be removed here return Engines::Container::_nil(); } else{ @@ -346,6 +352,7 @@ StartContainer(const Engines::MachineParameters& params, ret->logfilename(logFilename.c_str()); } + RmTmpFile(); // command file can be removed here return ret; } } diff --git a/src/Container/SALOME_ContainerPy.py b/src/Container/SALOME_ContainerPy.py index 1dc01b639..955a1d8d9 100755 --- a/src/Container/SALOME_ContainerPy.py +++ b/src/Container/SALOME_ContainerPy.py @@ -174,9 +174,10 @@ class SALOME_ContainerPy_i (Engines__POA.Container): if verbose(): print "import ",componentName," successful" ret=1 except: - import traceback - traceback.print_exc() - print "import ",componentName," not possible" + if verbose(): + import traceback + traceback.print_exc() + print "import ",componentName," not possible" return ret #------------------------------------------------------------------------- @@ -317,6 +318,8 @@ class SALOME_ContainerPy_i (Engines__POA.Container): #============================================================================= if __name__ == "__main__": + # change the stdout buffering to line buffering (same as C++ cout buffering) + sys.stdout=os.fdopen(1,"w",1) #initialise the ORB and find the root POA if verbose():print "Starting ",sys.argv[1] orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) diff --git a/src/Container/TestSalome_file.cxx b/src/Container/TestSalome_file.cxx index 6f18790bb..5230d7fc5 100644 --- a/src/Container/TestSalome_file.cxx +++ b/src/Container/TestSalome_file.cxx @@ -23,8 +23,8 @@ #include #include #include -#include #include "HDFascii.hxx" +#include using namespace std; diff --git a/src/DF/Makefile.am b/src/DF/Makefile.am index 93e771dc0..78d557daf 100644 --- a/src/DF/Makefile.am +++ b/src/DF/Makefile.am @@ -48,16 +48,10 @@ salomeinclude_HEADERS= \ # This local variable defines the list of CPPFLAGS common to all target in this package. COMMON_CPPFLAGS=\ - -I$(srcdir)/../Basics \ - -I$(srcdir)/../SALOMELocalTrace \ - -I$(srcdir)/../HDFPersist \ - @HDF5_INCLUDES@ \ @BOOST_CPPFLAGS@ # This local variable defines the list of dependant libraries common to all target in this package. -COMMON_LIBS =\ - ../HDFPersist/libSalomeHDFPersist.la \ - @HDF5_LIBS@ +COMMON_LIBS = # # =============================================================== @@ -93,6 +87,5 @@ libDF_la_LIBADD = $(COMMON_LIBS) bin_PROGRAMS = testDF testDF_SOURCES = testDF.cxx testDF_CPPFLAGS = $(COMMON_CPPFLAGS) -testDF_LDADD = ./libDF.la \ - $(HDF5_LIBS) +testDF_LDADD = ./libDF.la diff --git a/src/DSC/DSC_Basic/DSC_i.cxx b/src/DSC/DSC_Basic/DSC_i.cxx index 736fc1e51..75f3f05c7 100644 --- a/src/DSC/DSC_Basic/DSC_i.cxx +++ b/src/DSC/DSC_Basic/DSC_i.cxx @@ -48,7 +48,9 @@ Engines_DSC_i(CORBA::ORB_ptr orb, Engines::Container_ptr container, const char *instanceName, const char *interfaceName, - bool notif) : Engines_Component_i(orb, poa, container, instanceName, interfaceName) + bool notif, + bool regist) : + Engines_Component_i(orb, poa, container, instanceName, interfaceName,notif,regist) { #ifdef _DEBUG_ std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl; diff --git a/src/DSC/DSC_Basic/DSC_i.hxx b/src/DSC/DSC_Basic/DSC_i.hxx index e0411cfa3..ccfd98786 100644 --- a/src/DSC/DSC_Basic/DSC_i.hxx +++ b/src/DSC/DSC_Basic/DSC_i.hxx @@ -61,7 +61,8 @@ public: Engines::Container_ptr container, const char *instanceName, const char *interfaceName, - bool notif = false); + bool notif = false, + bool regist = true ); virtual ~Engines_DSC_i(); diff --git a/src/DSC/DSC_Python/Makefile.am b/src/DSC/DSC_Python/Makefile.am index 314931e2a..5a87b6b30 100644 --- a/src/DSC/DSC_Python/Makefile.am +++ b/src/DSC/DSC_Python/Makefile.am @@ -56,13 +56,11 @@ COMMON_LIBS = @CORBA_LIBS@ # AM_CFLAGS = -fexceptions -salomepython_PYTHON = dsccalcium.py -nodist_salomepython_PYTHON = calcium.py +salomepython_PYTHON = calcium.py dsccalcium.py salomepyexec_LTLIBRARIES = _calcium.la -MY_SWIG_FLAGS = $(SWIG_FLAGS) -noexcept -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Calcium -SWIG_SRC = calcium.i -nodist__calcium_la_SOURCES = calcium_wrap.cpp -_calcium_la_SOURCES = $(SWIG_SRC) +MY_SWIG_FLAGS= $(SWIG_FLAGS) -noexcept -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Calcium +SWIG_SRC=calcium.i +_calcium_la_SOURCES = calcium_wrap.cpp _calcium_la_LDFLAGS = -module _calcium_la_LIBADD = ../DSC_User/Datastream/Calcium/libCalciumC.la \ ../DSC_User/Datastream/libSalomeDatastream.la \ @@ -73,8 +71,10 @@ _calcium_la_LIBADD = ../DSC_User/Datastream/Calcium/libCalciumC.la \ _calcium_la_CXXFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS) -calcium_wrap.cpp calcium.py:$(SWIG_SRC) +EXTRA_DIST=calcium_wrap.cpp calcium.i + +calcium_wrap.cpp calcium.py:calcium.i $(SWIG) $(MY_SWIG_FLAGS) -o calcium_wrap.cpp $< -CLEANFILES = calcium_wrap.cpp calcium.py +CLEANFILES = calcium_wrap.cpp diff --git a/src/DSC/DSC_User/Basic/Makefile.am b/src/DSC/DSC_User/Basic/Makefile.am index 607985787..9b77a6a6e 100644 --- a/src/DSC/DSC_User/Basic/Makefile.am +++ b/src/DSC/DSC_User/Basic/Makefile.am @@ -45,6 +45,11 @@ salomeinclude_HEADERS = basic_port_factory.hxx \ COMMON_CPPFLAGS= -I$(top_builddir)/idl \ -I$(top_srcdir)/src/DSC/DSC_Basic \ -I$(top_srcdir)/src/DSC/DSC_User \ + -I$(top_srcdir)/src/Container \ + -I$(top_srcdir)/src/Notification \ + -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@ @@ -66,4 +71,5 @@ libSalomeDSCSupervBasic_la_SOURCES = basic_port_factory.cxx \ libSalomeDSCSupervBasic_la_CXXFLAGS = $(COMMON_CPPFLAGS) libSalomeDSCSupervBasic_la_LDFLAGS = -no-undefined -version-info=0:0:0 +libSalomeDSCSupervBasic_la_LIBADD = ../libSalomeDSCSuperv.la diff --git a/src/DSC/DSC_User/Basic/basic_port_factory.cxx b/src/DSC/DSC_User/Basic/basic_port_factory.cxx index 8eeae33ac..9c147cf05 100644 --- a/src/DSC/DSC_User/Basic/basic_port_factory.cxx +++ b/src/DSC/DSC_User/Basic/basic_port_factory.cxx @@ -24,10 +24,13 @@ // Module : KERNEL // #include "basic_port_factory.hxx" +#include "Superv_Component_i.hxx" using namespace std; -basic_port_factory::basic_port_factory() {} +basic_port_factory::basic_port_factory() { + Superv_Component_i::register_factory("BASIC",this); +} basic_port_factory::~basic_port_factory() {} @@ -47,3 +50,5 @@ basic_port_factory::create_data_proxy(string type) { rtn_port = new data_short_port_uses(); return rtn_port; } + +static basic_port_factory myfactory; diff --git a/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx b/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx index 46d8734c2..eec2ea22f 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx @@ -34,7 +34,7 @@ PySupervCompo::PySupervCompo( CORBA::ORB_ptr orb, const char *instanceName, const char *interfaceName, bool notif) : - Superv_Component_i(orb, poa,contain, instanceName, interfaceName) + Superv_Component_i(orb, poa,contain, instanceName, interfaceName,false,false) { } diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx index 5ce9dd3d5..b607de119 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx @@ -30,6 +30,7 @@ #define _PORT_TRAITS_HXX_ #include "Superv_Component_i.hxx" +#include "calcium_port_factory.hxx" // PROVIDES PORT TRAITS template struct UnknownProvidesPortType {}; diff --git a/src/DSC/DSC_User/Datastream/Calcium/Makefile.am b/src/DSC/DSC_User/Datastream/Calcium/Makefile.am index 3ec317709..da56a1f68 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Makefile.am +++ b/src/DSC/DSC_User/Datastream/Calcium/Makefile.am @@ -68,7 +68,7 @@ EXTRA_DIST=fortoc.h # # This local variable defines the list of CPPFLAGS common to all target in this package. -COMMON_CPPFLAGS= -I$(srcdir) -I$(top_srcdir)/src/DSC/DSC_User \ +COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \ -I$(top_srcdir)/src/DSC/DSC_User/Datastream \ -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Palm \ -I$(top_srcdir)/src/DSC/DSC_User/Basic \ 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 fbcdb7eea..a99ec947f 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx @@ -27,10 +27,13 @@ // Id : $Id$ // #include "calcium_port_factory.hxx" +#include "Superv_Component_i.hxx" using namespace std; -calcium_port_factory::calcium_port_factory() {} +calcium_port_factory::calcium_port_factory() { + Superv_Component_i::register_factory("CALCIUM",this); +} calcium_port_factory::~calcium_port_factory() {} @@ -73,3 +76,5 @@ calcium_port_factory::create_data_proxy(string type) { return rtn_port; } + +static calcium_port_factory myfactory; diff --git a/src/DSC/DSC_User/Datastream/Makefile.am b/src/DSC/DSC_User/Datastream/Makefile.am index 9a7f5bfa1..9c7742f39 100644 --- a/src/DSC/DSC_User/Datastream/Makefile.am +++ b/src/DSC/DSC_User/Datastream/Makefile.am @@ -56,7 +56,8 @@ COMMON_CPPFLAGS= @BOOST_CPPFLAGS@ -I$(top_srcdir)/src/DSC/DSC_User # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS = $(top_builddir)/src/DSC/DSC_User/Datastream/Palm/libSalomePalm.la \ - $(top_builddir)/src/DSC/DSC_User/Datastream/Calcium/libSalomeCalcium.la + $(top_builddir)/src/DSC/DSC_User/Datastream/Calcium/libSalomeCalcium.la \ + ../libSalomeDSCSuperv.la # # =============================================================== diff --git a/src/DSC/DSC_User/Datastream/Palm/Makefile.am b/src/DSC/DSC_User/Datastream/Palm/Makefile.am index 74f149f5b..8d663d52d 100644 --- a/src/DSC/DSC_User/Datastream/Palm/Makefile.am +++ b/src/DSC/DSC_User/Datastream/Palm/Makefile.am @@ -46,6 +46,10 @@ salomeinclude_HEADERS = palm_port_factory.hxx \ COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \ -I$(top_srcdir)/src/DSC/DSC_User/Datastream \ -I$(top_srcdir)/src/DSC/DSC_Basic \ + -I$(top_srcdir)/src/Container \ + -I$(top_srcdir)/src/Notification \ + -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 \ diff --git a/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.cxx b/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.cxx index b0896d43a..18656bfff 100644 --- a/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.cxx +++ b/src/DSC/DSC_User/Datastream/Palm/palm_port_factory.cxx @@ -27,10 +27,12 @@ // Id : $Id$ // #include "palm_port_factory.hxx" +#include "Superv_Component_i.hxx" using namespace std; palm_port_factory::palm_port_factory() { + Superv_Component_i::register_factory("PALM",this); } palm_port_factory::~palm_port_factory() {} @@ -52,3 +54,5 @@ palm_port_factory::create_data_proxy(string type) { uses_port * rtn_port = NULL; return rtn_port; } + +static palm_port_factory myfactory; diff --git a/src/DSC/DSC_User/Makefile.am b/src/DSC/DSC_User/Makefile.am index 2b42e30ba..9c6f39364 100644 --- a/src/DSC/DSC_User/Makefile.am +++ b/src/DSC/DSC_User/Makefile.am @@ -45,10 +45,7 @@ salomeinclude_HEADERS = base_port.hxx \ # # This local variable defines the list of CPPFLAGS common to all target in this package. -COMMON_CPPFLAGS= -I$(srcdir) -I$(srcdir)/Basic \ - -I$(srcdir)/Datastream \ - -I$(srcdir)/Datastream/Palm \ - -I$(srcdir)/Datastream/Calcium \ +COMMON_CPPFLAGS= \ -I$(top_srcdir)/src/Container \ -I$(top_srcdir)/src/Notification \ -I$(top_srcdir)/src/DSC/DSC_Basic \ @@ -78,6 +75,7 @@ libSalomeDSCSuperv_la_SOURCES = base_port.cxx \ libSalomeDSCSuperv_la_CXXFLAGS = $(COMMON_CPPFLAGS) libSalomeDSCSuperv_la_LDFLAGS = -no-undefined -version-info=0:0:0 +libSalomeDSCSuperv_la_LIBADD = ../DSC_Basic/libSalomeDSCContainer.la # # =============================================================== @@ -93,4 +91,4 @@ test_DSC_Exception_CXXFLAGS = $(COMMON_CPPFLAGS) test_DSC_Exception_LDADD = $(top_builddir)/src/Utils/libOpUtil.la \ $(CORBA_LIBS) -SUBDIRS = Basic Datastream +SUBDIRS = . Basic Datastream diff --git a/src/DSC/DSC_User/Superv_Component_i.cxx b/src/DSC/DSC_User/Superv_Component_i.cxx index 53e053b42..49eb37515 100644 --- a/src/DSC/DSC_User/Superv_Component_i.cxx +++ b/src/DSC/DSC_User/Superv_Component_i.cxx @@ -25,8 +25,6 @@ // #include "Superv_Component_i.hxx" -using namespace std; - DSC_EXCEPTION_CXX(Superv_Component_i,BadFabType); DSC_EXCEPTION_CXX(Superv_Component_i,BadType); DSC_EXCEPTION_CXX(Superv_Component_i,BadCast); @@ -37,6 +35,8 @@ DSC_EXCEPTION_CXX(Superv_Component_i,PortNotConnected); DSC_EXCEPTION_CXX(Superv_Component_i,NilPort); DSC_EXCEPTION_CXX(Superv_Component_i,BadProperty); +std::map Superv_Component_i::_factory_map; + Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId, @@ -48,23 +48,19 @@ Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb, #ifdef _DEBUG_ std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl; #endif - register_factory("BASIC", new basic_port_factory()); - register_factory("PALM", new palm_port_factory()); - register_factory("CALCIUM", new calcium_port_factory()); } Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, Engines::Container_ptr container, const char *instanceName, const char *interfaceName, - bool notif) : Engines_DSC_i(orb, poa, container, instanceName, interfaceName) + bool notif, + bool regist) : + Engines_DSC_i(orb, poa, container, instanceName, interfaceName,notif,regist) { #ifdef _DEBUG_ std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl; #endif - register_factory("BASIC", new basic_port_factory()); - register_factory("PALM", new palm_port_factory()); - register_factory("CALCIUM", new calcium_port_factory()); } diff --git a/src/DSC/DSC_User/Superv_Component_i.hxx b/src/DSC/DSC_User/Superv_Component_i.hxx index ecc529586..ec6d8abcb 100644 --- a/src/DSC/DSC_User/Superv_Component_i.hxx +++ b/src/DSC/DSC_User/Superv_Component_i.hxx @@ -32,12 +32,9 @@ #include "provides_port.hxx" #include "port_factory.hxx" -// default ports factories in the Kernel -#include "basic_port_factory.hxx" -#include "palm_port_factory.hxx" -#include "calcium_port_factory.hxx" - #include "DSC_Exception.hxx" +#include + /*! \class Superv_Component_i * \brief This class implements DSC_User component. @@ -67,7 +64,8 @@ public: Engines::Container_ptr container, const char *instanceName, const char *interfaceName, - bool notif = false); + bool notif = false, + bool regist = true ); virtual ~Superv_Component_i(); // Exceptions declarations. @@ -246,7 +244,7 @@ public: * and Superv_Component_i::create_uses_data_port) * \param factory_ptr factory pointer (destroyed by the component) */ - virtual void register_factory(const std::string & factory_name, + static void register_factory(const std::string & factory_name, port_factory * factory_ptr); /*! @@ -260,7 +258,7 @@ public: private: // Factory map typedef std::map factory_map_t; - factory_map_t _factory_map; + static factory_map_t _factory_map; /*-------------------------------------------------*/ // A Superv_Component port. diff --git a/src/HDFPersist/HDFcontainerObject.cc b/src/HDFPersist/HDFcontainerObject.cc index 2ac7eb484..faf2c6191 100644 --- a/src/HDFPersist/HDFcontainerObject.cc +++ b/src/HDFPersist/HDFcontainerObject.cc @@ -29,7 +29,6 @@ extern "C" } #include "HDFcontainerObject.hxx" #include "HDFexception.hxx" -//#include "utilities.h" using namespace std; HDFcontainerObject::HDFcontainerObject(const char *name) @@ -47,10 +46,8 @@ HDFcontainerObject::~HDFcontainerObject() { sonToDelete = _firstson; _firstson = _firstson->GetNextBrother(); -// MESSAGE("son to delete: " << sonToDelete); delete sonToDelete; } -// MESSAGE("destruction: " << this); } int HDFcontainerObject::nInternalObjects() @@ -65,11 +62,6 @@ void HDFcontainerObject::InternalObjectIndentify(int rank, char *object_name) void HDFcontainerObject::AddSon(HDFinternalObject *son) { -// MESSAGE("add son ") MESSAGE("add to this" << this); -// MESSAGE("add son " << son); -// MESSAGE("firstson " << _firstson); -// MESSAGE("lastson " << _lastson); - if (_nsons == 0) { _firstson = son; @@ -82,8 +74,6 @@ void HDFcontainerObject::AddSon(HDFinternalObject *son) _lastson = son; } _nsons ++; -// MESSAGE("firstson " << _firstson); -// MESSAGE("lastson " << _lastson); } HDFinternalObject *HDFcontainerObject::GetFirstSon() diff --git a/src/HDFPersist/HDFobject.cc b/src/HDFPersist/HDFobject.cc index a5075a0cf..828cdd1d7 100644 --- a/src/HDFPersist/HDFobject.cc +++ b/src/HDFPersist/HDFobject.cc @@ -29,24 +29,20 @@ extern "C" #include "hdfi.h" } -#include -//#include "utilities.h" +#include +#include using namespace std; HDFobject::HDFobject(const char *name) { - // MESSAGE("-------- constructor " << name << " " << this); HDFerrorModeLock(); - _name = new char[strlen(name)+1]; - strcpy(_name,name); + _name = strdup(name); _id = -1; } HDFobject::~HDFobject() { - //delete [] _name; - delete _name; - // MESSAGE("-------- destructor ------" << this); + free(_name); } hdf_idt HDFobject::GetId() diff --git a/src/HDFPersist/Makefile.am b/src/HDFPersist/Makefile.am index 617d009fa..0213e73e7 100644 --- a/src/HDFPersist/Makefile.am +++ b/src/HDFPersist/Makefile.am @@ -89,9 +89,7 @@ libSalomeHDFPersist_la_SOURCES =\ libSalomeHDFPersist_la_LDFLAGS = -no-undefined -version-info=0:0:0 -libSalomeHDFPersist_la_CPPFLAGS = @HDF5_INCLUDES@ -D@MACHINE@ \ - -I$(srcdir)/../SALOMELocalTrace \ - -I$(srcdir)/../Basics +libSalomeHDFPersist_la_CPPFLAGS = @HDF5_INCLUDES@ -D@MACHINE@ libSalomeHDFPersist_la_LIBADD = @HDF5_LIBS@ @@ -105,16 +103,3 @@ EXTRA_DIST = \ test7.cxx \ test8.cxx \ test9.cxx - -#bin_PROGRAMS=HDFtest1 HDFtest2 HDFtest3 -#HDFtest1_SOURCES = test1.c -#HDFtest2_SOURCES = test2.c -#HDFtest3_SOURCES = test3.cxx - -#AM_CFLAGS= @CAS_CPPFLAGS@ @HDF5_INCLUDES@ -D@MACHINE@ \ -# -I$(srcdir)/../SALOMELocalTrace \ -# -I$(srcdir)/../Basics -#AM_CXXFLAGS= @CAS_CPPFLAGS@ @HDF5_INCLUDES@ -D@MACHINE@ \ -# -I$(srcdir)/../SALOMELocalTrace \ -# -I$(srcdir)/../Basics -#AM_LDFLAGS= @HDF5_LIBS@ diff --git a/src/Launcher/BatchTest.cxx b/src/Launcher/BatchTest.cxx index 790a673aa..a320ecedc 100644 --- a/src/Launcher/BatchTest.cxx +++ b/src/Launcher/BatchTest.cxx @@ -285,9 +285,15 @@ BatchTest::test_jobsubmit_simple() std::string batch_type = _batch_descr.batch.in(); // Basic test - if (batch_type == "slurm") + if (batch_type == "lsf") { - INFOS("test_jobsubmit_simple not yet implemented for slurm... return OK"); + INFOS("test_jobsubmit_simple not yet implemented for lsf... return OK"); + result = "OK"; + return result; + } + if (batch_type == "sge") + { + INFOS("test_jobsubmit_simple not yet implemented for sge... return OK"); result = "OK"; return result; } @@ -452,16 +458,25 @@ BatchTest::test_jobsubmit_mpi() mpiImpl = new MpiImpl_MPICH2(); else if(mpi_type == "openmpi") mpiImpl = new MpiImpl_OPENMPI(); + else if(mpi_type == "slurm") + mpiImpl = new MpiImpl_SLURM(); else { result += "Error MPI impl not supported : " + mpi_type; return result; } - // SLURM not yet implemented... - if (batch_type == "slurm") + // LSF et SGE not yet implemented... + if (batch_type == "lsf") + { + INFOS("test_jobsubmit_simple not yet implemented for lsf... return OK"); + result = "OK"; + return result; + } + + if (batch_type == "sge") { - INFOS("test_jobsubmit_simple not yet implemented for slurm... return OK"); + INFOS("test_jobsubmit_simple not yet implemented for sge... return OK"); result = "OK"; return result; } diff --git a/src/Launcher/Launcher.cxx b/src/Launcher/Launcher.cxx index c4d680423..6dd80e189 100644 --- a/src/Launcher/Launcher.cxx +++ b/src/Launcher/Launcher.cxx @@ -25,12 +25,16 @@ #include "Batch_FactBatchManager_eLSF.hxx" #include "Batch_FactBatchManager_ePBS.hxx" #include "Batch_BatchManager_eClient.hxx" - +#include "Batch_FactBatchManager_eSGE.hxx" +#include "SALOME_Launcher_Handler.hxx" +#include "Launcher.hxx" #include #include #include #include +using namespace std; + //============================================================================= /*! * Constructor @@ -66,6 +70,114 @@ Launcher_cpp::~Launcher_cpp() delete it2->second; } +//============================================================================= +/*! CORBA Method: + * Submit a batch job on a cluster and returns the JobId + * \param xmlExecuteFile : to define the execution on the batch cluster + * \param clusterName : name of the batch cluster + */ +//============================================================================= +long Launcher_cpp::submitJob( const std::string xmlExecuteFile, + const std::string clusterName) throw(LauncherException) +{ +#if defined(_DEBUG_) || defined(_DEBUG) + cout << "BEGIN OF Launcher_cpp::submitJob" << endl; +#endif + long jobId; + vector aMachineList; + + if(!_ResManager) + throw LauncherException("You must set Resources Manager to Launcher!!"); + + // verify if cluster is in resources catalog + machineParams params; + params.hostname = clusterName; + vector aCompoList ; + try{ + aMachineList = _ResManager->GetFittingResources(params, aCompoList); + } + catch(const ResourcesException &ex){ + throw LauncherException(ex.msg.c_str()); + } + if (aMachineList.size() == 0) + throw LauncherException("This cluster is not in resources catalog"); + + // Parsing xml file + ParseXmlFile(xmlExecuteFile); + + // verify if clustername is in xml file + map::const_iterator it1 = _launch.MachinesList.find(clusterName); + if(it1 == _launch.MachinesList.end()) + throw LauncherException("This cluster is not in xml file"); + + ParserResourcesType p = _ResManager->GetResourcesList(aMachineList[0]); + string cname(p.Alias); +#if defined(_DEBUG_) || defined(_DEBUG) + cout << "Choose cluster: " << cname << endl; +#endif + + // search batch manager for that cluster in map or instanciate one + map < string, Batch::BatchManager_eClient * >::const_iterator it2 = _batchmap.find(cname); + if(it2 == _batchmap.end()) + { + _batchmap[cname] = FactoryBatchManager(p); + // TODO: Add a test for the cluster ! + } + + try{ + + // directory on cluster to put files to execute + string remotedir = _launch.MachinesList[clusterName].WorkDirectory; + // local directory to get files to execute and to put results + string localdir = _launch.RefDirectory; + + int idx1 = xmlExecuteFile.find_last_of("/"); + if(idx1 == string::npos) idx1 = -1; + int idx2 = xmlExecuteFile.find(".xml"); + string logfile = xmlExecuteFile.substr(idx1+1,idx2-idx1-1); + string ologfile = logfile + ".output.log"; + string elogfile = logfile + ".error.log"; + + // create and submit job on cluster + Batch::Parametre param; + param[USER] = p.UserName; + param[EXECUTABLE] = ""; + for(int i=0; i<_launch.InputFile.size();i++) + param[INFILE] += Batch::Couple( localdir + "/" + _launch.InputFile[i], remotedir + "/" + _launch.InputFile[i] ); + for(int i=0; i<_launch.OutputFile.size();i++) + param[OUTFILE] += Batch::Couple( localdir + "/" + _launch.OutputFile[i], remotedir + "/" + _launch.OutputFile[i] ); + param[OUTFILE] += Batch::Couple( localdir + "/" + ologfile, remotedir + "/" + ologfile ); + param[OUTFILE] += Batch::Couple( localdir + "/" + elogfile, remotedir + "/" + elogfile ); + param[NBPROC] = _launch.NbOfProcesses; + param[WORKDIR] = remotedir; + param[TMPDIR] = remotedir; + param[MAXWALLTIME] = getWallTime(""); + param[MAXRAMSIZE] = getRamSize(""); + param[HOMEDIR] = ""; + + Batch::Environnement env; + env["COMMAND"] = _launch.Command; + env["SOURCEFILE"] = _launch.MachinesList[clusterName].EnvFile; + env["LOGFILE"] = logfile; + + Batch::Job* job = new Batch::Job(param,env); + + // submit job on cluster + Batch::JobId jid = _batchmap[cname]->submitJob(*job); + + // get job id in long + istringstream iss(jid.getReference()); + iss >> jobId; + + _jobmap[ pair(cname,jobId) ] = job; + } + catch(const Batch::EmulationException &ex){ + throw LauncherException(ex.msg.c_str()); + } + + return jobId; +} + //============================================================================= /*! CORBA Method: * Submit a batch job on a cluster and returns the JobId @@ -87,6 +199,9 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute , long jobId; vector aMachineList; + if(!_ResManager) + throw LauncherException("You must set Resources Manager to Launcher!!"); + // check batch params if ( !check(batch_params) ) throw LauncherException("Batch parameters are bad (see informations above)"); @@ -128,11 +243,10 @@ long Launcher_cpp::submitSalomeJob( const string fileToExecute , for(int i=0;i aCompoList ; vector aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ; @@ -190,15 +308,30 @@ string Launcher_cpp::querySalomeJob( long id, if(it == _batchmap.end()) throw LauncherException("no batchmanager for that cluster"); - ostringstream oss; - oss << id; - Batch::JobId jobId( _batchmap[clustername], oss.str() ); + Batch::Parametre par; + try{ + ostringstream oss; + oss << id; + Batch::JobId jobId( _batchmap[clustername], oss.str() ); + + Batch::JobInfo jinfo = jobId.queryJob(); + par = jinfo.getParametre(); + } + catch(const Batch::EmulationException &ex){ + throw LauncherException(ex.msg.c_str()); + } - Batch::JobInfo jinfo = jobId.queryJob(); - Batch::Parametre par = jinfo.getParametre(); return par[STATE]; } +string Launcher_cpp::queryJob( long id, + const std::string clusterName) +{ + machineParams params; + params.hostname = clusterName; + return queryJob(id,params); +} + //============================================================================= /*! CORBA Method: * Delete a batch job on a cluster @@ -206,9 +339,12 @@ string Launcher_cpp::querySalomeJob( long id, * \param params : Constraints for the choice of the batch cluster */ //============================================================================= -void Launcher_cpp::deleteSalomeJob( const long id, - const machineParams& params) throw(LauncherException) +void Launcher_cpp::deleteJob( const long id, + const machineParams& params) throw(LauncherException) { + if(!_ResManager) + throw LauncherException("You must set Resources Manager to Launcher!!"); + // find a cluster matching params structure vector aCompoList ; vector aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ; @@ -227,6 +363,14 @@ void Launcher_cpp::deleteSalomeJob( const long id, jobId.deleteJob(); } +void Launcher_cpp::deleteJob( long id, + const std::string clusterName) +{ + machineParams params; + params.hostname = clusterName; + deleteJob(id,params); +} + //============================================================================= /*! CORBA Method: * Get result files of job on a cluster @@ -234,10 +378,13 @@ void Launcher_cpp::deleteSalomeJob( const long id, * \param params : Constraints for the choice of the batch cluster */ //============================================================================= -void Launcher_cpp::getResultSalomeJob( const string directory, - const long id, - const machineParams& params) throw(LauncherException) +void Launcher_cpp::getResultsJob( const string directory, + const long id, + const machineParams& params) throw(LauncherException) { + if(!_ResManager) + throw LauncherException("You must set Resources Manager to Launcher!!"); + vector aCompoList ; vector aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ; ParserResourcesType p = _ResManager->GetResourcesList(aMachineList[0]); @@ -253,6 +400,15 @@ void Launcher_cpp::getResultSalomeJob( const string directory, _batchmap[clustername]->importOutputFiles( *job, directory ); } +void Launcher_cpp::getResultsJob( const std::string directory, + long id, + const std::string clusterName) +{ + machineParams params; + params.hostname = clusterName; + getResultsJob(directory,id,params); +} + //============================================================================= /*! * Factory to instanciate the good batch manager for choosen cluster. @@ -293,8 +449,14 @@ Batch::BatchManager_eClient *Launcher_cpp::FactoryBatchManager( const ParserReso case slurm: mpi = "slurm"; break; + case prun: + mpi = "prun"; + break; + case nompi: + throw LauncherException("you must specified an mpi implementation for batch manager"); + break; default: - mpi = "indif"; + throw LauncherException("unknown mpi implementation"); break; } #if defined(_DEBUG_) || defined(_DEBUG) @@ -313,6 +475,12 @@ Batch::BatchManager_eClient *Launcher_cpp::FactoryBatchManager( const ParserReso #endif fact = new Batch::FactBatchManager_eLSF; break; + case sge: +#if defined(_DEBUG_) || defined(_DEBUG) + cout << "Instantiation of SGE batch manager" << endl; +#endif + fact = new Batch::FactBatchManager_eSGE; + break; default: #if defined(_DEBUG_) || defined(_DEBUG) cerr << "BATCH = " << params.Batch << endl; @@ -347,10 +515,14 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const tempOutputFile << dirForTmpFiles ; tempOutputFile << ":$PYTHONPATH" << endl ; + // Adding user script + std::string script = params.userCommands; + if (script != "") + tempOutputFile << script << endl; // Test node rank - tempOutputFile << "if test " ; + tempOutputFile << "if test \"" ; tempOutputFile << mpiImpl->rank() ; - tempOutputFile << " = 0; then" << endl ; + tempOutputFile << "\" = \"0\"; then" << endl ; // ----------------------------------------------- // Code for rank 0 : launch runAppli and a container @@ -453,8 +625,10 @@ MpiImpl *Launcher_cpp::FactoryMpiImpl(MpiImplType mpi) throw(LauncherException) return new MpiImpl_OPENMPI(); case slurm: return new MpiImpl_SLURM(); - case indif: - throw LauncherException("you must specify a mpi implementation in CatalogResources.xml file"); + case prun: + return new MpiImpl_PRUN(); + case nompi: + throw LauncherException("you must specify an mpi implementation for batch manager"); default: ostringstream oss; oss << mpi << " : not yet implemented"; @@ -628,37 +802,70 @@ long Launcher_cpp::getRamSize(std::string mem) return 0; } -std::string -Launcher_cpp::getHomeDir(const ParserResourcesType& p, const std::string& tmpdir) +void Launcher_cpp::ParseXmlFile(string xmlExecuteFile) { - std::string home; - std::string command; - int idx = tmpdir.find("Batch/"); - std::string filelogtemp = tmpdir.substr(idx+6, tmpdir.length()); - filelogtemp = "/tmp/logs" + filelogtemp + "_home"; - - if( p.Protocol == rsh ) - command = "rsh "; - else if( p.Protocol == ssh ) - command = "ssh "; - else - throw LauncherException("Unknown protocol"); - if (p.UserName != ""){ - command += p.UserName; - command += "@"; + SALOME_Launcher_Handler* handler = new SALOME_Launcher_Handler(_launch); + + const char* aFilePath = xmlExecuteFile.c_str(); + FILE* aFile = fopen(aFilePath, "r"); + + if (aFile != NULL) + { + xmlDocPtr aDoc = xmlReadFile(aFilePath, NULL, 0); + + if (aDoc != NULL) + handler->ProcessXmlDocument(aDoc); + else{ +#if defined(_DEBUG_) || defined(_DEBUG) + cout << "ResourcesManager_cpp: could not parse file "<< aFilePath << endl; +#endif + } + + // Free the document + xmlFreeDoc(aDoc); + + fclose(aFile); } - command += p.Alias; - command += " 'echo $HOME' > "; - command += filelogtemp; + else{ #if defined(_DEBUG_) || defined(_DEBUG) - std::cerr << command.c_str() << std::endl; + cout << "Launcher_cpp: file "< #include "ResourcesManager.hxx" +#include "SALOME_Launcher_Parser.hxx" #include #include @@ -67,15 +68,21 @@ public: Launcher_cpp(); ~Launcher_cpp(); + long submitJob(const std::string xmlExecuteFile, + const std::string clusterName) throw(LauncherException); + long submitSalomeJob(const std::string fileToExecute , const std::vector& filesToExport , const std::vector& filesToImport , const batchParams& batch_params, const machineParams& params) throw(LauncherException); - std::string querySalomeJob( const long jobId, const machineParams& params) throw(LauncherException); - void deleteSalomeJob( const long jobId, const machineParams& params) throw(LauncherException); - void getResultSalomeJob( const std::string directory, const long jobId, 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); + void deleteJob( const long jobId, const machineParams& params) throw(LauncherException); + void deleteJob( const long jobId, const std::string clusterName); + 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 SetResourcesManager( ResourcesManager_cpp* rm ) { _ResManager = rm; } @@ -94,6 +101,11 @@ protected: bool check(const batchParams& batch_params); long getWallTime(std::string edt); long getRamSize(std::string mem); + void ParseXmlFile(std::string xmlExecuteFile); + + //! will contain the informations on the data type catalog(after parsing) + ParserLauncherType _launch; + }; #endif diff --git a/src/Launcher/Makefile.am b/src/Launcher/Makefile.am index 52a95dfc0..ab797d703 100644 --- a/src/Launcher/Makefile.am +++ b/src/Launcher/Makefile.am @@ -19,12 +19,6 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -# SALOME Container : implementation of container and engine for Kernel -# File : Makefile.am -# Author : Guillaume Boulant (CSSI) -# Module : KERNEL -# $Header$ -# include $(top_srcdir)/salome_adm/unix/make_common_starter.am # @@ -34,10 +28,12 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # # header files salomeinclude_HEADERS = \ - BatchTest.hxx \ - SALOME_Launcher.hxx \ - SALOME_Launcher_defs.hxx \ - Launcher.hxx + SALOME_Launcher_Parser.hxx \ + SALOME_Launcher_Handler.hxx \ + BatchTest.hxx \ + SALOME_Launcher_defs.hxx \ + SALOME_Launcher.hxx \ + Launcher.hxx # Scripts to be installed dist_salomescript_DATA = @@ -91,10 +87,14 @@ COMMON_LIBS =\ # Libraries targets # =============================================================== # -lib_LTLIBRARIES = libLauncher.la libSalomeLauncher.la +if WITHONLYLAUNCHER + lib_LTLIBRARIES = libLauncher.la +else + lib_LTLIBRARIES = libLauncher.la libSalomeLauncher.la +endif libSalomeLauncher_la_SOURCES=\ - BatchTest.cxx \ - SALOME_Launcher.cxx + BatchTest.cxx \ + SALOME_Launcher.cxx libSalomeLauncher_la_CPPFLAGS =\ $(COMMON_CPPFLAGS) @@ -107,10 +107,12 @@ libSalomeLauncher_la_LIBADD =\ $(COMMON_LIBS) libLauncher.la libLauncher_la_SOURCES=\ + SALOME_Launcher_Parser.cxx \ + SALOME_Launcher_Handler.cxx \ Launcher.cxx libLauncher_la_CPPFLAGS =\ - $(COMMON_CPPFLAGS) \ + -I$(srcdir)/../Batch \ -I$(srcdir)/../ResourcesManager \ @MPI_INCLUDES@ \ @LIBXML_INCLUDES@ @@ -121,7 +123,7 @@ libLauncher_la_LDFLAGS =\ libLauncher_la_LIBADD =\ ../Batch/libSalomeBatch.la \ - ../ResourcesManager/libResourcesManager.la \ + ../ResourcesManager/libSalomeResourcesManager.la \ @MPI_LIBS@ \ @LIBXML_LIBS@ @@ -130,7 +132,9 @@ libLauncher_la_LIBADD =\ # Executables targets # =============================================================== # -bin_PROGRAMS = SALOME_LauncherServer +if !WITHONLYLAUNCHER + bin_PROGRAMS = SALOME_LauncherServer +endif SALOME_LauncherServer_SOURCES =\ SALOME_LauncherServer.cxx diff --git a/src/Launcher/SALOME_Launcher.cxx b/src/Launcher/SALOME_Launcher.cxx index afbd89b4e..00869eec8 100644 --- a/src/Launcher/SALOME_Launcher.cxx +++ b/src/Launcher/SALOME_Launcher.cxx @@ -113,6 +113,28 @@ CORBA::Long SALOME_Launcher::getPID() } +//============================================================================= +/*! CORBA Method: + * Submit a batch job on a cluster and returns the JobId + * \param xmlExecuteFile : .xml to parse to execute on the batch cluster + * \param clusterName : cluster name + */ +//============================================================================= +CORBA::Long SALOME_Launcher::submitJob(const char * xmlExecuteFile, + const char * clusterName) +{ + CORBA::Long jobId; + + try{ + jobId = _l.submitJob(xmlExecuteFile,clusterName); + } + catch(const LauncherException &ex){ + INFOS(ex.msg.c_str()); + THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR); + } + return jobId; +} + //============================================================================= /*! CORBA Method: * Submit a batch job on a cluster and returns the JobId @@ -192,9 +214,9 @@ SALOME_Launcher::testBatch(const Engines::MachineParameters& params) rtn = true; } } - catch(const SALOME_Exception &ex){ - INFOS(ex.what()); - THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR); + catch(const LauncherException &ex){ + INFOS(ex.msg.c_str()); + THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR); } return rtn; } @@ -206,8 +228,8 @@ SALOME_Launcher::testBatch(const Engines::MachineParameters& params) * \param params : Constraints for the choice of the batch cluster */ //============================================================================= -char* SALOME_Launcher::querySalomeJob( const CORBA::Long jobId, - const Engines::MachineParameters& params) +char* SALOME_Launcher::queryJob( const CORBA::Long jobId, + const Engines::MachineParameters& params) { string status; machineParams p; @@ -219,10 +241,10 @@ char* SALOME_Launcher::querySalomeJob( const CORBA::Long jobId, p.mem_mb = params.mem_mb; try{ - status = _l.querySalomeJob(jobId,p); + status = _l.queryJob(jobId,p); } catch(const LauncherException &ex){ - INFOS("Caught exception."); + INFOS(ex.msg.c_str()); THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM); } return CORBA::string_dup(status.c_str()); @@ -235,8 +257,8 @@ char* SALOME_Launcher::querySalomeJob( const CORBA::Long jobId, * \param params : Constraints for the choice of the batch cluster */ //============================================================================= -void SALOME_Launcher::deleteSalomeJob( const CORBA::Long jobId, - const Engines::MachineParameters& params) +void SALOME_Launcher::deleteJob( const CORBA::Long jobId, + const Engines::MachineParameters& params) { machineParams p; p.hostname = params.hostname; @@ -247,7 +269,7 @@ void SALOME_Launcher::deleteSalomeJob( const CORBA::Long jobId, p.mem_mb = params.mem_mb; try{ - _l.deleteSalomeJob(jobId,p); + _l.deleteJob(jobId,p); } catch(const LauncherException &ex){ INFOS("Caught exception."); @@ -262,9 +284,9 @@ void SALOME_Launcher::deleteSalomeJob( const CORBA::Long jobId, * \param params : Constraints for the choice of the batch cluster */ //============================================================================= -void SALOME_Launcher::getResultSalomeJob( const char *directory, - const CORBA::Long jobId, - const Engines::MachineParameters& params) +void SALOME_Launcher::getResultsJob( const char *directory, + const CORBA::Long jobId, + const Engines::MachineParameters& params) { machineParams p; p.hostname = params.hostname; @@ -275,7 +297,7 @@ void SALOME_Launcher::getResultSalomeJob( const char *directory, p.mem_mb = params.mem_mb; try{ - _l.getResultSalomeJob( directory, jobId, p ); + _l.getResultsJob( directory, jobId, p ); } catch(const LauncherException &ex){ INFOS("Caught exception."); diff --git a/src/Launcher/SALOME_Launcher.hxx b/src/Launcher/SALOME_Launcher.hxx index 91615c658..9263d5c68 100644 --- a/src/Launcher/SALOME_Launcher.hxx +++ b/src/Launcher/SALOME_Launcher.hxx @@ -43,6 +43,9 @@ public: SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa); ~SALOME_Launcher(); + CORBA::Long submitJob(const char * xmlExecuteFile, + const char * clusterName); + CORBA::Long submitSalomeJob(const char * fileToExecute , const Engines::FilesList& filesToExport , const Engines::FilesList& filesToImport , @@ -52,6 +55,9 @@ public: char* querySalomeJob( CORBA::Long jobId, const Engines::MachineParameters& params); void deleteSalomeJob( CORBA::Long jobId, const Engines::MachineParameters& params); void getResultSalomeJob( const char * directory, CORBA::Long jobId, const Engines::MachineParameters& params ); + char* queryJob( CORBA::Long jobId, const Engines::MachineParameters& params); + void deleteJob( CORBA::Long jobId, const Engines::MachineParameters& params); + void getResultsJob( const char * directory, CORBA::Long jobId, const Engines::MachineParameters& params ); CORBA::Boolean testBatch(const Engines::MachineParameters& params); diff --git a/src/Launcher/SALOME_Launcher_Handler.cxx b/src/Launcher/SALOME_Launcher_Handler.cxx new file mode 100755 index 000000000..31b4e7ce1 --- /dev/null +++ b/src/Launcher/SALOME_Launcher_Handler.cxx @@ -0,0 +1,167 @@ +// 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 +// +// SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl) +// File : SALOME_Laucher_Handler.cxx +// Author : Bernard Secher +// Module : SALOME +// $Header$ +// +#include "SALOME_Launcher_Handler.hxx" +#include +#include + +using namespace std; + +#ifdef _DEBUG_ +static int MYDEBUG = 1; +#else +static int MYDEBUG = 0; +#endif + +//============================================================================= +/*! + * Constructor + * \param listOfResources: map of ParserResourcesType to fill when parsing + */ +//============================================================================= + +SALOME_Launcher_Handler::SALOME_Launcher_Handler(ParserLauncherType& launch): + _launch(launch) +{ + //XML tags initialisation + test_machine_list = "machine-list"; + test_main = "main"; + + test_machine = "machine"; + test_env_file = "env-file"; + test_work_directory = "work-directory"; + test_ref_directory = "ref-directory"; + test_nb_processes = "nb-processes"; + test_input_file = "input-file"; + test_output_file = "output-file"; + test_command = "command"; + +} + +//============================================================================= +/*! + * Destructor + */ +//============================================================================= + +SALOME_Launcher_Handler::~SALOME_Launcher_Handler() +{ + // cout << "SALOME_Launcher_Handler destruction") << endl; +} + +//============================================================================= +/*! + * Retrieves DS after the file parse. + */ +//============================================================================= + +const ParserLauncherType& +SALOME_Launcher_Handler::GetLauncherAfterParsing() const +{ + return _launch; +} + +//============================================================================= +/*! + * Processes XML document and fills the list of resources + */ +//============================================================================= + +void SALOME_Launcher_Handler::ProcessXmlDocument(xmlDocPtr theDoc) +{ +// if (MYDEBUG) cout << "Begin parse document" << endl; + + // Empty private elements + _launch.Clear(); + + // Get the document root node + xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc); + + aCurNode = aCurNode->xmlChildrenNode; + + // Processing the document nodes + while(aCurNode != NULL){ + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_machine_list) ){ + xmlNodePtr aCurNode2 = aCurNode->xmlChildrenNode; + while(aCurNode2 != NULL){ + if ( !xmlStrcmp(aCurNode2->name,(const xmlChar*)test_machine) ){ + _machp.Clear(); + xmlChar* name = xmlNodeGetContent(aCurNode2); + string clusterName = (const char*)name; + xmlFree(name); + + if (xmlHasProp(aCurNode2, (const xmlChar*)test_env_file)){ + xmlChar* envfile = xmlGetProp(aCurNode2, (const xmlChar*)test_env_file); + _machp.EnvFile = (const char*)envfile; + xmlFree(envfile); + } + + if (xmlHasProp(aCurNode2, (const xmlChar*)test_work_directory)){ + xmlChar* workdirectory = xmlGetProp(aCurNode2, (const xmlChar*)test_work_directory); + _machp.WorkDirectory = (const char*)workdirectory; + xmlFree(workdirectory); + } + _launch.MachinesList[clusterName]=_machp ; + } + aCurNode2 = aCurNode2->next; + } + } + + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_ref_directory) ){ + xmlChar* refdirectory = xmlNodeGetContent(aCurNode); + _launch.RefDirectory = (const char*)refdirectory; + xmlFree(refdirectory); + } + + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_nb_processes) ){ + xmlChar* nbofprocesses = xmlNodeGetContent(aCurNode); + _launch.NbOfProcesses = atoi((const char*)nbofprocesses); + xmlFree(nbofprocesses); + } + + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_input_file) ){ + xmlChar* inputfile = xmlNodeGetContent(aCurNode); + _launch.InputFile.push_back((const char*)inputfile); + xmlFree(inputfile); + } + + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_output_file) ){ + xmlChar* outputfile = xmlNodeGetContent(aCurNode); + _launch.OutputFile.push_back((const char*)outputfile); + xmlFree(outputfile); + } + + if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_command) ){ + xmlChar* command = xmlNodeGetContent(aCurNode); + _launch.Command = (const char*)command; + xmlFree(command); + } + + aCurNode = aCurNode->next; + } + +} diff --git a/src/Launcher/SALOME_Launcher_Handler.hxx b/src/Launcher/SALOME_Launcher_Handler.hxx new file mode 100755 index 000000000..0e14468ec --- /dev/null +++ b/src/Launcher/SALOME_Launcher_Handler.hxx @@ -0,0 +1,68 @@ +// 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 +// +// SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl) +// File : SALOME_Launcher_Handler.hxx +// Author : Bernard SECHER +// Module : SALOME +//$Header$ +// +#ifndef SALOME_LAUNCHER_HANDLER +#define SALOME_LAUNCHER_HANDLER + +#include "SALOME_Launcher_Parser.hxx" + +#include +#include + +#include + +class SALOME_Launcher_Handler +{ + +public : + SALOME_Launcher_Handler(ParserLauncherType& launch); + + virtual ~SALOME_Launcher_Handler(); + + const ParserLauncherType& GetLauncherAfterParsing() const; + + void ProcessXmlDocument(xmlDocPtr theDoc); + +private : + ParserLauncherType& _launch; + MachineParameters _machp; + + const char *test_machine_list; + const char *test_main; + + const char *test_machine; + const char *test_env_file; + const char *test_work_directory; + const char *test_ref_directory; + const char *test_nb_processes; + const char *test_input_file; + const char *test_output_file; + const char *test_command; + +}; + +#endif // SALOME_LAUNCHER_HANDLER diff --git a/src/Launcher/SALOME_Launcher_Parser.cxx b/src/Launcher/SALOME_Launcher_Parser.cxx new file mode 100644 index 000000000..0636debbc --- /dev/null +++ b/src/Launcher/SALOME_Launcher_Parser.cxx @@ -0,0 +1,79 @@ +// 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 "SALOME_Launcher_Parser.hxx" +#include +#include + +#define NULL_VALUE 0 + +using namespace std; + +void MachineParameters::Clear() +{ + EnvFile = ""; + WorkDirectory = ""; +} + +void MachineParameters::Print() const +{ + ostringstream oss; + oss << " EnvFile: " << EnvFile + << " WorkDirectory: " << WorkDirectory << endl; + + cout << oss.str(); +} + +void ParserLauncherType::Print() const +{ + ostringstream oss; + oss << endl << + "RefDirectory: " << RefDirectory << endl << + "NbOfProcesses: " << NbOfProcesses << endl << + "InputFile: "; + for(int i=0; i ::const_iterator it; + for(it=MachinesList.begin();it!=MachinesList.end();it++){ + cout << " " << it->first; + it->second.Print(); + } + +} + +void ParserLauncherType::Clear() +{ + MachinesList.clear(); + RefDirectory = ""; + NbOfProcesses = 1; + InputFile.clear(); + OutputFile.clear(); + Command = ""; +} diff --git a/src/Launcher/SALOME_Launcher_Parser.hxx b/src/Launcher/SALOME_Launcher_Parser.hxx new file mode 100755 index 000000000..4cecce9eb --- /dev/null +++ b/src/Launcher/SALOME_Launcher_Parser.hxx @@ -0,0 +1,57 @@ +// 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 +// +// SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl) +// File : SALOME_Launcher_Parser.hxx +// Author : Bernard Secher +// Module : SALOME +//$Header$ +// +#ifndef SALOME_LAUNCHER_PARSER +#define SALOME_LAUNCHER_PARSER + +#include +#include +#include +#include + +struct MachineParameters + { + std::string EnvFile; + std::string WorkDirectory; + void Print() const; + void Clear(); + }; + +struct ParserLauncherType + { + std::map MachinesList; + std::string RefDirectory; + long NbOfProcesses; + std::vector InputFile; + std::vector OutputFile; + std::string Command; + + void Print() const; + void Clear(); + }; + +#endif //SALOME_LAUNCHER_PARSER diff --git a/src/LifeCycleCORBA/Makefile.am b/src/LifeCycleCORBA/Makefile.am index d01de24a8..c24e369f9 100644 --- a/src/LifeCycleCORBA/Makefile.am +++ b/src/LifeCycleCORBA/Makefile.am @@ -109,7 +109,6 @@ Test_LifeCycleCORBA_LDADD = \ ../Registry/libRegistry.la \ ../Notification/libSalomeNotification.la \ ../Container/libSalomeContainer.la \ - ../HDFPersist/libSalomeHDFPersist.la \ $(COMMON_LIBS) \ @CORBA_LIBS@ @@ -125,8 +124,6 @@ TestContainerManager_LDADD = \ ../Registry/libRegistry.la \ ../Notification/libSalomeNotification.la \ ../Container/libSalomeContainer.la \ - ../HDFPersist/libSalomeHDFPersist.la \ - ../HDFPersist/libSalomeHDFPersist.la \ $(COMMON_LIBS) \ @CORBA_LIBS@ diff --git a/src/LifeCycleCORBA/Test/Makefile.am b/src/LifeCycleCORBA/Test/Makefile.am index 5db61876b..c54e98603 100644 --- a/src/LifeCycleCORBA/Test/Makefile.am +++ b/src/LifeCycleCORBA/Test/Makefile.am @@ -74,7 +74,6 @@ COMMON_LIBS =\ $(RPATH)/Utils/Test/libUtilsTest.la $(RPATH)/Utils/libOpUtil.la \ $(RPATH)/SALOMELocalTrace/Test/libSALOMELocalTraceTest.la $(RPATH)/SALOMELocalTrace/libSALOMELocalTrace.la \ $(RPATH)/SALOMETraceCollector/Test/libSALOMETraceCollectorTest.la \ - $(RPATH)/HDFPersist/libSalomeHDFPersist.la \ $(top_builddir)/idl/libSalomeIDLKernel.la # diff --git a/src/LifeCycleCORBA_SWIG/Makefile.am b/src/LifeCycleCORBA_SWIG/Makefile.am index 1ed7461f4..7c694fc07 100644 --- a/src/LifeCycleCORBA_SWIG/Makefile.am +++ b/src/LifeCycleCORBA_SWIG/Makefile.am @@ -49,13 +49,14 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # The library will be installed in the same place. # +BUILT_SOURCES = swig_wrap.cpp + SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../LifeCycleCORBA -I$(srcdir)/../Utils SWIG_SOURCES = libSALOME_LifeCycleCORBA.i -nodist_salomepython_PYTHON = libSALOME_LifeCycleCORBA.py +salomepython_PYTHON = libSALOME_LifeCycleCORBA.py salomepyexec_LTLIBRARIES = _libSALOME_LifeCycleCORBA.la -nodist__libSALOME_LifeCycleCORBA_la_SOURCES = swig_wrap.cpp -_libSALOME_LifeCycleCORBA_la_SOURCES = $(SWIG_SOURCES) +_libSALOME_LifeCycleCORBA_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES) _libSALOME_LifeCycleCORBA_la_CPPFLAGS =\ @PYTHON_INCLUDES@ \ -I$(srcdir) \ @@ -76,7 +77,7 @@ _libSALOME_LifeCycleCORBA_la_LIBADD = \ swig_wrap.cpp : $(SWIG_SOURCES) $(SWIG) $(SWIG_FLAGS) -o $@ $< -CLEANFILES = swig_wrap.cpp libSALOME_LifeCycleCORBA.py +CLEANFILES = swig_wrap.cpp # diff --git a/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i b/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i index 4791f4247..d2d5fe268 100644 --- a/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i +++ b/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i @@ -23,6 +23,8 @@ // %module libSALOME_LifeCycleCORBA +%feature("autodoc", "1"); + %include @@ -35,6 +37,11 @@ #include "SALOME_NamingService.hxx" #include "ServiceUnreachable.hxx" #include "Utils_SALOME_Exception.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 using namespace std; @@ -116,10 +123,13 @@ struct omniORBpyAPI { $result = PyString_FromString($1.c_str()); } -%typemap(typecheck) const Engines::MachineParameters &, - Engines::MachineParameters const & +%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) Engines::MachineParameters const & +{ + $1 = PyDict_Check($input)? 1 : 0; +} +%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) const Engines::MachineParameters & { - $1 = PyDict_Check($input); + $1 = PyDict_Check($input)? 1 : 0; } %typemap(typecheck) std::string, diff --git a/src/Logger/Makefile.am b/src/Logger/Makefile.am index db56c6be8..5347e5c7b 100644 --- a/src/Logger/Makefile.am +++ b/src/Logger/Makefile.am @@ -47,8 +47,6 @@ 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 \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ # Libraries targets diff --git a/src/Logger/SALOME_Logger_Server.hxx b/src/Logger/SALOME_Logger_Server.hxx index dc13fec3f..a20632857 100644 --- a/src/Logger/SALOME_Logger_Server.hxx +++ b/src/Logger/SALOME_Logger_Server.hxx @@ -28,8 +28,8 @@ #define SALOME_Logger_Server_include #include - #include + #ifdef WIN32 #include #endif @@ -69,8 +69,10 @@ private: bool m_putIntoFile; //ofstream class specialized for disk file output std::ofstream m_outputFile; + //synchronisation object static omni_mutex myLock; + CORBA::ORB_ptr _orb; }; diff --git a/src/Logger/SALOME_Logger_Server_main.cxx b/src/Logger/SALOME_Logger_Server_main.cxx index 524059906..8cd5d9025 100644 --- a/src/Logger/SALOME_Logger_Server_main.cxx +++ b/src/Logger/SALOME_Logger_Server_main.cxx @@ -25,10 +25,11 @@ // Module : SALOME // #include -#include #include "SALOME_Logger_Server.hxx" #include #include +#include + #ifndef WIN32 # include #else diff --git a/src/MPIContainer/MPIContainer_i.cxx b/src/MPIContainer/MPIContainer_i.cxx index 902cd1ddb..ecdfba30c 100644 --- a/src/MPIContainer/MPIContainer_i.cxx +++ b/src/MPIContainer/MPIContainer_i.cxx @@ -26,6 +26,7 @@ #include #include #include +#include "Basics_Utils.hxx" #include "SALOME_Component_i.hxx" #include "MPIContainer_i.hxx" #include "SALOME_NamingService.hxx" diff --git a/src/Makefile.am b/src/Makefile.am index 3faeb2350..2d202204b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -100,6 +100,10 @@ DIST_SUBDIRS = \ # check_cppunit for example with CPPUNIT_IS_OK. # +if WITHONLYLAUNCHER + SUBDIRS = Batch Batch_SWIG ResourcesManager Launcher +else + SUBDIRS = $(SUBDIR_BASE) if WITH_BATCH @@ -110,9 +114,9 @@ if CORBA_GEN SUBDIRS += $(SUBDIR_CORBA) endif -#if MPI_IS_OK -# SUBDIRS += $(SUBDIR_MPI) -#endif +if MPI_IS_OK + SUBDIRS += $(SUBDIR_MPI) +endif if CPPUNIT_IS_OK if CORBA_GEN @@ -127,7 +131,8 @@ else endif endif if WITH_PACO_PARALLEL -SUBDIRS += $(SUBDIR_PARALLEL) + SUBDIRS += $(SUBDIR_PARALLEL) endif +endif EXTRA_DIST = win32pm diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx index 79424535d..fba68af7b 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Acomponent_impl.cxx @@ -488,13 +488,13 @@ void SALOME_ModuleCatalog_AcomponentImpl::duplicate // duplicate service by default S_out.Servicebydefault = S_in.Servicebydefault; - unsigned int _length, ind2; + unsigned int _length; // duplicate in Parameters _length = S_in.ServiceinParameter.length(); S_out.ServiceinParameter.length(_length); - for (ind2 = 0; ind2 < _length ; ind2 ++) + for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) duplicate(S_out.ServiceinParameter[ind2], S_in.ServiceinParameter[ind2]); @@ -502,7 +502,7 @@ void SALOME_ModuleCatalog_AcomponentImpl::duplicate _length = S_in.ServiceoutParameter.length(); S_out.ServiceoutParameter.length(_length); - for (ind2 = 0; ind2 < _length ; ind2 ++) + for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) duplicate(S_out.ServiceoutParameter[ind2], S_in.ServiceoutParameter[ind2]); @@ -510,7 +510,7 @@ void SALOME_ModuleCatalog_AcomponentImpl::duplicate _length = S_in.ServiceinDataStreamParameter.length(); S_out.ServiceinDataStreamParameter.length(_length); - for (ind2 = 0; ind2 < _length ; ind2 ++) + for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) duplicate(S_out.ServiceinDataStreamParameter[ind2], S_in.ServiceinDataStreamParameter[ind2]); @@ -519,7 +519,7 @@ void SALOME_ModuleCatalog_AcomponentImpl::duplicate if(MYDEBUG) SCRUTE(_length); S_out.ServiceoutDataStreamParameter.length(_length); - for (ind2 = 0; ind2 < _length ; ind2 ++) + for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) duplicate(S_out.ServiceoutDataStreamParameter[ind2], S_in.ServiceoutDataStreamParameter[ind2]); } diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx index e1d3a5ae3..895b05cd9 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Client.cxx @@ -66,24 +66,24 @@ int main(int argc,char **argv) SALOME_ModuleCatalog::ListOfComponents_var list_composants = Catalogue->GetComponentList(); - unsigned int ind; + // Typed component list MESSAGE("Get Typed Component list (GEOM Type)"); SALOME_ModuleCatalog::ListOfComponents_var list_typed_composants = Catalogue->GetTypedComponentList(SALOME_ModuleCatalog::GEOM); - for (ind = 0; ind < list_typed_composants->length();ind++) + for (unsigned int ind = 0; ind < list_typed_composants->length();ind++) MESSAGE("Component GEOM list : " << list_typed_composants[ind]); MESSAGE("Get Typed Component list (SUPERV Type)"); list_typed_composants = Catalogue->GetTypedComponentList(SALOME_ModuleCatalog::SUPERV); - for (ind = 0; ind < list_typed_composants->length();ind++) + for (unsigned int ind = 0; ind < list_typed_composants->length();ind++) MESSAGE("Component SUPERV list : " << list_typed_composants[ind]); // Get list of couple (component name, component icone) SALOME_ModuleCatalog::ListOfIAPP_Affich_var list_composants_icone = Catalogue->GetComponentIconeList(); - for (ind = 0; ind < list_composants_icone->length();ind++) + for (unsigned int ind = 0; ind < list_composants_icone->length();ind++) { MESSAGE("Component name: " << list_composants_icone[ind].modulename); MESSAGE("Component icone: " << list_composants_icone[ind].moduleicone); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx index 272657738..7298101b4 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx @@ -236,10 +236,10 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) _typeList.push_back(aType); } else - MESSAGE ( "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." ); + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl; } else - MESSAGE ( "Warning: this type (" << aType.name << "," << aType.kind << ") has incorrect kind, it will be ignored." ); + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") has incorrect kind, it will be ignored." << std::endl; } else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"sequence" )) { @@ -266,11 +266,11 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) _typeList.push_back(aType); } else - MESSAGE ( "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." ); + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl; } else { - MESSAGE ( "Warning: this sequence type (" << aType.name << "," << aType.content << ") has unknown content type, it will be ignored." ); + std::cerr << "Warning: this sequence type (" << aType.name << "," << aType.content << ") has unknown content type, it will be ignored." << std::endl; } } else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"objref" )) @@ -308,7 +308,7 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) } else { - MESSAGE ( "Warning: this objref type (" << aType.name << ") has unknown base type (" << base << "), it will be ignored." ); + std::cerr << "Warning: this objref type (" << aType.name << ") has unknown base type (" << base << "), it will be ignored." << std::endl; error=1; break; } @@ -325,7 +325,7 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) _typeList.push_back(aType); } else - MESSAGE ( "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." ); + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl; } } else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"struct" )) @@ -370,7 +370,7 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) } else { - MESSAGE ( "Warning: this struct type (" << aType.name << ") has unknown member type (" << member.first << "," << member.second << "), it will be ignored." ); + std::cerr << "Warning: this struct type (" << aType.name << ") has unknown member type (" << member.first << "," << member.second << "), it will be ignored." << std::endl; error=1; break; } @@ -386,7 +386,7 @@ void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) _typeList.push_back(aType); } else - MESSAGE ( "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." ); + std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl; } } // end of struct aTypeNode = aTypeNode->next; diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx index 29c48ed5f..43c4b6d8c 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx @@ -161,7 +161,7 @@ int main(int argc,char **argv) timer.ShowAbsolute(); #endif orb->run(); - MESSAGE ( "server returned from orb->run()" ); + std::cerr << "server returned from orb->run()" << std::endl; orb->destroy(); // mgr->deactivate(true,true); diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx index 185ec8bfd..865635705 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx @@ -291,13 +291,11 @@ SALOME_ModuleCatalogImpl::GetPathPrefix(const char* machinename) { char* _path = NULL; bool _find = false ; - unsigned int ind, ind1; - // Parse all the path prefixes // looking for the wanted computer - for (ind = 0 ; ind < _personal_path_list.size() ; ind++) + for (unsigned int ind = 0 ; ind < _personal_path_list.size() ; ind++) { - for (ind1 = 0 ; ind1 < _personal_path_list[ind].listOfComputer.size() ; ind1++) + for (unsigned int ind1 = 0 ; ind1 < _personal_path_list[ind].listOfComputer.size() ; ind1++) { if (strcmp(machinename, _personal_path_list[ind].listOfComputer[ind1].c_str()) == 0) { @@ -313,9 +311,9 @@ SALOME_ModuleCatalogImpl::GetPathPrefix(const char* machinename) { if (!_find) { - for (ind = 0 ; ind < _general_path_list.size() ; ind++) + for (unsigned int ind = 0 ; ind < _general_path_list.size() ; ind++) { - for (ind1 = 0 ; ind1 < _general_path_list[ind].listOfComputer.size() ; ind1++) + for (unsigned int ind1 = 0 ; ind1 < _general_path_list[ind].listOfComputer.size() ; ind1++) { if (strcmp(machinename, _general_path_list[ind].listOfComputer[ind1].c_str()) == 0) { @@ -349,10 +347,8 @@ SALOME_ModuleCatalogImpl::GetComponentList() _list_components->length(_personal_module_list.size()); - unsigned int ind; - // All the components defined in the personal catalog are taken - for(ind=0; ind < _personal_module_list.size();ind++){ + for(unsigned int ind=0; ind < _personal_module_list.size();ind++){ _list_components[ind]=(_personal_module_list[ind].name).c_str(); if(MYDEBUG) SCRUTE(_list_components[ind]) ; } @@ -362,7 +358,7 @@ SALOME_ModuleCatalogImpl::GetComponentList() // The components in the general catalog are taken only if they're // not defined in the personal catalog - for(ind=0; ind < _general_module_list.size();ind++){ + for(unsigned int ind=0; ind < _general_module_list.size();ind++){ _find = false; for(unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++){ // searching if the component is already defined in @@ -407,10 +403,8 @@ SALOME_ModuleCatalogImpl::GetComponentIconeList() _list_components_icone->length(_personal_module_list.size()); - unsigned int ind; - // All the components defined in the personal catalog are taken - for(ind=0; ind < _personal_module_list.size();ind++){ + for(unsigned int ind=0; ind < _personal_module_list.size();ind++){ _list_components_icone[ind].modulename=(_personal_module_list[ind].name).c_str(); _list_components_icone[ind].moduleusername=(_personal_module_list[ind].username).c_str(); _list_components_icone[ind].moduleicone=(_personal_module_list[ind].icon).c_str(); @@ -425,7 +419,7 @@ SALOME_ModuleCatalogImpl::GetComponentIconeList() // The components in the general catalog are taken only if they're // not defined in the personal catalog - for(ind=0; ind < _general_module_list.size();ind++){ + for(unsigned int ind=0; ind < _general_module_list.size();ind++){ _find = false; for(unsigned int ind1=0; ind1 < _personal_module_list.size();ind1++){ // searching if the component is aleready defined in @@ -499,10 +493,8 @@ SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentT break; } - unsigned int ind; - // All the components in the personal catalog are taken - for (ind=0; ind < _personal_module_list.size();ind++) + for (unsigned int ind=0; ind < _personal_module_list.size();ind++) { if (_personal_module_list[ind].type == _temp_component_type) { @@ -518,7 +510,7 @@ SALOME_ModuleCatalogImpl::GetTypedComponentList(SALOME_ModuleCatalog::ComponentT // The components in the general catalog are taken only if they're // not defined in the personal catalog - for (ind=0; ind < _general_module_list.size();ind++) + for (unsigned int ind=0; ind < _general_module_list.size();ind++) { _find = false; @@ -635,10 +627,8 @@ SALOME_ModuleCatalogImpl::findComponent(const string & name) { ParserComponent * C_parser = NULL; - unsigned int ind; - if (!C_parser) - for (ind=0; ind < _personal_module_list.size();ind++) + for (unsigned int ind=0; ind < _personal_module_list.size();ind++) { if (name.compare(_personal_module_list[ind].name) == 0) { @@ -650,7 +640,7 @@ SALOME_ModuleCatalogImpl::findComponent(const string & name) } if (!C_parser) - for (ind=0; ind < _general_module_list.size();ind++) + for (unsigned int ind=0; ind < _general_module_list.size();ind++) { if (name.compare(_general_module_list[ind].name) == 0) { @@ -807,13 +797,13 @@ void SALOME_ModuleCatalogImpl::duplicate S_corba.TypeOfNode = S_parser.typeOfNode; - unsigned int _length, ind2; + unsigned int _length; // duplicate in Parameters _length = S_parser.inParameters.size(); S_corba.ServiceinParameter.length(_length); - for (ind2 = 0; ind2 < _length ; ind2 ++) + for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) duplicate(S_corba.ServiceinParameter[ind2], S_parser.inParameters[ind2]); @@ -821,7 +811,7 @@ void SALOME_ModuleCatalogImpl::duplicate _length = S_parser.outParameters.size(); S_corba.ServiceoutParameter.length(_length); - for (ind2 = 0; ind2 < _length ; ind2 ++) + for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) duplicate(S_corba.ServiceoutParameter[ind2], S_parser.outParameters[ind2]); @@ -829,7 +819,7 @@ void SALOME_ModuleCatalogImpl::duplicate _length = S_parser.inDataStreamParameters.size(); S_corba.ServiceinDataStreamParameter.length(_length); - for (ind2 = 0; ind2 < _length ; ind2 ++) + for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) duplicate(S_corba.ServiceinDataStreamParameter[ind2], S_parser.inDataStreamParameters[ind2]); @@ -838,7 +828,7 @@ void SALOME_ModuleCatalogImpl::duplicate // if(MYDEBUG) SCRUTE(_length); S_corba.ServiceoutDataStreamParameter.length(_length); - for (ind2 = 0; ind2 < _length ; ind2 ++) + for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++) duplicate(S_corba.ServiceoutDataStreamParameter[ind2], S_parser.outDataStreamParameters[ind2]); } @@ -922,21 +912,19 @@ SALOME_ModuleCatalogImpl::_verify_path_prefix(ParserPathPrefixes & pathList) bool _return_value = true; vector _machine_list; - unsigned int ind, ind1; - // Fill a list of all computers indicated in the path list - for (ind = 0; ind < pathList.size(); ind++) + for (unsigned int ind = 0; ind < pathList.size(); ind++) { - for (ind1 = 0 ; ind1 < pathList[ind].listOfComputer.size(); ind1++) + for (unsigned int ind1 = 0 ; ind1 < pathList[ind].listOfComputer.size(); ind1++) { _machine_list.push_back(pathList[ind].listOfComputer[ind1]); } } // Parse if a computer name is twice in the list of computers - for (ind = 0; ind < _machine_list.size(); ind++) + for (unsigned int ind = 0; ind < _machine_list.size(); ind++) { - for (ind1 = ind+1 ; ind1 < _machine_list.size(); ind1++) + for (unsigned int ind1 = ind+1 ; ind1 < _machine_list.size(); ind1++) { if(_machine_list[ind].compare(_machine_list[ind1]) == 0) { diff --git a/src/ModuleGenerator/IDLparser.py b/src/ModuleGenerator/IDLparser.py index bbbd5f64e..e22678cd5 100644 --- a/src/ModuleGenerator/IDLparser.py +++ b/src/ModuleGenerator/IDLparser.py @@ -80,6 +80,7 @@ class Tree: self.parent = None self.childs = [] self.comments = [] + self.attrs={} def addChild(self, tree): if tree is not None: @@ -114,7 +115,10 @@ class Tree: d = depth if self.name != '': s = string.ljust('', 4*depth) - s += '<' + self.name + '>' + s += '<' + self.name + for k,v in self.attrs.items(): + s += ' ' + k + '="' + v + '"' + s += '>' if self.content != '': s += self.content else: @@ -213,6 +217,9 @@ class Tree: L_merge.addChild(i_ext) self.replaceChild(L_merge) + + def setAttrib(self, name,value): + self.attrs[name]=value @@ -476,6 +483,7 @@ class Catalog(ContentHandler, Tree): parser.parse(filename) else: t = self.addNamedChild('begin-catalog') + t.addNamedChild('type-list') t.addNamedChild('component-list') n = self.getChild('begin-catalog') @@ -484,6 +492,9 @@ class Catalog(ContentHandler, Tree): return if n.getChild('path-prefix-list') is None: n.insertFirstNamedChild('path-prefix-list') + if n.getChild('type-list') is None: + p=n.childs.index(n.getChild('path-prefix-list')) + n.childs.insert(p+1,Tree('type-list')) if n.getChild('component-list') is None: n.addNamedChild('component-list') @@ -516,6 +527,16 @@ class Catalog(ContentHandler, Tree): e = p.addChild(parameter(mode='in')) elif name == 'outParameter': e = p.addChild(parameter(mode='out')) + elif name == 'sequence': + e = p.addChild(SeqType(attrs["name"],attrs["content"])) + elif name == 'objref': + e = p.addChild(ObjType(attrs["name"])) + elif name == 'struct': + e = p.addChild(StructType(attrs["name"])) + elif name == 'type': + e = p.addChild(Type(attrs["name"],attrs["kind"])) + elif name == 'member': + e = p.addChild(Member(attrs["name"],attrs["type"])) else: e = p.addNamedChild(name) self.list.append(e) @@ -555,8 +576,66 @@ class Catalog(ContentHandler, Tree): print ' replace component', i_ext.getChild('component-name').content i_int.merge(i_ext) - - + def mergeType(self, type): + L_int = self.getNode('type-list') + if L_int is None: + error("Catalog.mergeType : 'type-list' is not found") + return + for t in L_int.childs: + if t.attrs["name"] == type.attrs["name"]: + t.merge(type) + return + + L_int.addChild(type) + +class Member(Tree): + def __init__(self, name,type): + Tree.__init__(self, 'member') + self.setAttrib("name",name) + self.setAttrib("type",type) + +class Type(Tree): + def __init__(self, name,kind): + Tree.__init__(self, 'type') + self.setAttrib("name",name) + self.setAttrib("kind",kind) + + def merge(self,t): + self.setAttrib("kind",t.attrs["kind"]) + +class SeqType(Tree): + def __init__(self, name,content): + Tree.__init__(self, 'sequence') + self.setAttrib("name",name) + self.setAttrib("content",content) + + def merge(self,t): + self.setAttrib("content",t.attrs["content"]) + +class StructType(Tree): + def __init__(self, name): + Tree.__init__(self, 'struct') + self.setAttrib("name",name) + + def merge(self,t): + #remove childs and replace by t childs + self.childs=[] + for c in t.childs: + self.childs.append(c) + +class ObjType(Tree): + def __init__(self, name): + Tree.__init__(self, 'objref') + self.setAttrib("name",name) + + def merge(self,t): + RepoId=t.attrs.get("id") + if RepoId: + self.setAttrib("id",RepoId) + #remove childs and replace by t childs + self.childs=[] + for c in t.childs: + self.childs.append(c) # IDL file reader @@ -589,47 +668,61 @@ class ModuleCatalogVisitor (idlvisitor.AstVisitor): def __init__(self, catalog): self.catalog = catalog self.EngineType = 0 + self.currentScope=None def visitAST(self, node): for n in node.declarations(): - n.accept(self) + if n.mainFile(): + n.accept(self) def visitModule(self, node): + self.currentScope=node for n in node.definitions(): n.accept(self) def visitInterface(self, node): - if node.mainFile(): self.EngineType = 0 for i in node.inherits(): s = i.scopedName(); - if ((s[0] == "Engines") & (s[1] == "Component")): + if s[0] == "Engines": + if s[1] == "Component": self.EngineType = 1; break + if s[1] == "Superv_Component": + self.EngineType = 2; break - Comp = Component(node.identifier()) + if self.EngineType: + #This interface is a SALOME component + Comp = Component(node.identifier()) - self.currentInterface = Comp.createInterface(node.identifier()) + self.currentInterface = Comp.createInterface(node.identifier()) - for c in node.callables(): + for c in node.callables(): if isinstance(c, idlast.Operation): c.accept(self) - for c in node.declarations(): + for c in node.declarations(): if isinstance(c, idlast.Struct): c.accept(self) - for i in node.comments(): + for i in node.comments(): self.currentInterface.comments.append(str(i)) - self.currentInterface.processDataStreams() + if self.EngineType == 2: + self.currentInterface.processDataStreams() - if (self.EngineType): - global nb_components - nb_components = nb_components + 1 - self.catalog.mergeComponent(Comp) + global nb_components + nb_components = nb_components + 1 + self.catalog.mergeComponent(Comp) + + else: + #This interface is not a component : use it as a DataType + t=ObjType("/".join(node.scopedName())) + for i in node.inherits(): + t.addNamedChild("base","/".join(i.scopedName())) + self.catalog.mergeType(t) self.EngineType = 0 @@ -652,7 +745,9 @@ class ModuleCatalogVisitor (idlvisitor.AstVisitor): def visitDeclaredType(self, type): - self.currentType = type.name() + name=type.name() + scoped_name="/".join(type.scopedName()) + self.currentType = scoped_name def visitBaseType(self, type): self.currentType = ttsMap[type.kind()] @@ -669,6 +764,58 @@ class ModuleCatalogVisitor (idlvisitor.AstVisitor): self.currentService.createOutParameter \ (node.identifier(), self.currentType) + def visitSequenceType(self,type): + type.seqType().accept(self) + if type.bound() == 0: + self.contentType=self.currentType + self.currentType = "sequence" + else: + self.currentType = None + + def visitTypedef(self, node): + if node.constrType(): + node.aliasType().decl().accept(self) + + node.aliasType().accept(self) + type = self.currentType + if not type: + return + decll = [] + for d in node.declarators(): + d.accept(self) + if self.__result_declarator: + decll.append(self.__result_declarator) + if type == "sequence": + #it's a sequence type + for name in decll: + scoped_name="/".join(self.currentScope.scopedName()+[name]) + self.catalog.mergeType(SeqType(scoped_name,self.contentType)) + #else: + #it's an alias + # for name in decll: + # scoped_name="/".join(self.currentScope.scopedName()+[name]) + # self.catalog.mergeType(Type(scoped_name,type)) + + def visitStruct(self, node): + t=StructType("/".join(node.scopedName())) + for m in node.members(): + if m.constrType(): + m.memberType().decl().accept(self) + + m.memberType().accept(self) + type = self.currentType + for d in m.declarators(): + d.accept(self) + t.addChild(Member(self.__result_declarator,type)) + + self.catalog.mergeType(t) + + def visitDeclarator(self, node): + if node.sizes(): + self.__result_declarator =None + else: + self.__result_declarator =node.identifier() + #-------------------------------------------------- # parse idl and store xml file #-------------------------------------------------- diff --git a/src/ModuleGenerator/README b/src/ModuleGenerator/README index 34c4a62da..1a06d38fc 100644 --- a/src/ModuleGenerator/README +++ b/src/ModuleGenerator/README @@ -1,3 +1,26 @@ +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 +______________________________________________________________________ + + Outil de generation du catalogue de module a partir des fichiers idl corba. version 0.1 (12/4/2002) diff --git a/src/ModuleGenerator/testIDLparser.in b/src/ModuleGenerator/testIDLparser.in index 788210d0f..26c4ef2f1 100755 --- a/src/ModuleGenerator/testIDLparser.in +++ b/src/ModuleGenerator/testIDLparser.in @@ -25,7 +25,7 @@ ROOT_SRCDIR=@ROOT_SRCDIR@ export ROOT_SRCDIR ROOT_BUILDDIR=@ROOT_BUILDDIR@ export ROOT_BUILDDIR -SRCDIR=${ROOT_SRCDIR}/SALOME/src/ModuleGenerator +SRCDIR=${ROOT_SRCDIR}/src/ModuleGenerator export SRCDIR ${SRCDIR}/tests/test$1.sh diff --git a/src/ModuleGenerator/tests/AddComponent.idl b/src/ModuleGenerator/tests/AddComponent.idl new file mode 100644 index 000000000..1fc59233d --- /dev/null +++ b/src/ModuleGenerator/tests/AddComponent.idl @@ -0,0 +1,68 @@ +// 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 : AddComponent.idl +// Author : Jean Rahuel +// +#ifndef _ADDCOMPONENT_IDL +#define _ADDCOMPONENT_IDL + +#include "SALOME_Component.idl" + +module SuperVisionTest { + + interface Adder ; + + interface AddComponent : Engines::Component { + double Add( in double x , in double y , out double z ) ; + double AddWithoutSleep( in double x , in double y , out double z ) ; + void Setx( in double x ) ; + void Sety( in double y ) ; + double Addxy() ; + double AddyTox( in double y ) ; + long Sigma( in long n ) ; + double LastResult() ; + + Adder Addition() ; + boolean AdditionObjRef1( out Adder anAdder ) ; + void AdditionObjRef2( out boolean FuncValue , out Adder anAdder ) ; + boolean AdditionObjRefs( in AddComponent AddComponent1 , + in AddComponent Adder2 , + in AddComponent Adder3 , + out AddComponent RetAddComponent1 , + out AddComponent RetAdder2 , + out AddComponent RetAdder3 ) ; + }; + + interface Adder : Engines::Component { + double Add( in double x , in double y , out double z ) ; + double AddWithoutSleep( in double x , in double y , out double z ) ; + double AddAndCompare( in double x , in double y , in Adder anOtherAdder, + out double z ) ; + void SetLastResult( in double z ) ; + void LastResult( out double z ) ; + Engines::Component LccAddComponent( in string aContainer , + in string aComponentName ) ; + }; + +} ; + +#endif diff --git a/src/ModuleGenerator/tests/SubComponent.idl b/src/ModuleGenerator/tests/SubComponent.idl new file mode 100644 index 000000000..772b3f1ea --- /dev/null +++ b/src/ModuleGenerator/tests/SubComponent.idl @@ -0,0 +1,38 @@ +// 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 : SubComponent.idl +// Author : Jean Rahuel +// +#ifndef _SUBCOMPONENT_IDL +#define _SUBCOMPONENT_IDL + +#include "SALOME_Component.idl" + +module SuperVisionTest { + + interface SubComponent : Engines::Component { + void Sub( in double x , in double y , out double z ) ; + } ; +}; + + +#endif diff --git a/src/ModuleGenerator/tests/test1.sh b/src/ModuleGenerator/tests/test1.sh index 76a76493a..bc7cadfbc 100755 --- a/src/ModuleGenerator/tests/test1.sh +++ b/src/ModuleGenerator/tests/test1.sh @@ -31,7 +31,8 @@ echo "test1: \rm -f my_catalog.xml* -${ROOT_BUILDDIR}/bin/runIDLparser \ +sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \ + -I${ROOT_SRCDIR}/idl \ -Wbcatalog=my_catalog.xml \ - ${ROOT_SRCDIR}/idl/AddComponent.idl + ${SRCDIR}/tests/AddComponent.idl diff --git a/src/ModuleGenerator/tests/test1b.sh b/src/ModuleGenerator/tests/test1b.sh index eae12adec..8cad7c9b1 100755 --- a/src/ModuleGenerator/tests/test1b.sh +++ b/src/ModuleGenerator/tests/test1b.sh @@ -23,7 +23,7 @@ # File : test1b.sh # Module : SALOME # -echo "test6: +echo "test1b: test derivation Engine::Component " @@ -35,7 +35,8 @@ echo " --> creation d'un nouveau catalogue avec un composant " -${ROOT_BUILDDIR}/bin/runIDLparser \ - -Wbcatalog=my_catalog.xml \ +sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \ + -I${ROOT_SRCDIR}/idl \ + -Wbcatalog=my_catalog.xml \ ${SRCDIR}/tests/TrucComponent.idl diff --git a/src/ModuleGenerator/tests/test2.sh b/src/ModuleGenerator/tests/test2.sh index 92ff0eaa0..0d238ce48 100755 --- a/src/ModuleGenerator/tests/test2.sh +++ b/src/ModuleGenerator/tests/test2.sh @@ -36,25 +36,28 @@ echo " --> creation d'un nouveau catalogue avec un composant " -${ROOT_BUILDDIR}/bin/runIDLparser \ +sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \ + -I${ROOT_SRCDIR}/idl \ -Wbcatalog=my_catalog.xml \ - ${ROOT_SRCDIR}/idl/AddComponent.idl + ${SRCDIR}/tests/AddComponent.idl echo " --> ajout d'un nouveau composant dans le catalogue " -${ROOT_BUILDDIR}/bin/runIDLparser \ +sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \ + -I${ROOT_SRCDIR}/idl \ -Wbcatalog=my_catalog.xml \ - ${ROOT_SRCDIR}/idl/SubComponent.idl + ${SRCDIR}/tests/SubComponent.idl echo " --> remplacement du premier composant dans le catalogue " -${ROOT_BUILDDIR}/bin/runIDLparser \ +sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \ + -I${ROOT_SRCDIR}/idl \ -Wbcatalog=my_catalog.xml \ - ${ROOT_SRCDIR}/idl/AddComponent.idl + ${SRCDIR}/tests/AddComponent.idl diff --git a/src/ModuleGenerator/tests/test3.sh b/src/ModuleGenerator/tests/test3.sh index dd6d35898..6f9371e84 100755 --- a/src/ModuleGenerator/tests/test3.sh +++ b/src/ModuleGenerator/tests/test3.sh @@ -36,14 +36,17 @@ echo " --> creation d'un nouveau catalogue avec un composant " -${ROOT_BUILDDIR}/bin/runIDLparser \ - -Wbcatalog=my_catalog.xml \ - ${ROOT_SRCDIR}/idl/AddComponent.idl +sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \ + -I${ROOT_SRCDIR}/idl \ + -Wbcatalog=my_catalog.xml \ + ${SRCDIR}/tests/AddComponent.idl + echo " --> remplacement du composant dans le catalogue (meme idl) " -${ROOT_BUILDDIR}/bin/runIDLparser \ - -Wbcatalog=my_catalog.xml \ - ${ROOT_SRCDIR}/idl/AddComponent.idl +sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \ + -I${ROOT_SRCDIR}/idl \ + -Wbcatalog=my_catalog.xml \ + ${SRCDIR}/tests/AddComponent.idl diff --git a/src/ModuleGenerator/tests/test4.sh b/src/ModuleGenerator/tests/test4.sh index 56b96e4f1..9713d7cfd 100755 --- a/src/ModuleGenerator/tests/test4.sh +++ b/src/ModuleGenerator/tests/test4.sh @@ -35,9 +35,10 @@ echo " --> creation d'un nouveau catalogue avec un composant " -${ROOT_BUILDDIR}/bin/runIDLparser \ - -Wbcatalog=my_catalog.xml \ - ${ROOT_SRCDIR}/idl/AddComponent.idl +sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \ + -I${ROOT_SRCDIR}/idl \ + -Wbcatalog=my_catalog.xml \ + ${SRCDIR}/tests/AddComponent.idl mv my_catalog.xml C1 @@ -52,7 +53,8 @@ mv C1 my_catalog.xml --> remplacement du composant dans le catalogue (autre idl) " -${ROOT_BUILDDIR}/bin/runIDLparser \ - -Wbcatalog=my_catalog.xml \ - ${SRCDIR}/tests/Truc2Component.idl +sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \ + -I${ROOT_SRCDIR}/idl \ + -Wbcatalog=my_catalog.xml \ + ${SRCDIR}/tests/Truc2Component.idl diff --git a/src/ModuleGenerator/tests/test5.sh b/src/ModuleGenerator/tests/test5.sh index c7b31f70f..0ada24652 100755 --- a/src/ModuleGenerator/tests/test5.sh +++ b/src/ModuleGenerator/tests/test5.sh @@ -23,7 +23,7 @@ # File : test5.sh # Module : SALOME # -echo "test4: +echo "test5: creation d'un catalogue avec tous les idl de Salome (au 29/3/2002) @@ -36,6 +36,7 @@ do echo echo " processing " `basename $i` echo - ${ROOT_BUILDDIR}/bin/runIDLparser \ - -Wbcatalog=my_catalog.xml $i + sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \ + -I${ROOT_SRCDIR}/idl \ + -Wbcatalog=my_catalog.xml $i done diff --git a/src/NOTIFICATION_SWIG/Makefile.am b/src/NOTIFICATION_SWIG/Makefile.am index 412553cdb..6f2c9835c 100644 --- a/src/NOTIFICATION_SWIG/Makefile.am +++ b/src/NOTIFICATION_SWIG/Makefile.am @@ -34,18 +34,17 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am # (cf. http://www.geocities.com/foetsch/python/swig_linux.htm) # see also LifeCycleCORBA_SWIG # +BUILT_SOURCES = swig_wrap.cpp SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../Notification SWIG_SOURCES = NOTIFICATION.i -nodist_salomepython_PYTHON = libNOTIFICATION.py +salomepython_PYTHON = libNOTIFICATION.py salomepyexec_LTLIBRARIES = _libNOTIFICATION.la -nodist__libNOTIFICATION_la_SOURCES = swig_wrap.cpp -_libNOTIFICATION_la_SOURCES = $(SWIG_SOURCES) \ +_libNOTIFICATION_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES) \ NOTIFICATION_Swig.cxx NOTIFICATION_Swig.hxx SALOME_NOTIFICATION_SWIG.hxx _libNOTIFICATION_la_CPPFLAGS =\ @PYTHON_INCLUDES@ -DHAVE_CONFIG_H \ - -I$(srcdir) \ -I$(srcdir)/../Notification \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ @@ -54,9 +53,9 @@ _libNOTIFICATION_la_CPPFLAGS =\ _libNOTIFICATION_la_LDFLAGS = -module -_libNOTIFICATION_la_LIBADD = @PYTHON_LIBS@ ../Notification/libSalomeNotification.la +_libNOTIFICATION_la_LIBADD = ../Notification/libSalomeNotification.la swig_wrap.cpp : $(SWIG_SOURCES) $(SWIG) $(SWIG_FLAGS) -o $@ $< -CLEANFILES = swig_wrap.cpp libNOTIFICATION.py +CLEANFILES = swig_wrap.cpp diff --git a/src/NOTIFICATION_SWIG/NOTIFICATION.i b/src/NOTIFICATION_SWIG/NOTIFICATION.i index 26f68f665..eee6ffbc8 100644 --- a/src/NOTIFICATION_SWIG/NOTIFICATION.i +++ b/src/NOTIFICATION_SWIG/NOTIFICATION.i @@ -26,6 +26,7 @@ // %module libNOTIFICATION +%feature("autodoc", "1"); %{ //#define __declspec(a) diff --git a/src/ParallelContainer/SALOME_ParallelComponent_i.cxx b/src/ParallelContainer/SALOME_ParallelComponent_i.cxx index e9cccf9fe..8e8cc6aee 100644 --- a/src/ParallelContainer/SALOME_ParallelComponent_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelComponent_i.cxx @@ -27,7 +27,7 @@ #include "SALOME_ParallelComponent_i.hxx" #include "SALOME_ParallelContainer_i.hxx" -#include "Basics_Utils.hxx" +#include "OpUtil.hxx" #include #ifndef WIN32 #include diff --git a/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx b/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx index 68d2f2414..61f5eda5c 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx @@ -45,7 +45,7 @@ #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" #include "SALOMETraceCollector.hxx" -#include "Basics_Utils.hxx" +#include "OpUtil.hxx" using namespace std; diff --git a/src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx b/src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx index b5c522c6d..7c8f6afc8 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx @@ -48,7 +48,7 @@ #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" #include "SALOMETraceCollector.hxx" -#include "Basics_Utils.hxx" +#include "OpUtil.hxx" using namespace std; diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxyDummy.cxx b/src/ParallelContainer/SALOME_ParallelContainerProxyDummy.cxx index 2fc7ed8b4..be5ee2add 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerProxyDummy.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerProxyDummy.cxx @@ -46,7 +46,7 @@ #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" #include "SALOMETraceCollector.hxx" -#include "Basics_Utils.hxx" +#include "OpUtil.hxx" #ifdef DEBUG_PARALLEL #include diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxyMpi.cxx b/src/ParallelContainer/SALOME_ParallelContainerProxyMpi.cxx index 390efb9e1..49bb1899f 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerProxyMpi.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerProxyMpi.cxx @@ -47,7 +47,7 @@ #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" #include "SALOMETraceCollector.hxx" -#include "Basics_Utils.hxx" +#include "OpUtil.hxx" using namespace std; #ifdef DEBUG_PARALLEL diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx index 56995e0f3..52f5e7070 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx @@ -36,7 +36,7 @@ #include "SALOME_FileRef_i.hxx" #include "SALOME_FileTransfer_i.hxx" #include "SALOME_NamingService.hxx" -#include "Basics_Utils.hxx" +#include "OpUtil.hxx" #include #include diff --git a/src/ResourcesManager/Makefile.am b/src/ResourcesManager/Makefile.am index edde03e67..f24d8355d 100755 --- a/src/ResourcesManager/Makefile.am +++ b/src/ResourcesManager/Makefile.am @@ -72,7 +72,11 @@ COMMON_LIBS =\ # Libraries targets # =============================================================== # -lib_LTLIBRARIES = libResourcesManager.la libSalomeResourcesManager.la +if WITHONLYLAUNCHER + lib_LTLIBRARIES = libResourcesManager.la +else + lib_LTLIBRARIES = libResourcesManager.la libSalomeResourcesManager.la +endif libSalomeResourcesManager_la_SOURCES =\ SALOME_ResourcesManager.cxx @@ -97,6 +101,5 @@ libResourcesManager_la_CPPFLAGS =\ libResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0 libResourcesManager_la_LIBADD =\ - ../Basics/libSALOMEBasics.la \ - ../SALOMELocalTrace/libSALOMELocalTrace.la \ + ../Utils/libOpUtil.la \ @LIBXML_LIBS@ diff --git a/src/ResourcesManager/ResourcesManager.cxx b/src/ResourcesManager/ResourcesManager.cxx index 8f2d2a5cb..5bcf6d843 100644 --- a/src/ResourcesManager/ResourcesManager.cxx +++ b/src/ResourcesManager/ResourcesManager.cxx @@ -27,15 +27,12 @@ #include #include #include -#include #include #include #include -#ifndef WIN32 -# include -#endif +#include #define MAX_SIZE_FOR_HOSTNAME 256; @@ -67,12 +64,14 @@ ResourcesManager_cpp(const char *xmlFilePath) : */ //============================================================================= -ResourcesManager_cpp::ResourcesManager_cpp() +ResourcesManager_cpp::ResourcesManager_cpp() throw(ResourcesException) { #if defined(_DEBUG_) || defined(_DEBUG) cerr << "ResourcesManager_cpp constructor" << endl; #endif _isAppliSalomeDefined = (getenv("APPLI") != 0); + if(!getenv("KERNEL_ROOT_DIR")) + throw ResourcesException("you must define KERNEL_ROOT_DIR environment variable!!"); if (_isAppliSalomeDefined) { @@ -125,9 +124,6 @@ std::vector ResourcesManager_cpp::GetFittingResources(const machineParams& params, const std::vector& componentList) throw(ResourcesException) { -//#if defined(_DEBUG_) || defined(_DEBUG) -// cerr << "ResourcesManager_cpp::GetFittingResources" << endl; -//#endif vector vec; ParseXmlFile(); @@ -138,9 +134,6 @@ ResourcesManager_cpp::GetFittingResources(const machineParams& params, #endif if (hostname[0] != '\0'){ -//#if defined(_DEBUG_) || defined(_DEBUG) -// cerr << "ResourcesManager_cpp::GetFittingResources : hostname specified" << endl; -//#endif if ( strcmp(hostname, "localhost") == 0 || strcmp(hostname, Kernel_Utils::GetHostname().c_str()) == 0 ) @@ -159,11 +152,13 @@ ResourcesManager_cpp::GetFittingResources(const machineParams& params, // --- params.hostname is in the list of resources so return it. vec.push_back(hostname); } + else if (_resourcesBatchList.find(hostname) != _resourcesBatchList.end()) { // --- params.hostname is in the list of resources so return it. vec.push_back(hostname); } + else { // Cas d'un cluster: nombre de noeuds > 1 @@ -172,10 +167,6 @@ ResourcesManager_cpp::GetFittingResources(const machineParams& params, if( (*iter).second.DataForSort._nbOfNodes > 1 ){ if( strncmp(hostname,(*iter).first.c_str(),strlen(hostname)) == 0 ){ vec.push_back((*iter).first.c_str()); -//#if defined(_DEBUG_) || defined(_DEBUG) -// cerr << "SALOME_ResourcesManager_cpp::GetFittingResources vector[" -// << cpt << "] = " << (*iter).first.c_str() << endl ; -//#endif cpt++; } } diff --git a/src/ResourcesManager/ResourcesManager.hxx b/src/ResourcesManager/ResourcesManager.hxx index 0f82ccf2c..cc065929c 100644 --- a/src/ResourcesManager/ResourcesManager.hxx +++ b/src/ResourcesManager/ResourcesManager.hxx @@ -60,7 +60,7 @@ class RESOURCESMANAGER_EXPORT ResourcesManager_cpp public: ResourcesManager_cpp(const char *xmlFilePath); - ResourcesManager_cpp(); + ResourcesManager_cpp() throw(ResourcesException); ~ResourcesManager_cpp(); diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index 7fde2ca3a..1602fcce9 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -26,18 +26,12 @@ //$Header$ // #include "SALOME_ResourcesCatalog_Handler.hxx" +#include "Basics_Utils.hxx" #include #include -#include "utilities.h" using namespace std; -#ifdef _DEBUG_ -static int MYDEBUG = 1; -#else -static int MYDEBUG = 0; -#endif - //============================================================================= /*! * Constructor @@ -70,6 +64,8 @@ SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& resources_list, test_cpu_freq_mhz = "CPUFreqMHz"; test_nb_of_nodes = "nbOfNodes"; test_nb_of_proc_per_node = "nbOfProcPerNode"; + test_batch_queue = "batchQueue"; + test_user_commands = "userCommands"; } //============================================================================= @@ -103,8 +99,6 @@ SALOME_ResourcesCatalog_Handler::GetResourcesAfterParsing() const void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) { -// if (MYDEBUG) cout << "Begin parse document" << endl; - // Empty private elements _resources_list.clear(); @@ -138,10 +132,28 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) else _resource.Alias = ""; - if (xmlHasProp(aCurNode, (const xmlChar*)test_protocol)) + if (xmlHasProp(aCurNode, (const xmlChar*)test_batch_queue)) + { + xmlChar* batch_queue = xmlGetProp(aCurNode, (const xmlChar*)test_batch_queue); + _resource.batchQueue = (const char*)batch_queue; + xmlFree(batch_queue); + } + else + _resource.batchQueue = ""; + + if (xmlHasProp(aCurNode, (const xmlChar*)test_user_commands)) + { + xmlChar* user_commands= xmlGetProp(aCurNode, (const xmlChar*)test_user_commands); + _resource.userCommands = (const char*)user_commands; + xmlFree(user_commands); + } + else + _resource.userCommands = ""; + + if (xmlHasProp(aCurNode, (const xmlChar*)test_protocol)) { - xmlChar* protocol= xmlGetProp(aCurNode, (const xmlChar*)test_protocol); - switch ( protocol[0]) + xmlChar* protocol= xmlGetProp(aCurNode, (const xmlChar*)test_protocol); + switch ( protocol[0]) { case 'r': _resource.Protocol = rsh; @@ -189,6 +201,8 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) _resource.Batch = pbs; else if (aBatch == "lsf") _resource.Batch = lsf; + else if (aBatch == "sge") + _resource.Batch = sge; else _resource.Batch = none; } @@ -208,8 +222,10 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) _resource.mpi = openmpi; else if (anMpi == "slurm") _resource.mpi = slurm; + else if (anMpi == "prun") + _resource.mpi = prun; else - _resource.mpi = indif; + _resource.mpi = nompi; } if (xmlHasProp(aCurNode, (const xmlChar*)test_user_name)) @@ -296,36 +312,36 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) _resource.HostName = nodeName ; _resources_list[nodeName] = _resource; } - } - else - _resources_list[_resource.HostName] = _resource; - } - else - _resources_batch_list[_resource.HostName] = _resource; - } + } + else + { + _resources_list[_resource.HostName] = _resource; + if(_resource.HostName == "localhost") + _resources_list[Kernel_Utils::GetHostname()] = _resource; + } + } + else + _resources_batch_list[_resource.HostName] = _resource; + } aCurNode = aCurNode->next; } - // For debug only - if (MYDEBUG) - { - for (map::const_iterator iter = - _resources_list.begin(); - iter != _resources_list.end(); - iter++) - { - SCRUTE((*iter).second.HostName); - SCRUTE((*iter).second.Alias); - SCRUTE((*iter).second.UserName); - SCRUTE((*iter).second.AppliPath); - SCRUTE((*iter).second.OS); - SCRUTE((*iter).second.Protocol); - SCRUTE((*iter).second.Mode); - } - -// cout << "This is the end of document" << endl; -// } - } +#ifdef _DEBUG_ + for (map::const_iterator iter = + _resources_list.begin(); + iter != _resources_list.end(); + iter++) + { + std::cerr << (*iter).second.HostName << std::endl; + std::cerr << (*iter).second.Alias << std::endl; + std::cerr << (*iter).second.UserName << std::endl; + std::cerr << (*iter).second.AppliPath << std::endl; + std::cerr << (*iter).second.OS << std::endl; + std::cerr << (*iter).second.Protocol << std::endl; + std::cerr << (*iter).second.Mode << std::endl; + } +#endif + } @@ -353,7 +369,9 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc) node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL); xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str()); xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str()); - + xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str()); + xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str()); + switch ((*iter).second.Protocol) { case rsh: @@ -386,8 +404,8 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc) case lsf: xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf"); break; - case slurm: - xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "slurm"); + case sge: + xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge"); break; default: xmlNewProp(node, BAD_CAST test_batch, BAD_CAST ""); @@ -407,6 +425,12 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc) case openmpi: xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi"); break; + case slurm: + xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm"); + break; + case prun: + xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun"); + break; default: xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST ""); } @@ -469,8 +493,8 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc) case lsf: xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf"); break; - case slurm: - xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "slurm"); + case sge: + xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge"); break; default: xmlNewProp(node, BAD_CAST test_batch, BAD_CAST ""); @@ -490,6 +514,12 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc) case openmpi: xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi"); break; + case slurm: + xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm"); + break; + case prun: + xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun"); + break; default: xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST ""); } diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx index b9a48e597..35cd21296 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.hxx @@ -78,6 +78,8 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesCatalog_Handler const char *test_cpu_freq_mhz; const char *test_nb_of_nodes; const char *test_nb_of_proc_per_node; + const char *test_batch_queue; + const char *test_user_commands; }; diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx index dc72aeb0c..fff95034a 100644 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.cxx @@ -131,6 +131,8 @@ void ParserResourcesType::Print() const "UserName : " << UserName << endl << "AppliPath : " << AppliPath << endl << "OS : " << OS << endl << + "batchQueue : " << batchQueue << endl << + "userCommands : " << userCommands << endl << "Modules : " << endl; for(int i=0;i ModulesList; std::string OS; + std::string batchQueue; + std::string userCommands; void Print() const; void Clear(); diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index 02930d5c5..408c2250a 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -210,9 +210,8 @@ Engines::MachineParameters* SALOME_ResourcesManager::GetMachineParameters(const p_ptr->cpu_clock = resource.DataForSort._CPUFreqMHz; p_ptr->nb_proc_per_node = resource.DataForSort._nbOfProcPerNode; p_ptr->nb_node = resource.DataForSort._nbOfNodes; - if( resource.mpi == indif ) - p_ptr->mpiImpl = "indif"; - else if( resource.mpi == lam ) + + if( resource.mpi == lam ) p_ptr->mpiImpl = "lam"; else if( resource.mpi == mpich1 ) p_ptr->mpiImpl = "mpich1"; @@ -222,10 +221,17 @@ Engines::MachineParameters* SALOME_ResourcesManager::GetMachineParameters(const p_ptr->mpiImpl = "openmpi"; else if( resource.mpi == slurm ) p_ptr->mpiImpl = "slurm"; + else if( resource.mpi == prun ) + p_ptr->mpiImpl = "prun"; + if( resource.Batch == pbs ) p_ptr->batch = "pbs"; else if( resource.Batch == lsf ) p_ptr->batch = "lsf"; + else if( resource.Batch == sge ) + p_ptr->batch = "sge"; + + p_ptr->nb_component_nodes=1; return p_ptr; } diff --git a/src/SALOMEDS/Makefile.am b/src/SALOMEDS/Makefile.am index 53a6db474..c56b74553 100644 --- a/src/SALOMEDS/Makefile.am +++ b/src/SALOMEDS/Makefile.am @@ -182,6 +182,8 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_AttributeParameter.cxx \ SALOMEDS_AttributeString.cxx \ SALOMEDS_IParameters.cxx \ + SALOMEDS_AttLong_i.hxx \ + SALOMEDS_AttReal_i.hxx \ SALOMEDS_AttributeComment.hxx \ SALOMEDS_AttributeComment_i.hxx \ SALOMEDS_AttributeDrawable.hxx \ @@ -239,6 +241,8 @@ libSalomeDS_la_SOURCES = \ SALOMEDS_AttributeTreeNode_i.hxx \ SALOMEDS_AttributeUserID.hxx \ SALOMEDS_AttributeUserID_i.hxx \ + SALOMEDS_BasicAttributeFactory.hxx \ + SALOMEDS_BasicAttribute_i.hxx \ SALOMEDS_Callback_i.hxx \ SALOMEDS_ChildIterator.hxx \ SALOMEDS_ChildIterator_i.hxx \ diff --git a/src/SALOMEDS/README_attributes b/src/SALOMEDS/README_attributes index b0c4ff789..51c13174b 100644 --- a/src/SALOMEDS/README_attributes +++ b/src/SALOMEDS/README_attributes @@ -1,5 +1,24 @@ +Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -$Header$ +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 +----------------------------------------- How to add a new attribute (without WOK): ----------------------------------------- diff --git a/src/SALOMEDS/SALOMEDS_AttLong_i.cxx b/src/SALOMEDS/SALOMEDS_AttLong_i.cxx index b126fe493..7aaeb5337 100644 --- a/src/SALOMEDS/SALOMEDS_AttLong_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttLong_i.cxx @@ -1,31 +1,30 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// 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. // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server // File : SALOMEDS_AttLong_i.cxx // Author : Estelle Deville // Module : SALOME // $Header$ - +// #include "SALOMEDS_AttLong_i.hxx" #include "utilities.h" #include diff --git a/src/SALOMEDS/SALOMEDS_AttLong_i.hxx b/src/SALOMEDS/SALOMEDS_AttLong_i.hxx index adb6acb0c..ad7084b20 100644 --- a/src/SALOMEDS/SALOMEDS_AttLong_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttLong_i.hxx @@ -1,31 +1,30 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// 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. // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server // File : SALOMEDS_AttLong_i.hxx // Author : Estelle Deville // Module : SALOME // $Header$ - +// #ifndef __SALOMEDS_ATTLONG_I_H__ #define __SALOMEDS_ATTLONG_I_H__ diff --git a/src/SALOMEDS/SALOMEDS_AttReal_i.cxx b/src/SALOMEDS/SALOMEDS_AttReal_i.cxx index 30740a810..d0475f246 100644 --- a/src/SALOMEDS/SALOMEDS_AttReal_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttReal_i.cxx @@ -1,31 +1,30 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// 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. // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server // File : SALOMEDS_AttReal_i.cxx // Author : Estelle Deville // Module : SALOME // $Header$ - +// #include "SALOMEDS_AttReal_i.hxx" #include "utilities.h" #include diff --git a/src/SALOMEDS/SALOMEDS_AttReal_i.hxx b/src/SALOMEDS/SALOMEDS_AttReal_i.hxx index 65fda690a..4eeb13ed8 100644 --- a/src/SALOMEDS/SALOMEDS_AttReal_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttReal_i.hxx @@ -1,31 +1,30 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// 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. // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server // File : SALOMEDS_AttReal_i.hxx // Author : Estelle Deville // Module : SALOME // $Header$ - +// #ifndef __SALOMEDS_ATTREAL_I_H__ #define __SALOMEDS_ATTREAL_I_H__ diff --git a/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.cxx b/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.cxx index e5f27882a..58ee4137c 100644 --- a/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.cxx +++ b/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.cxx @@ -1,31 +1,30 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// 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. // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server // File : SALOMEDS_BasicAttributeFactory.cxx // Author : Estelle Deville, CEA // Module : SALOME // $Header$ - +// #include "SALOMEDS_BasicAttributeFactory.hxx" #include "utilities.h" using namespace std; diff --git a/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.hxx b/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.hxx index 8ad0c9c9e..1034a2304 100644 --- a/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.hxx +++ b/src/SALOMEDS/SALOMEDS_BasicAttributeFactory.hxx @@ -1,31 +1,30 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// 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. // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server // File : SALOMEDS_BasicAttributeFactory.hxx // Author : Estelle Deville, CEA // Module : SALOME // $Header$ - +// #ifndef _BASIC_ATTRIBUTEFACTORY_HXX_ #define _BASIC_ATTRIBUTEFACTORY_HXX_ #include "SALOMEDS_BasicAttribute_i.hxx" diff --git a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx index 74dd4e85d..ba425bb2e 100644 --- a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.cxx @@ -1,31 +1,30 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// 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. // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server // File : SALOMEDS_BasicAttribute_i.cxx // Author : Estelle Deville, CEA // Module : SALOME // $Header$ - +// #include "SALOMEDS_BasicAttribute_i.hxx" using namespace std; diff --git a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx index b8902a902..237cd1123 100644 --- a/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_BasicAttribute_i.hxx @@ -1,31 +1,30 @@ -// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// 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. // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server // File : SALOMEDS_BasicAttribute_i.hxx // Author : Estelle Deville, CEA // Module : SALOME // $Header$ - +// #ifndef _BASIC_ATTRIBUTE_I_HXX_ #define _BASIC_ATTRIBUTE_I_HXX_ diff --git a/src/SALOMEDSImpl/Makefile.am b/src/SALOMEDSImpl/Makefile.am index 0c64eabaf..ae248dca8 100644 --- a/src/SALOMEDSImpl/Makefile.am +++ b/src/SALOMEDSImpl/Makefile.am @@ -220,5 +220,4 @@ bin_PROGRAMS = testDS testDS_SOURCES = testDS.cxx testDS_CPPFLAGS = $(COMMON_CPPFLAGS) testDS_LDADD = libSalomeDSImpl.la \ - ../HDFPersist/libSalomeHDFPersist.la \ $(HDF5_LIBS) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx index 61c51cacb..da906393c 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfInteger.cxx @@ -460,7 +460,7 @@ string SALOMEDSImpl_AttributeTableOfInteger::Save() aString += myRows[i][j]; aString += '\n'; } - } + } //Nb columns sprintf(buffer, "%d\n", myNbColumns); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx index 15cf6de0b..1b9dd68c6 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfReal.cxx @@ -446,7 +446,7 @@ string SALOMEDSImpl_AttributeTableOfReal::Save() aString += myTitle[i]; aString +='\n'; } - + //Nb rows sprintf(buffer, "%d\n", myNbRows); aString+=buffer; @@ -460,7 +460,7 @@ string SALOMEDSImpl_AttributeTableOfReal::Save() aString += myRows[i][j]; aString += '\n'; } - } + } //Nb columns sprintf(buffer, "%d\n", myNbColumns); @@ -485,7 +485,7 @@ string SALOMEDSImpl_AttributeTableOfReal::Save() sprintf(buffer, "%d\n%.64e\n", p->first, p->second); aString += buffer; } - + delete []buffer; return aString; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx index c92177c7d..f5872c4ad 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeTableOfString.cxx @@ -461,7 +461,7 @@ string SALOMEDSImpl_AttributeTableOfString::Save() aString += myRows[i][j]; aString += '\n'; } - } + } //Nb columns sprintf(buffer, "%d\n", myNbColumns); diff --git a/src/SALOMELocalTrace/FileTraceCollector.cxx b/src/SALOMELocalTrace/FileTraceCollector.cxx index 2e98daec6..4bf7c3356 100644 --- a/src/SALOMELocalTrace/FileTraceCollector.cxx +++ b/src/SALOMELocalTrace/FileTraceCollector.cxx @@ -29,8 +29,6 @@ #include #include -#include "utilities.h" - using namespace std; //#define _DEVDEBUG_ @@ -108,7 +106,7 @@ void* FileTraceCollector::run(void *bid) traceFile.open(theFileName, ios::out | ios::app); if (!traceFile) { - MESSAGE ( "impossible to open trace file "<< theFileName ); + cerr << "impossible to open trace file "<< theFileName << endl; exit (1); } @@ -137,11 +135,11 @@ void* FileTraceCollector::run(void *bid) traceFile.close(); cout << flush ; #ifndef WIN32 - MESSAGE ( "INTERRUPTION from thread " << myTrace.threadId - << " : " << myTrace.trace ); + cerr << "INTERRUPTION from thread " << myTrace.threadId + << " : " << myTrace.trace; #else - MESSAGE ( "INTERRUPTION from thread " << (void*)(&myTrace.threadId) - << " : " << myTrace.trace ); + cerr << "INTERRUPTION from thread " << (void*)(&myTrace.threadId) + << " : " << myTrace.trace; #endif cerr << flush ; exit(1); diff --git a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx index c3d65485a..1b384dc37 100644 --- a/src/SALOMELocalTrace/LocalTraceBufferPool.cxx +++ b/src/SALOMELocalTrace/LocalTraceBufferPool.cxx @@ -40,7 +40,6 @@ #include "BaseTraceCollector.hxx" #include "LocalTraceCollector.hxx" #include "FileTraceCollector.hxx" -#include "BasicsGenericDestructor.hxx" #include "utilities.h" using namespace std; @@ -133,9 +132,9 @@ LocalTraceBufferPool* LocalTraceBufferPool::instance() #endif if ( !TraceCollectorFactory ) { - MESSAGE ( "Can't resolve symbol: SingletonInstance" ); + cerr << "Can't resolve symbol: SingletonInstance" < #include #include -#include "utilities.h" using namespace std; @@ -104,10 +103,10 @@ void* LocalTraceCollector::run(void *bid) cout << flush ; #ifndef WIN32 cerr << "INTERRUPTION from thread " << myTrace.threadId - << " : " << myTrace.trace; + << " : " << myTrace.trace; #else cerr << "INTERRUPTION from thread " << (void*)(&myTrace.threadId) - << " : " << myTrace.trace; + << " : " << myTrace.trace; #endif cerr << flush ; exit(1); @@ -118,7 +117,8 @@ void* LocalTraceCollector::run(void *bid) #ifndef WIN32 cerr << "th. " << myTrace.threadId << " " << myTrace.trace; #else - cerr << "th. " << (void*)(&myTrace.threadId) << " " << myTrace.trace; + cerr << "th. " << (void*)(&myTrace.threadId) + << " " << myTrace.trace; #endif cerr << flush ; } @@ -146,7 +146,7 @@ LocalTraceCollector:: ~LocalTraceCollector() if (_threadId) { int ret = pthread_join(*_threadId, NULL); - if (ret) { MESSAGE ( "error close LocalTraceCollector : " << ret ); } + if (ret) cerr << "error close LocalTraceCollector : "<< ret << endl; else DEVTRACE("LocalTraceCollector destruction OK"); delete _threadId; _threadId = 0; diff --git a/src/SALOMELocalTrace/LocalTraceCollector.hxx b/src/SALOMELocalTrace/LocalTraceCollector.hxx index c6f0160f5..4cfd00b2c 100644 --- a/src/SALOMELocalTrace/LocalTraceCollector.hxx +++ b/src/SALOMELocalTrace/LocalTraceCollector.hxx @@ -29,7 +29,6 @@ #include "SALOME_LocalTrace.hxx" -#include #include "LocalTraceBufferPool.hxx" #include "BaseTraceCollector.hxx" diff --git a/src/TestMPIContainer/TestMPIContainer.cxx b/src/TestMPIContainer/TestMPIContainer.cxx index 19ec2ef20..e3e8c27e4 100644 --- a/src/TestMPIContainer/TestMPIContainer.cxx +++ b/src/TestMPIContainer/TestMPIContainer.cxx @@ -36,10 +36,11 @@ #include CORBA_CLIENT_HEADER(SALOME_MPIContainer) #include CORBA_CLIENT_HEADER(SALOME_TestMPIComponent) +#include "Basics_Utils.hxx" # include "Utils_ORB_INIT.hxx" # include "Utils_SINGLETON.hxx" #include "SALOME_NamingService.hxx" -#include "Basics_Utils.hxx" +#include "OpUtil.hxx" using namespace std; int main (int argc, char * argv[]) diff --git a/src/UnitTests/Makefile.am b/src/UnitTests/Makefile.am index 60aa17df2..3e64bf565 100644 --- a/src/UnitTests/Makefile.am +++ b/src/UnitTests/Makefile.am @@ -68,9 +68,7 @@ endif UnitTests_LDADD =\ @CPPUNIT_LIBS@ \ ../Basics/libSALOMEBasics.la \ - ../SALOMELocalTrace/libSALOMELocalTrace.la \ - ../SALOMELocalTrace/Test/libSALOMELocalTraceTest.la \ - ../HDFPersist/libSalomeHDFPersist.la + ../SALOMELocalTrace/libSALOMELocalTrace.la ../SALOMELocalTrace/Test/libSALOMELocalTraceTest.la if CORBA_GEN UnitTests_LDADD +=\ diff --git a/src/Utils/OpUtil.cxx b/src/Utils/OpUtil.cxx new file mode 100644 index 000000000..3d50327ab --- /dev/null +++ b/src/Utils/OpUtil.cxx @@ -0,0 +1,77 @@ +// 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 +// +// SALOME Utils : general SALOME's definitions and tools +// File : OpUtil.cxx +// Module : SALOME +// +#include "utilities.h" +#include "OpUtil.hxx" +#include +#include + +#ifndef WNT +#include +#else +#include +#endif +using namespace std; +//int gethostname(char *name, size_t len); + +std::string GetHostname() +{ + int ls = 100, r = 1; + char *s; + + while (ls < 10000 && r) { + ls *= 2; + s = new char[ls]; + r = gethostname(s, ls-1); + switch (r) + { + case 0: + break; + default: +#ifdef EINVAL + case EINVAL: +#endif +#ifdef ENAMETOOLONG + case ENAMETOOLONG: +#endif + delete [] s; + continue; + } + } + + if (r != 0) { + s = new char[50]; + strcpy(s, "localhost"); + } + + // remove all after '.' + char *aDot = (strchr(s,'.')); + if (aDot) aDot[0] = '\0'; + + string p = s; + delete [] s; + return p; +} +