DIST_SUBDIRS= salome_adm idl src doc bin resources
-DISTCLEANFILES = a.out
+DISTCLEANFILES = a.out local-install.sh
salomeinclude_DATA = KERNEL_version.h
runSalome \
runSalome.csh \
runSalome.ksh \
+ runSalome.bat \
waitNS.sh
# These files are python files
-#!/usr/bin/env python
+#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-#!/usr/bin/env python
+#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-#!/bin/sh
+#!/bin/bash
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#clean appli
-#
-rm -rf bin lib share doc idl env.d envd USERS getAppliPath.py searchFreePort.sh runAppli runConsole runSession runRemote.sh runTests SalomeApp.xml *.pyc *~ .bashrc
+
+DELCOM="rm -rf bin lib share doc idl env.d envd USERS getAppliPath.py searchFreePort.sh runAppli runConsole runSession runRemote.sh runTests SalomeApp.xml *.pyc *~ .bashrc"
+DOIT="false"
+
+if [ $# > 0 ]
+then
+ if [ "x$1" == "x-f" ]
+ then DOIT="true"
+ fi
+fi
+
+if [ $DOIT == "false" ]
+then
+ echo "Do you want to delete a SALOME application in this directory ? " `pwd`
+ echo "command to execute: " $DELCOM
+ echo "enter yes or no"
+ read ANSWER
+ echo "ANSWER="$ANSWER
+ if [ "x$ANSWER" == "xyes" ]
+ then
+ DOIT="true"
+ fi
+fi
+
+if [ $DOIT == "true" ]
+then
+ $DELCOM
+fi
-#!/usr/bin/env python
+#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
command="""
<parameter name="pyModules" value=""/>
<parameter name="embedded" value="SalomeAppEngine,study,cppContainer,registry,moduleCatalog"/>
- <parameter name="standalone" value="pyContainer,supervContainer"/>
+ <parameter name="standalone" value="pyContainer"/>
</section>
</document>
"""
VERSION=V3_2_0
-for module in KERNEL MED GUI GEOM SMESH VISU SUPERV LIGHT NETGENPLUGIN PYCALCULATOR;
+for module in KERNEL MED GUI GEOM SMESH VISU LIGHT NETGENPLUGIN PYCALCULATOR;
do
echo " ========= " ${module};
python virtual_salome.py -v --prefix="." --module=$INSTALL_ROOT/${module}_${VERSION}
<parameter name="xterm" value="no"/>
<parameter name="portkill" value="no"/>
<parameter name="killall" value="no"/>
- <parameter name="modules" value="GUI,GEOM,SMESH,VISU,SUPERV,MED,COMPONENT,LIGHT,PYHELLO,PYCALCULATOR"/>
+ <parameter name="modules" value="GUI,GEOM,SMESH,VISU,MED,COMPONENT,LIGHT,PYHELLO,PYCALCULATOR"/>
<parameter name="pyModules" value=""/>
<parameter name="embedded" value="SalomeAppEngine,cppContainer,registry,moduleCatalog,study"/>
<parameter name="standalone" value="pyContainer"/>
<parameter name="GEOM" value="${GEOM_ROOT_DIR}/share/salome/resources/geom"/>
<parameter name="SMESH" value="${SMESH_ROOT_DIR}/share/salome/resources/smesh"/>
<parameter name="VISU" value="${VISU_ROOT_DIR}/share/salome/resources/visu"/>
- <parameter name="SUPERV" value="${SUPERV_ROOT_DIR}/share/salome/resources/superv"/>
<parameter name="MED" value="${MED_ROOT_DIR}/share/salome/resources/med"/>
<parameter name="StdMeshers" value="${SMESH_ROOT_DIR}/share/salome/resources/smesh"/>
<parameter name="NETGENPlugin" value="${NETGENPLUGIN_ROOT_DIR}/share/salome/resources/netgenplugin"/>
<parameter name="name" value="Post-Pro"/>
<parameter name="icon" value="ModuleVisu.png"/>
</section>
- <section name="SUPERV">
- <parameter name="name" value="Supervisor"/>
- <parameter name="icon" value="ModuleSupervision.png"/>
- </section>
<section name="MED">
<parameter name="name" value="Med"/>
<parameter name="icon" value="ModuleMed.png"/>
export GEOM_ROOT_DIR=${REPINST}/GEOM_V301
export MED_ROOT_DIR=${REPINST}/MED_V301
export SMESH_ROOT_DIR=${REPINST}/SMESH_V301
-export SUPERV_ROOT_DIR=${REPINST}/SUPERV_V301
export VISU_ROOT_DIR=${REPINST}/VISU_V301
export NETGENPLUGIN_ROOT_DIR=${REPINST}/NETGENPLUGIN_V301
export COMPONENT_ROOT_DIR=${REPINST}/COMPONENT_V301
#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
APPLI_HOME=`dirname $0`
+NSPORT=last
+NSHOST=localhost
+
+usage()
+{
+ echo "Connect to a SALOME session (local or remote)"
+ echo ""
+ echo "Usage: $(basename $0) [ -p PORT ] [ -m MACHINE ] [ -h ] [command]"
+ echo ""
+ echo " -p PORT : The port to connect to "
+ echo " -m MACHINE : The machine to connect to "
+ echo " -h : Print this message"
+ echo " command : The command to execute in the SALOME session"
+ echo ""
+ echo "If the command is not given a shell is opened"
+ echo "If PORT and MACHINE are not given, try to connect to the last active session on the local machine"
+ echo "If PORT and MACHINE are given, try to connect to the remote session associated with PORT on MACHINE"
+ echo "If MACHINE is not given, try to connect to the session associated to PORT on the local machine"
+ echo "If PORT is not given, try to connect to the remote session associated to port 2810 on MACHINE"
+ echo ""
+}
+
+while getopts 'm:p:h' OPTION
+ do
+ case $OPTION in
+ m)NSHOST="$OPTARG" ;;
+ p)NSPORT="$OPTARG" ;;
+ h|?) usage
+ exit 1 ;;
+ esac
+ done
+shift $(($OPTIND - 1))
+
# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
export APPLI=`${APPLI_HOME}/getAppliPath.py`
. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
-if test "x$1" == "xNSPORT"; then
- NSPORT=$2
- export NSPORT
- myhost=`hostname`
- OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${myhost}_${NSPORT}.cfg
- export OMNIORB_CONFIG
- NSHOST=${myhost}
- export NSHOST
- shift 2
-else
-
- # --- set omniORB configuration to current session if any
-
- fileOmniConfig=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg
-
- if [ -f $fileOmniConfig ]; then
- OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg
+if test "x${NSPORT}" == "xlast"; then
+ #PORT is not given
+ if test "x${NSHOST}" == "xlocalhost"; then
+ #MACHINE and PORT are not given
+ # --- set omniORB configuration to current session if any
+ fileOmniConfig=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg
+ if [ -f $fileOmniConfig ]; then
+ OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg
+ export OMNIORB_CONFIG
+ # --- set environment variables for port and hostname of NamingService
+ NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host`
+ NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port`
+ export NSPORT
+ export NSHOST
+ fi
+ else
+ #MACHINE is given PORT is not given
+ NSPORT=2810
+ OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${NSHOST}_${NSPORT}.cfg
export OMNIORB_CONFIG
-
- # --- set environment variables for port and hostname of NamingService
-
- NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host`
- export NSHOST
- NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port`
+ #if omniorb config file exists do not override (perhaps too conservative)
+ if [ ! -f ${OMNIORB_CONFIG} ]; then
+ echo "InitRef = NameService=corbaname::${NSHOST}:${NSPORT}" > ${OMNIORB_CONFIG}
+ fi
export NSPORT
+ export NSHOST
+ fi
+else
+ #PORT is given
+ if test "x${NSHOST}" == "xlocalhost"; then
+ #MACHINE is not given PORT is given
+ NSHOST=`hostname`
+ fi
+ OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${NSHOST}_${NSPORT}.cfg
+ export OMNIORB_CONFIG
+ #if omniorb config file exists do not override (perhaps too conservative)
+ if [ ! -f ${OMNIORB_CONFIG} ]; then
+ echo "InitRef = NameService=corbaname::${NSHOST}:${NSPORT}" > ${OMNIORB_CONFIG}
fi
+ export NSPORT
+ export NSHOST
fi
# --- invoke shell with or without args
-#!/usr/bin/env python
+#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
#runSalome.set_env(args, modules_list, modules_root_dir)
setenv.main(True);
+if sys.platform == "win32":
+ if len(argv) >= 2:
+ # Fix a problem of spaces in argv[1]
+ argv[1] = '"%s"'%(argv[1])
+ pass
+ pass
+
os.execvp(argv[0],argv)
-#!/usr/bin/env python
+#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-#!/usr/bin/env python
+#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
test_nam = "test"
play_nam = "play"
gdb_session_nam = "gdb_session"
+ddd_session_nam = "ddd_session"
+shutdown_servers_nam = "shutdown_servers"
# values in XML configuration file giving specific module parameters (<module_name> section)
# which are stored in opts with key <module_name>_<parameter> (eg SMESH_plugins)
# possible choices for the "embedded" and "standalone" parameters
embedded_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "SalomeAppEngine" ]
-standalone_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "pyContainer", "supervContainer"]
+standalone_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "pyContainer"]
# values of boolean type (must be '0' or '1').
# xml_parser.boolValue() is used for correct setting
-boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam, pinter_nam )
+boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam, pinter_nam, shutdown_servers_nam )
intKeys = ( interp_nam, )
# values of list type
help_str = "Python script(s) to be imported. Python scripts are imported "
help_str += "in the order of their appearance. In GUI mode python scripts "
help_str += "are imported in the embedded python interpreter of current study, "
- help_str += "otherwise in an external python interpreter"
+ help_str += "otherwise in an external python interpreter. "
+ help_str += "Note: this option is obsolete. Instead you can pass Python script(s) "
+ help_str += "directly as positional parameter."
o_u = optparse.Option("-u",
"--execute",
metavar="<script1,script2,...>",
dest="gdb_session", default=False,
help=help_str)
+ # ddd session
+ help_str = "Launch session with ddd"
+ o_ddd = optparse.Option("--ddd-session",
+ action="store_true",
+ dest="ddd_session", default=False,
+ help=help_str)
+
+ # shutdown-servers. Default: False.
+ help_str = "1 to shutdown standalone servers when leaving python interpreter, "
+ help_str += "0 to keep the standalone servers as daemon [default]. "
+ help_str += "This option is only useful in batchmode "
+ help_str += "(terminal mode or without showing desktop)."
+ o_shutdown = optparse.Option("--shutdown-servers",
+ metavar="<1/0>",
+ #type="choice", choices=boolean_choices,
+ type="string",
+ action="callback", callback=store_boolean, callback_args=('shutdown_servers',),
+ dest="shutdown_servers",
+ help=help_str)
+
# All options
opt_list = [o_t,o_g, # GUI/Terminal
o_d,o_o, # Desktop
o_nspl,
o_test, # Write/read test script file with help of TestRecorder
o_play, # Reproducing test script with help of TestRecorder
- o_gdb]
+ o_gdb,
+ o_ddd,
+ o_shutdown,
+ ]
#std_options = ["gui", "desktop", "log_file", "py_scripts", "resources",
# "xterm", "modules", "embedded", "standalone",
opt_list += theAdditionalOptions
- a_usage = "%prog [options] [STUDY_FILE]"
+ a_usage = "%prog [options] [STUDY_FILE] [PYTHON_FILE [PYTHON_FILE ...]]"
version_str = "Salome %s" % version()
pars = optparse.OptionParser(usage=a_usage, version=version_str, option_list=opt_list)
if args["session_gui"]:
if cmd_opts.splash is not None:
args[splash_nam] = cmd_opts.splash
- if len(cmd_args) > 0:
- args["study_hdf"] = cmd_args[0]
else:
args["session_gui"] = False
args[splash_nam] = False
listlist = cmd_opts.py_scripts
for listi in listlist:
args[script_nam] += re.split( "[:;,]", listi)
+ for arg in cmd_args:
+ if arg[-3:] == ".py":
+ args[script_nam].append(arg)
+ elif not args["study_hdf"]:
+ args["study_hdf"] = arg
+ pass
+ pass
# xterm
if cmd_opts.xterm is not None: args[xterm_nam] = cmd_opts.xterm
if cmd_opts.gdb_session is not None:
args[gdb_session_nam] = cmd_opts.gdb_session
+ # Ddd session in xterm
+ if cmd_opts.ddd_session is not None:
+ args[ddd_session_nam] = cmd_opts.ddd_session
+
+ # Shutdown servers
+ if cmd_opts.shutdown_servers is None:
+ args[shutdown_servers_nam] = 0
+ else:
+ args[shutdown_servers_nam] = cmd_opts.shutdown_servers
+ pass
+
####################################################
# Add <theAdditionalOptions> values to args
for add_opt in theAdditionalOptions:
-#!/usr/bin/env python
+#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
#print "Can't create " + upath
pass
- #os.system("touch " + upath + "/dummy")
- for fname in os.listdir(upath):
- try:
- if not fname.startswith("."): os.remove(upath + "/" + fname)
- except:
- pass
- #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log")
-
if verbose(): print "Name Service... ",
#hname=os.environ["HOST"] #commands.getoutput("hostname")
if sys.platform == "win32":
#aPort=(ss.join().split(':'))[2];
#aPort=re.findall("\d+", ss[0])[0]
+ # \begin{E.A.}
+ # put the log files of omniNames in different directory with port reference,
+ # it is cleaner on linux and it is a fix for salome since it is impossible to
+ # remove the log files if the corresponding omniNames has not been killed.
+ # \end{E.A.}
+
+ upath += "/omniNames_%s"%(aPort)
+ try:
+ os.mkdir(upath)
+ except:
+ #print "Can't create " + upath
+ pass
+
+ #os.system("touch " + upath + "/dummy")
+ for fname in os.listdir(upath):
+ try:
+ os.remove(upath + "/" + fname)
+ except:
+ pass
+ #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log")
+
#aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/"
#print "sed command = ", aSedCommand
#aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"])
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# --------------------------------------------------------------------------
- def waitNS(self,name,typobj=None,maxcount=60):
+ def waitNS(self,name,typobj=None,maxcount=240):
count=0
delta=0.5
print "Searching %s in Naming Service " % name,
while(1):
count += 1
- if count > maxcount : raise "Impossible de trouver %s" % name
+ if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name
obj=self.Resolve(name)
if obj :
print " found in %s seconds " % ((count-1)*delta)
try:
os.kill(thePID,0)
except:
- raise "Process %d for %s not found" % (thePID,theName)
+ raise RuntimeError, "Process %d for %s not found" % (thePID,theName)
aCount += 1
anObj = self.Resolve(theName)
if anObj:
print "Searching %s in Naming Service " % name,
while(1):
count += 1
- if count > maxcount : raise "Impossible de trouver %s" % name
+ if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name
obj=self.ResolveLogger(name)
if obj :
print " found in %s seconds " % ((count-1)*delta)
#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# - if the config file does not exist, it is created with default values.
#
#
-# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,SUPERV,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer,supervContainer --xterm --killall
+# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer --xterm --killall
#
# parameters from command line supersede those from SalomeApp.xml
#
# (embedded = same process) or in a separate process (standalone):
# --> registry,study,moduleCatalog,cppContainer
# Other CORBA servers could only be launched in separate process (standalone):
-# --> pyContainer,supervContainer
+# --> pyContainer
#
# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h
# help
--- /dev/null
+@REM Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE\r
+@REM\r
+@REM Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+@REM CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS\r
+@REM\r
+@REM This library is free software; you can redistribute it and/or\r
+@REM modify it under the terms of the GNU Lesser General Public\r
+@REM License as published by the Free Software Foundation; either\r
+@REM version 2.1 of the License.\r
+@REM\r
+@REM This library is distributed in the hope that it will be useful,\r
+@REM but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+@REM Lesser General Public License for more details.\r
+@REM\r
+@REM You should have received a copy of the GNU Lesser General Public\r
+@REM License along with this library; if not, write to the Free Software\r
+@REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+@REM\r
+@REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+@REM\r
+\r
+@"%PYTHONBIN%" "%KERNEL_ROOT_DIR%\bin\salome\envSalome.py" "%PYTHONBIN%" "%KERNEL_ROOT_DIR%\bin\salome\runSalome.py" %*\r
#
-runSalome --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --killall
+runSalome --gui --modules=GEOM,SMESH,VISU,MED --killall
# - if the config file does not exist, it is created with default values.
#
#
-# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,SUPERV,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer,supervContainer --xterm --killall
+# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer --xterm --killall
#
# parameters from command line supersede those from SalomeApp.xml
#
# (embedded = same process) or in a separate process (standalone):
# --> registry,study,moduleCatalog,cppContainer
# Other CORBA servers could only be launched in separate process (standalone):
-# --> pyContainer,supervContainer
+# --> pyContainer
#
# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h
# help
#
# -----------------------------------------------------------------------------
# Example on CCRT (without ihm) :
-# ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --terminal --modules=MED,CALCULATOR,COMPONENT --standalone=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer --killall
+# ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --terminal --modules=MED,CALCULATOR,COMPONENT --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall
#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
import setenv
from server import *
from launchConfigureParser import verbose
-#process_id = {} move to server.py
+from server import process_id
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
#
-# Definition des classes d'objets pour le lancement des Server CORBA
+# Class definitions to launch CORBA Servers
#
class InterpServer(Server):
self.args=args
env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("LD_LIBRARY_PATH")]
self.CMD=['xterm', '-e']+ env_ld_library_path + ['python']
- #self.CMD=['xterm', '-e', 'python']
def run(self):
global process_id
# ---
-class ContainerSUPERVServer(Server):
- def __init__(self,args):
- self.args=args
- self.initArgs()
- # if sys.platform == "win32":
-# self.CMD=[os.environ["KERNEL_ROOT_DIR"] + "/win32/" + os.environ["BIN_ENV"] + "/" + 'SALOME_Container' + ".exe",'SuperVisionContainer']
-# else:
- self.CMD=['SALOME_Container','SuperVisionContainer']
-
-# ---
-
class LoggerServer(Server):
def __init__(self,args):
self.args=args
self.SCMD2+=['CPP']
if 'pyContainer' in self.args['standalone'] or 'pyContainer' in self.args['embedded']:
self.SCMD2+=['PY']
- if 'supervContainer' in self.args['standalone']:
- self.SCMD2+=['SUPERV']
if self.args['gui']:
session_gui = True
if self.args.has_key('session_gui'):
elif self.args.has_key('play'):
self.CMD+=['-play'] + self.args['play']
- if self.args["gdb_session"]:
+ if self.args["gdb_session"] or self.args["ddd_session"]:
f = open(".gdbinit4salome", "w")
f.write("set args ")
args = " ".join(self.CMD[1:])
f.write(args)
f.write("\n")
f.close()
- self.CMD = ["xterm", "-e", "gdb", "--command=.gdbinit4salome", self.CMD[0]]
+ if self.args["ddd_session"]:
+ self.CMD = ["ddd", "--command=.gdbinit4salome", self.CMD[0]]
+ elif self.args["gdb_session"]:
+ self.CMD = ["xterm", "-e", "gdb", "--command=.gdbinit4salome", self.CMD[0]]
+ pass
pass
# ---
import SALOME
import SALOMEDS
import SALOME_ModuleCatalog
- reload(Engines)
- reload(SALOME)
- reload(SALOMEDS)
import SALOME_Session_idl
session=clt.waitNS("/Kernel/Session",SALOME.Session)
session.GetInterface()
if verbose(): print "startSalome ", args
#
- # Initialisation ORB et Naming Service
+ # Initialisation ORB and Naming Service
#
clt=orbmodule.client(args)
f.write(os.environ['NSPORT'])
f.close()
- # (non obligatoire) Lancement Logger Server
- # et attente de sa disponibilite dans le naming service
+ # Launch Logger Server (optional)
+ # and wait until it is registered in naming service
#
if args['logger']:
myServer=NotifyServer(args,modules_root_dir)
myServer.run()
- # Lancement Session Server (to show splash ASAP)
+ # Launch Session Server (to show splash ASAP)
#
if args["gui"]:
mySessionServ.run()
#
- # Lancement Registry Server,
- # attente de la disponibilite du Registry dans le Naming Service
+ # Launch Registry Server,
+ # and wait until it is registered in naming service
#
if ('registry' not in args['embedded']) | (args["gui"] == 0) :
clt.waitNSPID("/Registry",myServer.PID)
#
- # Lancement Catalog Server,
- # attente de la disponibilite du Catalog Server dans le Naming Service
+ # Launch Catalog Server,
+ # and wait until it is registered in naming service
#
-
if ('moduleCatalog' not in args['embedded']) | (args["gui"] == 0):
cataServer=CatalogServer(args)
clt.waitNSPID("/Kernel/ModulCatalog",cataServer.PID,SALOME_ModuleCatalog.ModuleCatalog)
#
- # Lancement SalomeDS Server,
- # attente de la disponibilite du SalomeDS dans le Naming Service
+ # Launch SalomeDS Server,
+ # and wait until it is registered in naming service
#
#print "ARGS = ",args
clt.waitNSPID("/myStudyManager",myServer.PID)
#
- # Lancement LauncherServer
+ # Launch LauncherServer
#
myCmServer = LauncherServer(args)
theComputer = getShortHostName()
#
- # Lancement Container C++ local,
- # attente de la disponibilite du Container C++ local dans le Naming Service
+ # Launch local C++ Container (FactoryServer),
+ # and wait until it is registered in naming service
#
if ('cppContainer' in args['standalone']) | (args["gui"] == 0) :
clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",myServer.PID)
#
- # Lancement Container Python local,
- # attente de la disponibilite du Container Python local
- # dans le Naming Service
+ # Launch local Python Container (FactoryServerPy),
+ # and wait until it is registered in naming service
#
if 'pyContainer' in args['standalone']:
clt.waitNSPID("/Containers/" + theComputer + "/FactoryServerPy",myServer.PID)
#
- # Lancement Container Supervision local,
- # attente de la disponibilite du Container Supervision local
- # dans le Naming Service
- #
-
- if 'supervContainer' in args['standalone']:
- myServer=ContainerSUPERVServer(args)
- myServer.run()
- if sys.platform == "win32":
- clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer")
- else:
- clt.waitNSPID("/Containers/" + theComputer + "/SuperVisionContainer",myServer.PID)
-
- #
- # Attente de la disponibilite du Session Server dans le Naming Service
+ # Wait until Session Server is registered in naming service
#
if args["gui"]:
import SALOME
import SALOMEDS
import SALOME_ModuleCatalog
- reload(Engines)
- reload(SALOME)
- reload(SALOMEDS)
import SALOME_Session_idl
if sys.platform == "win32":
session=clt.waitNS("/Kernel/Session",SALOME.Session)
anInterp=InterpServer(args)
anInterp.run()
- # set PYTHONINSPECT variable
+ # set PYTHONINSPECT variable (python interpreter in interactive mode)
if args['pinter']:
os.environ["PYTHONINSPECT"]="1"
import readline
"""%filedict
#
- # Impression arborescence Naming Service
+ # Print Naming Service directory list
#
if clt != None:
clt.showNS()
pass
+ if not args['gui'] or not args['session_gui']:
+ if args['shutdown_servers']:
+ class __utils__(object):
+ def __init__(self, port):
+ self.port = port
+ import killSalomeWithPort
+ self.killSalomeWithPort = killSalomeWithPort
+ return
+ def __del__(self):
+ self.killSalomeWithPort.killMyPort(self.port)
+ return
+ pass
+ args['shutdown_servers'] = __utils__(args['port'])
+ pass
+ pass
+
# run python scripts, passed via --execute option
toimport = []
if args.has_key('pyscript'):
if toimport[ i ] == 'killall':
clt.showNS()
killAllPorts()
- import sys
sys.exit(0)
else:
scrname = toimport[ i ]
if len(scrname) > 2 and (len(scrname) - string.rfind(scrname, ".py") == 3):
print 'executing',scrname
+ sys.path.insert( 0, os.path.dirname(scrname))
execfile(scrname,globals())
+ del sys.path[0]
else:
print 'importing',scrname
doimport = 'import ' + scrname
os.remove( tmp_file );
#
def portIsUsed(port, data):
- regObj = re.compile( "tcp.*:([0-9]+).*:.*listen", re.IGNORECASE );
+ regObj = re.compile( ".*tcp.*:([0-9]+).*:.*listen", re.IGNORECASE );
for item in data:
try:
p = int(regObj.match(item).group(1))
msg = "\n"
msg += "Can't find a free port to launch omniNames\n"
msg += "Try to kill the running servers and then launch SALOME again.\n"
- raise msg
+ raise RuntimeError, msg
NSPORT=NSPORT+1
pass
return
def main():
"""Salome launch as a main application"""
- import sys
from salome_utils import getHostName
print "runSalome running on %s" % getHostName()
args, modules_list, modules_root_dir = setenv.get_config()
<plugin name="GHS3DPlugin"/>
</module>
<module name="VISU"/>
- <module name="SUPERV"/>
<module name="MED"/>
<module name="COMPONENT"/>
<module name="PYCALCULATOR"/>
</embedded-list>
<standalone-list>
<standaloneserver>pyContainer</standaloneserver>
- <standaloneserver>supervContainer</standaloneserver>
</standalone-list>
</Configuration-list>
#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
msg = ""
msg += "Can not find a free port to launch omniNames\n"
msg += "Kill the running servers and try again.\n"
- raise msg
+ raise RuntimeError, msg
NSPORT = NSPORT+1
pass
os.environ['NSHOST'] = hostname
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# ---
-def getPortNumber():
+def getPortNumber(use_default=True):
"""
Get current naming server port number:
1. try NSPORT environment variable
1. if fails, try to parse config file defined by OMNIORB_CONFIG environment variable
- 2. if fails, return 2809 as default port number
+ 2. if fails, return 2809 as default port number (if use_default is True) or None (id use_default is False)
"""
import os
try:
pass
port = getPortFromORBcfg()
if port is not None: return port
- return 2809 # '2809' is default port number
+ if use_default: return 2809 # '2809' is default port number
+ return None
# ---
# ---
-def makeTmpDir( path ):
+def makeTmpDir( path, mode=0777 ):
"""
Make temporary directory with the specified path.
If the directory exists then clear its contents.
Parameters:
- path : absolute path to the directory to be created.
+ - mode : access mode
"""
import os
-
if os.path.exists( path ):
- os.system( "rm -rf " + path + "/*" )
+ import sys
+ if sys.platform == "win32":
+ os.system( "rmdir /S /Q " + '"' + path + '"' )
+ os.system( "mkdir " + '"' + path + '"' )
+ else:
+ os.system( "rm -rf " + path + "/*" )
+ pass
pass
else:
- os.makedirs( path, 0777 )
- pass
+ dirs = path.split("/")
+ shift1 = shift2 = 0
+ if not dirs[0]: shift1 = 1
+ if dirs[-1]: shift2 = 1
+ for i in range(1+shift1,len(dirs)+shift2):
+ p = "/".join(dirs[:i])
+ try:
+ os.mkdir(p, mode)
+ os.chmod(p, mode)
+ except:
+ pass
+ pass
+ pass
+ pass
# ---
dest.writelines( dest_lines )
dest.close()
- command = "cat " + src_file + " >> " + dest_file
+ import sys
+ if sys.platform == "win32":
+ command = "type " + '"' + src_file + '"' + " >> " + '"' + dest_file + '"'
+ else:
+ command = "cat " + src_file + " >> " + dest_file
+ pass
pass
else:
- command = "cp " + src_file + " " + dest_file
+ import sys
+ if sys.platform == "win32":
+ command = "copy " + '"' + src_file + '"' + " " + '"' + dest_file + '"' + " > nul"
+ else:
+ command = "cp " + src_file + " " + dest_file
+ pass
pass
os.system( command )
#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
modules_list.remove("GUI")
pass
- if "SUPERV" in modules_list and not 'supervContainer' in args['standalone']:
- args['standalone'].append("supervContainer")
- pass
-
return args, modules_list, modules_root_dir
# -----------------------------------------------------------------------------
"""Add to the PATH-variables modules specific paths"""
import os
- from salome_utils import getTmpDir, generateFileName, makeTmpDir
+ from salome_utils import getTmpDir, generateFileName, makeTmpDir, getPortNumber
# create temporary directory for environment files needed by modules from the list
- tmp_dir = getTmpDir()
- env_dir = generateFileName(tmp_dir, prefix="env", with_port=True)
- makeTmpDir(env_dir)
+ port = getPortNumber(False)
+ if port:
+ tmp_dir = getTmpDir()
+ env_dir = generateFileName(tmp_dir, prefix="env", with_port=True)
+ makeTmpDir(env_dir)
+ pass
python_version="python%d.%d" % sys.version_info[0:2]
modules_root_dir_list = []
salome_subdir,
"shared_modules"),
"PYTHONPATH")
-
+
# set environment by modules from the list
- try:
- mod=__import__(module.lower()+"_setenv")
- mod.set_env(args)
- pass
- except:
+ if port:
+ try:
+ mod=__import__(module.lower()+"_setenv")
+ mod.set_env(args)
+ pass
+ except:
+ pass
pass
pass
pass
if args['logger']:
os.environ["SALOME_trace"]="with_logger"
- # set environment for SUPERV module
- os.environ["ENABLE_MACRO_NODE"]="1"
# set resources variables if not yet set
- # Done now by launchConfigureParser.py
- #if os.getenv("GUI_ROOT_DIR"):
- #if not os.getenv("SalomeAppConfig"): os.environ["SalomeAppConfig"] = os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui"
os.environ["CSF_SALOMEDS_ResourcesDefaults"] \
= os.path.join(modules_root_dir["KERNEL"],"share",
#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# ================================================================
#AC_PREREQ(2.59)
#
-AC_INIT([Salome2 Project], [5.1.1], [paul.rascle@edf.fr], [SalomeKERNEL])
+AC_INIT([Salome2 Project], [5.1.3], [paul.rascle@edf.fr], [SalomeKERNEL])
# AC_CONFIG_AUX_DIR defines an alternative directory where to find the auxiliary
# scripts such as config.guess, install-sh, ...
AC_CONFIG_AUX_DIR(salome_adm/unix/config_files)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
-AM_INIT_AUTOMAKE([tar-pax])
+AM_INIT_AUTOMAKE([tar-pax -Wno-portability])
#AC_CONFIG_HEADER([config.h])
XVERSION=`echo $VERSION | awk -F. '{printf("0x%02x%02x%02x",$1,$2,$3)}'`
esac],[corba_gen=true])
AM_CONDITIONAL(CORBA_GEN, test x$corba_gen = xtrue)
-# ---- option to build only launcher, resources manager and batch classes
+# ---- option to build only launcher and resources manager
AC_ARG_WITH(onlylauncher,
- --with-onlylauncher,
- [],[with_onlylauncher="no"])
+ [AC_HELP_STRING([--with-onlylauncher],[Build only launcher and resources manager [default=no]])],
+ [],
+ [with_onlylauncher="no"])
AM_CONDITIONAL(WITHONLYLAUNCHER, test x$with_onlylauncher = xyes)
+if test "$with_onlylauncher" != "yes"; then
+ AC_DEFINE([HAVE_SALOME_CONFIG], [], [True if SALOMEconfig.h file is used])
+fi
# ----------------------------------------------------------------------------
echo
AC_PROG_MAKE_SET
AC_PROG_INSTALL
+AC_LOCAL_INSTALL
echo
echo ---------------------------------------------
cc_ok=no
AC_PROG_CC
AC_PROG_CXX
+AC_LANG(C++)
AC_CXX_WARNINGS
AC_CXX_TEMPLATE_OPTIONS
AC_DEPEND_FLAG
# Testing linker
AC_LINKER_OPTIONS
+echo
+echo ---------------------------------------------
+echo testing Fortran INTEGER size for CALCIUM
+echo ---------------------------------------------
+echo
+
+CHECK_CALCIUM
+
echo
echo ---------------------------------------------
echo testing threads
echo ============================================================
echo
-echo
-echo ---------------------------------------------
-echo Testing Batch
-echo ---------------------------------------------
-echo
-
-dnl Several batch systems (OpenPBS, LSF, ...) can be operated using
-dnl the Batch classes library integrated in the KERNEL module. The
-dnl checking process tests here the presence of underlying batch
-dnl softwares. If none is detected, the KERNEL is declared to be
-dnl "without batch".
-
-echo testing OpenPBS
-echo ---------------
-openpbs_ok=no
-CHECK_OPENPBS
-dnl openpbs_ok is set to yes by CHECK_OPENPBS
-
-echo testing LSF
-echo -----------
-lsf_ok=no
-CHECK_LSF
-dnl lsf_ok is set to yes by CHECK_LSF
-echo lsf = $lsf_ok
-
-echo testing Local batch system
-echo --------------------------
-localbatch_ok=no
-CHECK_LOCAL
-dnl localbatch_ok is set to yes by CHECK_LOCAL
-
-WITH_BATCH=no
-test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes
-
-AC_ARG_ENABLE(batch,
- [AC_HELP_STRING([--enable-batch],[Batch [default=yes]])],
- [case "${enableval}" in
- yes) test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes;;
- no) WITH_BATCH=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-batch) ;;
- esac],[test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes])
-
-echo Batch mode = $WITH_BATCH
-
-AC_SUBST(WITH_BATCH)
-AM_CONDITIONAL(WITH_BATCH, [test x"$WITH_BATCH" = xyes])
-
echo
echo ----------------------------------------------
echo testing CPPUNIT only required for unit testing
echo
CHECK_CPPUNIT
+echo
+echo --------------------------------------------------------------
+echo Testing libBatch only required for batch functions in Launcher
+echo --------------------------------------------------------------
+echo
+
+CHECK_LIBBATCH
+AM_CONDITIONAL(WITH_LIBBATCH, [test x"$libbatch_ok" = xyes])
+
echo
echo ============================================================
echo testing products required only for documentation generation
CHECK_HTML_GENERATORS
# Additional conditional to avoid compilation of non-portable code
-AM_CONDITIONAL(WINDOWS, 0)
+AM_CONDITIONAL(WINDOWS, [ test ])
echo
echo ============================================================
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
summary $parallel_products
echo
-optional_products="cppunit_ok openpbs_ok lsf_ok numpy_ok"
+optional_products="cppunit_ok numpy_ok libbatch_ok"
echo --- Optional products:
echo [" These products are optional because the KERNEL functions"]
echo [" using them are built only if the products are detected."]
summary $optional_products
echo
+if test x$libbatch_ok = xno; then
+ echo [" Warning: Batch functions will not be available in"]
+ echo [" Salome Launcher because they require libBatch."]
+ echo
+fi
htmldoc_products="doxygen_ok graphviz_ok rst2html_ok"
# autoscan, the Makefile list is generated in the output file configure.scan.
# This could be helpfull to update de configuration.
AC_OUTPUT([ \
- ./KERNEL_version.h \
- ./salome_adm/unix/SALOMEconfig.ref \
- ./salome_adm/Makefile \
- ./salome_adm/cmake_files/Makefile \
- ./salome_adm/unix/Makefile \
- ./salome_adm/unix/config_files/Makefile \
- Makefile \
- ./bin/Makefile \
- ./bin/VERSION \
- ./doc/Makefile \
- ./doc/salome/Makefile \
- ./doc/salome/tui/Makefile \
- ./doc/salome/tui/doxyfile \
- ./doc/salome/gui/Makefile \
- ./doc/salome/gui/doxyfile \
- ./idl/Makefile \
- ./resources/Makefile \
- ./resources/KERNELCatalog.xml \
- ./resources/CatalogResources.xml \
- ./src/Makefile \
- ./src/Basics/Makefile \
- ./src/Basics/Test/Makefile \
- ./src/Batch/Makefile \
- ./src/Batch_SWIG/Makefile \
- ./src/Communication/Makefile \
- ./src/Communication_SWIG/Makefile \
- ./src/Container/Makefile \
- ./src/ParallelContainer/Makefile \
- ./src/DF/Makefile \
- ./src/DSC/Makefile \
- ./src/DSC/DSC_Basic/Makefile \
- ./src/DSC/DSC_User/Makefile \
- ./src/DSC/DSC_User/Basic/Makefile \
- ./src/DSC/DSC_User/Datastream/Makefile \
- ./src/DSC/DSC_User/Datastream/Palm/Makefile \
- ./src/DSC/DSC_User/Datastream/Calcium/Makefile \
- ./src/DSC/ParallelDSC/Makefile \
- ./src/DSC/DSC_Python/Makefile \
- ./src/GenericObj/Makefile \
- ./src/HDFPersist/Makefile \
- ./src/KERNEL_PY/Makefile \
- ./src/Launcher/Makefile \
- ./src/LifeCycleCORBA/Makefile \
- ./src/LifeCycleCORBA/Test/Makefile \
- ./src/LifeCycleCORBA_SWIG/Makefile \
- ./src/LifeCycleCORBA_SWIG/Test/Makefile \
- ./src/Logger/Makefile \
- ./src/Logger/Test/Makefile \
- ./src/ModuleCatalog/Makefile \
- ./src/ModuleGenerator/Makefile \
- ./src/ModuleGenerator/testIDLparser \
- ./src/MPIContainer/Makefile \
- ./src/NamingService/Makefile \
- ./src/NamingService/Test/Makefile \
- ./src/Notification/Makefile \
- ./src/NOTIFICATION_SWIG/Makefile \
- ./src/Registry/Makefile \
- ./src/ResourcesManager/Makefile \
- ./src/SALOMEDS/Makefile \
- ./src/SALOMEDS/Test/Makefile \
- ./src/SALOMEDSClient/Makefile \
- ./src/SALOMEDSImpl/Makefile \
- ./src/SALOMEDSImpl/Test/Makefile \
- ./src/SALOMELocalTrace/Makefile \
- ./src/SALOMELocalTrace/Test/Makefile \
- ./src/SALOMETraceCollector/Makefile \
- ./src/SALOMETraceCollector/Test/Makefile \
- ./src/TestContainer/Makefile \
- ./src/TestMPIContainer/Makefile \
- ./src/TOOLSDS/Makefile \
- ./src/UnitTests/Makefile \
- ./src/Utils/Makefile \
- ./src/Utils/Test/Makefile \
+ KERNEL_version.h \
+ salome_adm/unix/SALOMEconfig.ref \
+ salome_adm/Makefile \
+ salome_adm/cmake_files/Makefile \
+ salome_adm/unix/Makefile \
+ salome_adm/unix/config_files/Makefile \
+ Makefile \
+ bin/Makefile \
+ bin/VERSION \
+ doc/Makefile \
+ doc/salome/Makefile \
+ doc/salome/tui/Makefile \
+ doc/salome/tui/doxyfile \
+ doc/salome/gui/Makefile \
+ doc/salome/gui/doxyfile \
+ idl/Makefile \
+ idl/Calcium_Ports.idl \
+ resources/Makefile \
+ resources/KERNELCatalog.xml \
+ resources/CatalogResources.xml \
+ src/Makefile \
+ src/Basics/Makefile \
+ src/Basics/Test/Makefile \
+ src/Communication/Makefile \
+ src/Communication_SWIG/Makefile \
+ src/Container/Makefile \
+ src/ParallelContainer/Makefile \
+ src/DF/Makefile \
+ src/DSC/Makefile \
+ src/DSC/DSC_Basic/Makefile \
+ src/DSC/DSC_User/Makefile \
+ src/DSC/DSC_User/Basic/Makefile \
+ src/DSC/DSC_User/Datastream/Makefile \
+ src/DSC/DSC_User/Datastream/Palm/Makefile \
+ src/DSC/DSC_User/Datastream/Calcium/Makefile \
+ src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx \
+ src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx \
+ src/DSC/DSC_User/Datastream/Calcium/CalciumFortranInt.h \
+ src/DSC/ParallelDSC/Makefile \
+ src/DSC/DSC_Python/Makefile \
+ src/GenericObj/Makefile \
+ src/HDFPersist/Makefile \
+ src/KERNEL_PY/Makefile \
+ src/Launcher/Makefile \
+ src/LifeCycleCORBA/Makefile \
+ src/LifeCycleCORBA/Test/Makefile \
+ src/LifeCycleCORBA_SWIG/Makefile \
+ src/LifeCycleCORBA_SWIG/Test/Makefile \
+ src/Logger/Makefile \
+ src/Logger/Test/Makefile \
+ src/ModuleCatalog/Makefile \
+ src/ModuleGenerator/Makefile \
+ src/ModuleGenerator/testIDLparser \
+ src/MPIContainer/Makefile \
+ src/NamingService/Makefile \
+ src/NamingService/Test/Makefile \
+ src/Notification/Makefile \
+ src/NOTIFICATION_SWIG/Makefile \
+ src/Registry/Makefile \
+ src/ResourcesManager/Makefile \
+ src/SALOMEDS/Makefile \
+ src/SALOMEDS/Test/Makefile \
+ src/SALOMEDSClient/Makefile \
+ src/SALOMEDSImpl/Makefile \
+ src/SALOMEDSImpl/Test/Makefile \
+ src/SALOMELocalTrace/Makefile \
+ src/SALOMELocalTrace/Test/Makefile \
+ src/SALOMETraceCollector/Makefile \
+ src/SALOMETraceCollector/Test/Makefile \
+ src/TestContainer/Makefile \
+ src/TestMPIContainer/Makefile \
+ src/TOOLSDS/Makefile \
+ src/UnitTests/Makefile \
+ src/Utils/Makefile \
+ src/Utils/Test/Makefile \
])
+++ /dev/null
-\input texinfo @c -*-texinfo-*-
-@c %**start of header
-@setfilename Batch.info
-@settitle Documentation de Batch
-@setchapternewpage odd
-@iftex
-@afourpaper
-@end iftex
-
-@include version.texi
-
-@dircategory Bibliotheque de classes Batch
-@direntry
-* Batch: (Batch); Documentation de la bibliotheque de classes Batch.
-@end direntry
-
-@c %**end of header
-
-
-
-@titlepage
-@sp 10
-@comment The title is printed in a large font.
-@title Bibliotheque de classes Batch
-@subtitle Documentation - version @value{VERSION}
-@subtitle @value{UPDATED}
-@author Ivan DUTKA-MALEN - EDF R&D
-
-@c The following two commands start the copyright page.
-@page
-@vskip 0pt plus 1filll
-Copyright @copyright{} 2003-2004 EDF R&D sous licence GPL
-@end titlepage
-
-@contents
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Top, Description, Index , (dir)
-@comment node-name, next, previous, up
-@ifinfo
-Copyright @copyright{} 2003-2004 EDF R&D sous licence GPL
-@end ifinfo
-
-@unnumbered Introduction
-
-Ceci est la documentation de la bibliotheque de classes Batch version
-@value{VERSION}.
-
-Ce manuel est normalement disponible sous la forme de fichiers
-@file{.info}, PostScript @file{.ps}, PDF @file{.pdf} et HTML
-@file{.html}. Merci a Texinfo.
-
-
-@menu
-* Description:: Le batch, c'est quoi ? Ca sert a quoi ?
-* Classes:: Une description des classes internes.
-* Utilisation:: Comment on s'en sert ? Quelques exemples.
-* Installation de la bibliotheque:: Comment ca s'installe ?
-* Divers:: D'autres petits details.
-* Index:: Index generaux.
-@end menu
-
-
-
-
-
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Description, Classes, Top, Top
-@comment node-name, next, previous, up
-@chapter Description Generale
-@cindex description
-
-Dans le domaine du batch, nombreux sont les gestionnaires qui sont
-apparus et se sont popularises en fonction des plates-formes et des
-constructeurs. On peut notamment citer NQS, le premier de tous, LSF,
-LoadLeveler, PBS (et ses derives OpenPBS et PBS Pro), etc. qui se
-prevalent tous d'une compatibilite avec NQS.
-
-Si l'ensemble de ces produits offrent les fonctionnalites de base de
-NQS, a savoir soumission, controle, destruction, modification, etc. de
-travaux batch, ils se distinguent tous par leur incompatibilite mutuelle
-et par les syntaxes de fichiers et les appels de fonction specifiques
-qu'ils ont developpes.
-
-Or il est interessant de pouvoir acceder d'une facon homogene et
-generique aux fonctionnalites de ces gestionnaires quitte a se
-restreindre a un sous-ensemble minimal mais essentiel de leurs
-possibilites.
-
-La bibliotheque de classes Batch fournit ce moyen de soumettre et
-controler des travaux batch depuis une machine cliente sans s'occuper du
-type de gestionnaire present sur le serveur sur lequel se deroule
-l'execution du travail. Seul doit etre precise le nom du serveur sur
-lequel sera soumis le travail batch et le type de gestionnaire qui s'y
-trouve. Tout le reste est generique et ne depend plus de l'implementation.
-
-
-
-
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classes, Terminologie, Description, Top
-@comment node-name, next, previous, up
-@chapter Classes Internes
-@cindex classe
-
-Les classes de la bibliotheque reposent sur des concepts issus du monde
-de la gestion de batch, qui meritent d'etre reprecises pour ne pas
-introduire d'ambiguite semantique dans le discours.
-
-@menu
-* Terminologie:: Description des termes employes.
-* Classes generiques:: Les classes communes a tous les gestionnaires.
-* Classes specifiques:: Les classes d'implementation.
-@end menu
-
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Terminologie, Batch, Classes, Classes
-@comment node-name, next, previous, up
-@section Terminologie
-@cindex terminologie
-
-Pour les non-inities aux mysteres de la gestion de batch, un petit
-glossaire des termes employes dans cette documentation, assaisonne a la
-sauce de la bibliotheque de classes Batch.
-
-@menu
-* Batch:: Gestion par lots, execution differee.
-* BatchManager:: Gestionnaire de batch.
-* Job:: Travail.
-* Parametre:: Configuration de l'execution.
-* Environnement:: Environnement d'execution.
-* JobId:: Identifiant de travail.
-* JobInfo:: Informations sur le travail.
-@end menu
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Batch, BatchManager, Terminologie, Terminologie
-@comment node-name, next, previous, up
-@subsection Batch
-@cindex batch
-
-Le traitement batch (batch processing en anglais), ou traitement par
-lot, fait reference au mode de sequencage et d'utilisation des
-ressources d'un calculateur tel qu'il a ete premierement employe dans
-les debuts de l'ere informatique. Mais il faut preciser que cette
-anteriorite ne condamne pas le traitement batch aux oubliettes au motif
-d'une quelconque obsolescence. Si le traitement par lot a vu le jour et
-existe encore aujourd'hui, c'est parce qu'il repond de maniere
-satisfaisante a une certaine utilisation des ressources d'un
-calculateur, et que cette utilisation est encore d'actualite. Present
-depuis plus de quarante ans, le batch est encore largement utilise sur
-les grands serveurs, et le sera vraisemblablement pour quelques annees
-encore.
-
-Le traitement par lot se distingue de l'execution interactive par le
-fait que les travaux a effectuer sont places dans une file d'attente
-avec une indication pour chaque lot des ressources dont il doit disposer
-pour aboutir correctement. Une fois les travaux inscrits dans la file,
-c'est au systeme de traitement batch (@xref{BatchManager}.) de veiller a
-leur bonne execution en leur fournissant les ressources demandees. Tout
-travail qui ne disposerait pas des ressources adequates ne peut pas etre
-active.
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node BatchManager, Job, Batch, Terminologie
-@comment node-name, next, previous, up
-@subsection Batch Manager
-@cindex batch manager
-@cindex gestionnaire
-
-Le role du gestionnaire de batch, ou batch manager en anglais, est
-d'executer et eventuellement d'ordonner les travaux places en file
-d'attente en leur allouant exclusivement les ressources necessaires a
-leur execution. Son objectif est d'optimiser les ressources du systeme
-dont il a la charge de maniere a ecouler le maximum de travaux en un
-minimum de temps et un minimum de ressources materielles.
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Job, Parametre, BatchManager, Terminologie
-@comment node-name, next, previous, up
-@subsection Job
-@cindex Job
-@cindex travail
-
-Le travail, ou job en anglais, est l'unite elementaire de traitement qui
-peut etre soumis au gestionnaire de batch. Il peut s'agir d'une simple
-commande systeme, comme d'une application ou bien meme de l'enchainement
-complexe mais indivisible de plusieurs applications ou commandes.
-
-Pour s'executer correctement, c'est-a-dire sans erreur, le job doit
-disposer de certaines ressources --- de la memoire, du temps, de
-l'espace disque @dots{} --- pendant toute la duree de son
-execution. C'est au gestionnaire de batch (@xref{BatchManager}.) de
-garantir au job la presence et la persistence de ces ressources pendant
-l'execution du job.
-
-Par contre c'est a l'utilisateur qui soumet le job d'informer le
-gestionnaire de batch des ressources necessaires au job. Pour des
-raisons evidentes de bonne gestion des ressources, le job ne peut
-consommer plus de ressources que celles qu'il a demande et obtenu du
-gestionnaire de batch sans etre arrete ou reclasse.
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Parametre, Environnement, Job, Terminologie
-@comment node-name, next, previous, up
-@subsection Parametre
-@cindex parametre
-
-Le premier type de ressource necessaire a un job concerne les elements
-materiels ou temporels, en un mot, physiques. Parmi ces ressources, on
-trouve le temps de calcul, le temps de presence en machine, l'espace
-disque, la quantite de memoire vive, l'architecture du calculateur, etc.
-
-Dans la terminologie de la bibliotheque de classes Batch, tous ces
-elements ont ete regroupes sous le terme de @emph{Parametre}.
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Environnement, JobId, Parametre, Terminologie
-@comment node-name, next, previous, up
-@subsection Environnement
-@cindex environnement
-
-Le second type de ressource necessaire a un job concerne les elements
-logiciels. Cela se traduit le plus souvent, et particulierement, dans
-les systemes Unix par la notion de variable d'environnement. Lorsque le
-job s'execute, il doit pouvoir trouver l'ensemble des commandes et des
-applications auquel il souhaite faire appel. Les variables
-d'environnement decrivent donc les localisations des ces
-programmes. Elles peuvent egalement contenir des informations influant
-sur le comportement des programmes.
-
-Dans la terminologie de la bibliotheque de classes Batch, tous ces
-elements on ete regroupes sous le terme de @emph{Environnement}.
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node JobId, JobInfo, Environnement, Terminologie
-@comment node-name, next, previous, up
-@subsection JobId
-@cindex jobid
-@cindex identifier
-
-Si un job (@xref{Job}.) decrit les actions qui doivent etre effectues
-par le systeme sous le controle du gestionnaire de batch, il est clair
-qu'il est possible de soumettre plusieurs fois de suite le meme job, et
-par la-meme d'executer plusieurs fois (et parfois simultanement) ces
-memes actions. On a donc plusieurs instances du meme job qui sont
-presentes en machine. Chaque instance peut etre distinguee des autres
-par un identifiant unique qui lui est propre : c'est le @emph{jobId}.
-
-Le JobId est determine par le gestionnaire de batch au moment de la
-soumission.
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node JobInfo, Classes generiques, JobId, Terminologie
-@comment node-name, next, previous, up
-@subsection JobInfo
-@cindex jobinfo
-
-
-Des qu'un job (@xref{Job}.) est soumis donc des qu'il dispose d'un
-JobId (@xref{JobId}.), il est possible d'interroger le gestionnaire de
-batch pour etre informe de son comportement, de son evolution au sein du
-systeme pendant son execution.
-
-On peut ainsi connaitre les parametres reellement consommes par rapport
-aux parametres alloues, ainsi que l'environnement d'execution du job.
-
-Le JobInfo est une structure qui collecte ses informations sur l'etat du
-job.
-
-
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classes generiques, Namespace, JobInfo, Classes
-@comment node-name, next, previous, up
-@section Classes generiques
-@cindex classes generiques
-
-Schematiquement, les classes composant la bibliotheque sont regroupees
-en trois categories. Celles appartenant au groupe @emph{Types de base}
-ne servent que de support au fonctionnement des classes de plus haut
-niveau, egalement appellees @emph{Classes utilisateur}. Seules ces
-dernieres sont vraiment interessantes pour l'utilisateur de la
-bibliotheque. Les exceptions sont regroupees dans une categorie qui leur
-est propre.
-
-@menu
-* Namespace:: Espace de noms pour la bibliotheque.
-* Types de base:: Les classes elementaires.
-* Classes utilisateur:: Les classes de haut-niveau.
-* Exceptions:: Les exceptions de la bibliotheque.
-@end menu
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Namespace, Types de base, Classes generiques, Classes generiques
-@comment node-name, next, previous, up
-@subsection Namespace
-@cindex namespace
-
-Toutes les classes de la bibliotheque sont regroupees dans un unique
-namespace nomme @emph{Batch} afin de ne pas introduire de conflit avec
-d'autres classes de meme nom.
-
-Ainsi lorsque par exemple on cite la classe @emph{BatchManager}, il
-faudra declarer un objet @emph{Batch::BatchManager} ou bien faire appel
-au namespace @emph{Batch} en C++. En Python, les objets sont regroupes
-dans un module nomme @emph{libBatch_Swig}.
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Types de base, Classe Couple, Namespace, Classes generiques
-@comment node-name, next, previous, up
-@subsection Types de base
-@cindex types de base
-
-Les classes decrites ici sont toutes utilisees ou utilisables par les
-classes utilisateur de la bibliotheque, et en particulier par la classe
-Versatile. @xref{Classe Versatile}.
-
-Ces classes implementent sous forme d'objet les types de base du langage
-C++. Ainsi la classe @emph{Booltype} implemente le type de base
-@emph{bool}. Certains types de base n'existant pas dans le langage ont
-ete crees et encapsules dans une classe : c'est le cas notamment du type
-de base @emph{Date} et de la classe @emph{DateType}, et du type de base
-@emph{Couple} et de la classe @emph{CoupleType}.
-
-Tous les classes heritent de la classe generique @emph{GenericType}.
-
-@menu
--- Types de base --
-
-* Classe Couple:: Association de fichiers.
-* Classe Date:: Type elementaire de date.
-
--- Classes d'implementation des types de base --
-
-* Classe GenericType:: Classe-mere de tous les types.
-* Classe BoolType:: Encapsulation du type bool.
-* Classe CharType:: Encapsulation du type char.
-* Classe CoupleType:: Encapsulation du type Couple.
-* Classe DateType:: Encapsulation du type Date.
-* Classe IntType:: Encapsulation du type int.
-* Classe LongType:: Encapsulation du type long.
-* Classe StringType:: Encapsulation du type string.
-
-@end menu
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe Couple, Classe Date, Types de base, Types de base
-@comment node-name, next, previous, up
-@page
-@subsubsection Couple
-@findex Couple
-
-La classe @emph{Couple} implemente le comportement d'un couple de deux
-chaines de type @emph{string} qui sont respectivement nommees
-@emph{local} et @emph{remote}.
-
-Cette classe est utilisee essentiellement pour la designation des
-fichiers a transferer lors des soumissions de travaux, d'ou les noms
-employes.
-
-@cartouche
-Il faut toutefois faire attention a designer correctement ce qui est
-local ou distant. Ainsi dans la bibliotheque de classes Batch, on a
-adopte la convention qu'un fichier dit @emph{local} est celui present
-sur la machine qui execute la bibliotheque de classes Batch, alors qu'un
-fichier dit @emph{remote} (ou distant) est celui present sur le serveur
-du gestionnaire de batch.
-L'approche est donc clairement orientee utilisateur plutot que serveur.
-@end cartouche
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class Couple
-@{
- public:
- // Constructeur standard
- Couple(const string & local, const string & remote);
-
- // Constructeur par recopie
- Couple(const Couple & C);
-
- // Operateur pour l'affichage sur un stream
- friend ostream & operator << (ostream & os, const Couple & cp);
-
- // Operateur d'affectation
- virtual Couple & operator =(const Couple &);
-
- // Conversion en chaine
- virtual string str() const;
-
- // Accesseurs
- virtual string getLocal() const;
- virtual string getRemote() const;
-
- protected:
- string _local; // chemin d'acces au fichier local
- string _remote; // chemin d'acees au fichier distant
-
- private:
-
-@};
-@end example
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe Date, Classe GenericType, Classe Couple, Types de base
-@comment node-name, next, previous, up
-@page
-@subsubsection Date
-@findex Date
-
-La classe @emph{Date} sert a stocker n'importe quelle information de
-temps et peut la representer sous une forme plus lisible a l'utilisateur
-que le traditionnel appel a la fonction @emph{ctime}. @xref{(*manpages*)ctime}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class Date
-@{
- public:
- // Constructeur standard (a partir d'une valeur epoch)
- Date(const long l=0);
-
- // Constructeur a partir d'une chaine hh:mm:ss
- Date(const string s);
-
- // Operateurs portant sur les Dates
- virtual Date & operator =(long l);
- virtual Date & operator +(long l);
- virtual Date & operator -(long l);
- virtual Date & operator +=(long l);
- virtual Date & operator -=(long l);
- virtual Date & operator =(const string & s);
-
- // Conversions en types standards
- virtual string str() const;
- virtual long epoch() const;
-
- protected:
- int _day, _month, _year;
- int _hour, _min, _sec;
-
- private:
-
-@};
-@end example
-@end itemize
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe GenericType, Classe BoolType, Classe Date, Types de base
-@comment node-name, next, previous, up
-@page
-@subsubsection GenericType
-@findex GenericType
-
-La classe @emph{GenericType} est la classe-mere de toutes les classes
-utilisees par la classe @emph{Versatile}. @xref{Classe Versatile}.
-
-Elle definit une interface que @emph{Versatile} utilise pour controler
-les objets : constructeur simple et destructeur, operateur sur
-@emph{ostream}, conversion en chaine et surtout methode @emph{clone}.
-
-La methode @emph{clone} permet de recuperer un nouvel objet identique au
-premier qui sera automatiquement alloue sur le tas par un appel a
-@emph{new}. Il est important de noter ici que le nouvel objet @strong{DEVRA}
-etre desalloue par un appel a @emph{delete}. Cette desallocation est a
-la charge de l'utilisateur de l'objet sans quoi une fuite memoire en
-resultera.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class GenericType
-@{
- public:
- // Constructeur et destructeur
- GenericType();
- virtual ~GenericType();
-
- // Operateur pour l'affichage sur un stream
- friend ostream & operator << (ostream & os,
- const GenericType & obj);
-
- // Conversion en chaine
- virtual string affiche() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- // Retourne le nombre d'objets GenericType et al.
- static int getNb();
-
- protected:
-
- private:
- static int _nb; // nombre total d'objets GenericType et al.
-
-@};
-@end example
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe BoolType, Classe CharType, Classe GenericType, Types de base
-@comment node-name, next, previous, up
-@page
-@subsubsection BoolType
-@findex BoolType
-
-Cette classe encapsule le type C++ @emph{bool} dans un objet herite de
-@emph{GenericType} de maniere a pouvoir le stocker aisement dans un
-objet de classe @emph{Versatile}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class BoolType : public GenericType
-@{
- public:
- // Constructeur
- BoolType(const bool b=false);
-
- // Conversion en chaine
- virtual string affiche() const;
-
- // Operateur d'affectation
- virtual BoolType & operator =(bool);
-
- // Conversion en bool
- virtual operator bool() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- bool _data;
-
- private:
-
-@};
-@end example
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe CharType, Classe CoupleType, Classe BoolType, Types de base
-@comment node-name, next, previous, up
-@page
-@subsubsection CharType
-@findex CharType
-
-Cette classe encapsule le type C++ @emph{char} dans un objet herite de
-@emph{GenericType} de maniere a pouvoir le stocker aisement dans un
-objet de classe @emph{Versatile}.
-
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class CharType : public GenericType
-@{
- public:
- // Constructeur
- CharType(const char c=0);
-
- // Conversion en chaine
- virtual string affiche() const;
-
- // Operateur d'affectation
- virtual CharType & operator =(char);
-
- // Conversion en char
- virtual operator char() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- char _data;
-
- private:
-
-@};
-@end example
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe CoupleType, Classe DateType, Classe CharType, Types de base
-@comment node-name, next, previous, up
-@page
-@subsubsection CoupleType
-@findex CoupleType
-
-Cette classe encapsule le type interne @emph{Couple} dans un objet herite de
-@emph{GenericType} de maniere a pouvoir le stocker aisement dans un
-objet de classe @emph{Versatile}.
-
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class CoupleType : public GenericType
-@{
- public:
- // Constructeur
- CoupleType(const Couple & C);
-
- // Conversion en chaine
- virtual string affiche() const;
- virtual operator string() const;
-
- // Operateur d'affectation
- virtual CoupleType & operator =(const Couple & C);
-
- // Conversion en char
- virtual operator Couple() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- Couple _data;
-
- private:
-
-@};
-@end example
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe DateType, Classe IntType, Classe CoupleType, Types de base
-@comment node-name, next, previous, up
-@page
-@subsubsection DateType
-@findex DateType
-
-Cette classe encapsule le type interne @emph{Date} dans un objet herite de
-@emph{GenericType} de maniere a pouvoir le stocker aisement dans un
-objet de classe @emph{Versatile}.
-
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class DateType : public GenericType
-@{
- public:
- // Constructeur
- DateType(const Date & d);
-
- // Conversion en chaine
- virtual string affiche() const;
-
- // Operateur d'affectation
- virtual DateType & operator =(const Date &);
-
- // Conversion en Date
- virtual operator Date() const;
-
- // Conversion en long
- virtual operator long() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- Date _data;
-
- private:
-@};
-@end example
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe IntType, Classe LongType, Classe DateType, Types de base
-@comment node-name, next, previous, up
-@page
-@subsubsection IntType
-@findex IntType
-
-Cette classe encapsule le type C++ @emph{int} dans un objet herite de
-@emph{GenericType} de maniere a pouvoir le stocker aisement dans un
-objet de classe @emph{Versatile}.
-
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class IntType : public GenericType
-@{
- public:
- // Constructeur
- IntType(const int i=0);
-
- // Conversion en chaine
- virtual string affiche() const;
-
- // Operateur d'affectation
- virtual IntType & operator =(int);
-
- // Conversion en int
- virtual operator int() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- int _data;
-
- private:
-
-@};
-@end example
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe LongType, Classe StringType, Classe IntType, Types de base
-@comment node-name, next, previous, up
-@page
-@subsubsection LongType
-@findex LongType
-
-Cette classe encapsule le type C++ @emph{long} dans un objet herite de
-@emph{GenericType} de maniere a pouvoir le stocker aisement dans un
-objet de classe @emph{Versatile}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class LongType : public GenericType
-@{
- public:
- // Constructeur
- LongType(const long l=0L);
-
- // Conversion en chaine
- virtual string affiche() const;
-
- // Operateur d'affectation
- virtual LongType & operator =(long);
-
- // Conversion en long
- virtual operator long() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- long _data;
-
- private:
-
-@};
-@end example
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe StringType, Classes utilisateur, Classe LongType, Types de base
-@comment node-name, next, previous, up
-@page
-@subsubsection StringType
-@findex StringType
-
-Cette classe encapsule le type C++ @emph{string} de la STL dans un objet
-herite de @emph{GenericType} de maniere a pouvoir le stocker aisement
-dans un objet de classe @emph{Versatile}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class StringType : public GenericType
-@{
- public:
- // Constructeur
- StringType(const string & s="");
-
- // Conversion en chaine
- virtual string affiche() const;
- virtual operator string() const;
-
- // Operateur d'affectation
- virtual StringType & operator =(string);
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- string _data;
-
- private:
-
-@};
-@end example
-@end itemize
-
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classes utilisateur, Exemple, Classe StringType, Classes generiques
-@comment node-name, next, previous, up
-@page
-@subsection Classes utilisateur
-@cindex classes utilisateur
-
-Les classes dites classes utilisateur sont en realite les classes de
-plus haut niveau de la biliotheque de classes Batch. Ces classes
-remplissent les unes avec les autres l'ensemble des fonctionnalites
-proposees par la bibliotheque. L'utilisateur trouvera donc dans cette
-section la description des possibilites de la bibliotheque et le moyen
-de les mettre en oeuvre.
-
-La premiere section montre un exemple complet de soumission et de
-controle d'un job soumis a travers les classes de la biliotheque. Les
-sections suivantes reprennent les elements de l'exemple pour le
-detailler et le completer.
-
-@menu
-* Exemple:: Exemple simple mais complet d'utilisation.
-* Classe BatchManagerCatalog:: Description de la classe BatchManagerCatalog.
-* Classe FactBatchManager:: Description de la classe FactBatchManager.
-* Classe BatchManager:: Description de la classe BatchManager.
-* Classe Environnement:: Description de la classe Environnement.
-* Classe Job:: Description de la classe Job.
-* Classe JobId:: Description de la classe JobId.
-* Classe JobInfo:: Description de la classe JobInfo.
-* Classe Parametre:: Description de la classe Parametre.
-* Classe Versatile:: Description de la classe Versatile.
-@end menu
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Exemple, Classe BatchManagerCatalog, Classes utilisateur, Classes utilisateur
-@comment node-name, next, previous, up
-@page
-@subsubsection Exemple
-@cindex exemple
-
-Cet exemple decrit le processus type de creation et de soumission d'un
-job a travers les classes de la bibliotheque.
-
-Il faut toutefois penser que les appels aux methodes peuvent lever des
-exceptions qu'il faudra intercepter et gerer. @xref{Exceptions}.
-
-@example
- @dots{}
-
- // On instancie le catalogue de gestionnaires de batch
- Batch::BatchManagerCatalog cata;
-
- // On cree un BatchManager qui se connecte au veritable gestionnaire
- // de batch
- Batch::BatchManager & bm = (* cata("PBS"))("monserver.mondomaine.fr");
-
- // Pour fabriquer un Job, on doit d'abord creer un objet Parametre et
- // un objet Environnement qui contiennent respectivement la liste des
- // parametres du job au sein du gestionnaire de batch et la liste des
- // variables d'environnement necessaires au fonctionnement du job
- Batch::Parametre param;
-
- param[EXECUTABLE] = "/home/user/mon_application/executable";
- param[NAME] = "MonJob";
- param[ACCOUNT] = "MonProjet"; // code d'imputation/facturation
- param[MAXCPUTIME] = 360L; // 6min
- param[MAXWALLTIME] = 480L; // 8min
- param[INFILE] = Batch::Couple("/tmp/infich1", rempath+"/infich1");
- param[OUTFILE] = Batch::Couple("/tmp/outfich1", rempath+"/outfich1");
- param[OUTFILE] += Batch::Couple("stderr", path + "/STDERR");
- param[OUTFILE] += Batch::Couple("stdout", path + "/STDOUT");
- param[MAIL] = "user@@domaine.fr";
- param[USER] = "user";
-
- Batch::Environnement env;
- env["DEBUG"] = "3"; // un niveau de debug exige par l'application
- env["MYAPP_FILE"] = "/home/user/mon_application/data/mydatafile";
-
- // Creation du job
- Batch::Job job(param, env);
-
- // On soumet le Job au BatchManager qui le relaie jusqu'au veritable
- // gestionnaire de batch sur le serveur. En retour on obtient un
- // identifiant unique de notre job (JobId).
- const Batch::JobId jobid = bm.submitJob(job);
-
- // On interroge le BatchManager pour connaitre l'etat du Job
- const Batch::JobInfo jinfo = jobid.queryJob();
- cout << jinfo << endl;
-
- // On detruit l'objet BatchManager
- delete &bm;
-
- @dots{}
-@end example
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe BatchManagerCatalog, Classe FactBatchManager, Exemple, Classes utilisateur
-@comment node-name, next, previous, up
-@page
-@subsubsection BatchManagerCatalog
-@findex BatchManagerCatalog
-
-La classe @emph{BatchManagerCatalog} definit une interface d'acces au
-catalogue de fabriques de BatchManager. @xref{Classe FactBatchManager}.
-
-Pourquoi utiliser une fabrique et ne pas instancier directement un objet
-@emph{BatchManager} en fonction de sa classe ? C'est l'option qui avait ete
-choisie dans la premiere version de la bibliotheque de classes
-Batch. Cette facon de proceder est simple, aussi bien pour le
-developpeur de la classe que pour l'utilisateur, mais elle se revele a
-terme penalisante dans la souplesse d'utilisation des classes. Elle
-permet aussi moins facilement de mettre en place une strategie de
-singleton pour les objets @emph{BatchManager}, ce qui peut se reveler utile non
-pas en termes de performance mais plutot en termes de genericite et
-toujours de souplesse.
-
-En resume, l'utilisation de fabiques permet d'acceder a la genericite,
-qui rappelons-le est l'objet de cette biliotheque, a la souplesse et a
-la performance au prix d'une legere complication pour le developpeur
-mais pas pour l'utilisateur.
-
-Le catalogue de fabriques est une @emph{map}, ou tableau associatif,
-auquel on passe le nom d'une fabrique et qui retourne un pointeur sur
-une instance de cette fabrique.
-
-Le catalogue est renseigne statiquement par les fabriques declarees
-elles-memes statiquement dans la biliotheque. Il est donc precharge avec
-les fabriques correspondant a chacune des API disponibles. Comme le
-catalogue n'est pas declare constant, il est possible de rajouter ou de
-supprimer des fabriques dans le catalogue dynamiquement.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class BatchManagerCatalog
-@{
-public:
- // Constructeur
- BatchManagerCatalog();
- // Destructeur
- virtual ~BatchManagerCatalog();
-
- // Accesseurs
- static FactBatchManager * getFactBatchManager(const char * type);
- static void addFactBatchManager(const char * type,
- FactBatchManager * pFBM);
- virtual FactBatchManager * operator() (const char * type) const;
-
- // Wrapping Python
- virtual map<string, FactBatchManager *> * dict() const;
- virtual string __repr__() const;
-
-protected:
- // Le catalogue est gere en singleton et en multi-thread
- static map<string, FactBatchManager *> * _p_catalog;
- static pthread_mutex_t _mutex;
-
-private:
-
-@};
-@end example
-
-@item Exemple
-
-@example
-@dots{}
-
-// On instancie le catalogue de gestionnaires de batch
-Batch::BatchManagerCatalog cata;
-
-@dots{}
-@end example
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{BatchManagerCatalog()}
-
-Le constructeur par defaut permet d'obtenir une instance de
-@emph{BatchManagerCatalog} qui permet de manipuler un objet statique
-interne. Cet objet interne est le veritable catalogue et se trouve etre
-un singleton.
-
-
-@item
-@b{~BatchManagerCatalog()}
-
-Le destructeur n'a pas d'action particuliere.
-
-@item
-@b{static FactBatchManager * getFactBatchManager(const char * type)}
-
-Cet accesseur retourne un pointeur sur un objet de type
-@emph{FactBatchManager} en fonction du nom (le type) sous lequel il
-s'est enregistre dans le catalogue.
-
-Cette fonction est statique et peut donc etre utilisee pour interroger
-le catalogue depuis des objets statiques.
-
-@item
-@b{static void addFactBatchManager(const char * type, FactBatchManager * pFBM)}
-
-Cet accesseur enregistre dans le catalogue un pointeur sur un objet de type
-@emph{FactBatchManager} sous le nom (le type) passe en argument.
-
-Cette fonction est statique et peut donc etre utilisee pour enregistrer
-des objets statiques dans le catalogue.
-
-@item
-@b{FactBatchManager * operator() (const char * type) const}
-
-Cet accesseur retourne un pointeur sur un objet de type
-@emph{FactBatchManager} en fonction du nom (le type) sous lequel il
-s'est enregistre dans le catalogue.
-
-Cette fonction non statique est utilisable sur une instance de
-@emph{BatchManagerCatalog}.
-
-@item
-@b{map<string, FactBatchManager *> * dict() const}
-
-Cette methode utilisable depuis Python permet de recuperer un
-dictionnaire decrivant le contenu du catalogue.
-
-@item
-@b{string __repr__() const}
-
-Cette methode utilisable depuis Python retourne une description de
-l'objet @emph{BatchManagerCatalog}.
-
-@end itemize
-
-
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe FactBatchManager, Classe BatchManager, Classe BatchManagerCatalog, Classes utilisateur
-@comment node-name, next, previous, up
-@page
-@subsubsection FactBatchManager
-@findex FactBatchManager
-
-La classe @emph{FactBatchManager} est abstraite. Elle definit une interface
-qui doit etre implementee par des classes specialisees en fonction du
-gestionnaire de batch et de son API de communication. @xref{Classes specifiques}.
-
-Les objets repondant a l'interface de @emph{FactBatchManager} sont
-automatiquement inseres dans le catalogue des fabriques de
-@emph{BatchManager} a la construction de l'objet. Il est ainsi possible
-de definir statiquement des objets de ce type qui enrichiront le
-catalogue des la compilation. @xref{Classe
-BatchManagerCatalog}. @xref{Classe BatchManager}.
-
-Les objets de la classe @emph{FactBatchManager} ou de ses derivees sont
-des functors et renvoient au moment de l'appel un pointeur sur un objet
-gestionnaire de batch @emph{BatchManager} associe a un
-serveur. L'allocation de l'objet est faite sur le tas et celui-ci doit
-donc etre desalloue manuellement par l'utilisateur de la bibliotheque au
-moment opportun.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class FactBatchManager
-@{
-public:
- // Constructeur
- FactBatchManager(const string & type);
-
- // Destructeur
- virtual ~FactBatchManager();
-
- // Functor
- virtual BatchManager * operator() (const char * hostname) const = 0;
-
- // Accesseur au type interne
- string getType() const;
-
- // Wrapping Python
- string __repr__() const;
-
-protected:
- string type; // Le type interne
-
-private:
-
-@};
-@end example
-
-@item Exemple
-
-@example
-@dots{}
-
-// On instancie le catalogue de gestionnaires de batch
-Batch::BatchManagerCatalog cata;
-
-// On cree une fabrique de BatchManager de type PBS
-Batch::FactBatchManager & fbm = * cata("PBS");
-
-@dots{}
-@end example
-
-@item Methodes
-@itemize @minus{}
-
-@item
-@b{FactBatchManager(const string & type)}
-
-Le constructeur de la classe prend un type qui doit identifer de maniere
-unique la fabrique au sein du catalogue de fabrique. Ce type sert de cle au
-catalogue. @xref{Classe BatchManagerCatalog}.
-
-@item
-@b{~FactBatchManager()}
-
-Le destructeur de la classe n'a pas d'action particuliere.
-
-@item
-@b{BatchManager * operator() (const char * hostname) const}
-
-Cette methode est virtuelle pure. Elle doit etre surchargee dans les
-classes derivees et doit retourner un pointeur sur un objet de type
-@emph{BatchManager} correpondant au type de la classe et oeuvrant sur la
-machine passee en argument. Le @emph{hostname} est soit alphabetique
-soit numerique et doit etre soit un nom de machine valide soit une
-adresse IP valide. Aucun controle n'est a priori realise et cet argument
-est passe tel quel a l'API du gestionnaire de batch.
-
-Cet objet agit comme @emph{parent} vis-a-vis de l'objet
-@emph{BatchManager} qu'il retourne.
-
-@item
-@b{string getType() const}
-
-Cette methode renvoie le type interne de l'objet, c'est-a-dire la cle
-sous lequel il est enregistre dans le catalogue.
-
-@item
-@b{string __repr__() const}
-
-Cette methode utilisable depuis Python retourne une description de
-l'objet @emph{FactBatchManager}.
-
-@end itemize
-
-
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe BatchManager, Classe Environnement, Classe FactBatchManager, Classes utilisateur
-@comment node-name, next, previous, up
-@page
-@subsubsection BatchManager
-@findex BatchManager
-
-La classe @emph{BatchManager} est abstraite. Elle definit une interface
-qui doit etre implementee par des classes specialisees en fonction du
-gestionnaire de batch et de son API de communication. @xref{Classes
-specifiques}.
-
-Toute action a destination du gestionnaire de batch doit etre precedee
-de l'instanciation d'un objet derivant de la classe @emph{BatchManager}
-puisque c'est a travers cet objet que l'on aura acces a l'interface du
-gestionnaire.
-
-Cette instanciation est realisee par une fabrique de gestionnaire de
-batch, instance elle-meme derivee de la classe abstraite
-FactBatchManager. @xref{Classe FactBatchManager}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class BatchManager
-@{
- public:
- // Constructeur et destructeur
- BatchManager(const FactBatchManager * parent,
- const char * host="localhost")
- throw(InvalidArgumentException);
- virtual ~BatchManager();
-
- // Recupere l'identifiant d'un job deja soumis au BatchManager
- virtual const JobId getJobIdByReference(const string & ref);
-
- // Methodes pour le controle des jobs : virtuelles pures
- // soumet un job au gestionnaire
- virtual const JobId submitJob(const Job & job) = 0;
-
- // retire un job du gestionnaire
- virtual void deleteJob(const JobId & jobid) = 0;
-
- // suspend un job en file d'attente
- virtual void holdJob(const JobId & jobid) = 0;
-
- // relache un job suspendu
- virtual void releaseJob(const JobId & jobid) = 0;
-
- // modifie un job en file d'attente
- virtual void alterJob(const JobId & jobid,
- const Parametre & param,
- const Environnement & env) = 0;
- virtual void alterJob(const JobId & jobid,
- const Parametre & param) = 0;
- virtual void alterJob(const JobId & jobid,
- const Environnement & env) = 0;
-
- // renvoie l'etat du job
- virtual JobInfo queryJob(const JobId & jobid) = 0;
-
- // wrapping Python
- virtual string __repr__() const;
-
- protected:
- string _hostname; // serveur ou tourne le BatchManager
- const FactBatchManager * _parent; // fabrique qui a produit l'instance
-
- private:
-
-@};
-@end example
-
-@item Exemple
-
-@example
-@dots{}
-
-// On instancie le catalogue de gestionnaires de batch
-Batch::BatchManagerCatalog cata;
-
-// On cree un BatchManager qui se connecte au veritable gestionnaire
-// de batch
-Batch::BatchManager & bm = (* cata("PBS"))("monserver.mondomaine.fr");
-
-// Maintenant, on peut utiliser toutes les fonctionnalites du
-// gestionnaire de batch a travers le variable myBM
-
-// On detruit l'objet BatchManager
-delete &bm;
-
-@dots{}
-@end example
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{BatchManager(const FactBatchManager * parent,$*
-const char * host="localhost") throw(InvalidArgumentException)}
-
-Excepte un pointeur sur la fabrique qui a produit l'objet, @xref{Classe FactBatchManager},
- le constructeur accepte zero ou un argument de type
-@emph{string} decrivant soit le nom de domaine completement qualifie
-(FQDN, @i{fully qualified domain name}) du serveur de batch, soit son
-adresse IP dans un format decimal "aaa.bbb.ccc.ddd".
-
-Une resolution du nom ou de l'adresse peut etre realisee en fonction des
-capacites de la plate-forme pour s'assurer que le serveur est connu et
-joignable. En cas d'echec, une exception InvalidArgumentException est
-levee. @xref{Classe InvalidArgumentException}. A priori, aucune
-verification n'est faite par defaut.
-
-Ceci fait, une connexion est etablie avec le gestionnaire de batch qui
-est maintenue jusqu'a destruction de l'objet, si le gestionnaire le permet.
-
-@item
-@b{~BatchManager()}
-
-Le destructeur supprime la connexion precedemment etablie par le
-constructeur lorsque celle-ci a reussi.
-
-@item
-@b{const JobId submitJob(const Job & job)}
-
-Cette methode soumet le job passe en argument au gestionnaire de
-batch. Etant donne que le job ne peut pas etre envoye tel quel puisqu'il
-a un format generique au sein de la bibliotheque de classes Batch, cette
-methode est chargee de le convertir dans un format adapte au
-gestionnaire de batch sous-jacent.
-
-Ce n'est que lorsque cette conversion est realisee que le job est soumis
-au gestionnaire a travers son API. L'identifiant propose par le
-gestionnaire est alors renvoye a l'appelant. Si la soumission echoue
-pour une raison ou une autre, une exception APIInternalFailureException est
-levee. @xref{Classe APIInternalFailureException}.
-
-@item
-@b{void deleteJob(const JobId & jobid)}
-
-Cette methode retire le job dont l'identifiant est passe en argument de
-la file d'attente du gestionnaire, ou bien l'arrete s'il est en cours
-d'execution. Cette methode est inoperante sur des travaux deja termines,
-auquel cas une exception APIInternalFailureException est
-levee. @xref{Classe APIInternalFailureException}.
-
-
-@item
-@b{void holdJob(const JobId & jobid)}
-
-Cette methode suspend le job dont l'identifiant est passe en argument au
-sein de la file d'attente du gestionnaire. Cette methode est inoperante
-sur des travaux en cours d'execution ou deja termines, ainsi que sur des
-travaux deja suspendus.
-En cas de probleme, une exception APIInternalFailureException est
-levee. @xref{Classe APIInternalFailureException}.
-
-@item
-@b{void releaseJob(const JobId & jobid)}
-
-Cette methode relache un job precedemment suspendu en file
-d'attente dont l'identifiant est passe en argument. Elle est inoperante
-sur des travaux deja relaches, en cours d'execution ou termines.
-En cas de probleme, une exception APIInternalFailureException est
-levee. @xref{Classe APIInternalFailureException}.
-
-
-@item
-@b{void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)@*
-void alterJob(const JobId & jobid, const Parametre & param)@*
-void alterJob(const JobId & jobid, const Environnement & env)}
-
-Ces methodes permettent de modifier les parametres d'execution et
-d'environnement d'un job dont l'identifiant est passe en
-argument. @xref{Classe Parametre}. @xref{Classe Environnement}. Il
-est important de noter que le job doit etre encore place en file
-d'attente sinon la methode est inoperante.
-En cas de probleme, une exception APIInternalFailureException est
-levee. @xref{Classe APIInternalFailureException}.
-
-@item
-@b{JobInfo queryJob(const JobId & jobid)}
-
-Cette methode permet de recuperer les informations concernant le job
-dont l'identifiant est passe en argument dans un objet de classe
-@emph{JobInfo}. @xref{Classe JobInfo}. On y retrouve les parametres
-d'execution et d'environnement du job tels qu'ils ont ete passes au
-gestionnaire au moment de la soumission, ainsi que des informations
-concernant l'execution du job comme par exemple la machine d'execution,
-le temps consomme, la memoire consommee, etc.
-
-Il n'est pas toujours possible d'interroger un job deja termine.
-En cas de probleme, une exception APIInternalFailureException est
-levee. @xref{Classe APIInternalFailureException}.
-
-
-@item
-@b{const JobId getJobIdByReference(const string & ref)}
-
-Cette methode permet de recuperer au sein de la classe un identifiant de
-job a partir d'une chaine de caracteres obtenue par un biais
-externe. Cet identifiant pourra etre utilise par la suite au sein de la
-biliotheque de classes pour controler le job comme s'il avait ete cree
-et soumis depuis la biliotheque-meme.
-
-@end itemize
-
-
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe Environnement, Classe Job, Classe BatchManager, Classes utilisateur
-@comment node-name, next, previous, up
-@page
-@subsubsection Environnement
-@findex Environnement
-
-La classe @emph{Environnement} permet de definir les variables
-d'environnement necessaires a l'execution d'un job. Ces variables seront
-creees automatiquement dans l'environnement du job lorsque celui-ci
-debutera son execution sur la machine.
-
-Une variable d'environnement est traditionnellement composee d'un nom et
-d'une valeur qui peut etre vide ou absente. L'ensemble des variables
-d'environnement peut ainsi etre represente sous la forme d'une table
-associative dans laquelle le nom de la variable correspond a la clef de la
-table, et la valeur de la variable correspond a la valeur de la table
-pour la clef donnee.
-
-Chaque objet de la classe @emph{Environnement} se comporte comme une
-table associative telle que decrite auparavant.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-typedef map < string, string > Environnement;
-@end example
-
-
-@item Exemple
-@example
-@dots{}
-
-Environnement env;
-env["MYAPP_ROOTDIR"] = "/home/user/myapplication";
-env["MYAPP_LICENSEFILE"] = env["MYAPP_ROOTDIR"] + "/license.dat";
-env["CXX"] = "g++";
-env["CXXFLAGS"] = "-g -O2";
-
-@dots{}
-@end example
-
-@item Methodes
-
-Compte tenu de la definition actuelle de la classe @emph{Environnement}
-en tant que map STL, elle beneficie de toutes les fonctionnalites
-classiques des maps STL.
-
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe Job, Classe JobId, Classe Environnement, Classes utilisateur
-@comment node-name, next, previous, up
-@page
-@subsubsection Job
-@findex Job
-
-La classe @emph{Job} represente la notion de travail, ou job, dans la
-bibliotheque de classes Batch. Elle se comporte essentiellement comme
-une collection de parametres et de variables necessaires a la
-description des actions qui doivent etre realisees dans des conditions
-precisees.
-
-Elle se repose sur deux autres classes qui distinguent la notion de
-parametre d'execution et celle de variable d'environnement : les classes
-@emph{Parametre} et @emph{Environnement}. @xref{Classe
-Parametre}. @xref{Classe Environnement}.
-
-Son role est de preparer la soumission qui aura lieu et qui concretisera
-l'incarnation du job dans le gestionnaire de batch. Tant que le job n'a
-pas ete soumis, on ne peut pas vraiment considerer son existence et de
-fait les interactions qu'on peut avoir avec l'objet sont tres limitees.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class Job
-@{
- public:
- // Constructeurs et destructeur
- Job();
- Job(Parametre param);
- Job(Environnement env);
- Job(Parametre param, Environnement env);
- virtual ~Job();
-
- // Operateur pour l'affichage sur un stream
- friend ostream & operator <<(ostream & os, const Job & job);
-
- // Accesseurs
- Parametre getParametre() const;
- void setParametre(const Parametre &);
-
- // Accesseurs
- Environnement getEnvironnement() const;
- void setEnvironnement(const Environnement &);
-
- // Methodes pour l'interfacage avec Python (SWIG)
- string __repr__() const;
-
- protected:
- Parametre _param; // table des parametres batch du job
- Environnement _env; // table des variables d'environnement
-
- private:
-
-@};
-@end example
-
-
-@item Exemple
-@example
-@dots{}
-
-@dots{} (ici on cree un BatchManager bm)
-Parametre param;
-Environnement env;
-
-@dots{} (ici on cree les parametres du job)
-
-Job job(param, env);
-JobId jobid = bm.sumbitJob(job);
-
-@dots{}
-@end example
-
-@item Methodes
-@itemize @minus{}
-
-@item
-@b{Job()$*
-Job(Parametre param)$*
-Job(Environnement env)$*
-Job(Parametre param, Environnement env)}
-
-Le constructeur, en plus de creer l'objet, peut faire des verifications
-sur la coherence des objets passes en argument s'il y en a.
-
-@item
-@b{~Job()}
-
-Le destructeur libere simplement les espaces alloues.
-
-@item
-@b{ostream & operator <<(ostream & os, const Job & job)}
-
-Cette methode permet a l'utilisateur d'afficher sur un stream le contenu
-d'un objet de classe @emph{Job}.
-
-@item
-@b{Parametre getParametre() const}
-
-Un accesseur pour recuperer l'objet Parametre passe en argument du
-constructeur.
-
-@item
-@b{void setParametre(const Parametre &)}
-
-Cette methode permet de positionner @i{a posteriori} l'objet
-@emph{Parametre}. Des tests complementaires peuvent etre faits pour
-verifier la coherence de l'objet.
-
-@item
-@b{Environnement getEnvironnement() const}
-
-Un accesseur pour recuperer l'objet Environnement passe en argument du constructeur.
-
-@item
-@b{void setEnvironnement(const Environnement &)}
-
-Cette methode permet de positionner @i{a posteriori} l'objet
-@emph{Environnement}. Des tests complementaires peuvent etre faits pour
-verifier la coherence de l'objet.
-
-@item
-@b{string __repr__() const}
-
-Cette methode sert dans l'interfacage Python de l'objet et permet d'en
-realiser l'affichage a travers l'interpreteur Python.
-
-@end itemize
-@end itemize
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe JobId, Classe JobInfo, Classe Job, Classes utilisateur
-@comment node-name, next, previous, up
-@page
-@subsubsection JobId
-@findex JobId
-
-La classe @emph{JobId} represente l'incarnation d'un objet de classe
-@emph{Job} une fois soumis au travers du gestionnaire de batch. A chaque
-objet @emph{JobId} correspond une et une seule soumission d'un objet
-@emph{Job}. Ainsi un meme objet @emph{Job} peut etre soumis plusieurs
-fois de suite a un ou plusieurs gestionnaires de batch et produira
-autant d'objets @emph{JobId}.
-
-L'objet @emph{JobId} assure le controle et la gestion du job au travers
-du gestionnaire de batch. Chaque objet @emph{JobId} est associe a un
-gestionnaire particulier aupres duquel il relaie les actions qu'on lui
-soumet.
-
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class JobId
-@{
- friend class BatchManager;
-
- public:
- // Constructeur standard et destructeur
- JobId();
- virtual ~JobId();
-
- // Constructeur avec le pointeur sur le BatchManager associe
- // et avec une reference
- JobId(BatchManager *, string ref);
-
- // Operateur d'affectation entre objets
- virtual JobId & operator =(const JobId &);
-
- // Constructeur par recopie
- JobId(const JobId &);
-
- // Accesseur pour la reference interne
- virtual string getReference() const;
-
- // Methodes pour le controle du job
- // retire un job du gestionnaire
- virtual void deleteJob() const;
-
- // suspend un job en file d'attente
- virtual void holdJob() const;
-
- // relache un job suspendu
- virtual void releaseJob() const;
-
- // modifie un job en file d'attente
- virtual void alterJob(const Parametre & param,
- const Environnement & env) const;
- virtual void alterJob(const Parametre & param) const;
- virtual void alterJob(const Environnement & env) const;
-
- // modifie un job en file d'attente
- virtual void setParametre(const Parametre & param);
- virtual void setEnvironnement(const Environnement & env);
-
- // renvoie l'etat du job
- virtual Batch::JobInfo queryJob() const;
-
- // Methodes pour l'interfacage avec Python (SWIG)
- string __str__() const; // SWIG : affichage en Python
- string __repr__() const; // SWIG : affichage en Python
-
- protected:
- BatchManager * _p_batchmanager; // pointeur sur le BatchManager
- // qui controle le job
- string _reference; // reference du job au sein du BatchManager
-
- private:
-
-@};
-@end example
-
-
-@item Exemple
-@example
-@dots{} (ici on cree un BatchManager bm et un Job job)
-
-// On soumet le job et on recupere un identifiant
-JobId jobid = bm.submitJob(job);
-
-// Ce qui permet d'interroger l'etat du job en cours
-JobInfo jinfo = jobid.queryJob();
-
-@dots{}
-@end example
-
-@item Methodes
-
-@itemize @minus{}
-@item
-@b{JobId()@*
-JobId(BatchManager *, string ref)}
-
-Le constructeur par defaut cree un @emph{JobId} qui devra etre complete
-par la suite. Ceci n'est pas directement realisable par l'utilisateur
-mais sert pour certaines classes amies de la classe @emph{JobId}.
-
-D'un point de vue utilisateur la construction d'un objet @emph{JobId}
-necessite un pointeur sur un gestionnaire de batch existant et une
-chaine de caractere representant une reference au sein de ce
-gestionnaire de batch.
-
-Ces parametres sont en general issus de la
-communication avec l'API du gestionnaire de batch et ne peuvent etre
-aisement deduits. C'est pourquoi il est recommande de passer par une
-classe d'implementation pour fabriquer un objet @emph{JobId}.
-
-
-@item
-@b{~JobId()}
-
-Le destructeur libere l'espace occupe par l'objet.
-
-@item
-@b{JobId & operator =(const JobId &)}
-
-L'affectation d'un objet @emph{JobId} duplique les donnees internes de
-l'objet passe en argument. Les deux objets sont totalement independants
-a l'issue de l'affectation et designent chacun la meme instance du job
-dans le meme gestionnaire de batch. Le controle du job peut etre realise
-avec l'un ou l'autre des objets.
-
-@item
-@b{JobId(const JobId &)}
-
-De meme que l'affectation le constructeur par recopie produit un objet
-@emph{JobId} totalement independant de l'objet passe en argument et qui
-designe le meme job dans le meme gestionnaire de batch. Le controle du
-job peut etre realise avec l'un ou l'autre des objets.
-
-@item
-@b{string getReference() const}
-
-Cet accesseur retourne la reference du job pour le gestionnaire de batch
-qui a produit l'objet.
-
-@item
-@b{void deleteJob() const}
-
-Cette methode relaie aupres au gestionnaire de batch qui a produit
-l'objet la demande d'arret du job.
-
-@item
-@b{void holdJob() const}
-
-Cette methode relaie aupres au gestionnaire de batch qui a produit
-l'objet la demande de suspension du job.
-
-@item
-@b{void releaseJob() const}
-
-Cette methode relaie aupres au gestionnaire de batch qui a produit
-l'objet la demande de liberation du job.
-
-@item
-@b{void alterJob(const Parametre & param, const Environnement & env) const@*
-void alterJob(const Parametre & param) const@*
-void alterJob(const Environnement & env) const}
-
-Ces methodes relaient aupres du gestionnaire de batch qui a produit
-l'objet la demande de modification des parametres et/ou des variables
-d'environnement du job.
-
-@item
-@b{void setParametre(const Parametre & param)}
-
-Cette methode n'est utile que pour l'interfacage avec Python, car Python
-ne sait pas gerer la surcharge de methode, et de fait leve des
-exceptions lors d'appels a de telles methodes.
-
-Elle est equivalente a la methode @samp{void alterJob(const Parametre & param) const}.
-
-
-@item
-@b{void setEnvironnement(const Environnement & env)}
-
-Cette methode n'est utile que pour l'interfacage avec Python, car Python
-ne sait pas gerer la surcharge de methode, et de fait leve des
-exceptions lors d'appels a de telles methodes.
-
-Elle est equivalente a la methode @samp{void alterJob(const Environnement & env) const}.
-
-@item
-@b{Batch::JobInfo queryJob() const}
-
-Cette methode relaie aupres du gestionnaire de batch qui a produit
-l'objet la demande d'interrogation de l'etat du job.
-
-@item
-@b{string __str__() const}
-
-Cette methode n'est utile que pour l'interfacage avec Python. Elle
-permet d'afficher l'etat de l'objet @emph{JobId}.
-
-@item
-@b{string __repr__() const}
-
-Cette methode n'est utile que pour l'interfacage avec Python. Elle
-permet d'afficher l'etat de l'objet @emph{JobId}.
-
-@end itemize
-@end itemize
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe JobInfo, Classe Parametre, Classe JobId, Classes utilisateur
-@comment node-name, next, previous, up
-@page
-@subsubsection JobInfo
-@findex JobInfo
-
-Un objet de classe @emph{JobInfo} represente l'ensemble des informations
-disponibles sur un travail actif, c'est-a-dire soumis au gestionnaire de
-batch, a un instant donne.
-
-Cet objet reprend des informations issues du job tel qu'il a ete soumis,
-@xref{Classe Job}, mais aussi des informations produites par le
-gestionnaire de batch a partir de la soumission et du transit du job en
-son sein : nom de la queue dans laquelle le job est inscrit, duree
-d'execution, date de soumission, etc.
-
-Ces informations sont disponibles aupres de l'utilisateur de la classe a
-travers les objets @emph{Parametre} et @emph{Environnement} que l'objet
-@emph{JobInfo} peut fournir.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class JobInfo
-@{
- public:
- // Constructeur standard et destructeur
- JobInfo();
- virtual ~JobInfo();
-
- // Constructeur par recopie
- JobInfo(const JobInfo & jinfo);
-
- // Operateur pour l'affichage sur un stream
- friend ostream & operator <<(ostream & os, const JobInfo & ji);
-
- // Accesseurs
- virtual Parametre getParametre() const;
- virtual Environnement getEnvironnement() const;
-
- // Methodes pour l'interfacage avec Python (SWIG)
- string __str__() const; // SWIG : affichage en Python
- string __repr__() const; // SWIG : affichage en Python
-
- protected:
- Parametre _param; // parametres du job
- Environnement _env; // variables d'environnement du job
-
- private:
-@};
-@end example
-
-
-@item Exemple
-@example
-@dots{} (ici on cree un BatchManager bm et un Job job)
-
-// On soumet le job et on recupere un identifiant
-JobId jobid = bm.submitJob(job);
-
-// Ce qui permet d'interroger l'etat du job en cours
-JobInfo jinfo = jobid.queryJob();
-
-// On recupere l'objet Parametre interne modifie
-// par le gestionnaire de batch
-Parametre param = jinfo.getParametre();
-
-// On recupere l'objet Environnement interne modifie
-// par le gestionnaire de batch
-Environnement env = jinfo.getEnvironnement();
-
-@dots{}
-@end example
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{JobInfo()}
-
-Ce constructeur cree un objet @emph{JobInfo} vide.
-
-@item
-@b{~JobInfo()}
-
-Le destructeur libere l'espace memoire alloue par l'objet.
-
-@item
-@b{JobInfo(const JobInfo & jinfo)}
-
-Le constructeur par recopie produit un objet identique a celui passe en
-argument. Les deux objets sont totalement independants l'un de l'autre.
-
-@item
-@b{ostream & operator <<(ostream & os, const JobInfo & ji)}
-
-Cet operateur permet de voir le contenu de l'objet sur un flot de sortie.
-
-@item
-@b{Parametre getParametre() const}
-
-Cet accesseur retourne l'objet interne @emph{Parametre} modifie par le
-gestionnaire de batch. En particulier on y retrouve toutes les clefs et
-les valeurs correspondant aux informations produites dynamiquement par
-le gestionnaire (duree d'execution, machine d'execution, etc.).
-Il n'est pas garanti que les valeurs passees au moment de la soumission
-soient inchangees car des modifications ont pu etre apportees a ces
-valeurs pendant le traitement du job par le gestionnaire.
-
-@item
-@b{Environnement getEnvironnement() const}
-
-Cet accesseur retourne l'objet interne @emph{Environnement} modifie par le
-gestionnaire de batch. En particulier on y retrouve toutes les clefs et
-les valeurs correspondant aux informations produites dynamiquement par
-le gestionnaire (chemin d'acces, variables d'environnement specifiques a
-la machine d'execution, etc.).
-Il n'est pas garanti que les valeurs passees au moment de la soumission
-soient inchangees car des modifications ont pu etre apportees a ces
-valeurs pendant le traitement du job par le gestionnaire.
-
-@item
-@b{string __str__() const}
-
-Cette methode n'est utile que pour l'interfacage avec Python. Elle
-permet d'afficher l'etat de l'objet @emph{JobInfo}.
-
-@item
-@b{string __repr__() const}
-
-Cette methode n'est utile que pour l'interfacage avec Python. Elle
-permet d'afficher l'etat de l'objet @emph{JobInfo}.
-
-@end itemize
-
-@end itemize
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe Parametre, Classe Versatile, Classe JobInfo, Classes utilisateur
-@comment node-name, next, previous, up
-@page
-@subsubsection Parametre
-@findex Parametre
-
-Les objets de la classe @emph{Parametre} se comportent comme des maps
-STL, dont ils ont les fonctionnalites, decrivant les parametres
-d'execution du job.
-
-Contrairement aux variables d'environnement qui sont decrites par les
-objets de la classe @emph{Environnement}, les parametres d'execution
-servent a preciser les contraintes qui pesent sur le job, comme par
-exemple la duree maximale d'execution autorisee, la quantite maximale de
-memoire utilisable ou la queue de soumission, ou bien a renseigner le
-job avec des informations specifiques a l'utilisateur, comme son
-username, son adresse email, le code d'imputation du job, etc.
-
-En raison du caractere tres specifique et precis des informations qui
-doivent etre fournies au gestionnaire de batch, une nomenclature est
-proposee par la classe @emph{Parametre} qu'il est vivement conseille de
-suivre. De plus tout a ete fait pour rendre cette ecriture naturelle et
-facile, donc il ne devrait pas y avoir de probleme pour l'utiliser.
-
-Ainsi, a titre d'exemple, pour preciser le temps maximal autorise pour
-un job, il faut creer une clef de nom @var{maxcputime} dans un objet de
-classe @emph{Parametre} qui sera ensuite passe au job. Et pour preciser
-le code d'imputation du job, il faut creer une clef de nom @var{account}.
-
-Mais cet exemple simple montre que la valeur associee a la clef
-@var{maxcputime} est semantiquement une duree, et que la valeur associee a
-la clef @var{account} est semantiquement un nom. On a donc un probleme de
-type puisque dans la definition d'une map STL le type de la valeur doit
-etre le meme, et ce meme si les valeurs doivent par la suite avoir des
-types semantiques differents. C'est pourquoi on a definit une classe
-@emph{Versatile} qui encapsule des types differents. @xref{Classe
-Versatile}.
-
-Quoiqu'il en soit toute la mecanique est cachee et seul importe pour
-l'utilisateur de savoir que les valeurs associees aux clefs sont typees
-et que ces types sont definis dans l'enumeration @emph{DiscriminatorType}.
-@xref{Classe Versatile}.
-
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class Parametre : public map< string, Versatile >
-@{
- public:
- // Constructeur standard
- Parametre();
-
- // Constructeur par recopie
- Parametre(const Parametre & PM);
-
- // Operateur de recherche dans la map
- Versatile & operator [] (const string &);
- const Versatile & operator [] (const string &) const;
-
- // Operateur d'affectation
- Parametre & operator =(const Parametre & PM);
-
- // Declarations statique des clefs de la map
- static const string ACCOUNT;
- static const string CHECKPOINT;
- static const string CKPTINTERVAL;
- static const string CREATIONTIME;
- static const string EGROUP;
- static const string ELIGIBLETIME;
- static const string EUSER;
- static const string EXECUTABLE;
- static const string EXECUTIONHOST;
- static const string HOLD;
- static const string ID;
- static const string INFILE;
- static const string MAIL;
- static const string MAXCPUTIME;
- static const string MAXDISKSIZE;
- static const string MAXRAMSIZE;
- static const string MAXWALLTIME;
- static const string MODIFICATIONTIME;
- static const string NAME;
- static const string OUTFILE;
- static const string PID;
- static const string QUEUE;
- static const string QUEUEDTIME;
- static const string SERVER;
- static const string STARTDATE;
- static const string STATE;
- static const string TEXT;
- static const string TMPDIR;
- static const string USEDCPUTIME;
- static const string USEDDISKSIZE;
- static const string USEDRAMSIZE;
- static const string USEDWALLTIME;
- static const string USER;
-
- protected:
- // map interne servant a controler le type
- // de la valeur associee a chaque clef
- map< string, TypeParam > TypeMap;
-
- private:
-
-@};
-@end example
-
-
-@item Exemple
-@example
-@dots{}
-
-Parametre param;
-
-param[EXECUTABLE] = "/home/user/mon_application/executable";
-param[NAME] = "MonJob";
-param[ACCOUNT] = "MonProjet"; // code d'imputation/facturation
-param[MAXCPUTIME] = 360L; // 6min
-param[MAXWALLTIME] = 480L; // 8min
-param[INFILE] = Couple("/tmp/infich1", rempath + "/infich1");
-param[OUTFILE] = Couple("/tmp/outfich1", rempath + "/outfich1");
-param[OUTFILE] += Couple("stderr", path + "/STDERR");
-param[OUTFILE] += Couple("stdout", path + "/STDOUT");
-param[MAIL] = "user@@domaine.fr";
-param[USER] = "user";
-
-@dots{}
-@end example
-
-@item Methodes
-@itemize @minus{}
-
-@item
-@b{Parametre()}
-
-Le constructeur par defaut initialise l'objet @emph{Parametre} et cree
-la table des types internes. Par contre l'objet ne contient aucune valeur.
-
-@item
-@b{Parametre(const Parametre & PM)}
-
-Le constructeur par recopie cree un objet @emph{Parametre} a l'image de
-celui qui lui est passe en argument. La table des types internes est
-dupliquee ainsi que tous les objets correspondant a chacune des clefs.
-
-@item
-@b{Versatile & operator [] (const string &)}
-
-Cet operateur permet de recuperer la valeur designee par la clef passee
-en argument. Cette valeur est de classe @emph{Versatile} qui encapsule
-tous les types de base utilisables dans la bibliotheque en tant que
-parametre. @xref{Classe Versatile}.
-
-
-@item
-@b{const Versatile & operator [] (const string &) const}
-
-A l'image de l'operateur precedent, cet operateur permet de recuperer la
-valeur designee par la clef passee en argument mais uniquement pour des
-objets constants.
-
-@item
-@b{Parametre & operator =(const Parametre & PM)}
-
-L'operateur d'affectation remplace l'ensemble du contenu de l'objet
-@emph{Parametre} par le contenu de l'objet passe en argument. Les
-valeurs sont dupliquees par rapport a l'objet @var{pm}.
-
-@end itemize
-
-@item Description des clefs
-
-Selon les gestionnaires de batch utilises, certaines clefs sont actives
-ou inactives. Une definition superflue ne pose pas de probleme et se
-trouve ignoree au moment de la soumission. Par contre l'absence d'un
-clef peut empecher la soumission d'aboutir et lever une exception.
-
-@itemize @minus{}
-@item ACCOUNT : type STRING
-
-Le code de facturation sur lequel le job doit s'imputer.
-
-@item CHECKPOINT : type LONG
-
-Une valeur non nulle indique au gestionnaire de batch que le job est
-@dfn{checkpointable}, c'est-a-dire interruptible pour une reprise
-ulterieure.
-
-@item CKPTINTERVAL : type LONG
-
-En liaison avec la clef @var{CHECKPOINT}, la clef @var{CKPTINTERVAL}
-indique l'intervalle en secondes entre deux interruptions du code
-(@dfn{checkpoint}).
-
-@item CREATIONTIME : type LONG
-
-La date a laquelle le job a ete cree (soumis) dans le gestionnaire de batch.
-
-@item EGROUP : type STRING
-
-Le groupe effectif au sens Unix du terme dans lequel le job s'execute.
-
-@item ELIGIBLETIME : type LONG
-
-La date a laquelle le job a pu disposer des ressources necessaires a son
-execution.
-
-@item EUSER : type STRING
-
-L'utilisateur effectif au sens Unix du terme pour lequel le job s'execute.
-
-@item EXECUTABLE : type STRING
-
-Le chemin d'acces absolu a l'executable sur la machine qui soumet le job.
-
-@item EXECUTIONHOST : type STRING
-
-Le nom de la machine qui execute le job.
-
-@item HOLD : type LONG
-
-Une valeur non nulle indique au gestionnaire de batch que le job doit
-etre place dans l'etat suspendu. Une valeur nulle libere le job.
-
-@item ID : type STRING
-
-L'identifiant unique du job pour le gestionnaire de batch.
-
-@item INFILE : type liste de COUPLE
-
-La clef @var{infile} liste les fichiers qui seront envoyes au job avant
-son execution. Chaque fichier peut avoir un nom different sur la machine
-cliente --- qui soumet le job --- et sur le serveur. C'est pourquoi
-chaque fichier a envoyer est represente par un couple dont le nom @var{local}
-est le chemin absolu du fichier sur la machine cliente et le nom
-@var{remote} est le chemin absolu du fichier sur le
-serveur. @xref{Classe Couple}.
-
-Si le nom @var{remote} vaut @samp{stdin}, alors le contenu du fichier
-designe par le nom @var{local} est envoye sur l'entree standard du job
-au moment de son execution.
-
-@item MAIL : type STRING
-
-L'adresse email de l'utilisateur ou lui seront envoyes les eventuels
-messages d'information et d'alerte du gestionnaire de batch.
-
-@item MAXCPUTIME : type LONG
-
-Le temps de calcul (@i{CPU time}) en secondes que ne devra pas depasser le job.
-
-@item MAXDISKSIZE : type LONG
-
-L'espace disque en octets que ne devra pas depasser le job.
-
-@item MAXRAMSIZE : type LONG
-
-La quantite de memoire vive en octets que ne devra pas depasser le job.
-
-@item MAXWALLTIME : type LONG
-
-Le temps reel (@i{elapsed time}) en secondes que ne devra pas depasser le job.
-
-@item MODIFICATIONTIME : type LONG
-
-La date a laquelle le job a ete modifie pour la derniere fois dans le
-gestionnaire de batch. Cette date correspond le plus souvent a la
-derniere operation realisee par le gestionnaire dans la gestion du job :
-routage au sein des files, suspension ou reprise, etc.
-
-@item NAME : type STRING
-
-Le nom du job tel qu'il apparait a l'utilisateur dans son dialogue avec
-le gestionnaire de batch. Ce nom n'a pas besoin d'etre unique et ne
-remplace pas l'identifiant (ID). Il n'est la que pour informer
-l'utilisateur de la nature de son job.
-
-@item OUTFILE : type liste de COUPLE
-
-La clef @var{outfile} liste les fichiers qui sont produits par le job et
-qui seront recuperes sur la machine locale de l'utilisateur apres
-son execution. Chaque fichier peut avoir un nom different sur la machine
-cliente --- qui soumet le job --- et sur le serveur. C'est pourquoi
-chaque fichier a recuperer est represente par un couple dont le nom @var{local}
-est le chemin absolu du fichier sur la machine cliente et le nom
-@var{remote} est le chemin absolu du fichier sur le
-serveur. @xref{Classe Couple}.
-
-Si le nom @var{local} vaut @samp{stdout}, alors le contenu du fichier
-designe par le nom @var{local} contient la sortie standard du job
-au moment de son execution.
-
-Si le nom @var{local} vaut @samp{stderr}, alors le contenu du fichier
-designe par le nom @var{local} contient la sortie d'erreur du job
-au moment de son execution.
-
-@item PID : type LONG
-
-La valeur du PID (@i{process identifier}) du job sur la machine sur
-lqsuelle il s'execute.
-
-@item QUEUE : type STRING
-
-Le nom de la queue, aussi appelee classe ou file suivant les
-terminologies, qui accueille le job.
-
-@item QUEUEDTIME : type LONG
-
-La date depuis laquelle le job a ete place en queue dans le gestionnaire
-de batch.
-
-@item SERVER : type STRING
-
-Le nom complet du serveur qui recoit les soumissions de job.
-
-@item STARTDATE : type LONG
-
-La date a partir de laquelle l'utilisateur desire que le job soit
-execute. L'execution ne demarrera qu'au dela de cette date et a
-condition que toutes les conditions de ressources soient remplies.
-
-@item STATE : type STRING
-
-L'etat actuel du job.
-
-ATTENTION : Ces valeurs ne sont pas encore normalisees.
-
-@item TEXT : type STRING
-
-Un texte d'information que le gestionnaire peut emettre a destination de
-l'utilisateur lorsque l'ensemble des parametres n'est pas suffisant pour
-traduire l'etat reel du job. Par exemple, ce message peut informer
-l'utilisateur de la raison qui maintient un job dans un etat suspendu ou
-qui l'empeche de s'executer.
-
-@item TMPDIR : type STRING
-
-Un chemin d'acces absolu a un repertoire qui sera cree au demarrage du
-job et qui isolera le job des autres travaux en cours d'execution sur la
-meme machine.
-
-@item USEDCPUTIME : type LONG
-
-Le temps de calcul (@i{CPU time}) en secondes reellement consomme par le job.
-
-@item USEDDISKSIZE : type LONG
-
-L'espace disque en octets reellement consomme par le job.
-
-@item USEDRAMSIZE : type LONG
-
-L'espace disque en octets reellement consommee par le job.
-
-@item USEDWALLTIME : type LONG
-
-Le temps reel (@i{elapsed time}) en secondes reellement consomme par le job.
-
-@item USER : type STRING
-
-Le nom de l'utilisateur (@i{username}) sous lequel le job devra tourner
-sur la machine d'execution. Ce parametre est utile lorsque l'utilisateur
-possede des comptes differents sur les machines sur lequel il soumet et calcule.
-
-@end itemize
-
-
-@end itemize
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe Versatile, Exceptions, Classe Parametre, Classes utilisateur
-@comment node-name, next, previous, up
-@page
-@subsubsection Versatile
-@findex Versatile
-
-Cette classe est normalement invisible en tant que telle a l'utilsateur
-de la bibliotheque de classes Batch. Mais il est tout de meme utile de
-la presenter car son action est visible, notamment dans son interaction
-fine avec la classe @emph{Parametre}. @xref{Classe Parametre}.
-
-Comme il a ete precise dans la descrption de la classe @emph{Parametre},
-la classe @emph{Versatile} a ete concue pour encapsuler les valeurs de
-la map @emph{Parametre} qui peuvent etre de types effectifs differents.
-
-Ces types, decrits par l'enumeration @emph{DiscriminatorType}, sont
-actuellement au nombre de trois : @var{long}, @var{string} et
-@var{couple}. Ces types correpondent au types de base du langage C++ ou
-de la biliotheque de classes Batch. @xref{Types de base}.
-
-Le type special @var{undefined} ne sert que pour l'objet
-@emph{Versatile} juste cree mais non encore affecte d'une valeur et donc
-d'un type. La premiere affection d'une valeur a un objet
-@emph{Versatile} non encore affecte lui donne automatiquement le type de
-la valeur.
-
-Les objets de classe @emph{Versatile} peuvent se comporter soit comme
-des variables scalaires, c'est-a-dire ne contenant qu'une valeur unique,
-soit comme des listes, auquel cas elles utilisent l'interface des
-@emph{list} de la STL. Toutefois afin de faciliter l'ecriture pour
-l'utilisateur basique de la classe @emph{Versatile} --- et de la classe
-@emph{Parametre} ---, des operateurs de concatenation @samp{+=} et
-@samp{,} ont ete ajoutes.
-
-
-@itemize @bullet{}
-@item Entete
-
-@example
-// Les types autorises
-enum DiscriminatorType @{ UNDEFINED, LONG, STRING, COUPLE @};
-
-typedef struct @{
- DiscriminatorType type; // le type de l'element interne
- int maxelem; // le nombre d'elements autorises
-@} TypeParam;
-
-class Versatile : public list< GenericType * >
-@{
- public:
- // Constructeur standard et destructeur
- Versatile();
- virtual ~Versatile();
-
- // Constructeur par recopie
- Versatile(const Versatile & V);
-
- // Constructeur depuis le type de "base"
- Versatile(long l);
- Versatile(const string & s);
- Versatile(const Couple & c);
-
- // Operateur d'affectation et de concatenation
- // a partir d'un type de "base"
- Versatile & operator = (const long l)
- throw(TypeMismatchException);
- Versatile & operator = (const string & ch)
- throw(TypeMismatchException);
- Versatile & operator +=(const string & ch)
- throw(TypeMismatchException,ListIsFullException);
- Versatile & operator , (const string & ch)
- throw(TypeMismatchException,ListIsFullException);
- Versatile & operator = (const Couple & cp)
- throw(TypeMismatchException);
- Versatile & operator +=(const Couple & cp)
- throw(TypeMismatchException,ListIsFullException);
- Versatile & operator , (const Couple & cp)
- throw(TypeMismatchException,ListIsFullException);
-
- // Operateur d'affectation entre objets
- Versatile & operator = (const Versatile & V)
- throw(TypeMismatchException);
-
- // Conversion de type vers un type de "base"
- operator long() const throw(TypeMismatchException);
- operator string() const throw(TypeMismatchException);
- operator Couple() const throw(TypeMismatchException);
- string str() const throw(TypeMismatchException);
-
- // Operateur pour l'affichage sur un stream
- friend ostream & operator << (ostream & os, const Versatile & );
-
- // Positionnement et recuperation du type de l'element interne
- void setType(DiscriminatorType) throw(TypeMismatchException);
- DiscriminatorType getType() const;
-
- // Positionnement et recuperation du nombre d'elements internes
- void setMaxSize(int i);
- int getMaxSize() const;
-
- // Positionnement et recuperation du nom de l'objet
- string getName() const;
- void setName(const string & name);
-
- protected:
- // Efface tous les elements internes de l'objet
- virtual void eraseAll();
-
- DiscriminatorType _discriminator; // type de l'element interne
- int _maxsize; // nombre max d'elements internes
- string _name; // nom de l'objet (sert pour les exceptions)
-
- private:
-
-@};
-@end example
-
-
-@item Exemple
-@example
-@dots{}
-
-// On cree un objet Versatile non encore affecte (scalaire)
-Versatile Vlong;
-
-// L'affectation d'un long lui donne le type LONG
-Vlong = 1024L * 1024L * 1024L;
-cout << "Versatile long (must be 1073741824) : " << Vlong << endl;
-
-// On cree un objet Versatile non encore affecte (scalaire)
-Versatile Vstring;
-
-// L'affectation d'une string (const char * promu en string)
-// lui donne le type STRING
-Vstring = "UneChaine";
-cout << "Versatile string (must be UneChaine) : " << Vstring << endl;
-
-try
- @{
- // L'affectation d'un autre type leve une exception.
- // Il n'y a pas de retypage dynamique.
- Vlong = "";
- cout << "ERR : No TypeMismatchException catched for Versatile long"
- << endl;
- @}
-catch (TypeMismatchException & ex)
- @{
- cout << "OK : TypeMismatchException catched for Versatile long"
- << endl;
- @}
-
-// Reaffectation avec le meme type
-Vlong = 1024L * 1024L;
-cout << "Versatile long (must be 1048576) : " << Vlong << endl;
-
-// On cree un objet Versatile non encore affecte (scalaire) ...
-Versatile Vcat1;
-
-// ... que l'on transforme en liste (non limitee)
-Vcat1.setMaxSize(0);
-
-// On affecte la premiere valeur ...
-Vcat1 = "A";
-
-// ... puis les suivantes par concatenation
-Vcat1 += "B";
-Vcat1 += "C";
-Vcat1 += "D";
-Vcat1 += "E";
-cout << "Versatile string concatenation (must be A B C D E) : "
- << Vcat1 << endl;
-
-// Idem que pour Vcat1, mais avec une limite a 5 elements dans la liste
-Versatile Vcat2;
-Vcat2.setMaxSize(5);
-Vcat2 = "a", "b", "c", "d", "e";
-cout << "Versatile string concatenation (must be a b c d e) : "
- << Vcat2 << endl;
-
-// On tronque les 2 derniers elements de la liste (il en reste 3)
-Vcat2.setMaxSize(3);
-cout << "Versatile string concatenation (must be a b c) : "
- << Vcat2 << endl;
-
-
-Versatile Vcopy2(Vcat2);
-cout << "Versatile copy (must be a b c) : " << Vcopy2 << endl;
-
-Versatile Vaffect;
-Vaffect = Vcat1;
-cout << "Versatile affect (must be A B C D E) : " << Vaffect << endl;
-Vaffect = Vcat2;
-cout << "Versatile affect (must be a b c) : " << Vaffect << endl;
-
-try
- @{
- // Retypage dynamique interdit
- Vaffect = Vlong;
- cout << "ERR : No TypeMismatchException catched for Versatile"
- << endl;
- @}
-catch (TypeMismatchException & ex)
- @{
- cout << "OK : TypeMismatchException catched for Versatile string"
- << endl;
- @}
-
-try
- @{
- // Concatenation au dela de la limite interdit
- Vcat2 += "En trop";
- cout << "ERR : No ListIsFullException catched for Versatile string"
- << endl;
- @}
-catch (ListIsFullException & ex)
- @{
- cout << "OK : ListIsFullException catched for Versatile string"
- << endl;
- @}
-
-// Les objets Versatile se comportent (presque) comme des objets
-// standards du langage
-long L = Vlong;
-cout << "Long value of Versatile long (must be 1048576) : "
- << L << endl;
-
-string S = Vstring;
-cout << "String value of Versatile (must be EncoreUneAutreChaine):"
- << S << endl;
-
-@dots{}
-@end example
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{Versatile()}
-
-Le constructeur par defaut fabrique un objet scalaire de type
-@var{undefined} et de nom @samp{undefined}.
-
-@item
-@b{~Versatile()}
-
-Le destructeur efface tout le contenu de l'objet si celui-ci avait ete affecte.
-
-@item
-@b{Versatile(const Versatile & V)}
-
-Le constructeur par recopie duplique l'objet passe en argument ainsi que
-les valeurs qu'il contient. Le nouvel objet est totalement independant
-de son geniteur.
-
-@item
-@b{Versatile(long l)@*
-Versatile(const string & s)@*
-Versatile(const Couple & c)}
-
-Ces constructeurs fabriquent des objets scalaires @emph{Versatile} a partir des
-types de base passes en argument. Chaque objet acquerera definitivement
-le type correspondant au type de base : @var{long} pour @samp{long},
-@var{string} pour @samp{string} et @var{couple} pour @samp{Couple}.
-
-@item
-@b{Versatile & operator = (const long l) throw(TypeMismatchException)@*
-Versatile & operator = (const string & ch) throw(TypeMismatchException)@*
-Versatile & operator = (const Couple & cp) throw(TypeMismatchException)}
-
-Ces operateurs affectent ou reaffectent la valeur passee en argument a
-l'objet. Le type de la valeur doit correspondre au type de l'objet si
-celui-ci a deja ete affecte, sinon une exception @emph{TypeMismatchException} est
-levee. @xref{Classe TypeMismatchException}.
-
-L'ancienne valeur de l'objet est perdue.
-
-@item
-@b{Versatile & operator += (const string & ch)
- throw(TypeMismatchException, ListIsFullException)@*
-Versatile & operator , (const string & ch)
- throw(TypeMismatchException, ListIsFullException)@*
-Versatile & operator += (const Couple & cp)
- throw(TypeMismatchException, ListIsFullException)@*
-Versatile & operator , (const Couple & cp)
- throw(TypeMismatchException, ListIsFullException)}
-
-Ces operateurs concatenent la valeur passee en argument a l'objet. Le
-type de la valeur doit correspondre au type interne de l'objet si
-celui-ci a deja ete affecte, sinon une exception @emph{TypeMismatchException} est
-levee. @xref{Classe TypeMismatchException}.
-
-Si la taille maximale de la liste est depasse, une exception @emph{ListIsFullException} est
-levee. @xref{Classe ListIsFullException}.
-
-@item
-@b{Versatile & operator = (const Versatile & V) throw(TypeMismatchException)}
-
-L'operateur d'affectation duplique l'objet passe en argument dans
-l'objet. Toutes les valeurs internes sont dupliquees de maniere a avoir
-une independance totale entre les deux objets a l'issue de
-l'affectation.
-
-Il est a noter qu'il est possible d'affecter a un objet un objet
-possedant un type different, auquel cas l'objet courant change de type
-pour acquerir celui de l'objet passe en argument. C'est le seul cas de
-changement de type autorise pour un objet.
-
-@item
-@b{operator long() const throw(TypeMismatchException)@*
-operator string() const throw(TypeMismatchException)@*
-operator Couple() const throw(TypeMismatchException)@*
-string str() const throw(TypeMismatchException)}
-
-Ces operateur de conversion dans les types de base permettent de
-recuperer la valeur interne de l'objet. Lorsque le type interne est
-incompatible avec la conversion une exception @emph{TypeMismatchException} est
-levee. @xref{Classe TypeMismatchException}.
-
-@item
-@b{ostream & operator << (ostream & os, const Versatile & )}
-
-Cet operateur permet de voir le contenu de l'objet sur un flot de sortie.
-
-@item
-@b{void setType(DiscriminatorType) throw(TypeMismatchException)}
-
-Cette methode change le type interne de l'objet en celui passe en
-argument. Ceci n'est possible que pour un objet non encore affecte. Si
-le nouveau type est different du type actuel une exception @emph{TypeMismatchException} est
-levee. @xref{Classe TypeMismatchException}.
-
-@item
-@b{DiscriminatorType getType() const}
-
-Cet accesseur renvoie le type interne de l'objet.
-
-@item
-@b{void setMaxSize(int i)}
-
-Cette methode permet de changer le nombre d'elements que l'objet est
-capable de stocker. Par defaut ce nombre est 1 a la construction de
-l'objet, signifiant qu'il ne peut contenir qu'une seule valeur a la fois
-(scalaire).
-
-Si ce nombre est superieur a 1 alors il represente une
-limite qui ne pourra etre depassee par l'objet sans lever d'exception
-@emph{ListIsFullException}. @xref{Classe ListIsFullException}.
-
-Si ce nombre vaut 0 (zero) alors il n'y a aucune limite superieure au
-nombre d'element dans l'objet.
-
-@item
-@b{int getMaxSize() const}
-
-Cet accesseur renvoie la taille maximale admise par l'objet.
-
-@item
-@b{void setName(const string & name)}
-
-Cette methode permet de positionner le nom de l'objet. Par defaut ce nom
-vaut @samp{undefined} a la construction de l'objet.
-
-Il est interessant de positionner le nom a une valeur significative
-comme par exemple le nom de la variable contenant l'objet car lorsqu'une
-exception est levee ce nom apparait en clair et aide au debugging.
-
-@item
-@b{string getName() const}
-
-Cet accesseur renvoie le nom interne de l'objet.
-
-@end itemize
-
-@end itemize
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Exceptions, Classe APIInternalFailureException, Classe Versatile, Classes generiques
-@comment node-name, next, previous, up
-@page
-@subsection Exceptions
-@cindex exceptions
-
-La bibliotheque de classes Batch definit un certain nombre d'exceptions
-qui sont levees par les classes lors d'evenements qui traduisent un
-comportement anormal de la bibliotheque.
-
-@menu
-* Classe APIInternalFailureException:: Erreur d'utilisation de l'API.
-* Classe ConnexionFailureException:: Probleme de connexion de l'API.
-* Classe GenericException:: Classe-mere de toutes les exceptions.
-* Classe InvalidArgumentException:: Parametre errone d'une methode.
-* Classe InvalidKeyException:: Clef erronee d'une map.
-* Classe ListIsFullException:: Debordement de taille d'une liste.
-* Classe NotYetImplementedException:: Methodes non encore implementee.
-* Classe RunTimeException:: Erreur d'execution imprevue.
-* Classe TypeMismatchException:: Probleme de conversion de type.
-@end menu
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe APIInternalFailureException, Classe ConnexionFailureException, Exceptions, Exceptions
-@comment node-name, next, previous, up
-@page
-@subsubsection APIInternalFailureException
-@findex APIInternalFailureException
-
-Cette exception est levee par les classes d'implementation de la
-bibliotheque lorsqu'une erreur est detectee au moment de la
-communication avec l'API du gestionnaire de batch. En general l'erreur
-renvoyee par l'API est incluse dans le message de l'exception.
-
-Cette exception herite de la classe @emph{GenericException} qui definit
-uniquement un constructeur et deux membres publics constants : @emph{type} et
-@emph{message}. @xref{Classe GenericException}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class APIInternalFailureException : public GenericException
-@{
- public:
- // Constructeur
- APIInternalFailureException(string msg = "undefined");
-@};
-@end example
-
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{APIInternalFailureException(string msg = "undefined")}
-
-Ce contructeur prend la chaine @emph{msg} comme message d'erreur a
-renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le
-membre public constant @emph{message}.
-
-Le membre public constant @emph{type} est initialise avec le nom de la
-classe, soit @emph{APIInternalFailureException}.
-
-@end itemize
-
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe ConnexionFailureException, Classe GenericException, Classe APIInternalFailureException, Exceptions
-@comment node-name, next, previous, up
-@page
-@subsubsection ConnexionFailureException
-@findex ConnexionFailureException
-
-Cette exception est levee par les classes d'implementation de la
-bibliotheque lorsqu'une erreur est detectee au moment de la
-connexion au gestionnaire de batch. En general l'erreur
-renvoyee par l'API de connexion est incluse dans le message de l'exception.
-
-Cette exception herite de la classe @emph{GenericException} qui definit
-uniquement un constructeur et deux membres publics constants : @emph{type} et
-@emph{message}. @xref{Classe GenericException}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class ConnexionFailureException : public GenericException
-@{
- public:
- // Constructeur
- ConnexionFailureException(string msg = "undefined");
-@};
-@end example
-
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{ConnexionFailureException(string msg = "undefined")}
-
-Ce contructeur prend la chaine @emph{msg} comme message d'erreur a
-renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le
-membre public constant @emph{message}.
-
-Le membre public constant @emph{type} est initialise avec le nom de la
-classe, soit @emph{ConnexionFailureException}.
-
-@end itemize
-
-@end itemize
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe GenericException, Classe InvalidArgumentException, Classe ConnexionFailureException, Exceptions
-@comment node-name, next, previous, up
-@page
-@subsubsection GenericException
-@findex GenericException
-
-Cette classe est generique comme son nom l'indique et definit une
-interface commune pour toutes les exceptions de la
-bibliotheque.
-
-Cette exception definit uniquement un constructeur et deux membres
-publics constants : @emph{type} et @emph{message}. @xref{Classe
-GenericException}.
-
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class GenericException
-@{
- public:
- const string type; // la nature de l'exception
- const string message; // la raison de l'exception
-
- // Constructeur
- GenericException(const string tp = "GenericException",
- const string msg = "undefined");
-@};
-@end example
-
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{GenericException(const string tp = "GenericException", const string msg = "undefined")}
-
-Ce contructeur prend la chaine @emph{msg} comme message d'erreur a
-renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le
-membre public constant @emph{message}.
-
-Le membre public constant @emph{type} est initialise avec le parametre
-@emph{tp} qui contient generalement le nom de la classe.
-
-@end itemize
-
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe InvalidArgumentException, Classe InvalidKeyException, Classe GenericException, Exceptions
-@comment node-name, next, previous, up
-@page
-@subsubsection InvalidArgumentException
-@findex InvalidArgumentException
-
-Cette exception est levee par les classes de la bibliotheque lorsqu'un
-parametre erronne est passe en argument a une methode. En general
-le nom de l'arguement erronne est inclus dans le message de
-l'exception.
-
-Cette exception herite de la classe @emph{GenericException} qui definit
-uniquement un constructeur et deux membres publics constants : @emph{type} et
-@emph{message}. @xref{Classe GenericException}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class InvalidArgumentException : public GenericException
-@{
- public:
- // Constructeur
- InvalidArgumentException(string msg = "undefined");
-@};
-@end example
-
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{InvalidArgumentException(string msg = "undefined")}
-
-Ce contructeur prend la chaine @emph{msg} comme message d'erreur a
-renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le
-membre public constant @emph{message}.
-
-Le membre public constant @emph{type} est initialise avec le nom de la
-classe, soit @emph{InvalidArgumentException}.
-
-@end itemize
-
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe InvalidKeyException, Classe ListIsFullException, Classe InvalidArgumentException, Exceptions
-@comment node-name, next, previous, up
-@page
-@subsubsection InvalidKeyException
-@findex InvalidKeyException
-
-
-Cette exception est levee par les methodes de la classe @emph{Parametre}
-lorsqu'une clef erronnee est utilisee. En general le nom de la clef
-erronnee est inclus dans le message de l'exception.
-
-Cette exception herite de la classe @emph{GenericException} qui definit
-uniquement un constructeur et deux membres publics constants : @emph{type} et
-@emph{message}. @xref{Classe GenericException}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class InvalidKeyException : public GenericException
-@{
- public:
- // Constructeur
- InvalidKeyException(string msg = "undefined");
-@};
-@end example
-
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{InvalidKeyException(string msg = "undefined")}
-
-Ce contructeur prend la chaine @emph{msg} comme message d'erreur a
-renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le
-membre public constant @emph{message}.
-
-Le membre public constant @emph{type} est initialise avec le nom de la
-classe, soit @emph{InvalidKeyException}.
-
-@end itemize
-
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe ListIsFullException, Classe NotYetImplementedException, Classe InvalidKeyException, Exceptions
-@comment node-name, next, previous, up
-@page
-@subsubsection ListIsFullException
-@findex ListIsFullException
-
-Cette exception est levee par les methodes de la classe @emph{Versatile}
-lorsque la taille maximale de la liste interne est depasse. En general
-le nom de l'objet en erreur est inclus dans le message de l'exception.
-
-Cette exception herite de la classe @emph{GenericException} qui definit
-uniquement un constructeur et deux membres publics constants : @emph{type} et
-@emph{message}. @xref{Classe GenericException}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class ListIsFullException : public GenericException
-@{
- public:
- // Constructeur
- ListIsFullException(string msg = "undefined");
-@};
-@end example
-
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{ListIsFullException(string msg = "undefined")}
-
-Ce contructeur prend la chaine @emph{msg} comme message d'erreur a
-renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le
-membre public constant @emph{message}.
-
-Le membre public constant @emph{type} est initialise avec le nom de la
-classe, soit @emph{ListIsFullException}.
-
-@end itemize
-
-@end itemize
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe NotYetImplementedException, Classe RunTimeException, Classe ListIsFullException, Exceptions
-@comment node-name, next, previous, up
-@page
-@subsubsection NotYetImplementedException
-@findex NotYetImplementedException
-
-Cette exception est levee par les classes de la bibliotheque lorsqu'une
-methode declaree mais non encore implementee est utilisee. En general
-le nom de l'objet en erreur est inclus dans le message de l'exception.
-
-Cette exception herite de la classe @emph{GenericException} qui definit
-uniquement un constructeur et deux membres publics constants : @emph{type} et
-@emph{message}. @xref{Classe GenericException}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class NotYetImplementedException : public GenericException
-@{
- public:
- // Constructeur
- NotYetImplementedException(string msg = "undefined");
-@};
-@end example
-
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{NotYetImplementedException(string msg = "undefined")}
-
-Ce contructeur prend la chaine @emph{msg} comme message d'erreur a
-renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le
-membre public constant @emph{message}.
-
-Le membre public constant @emph{type} est initialise avec le nom de la
-classe, soit @emph{NotYetImplementedException}.
-
-@end itemize
-
-@end itemize
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe RunTimeException, Classe TypeMismatchException, Classe NotYetImplementedException, Exceptions
-@comment node-name, next, previous, up
-@page
-@subsubsection RunTimeException
-@findex RunTimeException
-
-Cette exception est levee par les classes de la bibliotheque lorsqu'une
-erreur inconnue et imprevue apparait. Cette exception est le
-comportement par defaut que doit gerer le gestionnaire d'exception en ce
-qui concerne les classes de la bibliotheque. En general le nom de
-l'objet en erreur est inclus dans le message de l'exception.
-
-Cette exception herite de la classe @emph{GenericException} qui definit
-uniquement un constructeur et deux membres publics constants : @emph{type} et
-@emph{message}. @xref{Classe GenericException}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class RunTimeException : public GenericException
-@{
- public:
- // Constructeur
- RunTimeException(string msg = "undefined");
-@};
-@end example
-
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{RunTimeException(string msg = "undefined")}
-
-Ce contructeur prend la chaine @emph{msg} comme message d'erreur a
-renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le
-membre public constant @emph{message}.
-
-Le membre public constant @emph{type} est initialise avec le nom de la
-classe, soit @emph{RunTimeException}.
-
-@end itemize
-
-@end itemize
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe TypeMismatchException, Classes specifiques, Classe RunTimeException, Exceptions
-@comment node-name, next, previous, up
-@page
-@subsubsection TypeMismatchException
-@findex TypeMismatchException
-
-Cette exception est levee par les methodes de la classe @emph{Versatile}
-lorsque qu'une erreur de type est rencontree dans un objet. Ce genre
-d'erreur survient lorsqu'on essaie d'affecter une valeur d'un type
-different du type interne de l'objet @emph{Versatile} a ce meme objet,
-ou bien lorsqu'on ajoute une valeur d'un type different a une liste. En
-general le nom de l'objet en erreur est inclus dans le message de
-l'exception.
-
-Cette exception herite de la classe @emph{GenericException} qui definit
-uniquement un constructeur et deux membres publics constants : @emph{type} et
-@emph{message}. @xref{Classe GenericException}.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class TypeMismatchException : public GenericException
-@{
- public:
- // Constructeur
- TypeMismatchException(string msg = "undefined");
-@};
-@end example
-
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{TypeMismatchException(string msg = "undefined")}
-
-Ce contructeur prend la chaine @emph{msg} comme message d'erreur a
-renvoyer au gestionnaire d'exception. Cette valeur est stockee dans le
-membre public constant @emph{message}.
-
-Le membre public constant @emph{type} est initialise avec le nom de la
-classe, soit @emph{TypeMismatchException}.
-
-@end itemize
-
-@end itemize
-
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classes specifiques, Classes PBS, Classe TypeMismatchException, Classes
-@comment node-name, next, previous, up
-@page
-@section Classes specifiques
-@cindex classes specifiques
-
-Afin de pouvoir se connecter aux gestionnaires de batch reels a travers
-leurs API, les classes generiques ont ete derivees pour offrir une
-implementation correspondant a l'interface qu'elles definissent.
-
-Pour traduire a la fois le fait que les nouvelles classes derivent d'une
-classe generique et qu'elles sont une implementation d'une API
-particuliere, on adopte la convention de nom suivante : la classe se
-nomme comme sa classe generique mais est suffixee par le nom de l'API du
-gestionnaire de batch, les deux termes etant separes par un caractere
-@kbd{_} (souligne).
-
-Actuellement, seul le gestionnaire de batch OpenPBS, @xref{Prerequis}, est
-supporte. Mais ce catalogue devrait s'enrichir par la suite.
-
-Les classes de la bibliotheque sont egalement accessibles a travers un
-interpreteur Python, ce qui a necessite la creation de certaines classes
-d'interface avec l'interpreteur.
-
-@menu
-* Classes PBS:: Classes d'implementation pour OpenPBS
-* Classes Python:: Classes d'interfacage avec Python.
-@end menu
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classes PBS, Classe FactBatchManager_PBS, Classes specifiques, Classes specifiques
-@comment node-name, next, previous, up
-@page
-@subsection Classes PBS
-@cindex classes PBS
-
-Actuellement seules les classes @emph{BatchManager}, @emph{JobInfo} et
-@emph{Job} ont besoin d'etre derivees pour implementer la communication
-et l'interfacage avec l'API du gestionnaire de batch OpenPBS.
-
-
-@menu
-* Classe FactBatchManager_PBS:: Description de la classe FactBatchManager_PBS.
-* Classe BatchManager_PBS:: Description de la classe BatchManager_PBS.
-* Classe JobInfo_PBS:: Description de la classe JobInfo_PBS.
-* Classe Job_PBS:: Description de la classe Job_PBS.
-@end menu
-
-
-@node Classe FactBatchManager_PBS, Classe BatchManager_PBS, Classes PBS, Classes PBS
-@comment node-name, next, previous, up
-@subsubsection FactBatchManager_PBS
-@cindex FactBatchManager_PBS
-
-Cette classe derive de la classe generique @emph{FactBatchManager},
-@xref{Classe FactBatchManager}.
-
-Les objets de la classe @emph{BatchManager_PBS} realisent l'interface de
-la bibliotheque avec l'API du gestionnaire de batch OpenPBS.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class FactBatchManager_PBS : public FactBatchManager
-@{
-public:
- // Constructeur et destructeur
- FactBatchManager_PBS();
- virtual ~FactBatchManager_PBS();
-
- virtual BatchManager_PBS * operator() (const char * hostname) const;
-
-protected:
-
-private:
-
-@};
-@end example
-
-@item Exemple
-
-@example
-@dots{}
-
-// On instancie le catalogue de gestionnaires de batch
-Batch::BatchManagerCatalog cata;
-
-// On cree une fabrique de BatchManager de type PBS
-Batch::FactBatchManager & fbm = * cata("PBS");
-
-@dots{}
-@end example
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{FactBatchManager_PBS()}
-
-Ce constructeur instancie un objet de la classe
-@emph{FactBatchManager_PBS} et l'enregistre automatiquement aupres du
-catalogue de fabrique. @xref{Classe BatchManagerCatalog}.
-
-Le type est positionne a la valeur PBS.
-
-@item
-@b{~FactBatchManager_PBS()}
-
-Le destructeur ne fait rien de particulier.
-
-@item
-@b{BatchManager_PBS * operator() (const char * hostname) const}
-
-Cet operateur renvoie un objet nouvellement cree de type
-@emph{BatchManager_PBS} derivant de @emph{BatchManager} et oeuvrant sur
-la machine @emph{hostname}. La destruction de l'objet est a la charge de
-l'appelant.
-
-@end itemize
-
-@end itemize
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classe BatchManager_PBS, Classe JobInfo_PBS, Classe FactBatchManager_PBS, Classes PBS
-@comment node-name, next, previous, up
-@page
-@subsubsection BatchManager_PBS
-@cindex BatchManager_PBS
-
-Cette classe derive de la classe generique @emph{BatchManager},
-@xref{Classe BatchManager}.
-
-Les objets de la classe @emph{BatchManager_PBS} realisent l'interface de
-la bibliotheque avec l'API du gestionnaire de batch OpenPBS.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class BatchManager_PBS : public BatchManager
-@{
- public:
- // Constructeur et destructeur
- BatchManager_PBS(FactBatchManager * parent,
- const char * host) throw(InvalidArgumentException);
- virtual ~BatchManager_PBS();
-
- // Recupere le nom du serveur par defaut
- static string getDefaultServer();
-
- // Recupere le l'identifiant d'un job deja soumis au BatchManager
- virtual const JobId getJobIdByReference(const string & ref);
-
- // Methodes pour le controle des jobs : virtuelles pures
- // soumet un job au gestionnaire
- virtual const JobId submitJob(const Job & job);
-
- // retire un job du gestionnaire
- virtual void deleteJob(const JobId & jobid);
-
- // suspend un job en file d'attente
- virtual void holdJob(const JobId & jobid);
-
- // relache un job suspendu
- virtual void releaseJob(const JobId & jobid);
-
- // modifie un job en file d'attente
- virtual void alterJob(const JobId & jobid,
- const Parametre & param,
- const Environnement & env);
- virtual void alterJob(const JobId & jobid,
- const Parametre & param);
- virtual void alterJob(const JobId & jobid,
- const Environnement & env);
-
- // renvoie l'etat du job
- virtual JobInfo queryJob(const JobId & jobid);
-
- // modifie un job en file d'attente
- virtual void setParametre(const JobId & jobid,
- const Parametre & param);
- virtual void setEnvironnement(const JobId & jobid,
- const Environnement & env);
-
- protected:
- string _hostname; // serveur ou tourne le BatchManager
-
- private:
-
-@};
-@end example
-
-@item Exemple
-
-@example
-@dots{}
-
-// On instancie le catalogue de gestionnaires de batch
-Batch::BatchManagerCatalog cata;
-
-// On cree une fabrique de BatchManager de type PBS
-Batch::BatchManager & myBM = (* cata("PBS"))("serveur.domaine.fr")
-
-// Maintenant, on peut utiliser toutes les fonctionnalites du
-// gestionnaire de batch a travers le variable myBM
-
-@dots{}
-@end example
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{BatchManager_PBS(FactBatchManager * parent,
-const char * host) throw(InvalidArgumentException)}
-
-Excepte un pointeur sur la fabrique qui a produit l'objet, le
-constructeur accepte zero ou un argument de type @emph{string} decrivant
-soit le nom de domaine completement qualifie (FQDN, @i{fully qualified
-domain name}) du serveur de batch, soit son adresse IP dans un format
-decimal "aaa.bbb.ccc.ddd".
-
-Si aucun parametre n'est passe au constructeur, celui-ci prend le
-serveur par defaut tel que renvoye par la methode @emph{getDefaultServer}.
-
-Une resolution du nom ou de l'adresse peut etre realisee en fonction des
-capacites de la plate-forme pour s'assurer que le serveur est connu et
-joignable. En cas d'echec, une exception InvalidArgumentException est
-levee. @xref{Classe InvalidArgumentException}.
-
-Ceci fait, une connexion est etablie avec le gestionnaire de batch qui
-est maintenue jusqu'a destruction de l'objet.
-
-@item
-@b{~BatchManager()}
-
-Le destructeur supprime la connexion precedemment etablie par le
-constructeur lorsque celle-ci a reussi.
-
-@item
-@b{const JobId submitJob(const Job & job)}
-
-Cette methode soumet le job passe en argument au gestionnaire de
-batch. Etant donne que le job ne peut pas etre envoye tel quel puisqu'il
-a un format generique au sein de la bibliotheque de classes Batch, cette
-methode est chargee de le convertir dans un format adapte au
-gestionnaire de batch sous-jacent.
-
-La methode opere ici une conversion du job de la classe @emph{Job} en @emph{Job_PBS}.
-
-Ce n'est que lorsque cette conversion est realisee que le job est soumis
-au gestionnaire a travers son API. L'identifiant propose par le
-gestionnaire est alors renvoye a l'appelant. Si la soumission echoue
-pour une raison ou une autre, une exception APIInternalFailureException est
-levee. @xref{Classe APIInternalFailureException}.
-
-@item
-@b{void deleteJob(const JobId & jobid)}
-
-Cette methode retire le job dont l'identifiant est passe en argument de
-la file d'attente du gestionnaire, ou bien l'arrete en cours
-d'execution. Cette methode est inoperante sur des travaux deja termines,
-auquel cas une exception APIInternalFailureException est
-levee. @xref{Classe APIInternalFailureException}.
-
-
-@item
-@b{void holdJob(const JobId & jobid)}
-
-Cette methode suspend le job dont l'identifiant est passe en argument au
-sein de la file d'attente du gestionnaire. Cette methode est inoperante
-sur des travaux en cours d'execution ou deja termines, ainsi que sur des
-travaux deja suspendus.
-En cas de probleme, une exception APIInternalFailureException est
-levee. @xref{Classe APIInternalFailureException}.
-
-@item
-@b{void releaseJob(const JobId & jobid)}
-
-Cette methode relache un job precedemment suspendu en file
-d'attente dont l'identifiant est passe en argument. Elle est inoperante
-sur des travaux deja reclaches, en cours d'execution ou termines.
-En cas de probleme, une exception APIInternalFailureException est
-levee. @xref{Classe APIInternalFailureException}.
-
-
-@item
-@b{void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)@*
-void alterJob(const JobId & jobid, const Parametre & param)@*
-void alterJob(const JobId & jobid, const Environnement & env)}
-
-Ces methodes permettent de modifier les parametres d'execution et
-d'environnement d'un job dont l'identifiant est passe en
-argument. @xref{Classe Parametre}. @xref{Classe Environnement}. Il
-est important de noter que le job doit etre encore place en file
-d'attente sinon la methode est inoperante.
-En cas de probleme, une exception APIInternalFailureException est
-levee. @xref{Classe APIInternalFailureException}.
-
-@item
-@b{JobInfo queryJob(const JobId & jobid)}
-
-Cette methode permet de recuperer les informations concernant le job
-dont l'identifiant est passe en argument dans un objet de classe
-@emph{JobInfo}. @xref{Classe JobInfo}. On y retrouve les parametres
-d'execution et d'environnement du job tels qu'ils ont ete passes au
-gestionnaire au moment de la soumission, ainsi que des informations
-concernant l'execution du job comme par exemple la machine d'execution,
-le temps consomme, la memoire consommee, etc.
-
-Il n'est pas toujours possible d'interroger un job deja termine.
-En cas de probleme, une exception APIInternalFailureException est
-levee. @xref{Classe APIInternalFailureException}.
-
-
-@item
-@b{const JobId getJobIdByReference(const string & ref)}
-
-Cette methode permet de recuperer au sein de la classe un identifiant de
-job a partir d'une chaine de caracteres obtenue par un biais
-externe. Cet identifiant pourra etre utilise par la suite au sein de la
-biliotheque de classes pour controler le job comme s'il avait ete cree
-et soumis depuis la biliotheque-meme.
-
-@item
-@b{void setParametre(const JobId & jobid, const Parametre & param)}
-
-Cette methode n'est utile que pour l'interfacage avec Python, car Python
-ne sait pas gerer la surcharge de methode, et de fait leve des
-exceptions lors d'appels a de telles methodes.
-
-Elle est equivalente a la methode @samp{void alterJob(const JobId & jobid, const Parametre & param)}.
-
-@item
-@b{void setEnvironnement(const JobId & jobid, const Environnement & env)}
-
-Cette methode n'est utile que pour l'interfacage avec Python, car Python
-ne sait pas gerer la surcharge de methode, et de fait leve des
-exceptions lors d'appels a de telles methodes.
-
-Elle est equivalente a la methode @samp{void alterJob(const JobId & jobid, const Environnement & env)}.
-
-@end itemize
-
-
-@end itemize
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-
-@node Classe JobInfo_PBS, Classe Job_PBS, Classe BatchManager_PBS, Classes PBS
-@comment node-name, next, previous, up
-@page
-@subsubsection JobInfo_PBS
-@cindex JobInfo_PBS
-
-Un objet de classe @emph{JobInfo} represente l'ensemble des informations
-disponibles sur un travail actif, c'est-a-dire soumis au gestionnaire de
-batch, a un instant donne.
-
-Cet objet reprend des informations issues du job tel qu'il a ete soumis,
-@xref{Classe Job}, mais aussi des informations produites par le
-gestionnaire de batch a partir de la soumission et du transit du job en
-son sein : nom de la queue dans laquelle le job est inscrit, duree
-d'execution, date de soumission, etc.
-
-Ces informations sont disponibles aupres de l'utilisateur de la classe a
-travers les objets @emph{Parametre} et @emph{Environnement} que l'objet
-@emph{JobInfo} peut fournir.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class JobInfo_PBS : public JobInfo
-@{
- public:
- // Constructeur standard et destructeur
- JobInfo_PBS();
- JobInfo_PBS(struct batch_status * stat_list,
- bool tobedeleted = false);
- virtual ~JobInfo_PBS();
-
- // Constructeur par recopie
- JobInfo_PBS(const JobInfo_PBS & jinfo);
-
- // Methodes pour l'interfacage avec Python (SWIG)
- string __str__() const; // SWIG : affichage en Python
- string __repr__() const; // SWIG : affichage en Python
-
- protected:
- Parametre _param; // parametres du job
- Environnement _env; // variables d'environnement du job
-
- private:
-@};
-@end example
-
-
-@item Exemple
-@example
-@dots{} (ici on cree un BatchManager bm et un Job job)
-
-// On soumet le job et on recupere un identifiant
-JobId jobid = bm.submitJob(job);
-
-// Ce qui permet d'interroger l'etat du job en cours
-// Nota : l'objet retourne est un JobInfo_PBS
-JobInfo jinfo = jobid.queryJob();
-
-@dots{}
-@end example
-
-@item Methodes
-@itemize @minus{}
-@item
-@b{JobInfo_PBS()}
-
-Ce constructeur cree un objet @emph{JobInfo_PBS} vide.
-
-@item
-@b{~JobInfo_PBS()}
-
-Le destructeur libere l'espace memoire alloue pour l'objet si la
-desollacation n'a pas eu deja lieu dans le constructeur.
-
-@item
-@b{JobInfo_PBS(const JobInfo_PBS & jinfo)}
-
-Le constructeur par recopie produit un objet identique a celui passe en
-argument. Les deux objets sont totalement independants l'un de l'autre.
-
-@item
-@b{JobInfo_PBS(struct batch_status * stat_list, bool tobedeleted = false)}
-
-Ce constructeur recupere une liste chainee du type interne OpenPBS
-@emph{struct batch_status *}, la parcoure et l'analyse pour en extraire
-les informations utilisables par la bibliotheque de classes et les
-stocker dans deux objets internes @emph{Parametre} et
-@emph{Environnement}.
-
-Si le parametre @emph{tobedeleted} vaut @emph{true} alors la liste
-chainee @emph{stat_list} sera desallouee a la fin du constructeur. Sinon
-elle sera desalloue dans le destructeur au plus tard.
-
-@item
-@b{string __str__() const}
-
-Cette methode n'est utile que pour l'interfacage avec Python. Elle
-permet d'afficher l'etat de l'objet @emph{JobInfo}.
-
-@item
-@b{string __repr__() const}
-
-Cette methode n'est utile que pour l'interfacage avec Python. Elle
-permet d'afficher l'etat de l'objet @emph{JobInfo}.
-
-@end itemize
-
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-
-@node Classe Job_PBS, Classes Python, Classe JobInfo_PBS, Classes PBS
-@comment node-name, next, previous, up
-@page
-@subsubsection Job_PBS
-@cindex Job_PBS
-
-Un objet de classe @emph{Job} possede une structure generique
-potentiellement utilisable par tout gestionnaire de batch mais pas en
-l'etat. Une conversion dans un format lisible par le gestionnaire doit
-etre realisee.
-
-Ceci se fait en produisant a partir des donnees generiques de la classe
-@emph{Job} des structures de donnees specifiques qui peuvent etre
-directement passees a l'API du gestionnaire.
-
-La classe @emph{Job_PBS} se distingue donc de la classe @emph{Job} par son
-constructeur et par des accesseurs specifiques qui produisent des
-donnees lisibles par OpenPBS.
-
-Etant donnee la specificite de cette classe, elle ne devrait concerner
-que les developpeurs de la bibliotheque de classes Batch.
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class Job_PBS
-@{
- public:
- // Constructeurs et destructeur
- Job_PBS(const Job & job);
- virtual ~Job_PBS();
-
- // Accesseurs
- struct attropl * getAttributesOP();
- struct attrl * getAttributes();
- char * getScript();
- char * getDestination();
-
- protected:
- struct attropl * _p_attropl; // liste d'attributs + operateur
- struct attrl * _p_attrl; // liste d'attributs
- char * _script; // chemin d'acces au script du job
- char * _destination; // queue dans laquelle le job est soumis
-
- private:
-
-@};
-@end example
-
-
-@item Exemple
-@example
-@dots{}
-
-Parametre param;
-Environnement env;
-
-@dots{} (ici on cree les parametres du job)
-
-Job job(param, env);
-
-// On fabrique un job specifique a OpenPBS a partir du job generique
-// Ceci ne concerne en general pas l'utilisateur de la bibliotheque
-Job_PBS jobpbs(job);
-
-@dots{}
-@end example
-
-@item Methodes
-@itemize @minus{}
-
-@item
-@b{Job_PBS(const Job & job)}
-
-Le constructeur convertit les objets internes @emph{Parametre} et
-@emph{Environnement} de l'objet passe en argument en un ensemble de
-quatre structures C @emph{AttributesOP}, @emph{Attributes},
-@emph{Script} et @emph{Destination} directement utilisable par l'API de
-OpenPBS.
-
-@item
-@b{~Job_PBS()}
-
-Le destructeur libere simplement les espaces alloues pour les structures
-@emph{AttributesOP}, @emph{Attributes}, @emph{Script} et
-@emph{Destination}.
-
-@item
-@b{struct attropl * getAttributesOP()}
-
-Cet accesseur retourne un pointeur sur la structure interne
-@emph{AttributesOP} de l'objet. Cette structure n'est pas protogee
-contre les modifications accidentelles de l'utilisateur. Par consequent
-il est recommande d'eviter d'y apporter toute alteration sous peine de
-dysfonctionnement.
-
-Pour la definition de la structure @emph{AttributesOP}, voir la
-documentation OpenPBS.
-
-@item
-@b{struct attrl * getAttributes()}
-
-Cet accesseur retourne un pointeur sur la structure interne
-@emph{Attributes} de l'objet. Cette structure n'est pas protogee
-contre les modifications accidentelles de l'utilisateur. Par consequent
-il est recommande d'eviter d'y apporter toute alteration sous peine de
-dysfonctionnement.
-
-Pour la definition de la structure @emph{Attributes}, voir la
-documentation OpenPBS.
-
-@item
-@b{char * getScript()}
-
-Cet accesseur retourne un parametre @emph{Script} qui est une chaine de
-caracteres C contenant le chemin absolu (sur la machine d'execution)
-du script a soumettre au gestionnaire de batch.
-
-Cette chaine n'est pas protegee contre les modifications accidentelles
-de l'utilisateur. Il est donc recommande de ne pas y apporter de modification.
-
-@item
-@b{char * getDestination()}
-
-Cet accesseur retourne un parametre @emph{Destination} qui est une chaine de
-caracteres C contenant le nom de la queue, ou classe ou file selon les terminologies,
-du gestionnaire de batch dans laquelle le job doit etre soumis.
-
-Cette chaine n'est pas protegee contre les modifications accidentelles
-de l'utilisateur. Il est donc recommande de ne pas y apporter de modification.
-
-
-@end itemize
-@end itemize
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Classes Python, Classe PyVersatile, Classe Job_PBS, Classes specifiques
-@comment node-name, next, previous, up
-@page
-@subsection Classes Python
-@cindex classes Python
-
-L'integration de la bibliotheque de classes Batch dans l'interpreteur
-Python a beaucoup progresse depuis la precedente version et se trouve
-etre quasiment iso-fonctionelle avec le C++.
-
-Actuellement, l'interface avec Python s'appuie a la fois sur les
-fonctionnalites de l'utilitaire SWIG, et sur la definition d'une classe
-specifique qui permet de voir en Python la classe @emph{Versatile}.
-
-Certaines classes ont de plus des methodes specifiques pour le wrapping
-Python qui simplifient grandement le developpement des classes
-d'interface au detriment, il est vrai, d'une bonne independance entre
-les langages. Ce choix n'est pas definitif et pourra etre revu si
-l'occasion s'en presente.
-
-Quoi qu'il en soit toutes les classes de haut niveau sont interfacees en
-Python sous le meme nom et proposent les memes methodes (sauf celles
-surchargees en C++ qui sot parfois renommees pour lever
-l'ambiguite). Pour ne pas refaire un expose detaille et fastidieux des
-fonctionnalites Python de la bibliotheque de classes, il est propose de
-retrouver les noms et la syntaxe de ces classe dans la partie
-Utilisation de ce document. @xref{Utilisation}.
-
-@menu
-* Classe PyVersatile:: Description de la classe PyVersatile.
-@end menu
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-
-@node Classe PyVersatile, Utilisation, Classes Python, Classes Python
-@comment node-name, next, previous, up
-@page
-@subsubsection PyVersatile
-@cindex PyVersatile
-
-
-La classe @emph{PyVersatile} derive de la classe @emph{Versatile} et
-offre la possibilite de convertir un tel objet en objet Python et
-@i{vice versa}.
-
-
-@itemize @bullet{}
-@item Entete
-
-@example
-class PyVersatile : public Versatile
-@{
- public:
- // Constructeur a partir d'un objet Versatile
- PyVersatile(const Versatile &);
-
- // Constructeur a partir d'un PyObject
- PyVersatile(const PyObject *) throw(TypeMismatchException,
- ListIsFullException,
- InvalidArgumentException);
-
- // Conversion de type vers un PyObject
- operator PyObject *() const;
-
- // Operateur d'affectation a partir d'un objet Versatile
- PyVersatile & operator =(const Versatile &);
-
- protected:
-
- private:
-
-@};
-@end example
-
-
-@item Exemple
-@example
-@dots{}
-
-// On cree un objet Versatile contenant
-// une liste de chaine de caracteres
-Versatile V;
-V = "a", "b", "c";
-
-// On convertit cet objet Versatile en PyVersatile
-PyVersatile PyV(V);
-
-// De la on produit un objet Python
-// qui est une liste de chaine de caracteres
-PyObject * PyO = PyV;
-
-@dots{}
-@end example
-
-@item Methodes
-@itemize @minus{}
-
-@item
-@b{PyVersatile(const Versatile &)}
-
-Ce constructeur convertit un objet @emph{Versatile} en objet @emph{PyVersatile}.
-
-@item
-@b{PyVersatile(const PyObject *) throw(TypeMismatchException, ListIsFullException, InvalidArgumentException)}
-
-Ce constructeur convertit un objet Python passe en argument en un objet
-@emph{PyVersatile}.
-
-Seuls certains objets Python peuvent etre convertis : les @emph{string}
-et les @emph{long}, ainsi que les listes homogenes de ces types, ce qui
-est coherent avec la nature de l'objet @emph{Versatile}. Si tel n'est
-pas le cas, une exception Python est renvoyee a l'interpreteur.
-
-
-@item
-@b{operator PyObject *() const}
-
-Cet operateur convertit l'objet en objet Python. Selon le cas, l'objet
-retourne est soit un scalaire soit une liste. L'objet retourne est
-alloue dynamiquement et doit donc etre pris en charge par l'interpreteur.
-
-@item
-@b{PyVersatile & operator =(const Versatile &)}
-
-L'affectation d'un objet @emph{Versatile} passe en argument est
-similaire a l'affectation entre objets @emph{Versatile}. Les structures
-de donnees internes initiales de l'objet sont effacees et remplacees par
-une copie des donnees internes de l'objet passe en argument. Les deux
-objets restent independants l'un de l'autre a l'issue de l'affectation.
-
-@end itemize
-@end itemize
-
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Utilisation, Connexion, Classe PyVersatile, Top
-@comment node-name, next, previous, up
-@page
-@chapter Utilisation
-@cindex utilisation
-
-Ce chapitre presente les differentes actions qu'il est possible de
-realiser avec les classes de la bilbiotheque.
-
-On presente un cas hypothetique ou un utilisateur voudrait soumettre et
-controler un job depuis un code C++. Les sections suivantes decrivent
-les operations a faire ainsi que leur action sur le travail soumis.
-
-@menu
-* Connexion:: Creation d'un gestionnaire de batch.
-* Creation:: Declaration d'un job (travail).
-* Soumission:: Demande d'execution du job.
-* Interrogation:: Recuperation des informations sur le job.
-* Destruction:: Arret du job en cours.
-* Suspension:: Suspension du job en file d'attente.
-* Reprise:: Liberation du job en file d'attente.
-* Modification:: Modification d'un job en file d'attente.
-@end menu
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Connexion, Creation, Utilisation, Utilisation
-@comment node-name, next, previous, up
-@section Connexion
-@cindex connexion
-@cindex deconnexion
-
-La premiere etape avant toute utilisation pratique des classes de la
-bibliotheque consiste a se connecter a un gestionnaire de batch.
-
-Ce concept de connexion est purement interne a la bibliotheque car il
-est tout a fait possible d'imaginer le controle de jobs a travers l'API
-d'un gestionnaire sans jamais etablir ni maintenir une quelconque
-connexion avec celui-ci. D'autres par contre reclament l'etablissement
-d'une connexion.
-
-Quoiqu'il en soit ceci n'est pas genant et l'etablissement et le
-maintien de la connexion avec le gestionnaire de batch se fait par la
-creation d'un objet de classe @emph{BatchManager} ou d'une classe
-derivee.
-
-En pratique, la classe @emph{BatchManager} se comporte comme une
-interface et seules les classes d'implementation derivee doivent etre
-instanciees.
-
-Si l'on prend le cas d'un serveur @samp{serveur.domaine.fr} supportant
-un gestionnaire de batch OpenPBS, on peut s'y connecter de la maniere
-suivante :
-
-@itemize @bullet{}
-@item Exemple C++ :
-
-@example
-BatchManagerCatalog cata;
-BatchManager_PBS & bm = * (* cata('PBS'))("serveur.domaine.fr");
-@end example
-
-@item Exemple Python:
-
-@example
-cata = BatchManagerCatalog()
-bm = cata('PBS')('serveur.domaine.fr')
-@end example
-
-@end itemize
-
-Tant que l'objet @emph{bm} sera present --- tant que son destructeur
-n'aura pas ete appele --- la connexion sera maintenue. La deconnexion
-aura lieu a la destruction de l'objet.
-
-@xref{Classe BatchManager}.
-@xref{Classe BatchManager_PBS}.
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Creation, Soumission, Connexion, Utilisation
-@comment node-name, next, previous, up
-@section Creation
-@cindex creation
-
-La creation du job est l'etape qui precede toute soumission. Elle
-necessite de decrire d'un maniere ou d'un autre ce que l'on va demander
-a la machine d'executer.
-
-Pour cela on passe par deux objets intermediaires qui sont l'objet
-@emph{Parametre} et l'objet @emph{Environnement}.
-
-Le minimum a preciser est en general le chemin absolu d'acces a
-l'executable, quoique ceci depende fortement de la configuration du
-gestionnaire auquel on se connecte. Celui-ci peut reclamer des
-parametres supplementaires.
-
-Pour connaitre l'ensemble des parametres disponibles : @xref{Classe
-Parametre}.
-
-On supposera dans cet exemple que l'application en question sait
-reconnaitre une variable d'environnement @var{myapp_loglevel} qui prend
-une valeur numerique correspondant au niveau d'information affiche en
-sortie.
-
-Cette application imaginaire utilise egalement trois fichiers :
-
-@itemize @bullet{}
-@item
-un fichier d'entree nomme @file{Cas1.data} sur la machine locale qu'il
-faudra renommer @file{fort.9} pour que l'application puisse le lire
-(notre application imaginaire est ecrite en FORTRAN et attend un fichier
-d'entree sur son descripteur 9);
-
-@item
-un fichier de sortie standard que l'on voudra recuperer sous le nom
-@file{Cas1.out};
-
-@item
-un fichier d'erreur standard que l'on voudra recuperer sous le nom
-@file{Cas1.err}.
-
-@end itemize
-
-Le job est ensuite cree simplement a l'aide des deux objets precedents.
-
-@itemize @bullet{}
-@item Exemple C++ :
-
-@example
-Parametre param;
-param[EXECUTABLE] = "/home/user/my_app/bin/exec_app.sh";
-param[INFILE] = Couple("/home/user/my_app/data/Cas1.data","fort.9");
-param[OUTFILE] = Couple("/home/user/my_app/data/Cas1.out", "stdout"),
- Couple("/home/user/my_app/data/Cas1.err", "stderr");
-
-Environnement env;
-env["MYAPP_LOGLEVEL"] = "3";
-
-Job job(param, env);
-@end example
-
-@item Exemple Python:
-
-@example
-param = @{@}
-param["EXECUTABLE"] = "/home/user/my_app/bin/exec_app.sh"
-param["INFILE"] = [ ("/home/user/my_app/data/Cas1.data","fort.9") ]
-param["OUTFILE"] = [ ("/home/user/my_app/data/Cas1.out", "stdout"),
- ("/home/user/my_app/data/Cas1.err", "stderr") ]
-
-env = @{@}
-env["MYAPP_LOGLEVEL"] = "3"
-
-job = Job()
-job.setParametre(param)
-job.setEnvironnement(env)
-@end example
-
-@end itemize
-
-
-@xref{Classe Parametre}.
-@xref{Classe Environnement}.
-@xref{Classe Job}.
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Soumission, Interrogation, Creation, Utilisation
-@comment node-name, next, previous, up
-@section Soumission
-@cindex soumission
-@findex submitJob
-
-Une fois le job cree, il est alors tres simple de le soumettre au
-gestionnaire de batch en passant par l'intermediaire de l'objet
-@emph{BatchManager} cree precedemment.
-
-Cette soumission produira un objet @emph{JobId} qui servira a controler
-le job par la suite.
-
-Cependant des exceptions peuvent etre levees au moment de la soumission
-et il convient de fournir un gestionnaire d'exception pour gerer
-proprement ces incidents.
-
-@itemize @bullet{}
-@item Exemple C++ :
-
-@example
-try @{
- const JobId jobid = bm.submitJob(job);
-
-@} catch (GenericException & ex) @{
- @dots{}
-@}
-@end example
-
-@item Exemple Python:
-
-@example
-try :
- jobid = bm.submitJob(job)
-except :
- @dots{}
-@end example
-
-@end itemize
-
-
-@xref{Classe Job}.
-@xref{Classe JobId}.
-@xref{Exceptions}.
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Interrogation, Destruction, Soumission, Utilisation
-@comment node-name, next, previous, up
-@section Interrogation
-@cindex interrogation
-@findex queryJob
-
-La fourniture d'un objet @emph{JobId} permet d'avoir tout controle sur
-le job en cours. En particulier il est possible de l'interroger :
-ceci generera un objet @emph{JobInfo} qui donnera l'ensemble des
-informations disponibles sur l'etat du job aupres du gestionnaire de
-batch.
-
-Ces informations sont disponibles a travers deux objets internes de
-classes @emph{Parametre} et @emph{Environnement}, les memes que pour la
-classe @emph{Job}, mais modifies et completes avec les donnees les plus
-a jour du gestionnaire de batch.
-
-@itemize @bullet{}
-@item Exemple C++ :
-
-@example
-try @{
- const JobInfo jinfo = jobid.queryJob();
-
- Parametre newparam = jinfo.getParametre();
- Environnement newenv = jinfo.getEnvironnement();
-
-@} catch (GenericException & ex) @{
- @dots{}
-@}
-@end example
-
-@item Exemple Python:
-
-@example
-try :
- jobinfo = jobid.queryJob()
-
- newparam = jinfo.getParametre()
- newenv = jinfo.getEnvironnement()
-except :
- @dots{}
-@end example
-
-@end itemize
-
-
-@xref{Classe JobId}.
-@xref{Classe JobInfo}.
-@xref{Exceptions}.
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Destruction, Suspension, Interrogation, Utilisation
-@comment node-name, next, previous, up
-@section Destruction
-@cindex destruction
-@cindex suppression
-@findex deleteJob
-
-
-Il est possible de detruire un job que celui-ci soit encore en file
-d'attente ou bien que son execution ait deja commence, auquel cas elle
-serait immediatement interrompue.
-
-
-@itemize @bullet{}
-@item Exemple C++ :
-
-@example
-try @{
- jobid.deleteJob();
-
-@} catch (GenericException & ex) @{
- @dots{}
-@}
-@end example
-
-@item Exemple Python:
-
-@example
-try :
- jobid.deleteJob()
-
-except :
- @dots{}
-@end example
-
-@end itemize
-
-
-@xref{Classe JobId}.
-@xref{Exceptions}.
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Suspension, Reprise, Destruction, Utilisation
-@comment node-name, next, previous, up
-@section Suspension
-@cindex suspension
-@findex holdJob
-
-La suspension consiste a figer en file d'attente un job qui n'aurait pas
-encore commence son execution. Il n'est pas possible de suspendre un job
-qui s'execute.
-
-Il y a deux manieres de suspendre un job en file d'attente :
-@itemize @bullet{}
-@item en utilisant la methode @samp{holdJob};
-@item en modifiant les parametres du job a l'aide de la methode @samp{alterJob}.
-@end itemize
-
-Exemple 1 :
-
-@itemize @bullet{}
-@item Exemple C++ :
-
-@example
-try @{
- jobid.holdJob();
-
-@} catch (GenericException & ex) @{
- @dots{}
-@}
-@end example
-
-@item Exemple Python:
-
-@example
-try :
- jobid.holdJob()
-
-except :
- @dots{}
-@end example
-
-@end itemize
-
-Exemple 2 :
-
-@itemize @bullet{}
-@item Exemple C++ :
-
-@example
-try @{
- Parametre altparam;
- altparam[HOLD] = 1;
- jobid.alterJob(altparam);
-
-@} catch (GenericException & ex) @{
- @dots{}
-@}
-@end example
-
-@item Exemple Python:
-
-@example
-// Compte tenu de la surcharge d'operateur, cet exemple peut ne pas
-// fonctionner encore
-try :
- altparam = @{@}
- altparam["HOLD"] = 1
- jobid.alterJob(altparam)
-
-except :
- @dots{}
-@end example
-
-@end itemize
-
-
-
-@xref{Classe JobId}.
-@xref{Exceptions}.
-@xref{Reprise}.
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Reprise, Modification, Suspension, Utilisation
-@comment node-name, next, previous, up
-@section Reprise
-@cindex reprise
-@findex releaseJob
-
-La reprise est l'operation inverse de la suspension en ceci qu'elle
-libere un job precedemment suspendu en file d'attente. Le job continuera
-alors son cheminement normal au sein du gestionnaire de batch.
-
-Il y a deux manieres de suspendre un job en file d'attente :
-@itemize @bullet{}
-@item en utilisant la methode @samp{releaseJob};
-@item en modifiant les parametres du job a l'aide de la methode @samp{alterJob}.
-@end itemize
-
-Exemple 1 :
-
-@itemize @bullet{}
-@item Exemple C++ :
-
-@example
-try @{
- jobid.releaseJob();
-
-@} catch (GenericException & ex) @{
- @dots{}
-@}
-@end example
-
-@item Exemple Python:
-
-@example
-try :
- jobid.releaseJob()
-
-except :
- @dots{}
-@end example
-
-@end itemize
-
-Exemple 2 :
-
-@itemize @bullet{}
-@item Exemple C++ :
-
-@example
-try @{
- Parametre altparam;
- altparam[HOLD] = 0;
- jobid.alterJob(altparam);
-
-@} catch (GenericException & ex) @{
- @dots{}
-@}
-@end example
-
-@item Exemple Python:
-
-@example
-// Compte tenu de la surcharge d'operateur, cet exemple peut ne pas
-// fonctionner encore
-try :
- altparam = @{@}
- altparam["HOLD"] = 0
- jobid.alterJob(altparam)
-
-except :
- @dots{}
-@end example
-
-@end itemize
-
-
-@xref{Classe JobId}.
-@xref{Exceptions}.
-@xref{Suspension}.
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Modification, Installation de la bibliotheque, Reprise, Utilisation
-@comment node-name, next, previous, up
-@section Modification
-@cindex modification
-@findex alterJob
-
-Il est possible de modifier tout ou partie des parametres et des
-variables d'un job a condition que celui-ci soit encore en file
-d'attente. Un job dont l'execution a deja debute devient inalterable,
-sauf a l'arreter definitvement.
-
-La modification se fait en declarant un objet @emph{Parametre} et/ou un
-objet @emph{Environnement} contenant l'ensemble des alterations a
-apporter a la description du job. Ces alterations peuvent porter sur des
-parametres ou des variables deja definies ou non.
-
-En reprenant le cas du job imaginaire utilise jusqu'ici, on peut
-souhaiter changer le script qui tient lieu d'executable car le precedent
-etait incomplet, modifier le niveau d'affichage de la log et ajouter une
-variable nommee @var{myapp_debug} qui indique au code de passer en mode
-debug. Ceci pourrait se faire de la maniere suivante :
-
-@itemize @bullet{}
-@item Exemple C++ :
-
-@example
-try @{
- Parametre altparam;
- altparam[EXECUTABLE] = "/home/user/my_app/bin/exec_app.sh";
-
- Environnement altenv;
- altenv["MYAPP_LOGLEVEL"] = "4";
- altenv["MYAPP_DEBUG"] = "1";
- jobid.alterJob(altparam, altenv);
-
-@} catch (GenericException & ex) @{
- @dots{}
-@}
-@end example
-
-@item Exemple Python:
-
-@example
-// Compte tenu de la surcharge d'operateur, cet exemple peut ne pas
-// fonctionner encore
-try :
- altparam = @{@}
- altparam["EXECUTABLE"] = "/home/user/my_app/bin/exec_app.sh"
-
- altenv = @{@}
- altenv["MYAPP_LOGLEVEL"] = "4";
- altenv["MYAPP_DEBUG"] = "1";
-
- jobid.alterJob(altparam, altenv)
-
-except :
- @dots{}
-@end example
-
-@end itemize
-
-
-@xref{Classe JobId}.
-@xref{Exceptions}.
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Installation de la bibliotheque, Prerequis, Modification, Top
-@comment node-name, next, previous, up
-@chapter Installation
-@cindex installation
-
-Cette section montre comment installer l'ensemble de la bibliotheque de
-classes Batch sur une machine Unix.
-
-@menu
-* Prerequis::
-* Installation rapide::
-* Configuration::
-* Compilation::
-* Compilation de la documentation::
-* Tests::
-* Installation::
-@end menu
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Prerequis, Installation rapide, Installation de la bibliotheque, Installation de la bibliotheque
-@comment node-name, next, previous, up
-@section Prerequis
-@cindex prerequis
-
-@unnumberedsubsec GCC/G++
-
-A l'heure actuelle, la bibliotheque de classes Batch est developpee en
-C++ et necessite de fait un compilateur pour ce langage. GCC/G++
-version 2.95.3 (@inforef{Top, ,gcc} pour plus de detail) ou une version
-ulterieure est un choix judicieux.
-
-@unnumberedsubsec Gestionnaires de batch
-
-Comme la bibliotheque utilise les fonctionnalites de certains
-gestionnaires de batch, il est indispensable de pouvoir acceder aux
-bibliotheques et aux fichiers d'entete de ces produits, ou du moins des
-produits dont on se servira par la suite, ceci pour pouvoir communiquer
-a travers l'API qu'ils ont developpe.
-
-Le cas le plus simple est d'avoir le produit directement installe sur la
-machine sur laquelle sera compilee la bibliotheque de classes Batch.
-
-@unnumberedsubsubsec OpenPBS
-@cindex OpenPBS
-@cindex PBS
-
-A ce jour, seul le gestionnaire de batch PBS (OpenPBS et PBS Pro) est
-supporte (voir le site officiel @uref{http://www.openpbs.org}). Il doit
-avoir une version au moins egale a 2.3.16.
-
-@unnumberedsubsubsec LSF
-@cindex LSF
-
-Il est prevu d'avoir un support de LSF dans les mois qui viennent.
-
-@unnumberedsubsubsec LoadLeveler
-@cindex LoadLeveler
-
-Il est prevu d'avoir un support de LoadLeveler mais dans un futur plus
-lointain en fonction de la disponibilite du produit mais surtout d'une
-machine sur lequel il serait installe.
-
-@unnumberedsubsubsec Sun Grid Engine
-
-Ce choix-la est beaucoup plus hypothetique, et risque bien de ne jamais
-etre mene a bien.
-
-@unnumberedsubsubsec Rsh/Ssh
-
-Il est prevu de simuler le fonctionnement d'un gestionnaire de batch a
-l'aide de commandes Unix Rsh et Ssh dans la mesure de leurs capacites
-lorsque qu'il n'est pas possible d'avoir un gestionnaire de batch sur
-certaines machines ou de s'y connecter (par exemple lorsqu'on traverse
-un coupe-feu).
-
-@unnumberedsubsec Python
-@cindex Python
-
-Les classes de haut-niveau de la bibliotheque de classes Batch disposent
-d'une interface en Python qui leur permet d'etre utilisables dans ce
-langage. L'usage de cette fonctionnalite necessite d'avoir a disposition
-une version de Python (voir le site officiel
-@uref{http://www.python.org}) au moins egale a 2.2.
-
-@unnumberedsubsec SWIG
-@cindex SWIG
-
-De plus l'interfacage avec Python est automatise a l'aide de
-l'utilitaire SWIG (voir le site officiel @uref{http://www.swig.org}) qui
-transcrit les definitions des classes C++ en classes Python. Il faut
-pour cela disposer de la version 1.3.17 ou ulterieure.
-
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Installation rapide, Configuration, Prerequis, Installation de la bibliotheque
-@comment node-name, next, previous, up
-@section Installation rapide
-@cindex installation rapide
-
-Il faut commencer par decompresser le fichier @file{.tar.gz} ou
-@file{.tgz} et descendre dans le repertoire qu'il a cree :
-
-@example
-$ tar -xzvf Batch-@value{VERSION}.tar.gz
-$ cd Batch-@value{VERSION}
-@end example
-
-Pour ceux qui sont vraiment presses, le minimum requis est :
-
-@example
-$ ./configure
-$ make
-$ make install
-@end example
-
-Pour ceux qui ont le temps de lire la suite, les sections suivantes
-decrivent plus en detail ces etapes et les differents tests que l'on
-peut mener.
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Configuration, Compilation, Installation rapide, Installation de la bibliotheque
-@comment node-name, next, previous, up
-@section Configuration
-@cindex configuration
-
-La phase de configuration, tres classique dans le domaine des logiciels
-libres, est basee sur les produits autoconf (voir @inforef{Top,
-,autoconf}), automake (voir @inforef{Top, ,automake}) et libtool (voir
-@inforef{Top, ,libtool}).
-
-La configuration est faite a l'aide du programme @file{configure}
-present dans le repertoire racine de la bibliotheque de classes
-Batch. Ce programme analyse l'ensemble des elements du systeme sur
-lequel se deroulera la compilation pour determiner les parametres
-optimaux et la presence de tous les produits necessaires a la
-compilation.
-
-On n'oubliera pas de se referer a la documentation de @file{configure}
-notamment pour determiner l'emplacement definitif de l'installation :
-
-@example
-$ ./configure --help
-@end example
-
-C'est aussi au cours de cette phase de configuration qu'il est
-indispensable de preciser avec quelles options la bibliotheque doit etre
-generee. En particulier il est necessaire d'indiquer avec quel(s)
-gestionnaire(s) de batch doit se faire la compilation de maniere a avoir
-acces a l'API.
-
-Par exemple dans le cas de OpenPBS, il est necessaire de preciser :
-
-@example
-$ ./configure --with-openpbs=/path/to/PBS/root/dir
-@end example
-
-Le chemin @file{/path/to/PBS/root/dir} est optionnel si la variable
-d'environnement @var{openpbs} est definie avec cette meme valeur.
-
-De meme pour Python que l'on indique de la maniere suivante :
-
-@example
-$ ./configure --with-python=/path/to/Python/root/dir
-@end example
-
-ou bien a l'aide de la variable d'environnement @var{pythonhome}.
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Compilation, Compilation de la documentation, Configuration, Installation de la bibliotheque
-@comment node-name, next, previous, up
-@section Compilation
-@cindex compilation
-
-La compilation proprement dite n'appelle pas de remarque particuliere :
-
-@example
-$ make
-@end example
-
-On n'oubliera pas d'utiliser les focntionnalites de chaque @file{make},
-comme par exemple la compilation parallele pour reduire les temps de
-compilation (voir @inforef{Top, ,make}).
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Compilation de la documentation, Tests, Compilation, Installation de la bibliotheque
-@comment node-name, next, previous, up
-@section Compilation de la documentation
-@cindex compilation de la documentation
-
-Normalement la documentation est automatiquement compilee lors de la
-compilation de la bibliotheque, mais uniquement sous la forme d'un
-fichier @file{.info}. Il est egalement possible d'obtenir un fichier
-@file{.dvi} qui permettra de generer d'autres formats comme le
-PostScript (fichier @file{.ps}) ou le PDF (fichier @file{.pdf}), ou bien
-une documentation sous forme HTML (fichier @file{.html}).
-
-Pour fabriquer le fichier @file{.dvi} il faut executer la commande
-suivante :
-
-@example
-$ make dvi
-@end example
-
-Il est alors possible de produire une documentation sous forme
-PostScript :
-
-@example
-$ cd doc
-$ dvips Batch.dvi -o Batch.ps
-@end example
-
-ou PDF :
-
-@example
-$ cd doc
-$ dvipdf Batch.dvi Batch.pdf
-@end example
-
-Pour la documentation HTML, on l'obtient a l'aide de le commande
-suivante :
-
-@example
-$ cd doc
-$ texi2html -split_node Batch.texi
-@end example
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Tests, Installation, Compilation de la documentation, Installation de la bibliotheque
-@comment node-name, next, previous, up
-@section Tests
-@cindex tests
-
-@unnumberedsubsec Tests de pre-installation
-
-La bibliotheque de classes Batch dispose d'un ensemble de tests
-unitaires pour verifier le fonctionnement de chaque classe
-individuellement. Ces tests ne sont pas compiles lors de la compilation
-de la bibliotheque; ils ne le sont qu'au moment du test.
-
-Les tests sont executes de la maniere suivante :
-
-@example
-$ make check
-@end example
-
-A la fin des tests, un compte rendu est fait qui avertit l'utilisateur
-des tests reussis et des echecs rencontres. Chaque test peut etre rejoue
-individuellement en se placant dans le repertoire @file{test} et en
-executant les tests manuellement comme par exemple :
-
-@example
-$ cd test
-$ ./t_Versatile.sh
-@end example
-
-@unnumberedsubsec Tests de post-installation
-
-Certains tests ne sont pas executes lorsque la commande @file{make
-check} est lancee car ceux-ci necessitent l'installation prealable de
-certains fichiers qui ne l'ont pas encore ete, l'installation definitive
-n'ayant pas eu lieu encore. C'est pour cela que ces tests ne doivent et
-ne peuvent etre lances qu'une fois l'installation terminee. @xref{Installation}.
-
-Il faut pour cela executer :
-
-@example
-$ make installcheck
-@end example
-
-De la meme maniere que pour les tests de pre-installation, une compte
-rendu est fait et les tests defaillants peuvent etre rejoues
-manuellement pour determiner le probleme.
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Installation, Divers, Tests, Installation de la bibliotheque
-@comment node-name, next, previous, up
-@section Installation
-@cindex installation
-
-L'installation est la mise a disposition definitive dans le systeme de
-la bibliotheque de classes Batch. C'est la derniere etape de la
-procedure apres la configuration et la compilation.
-
-On l'execute de la maniere suivante :
-
-@example
-$ make install
-@end example
-
-Tous les fichiers compiles, la bibliotheque et les fichiers d'entete
-sont installes dans le repertoire definitif. Les fichiers de test de
-post-installation sont egalement copies (@xref{Tests}.) ainsi que la
-documentation.
-
-
-
-
-
-
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Divers, Index, Installation, Top
-@comment node-name, next, previous, up
-@chapter Divers
-@cindex divers
-
-
-
-
-
-@c ----------------------
-@c ----------------------
-@c ----------------------
-
-@node Index, Top , Divers, Top
-@comment node-name, next, previous, up
-@unnumbered Index
-
-@heading Index des concepts
-@printindex cp
-
-@heading Index des fonctions et des methodes
-@printindex fn
-
-@bye
-
+++ /dev/null
-/*!
-
-\page batch_page Batch
-
-<a href="Batch.html/index.html"> Batch documentation </a>
-
-*/
-
-
-
include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-usr_docs: doxyfile ../Batch.html
+usr_docs: doxyfile
echo "Running doxygen in directory: "`pwd`; \
- $(DOXYGEN) $< ; \
- cp -rf ../Batch.html KERNEL
+ $(DOXYGEN) $< ;
docs: usr_docs
-info_TEXINFOS = ../Batch.texi
-
install-data-local: usr_docs
$(INSTALL) -d $(DESTDIR)$(docdir)/gui
cp -rp KERNEL $(DESTDIR)$(docdir)/gui
FILE_PATTERNS = *.dox *.idl *.hxx *.cxx *.py
RECURSIVE = YES
-EXCLUDE = @top_srcdir@/doc/salome/batch.dox
+EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH = @top_srcdir@/doc/salome/examples
- \subpage kernel_salome
- \subpage dsc_page : DSC documentation page.
- \subpage salome_file_page : Salome_file documentation page.
- - <a href="Batch.html/index.html"> Batch documentation </a>
*/
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : Calcium_Ports.idl
-// Author : Eric Fayolle, EDF
-//
-#ifndef _CALCIUM_PORTS_IDL_
-#define _CALCIUM_PORTS_IDL_
-
-#include "SALOME_Ports.idl"
-
-/*! \file Calcium_Ports.idl \brief interfaces for Calcium ports
-*/
-
-module Ports {
-
-/*! \brief module that contains interfaces to define Calcium ports
-*/
- module Calcium_Ports {
-
- const long UNLIMITED_STORAGE_LEVEL = -70;
- enum DependencyType { UNDEFINED_DEPENDENCY, TIME_DEPENDENCY, ITERATION_DEPENDENCY };
- enum DateCalSchem { TI_SCHEM, TF_SCHEM , ALPHA_SCHEM};
- enum InterpolationSchem { L0_SCHEM, L1_SCHEM };
- enum ExtrapolationSchem { UNDEFINED_EXTRA_SCHEM, E0_SCHEM, E1_SCHEM};
-
- // enum DisconnectDirective {UNDEFINED_DIRECTIVE,CONTINUE,STOP};
- typedef boolean DisconnectDirective;
- const DisconnectDirective stop = FALSE;
- const DisconnectDirective cont = TRUE;
-
- interface Calcium_Port : Ports::Data_Port, Ports::PortProperties {
- void disconnect(in DisconnectDirective mode);
- };
-
- typedef sequence<long> seq_long;
- typedef sequence<float> seq_float;
- typedef sequence<double> seq_double;
- typedef sequence<string> seq_string;
- typedef sequence<boolean> seq_boolean;
- typedef seq_float seq_complex;
-
- interface Calcium_Integer_Port : Calcium_Port {
- void put (in seq_long data, in double time, in long tag);
- };
-
- interface Calcium_Real_Port : Calcium_Port {
- void put (in seq_float data, in double time, in long tag);
- };
-
- interface Calcium_Double_Port : Calcium_Port {
- void put (in seq_double data, in double time, in long tag);
- };
-
- interface Calcium_String_Port : Calcium_Port {
- void put (in seq_string data, in double time, in long tag);
- };
-
- interface Calcium_Logical_Port : Calcium_Port {
- void put (in seq_boolean data, in double time, in long tag);
- };
-
- interface Calcium_Complex_Port : Calcium_Port {
- void put (in seq_complex data, in double time, in long tag);
- };
-
- };
-};
-
-#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SALOME_Ports.idl
+// Author : Eric Fayolle, EDF
+//
+#ifndef _CALCIUM_PORTS_IDL_
+#define _CALCIUM_PORTS_IDL_
+
+#include "SALOME_Ports.idl"
+
+module Ports {
+
+ module Calcium_Ports {
+
+ const long UNLIMITED_STORAGE_LEVEL = -70;
+ enum DependencyType { UNDEFINED_DEPENDENCY, TIME_DEPENDENCY, ITERATION_DEPENDENCY };
+ enum DateCalSchem { TI_SCHEM, TF_SCHEM , ALPHA_SCHEM};
+ enum InterpolationSchem { L0_SCHEM, L1_SCHEM };
+ enum ExtrapolationSchem { UNDEFINED_EXTRA_SCHEM, E0_SCHEM, E1_SCHEM};
+
+ // enum DisconnectDirective {UNDEFINED_DIRECTIVE,CONTINUE,STOP};
+ typedef boolean DisconnectDirective;
+ const DisconnectDirective stop = FALSE;
+ const DisconnectDirective cont = TRUE;
+
+ interface Calcium_Port : Ports::Data_Port, Ports::PortProperties {
+ void disconnect(in DisconnectDirective mode);
+ };
+
+ typedef sequence<long> seq_long;
+ typedef sequence<long long> seq_long_long;
+ typedef sequence< @CALCIUM_IDL_INT_F77@ > seq_integer;
+
+ typedef sequence<float> seq_float;
+ typedef sequence<double> seq_double;
+ typedef sequence<string> seq_string;
+ typedef sequence<boolean> seq_boolean;
+ typedef seq_float seq_complex;
+
+ //Fortran int size conforming port
+ interface Calcium_Integer_Port : Calcium_Port {
+ void put (in seq_integer data, in double time, in long tag);
+ };
+
+ interface Calcium_Intc_Port : Calcium_Port {
+ void put (in seq_long data, in double time, in long tag);
+ };
+
+ interface Calcium_Long_Port : Calcium_Port {
+ void put (in seq_long_long data, in double time, in long tag);
+ };
+
+
+ interface Calcium_Real_Port : Calcium_Port {
+ void put (in seq_float data, in double time, in long tag);
+ };
+
+ interface Calcium_Double_Port : Calcium_Port {
+ void put (in seq_double data, in double time, in long tag);
+ };
+
+ interface Calcium_String_Port : Calcium_Port {
+ void put (in seq_string data, in double time, in long tag);
+ };
+
+ interface Calcium_Logical_Port : Calcium_Port {
+ void put (in seq_boolean data, in double time, in long tag);
+ };
+
+ interface Calcium_Complex_Port : Calcium_Port {
+ void put (in seq_complex data, in double time, in long tag);
+ };
+
+ };
+};
+
+#endif
#
include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-AM_CXXFLAGS = -fPIC
+AM_CXXFLAGS += -fPIC
BASEIDL_FILES = \
SALOME_Exception.idl \
nstest.idl \
DSC_Engines.idl \
SALOME_Ports.idl \
- Calcium_Ports.idl \
+ SALOME_PyNode.idl \
Palm_Ports.idl \
SALOME_PACOExtension.idl \
SALOME_ParamPorts.idl
SALOME_PACOExtension.xml SALOME_ParamPorts.xml
# This variable defines the files to be installed
-salomeidl_DATA = $(IDL_FILES)
+salomeidl_DATA = $(IDL_FILES)
+nodist_salomeidl_DATA = Calcium_Ports.idl
# Sources built from idl files
# BUILT_SOURCE = first thing done on make all
nstestSK.cc \
DSC_EnginesSK.cc \
SALOME_PortsSK.cc \
+ SALOME_PyNodeSK.cc \
Calcium_PortsSK.cc \
Palm_PortsSK.cc \
SALOME_PACOExtensionSK.cc \
SALOMEDSDynSK.cc SALOME_SessionDynSK.cc SALOME_RessourcesCatalogDynSK.cc \
DSC_EnginesDynSK.cc SALOME_ComponentDynSK.cc SALOME_GenericObjDynSK.cc \
Palm_PortsDynSK.cc SALOME_ExceptionDynSK.cc SALOMEDS_AttributesDynSK.cc \
- LoggerDynSK.cc SALOME_PACOExtensionDynSK.cc SALOME_ParamPortsDynSK.cc
+ LoggerDynSK.cc SALOME_PACOExtensionDynSK.cc SALOME_ParamPortsDynSK.cc SALOME_PyNodeDynSK.cc
MPIIDL_SOURCES = \
SALOME_MPIObjectSK.cc \
endif
idldir = $(prefix)/idl/salome
-nodist_idl_DATA = ${XML} ${IDL_PACO}
-nodist_salomeinclude_HEADERS = ${INCLUDES_PACO}
+nodist_idl_DATA = ${XML} ${IDL_PACO} Calcium_Ports.idl
+nodist_salomeinclude_HEADERS = ${INCLUDES_PACO}
BUILT_SOURCES = $(IDL_SOURCES) $(PAR) $(PAR_INCLUDES)
lib_LTLIBRARIES = libSalomeIDLKernel.la $(PAR_LIB)
nodist_libSalomeIDLKernel_la_SOURCES = $(IDL_SOURCES) $(DYNIDL_SRCS)
-libSalomeIDLKernel_la_CPPFLAGS =-I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h \
- -I$(top_builddir)/idl \
+libSalomeIDLKernel_la_CPPFLAGS =-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
libSalomeIDLKernel_la_LDFLAGS = -no-undefined -version-info=0:0:0
libSalomeIDLKernel_la_LIBADD = @CORBA_LIBS@
nodist_libSalomeParallelIDLKernel_la_SOURCES = $(PAR) $(GEN_PACO)
-libSalomeParallelIDLKernel_la_CPPFLAGS =-I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h \
- -I$(top_builddir)/idl \
+libSalomeParallelIDLKernel_la_CPPFLAGS =-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \
@PACO_INCLUDES@
libSalomeParallelIDLKernel_la_LDFLAGS = -no-undefined -version-info=0:0:0
libSalomeParallelIDLKernel_la_LIBADD = libSalomeIDLKernel.la @PACO_LIBS@
# These variables defines the building process of CORBA files
-OMNIORB_IDL = @OMNIORB_IDL@
-OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@
-OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_builddir)/salome/idl
-IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -Wba -I$(top_builddir)/salome/idl
-IDLPYFLAGS = @IDLPYFLAGS@
+IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(srcdir) -I$(top_builddir)/salome/idl
+IDLPYFLAGS = @IDLPYFLAGS@ -I$(srcdir)
# potential problem on parallel make on the following - multiple outputs
SUFFIXES = .idl .hh SK.cc
.idlSK.cc:
- $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
+ $(IDL) $(IDLCXXFLAGS) $<
SK.cc.hh:
#Dummy rule to replace the following one (for parallel make)
#.idl.hh:
-# $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
+# $(IDL) $(IDLCXXFLAGS) $<
if WITH_PACO_PARALLEL
%PaCO.idl %PaCO.hxx %PaCO.cxx : %.idl %.xml
- $(OMNIORB_IDL) -p@PACOPATH@/lib/python -bpaco -Wb$(top_srcdir)/idl/$*.xml,$(srcdir):@PACOPATH@/idl $(top_srcdir)/idl/$*.idl
+ $(IDL) -p@PACOPATH@/lib/python -bpaco -Wb$(top_srcdir)/idl/$*.xml,$(srcdir):@PACOPATH@/idl $(top_srcdir)/idl/$*.idl
-%.hxx: %.idl
- $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) -Wbh=.hxx -Wbs=.cxx $<
+.idl.hxx:
+ $(IDL) $(IDLCXXFLAGS) -Wbh=.hxx -Wbs=.cxx $<
endif
-install-exec-local: $(IDL_FILES:%=$(top_srcdir)/idl/%)
+install-exec-local: $(IDL_FILES:%=$(top_srcdir)/idl/%) Calcium_Ports.idl
$(INSTALL) -d $(DESTDIR)$(salomepythondir)
ls $^ | while read file; do \
- $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \
+ $(IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \
done
if WITH_PACO_PARALLEL
ls $(top_builddir)/idl/*.idl | while read file; do \
- $(OMNIORB_IDL) $(IDLPYFLAGS) -I$(top_srcdir)/idl -I@PACOPATH@/idl -C$(DESTDIR)$(salomepythondir) $$file ; \
+ $(IDL) $(IDLPYFLAGS) -I$(top_srcdir)/idl -I@PACOPATH@/idl -C$(DESTDIR)$(salomepythondir) $$file ; \
done
endif
rm -rf $(DESTDIR)$(salomepythondir)/*
mostlyclean-local:
- -rm -f *.hh *.cc .depidl
+ -rm -f *.hh *.cc .depidl Calcium_Ports.idl
# we use cpp to generate dependencies between idl files.
# option x c tells the preprocessor to consider idl as a c file.
# if an idl is modified, all idl dependencies are rebuilt
-.depidl: $(IDL_FILES)
+.depidl: $(IDL_FILES) Calcium_Ports.idl
@echo "" > $@
@for dep in $^ dummy; do \
if [ $$dep != "dummy" ]; then \
-include .depidl
-CLEANFILES = *PaCO* *.hxx *.cxx
+CLEANFILES = *PaCO* *.hxx *.cxx Calcium_Ports.idl
+
#include "SALOME_GenericObj.idl"
/*! \brief
- This package contains the interfaces used for creation, managment
+ This package contains the interfaces used for creation, management
and modification of the %Study
*/
module SALOMEDS
*/
void SetBoolean( in string theVarName, in boolean theValue );
+/*! \brief Create string variable with Name theVarName and value theValue
+
+ (or set if variable value into theValue already exists)
+ \param theVarName is a name of the variable
+ \param theVarName is a value of the variable.
+*/
+ void SetString( in string theVarName, in string theValue );
+
+/*! \brief Set current value as double for string variable
+*/
+ void SetStringAsDouble( in string theVarName, in double theValue );
+
/*! \brief Get value of a real variable
\param theVarName is a name of the variable.
\param theVarName is a name of the variable.
*/
boolean GetBoolean( in string theVarName );
+
+/*! \brief Get value of a string variable
+
+ \param theVarName is a name of the variable.
+*/
+ string GetString( in string theVarName );
/*! \brief Indicate if a variable is real
*/
boolean IsBoolean( in string theVarName );
+/*! \brief Indicate if a variable is string
+
+ Return true if variable is string otherwise return false.
+ \param theVarName is a name of the variable.
+*/
+ boolean IsString( in string theVarName );
+
/*! \brief Indicate if a variable exists in the study
Return true if variable exists in the study,
#include "SALOMEDS.idl"
#include "SALOME_Exception.idl"
+#include "SALOME_PyNode.idl"
/*! \file SALOME_Component.idl \brief interfaces for Component and Container
*/
any value;
};
+ //! Structure data type to hold reference on data
+ struct dataref
+ {
+ string ref;
+ };
+
typedef sequence<KeyValuePair> FieldsDict;
interface Component ;
\param localFile the local file to create by copy
*/
void copyFile(in Container contai, in string remoteFile, in string localFile);
+
+ //! Create a PyNode in the container
+ /*!
+ \param nodeName the name of the PyNode
+ \param code python code as text to load in the node
+ */
+ PyNode createPyNode(in string nodeName, in string code) raises(SALOME::SALOME_Exception);
};
/*! \brief Interface of the %component.
//! Determines whether the server has already been loaded or not.
void ping();
-//
-// Set study associated to component instance
-// \param studyId
-// (=0: multistudy component instance,
-// >0: study id associated to this instance
-// \return false if already set with a different value (change not possible)
-//
-// boolean setStudyId(in long studyId);
-
//! Get study associated to component instance
/*!
get study associated to component instance
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SALOME_PyNode.idl
+// Author : Christian CAREMOLI, EDF
+// $Header:
+//
+#ifndef _SALOME_PYNODE_IDL_
+#define _SALOME_PYNODE_IDL_
+
+#include "SALOME_GenericObj.idl"
+#include "SALOME_Exception.idl"
+
+/*! \file SALOME_PyNode.idl \brief interface for remote python execution
+*/
+
+/*! \brief
+This is a package of interfaces used for executing Python code on remote container
+*/
+module Engines
+{
+ typedef sequence<octet> pickledArgs;
+
+ interface PyNode : SALOME::GenericObj
+ {
+
+ /*! \brief execute a python function defined in the node
+
+ \param functionName the python function defined in the node to execute
+ \param inargs input argument values provided as a python pickle
+ \return output argument values as a python pickle
+ */
+ pickledArgs execute(in string functionName,in pickledArgs inargs) raises (SALOME::SALOME_Exception);
+
+ } ;
+
+};
+
+#endif
<sequence name="intvec" content="int"/>
<sequence name="stringvec" content="string"/>
<sequence name="boolvec" content="bool"/>
+ <struct name="dataref" >
+ <member name="ref" type="string"/>
+ </struct>
<objref name="CALCIUM_integer" id="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0"/>
<objref name="CALCIUM_real" id="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"/>
<objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
ENDIF(BOOST_STATUS)
IF(BOOST_STATUS)
- IF(WINDOWS)
- IF(CMAKE_BUILD_TYPE STREQUAL Debug)
- SET(EXTENSION -gd)
- ELSE(CMAKE_BUILD_TYPE STREQUAL Debug)
- SET(EXTENSION)
- ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
- FIND_LIBRARY(BOOST_LIB_THREAD libboost_thread-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS})
- FIND_LIBRARY(BOOST_LIB_DATE_TIME libboost_date_time-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS})
- FIND_LIBRARY(BOOST_LIB_SIGNALS libboost_signals-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS})
- FIND_LIBRARY(BOOST_LIB_FILESYSTEM libboost_filesystem-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS})
- FIND_LIBRARY(BOOST_LIB_SYSTEM libboost_system-vc90-mt${EXTENSION}-1_35 ${BOOST_LIB_PATHS})
- ELSE(WINDOWS)
- FIND_LIBRARY(BOOST_LIB_THREAD boost_thread ${BOOST_LIB_PATHS})
- ENDIF(WINDOWS)
SET(BOOST_LIBS)
- SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_THREAD})
- SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_DATE_TIME})
- SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_SIGNALS})
- SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_FILESYSTEM})
- SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_SYSTEM})
+ FOREACH(name thread date_time signals filesystem system regex)
+ IF(WINDOWS)
+ IF(CMAKE_BUILD_TYPE STREQUAL Debug)
+ SET(EXTENSION -gd)
+ ELSE(CMAKE_BUILD_TYPE STREQUAL Debug)
+ SET(EXTENSION)
+ ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
+ SET(LIB_NAMES)
+ FOREACH(version 1_35 1_38)
+ SET(LIB_NAMES ${LIB_NAMES} libboost_${name}-vc90-mt${EXTENSION}-${version})
+ ENDFOREACH(version 1_35 1_38)
+ FIND_LIBRARY(BOOST_LIB_${name} NAMES ${LIB_NAMES} PATHS ${BOOST_LIB_PATHS})
+ ELSE(WINDOWS)
+ FIND_LIBRARY(BOOST_LIB_${name} boost_${name} PATHS ${BOOST_LIB_PATHS})
+ ENDIF(WINDOWS)
+ IF(NOT BOOST_LIB_${name})
+ SET(BOOST_STATUS 0)
+ ENDIF(NOT BOOST_LIB_${name})
+ STRING(TOUPPER ${name} upname)
+ SET(BOOST_LIB_${upname} ${BOOST_LIB_${name}})
+ SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_${name}})
+ ENDFOREACH(name thread date_time signals filesystem system)
ENDIF(BOOST_STATUS)
# ------
--- /dev/null
+# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# ------
+
+MESSAGE(STATUS "Check for doxygen ...")
+
+# ------
+
+IF(DOXYGEN_IS_MANDATORY STREQUAL 0)
+ SET(DOXYGEN_IS_MANDATORY 0)
+ SET(DOXYGEN_IS_OPTIONAL 1)
+ENDIF(DOXYGEN_IS_MANDATORY STREQUAL 0)
+IF(DOXYGEN_IS_OPTIONAL STREQUAL 0)
+ SET(DOXYGEN_IS_MANDATORY 1)
+ SET(DOXYGEN_IS_OPTIONAL 0)
+ENDIF(DOXYGEN_IS_OPTIONAL STREQUAL 0)
+IF(NOT DOXYGEN_IS_MANDATORY AND NOT DOXYGEN_IS_OPTIONAL)
+ SET(DOXYGEN_IS_MANDATORY 0)
+ SET(DOXYGEN_IS_OPTIONAL 1)
+ENDIF(NOT DOXYGEN_IS_MANDATORY AND NOT DOXYGEN_IS_OPTIONAL)
+
+# ------
+
+SET(DOXYGEN_STATUS 1)
+IF(WITHOUT_DOXYGEN OR WITH_DOXYGEN STREQUAL 0)
+ SET(DOXYGEN_STATUS 0)
+ MESSAGE(STATUS "doxygen disabled from command line.")
+ENDIF(WITHOUT_DOXYGEN OR WITH_DOXYGEN STREQUAL 0)
+
+# ------
+
+IF(DOXYGEN_STATUS)
+ IF(WITH_DOXYGEN)
+ SET(DOXYGEN_ROOT_USER ${WITH_DOXYGEN})
+ ENDIF(WITH_DOXYGEN)
+ IF(NOT DOXYGEN_ROOT_USER)
+ SET(DOXYGEN_ROOT_USER $ENV{DOXYGEN_ROOT})
+ ENDIF(NOT DOXYGEN_ROOT_USER)
+ IF(NOT DOXYGEN_ROOT_USER)
+ SET(DOXYGEN_ROOT_USER $ENV{DOXYGENHOME})
+ ENDIF(NOT DOXYGEN_ROOT_USER)
+ENDIF(DOXYGEN_STATUS)
+
+# ------
+
+IF(DOXYGEN_STATUS)
+ SET(DOXYGEN_EXECUTABLE_TO_FIND doxygen)
+ IF(DOXYGEN_ROOT_USER)
+ FIND_PROGRAM(DOXYGEN_EXECUTABLE ${DOXYGEN_EXECUTABLE_TO_FIND} PATHS ${DOXYGEN_ROOT_USER}/bin NO_DEFAULT_PATH)
+ ELSE(DOXYGEN_ROOT_USER)
+ FIND_PROGRAM(DOXYGEN_EXECUTABLE ${DOXYGEN_EXECUTABLE_TO_FIND})
+ ENDIF(DOXYGEN_ROOT_USER)
+ IF(DOXYGEN_EXECUTABLE)
+ MESSAGE(STATUS "${DOXYGEN_EXECUTABLE_TO_FIND} found: ${DOXYGEN_EXECUTABLE}")
+ ELSE(DOXYGEN_EXECUTABLE)
+ MESSAGE(STATUS "${DOXYGEN_EXECUTABLE_TO_FIND} not found, try to use WITH_DOXYGEN option or DOXYGEN_ROOT (or DOXYGENHOME) environment variable")
+ SET(DOXYGEN_STATUS 0)
+ ENDIF(DOXYGEN_EXECUTABLE)
+ENDIF(DOXYGEN_STATUS)
+
+# ----
+
+IF(DOXYGEN_STATUS)
+ SET(DOXYGEN_IS_OK 1)
+ELSE(DOXYGEN_STATUS)
+ SET(DOXYGEN_IS_OK 0)
+ IF(DOXYGEN_IS_MANDATORY)
+ MESSAGE(FATAL_ERROR "doxygen not found ... mandatory ... abort")
+ ELSE(DOXYGEN_IS_MANDATORY)
+ MESSAGE(STATUS "doxygen not found ... optional ... disabled")
+ ENDIF(DOXYGEN_IS_MANDATORY)
+ENDIF(DOXYGEN_STATUS)
+
+# ----
SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl)
ENDIF(WINDOWS)
+SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4)
+
# SET(PLATFORM_CPPFLAGS)
# # # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT -D_CRT_SECURE_NO_WARNINGS)
# # SET(RM del)
# ----
IF(PYTHON_STATUS)
+ SET(PYTHON_CPPFLAGS ${PYTHON_INCLUDES})
ELSE(PYTHON_STATUS)
IF(PYTHON_IS_MANDATORY)
MESSAGE(FATAL_ERROR "python not found ... mandatory ... abort")
am2cmake.py \
FindBOOST.cmake \
FindCPPUNIT.cmake \
+FindDOXYGEN.cmake \
FindHDF5.cmake \
FindKERNEL.cmake \
FindLIBXML2.cmake \
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
"XmlTObjPlugin",
"XmlXCAFPlugin",
]
+ vtk_list = [
+ "vtkCommonPythonD",
+ "vtkGraphicsPythonD",
+ "vtkImagingPythonD",
+ ]
kernel_list = [
"DF",
"Launcher",
"StdMeshersGUI",
"StdMeshers",
]
- full_list = cas_list + kernel_list + gui_list
+ full_list = cas_list + vtk_list
+ full_list += kernel_list + gui_list
full_list += geom_list + med_list + smesh_list
# --
# E.A. : sort by len before substitution ...
INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)
INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
+ INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)
""")
pass
else:
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
+ INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake)
""")
if self.module == "gui":
INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindBLSURF.cmake)
""")
pass
+ if self.module == "hexoticplugin":
+ newlines.append("""
+ SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
+ SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
+ SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
+ INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
+ INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
+ INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)
+ """)
+ pass
+ if self.module == "ghs3dplugin":
+ newlines.append("""
+ SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
+ SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
+ SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
+ INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
+ INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
+ INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)
+ """)
+ pass
if self.module == "visu":
newlines.append("""
SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
""")
pass
+ if self.module == "yacs":
+ newlines.append("""
+ INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindEXPAT.cmake)
+ INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindGRAPHVIZ.cmake)
+ """)
+ pass
pass
pass
# --
+ newlines.append("""
+ SET(DOXYGEN_IS_OK 0)
+ """)
+ if self.module not in ['med']:
+ newlines.append("""
+ IF(WINDOWS)
+ SET(CPPUNIT_IS_OK 0)
+ ENDIF(WINDOWS)
+ """)
+ pass
+ # --
if self.module == "kernel":
newlines.append("""
SET(WITH_LOCAL 1)
SET(WITH_BATCH 1)
- set(VERSION 5.1.2)
- set(XVERSION 0x050102)
+ set(VERSION 5.1.3)
+ set(XVERSION 0x050103)
+ SET(CALCIUM_IDL_INT_F77 long)
+ SET(CALCIUM_CORBA_INT_F77 CORBA::Long)
+ SET(LONG_OR_INT int)
""")
elif self.module == "gui":
newlines.append("""
SET(ENABLE_PLOT2DVIEWER ON)
SET(ENABLE_PYCONSOLE ON)
SET(ENABLE_SUPERVGRAPHVIEWER ON)
- # SET(ENABLE_QXGRAPHVIEWER ON)
- set(VERSION 5.1.2)
- set(XVERSION 0x050102)
+ SET(ENABLE_QXGRAPHVIEWER ON)
+ set(VERSION 5.1.3)
+ set(XVERSION 0x050103)
""")
pass
elif self.module == "geom":
elif self.module == "med":
newlines.append("""
SET(MED_ENABLE_KERNEL ON)
+ IF(NOT WINDOWS)
+ SET(MED_ENABLE_SPLITTER ON)
+ ENDIF(NOT WINDOWS)
SET(MED_ENABLE_GUI ON)
""")
pass
SET(BLSURFPLUGIN_ENABLE_GUI ON)
""")
pass
+ elif self.module == "ghs3dplugin":
+ newlines.append("""
+ SET(GHS3DPLUGIN_ENABLE_GUI ON)
+ """)
+ pass
+ elif self.module == "yacs":
+ newlines.append("""
+ SET(SALOME_KERNEL ON)
+ SET(HAS_GUI ON)
+ """)
+ pass
# --
pass
# --
SET(AM_CXXFLAGS)
SET(LDADD)
""")
+ if self.module == "kernel":
+ newlines.append(r'''
+ SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h)
+ SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h)
+ ''')
+ else:
+ if self.module not in ["yacs"]:
+ newlines.append(r'''
+ SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h)
+ SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h)
+ ''')
+ pass
+ pass
# --
return
# --
# Convert the .in files in build dir
# --
+ if self.module == "yacs":
+ key = "salomegui"
+ if self.root[-len(key):] == key:
+ self.files.append("resources/YACSCatalog.xml.in")
+ pass
+ pass
for f in self.files:
if f[-3:] == ".in":
if f == "sstream.in":
# --
# --
- for key in ["bin_PROGRAMS"]:
+ for key in ["bin_PROGRAMS", "check_PROGRAMS"]:
if self.__thedict__.has_key(key):
self.addBinTarget(key, newlines)
pass
key = "IDL_FILES"
if self.__thedict__.has_key(key):
+ if self.module == "kernel":
+ newlines.append('''
+ SET(IDL_FILES ${IDL_FILES} Calcium_Ports.idl)
+ ''')
+ pass
newlines.append('''
FOREACH(input ${IDL_FILES})
STRING(REGEX REPLACE ".idl" "" base ${input})
SET(outputs ${src})
SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc)
SET(outputs ${outputs} ${dynsrc})
+ SET(inc ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh)
+ SET(outputs ${outputs} ${inc})
+ IF(input STREQUAL Calcium_Ports.idl)
+ SET(input ${CMAKE_CURRENT_BINARY_DIR}/${input})
+ ELSE(input STREQUAL Calcium_Ports.idl)
+ SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
+ ENDIF(input STREQUAL Calcium_Ports.idl)
+ SET(flags ${IDLCXXFLAGS} ${OMNIORB_IDLCXXFLAGS})
+ STRING(REGEX MATCH "-bcxx" ISBCXX ${flags})
+ IF(NOT ISBCXX)
+ SET(flags -bcxx ${flags})
+ ENDIF(NOT ISBCXX)
ADD_CUSTOM_COMMAND(
OUTPUT ${outputs}
- COMMAND ${OMNIORB_IDL} ${IDLCXXFLAGS} ${OMNIORB_IDLCXXFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${input}
+ COMMAND ${OMNIORB_IDL} ${flags} ${input}
MAIN_DEPENDENCY ${input}
)
install(FILES ${input} DESTINATION idl/salome)
FOREACH(f ${IDLPYFLAGS})
SET(flags "${flags} ${f}")
ENDFOREACH(f ${IDLPYFLAGS})
+ STRING(REGEX MATCH "-bpython" ISBPYTHON ${flags})
+ IF(NOT ISBPYTHON)
+ SET(flags "-bpython ${flags}")
+ ENDIF(NOT ISBPYTHON)
SET(IDLPYFLAGS ${flags})
STRING(REPLACE "\\\\" "/" IDLPYFLAGS ${IDLPYFLAGS})
INSTALL(CODE "SET(IDLPYFLAGS ${IDLPYFLAGS})")
''')
pass
+ # --
+ # --
+ if self.__thedict__.has_key("BUILT_SOURCES"):
+ newlines.append('''
+ FOREACH(f ${BUILT_SOURCES})
+ IF(f MATCHES "WRAP.cxx$")
+ # STRING(REGEX REPLACE "WRAP.cxx" "WRAP.h" inc ${f})
+ STRING(REGEX REPLACE "WRAP.cxx" ".i" input ${f})
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${f} # ${inc}
+ COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} ${SWIG_PYTHON_INCLUDES} ${MYSWIG_FLAGS} -o ${f} ${CMAKE_CURRENT_SOURCE_DIR}/${input}
+ MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${input}
+ )
+ ENDIF(f MATCHES "WRAP.cxx$")
+ ENDFOREACH(f ${BUILT_SOURCES})
+ ''')
+ pass
+
# --
# --
key = "MOC_FILES"
if self.__thedict__.has_key(key):
newlines.append('''
FOREACH(output ${MOC_FILES})
- STRING(REGEX REPLACE _moc.cxx .h input ${output})
+ ''')
+ if self.module == "yacs":
+ newlines.append('''
+ STRING(REGEX REPLACE _moc.cxx .hxx input ${output})
+ ''')
+ else:
+ newlines.append('''
+ STRING(REGEX REPLACE _moc.cxx .h input ${output})
+ ''')
+ pass
+ newlines.append('''
SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})
ADD_CUSTOM_COMMAND(
"nodist_salomescript_DATA" : "bin/salome",
"salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome",
"nodist_salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome",
+ "dist_salomepython_DATA" : "lib/python${PYTHON_VERSION}/site-packages/salome",
"sharedpkgpython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome/shared_modules",
}
if self.module == "medfile":
# --
newlines.append(r'''
SET(libs ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS})
- IF(name STREQUAL SALOMEBasics)
+ FOREACH(lib SALOMEBasics SalomeBatch)
+ IF(name STREQUAL lib)
SET(libs ${libs} ${PTHREAD_LIBS})
- ENDIF(name STREQUAL SALOMEBasics)
+ ENDIF(name STREQUAL lib)
+ ENDFOREACH(lib SALOMEBasics SalomeBatch)
''')
if key == "bin_PROGRAMS":
newlines.append(r'''
GET_FILENAME_COMPONENT(ext ${lib} EXT)
IF(ext STREQUAL .la)
GET_FILENAME_COMPONENT(lib ${lib} NAME_WE)
- STRING(REPLACE "lib" "" lib ${lib})
+ STRING(REGEX REPLACE "^lib" "" lib ${lib})
ENDIF(ext STREQUAL .la)
SET(vars)
SET(vars ${vars} -no-undefined)
+ SET(vars ${vars} -lvtkWidgets)
IF(WINDOWS)
SET(vars ${vars} -module)
SET(vars ${vars} -Wl,-E)
SET(vars ${vars} -lm)
SET(vars ${vars} -lboost_thread)
SET(vars ${vars} -lboost_signals)
- SET(vars ${vars} -lvtkWidgets)
+ SET(vars ${vars} -pthread -lpthread -ldl)
ENDIF(WINDOWS)
FOREACH(v ${vars})
IF(lib STREQUAL v)
ENDIF(WINDOWS)
''')
# --
+ if self.module in ["medfile", "yacs"]:
+ newlines.append(r'''
+ IF(WINDOWS)
+ SET(var ${var} -DNOGDI)
+ ENDIF(WINDOWS)
+ ''')
+ pass
+ # --
newlines.append(r'''
IF(WINDOWS)
SET(targets)
SET(dir $ENV{F2CHOME})
STRING(REPLACE "\\\\" "/" dir ${dir})
SET(var ${var} -I${dir})
+ SET(var ${var} -DF2C_BUILD)
ENDIF(name STREQUAL ${target})
ENDFOREACH(target ${targets})
ENDIF(WINDOWS)
SET(var ${var} -I${CMAKE_CURRENT_BINARY_DIR})
''')
pass
- if key == "bin_PROGRAMS":
+ newlines.append(r'''
+ SET(var ${var} ${AM_CPPFLAGS})
+ SET(var ${var} ${AM_CXXFLAGS})
+ ''')
+ if self.module == "yacs":
newlines.append(r'''
- SET(var ${var} ${AM_CPPFLAGS})
- SET(var ${var} ${AM_CXXFLAGS})
+ SET(var ${var} -DYACS_PTHREAD)
+ SET(var ${var} -DCMAKE_BUILD)
+ SET(var ${var} -DSALOME_KERNEL)
+ SET(var ${var} -DDSC_PORTS)
+ SET(var ${var} -DOMNIORB)
''')
pass
newlines.append(r'''
IF(WINDOWS)
SET(vars ${vars} -include SALOMEconfig.h)
SET(vars ${vars} -ftemplate-depth-32)
+ SET(vars ${vars} -fPIC)
+ SET(vars ${vars} -g)
ENDIF(WINDOWS)
SET(flags)
FOREACH(f ${var})
ENDFOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
''')
newlines.append(r'''
- SET(build_srcs)
+ SET(l ${nodist_${amname}_SOURCES} ${UIC_FILES})
+ FOREACH(f ${l})
+ SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f})
+ SET(srcs ${srcs} ${src})
+ ENDFOREACH(f ${l})
''')
newlines.append(r'''
+ SET(build_srcs)
SET(l ${nodist_${amname}_SOURCES} ${BUILT_SOURCES})
- ''')
- newlines.append(r'''
FOREACH(f ${l})
GET_FILENAME_COMPONENT(ext ${f} EXT)
IF(ext STREQUAL .py)
SET(build_srcs ${build_srcs} ${CMAKE_CURRENT_BINARY_DIR}/${f})
ENDIF(ext STREQUAL .py)
ENDFOREACH(f ${l})
- SET(srcs ${build_srcs} ${srcs})
''')
# --
# Add the library to cmake
IF(BEGIN_WITH_lib)
INSTALL(TARGETS ${name} DESTINATION ${DEST})
''')
+ if self.module == "gui":
+ newlines.append(r'''
+ FOREACH(lib SalomePyQt)
+ IF(name STREQUAL lib)
+ IF(WINDOWS)
+ IF(CMAKE_BUILD_TYPE STREQUAL Release)
+ INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}.pyd)
+ ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
+ INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}_d.pyd)
+ ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+ ELSE(WINDOWS)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so DESTINATION ${DEST} RENAME ${name}.so)
+ ENDIF(WINDOWS)
+ ENDIF(name STREQUAL lib)
+ ENDFOREACH(lib SalomePyQt)
+ FOREACH(lib SalomePy)
+ IF(name STREQUAL lib)
+ IF(WINDOWS)
+ IF(CMAKE_BUILD_TYPE STREQUAL Release)
+ INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.pyd)
+ ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
+ INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}_d.pyd)
+ ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+ ENDIF(WINDOWS)
+ ENDIF(name STREQUAL lib)
+ ENDFOREACH(lib SalomePy)
+ ''')
+ pass
if self.module == "geom":
newlines.append(r'''
IF(WINDOWS)
''')
pass
newlines.append(r'''
- # IF(name STREQUAL SalomePyQt)
- # INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so DESTINATION ${DEST} RENAME ${name}.so)
- # ENDIF(name STREQUAL SalomePyQt)
- ''')
- newlines.append(r'''
ELSE(BEGIN_WITH_lib)
''')
newlines.append(r'''
def addBinTarget(self, key, newlines):
# --
newlines.append(r'''
- FOREACH(amname ${bin_PROGRAMS})
+ FOREACH(amname ${bin_PROGRAMS} ${check_PROGRAMS})
''')
# --
newlines.append(r'''
SET(name "${amname}_exe")
SET(srcs ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
+ SET(l ${nodist_${amname}_SOURCES})
+ FOREACH(f ${l})
+ SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f})
+ SET(srcs ${srcs} ${src})
+ ENDFOREACH(f ${l})
LIST(LENGTH srcs nb)
IF(nb)
ADD_EXECUTABLE(${name} ${srcs})
''')
pass
# --
- newlines.append(r'''
- IF(WINDOWS)
- INSTALL(TARGETS ${name} DESTINATION ${DEST})
- INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe DESTINATION ${DEST} RENAME ${amname}.exe)
- INSTALL(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe)")
- ELSE(WINDOWS)
- SET(PERMS)
- SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
- SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
- SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
- INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name} DESTINATION ${DEST} PERMISSIONS ${PERMS} RENAME ${amname})
- ENDIF(WINDOWS)
- ''')
+ if key == "bin_PROGRAMS":
+ newlines.append(r'''
+ IF(WINDOWS)
+ INSTALL(TARGETS ${name} DESTINATION ${DEST})
+ INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe DESTINATION ${DEST} RENAME ${amname}.exe)
+ INSTALL(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe)")
+ ELSE(WINDOWS)
+ SET(PERMS)
+ SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
+ SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
+ SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name} DESTINATION ${DEST} PERMISSIONS ${PERMS} RENAME ${amname})
+ ENDIF(WINDOWS)
+ ''')
+ pass
# --
newlines.append(r'''
ENDIF(nb)
''')
# --
newlines.append(r'''
- ENDFOREACH(amname ${bin_PROGRAMS})
+ ENDFOREACH(amname ${bin_PROGRAMS} ${check_PROGRAMS})
''')
# --
return
''')
else:
newlines.append(r'''
+ GET_FILENAME_COMPONENT(ext ${f} EXT)
+ IF(ext STREQUAL .py)
+ IF(DEST STREQUAL bin/salome)
+ SET(PERMS)
+ SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
+ SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
+ SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
+ INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS})
+ ELSE(DEST STREQUAL bin/salome)
+ INSTALL(FILES ${f} DESTINATION ${DEST})
+ ENDIF(DEST STREQUAL bin/salome)
+ ELSE(ext STREQUAL .py)
INSTALL(FILES ${f} DESTINATION ${DEST})
+ ENDIF(ext STREQUAL .py)
''')
pass
newlines.append(r'''
IF(ext STREQUAL .qm)
STRING(REGEX REPLACE .qm .ts input ${f})
''')
- if self.module in ["kernel", "gui"]:
+ if self.module in ["kernel", "gui", "yacs"]:
newlines.append(r'''
SET(input ${CMAKE_CURRENT_SOURCE_DIR}/resources/${input})
''')
except ValueError:
pass
# --
+ if "Makefile.am.cmake" in files:
+ if "Makefile.am" in files:
+ files.remove("Makefile.am")
+ pass
+ pass
+ # --
for f in files:
- if f == "Makefile.am":
+ if f in ["Makefile.am", "Makefile.am.cmake"]:
convertAmFile(the_root, root, dirs, files, f, module)
pass
pass
SET(FULLDIR ${CMAKE_INSTALL_PREFIX}/${DIR})
FILE(MAKE_DIRECTORY ${FULLDIR})
MESSAGE(STATUS "Compiling ${IDL_FILE} into ${FULLDIR}")
-EXECUTE_PROCESS(COMMAND ${OMNIORB_IDL_PYTHON} ${IDLPYFLAGS} -C${FULLDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${IDL_FILE})
+EXECUTE_PROCESS(COMMAND ${OMNIORB_IDL_PYTHON} ${IDLPYFLAGS} -C${FULLDIR} ${IDL_FILE})
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#ifndef SALOME_CONFIG_H
-#define SALOME_CONFIG_H
-
-#define DEBUG
+/* Debug mode ??? */
+#ifndef DEBUG
+# define DEBUG
+#endif
-#define QUOTE(x) #x
-#define CORBA_CLIENT_HEADER(x) QUOTE(x@IDL_CLN_H@)
-#define CORBA_SERVER_HEADER(x) QUOTE(x@IDL_SRV_H@)
+/* CORBA headers include rules */
+#ifndef CORBA_CLIENT_HEADER
+# define QUOTE(x) #x
+# define CORBA_CLIENT_HEADER(x) QUOTE(x@IDL_CLN_H@)
+# define CORBA_SERVER_HEADER(x) QUOTE(x@IDL_SRV_H@)
+#endif
+/* Platform definition */
#ifndef @MACHINE@
#define @MACHINE@
#endif
-
-/* A path to a rcp-like command */
-#define RCP "@RCP@"
-
-/* A path to a rm-like command */
-#define RM "@RM@"
-
-/* A path to a cp-like command */
-#define CP "@CP@"
-
-/* A path to a rsh-like command */
-#define RSH "@RSH@"
-
-/* A path to a scp-like command */
-#define SCP "@SCP@"
-
-/* A path to a sh-like command */
-#define SH "@SH@"
-
-/* A path to a ssh-like command */
-#define SSH "@SSH@"
-
// This is only to suppress warning messages with defines redefined (cause of omniORB that exports these names)
+#ifdef PACKAGE
+#undef PACKAGE
+#endif
#ifdef PACKAGE_BUGREPORT
#undef PACKAGE_BUGREPORT
#endif
#ifdef PACKAGE_VERSION
#undef PACKAGE_VERSION
#endif
+#ifdef VERSION
+#undef VERSION
+#endif
#ifdef _POSIX_C_SOURCE
#undef _POSIX_C_SOURCE
#endif
-
-#endif
ac_cxx_use_std_iostream.m4 \
ac_cxx_warnings.m4 \
ac_linker_options.m4 \
+ac_check_sizeof_fortran.m4 \
acx_pthread.m4 \
check_Kernel.m4 \
check_boost.m4 \
check_corba.m4 \
check_cppunit.m4 \
check_f77.m4 \
+check_calcium.m4 \
check_hdf5.m4 \
check_htmlgen.m4 \
check_lam.m4 \
-check_lsf.m4 \
+check_libbatch.m4 \
check_mpi.m4 \
check_openmpi.m4 \
check_mpich.m4 \
check_omniorb.m4 \
-check_openpbs.m4 \
check_sockets.m4 \
check_swig.m4 \
check_withihm.m4 \
pyembed.m4 \
python.m4 \
check_libxml.m4 \
-check_local.m4 \
-check_paco++.m4
+check_paco++.m4 \
+local_install.m4
dist_salome4depr_DATA=\
$(DEPRECATED_FILES)
--- /dev/null
+AC_DEFUN([AC_CHECK_SIZEOF_FORTRAN], [
+ AC_REQUIRE([AC_F77_WRAPPERS])
+ AC_CACHE_CHECK([size of Fortran [$1]], [ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])],[
+ AC_LANG_SAVE()
+ AC_LANG([Fortran 77])
+ AC_COMPILE_IFELSE([
+ AC_LANG_SOURCE([
+ subroutine fsize()
+ $1 i(2)
+ call csize(i(1), i(2))
+ end
+ ])
+ ],[
+ AC_LANG([C])
+ cp conftest.$ac_objext conftestf.$ac_objext
+ old_LDFLAGS="$LDFLAGS"
+ LDFLAGS="conftestf.$ac_objext $LDFLAGS"
+#"$ac_cv_f77_libs"
+ AC_TRY_RUN([
+# include <stdio.h>
+# define CSIZE F77_FUNC(csize,CSIZE)
+# define FSIZE F77_FUNC(fsize,FSIZE)
+ static long size_val;
+ /* Called by Fortran */
+ void CSIZE (i1p, i2p)
+ char *i1p, *i2p;
+ {
+ size_val = (i2p - i1p);
+ }
+ main() {
+ FILE *f=fopen ("conftestval","w");
+ if (!f) return 1;
+ /* Call the Fortran function */
+ FSIZE ();
+ fprintf (f, "%d\n", size_val);
+ return 0;
+ }
+ ])
+ LDFLAGS="$old_LDFLAGS"
+ ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])=`cat conftestval`
+ rm -f conftestval conftestf.$ac_objext
+ ])
+ AC_LANG_RESTORE()
+ ])
+ AC_DEFINE_UNQUOTED(SIZEOF_FORTRAN_[]translit($1, [a-z *], [A-Z_p]),
+ [$ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])],
+ [The size of a Fortran `$1', as computed by sizeof.])
+
+])
dnl @version $Id$
dnl @author Marc Tajchman
dnl
-AC_DEFUN([AC_DEPEND_FLAG],
-[AC_CACHE_CHECK(which flag for dependency information generation,
-ac_cv_depend_flag,
-[AC_LANG_SAVE
+AC_DEFUN([AC_DEPEND_FLAG],[
+ AC_MSG_CHECKING([which flag for dependency information generation])
+ AC_LANG_SAVE
AC_LANG_C
echo "conftest.o: conftest.c" > conftest.verif
echo "int main() { return 0; }" > conftest.c
printf " C++ : ${DEPCXX} ${CXX_DEPEND_FLAG}"
AC_LANG_RESTORE
+ AC_MSG_RESULT([ ... done])
+
AC_SUBST(DEPCC)
AC_SUBST(DEPCXX)
AC_SUBST(DEPCXXFLAGS)
AC_SUBST(CXX_DEPEND_FLAG)
AC_SUBST(MACHINE)
])
-])
dnl modified by Marc Tajchman (CEA) - 10/10/2002
dnl
-AC_DEFUN([AC_CXX_HAVE_SSTREAM],
-[AC_CACHE_CHECK(whether the compiler has stringstream,
-HAVE_SSTREAM,
-[AC_REQUIRE([AC_CXX_NAMESPACES])
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <sstream>
-#ifdef HAVE_NAMESPACES
-using namespace std;
-#endif],[stringstream message; message << "Hello"; return 0;],
- HAVE_SSTREAM=yes, HAVE_SSTREAM=no)
- AC_LANG_RESTORE
-])
-AC_SUBST(HAVE_SSTREAM)
+AC_DEFUN([AC_CXX_HAVE_SSTREAM],[
+ AC_CACHE_CHECK([whether the compiler has stringstream],
+ [ac_cv_prog_cxx_have_sstream],
+ [ac_cv_prog_cxx_have_sstream=no
+ AC_REQUIRE([AC_CXX_NAMESPACES])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([
+ #include <sstream>
+ #ifdef HAVE_NAMESPACES
+ using namespace std;
+ #endif
+ ],
+ [stringstream message; message << "Hello"; return 0;],
+ [ac_cv_prog_cxx_have_sstream=yes],[ac_cv_prog_cxx_have_sstream=no])
+ AC_LANG_RESTORE
+ ])
+ HAVE_SSTREAM=$ac_cv_prog_cxx_have_sstream
+ AC_SUBST(HAVE_SSTREAM)
])
done
AC_SUBST(LDEXPDYNFLAGS)
+ for opt in "-Xlinker -enable-new-dtags" ; do
+ AC_CXX_OPTION($opt,LDFLAGS)
+ done
+ AC_SUBST(LDFLAGS)
+
dnl
case $host_os in
osf*)
else
AC_MSG_RESULT(\$BOOST_LIBSUFFIX = ${BOOST_LIBSUFFIX})
AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
+ AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so,
+ BOOST_LIB_THREAD="${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}",
+ BOOST_LIB_THREAD="")
+ AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_signals${BOOST_LIBSUFFIX}.so,
+ BOOST_LIB_SIGNALS="${BOOST_LIBS} -lboost_signals${BOOST_LIBSUFFIX}",
+ BOOST_LIB_SIGNALS="")
+ AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_system${BOOST_LIBSUFFIX}.so,
+ BOOST_LIB_SYSTEM="${BOOST_LIBS} -lboost_system${BOOST_LIBSUFFIX}",
+ BOOST_LIB_SYSTEM="")
+ AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}/libboost_regex${BOOST_LIBSUFFIX}.so,
+ BOOST_LIB_REGEX="${BOOST_LIBS} -lboost_regex${BOOST_LIBSUFFIX}",
+ BOOST_LIB_REGEX="")
fi
AC_MSG_RESULT(for boost binaries: $boost_binaries_ok)
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LIBSUFFIX)
AC_SUBST(BOOST_LIBS)
+AC_SUBST(BOOST_LIB_THREAD)
+AC_SUBST(BOOST_LIB_SIGNALS)
+AC_SUBST(BOOST_LIB_SYSTEM)
+AC_SUBST(BOOST_LIB_REGEX)
AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB)
AC_LANG_RESTORE
--- /dev/null
+AC_DEFUN([CHECK_CALCIUM], [
+
+## Guess where as cal_int type is provided by --with-cal_int option
+## or auto-detection must be used
+
+AC_ARG_WITH([cal_int],
+ AC_HELP_STRING([--with-cal_int=<C type>],
+ [Use <C type> for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.]),
+ [],
+ [withval=no])
+
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(int)
+
+if test "x$withval" = "xno"
+then
+ AC_REQUIRE([CHECK_F77])
+ AC_CHECK_SIZEOF_FORTRAN(integer)
+
+ if test "x$ac_cv_sizeof_fortran_integer" = "x8" ; then
+ AC_DEFINE(HAVE_F77INT64,[],
+ [The size of a Fortran integer, as computed by sizeof.])
+ test "x$ac_cv_sizeof_long" = "x8" || AC_MSG_ERROR([Size of C type long expected to be eight bytes])
+ LONG_OR_INT="long"
+ CALCIUM_IDL_INT_F77="long long"
+ CALCIUM_CORBA_INT_F77="CORBA::LongLong"
+ elif test "x$ac_cv_sizeof_fortran_integer" = "x4" ; then
+ test "x$ac_cv_sizeof_int" = "x4" || AC_MSG_ERROR([Size of C type int expected to be four bytes])
+ LONG_OR_INT="int"
+ CALCIUM_IDL_INT_F77="long"
+ CALCIUM_CORBA_INT_F77="CORBA::Long"
+ else
+ AC_MSG_ERROR([Size of Fortran type integer is neither four nor eigth bytes])
+ fi
+
+elif test "x$withval" = "xint"
+then
+ LONG_OR_INT="int"
+ CALCIUM_IDL_INT_F77="long"
+ CALCIUM_CORBA_INT_F77="CORBA::Long"
+ AC_MSG_NOTICE([Using C type int for cal_int])
+
+elif test "x$withval" = "xlong"
+then
+ LONG_OR_INT="long"
+ CALCIUM_IDL_INT_F77="long long"
+ CALCIUM_CORBA_INT_F77="CORBA::LongLong"
+ AC_MSG_NOTICE([Using C type long for cal_int])
+else
+ AC_MSG_ERROR([Fortran type integer must be mapped to C type int or C type long])
+fi
+
+AC_SUBST(CALCIUM_IDL_INT_F77)
+AC_SUBST(CALCIUM_CORBA_INT_F77)
+AC_SUBST(LONG_OR_INT)
+AC_DEFINE_UNQUOTED([CAL_INT],[$LONG_OR_INT],
+ [The C type to be used for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.])
+])
AC_DEFUN([CHECK_F77],[
AC_PROG_F77
-
AC_F77_LIBRARY_LDFLAGS
AC_F77_WRAPPERS
if test -z $HDF5HOME
then
AC_MSG_WARN(undefined HDF5HOME variable which specify hdf5 installation directory)
+ AC_MSG_NOTICE(Trying native Hdf5...)
else
LOCAL_INCLUDES="-I$HDF5HOME/include"
if test "x$HDF5HOME" = "x/usr"
then
+ AC_MSG_NOTICE(Trying native Hdf5...)
LOCAL_LIBS=""
else
+ AC_MSG_NOTICE(Trying Hdf5 from $HDF5HOME ...)
LOCAL_LIBS="-L$HDF5HOME/lib"
LOCAL_RLIBS="-R$HDF5HOME/lib"
fi
HDF5_MT_LIBS="$LOCAL_LIBS -lhdf5 $LOCAL_RLIBS"
fi
+if test "x$hdf5_ok" = "xyes"
+then
+ HDF5_INCLUDES="$HDF5_INCLUDES -DH5_USE_16_API"
+fi
+
AC_MSG_RESULT(for hdf5: $hdf5_ok)
])dnl
--- /dev/null
+dnl Copyright (C) 2007-2009 CEA/DEN, EDF R&D, OPEN CASCADE
+dnl
+dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or
+dnl email : webmaster.salome@opencascade.com
+dnl
+
+# CHECK_LIBBATCH
+# This macro can be used to find libBatch and set the associated variables in
+# a project based on autoconf. You can copy this file in your own project and
+# eventually modify it according to your own needs.
+# ----------------------------------------------------------------------------
+
+AC_DEFUN([CHECK_LIBBATCH],[
+
+AC_MSG_NOTICE(Checking for libBatch library)
+
+AC_SUBST(LIBBATCH_INCLUDES)
+AC_SUBST(LIBBATCH_LIBS)
+
+LIBBATCH_INCLUDES=""
+LIBBATCH_LIBS=""
+
+libbatch_ok=no
+
+AC_ARG_WITH([libbatch],
+ [AS_HELP_STRING([--with-libbatch=DIR],
+ [root directory path of libBatch installation])],
+ [LIBBATCH_DIR="$withval"],
+ [LIBBATCH_DIR=""])
+
+if test "x$LIBBATCH_DIR" = "x" ; then
+ # no --with-libbatch option used
+ if test "x$LIBBATCH_ROOT_DIR" != "x" ; then
+ # LIBBATCH_ROOT_DIR environment variable defined
+ LIBBATCH_DIR=$LIBBATCH_ROOT_DIR
+ fi
+fi
+
+LOCAL_INCLUDES=""
+LOCAL_LIBS=""
+
+if test "x$LIBBATCH_DIR" != "x" ; then
+ LOCAL_INCLUDES="-I$LIBBATCH_DIR/include"
+ if test "x$LIBBATCH_DIR" = "x/usr" ; then
+ LOCAL_LIBS="-lBatch"
+ else
+ LOCAL_LIBS="-L$LIBBATCH_DIR/lib -lBatch"
+ fi
+else
+ LOCAL_INCLUDES="-I/usr/include"
+ LOCAL_LIBS="-lBatch"
+fi
+
+# libBatch headers
+
+CPPFLAGS_old="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
+AC_CHECK_HEADER(Batch/Batch_BatchManager.hxx,
+ libbatch_ok="yes",
+ libbatch_ok="no")
+CPPFLAGS="$CPPFLAGS_old"
+
+
+if test "x$libbatch_ok" = "xyes" ; then
+ # libBatch library
+
+ LIBS_old=$LIBS
+ LIBS="$LIBS $LOCAL_LIBS"
+ # Can't use AC_SEARCH_LIBS or AC_CHECK_LIB here because
+ # they don't work with C++ namespaces
+ # AC_SEARCH_LIBS(Batch::BatchManagerCatalog::getInstance,Batch,
+ # libbatch_ok="yes",libbatch_ok="no")
+ AC_MSG_CHECKING(
+ [for library containing Batch::BatchManagerCatalog::getInstance])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ namespace Batch {
+ class BatchManagerCatalog {
+ public: static void getInstance();
+ };
+ }
+ ]],
+ [using namespace Batch;
+ BatchManagerCatalog::getInstance();])],
+ [libbatch_ok="yes"],
+ [libbatch_ok="no"])
+ AC_MSG_RESULT($libbatch_ok)
+
+ LIBS=$LIBS_old
+fi
+
+if test "x$libbatch_ok" = "xyes" ; then
+ LIBBATCH_INCLUDES="$LOCAL_INCLUDES"
+ LIBBATCH_LIBS="$LOCAL_LIBS"
+fi
+
+AC_MSG_RESULT(for libBatch: $libbatch_ok)
+
+])
LOCAL_INCLUDES="-I$LIBXML_DIR/include/libxml2"
if test "x$LIBXML_DIR" = "x/usr"
then
+ AC_MSG_NOTICE(Trying native Libxml2...)
LOCAL_LIBS="-lxml2"
else
+ AC_MSG_NOTICE(Trying Libxml2 from $LIBXML_DIR ...)
LOCAL_LIBS="-L$LIBXML_DIR/lib -lxml2"
fi
else
+ AC_MSG_NOTICE(Trying native Libxml2...)
LOCAL_INCLUDES="-I/usr/include/libxml2"
LOCAL_LIBS="-lxml2"
fi
+++ /dev/null
-dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-dnl
-dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-dnl
-# Check for Local
-AC_DEFUN([CHECK_LOCAL],
-[
- dnl AC_ARG_VAR([LOCAL], [])
- AC_ARG_WITH([local],
- AC_HELP_STRING([--with-local],
- [tell configure script to use local submission. Default is --with-local.]),
- [],
- [withval=yes])
-
- AC_MSG_CHECKING([for Local])
-
- if test "x$withval" = "xyes"
- then
- WITH_LOCAL=yes
-
- AC_MSG_RESULT([$withval])
-
- AC_ARG_VAR([RM], [A path to a rm-like command])
- AC_PATH_PROG([RM], [rm], [/bin/false])
- AC_DEFINE_UNQUOTED(RM, "$RM", [A path to a rm-like command])
-
- AC_ARG_VAR([SH], [A path to a sh-like command])
- AC_PATH_PROG([SH], [sh], [/bin/false])
- AC_DEFINE_UNQUOTED(SH, "$SH", [A path to a sh-like command])
- AC_ARG_VAR([CP], [A path to a cp-like command])
- AC_PATH_PROG([CP], [cp], [/bin/false])
- AC_DEFINE_UNQUOTED(CP, "$CP", [A path to a cp-like command])
-
- AC_ARG_VAR([RSH], [A path to a rsh-like command])
- AC_PATH_PROG([RSH], [rsh], [/bin/false])
- AC_DEFINE_UNQUOTED(RSH, "$RSH", [A path to a rsh-like command])
- AC_ARG_VAR([RCP], [A path to a rcp-like command])
- AC_PATH_PROG([RCP], [rcp], [/bin/false])
- AC_DEFINE_UNQUOTED(RCP, "$RCP", [A path to a rcp-like command])
-
- AC_ARG_VAR([SSH], [A path to a ssh-like command])
- AC_PATH_PROG([SSH], [ssh], [/bin/false])
- AC_DEFINE_UNQUOTED(SSH, "$SSH", [A path to a ssh-like command])
- AC_ARG_VAR([SCP], [A path to a scp-like command])
- AC_PATH_PROG([SCP], [scp], [/bin/false])
- AC_DEFINE_UNQUOTED(SCP, "$SCP", [A path to a scp-like command])
-
-
- else
- WITH_LOCAL=no
-
- AC_MSG_RESULT([no])
-
- fi
-
- AM_CONDITIONAL(WITH_LOCAL, test $WITH_LOCAL = yes)
-
- localbatch_ok=$WITH_LOCAL
- AC_SUBST(WITH_LOCAL)
- AC_SUBST(RM)
- AC_SUBST(SH)
- AC_SUBST(CP)
- AC_SUBST(RSH)
- AC_SUBST(RCP)
- AC_SUBST(SSH)
- AC_SUBST(SCP)
-
- dnl _CS_gbo Pour forcer l'utilisation du config.h, inclu
- dnl par les fichiers Batch_BatchManager_Local_*.cxx
- dnl OWN_CONFIG_H=yes
- dnl AC_SUBST(OWN_CONFIG_H)
-])
-
+++ /dev/null
-dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-dnl
-dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-dnl
-# Check for LSF
-AC_DEFUN([CHECK_LSF],
-[
- AC_ARG_WITH([lsf],
- AC_HELP_STRING([--with-lsf[[[[[=path] ]]]]],
- [tell configure script to use LSF that is located at <path>. Default is no. If path is not given, it is automaticaly determined from LSF_ENVDIR variable.]),
- [],
- [withval=no])
-
- AC_MSG_CHECKING([for LSF])
-
- if test ! "x$withval" = "xno"
- then
- if test "x$withval" = "xyes"
- then
- if test ! "x$LSF_ENVDIR" = "x"
- then
- test -f "$LSF_ENVDIR/lsf.conf" && . "$LSF_ENVDIR/lsf.conf"
- LSF=$LSF_TOP
- else
- dnl some default values ...
- LSF=/usr
- LSF_INCLUDEDIR=$LSF/include
- LSF_LIBDIR=$LSF/lib
- fi
- else
- LSF=$withval
- LSF_INCLUDEDIR=$LSF/include
- LSF_LIBDIR=$LSF/lib
- fi
-
- AC_MSG_RESULT([$LSF])
-
- dnl INCLUDE directory
-
- LSF_INCLUDES="-I${LSF_INCLUDEDIR}"
- saved_CPPFLAGS=${CPPFLAGS}
- CPPFLAGS="${CPPFLAGS} ${LSF_INCLUDES}"
- AC_CHECK_HEADER([lsf/lsbatch.h], [lsf_header_found=yes], [lsf_header_found=no], [])
- test x${lsf_header_found} = xno && AC_MSG_WARN([LSF include file not found])
- CPPFLAGS=${saved_CPPFLAGS}
- AC_SUBST(LSF_INCLUDES)
-
- dnl LIB directory
-
- if test "x${LSF_LIBDIR}" = "x/usr/lib"
- then
- LSF_LDFLAGS=""
- else
- LSF_LDFLAGS="-L${LSF_LIBDIR}"
- fi
- LSF_LIBS="-lbat -llsf"
- saved_LDFLAGS=${LDFLAGS}
- saved_LIBS=${LIBS}
- LDFLAGS="${LDFLAGS} ${LSF_LDFLAGS}"
- lsf_lib_found=yes
- AC_CHECK_LIB([lsf], [ls_load], [lsf_libs="-llsf ${lsf_libs}"], [lsf_lib_found=no], [])
- AC_CHECK_LIB([bat], [lsb_init], [lsf_libs="-lbat ${lsf_libs}"], [lsf_lib_found=no], [-llsf])
- test x${lsf_lib_found} = xno && AC_MSG_WARN([LSF library not found])
- LIBS="${LSF_LIBS} ${LIBS}"
- LDFLAGS=${saved_LDFLAGS}
- LIBS=${saved_LIBS}
- AC_SUBST(LSF_LDFLAGS)
- AC_SUBST(LSF_LIBS)
-
- test x${lsf_lib_found} = xyes && test x${lsf_header_found} = xyes && WITH_LSF=yes
-
- else
- WITH_LSF=no
-
- AC_MSG_RESULT([no])
-
- fi
-
- AM_CONDITIONAL(WITH_LSF, test $WITH_LSF = yes)
-
- lsf_ok=$WITH_LSF
- if test $lsf_ok = no ; then
- lsf_ok=
- fi
- AC_SUBST(WITH_LSF)
-
-])
-
+++ /dev/null
-dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-dnl
-dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-dnl
-dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-dnl
-# Check for OpenPBS
-AC_DEFUN([CHECK_OPENPBS],
-[
- AC_ARG_VAR([OPENPBS], [OpenPBS home directory])
- AC_ARG_WITH([openpbs],
- AC_HELP_STRING([--with-openpbs=<path>],
- [tell configure script to use OpenPBS that is located at <path>]),
- [test ! x"${withval}" = xyes && OPENPBS=${withval}],
- [])
-
- dnl AC_ARG_VAR([OPENPBSSERVERNAME], [OpenPBS server_name file])
- dnl AC_ARG_WITH([openpbs-server-name],
- dnl AC_HELP_STRING([--with-openpbs-server-name=<path>],
- dnl [tell configure script to use OpenPBS server_name file that is located at <path>]),
- dnl [test ! x"${withval}" = xyes && OPENPBSSERVERNAME=${withval}],
- dnl [with_openpbs_server_name=""])
-
-
- if test -z "${OPENPBS}"
- then
- AC_MSG_WARN([Environment variable OPENPBS not set. Skipping OpenPBS configuration.])
-
- else
-
- OPENPBS_INCLUDES="-I${OPENPBS}/include"
- saved_CPPFLAGS=${CPPFLAGS}
- CPPFLAGS="${CPPFLAGS} ${OPENPBS_INCLUDES}"
- AC_CHECK_HEADER([pbs_ifl.h], [openpbs_header_found=yes], [openpbs_header_found=no], [])
- test x${openpbs_header_found} = xno && AC_MSG_WARN([OpenPBS include file not found])
- CPPFLAGS=${saved_CPPFLAGS}
- AC_SUBST(OPENPBS_INCLUDES)
-
- if test "x${OPENPBS}" = "x/usr"
- then
- OPENPBS_LIBDIR=""
- else
- OPENPBS_LIBDIR="-L${OPENPBS}/lib"
- fi
- OPENPBS_LIBS="-lpbs"
- saved_LDFLAGS=${LDFLAGS}
- saved_LIBS=${LIBS}
- LDFLAGS="${LDFLAGS} ${OPENPBS_LIBDIR}"
- AC_CHECK_LIB([pbs], [pbs_connect], [openpbs_lib_found=yes], [openpbs_lib_found=no], [])
- test x${openpbs_lib_found} = xno && AC_MSG_WARN([OpenPBS library not found])
- LIBS="${LIBS} ${OPENPBS_LIBS}"
- LDFLAGS=${saved_LDFLAGS}
- LIBS=${saved_LIBS}
- AC_SUBST(OPENPBS_LIBDIR)
- AC_SUBST(OPENPBS_LIBS)
-
- dnl test -z "${OPENPBSSERVERNAME}" && OPENPBSSERVERNAME="/usr/spool/PBS/server_name"
- dnl AC_CHECK_FILE([${OPENPBSSERVERNAME}], [openpbs_server_name_found=yes], [openpbs_server_name_found=no])
-
- test x${openpbs_header_found} = xyes && test x${openpbs_lib_found} = xyes && openpbs_ok="yes"
-
- fi
-
- WITHOPENPBS=$openpbs_ok
- if test x$WITHOPENPBS = x ; then
- WITHOPENPBS=no
- fi
- AC_SUBST(WITHOPENPBS)
-
- AM_CONDITIONAL(WITH_OPENPBS, test $WITHOPENPBS = yes)
-
-])
-
--- /dev/null
+dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+dnl
+dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+dnl ---
+dnl File : local_install.m4
+dnl Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+dnl ---
+dnl
+
+dnl The purpose of below autoconf macro is to generate custom install script
+dnl to be used instead of global /usr/bin/install one.
+dnl The difference is that resulting install script does not install file passed
+dnl as parameter if its target copy exists and the file is not changed, i.e
+dnl source and target files are the identical.
+dnl The check is performed by the diff command.
+
+AC_DEFUN([AC_LOCAL_INSTALL],
+[
+GLOBAL_INSTALL=$INSTALL
+absdir=`pwd`
+INSTALL=${absdir}/local-install.sh
+cat > ${INSTALL} << EOF
+#!/bin/sh
+
+nb_args=\$[#]
+args=\$[*]
+if test \$nb_args -gt 1 ; then
+ nb=\$(expr \$nb_args - 2)
+ shift \$nb
+ target=\$[2]
+ if test -f \$target ; then
+ orig=\$[1]
+ if test -f \$orig ; then
+ diff \$orig \$target > /dev/null 2>&1
+ if test \$[?] = 0 ; then
+ echo \$orig and \$target are identical
+ exit 0
+ fi
+ fi
+ fi
+fi
+${GLOBAL_INSTALL} \$args
+EOF
+chmod +x ${INSTALL}
+AC_SUBST(INSTALL)
+AC_SUBST(GLOBAL_INSTALL)
+])dnl
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
+# ============================================================
+# The following is to avoid PACKAGE_... env variable
+# redefinition compilation warnings
+# ============================================================
+if !WITHONLYLAUNCHER
+ AM_CXXFLAGS = -I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h
+ AM_CPPFLAGS = -I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h
+else WITHONLYLAUNCHER
+ AM_CXXFLAGS =
+ AM_CPPFLAGS =
+endif
+
# ============================================================
# This file defines the common definitions used in several
# Makefile. This file must be included, if needed, by the file
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * APIInternalFailureException.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 20 15:15:42 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_APIInternalFailureException.hxx"
-using namespace std;
-
-namespace Batch {
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * APIInternalFailureException.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 20 15:15:41 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _APIINTERNALFAILUREEXCEPTION_H_
-#define _APIINTERNALFAILUREEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_GenericException.hxx"
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT APIInternalFailureException : public GenericException
- {
- public:
- // Constructeur
- APIInternalFailureException(std::string ch = "undefined") : GenericException("APIInternalFailureException", ch) {}
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include <iostream>
-#include <sstream>
-#include <string>
-#ifdef WIN32
-# include<winsock2.h>
-#else
-# include <netdb.h>
-#endif
-
-//#include "MEDMEM_STRING.hxx"
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-#include "Batch_FactBatchManager.hxx"
-#include "Batch_BatchManager.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Constructeur
-// BatchManager::BatchManager(string host) throw(InvalidArgumentException) : _hostname(host), jobid_map()
-// {
-// // On verifie que le hostname est correct
-// if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network
-// string msg = "hostname \"";
-// msg += _hostname;
-// msg += "\" unknown from the network";
-// throw InvalidArgumentException(msg.c_str());
-// }
-// }
- BatchManager::BatchManager(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException) : _hostname(host), jobid_map(), _parent(parent)
- {
- // On verifie que le hostname est correct
- if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network
- string msg = "hostname \"";
- msg += _hostname;
- msg += "\" unknown from the network";
- throw InvalidArgumentException(msg.c_str());
- }
- }
-
- // Destructeur
- BatchManager::~BatchManager()
- {
- // Nothing to do
- }
-
- string BatchManager::__repr__() const
- {
- ostringstream oss;
- oss << "<BatchManager of type '" << (_parent ? _parent->getType() : "unknown (no factory)") << "' connected to server '" << _hostname << "'>";
- return oss.str();
- }
-
- // Recupere le l'identifiant d'un job deja soumis au BatchManager
-// const JobId BatchManager::getJobIdByReference(const string & ref)
-// {
-// return JobId(this, ref);
-// }
- const JobId BatchManager::getJobIdByReference(const char * ref)
- {
- return JobId(this, ref);
- }
-
-// // Methode pour le controle des jobs : soumet un job au gestionnaire
-// const JobId BatchManager::submitJob(const Job & job)
-// {
-// static int idx = 0;
-// //MEDMEM::STRING sst;
-// ostringstream sst;
-// sst << "Jobid_" << idx++;
-// JobId id(this, sst.str());
-// return id;
-// }
-
-// // Methode pour le controle des jobs : retire un job du gestionnaire
-// void BatchManager::deleteJob(const JobId & jobid)
-// {
-// // Nothing to do
-// }
-
-// // Methode pour le controle des jobs : suspend un job en file d'attente
-// void BatchManager::holdJob(const JobId & jobid)
-// {
-// // Nothing to do
-// }
-
-// // Methode pour le controle des jobs : relache un job suspendu
-// void BatchManager::releaseJob(const JobId & jobid)
-// {
-// // Nothing to do
-// }
-
-// // Methode pour le controle des jobs : modifie un job en file d'attente
-// void BatchManager::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
-// {
-// // Nothing to do
-// }
-
-// // Methode pour le controle des jobs : modifie un job en file d'attente
-// void BatchManager::alterJob(const JobId & jobid, const Parametre & param)
-// {
-// // Nothing to do
-// }
-
-// // Methode pour le controle des jobs : modifie un job en file d'attente
-// void BatchManager::alterJob(const JobId & jobid, const Environnement & env)
-// {
-// // Nothing to do
-// }
-
-// // Methode pour le controle des jobs : renvoie l'etat du job
-// JobInfo BatchManager::queryJob(const JobId & jobid)
-// {
-// return JobInfo();
-// }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _BATCHMANAGER_H_
-#define _BATCHMANAGER_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include <map>
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-
-namespace Batch {
-
- class Job;
- class JobId;
- class JobInfo;
- class FactBatchManager;
-
- class BATCH_EXPORT BatchManager
- {
- public:
- // Constructeur et destructeur
- //BatchManager(std::string host="localhost") throw(InvalidArgumentException); // connexion a la machine host
- BatchManager(const Batch::FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException); // connexion a la machine host
- virtual ~BatchManager();
- virtual std::string __repr__() const;
-
- // Recupere le l'identifiant d'un job deja soumis au BatchManager
- //virtual const JobId getJobIdByReference(const std::string & ref);
- virtual const Batch::JobId getJobIdByReference(const char * ref);
-
- // Methodes pour le controle des jobs : virtuelles pures
- virtual const Batch::JobId submitJob(const Batch::Job & job) = 0; // soumet un job au gestionnaire
- virtual void deleteJob(const Batch::JobId & jobid) = 0; // retire un job du gestionnaire
- virtual void holdJob(const Batch::JobId & jobid) = 0; // suspend un job en file d'attente
- virtual void releaseJob(const Batch::JobId & jobid) = 0; // relache un job suspendu
- virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param, const Batch::Environnement & env) = 0; // modifie un job en file d'attente
- virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param) = 0; // modifie un job en file d'attente
- virtual void alterJob(const Batch::JobId & jobid, const Batch::Environnement & env) = 0; // modifie un job en file d'attente
- virtual Batch::JobInfo queryJob(const Batch::JobId & jobid) = 0; // renvoie l'etat du job
-
- protected:
- std::string _hostname; // serveur ou tourne le BatchManager
- // std::map< const std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis
- std::map< std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis
- const Batch::FactBatchManager * _parent;
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManagerCatalog.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include <sstream>
-#include <map>
-#include "Batch_BatchManagerCatalog.hxx"
-#include "Batch_FactBatchManager.hxx"
-using namespace std;
-
-namespace Batch {
-
- pthread_mutex_t BatchManagerCatalog::_mutex = PTHREAD_MUTEX_INITIALIZER;
- std::map<string, FactBatchManager *> * BatchManagerCatalog::_p_catalog = 0;
- BatchManagerCatalog BatchManagerCatalog::theCatalog;
-
- // Constructeur
- BatchManagerCatalog::BatchManagerCatalog()
- {
- // Nothing to do
- }
-
- // Destructeur
- BatchManagerCatalog::~BatchManagerCatalog()
- {
- delete BatchManagerCatalog::_p_catalog;
- }
-
- // Functor
- FactBatchManager * BatchManagerCatalog::getFactBatchManager(const char * type)
- {
- return (* BatchManagerCatalog::_p_catalog)[type];
- }
-
- void BatchManagerCatalog::addFactBatchManager(const char * type, FactBatchManager * pFBM)
- {
- if (pFBM) { // *** section critique ***
- pthread_mutex_lock(&_mutex);
-
- if (! BatchManagerCatalog::_p_catalog) BatchManagerCatalog::_p_catalog = new std::map<string, FactBatchManager *>;
- (*BatchManagerCatalog::_p_catalog)[type] = pFBM;
-
- pthread_mutex_unlock(&_mutex);
- }
- }
-
- FactBatchManager * BatchManagerCatalog::operator() (const char * type) const
- {
- return BatchManagerCatalog::getFactBatchManager(type);
- }
-
- std::map<string, FactBatchManager *> * BatchManagerCatalog::dict() const
- {
- return _p_catalog;
- }
-
- string BatchManagerCatalog::__repr__() const
- {
- ostringstream oss;
- oss << "<BatchManagerCatalog contains {";
- string sep;
- for(std::map<string, FactBatchManager *>::const_iterator it = (*_p_catalog).begin(); it != (*_p_catalog).end(); it++, sep=", ") {
- oss << sep << "'" << (*it).first << "' : '" << (*it).second->__repr__() << "'";
- }
- oss << "}>";
- return oss.str();
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManagerCatalog.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#ifndef _CATALOG_H_
-#define _CATALOG_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include <map>
-#include <pthread.h>
-
-namespace Batch {
-
- class FactBatchManager;
-
- class BATCH_EXPORT BatchManagerCatalog
- {
- public:
- // Constructeur
- BatchManagerCatalog();
- // Destructeur
- virtual ~BatchManagerCatalog();
-
- static Batch::FactBatchManager * getFactBatchManager(const char * type);
- static void addFactBatchManager(const char * type, Batch::FactBatchManager * pFBM);
- virtual Batch::FactBatchManager * operator() (const char * type) const;
-
- virtual std::map<std::string, FactBatchManager *> * dict() const;
- virtual std::string __repr__() const;
-
- protected:
- static BatchManagerCatalog theCatalog;
- static std::map<std::string, FactBatchManager *> * _p_catalog;
- static pthread_mutex_t _mutex;
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_LSF.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:17:22 2003
- * Projet : Salome 2
- *
- */
-
-extern "C" {
-#include <lsf/lsf.h>
-#include <lsf/lsbatch.h>
-}
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <string>
-#include "Batch_BatchManager_LSF.hxx"
-
-using namespace std;
-
-namespace Batch {
-
- BatchManager_LSF::BatchManager_LSF(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host)
- {
- // On se connecte au serveur LSF
- _connect = lsb_init("Salome2 Batch library");
- if (_connect < 0) { // si erreur
- char * errmsg = lsb_sysmsg();
- string msg = "LSF Server on host \"";
- msg += _hostname;
- msg += "\" : ";
- msg += errmsg ? errmsg : "Reason unknown";
- throw ConnexionFailureException(msg.c_str());
- }
- }
-
- // Destructeur
- BatchManager_LSF::~BatchManager_LSF()
- {
- // Nothing to do
- }
-
- // Methode pour le controle des jobs : soumet un job au gestionnaire
- const JobId BatchManager_LSF::submitJob(const Job & job)
- {
- Job_LSF joblsf = job;
- struct submitReply reply;
- int ref = lsb_submit(joblsf.getSubmitStruct(),
- &reply);
- if (ref < 0) { // si erreur
- char * msg = lsb_sysmsg();
- if (!msg) msg = "unknown";
- throw APIInternalFailureException(string("LSF submit error. Reason : ") + msg);
- }
-
- ostringstream oss;
- oss << ref;
- JobId id(this, oss.str());
- return id;
- }
-
- // Methode pour le controle des jobs : retire un job du gestionnaire
- void BatchManager_LSF::deleteJob(const JobId & jobid)
- {
- int ref;
- istringstream iss(jobid.getReference());
- iss >> ref;
- int rc = lsb_deletejob(ref, 0, 0);
- if (rc < 0) { // si erreur
- char * msg = lsb_sysmsg();
- if (!msg) msg = "unknown";
- throw APIInternalFailureException(string("LSF deljob error. Reason : ") + msg);
- }
- }
-
- // Methode pour le controle des jobs : suspend un job en file d'attente
- void BatchManager_LSF::holdJob(const JobId & jobid)
- {
- int ref;
- istringstream iss(jobid.getReference());
- iss >> ref;
- int rc = lsb_signaljob(ref, SIGSTOP);
- if (rc < 0) { // si erreur
- char * msg = lsb_sysmsg();
- if (!msg) msg = "unknown";
- throw APIInternalFailureException(string("LSF signaljob error. Reason : ") + msg);
- }
- }
-
- // Methode pour le controle des jobs : relache un job suspendu
- void BatchManager_LSF::releaseJob(const JobId & jobid)
- {
- int ref;
- istringstream iss(jobid.getReference());
- iss >> ref;
- int rc = lsb_signaljob(ref, SIGCONT);
- if (rc < 0) { // si erreur
- char * msg = lsb_sysmsg();
- if (!msg) msg = "unknown";
- throw APIInternalFailureException(string("LSF signaljob error. Reason : ") + msg);
- }
- }
-
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_LSF::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
- {
- int ref;
- istringstream iss(jobid.getReference());
- iss >> ref;
-
- Job_LSF joblsf = Job(param, env);
- struct submitReply reply;
- ref = lsb_modify(joblsf.getSubmitStruct(),
- &reply,
- ref);
- if (ref < 0) { // si erreur
- ostringstream msg_sst;
- char * msg = lsb_sysmsg();
- if (!msg) msg = "unknown";
- msg_sst << msg << endl;
-// msg_sst << "BadJobId = " << (long) reply.badJobId << endl
-// << "BadJobName = " << reply.badJobName << endl
-// << "BadReqIndx = " << reply.badReqIndx << endl;
- throw APIInternalFailureException(string("LSF modify error. Reason : ") + msg_sst.str());
- }
- }
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_LSF::alterJob(const JobId & jobid, const Parametre & param)
- {
- alterJob(jobid, param, Environnement());
- }
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_LSF::alterJob(const JobId & jobid, const Environnement & env)
- {
- alterJob(jobid, Parametre(), env);
- }
-
-
-
- // Methode pour le controle des jobs : renvoie l'etat du job
- JobInfo BatchManager_LSF::queryJob(const JobId & jobid)
- {
- int id;
- istringstream iss(jobid.getReference());
- iss >> id;
-
- JobInfo_LSF ji = JobInfo_LSF(id);
-
- return ji;
- }
-
-
-
- // Methode pour le controle des jobs : teste si un job est present en machine
- bool BatchManager_LSF::isRunning(const JobId & jobid)
- {
- int id;
- istringstream iss(jobid.getReference());
- iss >> id;
-
- JobInfo_LSF ji = JobInfo_LSF(id);
-
- return ji.isRunning();
- }
-
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_LSF.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:17:22 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _BATCHMANAGER_LSF_H_
-#define _BATCHMANAGER_LSF_H_
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_Job.hxx"
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_JobInfo_LSF.hxx"
-#include "Batch_Job_LSF.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-#include "Batch_ConnexionFailureException.hxx"
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_NotYetImplementedException.hxx"
-#include "Batch_BatchManager.hxx"
-
-namespace Batch {
-
- class Job;
- class JobId;
- class JobInfo;
- class FactBatchManager;
-
- class BATCH_EXPORT BatchManager_LSF : public BatchManager
- {
- public:
- // Constructeur et destructeur
- BatchManager_LSF(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host
- virtual ~BatchManager_LSF();
-
- // Recupere le nom du serveur par defaut
- // static string BatchManager_LSF::getDefaultServer();
-
- // Methodes pour le controle des jobs
- virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
- virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
- virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
- virtual void releaseJob(const JobId & jobid); // relache un job suspendu
- virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
- virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
- virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
- virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
- virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
-
- virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
- virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
-
-
- protected:
- int _connect; // LSF connect id
-
- private:
-
-#ifdef SWIG
- public:
- // Recupere le l'identifiant d'un job deja soumis au BatchManager
- //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
- virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
-#endif
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
-* BatchManager_Local.cxx :
-*
-* Auteur : Ivan DUTKA-MALEN - EDF R&D
-* Mail : mailto:ivan.dutka-malen@der.edf.fr
-* Date : Thu Nov 6 10:17:22 2003
-* Projet : Salome 2
-*
-*/
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <cstdlib>
-#include <limits.h>
-
-#include <sys/types.h>
-#ifdef WIN32
-# include <direct.h>
-#else
-# include <sys/wait.h>
-# include <unistd.h>
-#endif
-#include <ctime>
-#include <pthread.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include "Batch_IOMutex.hxx"
-#include "Batch_BatchManager_Local.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-
- // Constructeur
- BatchManager_Local::BatchManager_Local(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host), _connect(0), _threads_mutex(), _threads(), _thread_id_id_association_mutex(), _thread_id_id_association_cond()
-#ifndef WIN32 //TODO: porting of following functionality
- ,_thread_id_id_association()
-#endif
- {
- pthread_mutex_init(&_threads_mutex, NULL);
- pthread_mutex_init(&_thread_id_id_association_mutex, NULL);
- pthread_cond_init(&_thread_id_id_association_cond, NULL);
- }
-
- // Destructeur
- BatchManager_Local::~BatchManager_Local()
- {
- pthread_mutex_destroy(&_threads_mutex);
- pthread_mutex_destroy(&_thread_id_id_association_mutex);
- pthread_cond_destroy(&_thread_id_id_association_cond);
- }
-
- // Methode pour le controle des jobs : soumet un job au gestionnaire
- const JobId BatchManager_Local::submitJob(const Job & job)
- {
- Job_Local jobLocal = job;
-
- pthread_t thread_id = submit(jobLocal);
-
- ostringstream oss;
- oss << getIdByThread_id(thread_id);
-
- JobId id(this, oss.str());
-
- return id;
- }
-
- // Methode pour le controle des jobs : retire un job du gestionnaire
- void BatchManager_Local::deleteJob(const JobId & jobid)
- {
- Id id;
-
- istringstream iss(jobid.getReference());
- iss >> id;
-
- // On retrouve le thread_id du thread
- pthread_t thread_id;
-
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_threads_mutex);
- if (_threads.find(id) != _threads.end())
- thread_id = _threads[id].thread_id;
- pthread_mutex_unlock(&_threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
-
- cancel(thread_id);
- }
-
- // Methode pour le controle des jobs : suspend un job en file d'attente
- void BatchManager_Local::holdJob(const JobId & jobid)
- {
- Id id;
- istringstream iss(jobid.getReference());
- iss >> id;
-
- UNDER_LOCK( cout << "BatchManager is sending HOLD command to the thread " << id << endl );
-
- // On introduit une commande dans la queue du thread
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_threads_mutex);
- if (_threads.find(id) != _threads.end())
- _threads[id].command_queue.push(HOLD);
- pthread_mutex_unlock(&_threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- }
-
- // Methode pour le controle des jobs : relache un job suspendu
- void BatchManager_Local::releaseJob(const JobId & jobid)
- {
- Id id;
- istringstream iss(jobid.getReference());
- iss >> id;
-
- UNDER_LOCK( cout << "BatchManager is sending RELEASE command to the thread " << id << endl );
-
- // On introduit une commande dans la queue du thread
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_threads_mutex);
- if (_threads.find(id) != _threads.end())
- _threads[id].command_queue.push(RELEASE);
- pthread_mutex_unlock(&_threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- }
-
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_Local::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
- {
- }
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_Local::alterJob(const JobId & jobid, const Parametre & param)
- {
- alterJob(jobid, param, Environnement());
- }
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_Local::alterJob(const JobId & jobid, const Environnement & env)
- {
- alterJob(jobid, Parametre(), env);
- }
-
-
-
- // Methode pour le controle des jobs : renvoie l'etat du job
- JobInfo BatchManager_Local::queryJob(const JobId & jobid)
- {
- Id id;
- istringstream iss(jobid.getReference());
- iss >> id;
-
- Parametre param;
- Environnement env;
-
- //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : AVANT section critique" << endl );
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_threads_mutex);
- param = _threads[id].param;
- env = _threads[id].env;
- pthread_mutex_unlock(&_threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : APRES section critique" << endl );
-
- JobInfo_Local ji(param, env);
- return ji;
- }
-
-
-
- // Methode pour le controle des jobs : teste si un job est present en machine
- bool BatchManager_Local::isRunning(const JobId & jobid)
- {
- Id id;
- istringstream iss(jobid.getReference());
- iss >> id;
-
- Status status;
-
- //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : AVANT section critique" << endl );
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_threads_mutex);
- status = _threads[id].status;
- pthread_mutex_unlock(&_threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : APRES section critique" << endl );
-
- return (status == RUNNING);
- }
-
-
- // Methode d'execution d'un job
- pthread_t BatchManager_Local::submit(const Job_Local & job)
- {
- // L'id du thread a creer
- pthread_t thread_id =
-#ifdef WIN32
- {0,0};
-#else
- 0;
-#endif
-
- // Les attributs du thread a sa creation
- pthread_attr_t thread_attr;
- pthread_attr_init(&thread_attr);
- pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
-
- ThreadAdapter * p_ta = new ThreadAdapter(*this, job);
-
- // Creation du thread qui va executer la commande systeme qu'on lui passe
- int rc = pthread_create(&thread_id,
- &thread_attr,
- &ThreadAdapter::run,
- static_cast<void *>(p_ta));
- if (rc) {
- }
-
- // Liberation des zones memoire maintenant inutiles occupees par les attributs du thread
- pthread_attr_destroy(&thread_attr);
-
- return thread_id;
- }
-
-
- // Methode de destruction d'un job
- void BatchManager_Local::cancel(pthread_t thread_id)
- {
- pthread_cancel(thread_id);
- }
-
-
- // Fabrique un identifiant unique pour les threads puisque le thread_id n'est pas unique
- // au cours du temps (il peut etre reutilise lorsqu'un thread se termine)
- // ATTENTION : cette methode est uniquement protegee par la section critique de l'association
- // Thread_id / Id (_thread_id_id_association_mutex)
- BatchManager_Local::Id BatchManager_Local::nextId()
- {
- static Id id = 0;
- Id nextId = id++;
- //UNDER_LOCK( cout << "BatchManager_Local::Id BatchManager_Local::nextId() : Id = " << nextId << endl );
- return nextId;
- }
-
-
- // Retourne l'Id enregistre dans l'association Thread_id / Id et le detruit immediatement
- BatchManager_Local::Id BatchManager_Local::getIdByThread_id(pthread_t thread_id)
- {
- Id id = -1;
-
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_thread_id_id_association_mutex);
-#ifndef WIN32 //TODO: porting of following functionality
- while (_thread_id_id_association.find(thread_id) == _thread_id_id_association.end())
- pthread_cond_wait(&_thread_id_id_association_cond, &_thread_id_id_association_mutex);
-
- id = _thread_id_id_association[thread_id];
- _thread_id_id_association.erase(thread_id);
-#endif
-
- pthread_mutex_unlock(&_thread_id_id_association_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
-
- //UNDER_LOCK( cout << "BatchManager_Local::Id BatchManager_Local::getIdByThread_id(pthread_t thread_id) : Id = " << id << " - thread_id = " << thread_id << endl );
- return id;
- }
-
-
- // Associe un Thread_id a un Id nouvellement cree
- BatchManager_Local::Id BatchManager_Local::registerThread_id(pthread_t thread_id)
- {
- Id id = -1;
-
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_thread_id_id_association_mutex);
-#ifndef WIN32 //TODO: porting of following functionality
- if (_thread_id_id_association.find(thread_id) == _thread_id_id_association.end()) {
- id = _thread_id_id_association[thread_id] = nextId();
- pthread_cond_signal(&_thread_id_id_association_cond);
-
- } else {
- UNDER_LOCK( cerr << "ERROR : Pthread Inconstency. Two threads own the same thread_id." << endl );
- }
-#endif
- pthread_mutex_unlock(&_thread_id_id_association_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
-
- //UNDER_LOCK( cout << "BatchManager_Local::Id BatchManager_Local::registerThread_id(pthread_t thread_id) : Id = " << id << " - thread_id = " << thread_id << endl );
- return id;
- }
-
-
- // Constructeur de la classe ThreadAdapter
- BatchManager_Local::ThreadAdapter::ThreadAdapter(BatchManager_Local & bm, const Job_Local & job) :
- _bm(bm), _job(job)
- {
- // Nothing to do
- }
-
-
-
- // Methode d'execution du thread
- void * BatchManager_Local::ThreadAdapter::run(void * arg)
- {
-#ifndef WIN32 //TODO: porting of following functionality
- // On bloque tous les signaux pour ce thread
- sigset_t setmask;
- sigfillset(&setmask);
- pthread_sigmask(SIG_BLOCK, &setmask, NULL);
-
- // On autorise la terminaison differee du thread
- // (ces valeurs sont les valeurs par defaut mais on les force par precaution)
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
- pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
-
- // On enregistre la fonction de suppression du fils en cas d'arret du thread
- // Cette fontion sera automatiquement appelee lorsqu'une demande d'annulation
- // sera prise en compte par pthread_testcancel()
- pid_t child;
- pthread_cleanup_push(BatchManager_Local::kill_child_on_exit, static_cast<void *> (&child));
- pthread_cleanup_push(BatchManager_Local::delete_on_exit, arg);
-
- ThreadAdapter * p_ta = static_cast<ThreadAdapter *>(arg);
-
-
-
-
- // Le code retour cumule (ORed) de tous les appels
- // Nul en cas de reussite de l'ensemble des operations
- int rc = 0;
-
- // Cette table contient la liste des fichiers a detruire a la fin du processus
- std::vector<string> files_to_delete;
-
-
-
- // On copie les fichiers d'entree pour le fils
- const Parametre param = p_ta->_job.getParametre();
- Parametre::const_iterator it;
-
- // On initialise la variable workdir a la valeur du Current Working Directory
- char * cwd =
-#ifdef WIN32
- _getcwd(NULL, 0);
-#else
- new char [PATH_MAX];
- getcwd(cwd, PATH_MAX);
-#endif
- string workdir = cwd;
- delete [] cwd;
-
- if ( (it = param.find(WORKDIR)) != param.end() ) {
- workdir = static_cast<string>( (*it).second );
- }
-
- string executionhost = string(param[EXECUTIONHOST]);
-
- if ( (it = param.find(INFILE)) != param.end() ) {
- Versatile V = (*it).second;
- Versatile::iterator Vit;
-
- for(Vit=V.begin(); Vit!=V.end(); Vit++) {
- CoupleType cpt = *static_cast< CoupleType * >(*Vit);
- Couple cp = cpt;
- string local = cp.getLocal();
- string remote = cp.getRemote();
-
- string copy_cmd = p_ta->getBatchManager().copy_command("", local, executionhost, workdir + "/" + remote);
- UNDER_LOCK( cout << "Copying : " << copy_cmd << endl );
-
- if (system(copy_cmd.c_str()) ) {
- // Echec de la copie
- rc |= 1;
- } else {
- // On enregistre le fichier comme etant a detruire
- files_to_delete.push_back(workdir + "/" + remote);
- }
-
- }
- }
-
-
-
-
-#ifdef WIN32
- //TODO
- //Using CreateThread instead fork() POSIX function
-#else
- // On forke/exec un nouveau process pour pouvoir controler le fils
- // (plus finement qu'avec un appel system)
- // int rc = system(commande.c_str());
- child = fork();
- if (child < 0) { // erreur
- UNDER_LOCK( cerr << "Fork impossible (rc=" << child << ")" << endl );
-
- } else if (child > 0) { // pere
- p_ta->pere(child);
-
- } else { // fils
- p_ta->fils();
- }
-#endif
-
-
-
- // On copie les fichiers de sortie du fils
- if ( (it = param.find(OUTFILE)) != param.end() ) {
- Versatile V = (*it).second;
- Versatile::iterator Vit;
-
- for(Vit=V.begin(); Vit!=V.end(); Vit++) {
- CoupleType cpt = *static_cast< CoupleType * >(*Vit);
- Couple cp = cpt;
- string local = cp.getLocal();
- string remote = cp.getRemote();
-
- string copy_cmd = p_ta->getBatchManager().copy_command(executionhost, workdir + "/" + remote, "", local);
- UNDER_LOCK( cout << "Copying : " << copy_cmd << endl );
-
- if (system(copy_cmd.c_str()) ) {
- // Echec de la copie
- rc |= 1;
- } else {
- // On enregistre le fichier comme etant a detruire
- files_to_delete.push_back(workdir + "/" + remote);
- }
-
- }
- }
-
-
-
-
- // On efface les fichiers d'entree et de sortie du fils si les copies precedentes ont reussi
- // ou si la creation du fils n'a pu avoir lieu
- if ( (rc == 0) || (child < 0) ) {
- std::vector<string>::const_iterator it;
- for(it=files_to_delete.begin(); it!=files_to_delete.end(); it++) {
- string remove_cmd = p_ta->getBatchManager().remove_command(executionhost, *it);
- UNDER_LOCK( cout << "Removing : " << remove_cmd << endl );
- system(remove_cmd.c_str());
- }
- }
-
-
-
- // On retire la fonction de nettoyage de la memoire
- pthread_cleanup_pop(0);
-
- // On retire la fonction de suppression du fils
- pthread_cleanup_pop(0);
-
-
-
- // On invoque la fonction de nettoyage de la memoire
- delete_on_exit(arg);
-
- UNDER_LOCK( cout << "Father is leaving" << endl );
- pthread_exit(NULL);
-#endif
- return NULL;
- }
-
-
-
-
- void BatchManager_Local::ThreadAdapter::pere(pid_t child)
- {
-#ifndef WIN32 //TODO: porting of following functionality
- time_t child_starttime = time(NULL);
-
- // On enregistre le fils dans la table des threads
- pthread_t thread_id = pthread_self();
- Id id = _bm.registerThread_id(thread_id);
-
- Parametre param = _job.getParametre();
- Environnement env = _job.getEnvironnement();
-
- ostringstream thread_id_sst;
- thread_id_sst << id;
- param[ID] = thread_id_sst.str();
- param[STATE] = "Running";
- param[PID] = child;
-
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_bm._threads_mutex);
- _bm._threads[id].thread_id = thread_id;
- _bm._threads[id].pid = child;
- _bm._threads[id].status = RUNNING;
- _bm._threads[id].param = param;
- _bm._threads[id].env = env;
- _bm._threads[id].command_queue.push(NOP);
- pthread_mutex_unlock(&_bm._threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
-
-
-
-
-
- // on boucle en attendant que le fils ait termine
- while (1) {
- int child_rc = 0;
- pid_t child_wait_rc = waitpid(child, &child_rc, WNOHANG /* | WUNTRACED */);
- if (child_wait_rc > 0) {
- if (WIFSTOPPED(child_rc)) {
- // NOTA : pour rentrer dans cette section, il faut que le flag WUNTRACED
- // soit positionne dans l'appel a waitpid ci-dessus. Ce flag est couramment
- // desactive car s'il est possible de detecter l'arret d'un process, il est
- // plus difficile de detecter sa reprise.
-
- // Le fils est simplement stoppe
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_bm._threads_mutex);
- _bm._threads[id].status = STOPPED;
- _bm._threads[id].param[STATE] = "Stopped";
- pthread_mutex_unlock(&_bm._threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- UNDER_LOCK( cout << "Father sees his child is STOPPED : " << child_wait_rc << endl );
-
- }
- else {
- // Le fils est termine, on sort de la boucle et du if englobant
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_bm._threads_mutex);
- _bm._threads[id].status = DONE;
- _bm._threads[id].param[STATE] = "Done";
- pthread_mutex_unlock(&_bm._threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- UNDER_LOCK( cout << "Father sees his child is DONE : " << child_wait_rc << " (child_rc=" << (WIFEXITED(child_rc) ? WEXITSTATUS(child_rc) : -1) << ")" << endl );
- break;
- }
- }
- else if (child_wait_rc == -1) {
- // Le fils a disparu ...
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_bm._threads_mutex);
- _bm._threads[id].status = DEAD;
- _bm._threads[id].param[STATE] = "Dead";
- pthread_mutex_unlock(&_bm._threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- UNDER_LOCK( cout << "Father sees his child is DEAD : " << child_wait_rc << " (Reason : " << strerror(errno) << ")" << endl );
- break;
- }
-
-
-
- // On teste si le thread doit etre detruit
- pthread_testcancel();
-
-
-
- // On regarde si le fils n'a pas depasse son temps (wallclock time)
- time_t child_currenttime = time(NULL);
- time_t child_elapsedtime = child_currenttime - child_starttime;
- if (param.find(MAXWALLTIME) != param.end()) {
- int maxwalltime = param[MAXWALLTIME];
- // cout << "child_starttime = " << child_starttime << endl
- // << "child_currenttime = " << child_currenttime << endl
- // << "child_elapsedtime = " << child_elapsedtime << endl
- // << "maxwalltime = " << maxwalltime << endl
- // << "int(maxwalltime * 1.1) = " << int(maxwalltime * 1.1) << endl;
- if (child_elapsedtime > int(maxwalltime * 1.1) ) { // On se donne 10% de marge avant le KILL
- UNDER_LOCK( cout << "Father is sending KILL command to the thread " << id << endl );
- // On introduit une commande dans la queue du thread
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_bm._threads_mutex);
- if (_bm._threads.find(id) != _bm._threads.end())
- _bm._threads[id].command_queue.push(KILL);
- pthread_mutex_unlock(&_bm._threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
-
-
- } else if (child_elapsedtime > maxwalltime ) {
- UNDER_LOCK( cout << "Father is sending TERM command to the thread " << id << endl );
- // On introduit une commande dans la queue du thread
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_bm._threads_mutex);
- if (_bm._threads.find(id) != _bm._threads.end())
- _bm._threads[id].command_queue.push(TERM);
- pthread_mutex_unlock(&_bm._threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- }
- }
-
-
-
- // On regarde s'il y a quelque chose a faire dans la queue de commande
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_bm._threads_mutex);
- if (_bm._threads.find(id) != _bm._threads.end()) {
- while (_bm._threads[id].command_queue.size() > 0) {
- Commande cmd = _bm._threads[id].command_queue.front();
- _bm._threads[id].command_queue.pop();
-
- switch (cmd) {
- case NOP:
- UNDER_LOCK( cout << "Father does nothing to his child" << endl );
- break;
-
- case HOLD:
- UNDER_LOCK( cout << "Father is sending SIGSTOP signal to his child" << endl );
- kill(child, SIGSTOP);
- break;
-
- case RELEASE:
- UNDER_LOCK( cout << "Father is sending SIGCONT signal to his child" << endl );
- kill(child, SIGCONT);
- break;
-
- case TERM:
- UNDER_LOCK( cout << "Father is sending SIGTERM signal to his child" << endl );
- kill(child, SIGTERM);
- break;
-
- case KILL:
- UNDER_LOCK( cout << "Father is sending SIGKILL signal to his child" << endl );
- kill(child, SIGKILL);
- break;
-
- case ALTER:
- break;
-
- default:
- break;
- }
- }
-
- }
- pthread_mutex_unlock(&_bm._threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
-
- // On fait une petite pause pour ne pas surcharger inutilement le processeur
- sleep(1);
-
- }
-#endif
-
-
- }
-
-
-
-
- void BatchManager_Local::ThreadAdapter::fils()
- {
-#ifndef WIN32 //TODO: porting of following functionality
- Parametre param = _job.getParametre();
- Parametre::iterator it;
-
- try {
-
- // On se place dans le repertoire de travail
- if ( (it = param.find(WORKDIR)) != param.end() ) {
- string workdir = static_cast<string>( (*it).second );
- chdir(workdir.c_str());
- }
-
-
-
-
- // EXECUTABLE is MANDATORY, if missing, we exit with failure notification
- char * execpath = NULL;
- if (param.find(EXECUTABLE) != param.end()) {
- string executable = _bm.exec_command(param);
- execpath = new char [executable.size() + 1];
- strncpy(execpath, executable.c_str(), executable.size() + 1);
- } else exit(1);
-
- string debug_command = execpath;
-
- string name = (param.find(NAME) != param.end()) ? param[NAME] : param[EXECUTABLE];
-
- char ** argv = NULL;
- if (param.find(ARGUMENTS) != param.end()) {
- Versatile V = param[ARGUMENTS];
-
- argv = new char * [V.size() + 2]; // 1 pour name et 1 pour le NULL terminal
-
- argv[0] = new char [name.size() + 1];
- strncpy(argv[0], name.c_str(), name.size() + 1);
-
- debug_command += string(" # ") + argv[0];
-
- int i = 1;
- for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++, i++) {
- StringType argt = * static_cast<StringType *>(*it);
- string arg = argt;
- argv[i] = new char [arg.size() + 1];
- strncpy(argv[i], arg.c_str(), arg.size() + 1);
- debug_command += string(" # ") + argv[i];
- }
-
- // assert (i == V.size() + 1)
- argv[i] = NULL;
- }
-
-
- UNDER_LOCK( cout << "*** debug_command = " << debug_command << endl );
-
-
-
- Environnement env = _job.getEnvironnement();
-
-
- char ** envp = NULL;
- if(env.size() > 0) {
- envp = new char * [env.size() + 1]; // 1 pour le NULL terminal
- int i = 0;
- for(Environnement::const_iterator it=env.begin(); it!=env.end(); it++, i++) {
- const string & key = (*it).first;
- const string & value = (*it).second;
- ostringstream oss;
- oss << key << "=" << value;
- envp[i] = new char [oss.str().size() + 1];
- strncpy(envp[i], oss.str().c_str(), oss.str().size() + 1);
- }
-
- // assert (i == env.size())
- envp[i] = NULL;
- }
-
-
-
-
- // On positionne les limites systeme imposees au fils
- if (param.find(MAXCPUTIME) != param.end()) {
- int maxcputime = param[MAXCPUTIME];
- struct rlimit limit;
- limit.rlim_cur = maxcputime;
- limit.rlim_max = int(maxcputime * 1.1);
- setrlimit(RLIMIT_CPU, &limit);
- }
-
- if (param.find(MAXDISKSIZE) != param.end()) {
- int maxdisksize = param[MAXDISKSIZE];
- struct rlimit limit;
- limit.rlim_cur = maxdisksize * 1024;
- limit.rlim_max = int(maxdisksize * 1.1) * 1024;
- setrlimit(RLIMIT_FSIZE, &limit);
- }
-
- if (param.find(MAXRAMSIZE) != param.end()) {
- int maxramsize = param[MAXRAMSIZE];
- struct rlimit limit;
- limit.rlim_cur = maxramsize * 1024;
- limit.rlim_max = int(maxramsize * 1.1) * 1024;
- setrlimit(RLIMIT_AS, &limit);
- }
-
-
-
- // On cree une session pour le fils de facon a ce qu'il ne soit pas
- // detruit lorsque le shell se termine (le shell ouvre une session et
- // tue tous les process appartenant a la session en quittant)
- setsid();
-
-
- // On ferme les descripteurs de fichiers standards
- //close(STDIN_FILENO);
- //close(STDOUT_FILENO);
- //close(STDERR_FILENO);
-
-
- // On execute la commande du fils
- execve(execpath, argv, envp);
-
- // No need to deallocate since nothing happens after a successful exec
-
- // Normalement on ne devrait jamais arriver ici
- ofstream file_err("error.log");
- UNDER_LOCK( file_err << "Echec de l'appel a execve" << endl );
-
- } catch (GenericException & e) {
-
- std::cerr << "Caught exception : " << e.type << " : " << e.message << std::endl;
- }
-
- exit(99);
-#endif
- }
-
-
-
-
- void BatchManager_Local::kill_child_on_exit(void * p_pid)
- {
-#ifndef WIN32
- //TODO: porting of following functionality
- pid_t child = * static_cast<pid_t *>(p_pid);
-
- // On tue le fils
- kill(child, SIGTERM);
-
- // Nota : on pourrait aussi faire a la suite un kill(child, SIGKILL)
- // mais cette option n'est pas implementee pour le moment, car il est
- // preferable de laisser le process fils se terminer normalement et seul.
-#endif
- }
-
- void BatchManager_Local::delete_on_exit(void * arg)
- {
- ThreadAdapter * p_ta = static_cast<ThreadAdapter *>(arg);
- delete p_ta;
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_Local.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:17:22 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _BATCHMANAGER_LOCAL_H_
-#define _BATCHMANAGER_LOCAL_H_
-
-#include "Batch_Defines.hxx"
-
-#include <vector>
-#include <map>
-#include <queue>
-#include <pthread.h>
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_JobInfo_Local.hxx"
-#include "Batch_Job_Local.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-#include "Batch_ConnexionFailureException.hxx"
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_NotYetImplementedException.hxx"
-#include "Batch_BatchManager.hxx"
-
-namespace Batch {
-
- class FactBatchManager;
-
- class BATCH_EXPORT BatchManager_Local : public BatchManager
- {
- private:
- friend class ThreadAdapter;
- class ThreadAdapter{
- public:
- ThreadAdapter(BatchManager_Local & bm, const Job_Local & job);
- static void * run(void * arg);
- BatchManager_Local & getBatchManager() const { return _bm; };
-
- protected:
- BatchManager_Local & _bm;
- const Job_Local _job;
-
- private:
- void pere(pid_t child);
- void fils();
-
- };
-
- typedef int Id;
-
- enum Commande {
- NOP = 0,
- HOLD,
- RELEASE,
- TERM,
- KILL,
- ALTER,
- };
-
- enum Status {
- UNKNOWN = 0,
- RUNNING,
- STOPPED,
- DONE,
- DEAD,
- };
-
- struct Child {
- pthread_t thread_id;
- std::queue<Commande, std::deque<Commande> > command_queue;
- pid_t pid;
- int exit_code;
- Status status;
- Parametre param;
- Environnement env;
- };
-
-
-
- public:
- // Constructeur et destructeur
- BatchManager_Local(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host
- virtual ~BatchManager_Local();
-
- // Recupere le nom du serveur par defaut
- // static string BatchManager_Local::getDefaultServer();
-
- // Methodes pour le controle des jobs
- virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
- virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
- virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
- virtual void releaseJob(const JobId & jobid); // relache un job suspendu
- virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
- virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
- virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
- virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
- virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
-
- virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
- virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
-
-
- protected:
- int _connect; // Local connect id
- pthread_mutex_t _threads_mutex;
- std::map<Id, Child > _threads;
-
- // Methode abstraite qui renvoie la commande de copie du fichier source en destination
- virtual std::string copy_command( const std::string & host_source,
- const std::string & source,
- const std::string & host_destination,
- const std::string & destination) const = 0;
-
- // Methode abstraite qui renvoie la commande a executer
- virtual std::string exec_command(Parametre & param) const = 0;
-
- // Methode abstraite qui renvoie la commande d'effacement du fichier
- virtual std::string remove_command( const std::string & host_destination,
- const std::string & destination) const = 0;
-
- private:
- virtual pthread_t submit(const Job_Local & job);
- virtual void cancel(pthread_t thread_id);
- static void kill_child_on_exit(void * p_pid);
- static void delete_on_exit(void * arg);
- Id nextId(); // Retourne un identifiant unique pour un thread (clef de la map)
- Id getIdByThread_id(pthread_t thread_id);
- Id registerThread_id(pthread_t thread_id);
- pthread_mutex_t _thread_id_id_association_mutex;
- pthread_cond_t _thread_id_id_association_cond;
-#ifndef WIN32 //TODO: porting of following functionality
- //reason: pthread_t on win32 is a struct of pointer and int members
- std::map<pthread_t, Id> _thread_id_id_association;
-#endif
-
-#ifdef SWIG
- public:
- // Recupere le l'identifiant d'un job deja soumis au BatchManager
- //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
- virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
-#endif
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_Local_RSH.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:17:22 2003
- * Projet : Salome 2
- *
- */
-
-#ifdef HAVE_CONFIG_H
-# include <SALOMEconfig.h>
-#endif
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <cstdlib>
-#include <sys/types.h>
-#ifndef WIN32
-#include <sys/wait.h>
-#include <unistd.h>
-#endif
-#include <ctime>
-#include <pthread.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include "Batch_IOMutex.hxx"
-#include "Batch_BatchManager_Local_RSH.hxx"
-
-#ifndef RM
-#error "RM undefined. You must set RM to a valid path to a rm-like command."
-#endif
-
-#ifndef RCP
-#error "RCP undefined. You must set RCP to a valid path to a rcp-like command."
-#endif
-
-#ifndef RSH
-#error "RSH undefined. You must set RSH to a valid path to a rsh-like command."
-#endif
-
-using namespace std;
-
-namespace Batch {
-
-
- // Constructeur
- BatchManager_Local_RSH::BatchManager_Local_RSH(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_Local(parent, host)
- {
- }
-
- // Destructeur
- BatchManager_Local_RSH::~BatchManager_Local_RSH()
- {
- }
-
-
- // Methode abstraite qui renvoie la commande de copie du fichier source en destination
- string BatchManager_Local_RSH::copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const
- {
- ostringstream fullsource;
- if (host_source.size() == 0) {
- fullsource << "localhost:";
- } else {
- fullsource << host_source << ":";
- }
- fullsource << source;
-
- ostringstream fulldestination;
- if (host_destination.size() == 0) {
- fulldestination << "localhost:";
- } else {
- fulldestination << host_destination << ":";
- }
- fulldestination << destination;
-
- ostringstream copy_cmd;
- copy_cmd << RCP << " " << fullsource.str() << " " << fulldestination.str();
- return copy_cmd.str();
- }
-
- // Methode abstraite qui renvoie la commande a executer
- string BatchManager_Local_RSH::exec_command(Parametre & param) const
- {
- ostringstream exec_sub_cmd;
- exec_sub_cmd << param[EXECUTABLE];
-
- if (param.find(ARGUMENTS) != param.end()) {
- Versatile V = param[ARGUMENTS];
- for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) {
- StringType argt = * static_cast<StringType *>(*it);
- string arg = argt;
- exec_sub_cmd << " " << arg;
- }
- }
-
-
- Versatile new_arguments;
- new_arguments.setMaxSize(0);
- new_arguments = string(param[EXECUTIONHOST]);
-
-
- if (param.find(USER) != param.end()) {
- new_arguments += "-l";
- new_arguments += string(param[USER]);
- }
-
- new_arguments += exec_sub_cmd.str();
-
- param[ARGUMENTS] = new_arguments;
-
- // Sous Linux on est oblige de modifier ces deux parametres pour faire fonctionner la commande rsh
- param[EXECUTABLE] = RSH;
- param.erase(NAME);
-
- return RSH;
- }
-
- // Methode qui renvoie la commande d'effacement du fichier
- string BatchManager_Local_RSH::remove_command(const string & host_destination, const string & destination) const
- {
- string host = (host_destination.size()) ? host_destination : "localhost:";
-
- ostringstream remove_cmd;
- remove_cmd << RSH << " " << host << " \"" << RM << " " << destination << "\"";
- return remove_cmd.str();
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_Local_RSH.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:17:22 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _BATCHMANAGER_LOCAL_RSH_H_
-#define _BATCHMANAGER_LOCAL_RSH_H_
-
-#include "Batch_Defines.hxx"
-
-#include <vector>
-#include <map>
-#include <queue>
-#include <deque>
-#include <pthread.h>
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_JobInfo_Local.hxx"
-#include "Batch_Job_Local.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-#include "Batch_ConnexionFailureException.hxx"
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_NotYetImplementedException.hxx"
-#include "Batch_BatchManager_Local.hxx"
-
-namespace Batch {
-
- class FactBatchManager;
-
- class BATCH_EXPORT BatchManager_Local_RSH : public BatchManager_Local
- {
- public:
- // Constructeur et destructeur
- BatchManager_Local_RSH(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host
- virtual ~BatchManager_Local_RSH();
-
- protected:
- // Methode abstraite qui renvoie la commande de copie du fichier source en destination
- virtual std::string copy_command( const std::string & host_source,
- const std::string & source,
- const std::string & host_destination,
- const std::string & destination) const;
-
- // Methode abstraite qui renvoie la commande a executer
- virtual std::string exec_command(Parametre & param) const;
-
- // Methode qui renvoie la commande d'effacement du fichier
- virtual std::string remove_command( const std::string & host_destination,
- const std::string & destination) const;
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_Local_SH.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:17:22 2003
- * Projet : Salome 2
- *
- */
-
-#ifdef HAVE_CONFIG_H
-# include <SALOMEconfig.h>
-#endif
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <cstdlib>
-#include <sys/types.h>
-#ifndef WIN32
-#include <sys/wait.h>
-#include <unistd.h>
-#endif
-#include <ctime>
-#include <pthread.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include "Batch_IOMutex.hxx"
-#include "Batch_BatchManager_Local_SH.hxx"
-
-#ifndef RM
-#error "RM undefined. You must set RM to a valid path to a rm-like command."
-#endif
-
-#ifndef CP
-#error "CP undefined. You must set CP to a valid path to a cp-like command."
-#endif
-
-#ifndef SH
-#error "SH undefined. You must set SH to a valid path to a sh-like command."
-#endif
-
-using namespace std;
-
-namespace Batch {
-
-
- // Constructeur
- BatchManager_Local_SH::BatchManager_Local_SH(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_Local(parent, host)
- {
- }
-
- // Destructeur
- BatchManager_Local_SH::~BatchManager_Local_SH()
- {
- }
-
-
- // Methode qui renvoie la commande de copie du fichier source en destination
- string BatchManager_Local_SH::copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const
- {
- ostringstream copy_cmd;
- copy_cmd << CP << " " << source << " " << destination;
- return copy_cmd.str();
- }
-
- // Methode qui renvoie la commande a executer
- string BatchManager_Local_SH::exec_command(Parametre & param) const
- {
- ostringstream exec_sub_cmd;
- exec_sub_cmd << param[EXECUTABLE];
-
- if (param.find(ARGUMENTS) != param.end()) {
- Versatile V = param[ARGUMENTS];
- for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) {
- StringType argt = * static_cast<StringType *>(*it);
- string arg = argt;
- exec_sub_cmd << " " << arg;
- }
- }
-
- param[ARGUMENTS] = "-c";
- param[ARGUMENTS] += exec_sub_cmd.str();
-
- return SH;
- }
-
- // Methode qui renvoie la commande d'effacement du fichier
- string BatchManager_Local_SH::remove_command(const string & host_destination, const string & destination) const
- {
- ostringstream remove_cmd;
- remove_cmd << RM << " " << destination;
- return remove_cmd.str();
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_Local_SH.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:17:22 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _BATCHMANAGER_LOCAL_SH_H_
-#define _BATCHMANAGER_LOCAL_SH_H_
-
-#include "Batch_Defines.hxx"
-
-#include <vector>
-#include <map>
-#include <queue>
-#include <deque>
-#include <pthread.h>
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_JobInfo_Local.hxx"
-#include "Batch_Job_Local.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-#include "Batch_ConnexionFailureException.hxx"
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_NotYetImplementedException.hxx"
-#include "Batch_BatchManager_Local.hxx"
-
-namespace Batch {
-
- class FactBatchManager;
-
- class BATCH_EXPORT BatchManager_Local_SH : public BatchManager_Local
- {
- public:
- // Constructeur et destructeur
- BatchManager_Local_SH(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host
- virtual ~BatchManager_Local_SH();
-
- protected:
- // Methode qui renvoie la commande de copie du fichier source en destination
- virtual std::string copy_command( const std::string & host_source,
- const std::string & source,
- const std::string & host_destination,
- const std::string & destination) const;
-
- // Methode qui renvoie la commande a executer
- virtual std::string exec_command(Parametre & param) const;
-
- // Methode qui renvoie la commande d'effacement du fichier
- virtual std::string remove_command( const std::string & host_destination,
- const std::string & destination) const;
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_Local_SSH.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:17:22 2003
- * Projet : Salome 2
- *
- */
-
-#ifdef HAVE_CONFIG_H
-# include <SALOMEconfig.h>
-#endif
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <cstdlib>
-#include <sys/types.h>
-#ifndef WIN32
-#include <sys/wait.h>
-#include <unistd.h>
-#endif
-#include <ctime>
-
-#include <pthread.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include "Batch_IOMutex.hxx"
-#include "Batch_BatchManager_Local_SSH.hxx"
-
-#ifndef RM
-#error "RM undefined. You must set RM to a valid path to a rm-like command."
-#endif
-
-#ifndef RCP
-#error "RCP undefined. You must set RCP to a valid path to a scp-like command."
-#endif
-
-#ifndef SSH
-#error "SSH undefined. You must set SSH to a valid path to a ssh-like command."
-#endif
-
-using namespace std;
-
-namespace Batch {
-
-
- // Constructeur
- BatchManager_Local_SSH::BatchManager_Local_SSH(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_Local(parent, host)
- {
- }
-
- // Destructeur
- BatchManager_Local_SSH::~BatchManager_Local_SSH()
- {
- }
-
-
- // Methode abstraite qui renvoie la commande de copie du fichier source en destination
- string BatchManager_Local_SSH::copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const
- {
- ostringstream fullsource;
- if (host_source.size() == 0) {
- fullsource << "localhost:";
- } else {
- fullsource << host_source << ":";
- }
- fullsource << source;
-
- ostringstream fulldestination;
- if (host_destination.size() == 0) {
- fulldestination << "localhost:";
- } else {
- fulldestination << host_destination << ":";
- }
- fulldestination << destination;
-
- ostringstream copy_cmd;
- copy_cmd << RCP << " " << fullsource.str() << " " << fulldestination.str();
- return copy_cmd.str();
- }
-
- // Methode abstraite qui renvoie la commande a executer
- string BatchManager_Local_SSH::exec_command(Parametre & param) const
- {
- ostringstream exec_sub_cmd;
- exec_sub_cmd << param[EXECUTABLE];
-
- if (param.find(ARGUMENTS) != param.end()) {
- Versatile V = param[ARGUMENTS];
- for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) {
- StringType argt = * static_cast<StringType *>(*it);
- string arg = argt;
- exec_sub_cmd << " " << arg;
- }
- }
-
-
- Versatile new_arguments;
- new_arguments.setMaxSize(0);
- new_arguments = string(param[EXECUTIONHOST]);
-
-
- if (param.find(USER) != param.end()) {
- new_arguments += "-l";
- new_arguments += string(param[USER]);
- }
-
- new_arguments += exec_sub_cmd.str();
-
- param[ARGUMENTS] = new_arguments;
-
- // Sous Linux on est oblige de modifier ces deux parametres pour faire fonctionner la commande rsh
- param[EXECUTABLE] = SSH;
- param.erase(NAME);
-
- return SSH;
- }
-
- // Methode qui renvoie la commande d'effacement du fichier
- string BatchManager_Local_SSH::remove_command(const string & host_destination, const string & destination) const
- {
- string host = (host_destination.size()) ? host_destination : "localhost:";
-
- ostringstream remove_cmd;
- remove_cmd << SSH << " " << host << " \"" << RM << " " << destination << "\"";
- return remove_cmd.str();
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_Local_SSH.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:17:22 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _BATCHMANAGER_LOCAL_SSH_H_
-#define _BATCHMANAGER_LOCAL_SSH_H_
-
-#include "Batch_Defines.hxx"
-
-#include <vector>
-#include <map>
-#include <queue>
-#include <deque>
-#include <pthread.h>
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_JobInfo_Local.hxx"
-#include "Batch_Job_Local.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-#include "Batch_ConnexionFailureException.hxx"
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_NotYetImplementedException.hxx"
-#include "Batch_BatchManager_Local.hxx"
-
-namespace Batch {
-
- class FactBatchManager;
-
- class BATCH_EXPORT BatchManager_Local_SSH : public BatchManager_Local
- {
- public:
- // Constructeur et destructeur
- BatchManager_Local_SSH(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host
- virtual ~BatchManager_Local_SSH();
-
- protected:
- // Methode abstraite qui renvoie la commande de copie du fichier source en destination
- virtual std::string copy_command( const std::string & host_source,
- const std::string & source,
- const std::string & host_destination,
- const std::string & destination) const;
-
- // Methode abstraite qui renvoie la commande a executer
- virtual std::string exec_command(Parametre & param) const;
-
- // Methode qui renvoie la commande d'effacement du fichier
- virtual std::string remove_command( const std::string & host_destination,
- const std::string & destination) const;
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_PBS.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:17:22 2003
- * Projet : Salome 2
- *
- */
-
-extern "C" {
-#include <pbs_error.h>
-#include <pbs_ifl.h>
-}
-#include <iostream>
-#include <fstream>
-#include <sstream>
-//#include "MEDMEM_STRING.hxx"
-#include "Batch_BatchManager_PBS.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Recupere le nom du serveur par defaut
-// string BatchManager_PBS::getDefaultServer() {
-// string server_name = "localhost";
-
-// const char * server_name_path = "@openpbsspooldir@/server_name";
-// ifstream server_name_file(server_name_path);
-// if (server_name_file) {
-// server_name_file >> server_name;
-// server_name_file.close();
-// }
-
-// return server_name;
-// }
-
- // Constructeur
-// BatchManager_PBS::BatchManager_PBS() throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(BatchManager_PBS::getDefaultServer())
-// {
-// // On se connecte au serveur PBS
-// _connect = pbs_connect(const_cast< char * >(_hostname.c_str()));
-// if (_connect < 0) { // si erreur
-// char * errmsg = pbs_geterrmsg(_connect);
-// string msg = "PBS Server on host \"";
-// msg += _hostname;
-// msg += "\" : ";
-// msg += errmsg ? errmsg : "Reason unknown";
-// throw ConnexionFailureException(msg.c_str());
-// }
-// }
-
- // Constructeur
-// BatchManager_PBS::BatchManager_PBS(string host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(host)
-// {
-// // On se connecte au serveur PBS
-// _connect = pbs_connect(const_cast< char * >(_hostname.c_str()));
-// if (_connect < 0) { // si erreur
-// char * errmsg = pbs_geterrmsg(_connect);
-// string msg = "PBS Server on host \"";
-// msg += _hostname;
-// msg += "\" : ";
-// msg += errmsg ? errmsg : "Reason unknown";
-// throw ConnexionFailureException(msg.c_str());
-// }
-// }
- BatchManager_PBS::BatchManager_PBS(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host)
- {
- // On se connecte au serveur PBS
- _connect = pbs_connect(const_cast< char * >(_hostname.c_str()));
- if (_connect < 0) { // si erreur
- char * errmsg = pbs_geterrmsg(_connect);
- string msg = "PBS Server on host \"";
- msg += _hostname;
- msg += "\" : ";
- msg += errmsg ? errmsg : "Reason unknown";
- throw ConnexionFailureException(msg.c_str());
- }
- }
-
- // Destructeur
- BatchManager_PBS::~BatchManager_PBS()
- {
- // On se deconnecte du serveur PBS
- int rc = pbs_disconnect(_connect);
- if (rc < 0) { // si erreur
- string msg = "PBS Server on host \"";
- msg += _hostname;
- msg += "\" : ";
- msg += pbs_geterrmsg(_connect);
- throw ConnexionFailureException(msg.c_str());
- }
- }
-
- // Methode pour le controle des jobs : soumet un job au gestionnaire
- const JobId BatchManager_PBS::submitJob(const Job & job)
- {
- Job_PBS jobpbs = job;
- char * ref = pbs_submit(_connect,
- jobpbs.getAttributesOP(),
- jobpbs.getScript(),
- jobpbs.getDestination(),
- NULL);
- if (!ref) { // si erreur
- char * msg = pbs_geterrmsg(_connect);
- if (!msg) msg = "unknown";
- throw APIInternalFailureException(string("PBS submit error. Reason : ") + msg);
- }
-
- JobId id(this, string(ref));
- free(ref);
- return id;
- }
-
- // Methode pour le controle des jobs : retire un job du gestionnaire
- void BatchManager_PBS::deleteJob(const JobId & jobid)
- {
- char * ref = const_cast< char * >(jobid.getReference().c_str());
- int rc = pbs_deljob(_connect, ref, 0);
- if (rc) { // si erreur
- char * msg = pbs_geterrmsg(_connect);
- if (!msg) msg = "unknown";
- throw APIInternalFailureException(string("PBS deljob error. Reason : ") + msg);
- }
- }
-
- // Methode pour le controle des jobs : suspend un job en file d'attente
- void BatchManager_PBS::holdJob(const JobId & jobid)
- {
- char * ref = const_cast< char * >(jobid.getReference().c_str());
- int rc = pbs_holdjob(_connect, ref, USER_HOLD, 0);
- if (rc) { // si erreur
- char * msg = pbs_geterrmsg(_connect);
- if (!msg) msg = "unknown";
- throw APIInternalFailureException(string("PBS holdjob error. Reason : ") + msg);
- }
- }
-
- // Methode pour le controle des jobs : relache un job suspendu
- void BatchManager_PBS::releaseJob(const JobId & jobid)
- {
- char * ref = const_cast< char * >(jobid.getReference().c_str());
- int rc = pbs_rlsjob(_connect, ref, USER_HOLD, 0);
- if (rc) { // si erreur
- char * msg = pbs_geterrmsg(_connect);
- if (!msg) msg = "unknown";
- throw APIInternalFailureException(string("PBS rlsjob error. Reason : ") + msg);
- }
- }
-
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_PBS::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
- {
- Job job(param, env);
- Job_PBS jobpbs(job);
-
- char * ref = const_cast< char * >(jobid.getReference().c_str());
- int rc = pbs_alterjob(_connect,
- ref,
- jobpbs.getAttributes(),
- NULL);
- if (rc) { // si erreur
- char * msg = pbs_geterrmsg(_connect);
- if (!msg) msg = "unknown";
- throw APIInternalFailureException(string("PBS alterjob error. Reason : ") + msg);
- }
-
- }
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_PBS::alterJob(const JobId & jobid, const Parametre & param)
- {
- alterJob(jobid, param, Environnement());
- }
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_PBS::alterJob(const JobId & jobid, const Environnement & env)
- {
- alterJob(jobid, Parametre(), env);
- }
-
-
-
- // Methode pour le controle des jobs : renvoie l'etat du job
- JobInfo BatchManager_PBS::queryJob(const JobId & jobid)
- {
- char * id = const_cast< char * >(jobid.getReference().c_str());
- JobInfo_PBS ji = JobInfo_PBS(pbs_statjob(_connect, id, 0, 0), true);
- return ji;
- }
-
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_PBS.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:17:22 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _BATCHMANAGER_PBS_H_
-#define _BATCHMANAGER_PBS_H_
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_Job.hxx"
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_JobInfo_PBS.hxx"
-#include "Batch_Job_PBS.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-#include "Batch_ConnexionFailureException.hxx"
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_NotYetImplementedException.hxx"
-#include "Batch_BatchManager.hxx"
-
-namespace Batch {
-
- class Job;
- class JobId;
- class JobInfo;
- class FactBatchManager;
-
- class BATCH_EXPORT BatchManager_PBS : public BatchManager
- {
- public:
- // Constructeur et destructeur
- //BatchManager_PBS() throw(InvalidArgumentException,ConnexionFailureException); // connexion au serveur par defaut
- //BatchManager_PBS(std::string host) throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host
- BatchManager_PBS(const FactBatchManager * parent, const char * host="localhost") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host
- virtual ~BatchManager_PBS();
-
- // Recupere le nom du serveur par defaut
- // static std::string BatchManager_PBS::getDefaultServer();
-
- // Methodes pour le controle des jobs
- virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
- virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
- virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
- virtual void releaseJob(const JobId & jobid); // relache un job suspendu
- virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
- virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
- virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
- virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
-
- virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
- virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
-
-
- protected:
- int _connect; // PBS connect id
-
- private:
-
-#ifdef SWIG
- public:
- // Recupere le l'identifiant d'un job deja soumis au BatchManager
- //virtual const JobId getJobIdByReference(const std::string & ref) { return BatchManager::getJobIdByReference(ref); }
- virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
-#endif
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
-* BatchManager_eLSF.cxx : emulation of LSF client
-*
-* Auteur : Bernard SECHER - CEA DEN
-* Mail : mailto:bernard.secher@cea.fr
-* Date : Thu Apr 24 10:17:22 2008
-* Projet : PAL Salome
-*
-*/
-
-#include "Batch_BatchManager_eClient.hxx"
-#include "Basics_DirUtils.hxx"
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdlib.h>
-
-using namespace std;
-
-
-namespace Batch {
-
- BatchManager_eClient::BatchManager_eClient(const Batch::FactBatchManager * parent, const char* host, const char* protocol, const char* mpiImpl) : BatchManager(parent, host), _protocol(protocol), _username("")
- {
- // instanciation of mpi implementation needed to launch executable in batch script
- _mpiImpl = FactoryMpiImpl(mpiImpl);
- }
-
- // Destructeur
- BatchManager_eClient::~BatchManager_eClient()
- {
- // Nothing to do
- delete _mpiImpl;
- }
-
- void BatchManager_eClient::exportInputFiles(const Job& job) throw(EmulationException)
- {
- int status;
- Parametre params = job.getParametre();
- Versatile V = params[INFILE];
- Versatile::iterator Vit;
- string command;
- string copy_command;
- _username = string(params[USER]);
-
- // Test protocol
- if( _protocol == "rsh" )
- copy_command = "rcp ";
- else if( _protocol == "ssh" )
- copy_command = "scp ";
- else
- throw EmulationException("Unknown protocol : only rsh and ssh are known !");
-
- // First step : creating batch tmp files directory
- command = _protocol;
- command += " ";
- if(_username != ""){
- command += _username;
- command += "@";
- }
- command += _hostname;
- command += " \"mkdir -p ";
- command += string(params[TMPDIR]);
- command += "\"" ;
- cerr << command.c_str() << endl;
- status = system(command.c_str());
- if(status) {
- std::ostringstream oss;
- oss << status;
- std::string ex_mess("Error of connection on remote host ! status = ");
- ex_mess += oss.str();
- throw EmulationException(ex_mess.c_str());
- }
-
- // Second step : copy fileToExecute into
- // batch tmp files directory
- string executeFile = params[EXECUTABLE];
- if( executeFile.size() > 0 ){
- command = copy_command;
- command += string(params[EXECUTABLE]);
- command += " ";
- if(_username != ""){
- command += _username;
- command += "@";
- }
- command += _hostname;
- command += ":";
- command += string(params[TMPDIR]);
- cerr << command.c_str() << endl;
- status = system(command.c_str());
- if(status) {
- std::ostringstream oss;
- oss << status;
- std::string ex_mess("Error of connection on remote host ! status = ");
- ex_mess += oss.str();
- throw EmulationException(ex_mess.c_str());
- }
- }
-
- // Third step : copy filesToExportList into
- // batch tmp files directory
- for(Vit=V.begin(); Vit!=V.end(); Vit++) {
- CoupleType cpt = *static_cast< CoupleType * >(*Vit);
- Couple inputFile = cpt;
- command = copy_command;
- command += inputFile.getLocal();
- command += " ";
- if(_username != ""){
- command += _username;
- command += "@";
- }
- command += _hostname;
- command += ":";
- command += inputFile.getRemote();
- cerr << command.c_str() << endl;
- status = system(command.c_str());
- if(status) {
- std::ostringstream oss;
- oss << status;
- std::string ex_mess("Error of connection on remote host ! status = ");
- ex_mess += oss.str();
- throw EmulationException(ex_mess.c_str());
- }
- }
-
- }
-
- void BatchManager_eClient::importOutputFiles( const Job & job, const string directory ) throw(EmulationException)
- {
- string command;
- int status;
-
- Parametre params = job.getParametre();
- Versatile V = params[OUTFILE];
- Versatile::iterator Vit;
-
- for(Vit=V.begin(); Vit!=V.end(); Vit++) {
- CoupleType cpt = *static_cast< CoupleType * >(*Vit);
- Couple outputFile = cpt;
- if( _protocol == "rsh" )
- command = "rcp ";
- else if( _protocol == "ssh" )
- command = "scp ";
- else
- throw EmulationException("Unknown protocol");
-
- if (_username != ""){
- command += _username;
- command += "@";
- }
- command += _hostname;
- command += ":";
- command += outputFile.getRemote();
- command += " ";
- command += directory;
- cerr << command.c_str() << endl;
- status = system(command.c_str());
- if(status)
- {
- // Try to get what we can (logs files)
- // throw BatchException("Error of connection on remote host");
- std::string mess("Copy command failed ! status is :");
- ostringstream status_str;
- status_str << status;
- mess += status_str.str();
- cerr << mess << endl;
- }
- }
-
- }
-
- MpiImpl *BatchManager_eClient::FactoryMpiImpl(string mpiImpl) throw(EmulationException)
- {
- if(mpiImpl == "lam")
- return new MpiImpl_LAM();
- else if(mpiImpl == "mpich1")
- return new MpiImpl_MPICH1();
- else if(mpiImpl == "mpich2")
- return new MpiImpl_MPICH2();
- else if(mpiImpl == "openmpi")
- return new MpiImpl_OPENMPI();
- else if(mpiImpl == "slurm")
- return new MpiImpl_SLURM();
- else if(mpiImpl == "prun")
- return new MpiImpl_PRUN();
- else if(mpiImpl == "nompi")
- throw EmulationException("you must specified an mpi implementation for batch manager");
- else{
- ostringstream oss;
- oss << mpiImpl << " : not yet implemented";
- throw EmulationException(oss.str().c_str());
- }
- }
-
- string BatchManager_eClient::BuildTemporaryFileName() const
- {
- //build more complex file name to support multiple salome session
- string aFileName = Kernel_Utils::GetTmpFileName();
-#ifndef WIN32
- aFileName += ".sh";
-#else
- aFileName += ".bat";
-#endif
- return aFileName;
- }
-
- void BatchManager_eClient::RmTmpFile(std::string & TemporaryFileName)
- {
-#ifdef WIN32
- string command = "del /F ";
-#else
- string command = "rm ";
-#endif
- command += TemporaryFileName;
- char *temp = strdup(command.c_str());
- int lgthTemp = strlen(temp);
- temp[lgthTemp - 3] = '*';
- temp[lgthTemp - 2] = '\0';
- system(temp);
- free(temp);
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_eLSF.hxx : emulation of client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail : mailto:bernard.secher@cea.fr
- * Date : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _BATCHMANAGER_eClient_H_
-#define _BATCHMANAGER_eClient_H_
-
-#include "Batch_Defines.hxx"
-
-#include "MpiImpl.hxx"
-#include "Batch_BatchManager.hxx"
-
-#include <string>
-
-namespace Batch {
-
- class Job;
-
- class BATCH_EXPORT EmulationException
- {
- public:
- const std::string msg;
-
- EmulationException(const std::string m) : msg(m) {}
- };
-
- class BATCH_EXPORT BatchManager_eClient : public BatchManager
- {
- public:
- // Constructeur et destructeur
- BatchManager_eClient(const Batch::FactBatchManager * parent, const char* host="localhost", const char* protocol="ssh", const char* mpiImpl="mpich1");
- virtual ~BatchManager_eClient();
- void importOutputFiles( const Job & job, const std::string directory ) throw(EmulationException);
-
- protected:
- std::string _protocol; // protocol to access _hostname
- std::string _username; // username to access _hostname
- MpiImpl *_mpiImpl; // Mpi implementation to launch executable in batch script
-
- std::string BuildTemporaryFileName() const;
- void RmTmpFile(std::string & TemporaryFileName);
- MpiImpl* FactoryMpiImpl(std::string mpiImpl) throw(EmulationException);
- void exportInputFiles(const Job & job) throw(EmulationException);
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_eLSF.cxx : emulation of LSF client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail : mailto:bernard.secher@cea.fr
- * Date : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "Batch_BatchManager_eLSF.hxx"
-#ifdef WIN32
-# include <time.h>
-# include <io.h>
-#else
-# include <libgen.h>
-#endif
-
-using namespace std;
-
-namespace Batch {
-
- BatchManager_eLSF::BatchManager_eLSF(const FactBatchManager * parent, const char * host, const char * protocol, const char * mpiImpl) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_eClient(parent,host,protocol,mpiImpl)
- {
- // Nothing to do
- }
-
- // Destructeur
- BatchManager_eLSF::~BatchManager_eLSF()
- {
- // Nothing to do
- }
-
- // Methode pour le controle des jobs : soumet un job au gestionnaire
- const JobId BatchManager_eLSF::submitJob(const Job & job)
- {
- int status;
- Parametre params = job.getParametre();
- const std::string dirForTmpFiles = params[TMPDIR];
- const string fileToExecute = params[EXECUTABLE];
- std::string fileNameToExecute;
- if( fileToExecute.size() > 0 ){
- string::size_type p1 = fileToExecute.find_last_of("/");
- string::size_type p2 = fileToExecute.find_last_of(".");
- fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
- }
- else
- fileNameToExecute = "command";
-
- // export input files on cluster
- exportInputFiles(job);
-
- // build batch script for job
- buildBatchScript(job);
-
- // define name of log file
- string logFile="/tmp/logs/";
- logFile += getenv("USER");
- logFile += "/batchSalome_";
- srand ( time(NULL) );
- int ir = rand();
- ostringstream oss;
- oss << ir;
- logFile += oss.str();
- logFile += ".log";
-
- string command;
-
- // define command to submit batch
- command = _protocol;
- command += " ";
-
- if(_username != ""){
- command += _username;
- command += "@";
- }
-
- command += _hostname;
- command += " \"cd " ;
- command += dirForTmpFiles ;
- command += "; bsub < " ;
- command += fileNameToExecute ;
- command += "_Batch.sh\" > ";
- command += logFile;
- cerr << command.c_str() << endl;
- status = system(command.c_str());
- if(status)
- throw EmulationException("Error of connection on remote host");
-
- // read id of submitted job in log file
- char line[128];
- FILE *fp = fopen(logFile.c_str(),"r");
- fgets( line, 128, fp);
- fclose(fp);
-
- string sline(line);
- int p10 = sline.find("<");
- int p20 = sline.find(">");
- string strjob = sline.substr(p10+1,p20-p10-1);
-
- JobId id(this, strjob);
- return id;
- }
-
- // Methode pour le controle des jobs : retire un job du gestionnaire
- void BatchManager_eLSF::deleteJob(const JobId & jobid)
- {
- int status;
- int ref;
- istringstream iss(jobid.getReference());
- iss >> ref;
-
- // define command to submit batch
- string command;
- command = _protocol;
- command += " ";
-
- if (_username != ""){
- command += _username;
- command += "@";
- }
-
- command += _hostname;
- command += " \"bkill " ;
- command += iss.str();
- command += "\"";
- cerr << command.c_str() << endl;
- status = system(command.c_str());
- if(status)
- throw EmulationException("Error of connection on remote host");
-
- cerr << "jobId = " << ref << "killed" << endl;
- }
-
- // Methode pour le controle des jobs : suspend un job en file d'attente
- void BatchManager_eLSF::holdJob(const JobId & jobid)
- {
- throw EmulationException("Not yet implemented");
- }
-
- // Methode pour le controle des jobs : relache un job suspendu
- void BatchManager_eLSF::releaseJob(const JobId & jobid)
- {
- throw EmulationException("Not yet implemented");
- }
-
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_eLSF::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
- {
- throw EmulationException("Not yet implemented");
- }
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_eLSF::alterJob(const JobId & jobid, const Parametre & param)
- {
- alterJob(jobid, param, Environnement());
- }
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_eLSF::alterJob(const JobId & jobid, const Environnement & env)
- {
- alterJob(jobid, Parametre(), env);
- }
-
- // Methode pour le controle des jobs : renvoie l'etat du job
- JobInfo BatchManager_eLSF::queryJob(const JobId & jobid)
- {
- int id;
- istringstream iss(jobid.getReference());
- iss >> id;
-
- // define name of log file
- string logFile="/tmp/logs/";
- logFile += getenv("USER");
- logFile += "/batchSalome_";
-
- srand ( time(NULL) );
- int ir = rand();
- ostringstream oss;
- oss << ir;
- logFile += oss.str();
- logFile += ".log";
-
- string command;
- int status;
-
- // define command to submit batch
- command = _protocol;
- command += " ";
-
- if (_username != ""){
- command += _username;
- command += "@";
- }
-
- command += _hostname;
- command += " \"bjobs " ;
- command += iss.str();
- command += "\" > ";
- command += logFile;
- cerr << command.c_str() << endl;
- status = system(command.c_str());
- if(status)
- throw EmulationException("Error of connection on remote host");
-
- JobInfo_eLSF ji = JobInfo_eLSF(id,logFile);
- return ji;
- }
-
-
-
- // Methode pour le controle des jobs : teste si un job est present en machine
- bool BatchManager_eLSF::isRunning(const JobId & jobid)
- {
- throw EmulationException("Not yet implemented");
- }
-
- void BatchManager_eLSF::buildBatchScript(const Job & job) throw(EmulationException)
- {
-#ifndef WIN32 //TODO: need for porting on Windows
- int status;
- Parametre params = job.getParametre();
- Environnement env = job.getEnvironnement();
- const int nbproc = params[NBPROC];
- const long edt = params[MAXWALLTIME];
- const long mem = params[MAXRAMSIZE];
- const string workDir = params[WORKDIR];
- const std::string dirForTmpFiles = params[TMPDIR];
- const string fileToExecute = params[EXECUTABLE];
- const string home = params[HOMEDIR];
- const std::string queue = params[QUEUE];
- std::string rootNameToExecute;
- std::string fileNameToExecute;
- std::string filelogtemp;
- if( fileToExecute.size() > 0 ){
- string::size_type p1 = fileToExecute.find_last_of("/");
- string::size_type p2 = fileToExecute.find_last_of(".");
- rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
- char* basec=strdup(fileToExecute.c_str());
- fileNameToExecute = "~/" + dirForTmpFiles + "/" + string(basename(basec));
- free(basec);
-
- int idx = dirForTmpFiles.find("Batch/");
- filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length());
- }
- else{
- rootNameToExecute = "command";
- }
-
- std::string TmpFileName = BuildTemporaryFileName();
- ofstream tempOutputFile;
- tempOutputFile.open(TmpFileName.c_str(), ofstream::out );
-
- tempOutputFile << "#! /bin/sh -f" << endl ;
- if (queue != "")
- tempOutputFile << "#BSUB -q " << queue << endl;
- if( edt > 0 )
- tempOutputFile << "#BSUB -W " << getWallTime(edt) << endl ;
- if( mem > 0 )
- tempOutputFile << "#BSUB -M " << mem*1024 << endl ;
- tempOutputFile << "#BSUB -n " << nbproc << endl ;
- if( fileToExecute.size() > 0 ){
- tempOutputFile << "#BSUB -o " << home << "/" << dirForTmpFiles << "/output.log." << filelogtemp << endl ;
- tempOutputFile << "#BSUB -e " << home << "/" << dirForTmpFiles << "/error.log." << filelogtemp << endl ;
- }
- else{
- tempOutputFile << "#BSUB -o " << dirForTmpFiles << "/" << env["LOGFILE"] << ".output.log" << endl ;
- tempOutputFile << "#BSUB -e " << dirForTmpFiles << "/" << env["LOGFILE"] << ".error.log" << endl ;
- }
- if( workDir.size() > 0 )
- tempOutputFile << "cd " << workDir << endl ;
- if( fileToExecute.size() > 0 ){
- tempOutputFile << _mpiImpl->boot("",nbproc);
- tempOutputFile << _mpiImpl->run("",nbproc,fileNameToExecute);
- tempOutputFile << _mpiImpl->halt();
- }
- else{
- tempOutputFile << "source " << env["SOURCEFILE"] << endl ;
- tempOutputFile << env["COMMAND"];
- }
-
- tempOutputFile.flush();
- tempOutputFile.close();
-#ifdef WIN32
- _chmod(
-#else
- chmod(
-#endif
- TmpFileName.c_str(), 0x1ED);
- cerr << TmpFileName.c_str() << endl;
-
- string command;
- if( _protocol == "rsh" )
- command = "rcp ";
- else if( _protocol == "ssh" )
- command = "scp ";
- else
- throw EmulationException("Unknown protocol");
- command += TmpFileName;
- command += " ";
- if(_username != ""){
- command += _username;
- command += "@";
- }
- command += _hostname;
- command += ":";
- command += dirForTmpFiles ;
- command += "/" ;
- command += rootNameToExecute ;
- command += "_Batch.sh" ;
- cerr << command.c_str() << endl;
- status = system(command.c_str());
- if(status)
- throw EmulationException("Error of connection on remote host");
-
- RmTmpFile(TmpFileName);
-#endif
-
- }
-
- std::string BatchManager_eLSF::getWallTime(const long edt)
- {
- long h, m;
- h = edt / 60;
- m = edt - h*60;
- ostringstream oss;
- if( m >= 10 )
- oss << h << ":" << m;
- else
- oss << h << ":0" << m;
- return oss.str();
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_eLSF.hxx : emulation of LSF client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail : mailto:bernard.secher@cea.fr
- * Date : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _BATCHMANAGER_eLSF_H_
-#define _BATCHMANAGER_eLSF_H_
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_JobInfo_eLSF.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-#include "Batch_ConnexionFailureException.hxx"
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_NotYetImplementedException.hxx"
-#include "Batch_BatchManager.hxx"
-#include "Batch_BatchManager_eClient.hxx"
-
-namespace Batch {
-
- class Job;
- class JobId;
- class JobInfo;
- class FactBatchManager;
-
- class BATCH_EXPORT BatchManager_eLSF : public BatchManager_eClient
- {
- public:
- // Constructeur et destructeur
- BatchManager_eLSF(const FactBatchManager * parent, const char * host="localhost", const char * protocol="ssh", const char * mpiImpl="nompi") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host
- virtual ~BatchManager_eLSF();
-
- // Recupere le nom du serveur par defaut
- // static string BatchManager_LSF::getDefaultServer();
-
- // Methodes pour le controle des jobs
- virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
- virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
- virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
- virtual void releaseJob(const JobId & jobid); // relache un job suspendu
- virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
- virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
- virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
- virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
- virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
-
- virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
- virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
-
-
- protected:
- void buildBatchScript(const Job & job) throw(EmulationException);
- std::string getWallTime(const long edt);
-
- private:
-
-#ifdef SWIG
- public:
- // Recupere le l'identifiant d'un job deja soumis au BatchManager
- //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
- virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
-#endif
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_ePBS.cxx : emulation of PBS client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail : mailto:bernard.secher@cea.fr
- * Date : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "Batch_BatchManager_ePBS.hxx"
-#ifdef WIN32
-# include <time.h>
-# include <io.h>
-#else
-# include <libgen.h>
-#endif
-
-using namespace std;
-
-namespace Batch {
-
- BatchManager_ePBS::BatchManager_ePBS(const FactBatchManager * parent, const char * host, const char * protocol, const char * mpiImpl) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_eClient(parent,host,protocol,mpiImpl)
- {
- // Nothing to do
- }
-
- // Destructeur
- BatchManager_ePBS::~BatchManager_ePBS()
- {
- // Nothing to do
- }
-
- // Methode pour le controle des jobs : soumet un job au gestionnaire
- const JobId BatchManager_ePBS::submitJob(const Job & job)
- {
- int status;
- Parametre params = job.getParametre();
- const std::string dirForTmpFiles = params[TMPDIR];
- const string fileToExecute = params[EXECUTABLE];
- string::size_type p1 = fileToExecute.find_last_of("/");
- string::size_type p2 = fileToExecute.find_last_of(".");
- std::string fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
-
- // export input files on cluster
- exportInputFiles(job);
-
- // build batch script for job
- buildBatchScript(job);
-
- // define name of log file
- string logFile="/tmp/logs/";
- logFile += getenv("USER");
- logFile += "/batchSalome_";
- srand ( time(NULL) );
- int ir = rand();
- ostringstream oss;
- oss << ir;
- logFile += oss.str();
- logFile += ".log";
-
- string command;
-
- // define command to submit batch
- command = _protocol;
- command += " ";
-
- if(_username != ""){
- command += _username;
- command += "@";
- }
-
- command += _hostname;
- command += " \"cd " ;
- command += dirForTmpFiles ;
- command += "; qsub " ;
- command += fileNameToExecute ;
- command += "_Batch.sh\" > ";
- command += logFile;
- cerr << command.c_str() << endl;
- status = system(command.c_str());
- if(status)
- throw EmulationException("Error of connection on remote host");
-
- // read id of submitted job in log file
- char line[128];
- FILE *fp = fopen(logFile.c_str(),"r");
- fgets( line, 128, fp);
- fclose(fp);
-
- string sline(line);
- int pos = sline.find(".");
- string strjob;
- if(pos == string::npos)
- strjob = sline;
- else
- strjob = sline.substr(0,pos);
-
- JobId id(this, strjob);
- return id;
- }
-
- // Methode pour le controle des jobs : retire un job du gestionnaire
- void BatchManager_ePBS::deleteJob(const JobId & jobid)
- {
- int status;
- int ref;
- istringstream iss(jobid.getReference());
- iss >> ref;
-
- // define command to submit batch
- string command;
- command = _protocol;
- command += " ";
-
- if (_username != ""){
- command += _username;
- command += "@";
- }
-
- command += _hostname;
- command += " \"qdel " ;
- command += iss.str();
- command += "\"";
- cerr << command.c_str() << endl;
- status = system(command.c_str());
- if(status)
- throw EmulationException("Error of connection on remote host");
-
- cerr << "jobId = " << ref << "killed" << endl;
- }
-
- // Methode pour le controle des jobs : suspend un job en file d'attente
- void BatchManager_ePBS::holdJob(const JobId & jobid)
- {
- throw EmulationException("Not yet implemented");
- }
-
- // Methode pour le controle des jobs : relache un job suspendu
- void BatchManager_ePBS::releaseJob(const JobId & jobid)
- {
- throw EmulationException("Not yet implemented");
- }
-
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_ePBS::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
- {
- throw EmulationException("Not yet implemented");
- }
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_ePBS::alterJob(const JobId & jobid, const Parametre & param)
- {
- alterJob(jobid, param, Environnement());
- }
-
- // Methode pour le controle des jobs : modifie un job en file d'attente
- void BatchManager_ePBS::alterJob(const JobId & jobid, const Environnement & env)
- {
- alterJob(jobid, Parametre(), env);
- }
-
- // Methode pour le controle des jobs : renvoie l'etat du job
- JobInfo BatchManager_ePBS::queryJob(const JobId & jobid)
- {
- int id;
- istringstream iss(jobid.getReference());
- iss >> id;
-
- // define name of log file
- string logFile="/tmp/logs/";
- logFile += getenv("USER");
- logFile += "/batchSalome_";
-
- ostringstream oss;
- oss << this << "_" << id;
- logFile += oss.str();
- logFile += ".log";
-
- string command;
- int status;
-
- // define command to submit batch
- command = _protocol;
- command += " ";
-
- if (_username != ""){
- command += _username;
- command += "@";
- }
-
- command += _hostname;
- command += " \"qstat -f " ;
- command += iss.str();
- command += "\" > ";
- command += logFile;
- cerr << command.c_str() << endl;
- status = system(command.c_str());
- if(status && status != 153 && status != 256*153)
- throw EmulationException("Error of connection on remote host");
-
- JobInfo_ePBS ji = JobInfo_ePBS(id,logFile);
- return ji;
- }
-
- // Methode pour le controle des jobs : teste si un job est present en machine
- bool BatchManager_ePBS::isRunning(const JobId & jobid)
- {
- throw EmulationException("Not yet implemented");
- }
-
- void BatchManager_ePBS::buildBatchScript(const Job & job) throw(EmulationException)
- {
-#ifndef WIN32 //TODO: need for porting on Windows
- int status;
- Parametre params = job.getParametre();
- Environnement env = job.getEnvironnement();
- const long nbproc = params[NBPROC];
- const long edt = params[MAXWALLTIME];
- const long mem = params[MAXRAMSIZE];
- const string workDir = params[WORKDIR];
- const std::string dirForTmpFiles = params[TMPDIR];
- const string fileToExecute = params[EXECUTABLE];
- const string home = params[HOMEDIR];
- const std::string queue = params[QUEUE];
- std::string rootNameToExecute;
- std::string fileNameToExecute;
- std::string filelogtemp;
- if( fileToExecute.size() > 0 ){
- string::size_type p1 = fileToExecute.find_last_of("/");
- string::size_type p2 = fileToExecute.find_last_of(".");
- rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
- char* basec=strdup(fileToExecute.c_str());
- fileNameToExecute = "~/" + dirForTmpFiles + "/" + string(basename(basec));
- free(basec);
-
- int idx = dirForTmpFiles.find("Batch/");
- filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length());
- }
- else{
- rootNameToExecute = "command";
- }
-
- std::string TmpFileName = BuildTemporaryFileName();
- ofstream tempOutputFile;
- tempOutputFile.open(TmpFileName.c_str(), ofstream::out );
-
- tempOutputFile << "#! /bin/sh -f" << endl;
- if (queue != "")
- tempOutputFile << "#BSUB -q " << queue << endl;
- if( edt > 0 )
- tempOutputFile << "#PBS -l walltime=" << edt*60 << endl ;
- if( mem > 0 )
- tempOutputFile << "#PBS -l mem=" << mem << "mb" << endl ;
- if( fileToExecute.size() > 0 ){
- tempOutputFile << "#PBS -o " << home << "/" << dirForTmpFiles << "/output.log." << filelogtemp << endl ;
- tempOutputFile << "#PBS -e " << home << "/" << dirForTmpFiles << "/error.log." << filelogtemp << endl ;
- }
- else{
- tempOutputFile << "#PBS -o " << dirForTmpFiles << "/" << env["LOGFILE"] << ".output.log" << endl ;
- tempOutputFile << "#PBS -e " << dirForTmpFiles << "/" << env["LOGFILE"] << ".error.log" << endl ;
- }
- if( workDir.size() > 0 )
- tempOutputFile << "cd " << workDir << endl ;
- if( fileToExecute.size() > 0 ){
- tempOutputFile << _mpiImpl->boot("${PBS_NODEFILE}",nbproc);
- tempOutputFile << _mpiImpl->run("${PBS_NODEFILE}",nbproc,fileNameToExecute);
- tempOutputFile << _mpiImpl->halt();
- }
- else{
- tempOutputFile << "source " << env["SOURCEFILE"] << endl ;
- tempOutputFile << env["COMMAND"];
- }
-
- tempOutputFile.flush();
- tempOutputFile.close();
-#ifdef WIN32
- _chmod(
-#else
- chmod(
-#endif
- TmpFileName.c_str(), 0x1ED);
- cerr << TmpFileName.c_str() << endl;
-
- string command;
- if( _protocol == "rsh" )
- command = "rcp ";
- else if( _protocol == "ssh" )
- command = "scp ";
- else
- throw EmulationException("Unknown protocol");
- command += TmpFileName;
- command += " ";
- if(_username != ""){
- command += _username;
- command += "@";
- }
- command += _hostname;
- command += ":";
- command += dirForTmpFiles ;
- command += "/" ;
- command += rootNameToExecute ;
- command += "_Batch.sh" ;
- cerr << command.c_str() << endl;
- status = system(command.c_str());
- if(status)
- throw EmulationException("Error of connection on remote host");
-
- RmTmpFile(TmpFileName);
-#endif
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_ePBS.hxx : emulation of PBS client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail : mailto:bernard.secher@cea.fr
- * Date : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _BATCHMANAGER_eLSF_H_
-#define _BATCHMANAGER_eLSF_H_
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_JobInfo_ePBS.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-#include "Batch_ConnexionFailureException.hxx"
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_NotYetImplementedException.hxx"
-#include "Batch_BatchManager.hxx"
-#include "Batch_BatchManager_eClient.hxx"
-
-namespace Batch {
-
- class Job;
- class JobId;
- class JobInfo;
- class FactBatchManager;
-
- class BATCH_EXPORT BatchManager_ePBS : public BatchManager_eClient
- {
- public:
- // Constructeur et destructeur
- BatchManager_ePBS(const FactBatchManager * parent, const char * host="localhost", const char * protocol="ssh", const char * mpiImpl="nompi") throw(InvalidArgumentException,ConnexionFailureException); // connexion a la machine host
- virtual ~BatchManager_ePBS();
-
- // Recupere le nom du serveur par defaut
- // static string BatchManager_LSF::getDefaultServer();
-
- // Methodes pour le controle des jobs
- virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
- virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
- virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
- virtual void releaseJob(const JobId & jobid); // relache un job suspendu
- virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
- virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
- virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
- virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
- virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
-
- virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
- virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
-
-
- protected:
- void buildBatchScript(const Job & job) throw(EmulationException);
-
- private:
-
-#ifdef SWIG
- public:
- // Recupere le l'identifiant d'un job deja soumis au BatchManager
- //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
- virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
-#endif
-
- };
-
-}
-
-#endif
+++ /dev/null
-// 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 <iostream>
-#include <fstream>
-#include <sstream>
-#include <sys/stat.h>
-#include "Batch_BatchManager_eSGE.hxx"
-#include <stdlib.h>
-#ifdef WIN32
-# include <time.h>
-# include <io.h>
-#else
-#include <libgen.h>
-#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();
- }
-
-}
+++ /dev/null
-// 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
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BoolType.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include <assert.h>
-#include "Batch_BoolType.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Conversion en chaine
- string BoolType::affiche() const
- {
- return _data ? string("true") : string("false");
- }
-
- // Operateur d'affectation
- BoolType & BoolType::operator =(bool b)
- {
- _data = b;
- return *this;
- }
-
- // Conversion en bool
- BoolType::operator bool() const
- {
- return this->_data;
- }
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- GenericType * BoolType::clone() const
- {
- BoolType * pB = new BoolType(this->_data);
- assert(pB != 0);
- return pB;
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BoolType.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _BOOLTYPE_H_
-#define _BOOLTYPE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include "Batch_GenericType.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT BoolType : public GenericType
- {
- public:
- // Constructeur
- BoolType(const bool b=false) : _data(b) {}
-
- // Conversion en chaine
- virtual std::string affiche() const;
-
- // Operateur d'affectation
- virtual BoolType & operator =(bool);
-
- // Conversion en bool
- virtual operator bool() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- bool _data;
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * CharType.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include <assert.h>
-#include "Batch_CharType.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Conversion en chaine
- string CharType::affiche() const
- {
- return string(1, _data);
- }
-
- // Operateur d'affectation
- CharType & CharType::operator =(char c)
- {
- _data = c;
- return *this;
- }
-
- // Conversion en char
- CharType::operator char() const
- {
- return this->_data;
- }
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- GenericType * CharType::clone() const
- {
- CharType * pC = new CharType(this->_data);
- assert(pC != 0);
- return pC;
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * CharType.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _CHARTYPE_H_
-#define _CHARTYPE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include "Batch_GenericType.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT CharType : public GenericType
- {
- public:
- // Constructeur
- CharType(const char c=0) : _data(c) {}
-
- // Conversion en chaine
- virtual std::string affiche() const;
-
- // Operateur d'affectation
- virtual CharType & operator =(char);
-
- // Conversion en char
- virtual operator char() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- char _data;
-
- private:
-
- };
-
-}
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * ConnexionFailureException.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 13 11:24:31 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_ConnexionFailureException.hxx"
-using namespace std;
-
-namespace Batch {
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * ConnexionFailureException.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 13 11:24:31 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _CONNEXIONFAILUREEXCEPTION_H_
-#define _CONNEXIONFAILUREEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT ConnexionFailureException : public GenericException
- {
- public:
- // Constructeur
- ConnexionFailureException(std::string ch = "undefined") : GenericException("ConnexionFailureException", ch) {}
-
- };
-
-}
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Couple.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Tue Dec 9 15:00:35 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_Couple.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Operateur d'affectation
- Couple & Couple::operator =(const Couple & C)
- {
- _local = C._local;
- _remote = C._remote;
- return *this;
- }
-
- // Conversion en chaine
- string Couple::str() const
- {
- string res;
- res = "Couple(local : ";
- res += _local;
- res += ", remote : ";
- res += _remote;
- res += ")";
- return res;
- }
-
- // Operateur pour l'affichage sur un stream
- ostream & operator << (ostream & os, const Couple & cp)
- {
- return os << cp.str();
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Couple.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Tue Dec 9 15:00:35 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _COUPLE_H_
-#define _COUPLE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-
-namespace Batch {
-
- class BATCH_EXPORT Couple
- {
- public:
- // Constructeur standard
- Couple(const std::string & local="", const std::string & remote="") : _local(local), _remote(remote) {}
-
- // Constructeur par recopie
- Couple(const Couple & C) : _local(C._local), _remote(C._remote) {}
-
- // Operateur pour l'affichage sur un stream
- friend std::ostream & operator << (std::ostream & os, const Couple & cp);
-
- // Operateur d'affectation
- virtual Couple & operator =(const Couple &);
-
- // Conversion en chaine
- virtual std::string str() const;
-
- // Accesseurs
- virtual std::string getLocal() const { return _local; }
- virtual std::string getRemote() const { return _remote; }
-
- protected:
- std::string _local; // chemin d'acces au fichier local
- std::string _remote; // chemin d'acees au fichier distant
-
- private:
-
- };
-
-}
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * CoupleType.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Tue Dec 9 14:51:53 2003
- * Projet : Salome 2
- *
- */
-
-#include <assert.h>
-#include "Batch_CoupleType.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Conversion en chaine
- string CoupleType::affiche() const
- {
- return _data.str();
- }
-
- // Operateur d'affectation
- CoupleType & CoupleType::operator =(const Couple & C)
- {
- _data = C;
- return *this;
- }
-
- // Conversion en char
- CoupleType::operator Couple() const
- {
- return _data;
- }
-
- // Conversion en chaine
- CoupleType::operator string() const
- {
- return _data.str();
- }
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- GenericType * CoupleType::clone() const
- {
- CoupleType * pC = new CoupleType(this->_data);
- assert(pC != 0);
- return pC;
- }
-
-}
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * CoupleType.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Tue Dec 9 14:51:53 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _COUPLETYPE_H_
-#define _COUPLETYPE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include "Batch_GenericType.hxx"
-#include "Batch_Couple.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT CoupleType : public GenericType
- {
- public:
- // Constructeur
- CoupleType(const Couple & C) : _data(C) {}
-
- // Conversion en chaine
- virtual std::string affiche() const;
- virtual operator std::string() const;
-
- // Operateur d'affectation
- virtual CoupleType & operator =(const Couple & C);
-
- // Conversion en char
- virtual operator Couple() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- Couple _data;
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Date.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Wed Nov 26 14:11:42 2003
- * Projet : Salome 2
- *
- */
-
-#include <cstdio>
-#include <ctime>
-#include "Batch_Date.hxx"
-using namespace std;
-
-namespace Batch {
-
- Date::Date(const long l)
- {
- time_t l_t = l;
- struct tm * p_tm = localtime(&l_t);
- _day = p_tm->tm_mday;
- _month = p_tm->tm_mon + 1;
- _year = p_tm->tm_year + 1900;
- _hour = p_tm->tm_hour;
- _min = p_tm->tm_min;
- _sec = p_tm->tm_sec;
- }
-
- Date::Date(const string s)
- {
- if ((s == "now") || (s == "Now") || (s == "NOW")) {
- long l = time(0);
- time_t l_t = l;
- struct tm * p_tm = localtime(&l_t);
- _day = p_tm->tm_mday;
- _month = p_tm->tm_mon + 1;
- _year = p_tm->tm_year + 1900;
- _hour = p_tm->tm_hour;
- _min = p_tm->tm_min;
- _sec = p_tm->tm_sec;
-
- } else {
-// char c;
-// istringstream ist(s);
-// ist >> _day >> c
-// >> _month >> c
-// >> _year >> c
-// >> _hour >> c
-// >> _min >> c
-// >> _sec;
- sscanf(s.c_str(), "%ld/%ld/%ld-%ld:%ld:%ld", &_day, &_month, &_year, &_hour, &_min, &_sec);
- }
- }
-
- Date & Date::operator =(long l)
- {
- time_t l_t = l;
- struct tm * p_tm = localtime(&l_t);
- _day = p_tm->tm_mday;
- _month = p_tm->tm_mon + 1;
- _year = p_tm->tm_year + 1900;
- _hour = p_tm->tm_hour;
- _min = p_tm->tm_min;
- _sec = p_tm->tm_sec;
-
- return *this;
- }
-
- Date & Date::operator +(long l)
- {
- *this = epoch() + l;
- return *this;
- }
-
- Date & Date::operator -(long l)
- {
- *this = epoch() - l;
- return *this;
- }
-
- Date & Date::operator +=(long l)
- {
- *this = epoch() + l;
- return *this;
- }
-
- Date & Date::operator -=(long l)
- {
- *this = epoch() - l;
- return *this;
- }
-
- Date & Date::operator =(const string & s)
- {
- if ((s == "now") || (s == "Now") || (s == "NOW")) {
- long l = time(0);
- time_t l_t = l;
- struct tm * p_tm = localtime(&l_t);
- _day = p_tm->tm_mday;
- _month = p_tm->tm_mon + 1;
- _year = p_tm->tm_year + 1900;
- _hour = p_tm->tm_hour;
- _min = p_tm->tm_min;
- _sec = p_tm->tm_sec;
-
- } else {
-// char c;
-// istringstream ist(s);
-// ist >> _day >> c
-// >> _month >> c
-// >> _year >> c
-// >> _hour >> c
-// >> _min >> c
-// >> _sec;
- sscanf(s.c_str(), "%ld/%ld/%ld-%ld:%ld:%ld", &_day, &_month, &_year, &_hour, &_min, &_sec);
- }
-
- return *this;
- }
-
- string Date::str() const
- {
- char buf[64];
- string datestr;
-
- // _day to char *
- sprintf(buf, "%02ld", _day);
- datestr += buf;
- datestr += "/";
-
- // _month to char *
- sprintf(buf, "%02ld", _month);
- datestr += buf;
- datestr += "/";
-
- // _year to char *
- sprintf(buf, "%04ld", _year);
- datestr += buf;
- datestr += "-";
-
- // _hour to char *
- sprintf(buf, "%02ld", _hour);
- datestr += buf;
- datestr += ":";
-
- // _min to char *
- sprintf(buf, "%02ld", _min);
- datestr += buf;
- datestr += ":";
-
- // _sec to char *
- sprintf(buf, "%02ld", _sec);
- datestr += buf;
-
- return datestr;
- }
-
- long Date::epoch() const
- {
- struct tm T;
- T.tm_mday = _day;
- T.tm_mon = _month - 1;
- T.tm_year = _year - 1900;
- T.tm_hour = _hour;
- T.tm_min = _min;
- T.tm_sec = _sec;
- return mktime(&T);
- }
-
-}
-
-
-// COMMENTS
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Date.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Wed Nov 26 14:11:42 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _DATE_H_
-#define _DATE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-
-namespace Batch {
-
- class BATCH_EXPORT Date
- {
- public:
- Date(const long l=0);
- Date(const std::string s);
- virtual Date & operator =(long l);
- virtual Date & operator +(long l);
- virtual Date & operator -(long l);
- virtual Date & operator +=(long l);
- virtual Date & operator -=(long l);
- virtual Date & operator =(const std::string & s);
- virtual std::string str() const;
- virtual long epoch() const;
-
- protected:
- int _day, _month, _year;
- int _hour, _min, _sec;
-
- private:
-
- };
-
-}
-
-#endif
-
-// COMMENTS
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * DateType.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Wed Nov 26 11:15:34 2003
- * Projet : Salome 2
- *
- */
-extern "C" {
-#include <time.h>
-}
-#include <assert.h>
-#include "Batch_DateType.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Conversion en chaine
- string DateType::affiche() const
- {
- return _data.str();
- }
-
- // Operateur d'affectation
- DateType & DateType::operator =(const Date & d)
- {
- _data = d;
- return *this;
- }
-
- // Conversion en Date
- DateType::operator Date() const
- {
- return _data;
- }
-
- // Conversion en long
- DateType::operator long() const
- {
- return _data.epoch();
- }
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- GenericType * DateType::clone() const
- {
- DateType * pD = new DateType(this->_data);
- assert(pD != 0);
- return pD;
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * DateType.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Wed Nov 26 11:15:34 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _DATETYPE_H_
-#define _DATETYPE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include "Batch_GenericType.hxx"
-#include "Batch_Date.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT DateType : public GenericType
- {
- public:
- // Constructeur
- DateType(const Date & d) : _data(d) {};
-
- // Conversion en chaine
- virtual std::string affiche() const;
-
- // Operateur d'affectation
- virtual DateType & operator =(const Date &);
-
- // Conversion en Date
- virtual operator Date() const;
-
- // Conversion en long
- virtual operator long() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- Date _data;
-
- private:
- };
-
-}
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : Batch_Defines.hxx
-// Author : Alexander A. BORODIN
-// Module : SALOME
-//
-#ifndef _BATCH_Defines_HXX_
-#define _BATCH_Defines_HXX_
-
-#ifdef WIN32
-# if defined BATCH_EXPORTS || defined SalomeBatch_EXPORTS
-# define BATCH_EXPORT __declspec( dllexport )
-# else
-# define BATCH_EXPORT __declspec( dllimport )
-# endif
-# define RM "rm"
-# define RCP "rpc"
-# define RSH "rsh"
-#else
-# define BATCH_EXPORT
-#endif
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Environnement.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Oct 16 11:37:47 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_Environnement.hxx"
-using namespace std;
-
-namespace Batch {
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Environnement.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Oct 16 11:37:47 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _ENVIRONNEMENT_H_
-#define _ENVIRONNEMENT_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include <string>
-#include <map>
-
-namespace Batch {
-
- typedef std::map < std::string, std::string > Environnement;
-
-}
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include <sstream>
-#include <iostream>
-#include "Batch_BatchManagerCatalog.hxx"
-#include "Batch_FactBatchManager.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Constructeur
- FactBatchManager::FactBatchManager(const string & _t) : type(_t)
- {
- BatchManagerCatalog::addFactBatchManager(type.c_str(), this);
- ostringstream msg;
- msg << "FactBatchManager of type '" << type << "' inserted into catalog";
- cerr << msg.str().c_str() << endl;
- }
-
- // Destructeur
- FactBatchManager::~FactBatchManager()
- {
- // Nothing to do
- }
-
- // Accesseur
- string FactBatchManager::getType() const
- {
- return type;
- }
-
- string FactBatchManager::__repr__() const
- {
- ostringstream oss;
- oss << "<FactBatchManager of type '" << type << "'>";
- return oss.str();
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#ifndef _FACTBATCHMANAGER_H_
-#define _FACTBATCHMANAGER_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include <map>
-
-namespace Batch {
-
- class BatchManager;
-
- class BATCH_EXPORT FactBatchManager
- {
- public:
- // Constructeur et destructeur
- FactBatchManager(const std::string & type);
- virtual ~FactBatchManager();
-
- virtual Batch::BatchManager * operator() (const char * hostname) const = 0;
- std::string getType() const;
- std::string __repr__() const;
-
- protected:
- std::string type;
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_LSF.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include "Batch_BatchManager_LSF.hxx"
-#include "Batch_FactBatchManager_LSF.hxx"
-//#include "utilities.h"
-
-namespace Batch {
-
- static FactBatchManager_LSF sFBM_LSF;
-
- // Constructeur
- FactBatchManager_LSF::FactBatchManager_LSF() : FactBatchManager("LSF")
- {
- // Nothing to do
- }
-
- // Destructeur
- FactBatchManager_LSF::~FactBatchManager_LSF()
- {
- // Nothing to do
- }
-
- // Functor
- BatchManager * FactBatchManager_LSF::operator() (const char * hostname) const
- {
- // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'");
- return new BatchManager_LSF(this, hostname);
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_LSF.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#ifndef _FACTBATCHMANAGER_LSF_H_
-#define _FACTBATCHMANAGER_LSF_H_
-
-#include "Batch_FactBatchManager.hxx"
-
-namespace Batch {
-
- class BatchManager_LSF;
-
- class FactBatchManager_LSF : public FactBatchManager
- {
- public:
- // Constructeur et destructeur
- FactBatchManager_LSF();
- virtual ~FactBatchManager_LSF();
-
- virtual BatchManager * operator() (const char * hostname) const;
-
- protected:
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_Local.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include "Batch_BatchManager_Local.hxx"
-#include "Batch_FactBatchManager_Local.hxx"
-//#include "utilities.h"
-
-namespace Batch {
-
-// static FactBatchManager_Local sFBM_Local;
-
- // Constructeur
- FactBatchManager_Local::FactBatchManager_Local() : FactBatchManager("Local")
- {
- // Nothing to do
- }
-
- // Destructeur
- FactBatchManager_Local::~FactBatchManager_Local()
- {
- // Nothing to do
- }
-
- // Functor
-// BatchManager * FactBatchManager_Local::operator() (const char * hostname) const
-// {
-// // MESSAGE("Building new BatchManager_Local on host '" << hostname << "'");
-// return new BatchManager_Local(this, hostname);
-// }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_Local.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#ifndef _FACTBATCHMANAGER_LOCAL_H_
-#define _FACTBATCHMANAGER_LOCAL_H_
-
-#include "Batch_FactBatchManager.hxx"
-
-namespace Batch {
-
- class BatchManager_Local;
-
- class FactBatchManager_Local : public FactBatchManager
- {
- public:
- // Constructeur et destructeur
- FactBatchManager_Local();
- virtual ~FactBatchManager_Local();
-
- virtual BatchManager * operator() (const char * hostname) const = 0;
-
- protected:
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_Local_RSH.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include "Batch_BatchManager_Local_RSH.hxx"
-#include "Batch_FactBatchManager_Local_RSH.hxx"
-//#include "utilities.h"
-
-namespace Batch {
-
- // Constructeur
- FactBatchManager_Local_RSH::FactBatchManager_Local_RSH() : FactBatchManager("RSH")
- {
- // Nothing to do
- }
-
- // Destructeur
- FactBatchManager_Local_RSH::~FactBatchManager_Local_RSH()
- {
- // Nothing to do
- }
-
- // Functor
- BatchManager * FactBatchManager_Local_RSH::operator() (const char * hostname) const
- {
- // MESSAGE("Building new BatchManager_Local_RSH on host '" << hostname << "'");
- return new BatchManager_Local_RSH(this, hostname);
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_Local_RSH.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#ifndef _FACTBATCHMANAGER_LOCAL_RSH_H_
-#define _FACTBATCHMANAGER_LOCAL_RSH_H_
-
-#include "Batch_FactBatchManager.hxx"
-
-namespace Batch {
-
- class BatchManager_Local_RSH;
-
- class FactBatchManager_Local_RSH : public FactBatchManager
- {
- public:
- // Constructeur et destructeur
- FactBatchManager_Local_RSH();
- virtual ~FactBatchManager_Local_RSH();
-
- virtual BatchManager * operator() (const char * hostname) const;
-
- protected:
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_Local_SH.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include "Batch_BatchManager_Local_SH.hxx"
-#include "Batch_FactBatchManager_Local_SH.hxx"
-//#include "utilities.h"
-
-namespace Batch {
-
- static FactBatchManager_Local_SH sFBM_Local_SH;
-
- // Constructeur
- FactBatchManager_Local_SH::FactBatchManager_Local_SH() : FactBatchManager("SH")
- {
- // Nothing to do
- }
-
- // Destructeur
- FactBatchManager_Local_SH::~FactBatchManager_Local_SH()
- {
- // Nothing to do
- }
-
- // Functor
- BatchManager * FactBatchManager_Local_SH::operator() (const char * hostname) const
- {
- // MESSAGE("Building new BatchManager_Local_SH on host '" << hostname << "'");
- return new BatchManager_Local_SH(this, hostname);
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_Local_SH.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#ifndef _FACTBATCHMANAGER_LOCAL_SH_H_
-#define _FACTBATCHMANAGER_LOCAL_SH_H_
-
-#include "Batch_FactBatchManager.hxx"
-
-namespace Batch {
-
- class BatchManager_Local_SH;
-
- class FactBatchManager_Local_SH : public FactBatchManager
- {
- public:
- // Constructeur et destructeur
- FactBatchManager_Local_SH();
- virtual ~FactBatchManager_Local_SH();
-
- virtual BatchManager * operator() (const char * hostname) const;
-
- protected:
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_Local_SSH.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include "Batch_BatchManager_Local_SSH.hxx"
-#include "Batch_FactBatchManager_Local_SSH.hxx"
-//#include "utilities.h"
-
-namespace Batch {
-
- static FactBatchManager_Local_SSH sFBM_Local_SSH;
-
- // Constructeur
- FactBatchManager_Local_SSH::FactBatchManager_Local_SSH() : FactBatchManager("SSH")
- {
- // Nothing to do
- }
-
- // Destructeur
- FactBatchManager_Local_SSH::~FactBatchManager_Local_SSH()
- {
- // Nothing to do
- }
-
- // Functor
- BatchManager * FactBatchManager_Local_SSH::operator() (const char * hostname) const
- {
- // MESSAGE("Building new BatchManager_Local_SSH on host '" << hostname << "'");
- return new BatchManager_Local_SSH(this, hostname);
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_Local_SSH.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#ifndef _FACTBATCHMANAGER_LOCAL_SSH_H_
-#define _FACTBATCHMANAGER_LOCAL_SSH_H_
-
-#include "Batch_FactBatchManager.hxx"
-
-namespace Batch {
-
- class BatchManager_Local_SSH;
-
- class FactBatchManager_Local_SSH : public FactBatchManager
- {
- public:
- // Constructeur et destructeur
- FactBatchManager_Local_SSH();
- virtual ~FactBatchManager_Local_SSH();
-
- virtual BatchManager * operator() (const char * hostname) const;
-
- protected:
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_PBS.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#include "Batch_BatchManager_PBS.hxx"
-#include "Batch_FactBatchManager_PBS.hxx"
-using namespace std;
-
-namespace Batch {
-
- static FactBatchManager_PBS sFBM_PBS;
-
- // Constructeur
- FactBatchManager_PBS::FactBatchManager_PBS() : FactBatchManager("PBS")
- {
- // Nothing to do
- }
-
- // Destructeur
- FactBatchManager_PBS::~FactBatchManager_PBS()
- {
- // Nothing to do
- }
-
- // Functor
- BatchManager * FactBatchManager_PBS::operator() (const char * hostname) const
- {
- return new BatchManager_PBS(this, hostname);
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_PBS.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#ifndef _FACTBATCHMANAGER_PBS_H_
-#define _FACTBATCHMANAGER_PBS_H_
-
-#include "Batch_FactBatchManager.hxx"
-
-namespace Batch {
-
- class BatchManager_PBS;
-
- class FactBatchManager_PBS : public FactBatchManager
- {
- public:
- // Constructeur et destructeur
- FactBatchManager_PBS();
- virtual ~FactBatchManager_PBS();
-
- virtual BatchManager * operator() (const char * hostname) const;
-
- protected:
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_eClient.cxx : emulation of client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail : mailto:bernard.secher@cea.fr
- * Date : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#include <string>
-#include <sstream>
-#include "Batch_FactBatchManager_eClient.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Constructeur
- FactBatchManager_eClient::FactBatchManager_eClient(const string & _t) : FactBatchManager(_t)
- {
- }
-
- // Destructeur
- FactBatchManager_eClient::~FactBatchManager_eClient()
- {
- // Nothing to do
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_eClient.hxx : emulation of client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail : mailto:bernard.secher@cea.fr
- * Date : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _FACTBATCHMANAGER_eClient_H_
-#define _FACTBATCHMANAGER_eClient_H_
-
-#include <string>
-#include <map>
-#include "Batch_FactBatchManager.hxx"
-
-namespace Batch {
-
- class BatchManager_eClient;
-
- class FactBatchManager_eClient : public FactBatchManager
- {
- public:
- // Constructeur et destructeur
- FactBatchManager_eClient(const std::string & type);
- virtual ~FactBatchManager_eClient();
-
- virtual Batch::BatchManager_eClient * operator() (const char * hostname,const char * protocol, const char * mpi) const = 0;
-
- protected:
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_eLSF.cxx :
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Date : Avril 2008
- * Projet : PAL Salome
- *
- */
-
-#include <string>
-#include "Batch_BatchManager_eLSF.hxx"
-#include "Batch_FactBatchManager_eLSF.hxx"
-//#include "utilities.h"
-
-namespace Batch {
-
- // Constructeur
- FactBatchManager_eLSF::FactBatchManager_eLSF() : FactBatchManager_eClient("eLSF")
- {
- // Nothing to do
- }
-
- // Destructeur
- FactBatchManager_eLSF::~FactBatchManager_eLSF()
- {
- // Nothing to do
- }
-
- // Functor
- BatchManager * FactBatchManager_eLSF::operator() (const char * hostname) const
- {
- // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'");
- return new BatchManager_eLSF(this, hostname);
- }
-
- BatchManager_eClient * FactBatchManager_eLSF::operator() (const char * hostname, const char * protocol, const char * mpiImpl) const
- {
- // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'");
- return new BatchManager_eLSF(this, hostname, protocol, mpiImpl);
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_eLSF.hxx :
- *
- * Auteur : Bernard SECHER : CEA DEN
- * Date : Avril 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _FACTBATCHMANAGER_eLSF_H_
-#define _FACTBATCHMANAGER_eLSF_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include <map>
-#include "Batch_BatchManager_eClient.hxx"
-#include "Batch_FactBatchManager_eClient.hxx"
-
-namespace Batch {
-
- class BatchManager_eLSF;
-
- class BATCH_EXPORT FactBatchManager_eLSF : public FactBatchManager_eClient
- {
- public:
- // Constructeur et destructeur
- FactBatchManager_eLSF();
- virtual ~FactBatchManager_eLSF();
-
- virtual BatchManager * operator() (const char * hostname) const;
- virtual BatchManager_eClient * operator() (const char * hostname, const char * protocol, const char * mpiImpl) const;
-
- protected:
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_ePBS.cxx :
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Date : Avril 2008
- * Projet : PAL Salome
- *
- */
-
-#include <string>
-#include "Batch_BatchManager_ePBS.hxx"
-#include "Batch_FactBatchManager_ePBS.hxx"
-//#include "utilities.h"
-
-namespace Batch {
-
- // Constructeur
- FactBatchManager_ePBS::FactBatchManager_ePBS() : FactBatchManager_eClient("ePBS")
- {
- // Nothing to do
- }
-
- // Destructeur
- FactBatchManager_ePBS::~FactBatchManager_ePBS()
- {
- // Nothing to do
- }
-
- // Functor
- BatchManager * FactBatchManager_ePBS::operator() (const char * hostname) const
- {
- // MESSAGE("Building new BatchManager_PBS on host '" << hostname << "'");
- return new BatchManager_ePBS(this, hostname);
- }
-
- BatchManager_eClient * FactBatchManager_ePBS::operator() (const char * hostname, const char * protocol, const char * mpiImpl) const
- {
- // MESSAGE("Building new BatchManager_PBS on host '" << hostname << "'");
- return new BatchManager_ePBS(this, hostname, protocol, mpiImpl);
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_ePBS.hxx :
- *
- * Auteur : Bernard SECHER : CEA DEN
- * Date : Avril 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _FACTBATCHMANAGER_ePBS_H_
-#define _FACTBATCHMANAGER_ePBS_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include <map>
-#include "Batch_BatchManager_eClient.hxx"
-#include "Batch_FactBatchManager_eClient.hxx"
-
-namespace Batch {
-
- class BatchManager_ePBS;
-
- class BATCH_EXPORT FactBatchManager_ePBS : public FactBatchManager_eClient
- {
- public:
- // Constructeur et destructeur
- FactBatchManager_ePBS();
- virtual ~FactBatchManager_ePBS();
-
- virtual BatchManager * operator() (const char * hostname) const;
- virtual BatchManager_eClient * operator() (const char * hostname, const char * protocol, const char * mpiImpl) const;
-
- protected:
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// 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 <string>
-#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);
- }
-
-
-}
+++ /dev/null
-// 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
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * GenericException.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Wed Nov 26 10:15:57 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_GenericException.hxx"
-using namespace std;
-
-namespace Batch {
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * GenericException.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Wed Nov 26 10:15:56 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _GENERICEXCEPTION_H_
-#define _GENERICEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include <string>
-
-namespace Batch {
-
- class BATCH_EXPORT GenericException
- {
- public:
- const std::string type; // la nature de l'exception
- const std::string message; // la raison de l'exception
-
- // Constructeur
- GenericException(const std::string tp = "GenericException", const std::string ch = "undefined") : type(tp), message(ch) {}
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * GenericType.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-
-#include <iostream>
-#include <string>
-#include <assert.h>
-#include "Batch_GenericType.hxx"
-using namespace std;
-
-namespace Batch {
-
- // nombre total d'objet GenericType et al.
- int GenericType::_nb = 0;
-
- // Operateur pour l'affichage sur un stream
- ostream & operator << (ostream & os, const GenericType & obj)
- {
- return os << obj.affiche();
- }
-
- // Conversion en chaine
- string GenericType::affiche() const
- {
- return string("(GenericType : si ce message apparait, vous devez avoir un probleme)");
- }
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- GenericType * GenericType::clone() const
- {
- GenericType * pG = new GenericType;
- assert(pG != 0);
- return pG;
- }
-
-}
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * GenericType.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _GENERICTYPE_H_
-#define _GENERICTYPE_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include <iostream>
-#include <string>
-
-namespace Batch {
-
- class BATCH_EXPORT GenericType
- {
- public:
- // Constructeur et destructeur
- GenericType() { _nb++; }
- virtual ~GenericType() { _nb--; }
-
- // Operateur pour l'affichage sur un stream
- friend std::ostream & operator << (std::ostream & os, const GenericType & obj);
-
- // Conversion en chaine
- virtual std::string affiche() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- // Retourne le nombre d'objets GenericType et al.
- static int getNb() { return _nb; }
-
- protected:
-
- private:
- static int _nb; // nombre total d'objets GenericType et al.
-
- };
-
-}
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * IOMutex.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 14 11:00:39 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_IOMutex.hxx"
-
-namespace Batch {
-
- pthread_mutex_t IOMutex = PTHREAD_MUTEX_INITIALIZER;
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * IOMutex.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 14 11:00:39 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _IOMUTEX_H_
-#define _IOMUTEX_H_
-
-#include <pthread.h>
-
-#define LOCK_IO { pthread_mutex_lock(&Batch::IOMutex) ; }
-#define UNLOCK_IO { pthread_mutex_unlock(&Batch::IOMutex) ; }
-#define UNDER_LOCK(statement) { LOCK_IO ; { statement ; } ; UNLOCK_IO ; }
-
-namespace Batch {
-
- extern pthread_mutex_t IOMutex;
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * IntType.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include <sstream>
-#include <assert.h>
-//#include "MEDMEM_STRING.hxx"
-#include "Batch_IntType.hxx"
-using namespace std;
-
-
-namespace Batch {
-
- // Conversion en chaine
- string IntType::affiche() const
- {
- //MEDMEM::STRING sst;
- ostringstream sst;
- sst << _data;
- return sst.str();
- }
-
- // Operateur d'affectation
- IntType & IntType::operator =(int i)
- {
- _data = i;
- return *this;
- }
-
- // Conversion en int
- IntType::operator int() const
- {
- return this->_data;
- }
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- GenericType * IntType::clone() const
- {
- IntType * pI = new IntType(this->_data);
- assert(pI != 0);
- return pI;
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * IntType.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _INTTYPE_H_
-#define _INTTYPE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include "Batch_GenericType.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT IntType : public GenericType
- {
- public:
- // Constructeur
- IntType(const int i=0) : _data(i) {}
-
- // Conversion en chaine
- virtual std::string affiche() const;
-
- // Operateur d'affectation
- virtual IntType & operator =(int);
-
- // Conversion en int
- virtual operator int() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- int _data;
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * InvalidArgumentException.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Oct 16 16:18:00 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_InvalidArgumentException.hxx"
-using namespace std;
-
-namespace Batch {
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * InvalidArgumentException.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Oct 16 16:18:00 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _INVALIDARGUMENTEXCEPTION_H_
-#define _INVALIDARGUMENTEXCEPTION_H_
-
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_GenericException.hxx"
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT InvalidArgumentException : public GenericException
- {
- public:
- // Constructeur
- InvalidArgumentException(std::string ch = "undefined") : GenericException("InvalidArgumentException", ch) {}
- };
-
-}
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * InvalidKeyException.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Wed Oct 15 10:39:51 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_InvalidKeyException.hxx"
-using namespace std;
-
-namespace Batch {
-
-}
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * InvalidKeyException.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Wed Oct 15 10:39:51 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _INVALIDKEYEXCEPTION_H_
-#define _INVALIDKEYEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include "Batch_GenericException.hxx"
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT InvalidKeyException : public GenericException
- {
- public:
- // Constructeur
- InvalidKeyException(std::string ch = "undefined") : GenericException("InvalidKeyException", ch) {}
-
- protected:
-
- private:
-
- };
-
-}
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Job.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include "Batch_Job.hxx"
-#include "Batch_Parametre.hxx"
-#include <sstream>
-//#include "MEDMEM_STRING.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Constructeur
- Job::Job() : _param(), _env()
- {
- // Nothing to do
- }
-
-
- // Constructeur
- Job::Job(Parametre param) : _param(param), _env()
- {
- // Nothing to do
- }
-
-
- // Constructeur
- Job::Job(Environnement env) : _param(), _env(env)
- {
- // Nothing to do
- }
-
-
- // Constructeur
- Job::Job(Parametre param, Environnement env) : _param(param), _env(env)
- {
- // Nothing to do
- }
-
- // Operateur pour l'affichage sur un stream
- ostream & operator <<(ostream & os, const Job & job)
- {
- return os << job.__str__();
- }
-
- // Accesseur
- Batch::Parametre Job::getParametre() const
- {
- return _param;
- }
-
- // Accesseur
- void Job::setParametre(const Batch::Parametre & param)
- {
- _param = param;
- }
-
- // Accesseur
- Environnement Job::getEnvironnement() const
- {
- return _env;
- }
-
- // Accesseur
- void Job::setEnvironnement(const Environnement & env)
- {
- _env = env;
- }
-
-
- // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
- string Job::__str__() const {
- //MEDMEM::STRING str;
- ostringstream str;
- str << "<Job (" << this << ") :" << endl;
- str << " Parametre :" << endl;
- Parametre::const_iterator itp;
- for(itp=_param.begin(); itp!=_param.end(); itp++) {
- str << " * " << (*itp).first << " : " << (*itp).second << endl;
- }
- str << " Environnement :" << endl;
- Environnement::const_iterator ite;
- for(ite=_env.begin(); ite!=_env.end(); ite++) {
- str << " * " << (*ite).first << " : " << (*ite).second << endl;
- }
- str << " >";
- return str.str();
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Job.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _JOB_H_
-#define _JOB_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT Job
- {
- public:
- // Constructeurs et destructeur
- Job();
- Job(Batch::Parametre param);
- Job(Batch::Environnement env);
- Job(Batch::Parametre param, Batch::Environnement env);
- virtual ~Job() {}
-
- // Operateur pour l'affichage sur un stream
- friend std::ostream & operator <<(std::ostream & os, const Job & job);
-
- // Accesseurs
- Batch::Parametre getParametre() const;
- void setParametre(const Batch::Parametre &);
-
- // Accesseurs
- Batch::Environnement getEnvironnement() const;
- void setEnvironnement(const Batch::Environnement &);
-
- // Methodes pour l'interfacage avec Python (SWIG)
- // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- std::string __str__() const; // SWIG : affichage en Python
- std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
- protected:
- Batch::Parametre _param; // table des parametres batch du job
- Batch::Environnement _env; // table des variables d'environnement
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobId.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include "Batch_JobId.hxx"
-#include "Batch_BatchManager.hxx"
-#include <sstream>
-#include <assert.h>
-//#include "MEDMEM_STRING.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Constructeur standard
- JobId::JobId() : _p_batchmanager(), _reference("undefined")
- {
- // Nothing to do
- }
-
- // Constructeur avec le pointeur sur le BatchManager associe et avec une reference
- JobId::JobId(BatchManager * _p_bm, string ref) : _p_batchmanager(_p_bm), _reference(ref)
- {
- // Nothing to do
- }
-
- // Destructeur
- JobId::~JobId()
- {
- // Nothing to do
- }
-
- // Operateur d'affectation entre objets
- JobId & JobId::operator =(const JobId & jobid)
- {
- _p_batchmanager = jobid._p_batchmanager;
- _reference = jobid._reference;
-
- return *this;
- }
-
- // Constructeur par recopie
- JobId::JobId(const JobId & jobid) : _p_batchmanager(jobid._p_batchmanager), _reference(jobid._reference)
- {
- // Nothing to do
- }
-
- // Accesseur pour la reference interne
- string JobId::getReference() const
- {
- return _reference;
- }
-
- // Methode pour le controle du job : retire le job du gestionnaire
- void JobId::deleteJob() const
- {
- assert(_p_batchmanager != 0);
- _p_batchmanager->deleteJob(*this);
- }
-
- // Methode pour le controle du job : suspend le job en file d'attente
- void JobId::holdJob() const
- {
- assert(_p_batchmanager != 0);
- _p_batchmanager->holdJob(*this);
- }
-
- // Methode pour le controle du job : relache le job suspendu
- void JobId::releaseJob() const
- {
- assert(_p_batchmanager != 0);
- _p_batchmanager->releaseJob(*this);
- }
-
- // Methode pour le controle du job : modifie le job en file d'attente
- void JobId::alterJob(const Parametre & param, const Environnement & env) const
- {
- assert(_p_batchmanager != 0);
- _p_batchmanager->alterJob(*this, param, env);
- }
-
- // Methode pour le controle du job : modifie le job en file d'attente
- void JobId::alterJob(const Parametre & param) const
- {
- assert(_p_batchmanager != 0);
- _p_batchmanager->alterJob(*this, param);
- }
-
- // Methode pour le controle du job : modifie le job en file d'attente
- void JobId::alterJob(const Environnement & env) const
- {
- assert(_p_batchmanager != 0);
- _p_batchmanager->alterJob(*this, env);
- }
-
- // Methode pour le controle du job : renvoie l'etat du job
- JobInfo JobId::queryJob() const
- {
- assert(_p_batchmanager != 0);
- return _p_batchmanager->queryJob(*this);
- }
-
-
- // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
- string JobId::__str__() const {
- //MEDMEM::STRING str;
- ostringstream str;
- str << "<JobId (" << this << ") : referenced '" << _reference << "'>";
- return str.str();
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobId.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _JOBID_H_
-#define _JOBID_H_
-
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_JobInfo.hxx"
-#include "Batch_BatchManager.hxx"
-
-namespace Batch {
-
- class BatchManager;
-
- class BATCH_EXPORT JobId
- {
- friend class BatchManager;
-
- public:
- // Constructeur standard et destructeur
- JobId();
- virtual ~JobId();
-
- // Constructeur avec le pointeur sur le BatchManager associe et avec une reference
- JobId(Batch::BatchManager *, std::string ref);
-
- // Operateur d'affectation entre objets
- virtual JobId & operator =(const Batch::JobId &);
-
- // Constructeur par recopie
- JobId(const Batch::JobId &);
-
- // Accesseur pour la reference interne
- virtual std::string getReference() const;
-
- // Methodes pour le controle du job
- virtual void deleteJob() const; // retire un job du gestionnaire
- virtual void holdJob() const; // suspend un job en file d'attente
- virtual void releaseJob() const; // relache un job suspendu
- virtual void alterJob(const Batch::Parametre & param, const Batch::Environnement & env) const; // modifie un job en file d'attente
- virtual void alterJob(const Batch::Parametre & param) const; // modifie un job en file d'attente
- virtual void alterJob(const Batch::Environnement & env) const; // modifie un job en file d'attente
- virtual void setParametre(const Batch::Parametre & param) { return alterJob(param); } // modifie un job en file d'attente
- virtual void setEnvironnement(const Batch::Environnement & env) { return alterJob(env); } // modifie un job en file d'attente
- virtual Batch::JobInfo queryJob() const; // renvoie l'etat du job
-
- // Methodes pour l'interfacage avec Python (SWIG)
- // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- std::string __str__() const; // SWIG : affichage en Python
- std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
- protected:
- Batch::BatchManager * _p_batchmanager; // pointeur sur le BatchManager qui controle le job
- std::string _reference; // reference du job au sein du BatchManager
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:05:30 2003
- * Projet : Salome 2
- *
- */
-
-#include <iostream>
-#include <string>
-#include <sstream>
-//#include "MEDMEM_STRING.hxx"
-#include "Batch_JobInfo.hxx"
-
-using namespace std;
-
-namespace Batch {
-
- // Destructeur
- JobInfo::~JobInfo()
- {
- // Nothing to do
- }
-
-
- // Operateur pour l'affichage sur un stream
- ostream & operator <<(ostream & os, const JobInfo & ji)
- {
- return os << ji.__str__();
- }
-
-
- // Methodes pour l'interfacage avec Python (SWIG) : affichage en Python
- string JobInfo::__str__() const
- {
- //MEDMEM::STRING sst;
- ostringstream sst;
- sst << "<JobInfo (" << this << ") :" << endl;
- sst << " ID = " <<_param[ID] << endl;
-
- sst << " + Parametre :" << endl;
- Parametre::const_iterator itp;
- for(itp=_param.begin(); itp!=_param.end(); itp++) {
- if ( (*itp).first != ID ) {
- sst << " * " << (*itp).first << " = " << (*itp).second << endl;
- }
- }
-
- sst << " + Environnement :" << endl;
- Environnement::const_iterator ite;
- for(ite=_env.begin(); ite!=_env.end(); ite++) {
- sst << " * " << (*ite).first << " = " << (*ite).second << endl;
- }
-
- sst << " >";
-
- return sst.str();
- }
-
- // Accesseur
- Parametre JobInfo::getParametre() const
- {
- return _param;
- }
-
- // Accesseur
- Environnement JobInfo::getEnvironnement() const
- {
- return _env;
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:05:30 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _JOBINFO_H_
-#define _JOBINFO_H_
-
-#include "Batch_Defines.hxx"
-
-#include <iostream>
-#include <string>
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT JobInfo
- {
- public:
- // Constructeur standard et destructeur
- JobInfo() : _param(), _env() {};
- virtual ~JobInfo();
-
- // Constructeur par recopie
- JobInfo(const JobInfo & jinfo) : _param(jinfo._param), _env(jinfo._env) {};
-
- // Operateur pour l'affichage sur un stream
- friend std::ostream & operator <<(std::ostream & os, const JobInfo & ji);
-
- // Accesseurs
- // _CS_gbo Ajout explicite du namespace pour les besoins de swig (mauvaise gestion
- // des namespace par swig.
- virtual Batch::Parametre getParametre() const;
- virtual Batch::Environnement getEnvironnement() const;
-
- // Methodes pour l'interfacage avec Python (SWIG)
- // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- std::string __str__() const; // SWIG : affichage en Python
- std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
- protected:
- Parametre _param; // parametres du job
- Environnement _env; // variables d'environnement du job
- JobInfo(const Parametre & param, const Environnement & env) : _param(param), _env(env) {};
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_LSF.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 21 09:42:06 2003
- * Projet : Salome 2
- *
- */
-
-#include <cstdio>
-#include <sstream>
-#include <string>
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-#include "Batch_RunTimeException.hxx"
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_JobInfo_LSF.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-
-
- // Constructeurs
- JobInfo_LSF::JobInfo_LSF(int id) : JobInfo()
- {
- struct loadIndexLog * p_ld = new struct loadIndexLog;
- struct jobInfoHead * p_jInfoHead = lsb_openjobinfo_a(id, NULL, NULL, NULL, NULL, ALL_JOB);
-
- int more = p_jInfoHead->numJobs;
- if (more != 1) {
- char * msg = lsb_sysmsg();
- if (!msg) msg = "unknown";
- throw APIInternalFailureException(string("LSF lsb_openjobinfo error. Reason : ") + msg);
- }
-
- // on remplit une structure contenant <more> elements
- struct jobInfoEnt & jobInfo = * lsb_readjobinfo(&more);
-
-
- // On remplit les membres _param et _env
- _param[ACCOUNT] = jobInfo.submit.projectName;
- _param[CHECKPOINT] = jobInfo.submit.chkpntPeriod != 0;
- _param[CKPTINTERVAL] = jobInfo.submit.chkpntPeriod;
- _param[CREATIONTIME] = jobInfo.submitTime;
- // _param[EGROUP] = jobInfo.;
- _param[ELIGIBLETIME] = jobInfo.reserveTime;
- _param[ENDTIME] = jobInfo.endTime;
- _param[EUSER] = jobInfo.execUsername;
- _param[EXECUTABLE] = jobInfo.submit.command;
- _param[EXITCODE] = jobInfo.exitStatus;
- _param[HOLD] = jobInfo.status & (JOB_STAT_PSUSP | JOB_STAT_SSUSP | JOB_STAT_USUSP);
- _param[MAIL] = jobInfo.submit.mailUser;
- _param[MAXCPUTIME] = jobInfo.submit.rLimits[LSF_RLIMIT_CPU];
- _param[MAXDISKSIZE] = jobInfo.submit.rLimits[LSF_RLIMIT_FSIZE];
- _param[MAXRAMSIZE] = jobInfo.submit.rLimits[LSF_RLIMIT_SWAP];
- _param[MAXWALLTIME] = jobInfo.submit.rLimits[LSF_RLIMIT_RUN];
- _param[MODIFICATIONTIME] = jobInfo.lastEvent;
- _param[NAME] = jobInfo.jName;
- _param[NBPROC] = jobInfo.submit.numProcessors;
- _param[PID] = jobInfo.jobPid;
- _param[QUEUE] = jobInfo.submit.queue;
- _param[QUEUEDTIME] = jobInfo.submitTime;
- // _param[SERVER] = jobInfo.;
- _param[STARTTIME] = jobInfo.startTime;
- _param[TEXT] = jobInfo.numReasons ? lsb_pendreason(jobInfo.numReasons,
- jobInfo.reasonTb,
- p_jInfoHead,
- p_ld,0) : "";
- // _param[TMPDIR] = jobInfo.;
- _param[USEDCPUTIME] = static_cast<long>(jobInfo.cpuTime);
- // _param[USEDDISKSIZE] = jobInfo.;
- _param[USEDRAMSIZE] = jobInfo.runRusage.mem;
- _param[USEDWALLTIME] = jobInfo.duration * 60L;
- _param[USER] = jobInfo.user;
-
-
- ostringstream oss;
- int jobid = jobInfo.jobId;
- oss << jobid;
- _param[ID] = oss.str();
-
-
- string hosts, sep;
- for(int i=0; i < jobInfo.numExHosts; i++, sep="+") {
- hosts += jobInfo.exHosts[i];
- hosts += sep;
- }
- _param[EXECUTIONHOST] = hosts;
-
- ostringstream status;
-
- if (IS_PEND(jobInfo.status))
- status << " Job is pending;";
- if (IS_START(jobInfo.status))
- status << " Job is started;";
- if (IS_FINISH(jobInfo.status))
- status << " Job is finished;";
- if (IS_SUSP(jobInfo.status))
- status << " Job is suspended;";
- if (IS_POST_DONE(jobInfo.status))
- status << " Job is post-done;";
- if (IS_POST_ERR(jobInfo.status))
- status << " Job is post-error;";
-
- _param[STATE] = status.str();
- _running = IS_FINISH(jobInfo.status) ? false : true;
-
-
- if (strlen(jobInfo.submit.inFile))
- _param[INFILE] += Couple(jobInfo.submit.inFile, "stdin");
- if (strlen(jobInfo.submit.outFile))
- _param[OUTFILE] += Couple(jobInfo.submit.outFile, "stdout");
- if (strlen(jobInfo.submit.errFile))
- _param[OUTFILE] += Couple(jobInfo.submit.errFile, "stderr");
-
- for(int i=0; i < jobInfo.submit.nxf; i++) {
- switch (jobInfo.submit.xf[i].options) {
- case XF_OP_SUB2EXEC:
- _param[INFILE] += Couple(jobInfo.submit.xf[i].subFn, jobInfo.submit.xf[i].execFn);
- break;
-
- case XF_OP_EXEC2SUB:
- _param[OUTFILE] += Couple(jobInfo.submit.xf[i].subFn, jobInfo.submit.xf[i].execFn);
- break;
-
- default:
- break;
- }
- }
-
-
- lsb_closejobinfo();
- delete p_ld;
- }
-
-
-
- // Teste si un job est present en machine
- bool JobInfo_LSF::isRunning() const
- {
- return _running;
- }
-
-
- // Destructeur
- JobInfo_LSF::~JobInfo_LSF()
- {
- // Nothing to do
- }
-
-
-
- // Convertit une date HH:MM:SS en secondes
- long JobInfo_LSF::HMStoLong(const string & s)
- {
- long hour, min, sec;
-
- sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
- return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
- }
-
- // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
- string JobInfo_LSF::__str__() const
- {
- ostringstream sst;
- sst << "<JobInfo_LSF (" << this << ") :" << endl;
- sst << " ID = " <<_param[ID] << endl;
-
- sst << " + Parametre :" << endl;
- Parametre::const_iterator itp;
- for(itp=_param.begin(); itp!=_param.end(); itp++) {
- if ( (*itp).first != ID ) {
- sst << " * " << (*itp).first << " = " << (*itp).second << endl;
- }
- }
- return sst.str();
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_LSF.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 21 09:42:05 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _JOBINFO_LSF_H_
-#define _JOBINFO_LSF_H_
-
-extern "C" {
-
-#include <lsf/lsf.h>
-#include <lsf/lsbatch.h>
-}
-#include <string>
-#include "Batch_RunTimeException.hxx"
-#include "Batch_JobInfo.hxx"
-
-namespace Batch {
-
- class JobInfo_LSF : public JobInfo
- {
- public:
- // Constructeurs et destructeur
- JobInfo_LSF() : _running(false) {};
- JobInfo_LSF(int id);
- virtual ~JobInfo_LSF();
-
- // Constructeur par recopie
- JobInfo_LSF(const JobInfo_LSF & jinfo) : JobInfo(jinfo) {};
-
- // Teste si un job est present en machine
- virtual bool isRunning() const;
-
- // Methodes pour l'interfacage avec Python (SWIG)
- // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- std::string __str__() const; // SWIG : affichage en Python
- std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
- protected:
- bool _running; // etat du job en machine
-
- private:
- // Convertit une date HH:MM:SS en secondes
- long HMStoLong(const std::string &);
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_Local.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 21 09:42:06 2003
- * Projet : Salome 2
- *
- */
-
-#include <cstdio>
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-#include "Batch_JobInfo_Local.hxx"
-
-namespace Batch {
-
- // Constructeurs
- JobInfo_Local::JobInfo_Local(const Parametre & param, const Environnement & env) :
- JobInfo(param, env)
- {
- // Nothing to do
- }
-
-
- // Destructeur
- JobInfo_Local::~JobInfo_Local()
- {
- // Nothing to do
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_Local.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 21 09:42:05 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _JOBINFO_LOCAL_H_
-#define _JOBINFO_LOCAL_H_
-
-#include <string>
-#include "Batch_JobInfo.hxx"
-
-namespace Batch {
-
- class JobInfo_Local : public JobInfo
- {
- public:
- // Constructeurs et destructeur
- JobInfo_Local() {};
- JobInfo_Local(const Parametre & param, const Environnement & env);
- virtual ~JobInfo_Local();
-
- // Constructeur par recopie
- JobInfo_Local(const JobInfo_Local & jinfo) : JobInfo(jinfo) {};
-
-
- protected:
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_PBS.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 21 09:42:06 2003
- * Projet : Salome 2
- *
- */
-
-#include <cstdio>
-#include <sstream>
-//#include "MEDMEM_STRING.hxx"
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-#include "Batch_RunTimeException.hxx"
-#include "Batch_JobInfo_PBS.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Constructeurs
- JobInfo_PBS::JobInfo_PBS(struct batch_status * list, bool tobedeleted) : JobInfo()
- {
- // On ne considere que le premier element de la liste
- // Si tout est OK, la liste ne devrait contenir qu'un element
- // Sinon on leve une exception.
- struct batch_status * p_job = list;
- int i;
- for(i=0; p_job; p_job = p_job->next) i++;
- if (i == 0) throw RunTimeException("Liste vide (le job est absent de la file)");
- if (i > 1) {
- //MEDMEM::STRING sst;
- ostringstream sst;
- sst << "JobInfo_PBS::JobInfo_PBS(struct batch_status * list, bool tobedeleted) : la liste contient "
- << i << " elements" << " (1 seul requis)" << endl;
- throw RunTimeException(sst.str());
- }
- p_job = list;
-
- // On remplit les membres _param et _env
-
- if (p_job->name && strlen(p_job->name)) _param[ID] = p_job->name;
- if (p_job->text && strlen(p_job->text)) _param[TEXT] = p_job->text;
-
- for(struct attrl * p_attr = p_job->attribs; p_attr; p_attr = p_attr->next) {
-
- string name, res, value;
- if (p_attr->name && strlen(p_attr->name)) name = p_attr->name;
- if (p_attr->resource && strlen(p_attr->resource)) res = p_attr->resource;
- if (p_attr->value && strlen(p_attr->value)) value = p_attr->value;
-
- if (name == ATTR_N) {
- _param[NAME] = value;
-
- } else if (name == ATTR_owner) {
- _param[USER] = value;
-
- } else if (name == ATTR_state) {
- _param[STATE] = value;
-
- } else if (name == ATTR_queue) {
- _param[QUEUE] = value;
-
- } else if (name == ATTR_A) {
- _param[ACCOUNT] = value;
-
- } else if (name == ATTR_M) {
- _param[MAIL] = value;
-
- } else if (name == ATTR_c) {
- if (!strcmp(value.c_str(), CHECKPOINT_UNSPECIFIED)) _param[CHECKPOINT] = 1L;
- else _param[CHECKPOINT] = 0L;
-
- } else if (name == ATTR_h) {
- if (!strcmp(value.c_str(), NO_HOLD)) _param[HOLD] = 0L;
- else _param[HOLD] = 1L;
-
- } else if (name == ATTR_ctime) {
- _param[CREATIONTIME] = atol(value.c_str());
-
- } else if (name == ATTR_etime) {
- _param[ELIGIBLETIME] = atol(value.c_str());
-
- } else if (name == ATTR_mtime) {
- _param[MODIFICATIONTIME] = atol(value.c_str());
-
- } else if (name == ATTR_qtime) {
- _param[QUEUEDTIME] = atol(value.c_str());
-
- } else if (name == ATTR_exechost) {
- _param[EXECUTIONHOST] = value;
-
- } else if (name == ATTR_session) {
- _param[PID] = atol(value.c_str());
-
- } else if (name == ATTR_euser) {
- _param[EUSER] = value;
-
- } else if (name == ATTR_egroup) {
- _param[EGROUP] = value;
-
- } else if (name == ATTR_l) {
- if (res == "cput") {
- _param[MAXCPUTIME] = HMStoLong(value);
-
- } else if (res == "walltime") {
- _param[MAXWALLTIME] = HMStoLong(value);
-
- }
-
- } else if (name == ATTR_used) {
- if (res == "cput") {
- _param[USEDCPUTIME] = HMStoLong(value);
-
- } else if (res == "walltime") {
- _param[USEDWALLTIME] = HMStoLong(value);
-
- }
-
- } else if (name == ATTR_v) {
- int deb = 0;
- int pos = 0;
- bool ok = true;
-
- while (ok) {
- pos = value.find(",", deb);
- string sub = value.substr(deb, pos-deb);
- deb = pos + 1;
- if (pos < 0) ok = false;
-
- int eq = sub.find("=");
- _env[sub.substr(0, eq)] = sub.substr(eq+1);
- }
-
- }
- }
-
-
- if (tobedeleted) pbs_statfree(list);
- }
-
- // Destructeur
- JobInfo_PBS::~JobInfo_PBS()
- {
- // Nothing to do
- }
-
- // Convertit une date HH:MM:SS en secondes
- long JobInfo_PBS::HMStoLong(const string & s)
- {
- long hour, min, sec;
-
- sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
- return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
- }
-
- // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
- string JobInfo_PBS::__str__() const
- {
- //MEDMEM::STRING sst;
- ostringstream sst;
- sst << "<JobInfo_PBS (" << this << ") :" << endl;
- sst << " ID = " <<_param[ID] << endl;
-
- sst << " + Parametre :" << endl;
- Parametre::const_iterator itp;
- for(itp=_param.begin(); itp!=_param.end(); itp++) {
- if ( (*itp).first != ID ) {
- sst << " * " << (*itp).first << " = " << (*itp).second << endl;
- }
- }
- return sst.str();
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_PBS.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 21 09:42:05 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _JOBINFO_PBS_H_
-#define _JOBINFO_PBS_H_
-
-extern "C" {
-
-#include <pbs_error.h>
-#include <pbs_ifl.h>
-}
-#include <string>
-#include "Batch_RunTimeException.hxx"
-#include "Batch_JobInfo.hxx"
-
-namespace Batch {
-
- class JobInfo_PBS : public JobInfo
- {
- public:
- // Constructeurs et destructeur
- JobInfo_PBS() : JobInfo() {};
- JobInfo_PBS(struct batch_status * stat_list, bool tobedeleted = false);
- virtual ~JobInfo_PBS();
-
- // Constructeur par recopie
- JobInfo_PBS(const JobInfo_PBS & jinfo) : JobInfo(jinfo) {};
-
- // Methodes pour l'interfacage avec Python (SWIG)
- // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- std::string __str__() const; // SWIG : affichage en Python
- std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
- protected:
-
- private:
- // Convertit une date HH:MM:SS en secondes
- long HMStoLong(const std::string &);
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_eLSF.cxx : emulation of LSF client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail : mailto:bernard.secher@cea.fr
- * Date : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#include <cstdio>
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-#include "Batch_RunTimeException.hxx"
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_JobInfo_eLSF.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-
-
- // Constructeurs
- JobInfo_eLSF::JobInfo_eLSF(int id, string logFile) : JobInfo()
- {
- // On remplit les membres _param et _env
- ostringstream oss;
- oss << id;
- _param[ID] = oss.str();
-
- // read status of job in log file
- char line[128];
- ifstream fp(logFile.c_str(),ios::in);
- fp.getline(line,80,'\n');
-
- string sjobid, username, status;
- fp >> sjobid;
- fp >> username;
- fp >> status;
-
- _param[STATE] = status;
-
- if( status.find("RUN") != string::npos)
- _running = true;
-
- }
-
- // Teste si un job est present en machine
- bool JobInfo_eLSF::isRunning() const
- {
- return _running;
- }
-
-
- // Destructeur
- JobInfo_eLSF::~JobInfo_eLSF()
- {
- // Nothing to do
- }
-
- // Convertit une date HH:MM:SS en secondes
- long JobInfo_eLSF::HMStoLong(const string & s)
- {
- long hour, min, sec;
-
- sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
- return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
- }
-
- // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
- string JobInfo_eLSF::__str__() const
- {
- ostringstream sst;
- sst << "<JobInfo_eLSF (" << this << ") :" << endl;
- sst << " ID = " <<_param[ID] << endl;
- sst << " STATE = " <<_param[STATE] << endl;
-
- return sst.str();
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_eLSF.hxx : emulation of LSF client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail : mailto:bernard.secher@cea.fr
- * Date : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _JOBINFO_LSF_H_
-#define _JOBINFO_LSF_H_
-
-#include "Batch_RunTimeException.hxx"
-#include "Batch_JobInfo.hxx"
-
-#include <string>
-
-namespace Batch {
-
- class JobInfo_eLSF : public JobInfo
- {
- public:
- // Constructeurs et destructeur
- JobInfo_eLSF() : _running(false) {};
- JobInfo_eLSF(int id,std::string logFile);
- virtual ~JobInfo_eLSF();
-
- // Constructeur par recopie
- JobInfo_eLSF(const JobInfo_eLSF & jinfo) : JobInfo(jinfo) {};
-
- // Teste si un job est present en machine
- virtual bool isRunning() const;
-
- // Methodes pour l'interfacage avec Python (SWIG)
- // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- std::string __str__() const; // SWIG : affichage en Python
- std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
- protected:
- bool _running; // etat du job en machine
-
- private:
- // Convertit une date HH:MM:SS en secondes
- long HMStoLong(const std::string &);
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_ePBS.cxx : emulation of PBS client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail : mailto:bernard.secher@cea.fr
- * Date : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#include <cstdio>
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-#include "Batch_RunTimeException.hxx"
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_JobInfo_ePBS.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-
-
- // Constructeurs
- JobInfo_ePBS::JobInfo_ePBS(int id, string logFile) : JobInfo()
- {
- // On remplit les membres _param et _env
- ostringstream oss;
- oss << id;
- _param[ID] = oss.str();
-
- // read of log file
- char line[128];
- ifstream fp(logFile.c_str(),ios::in);
-
- string status;
- string sline;
- int pos = string::npos;
- while( (pos == string::npos) && fp.getline(line,80,'\n') ){
- sline = string(line);
- pos = sline.find("job_state");
- };
-
- if(pos!=string::npos){
- istringstream iss(sline);
- iss >> status;
- iss >> status;
- iss >> status;
- }
- else
- status = "U";
-
- _param[STATE] = status;
-
- if( status.find("R") != string::npos)
- _running = true;
-
- }
-
- // Teste si un job est present en machine
- bool JobInfo_ePBS::isRunning() const
- {
- return _running;
- }
-
-
- // Destructeur
- JobInfo_ePBS::~JobInfo_ePBS()
- {
- // Nothing to do
- }
-
- // Convertit une date HH:MM:SS en secondes
- long JobInfo_ePBS::HMStoLong(const string & s)
- {
- long hour, min, sec;
-
- sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
- return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
- }
-
- // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
- string JobInfo_ePBS::__str__() const
- {
- ostringstream sst;
- sst << "<JobInfo_ePBS (" << this << ") :" << endl;
- sst << " ID = " <<_param[ID] << endl;
- sst << " STATE = " <<_param[STATE] << endl;
-
- return sst.str();
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_ePBS.hxx : emulation of PBS client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail : mailto:bernard.secher@cea.fr
- * Date : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _JOBINFO_PBS_H_
-#define _JOBINFO_PBS_H_
-
-#include <string>
-#include "Batch_RunTimeException.hxx"
-#include "Batch_JobInfo.hxx"
-
-namespace Batch {
-
- class JobInfo_ePBS : public JobInfo
- {
- public:
- // Constructeurs et destructeur
- JobInfo_ePBS() : _running(false) {};
- JobInfo_ePBS(int id,std::string logFile);
- virtual ~JobInfo_ePBS();
-
- // Constructeur par recopie
- JobInfo_ePBS(const JobInfo_ePBS & jinfo) : JobInfo(jinfo) {};
-
- // Teste si un job est present en machine
- virtual bool isRunning() const;
-
- // Methodes pour l'interfacage avec Python (SWIG)
- // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- std::string __str__() const; // SWIG : affichage en Python
- std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
- protected:
- bool _running; // etat du job en machine
-
- private:
- // Convertit une date HH:MM:SS en secondes
- long HMStoLong(const std::string &);
-
- };
-
-}
-
-#endif
+++ /dev/null
-// 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 <cstdio>
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#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 << "<JobInfo_eSGE (" << this << ") :" << endl;
- sst << " ID = " <<_param[ID] << endl;
- sst << " STATE = " <<_param[STATE] << endl;
-
- return sst.str();
- }
-
-
-}
+++ /dev/null
-// 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.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 _JOBINFO_SGE_H_
-#define _JOBINFO_SGE_H_
-
-#include <string>
-#include "Batch_Defines.hxx"
-#include "Batch_RunTimeException.hxx"
-#include "Batch_JobInfo.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT JobInfo_eSGE : public JobInfo
- {
- public:
- // Constructeurs et destructeur
- JobInfo_eSGE() : _running(false) {};
- JobInfo_eSGE(int id,std::string logFile);
- virtual ~JobInfo_eSGE();
-
- // Constructeur par recopie
- JobInfo_eSGE(const JobInfo_eSGE & jinfo) : JobInfo(jinfo) {};
-
- // Teste si un job est present en machine
- virtual bool isRunning() const;
-
- // Methodes pour l'interfacage avec Python (SWIG)
- // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- std::string __str__() const; // SWIG : affichage en Python
- std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
- protected:
- bool _running; // etat du job en machine
-
- private:
- // Convertit une date HH:MM:SS en secondes
- long HMStoLong(const std::string &);
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Job_LSF.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 14 11:00:39 2003
- * Projet : Salome 2
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string>
-#include <vector>
-#include "Batch_Job_LSF.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-
- // Constructeur
- Job_LSF::Job_LSF(const Job & job) : _p_submit(0)
- {
- Parametre P = job.getParametre();
- _p_submit = ParametreToSubmitStruct(P);
- }
-
-
- // Destructeur
- Job_LSF::~Job_LSF()
- {
- if (_p_submit) {
- if (_p_submit->jobName) delete [] _p_submit->jobName;
- if (_p_submit->queue) delete [] _p_submit->queue;
- if (_p_submit->askedHosts) {
- delete [] *(_p_submit->askedHosts);
- delete [] _p_submit->askedHosts;
- }
- if (_p_submit->resReq) delete [] _p_submit->resReq;
- if (_p_submit->hostSpec) delete [] _p_submit->hostSpec;
- if (_p_submit->dependCond) delete [] _p_submit->dependCond;
- if (_p_submit->timeEvent) delete [] _p_submit->timeEvent;
- if (_p_submit->inFile) delete [] _p_submit->inFile;
- if (_p_submit->outFile) delete [] _p_submit->outFile;
- if (_p_submit->errFile) delete [] _p_submit->errFile;
- if (_p_submit->command) delete [] _p_submit->command;
- if (_p_submit->newCommand) delete [] _p_submit->newCommand;
- if (_p_submit->chkpntDir) delete [] _p_submit->chkpntDir;
- if (_p_submit->xf) delete [] _p_submit->xf;
- if (_p_submit->preExecCmd) delete [] _p_submit->preExecCmd;
- if (_p_submit->mailUser) delete [] _p_submit->mailUser;
- if (_p_submit->projectName) delete [] _p_submit->projectName;
- if (_p_submit->loginShell) delete [] _p_submit->loginShell;
- if (_p_submit->exceptList) delete [] _p_submit->exceptList;
- delete _p_submit;
- }
- }
-
-
- // Accesseur
- struct submit * Job_LSF::getSubmitStruct()
- {
- return _p_submit;
- }
-
-
- char * Job_LSF::string2char(const string & s)
- {
- char * ch = new char [s.size() + 1];
- memset(ch, 0, s.size() + 1);
- strncat(ch, s.c_str(), s.size());
- return ch;
- }
-
-
- struct submit * Job_LSF::ParametreToSubmitStruct(const Parametre & P)
- {
- if (! _p_submit) _p_submit = new struct submit;
-
- memset( (void *) _p_submit, 0, sizeof(struct submit));
-
- struct submit & sub = * _p_submit;
- sub.options = 0;
- sub.options2 = 0;
-
- sub.beginTime = 0; // job can run as soon as possible (default)
- sub.termTime = 0; // job can run as long as it wishes (default)
-
- sub.numProcessors = 1; // job can run on one single processor (default)
- sub.maxNumProcessors = 1; // job can run on one single processor (default)
-
- for(int i = 0; i< LSF_RLIM_NLIMITS; i++) sub.rLimits[i] = DEFAULT_RLIMIT;
-
- typedef std::vector< struct xFile > XFTAB;
- XFTAB xf_tab;
-
- string st_second;
- for(Parametre::const_iterator it = P.begin(); it != P.end(); it++) {
- if ( (*it).first == ACCOUNT ) {
- sub.options |= SUB_PROJECT_NAME;
- st_second = (*it).second.str();
- sub.projectName = string2char(st_second);
-
- } else if ( (*it).first == CHECKPOINT ) {
- if (static_cast< long >((*it).second))
- sub.options |= SUB_CHKPNT_PERIOD;
- else
- sub.options &= ~ SUB_CHKPNT_PERIOD;
-
- } else if ( (*it).first == CKPTINTERVAL ) {
- sub.chkpntPeriod = static_cast< long >((*it).second);
-
- } else if ( (*it).first == EXECUTABLE ) {
- st_second = (*it).second.str();
- sub.command = string2char(st_second);
-
- } else if ( (*it).first == EXECUTIONHOST ) {
- sub.options |= SUB_HOST;
- if (! sub.numAskedHosts) {
- sub.numAskedHosts = 1;
- sub.askedHosts = new char* [1];
- }
- st_second = (*it).second.str();
- sub.askedHosts[0] = string2char(st_second);
-
- } else if ( (*it).first == HOLD ) {
- if (static_cast< long >((*it).second))
- sub.options2 |= SUB2_HOLD;
- else
- sub.options2 &= ~ SUB2_HOLD;
-
- } else if ( (*it).first == INFILE ) {
- Versatile V = (*it).second;
- Versatile::iterator Vit;
-
- for(Vit=V.begin(); Vit!=V.end(); Vit++) {
- CoupleType cpt = *static_cast< CoupleType * >(*Vit);
- Couple cp = cpt;
- string local = cp.getLocal();
- string remote = cp.getRemote();
-
- // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur
- if (remote == "stdin"){
- sub.options |= SUB_IN_FILE;
- sub.inFile = string2char(local);
-
- } else {
- struct xFile xf;
- strncpy(xf.subFn, local.c_str(), MAXFILENAMELEN - 1); xf.subFn[MAXFILENAMELEN - 1] = 0;
- strncpy(xf.execFn, remote.c_str(), MAXFILENAMELEN - 1); xf.execFn[MAXFILENAMELEN - 1] = 0;
- xf.options = XF_OP_SUB2EXEC;
- xf_tab.push_back(xf);
- }
- }
-
- } else if ( (*it).first == MAIL ) {
- sub.options |= SUB_MAIL_USER;
- st_second = (*it).second.str();
- sub.mailUser = string2char(st_second);
-
- } else if ( (*it).first == MAXCPUTIME ) {
- sub.rLimits[LSF_RLIMIT_CPU] = static_cast< long >((*it).second);
-
- } else if ( (*it).first == MAXDISKSIZE ) {
- sub.rLimits[LSF_RLIMIT_FSIZE] = static_cast< long >((*it).second);
-
- } else if ( (*it).first == MAXRAMSIZE ) {
- sub.rLimits[LSF_RLIMIT_SWAP] = static_cast< long >((*it).second);
-
- } else if ( (*it).first == MAXWALLTIME ) {
- sub.rLimits[LSF_RLIMIT_RUN] = static_cast< long >((*it).second);
-
- } else if ( (*it).first == NAME ) {
- sub.options |= SUB_JOB_NAME;
- st_second = (*it).second.str();
- sub.jobName = string2char(st_second);
-
- } else if ( (*it).first == NBPROC ) {
- sub.numProcessors = static_cast< long >((*it).second);
- sub.maxNumProcessors = static_cast< long >((*it).second);
-
- } else if ( (*it).first == OUTFILE ) {
- Versatile V = (*it).second;
- Versatile::iterator Vit;
-
- for(Vit=V.begin(); Vit!=V.end(); Vit++) {
- CoupleType cpt = *static_cast< CoupleType * >(*Vit);
- Couple cp = cpt;
- string local = cp.getLocal();
- string remote = cp.getRemote();
-
- // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur
- if (remote == "stdout"){
- sub.options |= SUB_OUT_FILE;
- sub.outFile = string2char(local);
-
- } else if (remote == "stderr"){
- sub.options |= SUB_ERR_FILE;
- sub.errFile = string2char(local);
-
- } else {
- struct xFile xf;
- strncpy(xf.subFn, local.c_str(), MAXFILENAMELEN - 1); xf.subFn[MAXFILENAMELEN - 1] = 0;
- strncpy(xf.execFn, remote.c_str(), MAXFILENAMELEN - 1); xf.execFn[MAXFILENAMELEN - 1] = 0;
- xf.options = XF_OP_EXEC2SUB;
- xf_tab.push_back(xf);
- }
- }
-
-
- } else if ( (*it).first == QUEUE ) {
- sub.options |= SUB_QUEUE;
- st_second = (*it).second.str();
- sub.queue = string2char(st_second);
-
- } else if ( (*it).first == STARTTIME ) {
- sub.beginTime = static_cast< long >((*it).second);
-
- } else if ( (*it).first == TMPDIR ) {
- // TODO
-
- } else if ( (*it).first == USER ) {
- // TODO
-
- }
- }
-
-
- // Transfert de fichiers en entree et sortie
- sub.options |= SUB_OTHER_FILES;
- sub.nxf = xf_tab.size();
- sub.xf = new struct xFile [sub.nxf];
- int ixf = 0;
- for(XFTAB::const_iterator it_xf=xf_tab.begin(); it_xf != xf_tab.end(); it_xf++, ixf++)
- sub.xf[ixf] = *it_xf; // *it_xf == xf_tab[ixf]
-
-
- return _p_submit;
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Job_LSF.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 14 11:00:39 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _JOB_LSF_H_
-#define _JOB_LSF_H_
-
-extern "C" {
-
-#include <lsf/lsf.h>
-#include <lsf/lsbatch.h>
-}
-#include <string>
-#include "Batch_Job.hxx"
-
-namespace Batch {
-
- class Job_LSF
- {
- public:
- // Constructeur et destructeur
- Job_LSF(const Job & job);
- virtual ~Job_LSF();
-
- // Accesseurs
- struct submit * getSubmitStruct();
-
- protected:
- struct submit * _p_submit; // structure pour soumettre les jobs
-
- private:
- struct submit * ParametreToSubmitStruct(const Parametre & P);
- char * string2char(const std::string &);
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Job_Local.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 14 11:00:39 2003
- * Projet : Salome 2
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#ifndef WIN32
-#include <unistd.h>
-#endif
-#include "Batch_Job_Local.hxx"
-
-using namespace std;
-
-namespace Batch {
-
- // Constructeur
- Job_Local::Job_Local(const Job & job) :
- _command(), _param(job.getParametre()), _env(job.getEnvironnement())
- {
- // On positionne le nom du EXECUTIONHOST a "localhost" s'il n'est pas precise
- if ( _param.find(EXECUTIONHOST) == _param.end() ) {
- _param[EXECUTIONHOST] = "localhost";
- }
-
- // On convertit les objets Parametre et Environnement en liste chainee d'attributs + operateur
- addEnvironnement( _env );
- addParametre ( _param );
-
- }
-
-
- // Destructeur
- Job_Local::~Job_Local()
- {
- }
-
-
- void Job_Local::addParametre(const Parametre & P)
- {
- // En dernier, on ajoute le chemin complet de la commande
- _command += P[EXECUTABLE].str();
- }
-
-
- void Job_Local::addEnvironnement(const Environnement & E)
- {
- for(Environnement::const_iterator it=E.begin(); it != E.end(); it++) {
- string variable = (*it).first;
- string value = (*it).second;
-
- // On remplace toutes les occurences de single-quote par backslash-single-quote
- for(int pos=0; pos < value.size(); pos++) {
- pos = value.find("'", pos);
- if ( (pos < 0) || (pos > value.size()) ) break;
- value.replace(pos, 1, "\'");
- }
- _command += variable + "='" + value + "' ";
- }
- }
-
- string Job_Local::getCommand(void) const {
- return _command;
- }
-
-
- // Retourne l'objet Parametre
- Parametre Job_Local::getParametre() const
- {
- return _param;
- }
-
- // Retourne l'objet Environnement
- Environnement Job_Local::getEnvironnement() const
- {
- return _env;
- }
-
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Job_Local.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 14 11:00:39 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _JOB_LOCAL_H_
-#define _JOB_LOCAL_H_
-
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-#include "Batch_Job.hxx"
-
-namespace Batch {
-
- class Job_Local
- {
- public:
- // Constructeur et destructeur
- Job_Local(const Job & job);
- virtual ~Job_Local();
-
- // Retourne la commande _command
- virtual std::string getCommand(void) const;
-
- // Retourne l'objet Parametre
- virtual Parametre getParametre() const;
-
- // Retourne l'objet Environnement
- virtual Environnement getEnvironnement() const;
-
-
- protected:
- std::string _command;
- Parametre _param;
- Environnement _env;
-
- private:
- void addParametre(const Parametre & P);
- void addEnvironnement(const Environnement & E);
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Job_PBS.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 14 11:00:39 2003
- * Projet : Salome 2
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "Batch_Job_PBS.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Ajoute un element (name,resource,value) a la liste chainee d'attributs + operateur
- void Job_PBS::setResourceAttributeOP(struct attropl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value)
- {
- // L'element (name,resource,value) existe-t-il deja ? si oui ptr != 0
- struct attropl * ptr = findResourceAttributeOP(*attr_list, attr_name, attr_resource);
-
- if (!ptr) { // L'element n'existe pas, il faut le creer
- if (ptr = lastAttributeOP(*attr_list)) { // la liste n'est pas vide
- ptr->next = new struct attropl;
- ptr = ptr->next;
- ptr->next = 0;
-
- } else { // la liste est completement vide
- ptr = *attr_list = new struct attropl;
- ptr->next = 0;
- }
-
- // On remplit les champs (name,resource,value)
- ptr->name = new char[strlen(attr_name) + 1];
- strncpy(ptr->name, attr_name, strlen(attr_name));
- ptr->name[strlen(attr_name)] = 0;
-
- ptr->resource = new char[strlen(attr_resource) + 1];
- strncpy(ptr->resource, attr_resource, strlen(attr_resource));
- ptr->resource[strlen(attr_resource)] = 0;
-
- ptr->value = new char[strlen(attr_value) + 1];
- strncpy(ptr->value, attr_value, strlen(attr_value));
- ptr->value[strlen(attr_value)] = 0;
-
- } else { // L'attribut existe, on change sa valeur
- delete[] ptr->value; // On efface la valeur precedente
- ptr->value = new char[strlen(attr_value) + 1];
- strncpy(ptr->value, attr_value, strlen(attr_value));
- ptr->value[strlen(attr_value)] = 0;
-
- }
- }
-
-
- // Recherche un element (name,resource,value) dans la liste chainee d'attributs + operateur
- struct attropl * Job_PBS::findResourceAttributeOP(struct attropl * attr_list, const char * attr_name, const char * attr_resource)
- {
- // On parcoure la liste chainee pour trouver l'element dont les champs name et resource coincident
- struct attropl * ptr = attr_list;
- while (ptr) {
- if (!strcmp(ptr->name, attr_name) && !strcmp(ptr->resource, attr_resource)) break;
- ptr = ptr->next;
- }
- return ptr;
- }
-
-
- // Recherche le dernier element de la liste chainee d'attributs + operateur
- struct attropl * Job_PBS::lastAttributeOP(struct attropl * attr_list)
- {
- struct attropl * ptr = attr_list;
- while (ptr && ptr->next) {
- ptr = ptr->next;
- }
- return ptr;
- }
-
-
- // Convertit un objet Parametre en liste chainee d'attributs + operateur
- struct attropl * Job_PBS::ParametreToAttributeOPList(struct attropl ** _p_attr_list, Parametre & P)
- {
- Parametre::iterator it;
- string st_second;
- for(it=P.begin(); it!=P.end(); it++) {
- if ( (*it).first == ACCOUNT ) {
- st_second = (*it).second.str();
- setResourceAttributeOP(_p_attr_list, ATTR_A, "", st_second.c_str());
-
-
- } else if ( (*it).first == CHECKPOINT ) {
- setResourceAttributeOP(_p_attr_list, ATTR_c, "", "u");
-
-
- } else if ( (*it).first == CKPTINTERVAL ) {
- // Not significant
-
- } else if ( (*it).first == EXECUTABLE ) {
- // Already done
-
- } else if ( (*it).first == HOLD ) {
- if (static_cast< long >((*it).second))
- setResourceAttributeOP(_p_attr_list, ATTR_h, "", USER_HOLD);
- else
- setResourceAttributeOP(_p_attr_list, ATTR_h, "", NO_HOLD);
-
- } else if ( (*it).first == INFILE ) {
- Versatile V = (*it).second;
- Versatile::iterator Vit;
-
- string sep = "";
- string stagein;
-
- for(Vit=V.begin(); Vit!=V.end(); Vit++, sep=",") {
- CoupleType cpt = *static_cast< CoupleType * >(*Vit);
- Couple cp = cpt;
- string local = cp.getLocal();
- string remote = cp.getRemote();
-
- // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur
- stagein += sep + remote + "@" + local;
- }
-
- if (stagein.size())
- setResourceAttributeOP(_p_attr_list, ATTR_stagein, "", stagein.c_str());
-
-
- } else if ( (*it).first == MAIL ) {
- st_second = (*it).second.str();
- setResourceAttributeOP(_p_attr_list, ATTR_M, "", st_second.c_str());
-
- } else if ( (*it).first == MAXCPUTIME ) {
- char attr_value[32];
- long secondes = (*it).second;
- long heures = secondes / 3600L;
- long minutes = (secondes - 3600L * heures) / 60L;
- secondes = secondes % 60L;
- sprintf(attr_value, "%02ld:%02ld:%02ld", heures, minutes, secondes);
-
- setResourceAttributeOP(_p_attr_list, ATTR_l, "cput", attr_value);
-
-
- } else if ( (*it).first == MAXDISKSIZE ) {
-
- } else if ( (*it).first == MAXRAMSIZE ) {
-
- } else if ( (*it).first == MAXWALLTIME ) {
- char attr_value[32];
- long secondes = (*it).second;
- long heures = secondes / 3600L;
- long minutes = (secondes - 3600L * heures) / 60L;
- secondes = secondes % 60L;
- sprintf(attr_value, "%02ld:%02ld:%02ld", heures, minutes, secondes);
-
- setResourceAttributeOP(_p_attr_list, ATTR_l, "walltime", attr_value);
-
-
- } else if ( (*it).first == NAME ) {
- st_second = (*it).second.str();
- setResourceAttributeOP(_p_attr_list, ATTR_N, "", st_second.c_str());
-
-
- } else if ( (*it).first == OUTFILE ) {
- Versatile V = (*it).second;
- Versatile::iterator Vit;
-
- string sep = "";
- string stageout;
-
- for(Vit=V.begin(); Vit!=V.end(); Vit++, sep=",") {
- CoupleType cpt = *static_cast< CoupleType * >(*Vit);
- Couple cp = cpt;
- string local = cp.getLocal();
- string remote = cp.getRemote();
-
- if (remote == "stdout")
- setResourceAttributeOP(_p_attr_list, ATTR_o, "", local.c_str());
-
- else if (remote == "stderr")
- setResourceAttributeOP(_p_attr_list, ATTR_e, "", local.c_str());
-
- else
- // ATTENTION : les notions de fichier "local" ou "remote" sont inverses de celle de PBS qui a un point de vue serveur et non pas utilisateur
- stageout += sep + remote + "@" + local;
- }
-
- if (stageout.size())
- setResourceAttributeOP(_p_attr_list, ATTR_stageout, "", stageout.c_str());
-
- } else if ( (*it).first == QUEUE ) {
- // Already done
-
- } else if ( (*it).first == STARTTIME ) {
-
- } else if ( (*it).first == TMPDIR ) {
-
- } else if ( (*it).first == USER ) {
- st_second = (*it).second.str();
- setResourceAttributeOP(_p_attr_list, ATTR_u, "", st_second.c_str());
-
- }
- }
- return *_p_attr_list;
- }
-
-
- // Convertit un objet Environnement en liste chainee d'attributs + operateur
- struct attropl * Job_PBS::EnvironnementToAttributeOPList(struct attropl ** _p_attr_list, Environnement & E)
- {
- Environnement::iterator it;
- for(it=E.begin(); it!=E.end(); it++) {
- setResourceAttributeOP(_p_attr_list, ATTR_v, (*it).first.c_str(), ( (*it).first + "=" + (*it).second ).c_str());
- }
- return *_p_attr_list;
- }
-
-
- // Ajoute les variables d'environnement presentes dans tout job PBS
- void Job_PBS::addPBSEnvironnement(Environnement & E)
- {
- char * c;
-
- c = getenv("HOME");
- if (c) E["PBS_O_HOME"] = c;
-
- c = getenv("LANG");
- if (c) E["PBS_O_LANG"] = c;
-
- c = getenv("LOGNAME");
- if (c) E["PBS_O_LOGNAME"] = c;
-
- c = getenv("PATH");
- if (c) E["PBS_O_PATH"] = c;
-
- c = getenv("LD_LIBRARY_PATH");
- if (c) E["PBS_O_LD_LIBRARY_PATH"] = c;
-
- c = getenv("MAIL");
- if (c) E["PBS_O_MAIL"] = c;
-
- c = getenv("SHELL");
- if (c) E["PBS_O_SHELL"] = c;
-
- c = getenv("TZ");
- if (c) E["PBS_O_TZ"] = c;
-
- /* Recuperation du working directory */
- size_t size = 256;
- char * buf = 0;
- char * rc = 0;
- do {
- if (buf) delete[] buf;
- buf = new char[size];
- rc = getcwd(buf, size);
- size += size;
- } while (!rc);
- E["PBS_O_WORKDIR"] = buf;
- delete[] buf;
- }
-
-
- // Ajoute un element (name,resource,value) a la liste chainee d'attributs
- void Job_PBS::setResourceAttribute(struct attrl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value)
- {
- // L'element (name,resource,value) existe-t-il deja ? si oui ptr != 0
- struct attrl * ptr = findResourceAttribute(*attr_list, attr_name, attr_resource);
-
- if (!ptr) { // L'attribut n'existe pas, il faut le creer
- if (ptr = lastAttribute(*attr_list)) { // la liste n'est pas vide
- ptr->next = new struct attrl;
- ptr = ptr->next;
- ptr->next = 0;
-
- } else { // la liste est completement vide
- ptr = *attr_list = new struct attrl;
- ptr->next = 0;
- }
-
- // On remplit les champs (name,resource,value)
- ptr->name = new char[strlen(attr_name) + 1];
- strncpy(ptr->name, attr_name, strlen(attr_name));
- ptr->name[strlen(attr_name)] = 0;
-
- ptr->resource = new char[strlen(attr_resource) + 1];
- strncpy(ptr->resource, attr_resource, strlen(attr_resource));
- ptr->resource[strlen(attr_resource)] = 0;
-
- ptr->value = new char[strlen(attr_value) + 1];
- strncpy(ptr->value, attr_value, strlen(attr_value));
- ptr->value[strlen(attr_value)] = 0;
-
- } else { // L'attribut existe, on change sa valeur
- delete[] ptr->value; // On efface la valeur precedente
- ptr->value = new char[strlen(attr_value) + 1];
- strncpy(ptr->value, attr_value, strlen(attr_value));
- ptr->value[strlen(attr_value)] = 0;
-
- }
- }
-
- // Recherche un element (name,resource,value) dans la liste chainee d'attributs
- struct attrl * Job_PBS::findResourceAttribute(struct attrl * attr_list, const char * attr_name, const char * attr_resource)
- {
- // On parcoure la liste chainee pour trouver l'element dont les champs name et resource coincident
- struct attrl * ptr = attr_list;
- while (ptr) {
- if (!strcmp(ptr->name, attr_name) && !strcmp(ptr->resource, attr_resource)) break;
- ptr = ptr->next;
- }
- return ptr;
- }
-
-
- // Recherche le dernier element de la liste chainee d'attributs
- struct attrl * Job_PBS::lastAttribute(struct attrl * attr_list)
- {
- struct attrl * ptr = attr_list;
- while (ptr && ptr->next) {
- ptr = ptr->next;
- }
- return ptr;
- }
-
-
- // Constructeur
- Job_PBS::Job_PBS(const Job & job) : _p_attropl(0), _p_attrl(0), _script(0), _destination(0)
- {
- Parametre P = job.getParametre();
- Parametre::iterator it;
-
- // On extrait de l'objet Parametre le champ EXECUTABLE qui deviendra le script PBS
- if ( (it=P.find(EXECUTABLE)) != P.end()) {
- Versatile V = (*it).second;
- string st_exe = V.str();
- const char * exe = st_exe.c_str();
- int lg = strlen(exe);
- _script = new char[lg + 1];
- for (int ii=0; ii<lg+1; ii++) _script[ii] = 0;
- strcpy(_script, exe);
- _script[lg] = 0;
-
- } else {
- _script = new char[1];
- _script[0] = 0;
- }
-
- // On extrait de l'objet Parametre le champ QUEUE qui deviendra la destination
- if ( (it=P.find(QUEUE)) != P.end()) {
- Versatile V = (*it).second;
- string st_dest = V.str();
- const char * dest = st_dest.c_str();
- _destination = new char[strlen(dest) + 2 + 1];
- _destination[0] = 0;
- strcat(_destination, dest);
- _destination[strlen(dest)] = 0;
- } else {
- _destination = new char[1];
- _destination[0] = 0;
- }
-
- // On convertit les objets Parametre et Environnement en liste chainee d'attributs + operateur
- Environnement E = job.getEnvironnement();
- addPBSEnvironnement(E);
-
- _p_attropl = ParametreToAttributeOPList(&_p_attropl, P);
- _p_attropl = EnvironnementToAttributeOPList(&_p_attropl, E);
-
- }
-
-
- // Destructeur
- Job_PBS::~Job_PBS()
- {
- // On detruit la liste chainee d'attributs + operateur
- struct attropl * current_p_attropl = _p_attropl;
- while (current_p_attropl) {
- struct attropl * next = current_p_attropl->next;
- delete[] current_p_attropl->name;
- delete[] current_p_attropl->resource;
- delete[] current_p_attropl->value;
- delete current_p_attropl;
- current_p_attropl = next;
- }
-
- // On detruit la liste chainee d'attributs
- struct attrl * current_p_attrl = _p_attrl;
- while (current_p_attrl) {
- struct attrl * next = current_p_attrl->next;
- delete[] current_p_attrl->name;
- delete[] current_p_attrl->resource;
- delete[] current_p_attrl->value;
- delete current_p_attrl;
- current_p_attrl = next;
- }
-
- // On detruit les champs alloues
- delete[] _script;
- delete[] _destination;
- }
-
-
- // Accesseur
- struct attropl * Job_PBS::getAttributesOP()
- {
- return _p_attropl;
- }
-
- // Accesseur
- // Cette methode sert pour les pbs_alter de PBS
- // Pbs_alter est buggé par rapport a la specification ers_all.ps car les
- // variables d'environnement ne sont pas supportees (ATTR_v)
- struct attrl * Job_PBS::getAttributes()
- {
- if (_p_attrl == 0) {
-
- // On remplit la structure attrl a partir de la strucuture attropl
- // (elles ne different que par le parametre op, mais elles ne sont pas interchangeables
- // dans les appels)
-
- struct attropl * current_p_attropl = _p_attropl;
- while (current_p_attropl) {
- if (strcmp(current_p_attropl->name, ATTR_v)) // Bug fix for ATTR_v
- setResourceAttribute(&_p_attrl,
- current_p_attropl->name,
- current_p_attropl->resource,
- current_p_attropl->value);
-
- current_p_attropl = current_p_attropl->next;
- }
-
- }
-
- return _p_attrl;
- }
-
- // Accesseur
- char * Job_PBS::getScript()
- {
- return _script;
- }
-
- // Accesseur
- char * Job_PBS::getDestination()
- {
- return _destination;
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Job_PBS.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Fri Nov 14 11:00:39 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _JOB_PBS_H_
-#define _JOB_PBS_H_
-
-extern "C" {
-
-#include <pbs_error.h>
-#include <pbs_ifl.h>
-}
-#include "Batch_Job.hxx"
-
-namespace Batch {
-
- class Job_PBS
- {
- public:
- // Constructeur et destructeur
- Job_PBS(const Job & job);
- virtual ~Job_PBS();
-
- // Accesseurs
- struct attropl * getAttributesOP();
- struct attrl * getAttributes();
- char * getScript();
- char * getDestination();
-
- protected:
- struct attropl * _p_attropl; // liste chainee d'attributs + operateur
- struct attrl * _p_attrl; // liste chainee d'attributs
- char * _script; // chemin d'acces au script du job
- char * _destination; // queue dans laquelle le job est soumis
-
- private:
- // Ajoute un element (name,resource,value) a la liste chainee d'attributs + operateur
- void setResourceAttributeOP(struct attropl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value);
-
- // Recherche un element (name,resource,value) dans la liste chainee d'attributs + operateur
- struct attropl * findResourceAttributeOP(struct attropl * attr_list, const char * attr_name, const char * attr_resource);
-
- // Recherche le dernier element de la liste chainee d'attributs + operateur
- struct attropl * lastAttributeOP(struct attropl * attr_list);
-
- // Convertit un objet Parametre en liste chainee d'attributs + operateur
- struct attropl * ParametreToAttributeOPList(struct attropl ** _p_attr_list, Parametre & param);
-
- // Convertit un objet Environnement en liste chainee d'attributs + operateur
- struct attropl * EnvironnementToAttributeOPList(struct attropl ** _p_attr_list, Environnement & env);
-
- // Ajoute les variables d'environnement presentes dans tout job PBS
- void addPBSEnvironnement(Environnement & E);
-
-
- // Ajoute un element (name,resource,value) a la liste chainee d'attributs
- void setResourceAttribute(struct attrl ** attr_list, const char * attr_name, const char * attr_resource, const char * attr_value);
-
- // Recherche un element (name,resource,value) dans la liste chainee d'attributs
- struct attrl * findResourceAttribute(struct attrl * attr_list, const char * attr_name, const char * attr_resource);
-
- // Recherche le dernier element de la liste chainee d'attributs
- struct attrl * lastAttribute(struct attrl * attr_list);
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * ListIsFullException.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include "Batch_ListIsFullException.hxx"
-using namespace std;
-
-
-namespace Batch {
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * ListIsFullException.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _LISTISFULLEXCEPTION_H_
-#define _LISTISFULLEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT ListIsFullException : public GenericException
- {
- public:
- // Constructeur
- ListIsFullException(std::string ch = "undefined") : GenericException("ListIsFullException", ch) {}
- };
-
-}
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * LongType.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include <sstream>
-#include <assert.h>
-//#include "MEDMEM_STRING.hxx"
-#include "Batch_LongType.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Conversion en chaine
- string LongType::affiche() const
- {
- //MEDMEM::STRING sst;
- ostringstream sst;
- sst << _data;
- return sst.str();
- }
-
- // Operateur d'affectation
- LongType & LongType::operator =(long l)
- {
- _data = l;
- return *this;
- }
-
- // Conversion en long
- LongType::operator long() const
- {
- return this->_data;
- }
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- GenericType * LongType::clone() const
- {
- LongType * pL = new LongType(this->_data);
- assert(pL != 0);
- return pL;
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * LongType.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _LONGTYPE_H_
-#define _LONGTYPE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include "Batch_GenericType.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT LongType : public GenericType
- {
- public:
- // Constructeur
- LongType(const long l=0L) : _data(l) {}
-
- // Conversion en chaine
- virtual std::string affiche() const;
-
- // Operateur d'affectation
- virtual LongType & operator =(long);
-
- // Conversion en long
- virtual operator long() const;
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- long _data;
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * MapKey.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Tue Oct 14 14:00:30 2003
- * Projet : Salome 2
- *
- */
-
-#include <string>
-#include "Batch_MapKey.hxx"
-using namespace std;
-
-namespace Batch {
-
-
-}
-
-
-// COMMENTS
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * MapKey.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Tue Oct 14 14:00:29 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _MAPKEY_H_
-#define _MAPKEY_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include <string>
-
-namespace Batch {
-
- // une classe privee pour les differents types
- // ces types ne peuvent pas etre redefinis
- class BATCH_EXPORT MapKey : public std::string
- {
- private:
- friend class Parametre; // seule la classe Parametre peut creer des MapKey
- MapKey() : std::string() {}
- MapKey(const MapKey & mk, size_type pos, size_type npos) : std::string(mk, pos, npos) {}
- MapKey(const char * s, size_type n) : std::string(s, n) {}
- MapKey(const char * s) : std::string(s) {}
- MapKey(size_type n, char c) : std::string(n, c) {}
-#ifdef __STL_MEMBER_TEMPLATES
- template<class InputIterator>
- MapKey(InputIterator __begin, InputIterator __end) : std::string(__begin, __end) {}
-#else
- MapKey(const_iterator __begin, const_iterator __end) : std::string(__begin, __end) {}
-#endif
-
- public:
- MapKey(const MapKey & mk) : std::string(mk) {}
-
- };
-
-}
-
-#endif
-
-// COMMENTS
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * NotYetImplementedException.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Tue Nov 25 11:35:07 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_NotYetImplementedException.hxx"
-
-namespace Batch {
-
-}
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * NotYetImplementedException.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Tue Nov 25 11:35:07 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _NOTYETIMPLEMENTEDEXCEPTION_H_
-#define _NOTYETIMPLEMENTEDEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-#include "Batch_GenericException.hxx"
-
-#include <string>
-
-namespace Batch {
-
- class BATCH_EXPORT NotYetImplementedException : public GenericException
- {
- public:
- // Constructeur
- NotYetImplementedException(std::string ch = "undefined") : GenericException("NotYetImplementedException", ch) {}
- };
-
-}
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Parametre.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include "Batch_Versatile.hxx"
-#include "Batch_InvalidKeyException.hxx"
-#include "Batch_Parametre.hxx"
-
-using namespace std;
-
-// Definition des membres constants statiques
-// Definition des noms globaux pour les clefs en tant que references
-// TODO : supprimer les declarations statiques des clefs de la map
-def_static_MapKey(ACCOUNT);
-def_static_MapKey(ARGUMENTS);
-def_static_MapKey(CHECKPOINT);
-def_static_MapKey(CKPTINTERVAL);
-def_static_MapKey(CREATIONTIME);
-def_static_MapKey(EGROUP);
-def_static_MapKey(ELIGIBLETIME);
-def_static_MapKey(ENDTIME);
-def_static_MapKey(EUSER);
-def_static_MapKey(EXECUTABLE);
-def_static_MapKey(EXECUTIONHOST);
-def_static_MapKey(EXITCODE);
-def_static_MapKey(HOLD);
-def_static_MapKey(ID);
-def_static_MapKey(INFILE);
-def_static_MapKey(MAIL);
-def_static_MapKey(MAXCPUTIME);
-def_static_MapKey(MAXDISKSIZE);
-def_static_MapKey(MAXRAMSIZE);
-def_static_MapKey(MAXWALLTIME);
-def_static_MapKey(MODIFICATIONTIME);
-def_static_MapKey(NAME);
-def_static_MapKey(NBPROC);
-def_static_MapKey(OUTFILE);
-def_static_MapKey(PID);
-def_static_MapKey(QUEUE);
-def_static_MapKey(QUEUEDTIME);
-def_static_MapKey(SERVER);
-def_static_MapKey(STARTTIME);
-def_static_MapKey(STATE);
-def_static_MapKey(TEXT);
-def_static_MapKey(TMPDIR);
-def_static_MapKey(USEDCPUTIME);
-def_static_MapKey(USEDDISKSIZE);
-def_static_MapKey(USEDRAMSIZE);
-def_static_MapKey(USEDWALLTIME);
-def_static_MapKey(USER);
-def_static_MapKey(WORKDIR);
-def_static_MapKey(HOMEDIR);
-
-namespace Batch {
-
- // Constructeur standard
- // La map interne TypeMap possede les memes clefs que la map principale, mais les
- // valeurs associees contiennent le type des clefs de la map principale ainsi que
- // le nombre de valeurs autorisees dans l'objet Versatile (0=nombre quelconque,
- // sinon valeur precisee)
- Parametre::Parametre() : map< string, Versatile >()
- {
- TypeMap[ACCOUNT].type = STRING;
- TypeMap[ACCOUNT].maxelem = 1;
-
- TypeMap[ARGUMENTS].type = STRING;
- TypeMap[ARGUMENTS].maxelem = 0;
-
- TypeMap[CHECKPOINT].type = LONG;
- TypeMap[CHECKPOINT].maxelem = 1;
-
- TypeMap[CKPTINTERVAL].type = LONG;
- TypeMap[CKPTINTERVAL].maxelem = 1;
-
- TypeMap[CREATIONTIME].type = LONG;
- TypeMap[CREATIONTIME].maxelem = 1;
-
- TypeMap[EGROUP].type = STRING;
- TypeMap[EGROUP].maxelem = 1;
-
- TypeMap[ELIGIBLETIME].type = LONG;
- TypeMap[ELIGIBLETIME].maxelem = 1;
-
- TypeMap[ENDTIME].type = LONG;
- TypeMap[ENDTIME].maxelem = 1;
-
- TypeMap[EUSER].type = STRING;
- TypeMap[EUSER].maxelem = 1;
-
- TypeMap[EXECUTABLE].type = STRING;
- TypeMap[EXECUTABLE].maxelem = 1;
-
- TypeMap[EXECUTIONHOST].type = STRING;
- TypeMap[EXECUTIONHOST].maxelem = 0;
-
- TypeMap[EXITCODE].type = LONG;
- TypeMap[EXITCODE].maxelem = 1;
-
- TypeMap[HOLD].type = LONG;
- TypeMap[HOLD].maxelem = 1;
-
- TypeMap[ID].type = STRING;
- TypeMap[ID].maxelem = 1;
-
- TypeMap[INFILE].type = COUPLE;
- TypeMap[INFILE].maxelem = 0;
-
- TypeMap[MAIL].type = STRING;
- TypeMap[MAIL].maxelem = 1;
-
- TypeMap[MAXCPUTIME].type = LONG;
- TypeMap[MAXCPUTIME].maxelem = 1;
-
- TypeMap[MAXDISKSIZE].type = LONG;
- TypeMap[MAXDISKSIZE].maxelem = 1;
-
- TypeMap[MAXRAMSIZE].type = LONG;
- TypeMap[MAXRAMSIZE].maxelem = 1;
-
- TypeMap[MAXWALLTIME].type = LONG;
- TypeMap[MAXWALLTIME].maxelem = 1;
-
- TypeMap[MODIFICATIONTIME].type = LONG;
- TypeMap[MODIFICATIONTIME].maxelem = 1;
-
- TypeMap[NAME].type = STRING;
- TypeMap[NAME].maxelem = 1;
-
- TypeMap[NBPROC].type = LONG;
- TypeMap[NBPROC].maxelem = 1;
-
- TypeMap[OUTFILE].type = COUPLE;
- TypeMap[OUTFILE].maxelem = 0;
-
- TypeMap[PID].type = LONG;
- TypeMap[PID].maxelem = 1;
-
- TypeMap[QUEUE].type = STRING;
- TypeMap[QUEUE].maxelem = 1;
-
- TypeMap[QUEUEDTIME].type = LONG;
- TypeMap[QUEUEDTIME].maxelem = 1;
-
- TypeMap[SERVER].type = STRING;
- TypeMap[SERVER].maxelem = 1;
-
- TypeMap[STARTTIME].type = LONG;
- TypeMap[STARTTIME].maxelem = 1;
-
- TypeMap[STATE].type = STRING;
- TypeMap[STATE].maxelem = 1;
-
- TypeMap[TEXT].type = STRING;
- TypeMap[TEXT].maxelem = 1;
-
- TypeMap[TMPDIR].type = STRING;
- TypeMap[TMPDIR].maxelem = 1;
-
- TypeMap[USEDCPUTIME].type = LONG;
- TypeMap[USEDCPUTIME].maxelem = 1;
-
- TypeMap[USEDDISKSIZE].type = LONG;
- TypeMap[USEDDISKSIZE].maxelem = 1;
-
- TypeMap[USEDRAMSIZE].type = LONG;
- TypeMap[USEDRAMSIZE].maxelem = 1;
-
- TypeMap[USEDWALLTIME].type = LONG;
- TypeMap[USEDWALLTIME].maxelem = 1;
-
- TypeMap[USER].type = STRING;
- TypeMap[USER].maxelem = 1;
-
- TypeMap[WORKDIR].type = STRING;
- TypeMap[WORKDIR].maxelem = 1;
-
- TypeMap[HOMEDIR].type = STRING;
- TypeMap[HOMEDIR].maxelem = 1;
- }
-
- // Operateur de recherche dans la map
- // Cet operateur agit sur les objets NON CONSTANTS, il autorise la modification de
- // la valeur associée à la clef car il retourne une reference non constante
- Versatile & Parametre::operator [] (const string & mk)
- {
- // On controle que la clef est valide
- if (TypeMap.find(mk) == TypeMap.end()) throw InvalidKeyException(mk.c_str());
-
- // On recherche la valeur associee...
- Versatile & V = map< string, Versatile >::operator [] (mk);
-
- // ... et on l'initialise systematiquement
- // ATTENTION : si un probleme de type survient (ie, on stocke une valeur d'un type
- // different de celui inscrit dans TypeMap) une exception TypeMismatchException est
- // levee
- V.setName(mk);
- V.setType(TypeMap[mk].type);
- V.setMaxSize(TypeMap[mk].maxelem);
-
- return V;
- }
-
- // Operateur de recherche dans la map
- // Cet operateur agit sur les objets CONSTANTS
- const Versatile & Parametre::operator [] (const string & mk) const
- {
- // On controle que la clef est valide
- if (TypeMap.find(mk) == TypeMap.end()) throw InvalidKeyException(mk.c_str());
-
- // On recherche la valeur associee
- Parametre::const_iterator it = find(mk);
- if (it == end()) throw InvalidKeyException(mk.c_str());
- const Versatile & V = (*it).second;
-
- return V;
- }
-
- // Operateur d'affectation
- Parametre & Parametre::operator =(const Parametre & PM)
- {
- // On ne reaffecte pas l'objet a lui-meme, sinon aie, aie, aie
- if (this == &PM) return *this;
-
- // On efface toute la map
- erase(begin(), end());
-
- // On recopie la map interne
- // Meme si cela ne sert a rien pour le moment car les maps internes sont identiques,
- // il n'est pas exclu que dans un avenir proche elles puissent etre differentes
- (*this).TypeMap = PM.TypeMap;
-
- // On recree la structure interne de la map avec les valeurs de celle passee en argument
- Parametre::const_iterator it;
- for(it=PM.begin(); it!=PM.end(); it++)
- insert(make_pair( (*it).first ,
- Versatile( (*it).second)
- ) );
-
- return *this;
- }
-
- // Constructeur par recopie
- Parametre::Parametre(const Parametre & PM)
- {
- // inutile car l'objet est vierge : il vient d'etre cree
- // On efface toute la map
- // erase(begin(), end());
-
- // On recopie la map interne
- (*this).TypeMap = PM.TypeMap;
-
- // On cree la structure interne de la map avec les valeurs de celle passee en argument
- Parametre::const_iterator it;
- for(it=PM.begin();
- it!=PM.end();
- it++)
- insert(
- make_pair(
- (*it).first ,
- Versatile( (*it).second)
- ) );
- }
-
- // map< string, TypeParam > Parametre::getTypeMap() const
- // {
- // return TypeMap;
- // }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Parametre.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _PARAMETRE_H_
-#define _PARAMETRE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <map>
-#include <string>
-#include "Batch_InvalidKeyException.hxx"
-#include "Batch_Versatile.hxx"
-
-// Ces macros permettent de simplifier l'ajout de nouvelles
-// clefs dans la map Parametre
-// TODO : remplacer ce mecanisme statique par la lecture
-// TODO : d'une descrption dans un fichier exterieur (genre XML)
-
-#define def_extern_MapKey(mk) extern BATCH_EXPORT const std::string & mk;
-#define def_static_MapKey(mk) const std::string Batch::Parametre::mk(#mk); \
- const std::string & mk = Batch::Parametre::mk;
-
-namespace Batch {
-
- class BATCH_EXPORT Parametre : public std::map< std::string, Versatile >
- {
- public:
- // Constructeur standard
- Parametre();
-
- // Constructeur par recopie
- Parametre(const Parametre & PM);
-
- // Operateur de recherche dans la map
- Versatile & operator [] (const std::string &);
- const Versatile & operator [] (const std::string &) const;
-
- // Operateur d'affectation
- Parametre & operator =(const Parametre & PM);
-
- // Declarations statique des clefs de la map
- // TODO : supprimer les declarations statiques des clefs de la map
- static const std::string ACCOUNT;
- static const std::string ARGUMENTS;
- static const std::string CHECKPOINT;
- static const std::string CKPTINTERVAL;
- static const std::string CREATIONTIME;
- static const std::string EGROUP;
- static const std::string ELIGIBLETIME;
- static const std::string ENDTIME;
- static const std::string EUSER;
- static const std::string EXECUTABLE;
- static const std::string EXECUTIONHOST;
- static const std::string EXITCODE;
- static const std::string HOLD;
- static const std::string ID;
- static const std::string INFILE;
- static const std::string MAIL;
- static const std::string MAXCPUTIME;
- static const std::string MAXDISKSIZE;
- static const std::string MAXRAMSIZE;
- static const std::string MAXWALLTIME;
- static const std::string MODIFICATIONTIME;
- static const std::string NAME;
- static const std::string NBPROC;
- static const std::string OUTFILE;
- static const std::string PID;
- static const std::string QUEUE;
- static const std::string QUEUEDTIME;
- static const std::string SERVER;
- static const std::string STARTTIME;
- static const std::string STATE;
- static const std::string TEXT;
- static const std::string TMPDIR;
- static const std::string USEDCPUTIME;
- static const std::string USEDDISKSIZE;
- static const std::string USEDRAMSIZE;
- static const std::string USEDWALLTIME;
- static const std::string USER;
- static const std::string WORKDIR;
- static const std::string HOMEDIR;
-
- protected:
- std::map< std::string, TypeParam > TypeMap; // map interne servant a controler le type de la valeur associee a chaque clef
-
- private:
-
- };
-
-}
-
-def_extern_MapKey(ACCOUNT);
-def_extern_MapKey(ARGUMENTS);
-def_extern_MapKey(CHECKPOINT);
-def_extern_MapKey(CKPTINTERVAL);
-def_extern_MapKey(CREATIONTIME);
-def_extern_MapKey(EGROUP);
-def_extern_MapKey(ELIGIBLETIME);
-def_extern_MapKey(ENDTIME);
-def_extern_MapKey(EUSER);
-def_extern_MapKey(EXECUTABLE);
-def_extern_MapKey(EXECUTIONHOST);
-def_extern_MapKey(EXITCODE);
-def_extern_MapKey(HOLD);
-def_extern_MapKey(ID);
-def_extern_MapKey(INFILE);
-def_extern_MapKey(MAIL);
-def_extern_MapKey(MAXCPUTIME);
-def_extern_MapKey(MAXDISKSIZE);
-def_extern_MapKey(MAXRAMSIZE);
-def_extern_MapKey(MAXWALLTIME);
-def_extern_MapKey(MODIFICATIONTIME);
-def_extern_MapKey(NAME);
-def_extern_MapKey(NBPROC);
-def_extern_MapKey(OUTFILE);
-def_extern_MapKey(PID);
-def_extern_MapKey(QUEUE);
-def_extern_MapKey(QUEUEDTIME);
-def_extern_MapKey(SERVER);
-def_extern_MapKey(STARTTIME);
-def_extern_MapKey(STATE);
-def_extern_MapKey(TEXT);
-def_extern_MapKey(TMPDIR);
-def_extern_MapKey(USEDCPUTIME);
-def_extern_MapKey(USEDDISKSIZE);
-def_extern_MapKey(USEDRAMSIZE);
-def_extern_MapKey(USEDWALLTIME);
-def_extern_MapKey(USER);
-def_extern_MapKey(WORKDIR);
-def_extern_MapKey(HOMEDIR);
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * PyVersatile.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Mon Oct 13 12:01:12 2003
- * Projet : Salome 2
- *
- */
-
-#include <Python.h>
-#include "Batch_TypeMismatchException.hxx"
-#include "Batch_ListIsFullException.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-#include "Batch_PyVersatile.hxx"
-#include <string>
-
-using namespace std;
-
-namespace Batch {
-
- // Constructeur a partir d'un objet Versatile
- PyVersatile::PyVersatile(const Versatile & V) : Versatile(V)
- {
- // Nothing to do
- }
-
-
- // Constructeur a partir d'un PyObject
- // Les objets autorises sont les strings et les ints,
- // ainsi que les listes de strings
- PyVersatile::PyVersatile(const PyObject * PyO) throw(TypeMismatchException, ListIsFullException, InvalidArgumentException) : Versatile()
- {
- PyObject * _PyO = const_cast<PyObject *>(PyO);
-
- if (PyList_Check(_PyO)) { // c'est une liste
- _maxsize = PyList_Size(_PyO);
- for(int i=0; i<_maxsize; i++) {
- PyObject * val = PyList_GetItem(_PyO, i);
- if (PyString_Check(val)) {
- *this += PyString_AsString(val);
-
- } else if (PyTuple_Check(val) &&
- (PyTuple_Size(val) == 2) &&
- PyString_Check( PyTuple_GetItem(val,0) ) &&
- PyString_Check( PyTuple_GetItem(val,1) ) ) {
- *this += Couple( PyString_AsString( PyTuple_GetItem(val,0) ),
- PyString_AsString( PyTuple_GetItem(val,1) )
- );
-
- } else {
- PyErr_SetString(PyExc_RuntimeWarning, "PyVersatile::PyVersatile(const PyObject * PyO) : invalid PyObject");
- }
- }
-
- } else if (PyString_Check(_PyO)) { // c'est une string
- const char * s = PyString_AsString(_PyO);
- Versatile V = string(s);
- *this = V;
-
- } else if (PyInt_Check(_PyO)) { // c'est un int
- *this = PyInt_AsLong(_PyO);
-
- } else { // erreur
- PyErr_SetString(PyExc_RuntimeWarning, "PyVersatile::PyVersatile(const PyObject * PyO) : invalid PyObject");
- }
- }
-
-
-
- // Conversion de type vers un PyObject
- PyVersatile::operator PyObject *() const
- {
- PyObject * obj;
-
- if (_maxsize != 1) { // une liste
- obj = PyList_New(0);
- for(Versatile::const_iterator it=begin(); it!=end(); it++) {
-// char ch[2] = {0, 0};
- string st;
- Couple cp;
-// PyObject * tuple;
- switch (_discriminator) {
- // case BOOL:
- // PyList_Append(obj, PyInt_FromLong(* static_cast<BoolType *>(*it)));
- // break;
-
- // case CHAR:
- // *ch = * static_cast<CharType *>(*it);
- // PyList_Append(obj, PyString_FromString(ch));
- // break;
-
- // case INT:
- // PyList_Append(obj, PyInt_FromLong(* static_cast<IntType *>(*it)));
- // break;
-
- case LONG:
- PyList_Append(obj, PyInt_FromLong(* static_cast<LongType *>(*it)));
- break;
-
- case STRING:
- st = * static_cast<StringType *>(*it);
- PyList_Append(obj, PyString_FromString(st.c_str()));
- break;
-
- case COUPLE:
- cp = * static_cast<CoupleType *>(*it);
-// tuple = PyTuple_New(2);
-// PyTuple_SetItem(tuple, 0, PyString_FromString( cp.getLocal().c_str() ) );
-// PyTuple_SetItem(tuple, 1, PyString_FromString( cp.getRemote().c_str() ) );
-// PyList_Append(obj, tuple);
- PyList_Append(obj, Py_BuildValue("(ss)", cp.getLocal().c_str(), cp.getRemote().c_str() ));
- break;
-
- case UNDEFINED:
- PyList_Append(obj, Py_None);
- break;
- }
-
- }
-
- } else { // un scalaire
-// char ch[2] = {0, 0};
- string st;
- Couple cp;
-// PyObject * tuple;
- switch (_discriminator) {
- // case BOOL:
- // obj = PyInt_FromLong(* static_cast<BoolType *>(front()));
- // break;
-
- // case CHAR:
- // *ch = * static_cast<CharType *>(front());
- // obj = PyString_FromString(ch);
- // break;
-
- // case INT:
- // obj = PyInt_FromLong(* static_cast<IntType *>(front()));
- // break;
-
- case LONG:
- obj = PyInt_FromLong(* static_cast<LongType *>(front()));
- break;
-
- case STRING:
- st = * static_cast<StringType *>(front());
- obj = PyString_FromString(st.c_str());
- break;
-
- case COUPLE:
- cp = * static_cast<CoupleType *>(front());
-// tuple = PyTuple_New(2);
-// PyTuple_SetItem(tuple, 0, PyString_FromString( cp.getLocal().c_str() ) );
-// PyTuple_SetItem(tuple, 1, PyString_FromString( cp.getRemote().c_str() ) );
-// obj = PyList_New(0);
-// PyList_Append(obj, tuple);
- obj = Py_BuildValue("[(ss)]", cp.getLocal().c_str(), cp.getRemote().c_str() );
- break;
-
- case UNDEFINED:
- obj = Py_None;
- break;
- }
- }
-
- return obj;
- }
-
-
- // Operateur d'affectation a partir d'un objet Versatile
- PyVersatile & PyVersatile::operator =(const Versatile & V)
- {
- Versatile * me = this;
- *me = V;
- return *this;
- }
-
-}
-
-
-// COMMENTS
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * PyVersatile.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Mon Oct 13 12:01:12 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _PYVERSATILE_H_
-#define _PYVERSATILE_H_
-
-
-#include "Batch_Defines.hxx"
-
-#include <Python.h>
-#include "Batch_Versatile.hxx"
-#include "Batch_TypeMismatchException.hxx"
-#include "Batch_ListIsFullException.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT PyVersatile : public Versatile
- {
- public:
- // Constructeur a partir d'un objet Versatile
- PyVersatile(const Versatile &);
-
- // Constructeur a partir d'un PyObject
- PyVersatile(const PyObject *) throw(TypeMismatchException, ListIsFullException, InvalidArgumentException);
-
- // Conversion de type vers un PyObject
- operator PyObject *() const;
-
- // Operateur d'affectation a partir d'un objet Versatile
- PyVersatile & operator =(const Versatile &);
-
- protected:
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * RunTimeException.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Tue Nov 25 14:04:13 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_RunTimeException.hxx"
-using namespace std;
-
-namespace Batch {
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * RunTimeException.hxx :
- *
- * Auteur : %author% - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Tue Nov 25 14:04:13 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _RUNTIMEEXCEPTION_H_
-#define _RUNTIMEEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT RunTimeException : public GenericException
- {
- public:
- // Constructeur
- RunTimeException(std::string ch = "undefined") : GenericException("RunTimeException", ch) {}
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * StringType.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include <assert.h>
-#include "Batch_StringType.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Conversion en chaine
- string StringType::affiche() const
- {
- return _data;
- }
-
- // Operateur d'affectation
- StringType & StringType::operator =(string s)
- {
- _data = s;
- return *this;
- }
-
- // Conversion en chaine
- StringType::operator string() const
- {
- return this->_data;
- }
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- GenericType * StringType::clone() const
- {
- StringType * pS = new StringType(this->_data);
- assert(pS != 0);
- return pS;
- }
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * StringType.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _STRINGTYPE_H_
-#define _STRINGTYPE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include "Batch_GenericType.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT StringType : public GenericType
- {
- public:
- // Constructeur
- StringType(const std::string & s="") : _data(s) {}
-
- // Conversion en chaine
- virtual std::string affiche() const;
- virtual operator std::string() const;
-
- // Operateur d'affectation
- virtual StringType & operator =(std::string);
-
- // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
- // qu'il faudra detruire ensuite manuellement
- virtual GenericType * clone() const;
-
- protected:
- std::string _data;
-
- private:
-
- };
-
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * TypeMismatchException.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include "Batch_TypeMismatchException.hxx"
-using namespace std;
-
-namespace Batch {
-
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * TypeMismatchException.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _TYPEMISMATCHEXCEPTION_H_
-#define _TYPEMISMATCHEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
- class BATCH_EXPORT TypeMismatchException : public GenericException
- {
- public:
- // Constructeur
- TypeMismatchException(std::string ch = "undefined") : GenericException("TypeMismatchException", ch) {}
- };
-
-}
-
-#endif
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Versatile.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include <iostream>
-#include <list>
-#include <string>
-#include <sstream>
-#include <assert.h>
-//#include "MEDMEM_STRING.hxx"
-#include "Batch_GenericType.hxx"
-#include "Batch_IntType.hxx"
-#include "Batch_BoolType.hxx"
-#include "Batch_CharType.hxx"
-#include "Batch_LongType.hxx"
-#include "Batch_StringType.hxx"
-#include "Batch_Versatile.hxx"
-#include "Batch_TypeMismatchException.hxx"
-#include "Batch_ListIsFullException.hxx"
-using namespace std;
-
-namespace Batch {
-
- // Constructeur par recopie
- Versatile::Versatile(const Versatile & V) : _discriminator(V._discriminator), _maxsize(V._maxsize), _name(V._name) // , _str_value(0)
- {
- Versatile::const_iterator it;
-
- // On prend un a un les elements de l'objet passe en argument qu'on duplique
- for(it=V.begin(); it!=V.end(); it++)
- push_back( (*it)->clone() ); // Attention, la methode clone fait un new implicite
- }
-
- // Destructeur
- Versatile::~Versatile()
- {
- eraseAll();
- }
-
- // Operateur d'affectation entre objets
- Versatile & Versatile::operator = (const Versatile & Vrhs) throw(TypeMismatchException)
- {
- // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit
- setType(Vrhs._discriminator);
- setMaxSize(Vrhs._maxsize);
- _name = Vrhs._name;
-
- // On efface les donnees precedentes
- eraseAll();
-
- // On copie les donnees de Vrhs
- Versatile::const_iterator it;
-
- for(it=Vrhs.begin(); it!=Vrhs.end(); it++)
- push_back( (*it)->clone() ); // Attention, la methode clone fait un new implicite
-
- return *this;
- }
-
- // Operateur d'affectation a partir d'un long
- Versatile & Versatile::operator = (const long l) throw(TypeMismatchException)
- {
- // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit
- setType(LONG);
-
- // On efface les donnees precedentes
- eraseAll();
-
- // On ajoute un element interne de type long a l'objet
- LongType * pL = new LongType(l);
- assert(pL != 0);
- push_back(pL);
- return *this;
- }
-
- // Operateur d'affectation a partir d'une string
- Versatile & Versatile::operator = (const string & ch) throw(TypeMismatchException)
- {
- // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit
- setType(STRING);
-
- // On efface les donnees precedentes
- eraseAll();
-
- // On ajoute un element interne de type string a l'objet
- StringType * pS = new StringType(ch);
- assert(pS != 0);
- push_back(pS);
-
- return *this;
- }
-
- // Operateur de concatenation a partir d'une string
- Versatile & Versatile::operator +=(const string & ch) throw(TypeMismatchException,ListIsFullException)
- {
- // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit
- setType(STRING);
-
- // Si la taille maximale est atteinte, on leve une exception ListIsFullException
- if (_maxsize == 0) push_back(new StringType(ch));
- else if ((_maxsize > 0) && (size() < _maxsize)) push_back(new StringType(ch));
- else {
- //MEDMEM::STRING msg;
- ostringstream msg;
- msg << "Taille maximum : " << _maxsize;
- throw(ListIsFullException(msg.str()));
- }
- return *this;
- }
-
- // Operateur de concatenation a partir d'une string
- Versatile & Versatile::operator , (const string & ch) throw(TypeMismatchException,ListIsFullException)
- {
- *this += ch;
- return *this;
- }
-
- // Operateur d'affectation a partir d'un Couple
- Versatile & Versatile::operator = (const Couple & cp) throw(TypeMismatchException)
- {
- // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit
- setType(COUPLE);
-
- // On efface les donnees precedentes
- eraseAll();
-
- // On ajoute un element interne de type Couple a l'objet
- CoupleType * pC = new CoupleType(cp);
- assert(pC != 0);
- push_back(pC);
-
- return *this;
- }
-
- // Operateur de concatenation a partir d'un Couple
- Versatile & Versatile::operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException)
- {
- // ATTENTION : le forçage de type leve une exception TypeMismatchException entre cas de conflit
- setType(COUPLE);
-
- // Si la taille maximale est atteinte, on leve une exception ListIsFullException
- if (_maxsize == 0) push_back(new CoupleType(cp));
- else if ((_maxsize > 0) && (size() < _maxsize)) push_back(new CoupleType(cp));
- else {
- //MEDMEM::STRING msg;
- ostringstream msg;
- msg << "Taille maximum : " << _maxsize;
- throw(ListIsFullException(msg.str()));
- }
- return *this;
- }
-
- // Operateur de concatenation a partir d'un Couple
- Versatile & Versatile::operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException)
- {
- *this += cp;
- return *this;
- }
-
- ostream & operator << (ostream & os, const Versatile & V)
- {
- Versatile::const_iterator it;
- const char * sep = "";
-
- for(it=V.begin(); it!=V.end(); it++, sep=" ") {
- string s = (*it)->affiche();
- os << sep << s;
- }
- return os;
- }
-
- // Positionnement du type de l'element interne
- void Versatile::setType(DiscriminatorType t) throw(TypeMismatchException)
- {
- // Si le type est deja defini et ne correspond pas au type en argument
- // une exception TypeMismatchException est levee
- if ( (_discriminator == UNDEFINED) || (_discriminator == t) )
- _discriminator = t;
- else {
- //MEDMEM::STRING sst;
- ostringstream sst;
- sst << "Trying to change type of Versatile object \""
- << _name << "\"";
- throw(TypeMismatchException(sst.str()));
- }
- }
-
- // Positionnement du nombre d'elements internes
- void Versatile::setMaxSize(int i)
- {
- _maxsize = i;
- if (i <= 0) return;
- // Si la nouvelle taille est inferieure au nombre d'elements deja
- // presents, les elements en surplus sont effaces (troncature)
- if (size() > _maxsize)
- {
- int reste = size() - _maxsize;
- Versatile::iterator it;
- for(it=end(); (it!=begin()) && reste; it--, reste--)
- {
- delete back();
- pop_back();
- }
- }
- }
-
-
- // Conversion de type vers un long
- Versatile::operator long() const throw(TypeMismatchException)
- {
- // Si le type ne correspond pas ou si la liste contient plus d'un element,
- // la conversion est impossible et une exception TypeMismatchException
- // est levee
- if ( (_maxsize != 1) || (_discriminator != LONG) || (size() == 0) ) {
- //MEDMEM::STRING sst;
- ostringstream sst;
- sst << "Cannot cast Versatile object \""
- << _name << "\" to long";
- throw(TypeMismatchException(sst.str()));
- }
- return *( static_cast<LongType *>(this->front()) );
- }
-
- // Conversion de type vers un Couple
- Versatile::operator Couple() const throw(TypeMismatchException)
- {
- // Si le type ne correspond pas ou si la liste contient plus d'un element,
- // la conversion est impossible et une exception TypeMismatchException
- // est levee
- if ( (_maxsize != 1) || (_discriminator != COUPLE) || (size() == 0) ) {
- //MEDMEM::STRING sst;
- ostringstream sst;
- sst << "Cannot cast Versatile object \""
- << _name << "\" to Couple";
- throw(TypeMismatchException(sst.str()));
- }
- return *( static_cast<CoupleType *>(this->front()) );
- }
-
- // Conversion de type vers une string
- string Versatile::str() const throw(TypeMismatchException)
- {
- // Si le type ne correspond pas, la conversion est impossible et
- // une exception TypeMismatchException est levee
- if ( (_discriminator != STRING) || (size() == 0) ) {
- //MEDMEM::STRING sst;
- ostringstream sst;
- sst << "Cannot cast Versatile object \""
- << _name << "\" to string";
- throw(TypeMismatchException(sst.str()));
- }
-
- // La chaine renvoyee est la concatenation des chaines internes
- string s;
- Versatile::const_iterator it;
- const char * sep = "";
- for(it=begin(); it!=end(); it++, s+=sep, sep=" ")
- s += *( static_cast<StringType *>(*it));
-
- return s;
- }
-
- // Conversion de type vers une string
- Versatile::operator string () const throw(TypeMismatchException)
- {
- return str();
- }
-
- // Efface tous les elements internes de l'objet
- void Versatile::eraseAll()
- {
- while(!empty())
- {
- delete back();
- pop_back();
- }
- }
-
-
- // Recuperation du type de l'element interne
- DiscriminatorType Versatile::getType() const
- {
- return _discriminator;
- }
-
- // Recuperation du nom de l'objet
- string Versatile::getName() const
- {
- return _name;
- }
-
- // Positionnement du nom de l'objet
- void Versatile::setName(const string & name)
- {
- _name = name;
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Versatile.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _VERSATILE_H_
-#define _VERSATILE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <iostream>
-#include <list>
-#include <string>
-#include "Batch_GenericType.hxx"
-#include "Batch_IntType.hxx"
-#include "Batch_BoolType.hxx"
-#include "Batch_CharType.hxx"
-#include "Batch_LongType.hxx"
-#include "Batch_StringType.hxx"
-#include "Batch_CoupleType.hxx"
-#include "Batch_TypeMismatchException.hxx"
-#include "Batch_ListIsFullException.hxx"
-
-namespace Batch {
-
- // Les types autorises
- // enum DiscriminatorType { UNDEFINED, BOOL, CHAR, INT, LONG, STRING};
- enum DiscriminatorType { UNDEFINED, LONG, STRING, COUPLE };
-
- typedef struct {
- DiscriminatorType type; // le type de l'element interne
- int maxelem; // le nombre d'elements autorises
- } TypeParam;
-
- class BATCH_EXPORT Versatile : public std::list< GenericType * >
- {
- public:
- // Constructeur standard et destructeur
- Versatile() : _discriminator(UNDEFINED), _maxsize(1), _name("undefined") {}
- virtual ~Versatile();
-
- // Constructeur par recopie
- Versatile(const Versatile & V);
-
- // Constructeur depuis le type de "base"
- Versatile(long l) : _discriminator(LONG), _maxsize(1), _name("long") { push_back(new LongType(l)); }
- Versatile(const std::string & s) : _discriminator(STRING), _maxsize(1), _name("string") { push_back(new StringType(s)); }
- Versatile(const Couple & c) : _discriminator(COUPLE), _maxsize(1), _name("couple") { push_back(new CoupleType(c)); }
-
- // Operateur d'affectation et de concatenation a partir d'un type de "base"
- Versatile & operator = (const long l) throw(TypeMismatchException);
- Versatile & operator = (const std::string & ch) throw(TypeMismatchException);
- Versatile & operator +=(const std::string & ch) throw(TypeMismatchException,ListIsFullException);
- Versatile & operator , (const std::string & ch) throw(TypeMismatchException,ListIsFullException);
- Versatile & operator = (const Couple & cp) throw(TypeMismatchException);
- Versatile & operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException);
- Versatile & operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException);
-
- // Operateur d'affectation entre objets
- Versatile & operator = (const Versatile & V) throw(TypeMismatchException);
-
- // Conversion de type vers un type de "base"
- operator long() const throw(TypeMismatchException);
- operator std::string() const throw(TypeMismatchException);
- operator Couple() const throw(TypeMismatchException);
- std::string str() const throw(TypeMismatchException);
-
- // Operateur pour l'affichage sur un stream
- friend std::ostream & operator << (std::ostream & os, const Versatile & );
-
- // Positionnement et recuperation du type de l'element interne
- void setType(DiscriminatorType) throw(TypeMismatchException);
- DiscriminatorType getType() const;
-
- // Positionnement et recuperation du nombre d'elements internes
- void setMaxSize(int i);
- int getMaxSize() const { return _maxsize; }
-
- // Positionnement et recuperation du nom de l'objet
- std::string getName() const;
- void setName(const std::string & name);
-
- protected:
- // Efface tous les elements internes de l'objet
- virtual void eraseAll();
-
- DiscriminatorType _discriminator; // type de l'element interne
- int _maxsize; // nombre max d'elements internes
- std::string _name; // nom de l'objet (sert pour les exceptions)
-
- private:
-
- };
-
-}
-
-#endif
-
+++ /dev/null
-# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-####################################### library
-# SALOME Container : implementation of container and engine for Kernel
-# File : Makefile.in
-# Author : EDF
-# Module : SALOME
-# $Header$
-#
-include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-
-# header files
-LIB_INCLUDES = \
- Batch_APIInternalFailureException.hxx \
- Batch_BatchManager.hxx \
- Batch_BatchManagerCatalog.hxx \
- Batch_BoolType.hxx \
- Batch_CharType.hxx \
- Batch_ConnexionFailureException.hxx \
- Batch_Couple.hxx \
- Batch_CoupleType.hxx \
- Batch_Date.hxx \
- Batch_DateType.hxx \
- Batch_Environnement.hxx \
- Batch_FactBatchManager.hxx \
- Batch_GenericException.hxx \
- Batch_GenericType.hxx \
- Batch_IntType.hxx \
- Batch_InvalidArgumentException.hxx \
- Batch_InvalidKeyException.hxx \
- Batch_Job.hxx \
- Batch_JobId.hxx \
- Batch_JobInfo.hxx \
- Batch_ListIsFullException.hxx \
- Batch_LongType.hxx \
- Batch_MapKey.hxx \
- Batch_NotYetImplementedException.hxx \
- Batch_Parametre.hxx \
- Batch_PyVersatile.hxx \
- Batch_RunTimeException.hxx \
- Batch_StringType.hxx \
- Batch_TypeMismatchException.hxx \
- Batch_BatchManager_eClient.hxx \
- Batch_FactBatchManager_eClient.hxx \
- Batch_BatchManager_eLSF.hxx \
- Batch_FactBatchManager_eLSF.hxx \
- Batch_JobInfo_eLSF.hxx \
- Batch_BatchManager_ePBS.hxx \
- Batch_FactBatchManager_ePBS.hxx \
- Batch_JobInfo_ePBS.hxx \
- MpiImpl.hxx \
- Batch_Defines.hxx \
- Batch_BatchManager_eSGE.hxx \
- Batch_FactBatchManager_eSGE.hxx \
- Batch_JobInfo_eSGE.hxx \
- MpiImpl.hxx
-
-
-LIB_SRC = \
- Batch_APIInternalFailureException.cxx \
- Batch_BatchManager.cxx \
- Batch_BatchManagerCatalog.cxx \
- Batch_BoolType.cxx \
- Batch_CharType.cxx \
- Batch_ConnexionFailureException.cxx \
- Batch_Couple.cxx \
- Batch_CoupleType.cxx \
- Batch_Date.cxx \
- Batch_DateType.cxx \
- Batch_Environnement.cxx \
- Batch_FactBatchManager.cxx \
- Batch_GenericException.cxx \
- Batch_GenericType.cxx \
- Batch_IntType.cxx \
- Batch_InvalidArgumentException.cxx \
- Batch_InvalidKeyException.cxx \
- Batch_Job.cxx \
- Batch_JobId.cxx \
- Batch_JobInfo.cxx \
- Batch_ListIsFullException.cxx \
- Batch_LongType.cxx \
- Batch_MapKey.cxx \
- Batch_NotYetImplementedException.cxx \
- Batch_Parametre.cxx \
- Batch_PyVersatile.cxx \
- Batch_RunTimeException.cxx \
- Batch_StringType.cxx \
- Batch_TypeMismatchException.cxx \
- Batch_BatchManager_eClient.cxx \
- Batch_FactBatchManager_eClient.cxx \
- Batch_BatchManager_eLSF.cxx \
- Batch_FactBatchManager_eLSF.cxx \
- Batch_JobInfo_eLSF.cxx \
- Batch_BatchManager_ePBS.cxx \
- Batch_FactBatchManager_ePBS.cxx \
- Batch_JobInfo_ePBS.cxx \
- Batch_BatchManager_eSGE.cxx \
- Batch_FactBatchManager_eSGE.cxx \
- Batch_JobInfo_eSGE.cxx \
- MpiImpl.cxx
-
-
-LIB_CPPFLAGS = \
- ${PYTHON_INCLUDES}
-if !WITHONLYLAUNCHER
- LIB_CPPFLAGS += \
- -I$(srcdir)/../Basics \
- -I$(top_builddir)/salome_adm/unix
-endif
-
-LIB_LIBADD =
-if !WITHONLYLAUNCHER
- LIB_LIBADD += \
- ../Basics/libSALOMEBasics.la
-endif
-
-LIB_LIBADD += $(PYTHON_LIBS)
-
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# Special add for local batch system
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-if WITH_LOCAL
-LIB_INCLUDES +=\
- Batch_Versatile.hxx \
- Batch_BatchManager_Local.hxx \
- Batch_BatchManager_Local_RSH.hxx \
- Batch_BatchManager_Local_SH.hxx \
- Batch_BatchManager_Local_SSH.hxx \
- Batch_FactBatchManager_Local.hxx \
- Batch_FactBatchManager_Local_RSH.hxx \
- Batch_FactBatchManager_Local_SH.hxx \
- Batch_FactBatchManager_Local_SSH.hxx \
- Batch_JobInfo_Local.hxx \
- Batch_Job_Local.hxx \
- Batch_IOMutex.hxx
-
-LIB_SRC +=\
- Batch_Versatile.cxx \
- Batch_BatchManager_Local.cxx \
- Batch_BatchManager_Local_RSH.cxx \
- Batch_BatchManager_Local_SH.cxx \
- Batch_BatchManager_Local_SSH.cxx \
- Batch_FactBatchManager_Local.cxx \
- Batch_FactBatchManager_Local_RSH.cxx \
- Batch_FactBatchManager_Local_SH.cxx \
- Batch_FactBatchManager_Local_SSH.cxx \
- Batch_JobInfo_Local.cxx \
- Batch_Job_Local.cxx \
- Batch_IOMutex.cxx
-
-if !WITHONLYLAUNCHER
- LIB_CPPFLAGS += -DHAVE_CONFIG_H
-endif
-
-endif
-
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# Special add for openpbs batch system
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-if WITH_OPENPBS
-LIB_INCLUDES += \
- Batch_BatchManager_PBS.hxx \
- Batch_FactBatchManager_PBS.hxx \
- Batch_JobInfo_PBS.hxx \
- Batch_Job_PBS.hxx
-
-LIB_SRC +=\
- Batch_BatchManager_PBS.cxx \
- Batch_FactBatchManager_PBS.cxx \
- Batch_JobInfo_PBS.cxx \
- Batch_Job_PBS.cxx
-
-LIB_CPPFLAGS += @OPENPBS_INCLUDES@
-LIB_LIBADD += @OPENPBS_LIBDIR@ @OPENPBS_LIBS@
-
-endif
-
-#
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# Special add for lsf batch system
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#
-if WITH_LSF
-LIB_INCLUDES += \
- Batch_BatchManager_LSF.hxx \
- Batch_FactBatchManager_LSF.hxx \
- Batch_JobInfo_LSF.hxx \
- Batch_Job_LSF.hxx
-
-LIB_SRC += \
- Batch_BatchManager_LSF.cxx \
- Batch_FactBatchManager_LSF.cxx \
- Batch_JobInfo_LSF.cxx \
- Batch_Job_LSF.cxx
-
-LIB_CPPFLAGS += ${LSF_INCLUDES}
-LIB_LIBADD += ${LSF_LDFLAGS} ${LSF_LIBS}
-endif
-
-
-
-
-salomeinclude_HEADERS = $(LIB_INCLUDES)
-
-#
-# ===============================================================
-# Libraries targets
-# ===============================================================
-#
-lib_LTLIBRARIES = libSalomeBatch.la
-libSalomeBatch_la_SOURCES = $(LIB_SRC)
-libSalomeBatch_la_CPPFLAGS = ${LIB_CPPFLAGS}
-libSalomeBatch_la_LDFLAGS = -no-undefined -version-info=0:0:0
-libSalomeBatch_la_LIBADD = $(LIB_LIBADD)
+++ /dev/null
-// 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 <iostream>
-#include <sstream>
-#include <string>
-#include "MpiImpl.hxx"
-
-using namespace std;
-
-// Constructor
-MpiImpl::MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl::~MpiImpl()
-{
-}
-
-// lam implementation
-// Constructor
-MpiImpl_LAM::MpiImpl_LAM() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_LAM::~MpiImpl_LAM()
-{
-}
-
-string MpiImpl_LAM::size()
-{
- return "${LAMWORLD}";
-}
-
-string MpiImpl_LAM::rank()
-{
- return "${LAMRANK}";
-}
-
-string MpiImpl_LAM::boot(const string machinefile, const unsigned int nbnodes)
-{
- ostringstream oss;
- oss << "lamboot " << machinefile << endl;
- return oss.str();
-}
-
-string MpiImpl_LAM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
- ostringstream oss;
- oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
- return oss.str();
-}
-
-string MpiImpl_LAM::halt()
-{
- ostringstream oss;
- oss << "lamhalt" << endl;
- return oss.str();
-}
-
-// mpich1 implementation
-// Constructor
-MpiImpl_MPICH1::MpiImpl_MPICH1() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_MPICH1::~MpiImpl_MPICH1()
-{
-}
-
-string MpiImpl_MPICH1::size()
-{
- return "${MPIRUN_NPROCS}";
-}
-
-string MpiImpl_MPICH1::rank()
-{
- return "${MPIRUN_RANK}";
-}
-
-string MpiImpl_MPICH1::boot(const string machinefile, const unsigned int nbnodes)
-{
- return "";
-}
-
-string MpiImpl_MPICH1::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
- ostringstream oss;
- oss << "mpirun -machinefile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
- return oss.str();
-}
-
-string MpiImpl_MPICH1::halt()
-{
- return "";
-}
-
-// mpich2 implementation
-// Constructor
-MpiImpl_MPICH2::MpiImpl_MPICH2() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_MPICH2::~MpiImpl_MPICH2()
-{
-}
-
-string MpiImpl_MPICH2::size()
-{
- return "${PMI_SIZE}";
-}
-
-string MpiImpl_MPICH2::rank()
-{
- return "${PMI_RANK}";
-}
-
-string MpiImpl_MPICH2::boot(const string machinefile, const unsigned int nbnodes)
-{
- ostringstream oss;
- oss << "mpdboot" << " -n " << nbnodes;
- if (machinefile!="")
- oss << " -f " << machinefile;
- oss << endl;
- return oss.str();
-}
-
-string MpiImpl_MPICH2::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
- ostringstream oss;
- oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
- return oss.str();
-}
-
-string MpiImpl_MPICH2::halt()
-{
- ostringstream oss;
- oss << "mpdallexit" << endl;
- return oss.str();
-}
-
-// openmpi implementation
-// Constructor
-MpiImpl_OPENMPI::MpiImpl_OPENMPI() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_OPENMPI::~MpiImpl_OPENMPI()
-{
-}
-
-string MpiImpl_OPENMPI::size()
-{
- return "${OMPI_MCA_ns_nds_num_procs}";
-}
-
-string MpiImpl_OPENMPI::rank()
-{
- return "${OMPI_MCA_ns_nds_vpid}";
-}
-
-string MpiImpl_OPENMPI::boot(const string machinefile, const unsigned int nbnodes)
-{
- return "";
-}
-
-string MpiImpl_OPENMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
- ostringstream oss;
- oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
- return oss.str();
-}
-
-string MpiImpl_OPENMPI::halt()
-{
- return "";
-}
-
-// slurm implementation
-// Constructor
-MpiImpl_SLURM::MpiImpl_SLURM() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_SLURM::~MpiImpl_SLURM()
-{
-}
-
-string MpiImpl_SLURM::size()
-{
- return "${SLURM_NPROCS}";
-}
-
-string MpiImpl_SLURM::rank()
-{
- return "${SLURM_PROCID}";
-}
-
-string MpiImpl_SLURM::boot(const string machinefile, const unsigned int nbnodes)
-{
- return "";
-}
-
-string MpiImpl_SLURM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
- ostringstream oss;
- oss << "srun " << fileNameToExecute << endl;
- return oss.str();
-}
-
-string MpiImpl_SLURM::halt()
-{
- return "";
-}
-
-// prun implementation
-// Constructor
-MpiImpl_PRUN::MpiImpl_PRUN() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_PRUN::~MpiImpl_PRUN()
-{
-}
-
-string MpiImpl_PRUN::size()
-{
- return "${RMS_NPROCS}";
-}
-
-string MpiImpl_PRUN::rank()
-{
- return "${RMS_RANK}";
-}
-
-string MpiImpl_PRUN::boot(const string machinefile, const unsigned int nbnodes)
-{
- return "";
-}
-
-string MpiImpl_PRUN::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
- ostringstream oss;
- oss << "prun -n " << nbproc << " " << "-p mpi " << fileNameToExecute << endl;
- return oss.str();
-}
-
-string MpiImpl_PRUN::halt()
-{
- return "";
-}
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef _BL_MPIIMPL_H_
-#define _BL_MPIIMPL_H_
-
-#include "Batch_Defines.hxx"
-#include <string>
-
-class BATCH_EXPORT MpiImplException
-{
-public:
- const std::string msg;
-
- MpiImplException(const std::string m) : msg(m) {}
-};
-
-class BATCH_EXPORT MpiImpl
-{
-public:
- // Constructeur et destructeur
- MpiImpl(); // constrcuctor
- virtual ~MpiImpl(); //Destructor
-
- virtual std::string size() = 0; // get number of process of current job
- virtual std::string rank() = 0; // get process number of current job
- virtual std::string boot(const std::string machinefile, const unsigned int nbnodes) = 0; // get boot command
- virtual std::string run(const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute) = 0; // get run command
- virtual std::string halt() = 0; // get stop command
-
-protected:
-
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_LAM : public MpiImpl
-{
-public:
- // Constructeur et destructeur
- MpiImpl_LAM(); // constructor
- virtual ~MpiImpl_LAM(); //Destructor
-
- std::string size(); // get number of process of current job
- std::string rank(); // get process number of current job
- std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
- std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
- std::string halt(); // get stop command
-
-protected:
-
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_MPICH1 : public MpiImpl
-{
-public:
- // Constructeur et destructeur
- MpiImpl_MPICH1(); // constructor
- virtual ~MpiImpl_MPICH1(); //Destructor
-
- std::string size(); // get number of process of current job
- std::string rank(); // get process number of current job
- std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
- std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
- std::string halt(); // get stop command
-
-protected:
-
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_MPICH2 : public MpiImpl
-{
-public:
- // Constructeur et destructeur
- MpiImpl_MPICH2(); // constructor
- virtual ~MpiImpl_MPICH2(); //Destructor
-
- std::string size(); // get number of process of current job
- std::string rank(); // get process number of current job
- std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
- std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
- std::string halt(); // get stop command
-
-protected:
-
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_OPENMPI : public MpiImpl
-{
-public:
- // Constructeur et destructeur
- MpiImpl_OPENMPI(); // constructor
- virtual ~MpiImpl_OPENMPI(); //Destructor
-
- std::string size(); // get number of process of current job
- std::string rank(); // get process number of current job
- std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
- std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
- std::string halt(); // get stop command
-
-protected:
-
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_SLURM : public MpiImpl
-{
-public:
- // Constructeur et destructeur
- MpiImpl_SLURM(); // constructor
- virtual ~MpiImpl_SLURM(); //Destructor
-
- std::string size(); // get number of process of current job
- std::string rank(); // get process number of current job
- std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
- std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
- std::string halt(); // get stop command
-
-protected:
-
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_PRUN : public MpiImpl
-{
-public:
- // Constructeur et destructeur
- MpiImpl_PRUN(); // constructor
- virtual ~MpiImpl_PRUN(); //Destructor
-
- std::string size(); // get number of process of current job
- std::string rank(); // get process number of current job
- std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
- std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
- std::string halt(); // get stop command
-
-protected:
-
-private:
-
-};
-
-#endif
+++ /dev/null
-# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-#Batch_test.py
-# pratique
-#
-import readline
-import rlcompleter
-readline.parse_and_bind('tab: complete')
-
-# Importation de la bibliotheque de classes Batch
-from libBatch_Swig import *
-
-def work():
- # Definition d'un job...
- job=Job()
- # ... de ses parametres ...
- p={}
- p['EXECUTABLE']='/home/dutka/tmp/job'
- p['NAME']='MonJob'
- p['OUTFILE']=[('/tmp/stdout', 'stdout'), ('/tmp/stderr', 'stderr')]
- job.setParametre(p)
- # ... et de son environnement
- job.setEnvironnement({})
- print job
-
- # Appel au catalogue de BatchManager pour accéder au serveur cli70cu
- # Instanciation du catalogue (quasi-singleton)
- c=BatchManagerCatalog()
- # Instanciation d'une Factory de BatchManager de type 'PBS'
- # fbm=c('PBS')
-
- # Creation d'un BatchManager de type PBS sur le serveur cli70cu
- bm=c('PBS')('cli70cu')
-
- # Soumission du job au BatchManager
- jobid=bm.submitJob(job)
- print jobid
-
- # Interrogation de l'etat du job
- jobid.queryJob()
-
- # On attend que le job soit termine
- try:
- while 1: jinfo = jobid.queryJob()
- except:
- print "Job", jobid, "is done"
-
- pass
-
-if __name__ == "__main__":
- work()
- pass
-
-
-
+++ /dev/null
-# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# File : Makefile.am
-# Author : Guillaume Boulant (CSSI)
-# Module : KERNEL
-# $Header$
-#
-include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-
-#
-# ===============================================================
-# Swig targets
-# ===============================================================
-# (cf. http://www.geocities.com/foetsch/python/swig_linux.htm)
-#
-# Step 1: build the wrapping source files with swig
-#
-# libBatch_Swig.i -- swig --> swig_wrap.cpp
-# libBatch_Swig.py
-#
-# Step 2: build the dynamic library from cpp built source files and
-# dependant libraries.
-#
-# swig_wrap.cpp -- gcc --> swig_wrap.o |-- link --> _libBatch_Swig.la
-# + |
-# dependant libs |
-#
-# The file libBatch_Swig.py will be installed in
-# <prefix>/lib/python<version>/site-package/salome.
-# The library will be installed in the common place.
-#
-
-BUILT_SOURCES = swig_wrap.cpp libBatch_Swig.py
-
-SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -I$(srcdir)/../Batch
-SWIGSOURCES = libBatch_Swig.i libBatch_Swig_exception.i libBatch_Swig_typemap.i
-
-salomepython_PYTHON = libBatch_Swig.py
-salomepyexec_LTLIBRARIES = _libBatch_Swig.la
-_libBatch_Swig_la_SOURCES = swig_wrap.cpp
-_libBatch_Swig_la_CPPFLAGS = @PYTHON_INCLUDES@ -I$(srcdir) -I$(srcdir)/../Batch
-_libBatch_Swig_la_LDFLAGS = -module
-_libBatch_Swig_la_LIBADD = ../Batch/libSalomeBatch.la @PYTHON_LIBS@
-
-if WITH_OPENPBS
-_libBatch_Swig_la_CPPFLAGS += @OPENPBS_INCLUDES@
-_libBatch_Swig_la_LIBADD += @OPENPBS_LIBDIR@ @OPENPBS_LIBS@
-endif
-
-swig_wrap.cpp libBatch_Swig.py : $(SWIGSOURCES)
- $(SWIG) $(SWIG_FLAGS) -o swig_wrap.cpp $<
-
-CLEANFILES = swig_wrap.cpp
-
-EXTRA_DIST = $(SWIGSOURCES)
-
-#
-# ===============================================================
-# Files to be installed
-# ===============================================================
-#
-
-# Scripts to be installed.
-dist_salomescript_PYTHON = Batch_test.py
-
-# You don't need to specify libBatch_Swig.py. It is automatically
-# installed by means of the swig target salomepython_PYTHON.
-
-install-data-hook:
- @for f in $(dist_salomescript_PYTHON) ; do \
- chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \
- done
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * libBatch_Swig.i :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-/* ATTENTION:
- ==========
- Certaines classes ont des methodes surchargees et SWIG ne gere pas bien
- ces surcharges, d'ou un probleme d'utilisation en Python de celles-ci.
- En bref, ça ne marche pas et il faudra corriger le probleme...
-
- TODO : corriger le probleme de surcharge des methodes en Python
-
- IDM.
-*/
-
-
-/* Le nom du module Python tel qu'il est importe */
-%module libBatch_Swig
-
-/* generate docstrings with types */
-%feature("autodoc", "1");
-
-/* Inclusion des conversions de type */
-%include libBatch_Swig_typemap.i
-
-/* Inclusion de la gestion des exceptions */
-%include libBatch_Swig_exception.i
-
-%{
-#include "Batch_Defines.hxx"
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-
-#include "Batch_BatchManager.hxx"
-#include "Batch_BatchManagerCatalog.hxx"
-#include "Batch_FactBatchManager.hxx"
-%}
-
-/* Les classes exportees en Python */
-%include Batch_Defines.hxx
-%include Batch_Job.hxx
-%include Batch_JobId.hxx
-%include Batch_JobInfo.hxx
-
-%include Batch_BatchManager.hxx
-%include Batch_BatchManagerCatalog.hxx
-%include Batch_FactBatchManager.hxx
-
-
-
-/* Les methodes alterJob (surchargees et mal gerees en Python) sont
- remplacees par des methodes setParametre et setEnvironnement.
- cf. remarque ci-dessus.
-*/
-%ignore JobId::alterJob(const Parametre & param, const Environnement & env) const;
-%ignore JobId::alterJob(const Parametre & param) const;
-%ignore JobId::alterJob(const Environnement & env) const;
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * _exception.i :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-%exception {
- try {
- $action
- }
- catch (Batch::GenericException & ex) {
- std::string msg = ex.type + " : " + ex.message;
- PyErr_SetString(PyExc_RuntimeWarning, msg.c_str());
- return NULL;
- }
- catch (...) {
- PyErr_SetString(PyExc_RuntimeWarning, "unknown exception");
- return NULL;
- }
-}
-
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * _typemap.i :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-%{
-#include <string>
-#include <list>
-#include <map>
-#include "Batch_Parametre.hxx"
-#include "Batch_PyVersatile.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_FactBatchManager.hxx"
-#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
-typedef int Py_ssize_t;
-#define PY_SSIZE_T_MAX INT_MAX
-#define PY_SSIZE_T_MIN INT_MIN
-#endif
-%}
-
-# // supprime toutes les definitions par defaut => sert au debug
-# %typemap(in) SWIGTYPE ;
-
-
-# // construction d'un dictionnaire Python a partir d'un objet BatchManagerCatalog C++
-%typemap(out) std::map<std::string, Batch::FactBatchManager *> *
-{
- $result = PyDict_New();
-
- // on itere sur toutes les clefs de la map
- for(std::map<std::string, Batch::FactBatchManager *>::const_iterator it=(* $1).begin(); it!=(* $1).end(); it++) {
- std::string key = (*it).first;
- PyObject * obj = SWIG_NewPointerObj((void *) (*it).second, SWIGTYPE_p_Batch__FactBatchManager, 0);
- PyDict_SetItem($result, PyString_FromString(key.c_str()), obj);
- }
-}
-
-%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) Batch::Parametre
-{
- $1 = PyDict_Check($input)? 1 : 0;
-}
-
-# // construction d'un dictionnaire Python a partir d'un objet Parametre C++
-%typemap(out) Batch::Parametre
-{
- $result = PyDict_New();
-
- // on itere sur toutes les clefs de la map, et on passe par la classe PyVersatile
- // qui convertit un Versatile en PyObject et vice versa
- for(Batch::Parametre::const_iterator it=$1.begin(); it!=$1.end(); it++) {
- std::string key = (*it).first;
- Batch::PyVersatile PyV = (*it).second;
- PyDict_SetItem($result, PyString_FromString(key.c_str()), PyV);
- }
-}
-
-
-# // construction d'un objet Parametre C++ a partir d'un dictionnaire Python
-%typemap(in) Batch::Parametre & (Batch::Parametre PM)
-{
- if (!PyDict_Check($input)) {
- PyErr_SetString(PyExc_ValueError,"Expected a dictionnary");
- return NULL;
- }
-
- try {
- // on itere sur toutes les clefs du dictionnaire, et on passe par la classe PyVersatile
- // qui convertit un Versatile en PyObject et vice versa
- PyObject *key, *value;
- Py_ssize_t pos = 0;
- while (PyDict_Next($input, &pos, &key, &value)) {
- std::string mk = PyString_AsString(key);
- Batch::PyVersatile PyV = value;
- PyV.setName(mk);
- PM[mk] = PyV;
- }
-
- $1 = &PM; // $1 est une reference donc on lui passe une adresse
- }
- catch (Batch::GenericException & ex) {
- std::string msg = ex.type + " : " + ex.message;
- PyErr_SetString(PyExc_RuntimeWarning, msg.c_str());
- return NULL;
- }
- catch (...) {
- PyErr_SetString(PyExc_RuntimeWarning, "unknown exception");
- return NULL;
- }
-}
-
-
-# // construction d'un objet Parametre C++ a partir d'un dictionnaire Python
-%typemap(in) Batch::Parametre (Batch::Parametre PM)
-{
- if (!PyDict_Check($input)) {
- PyErr_SetString(PyExc_ValueError,"Expected a dictionnary");
- return NULL;
- }
-
- try {
- // on itere sur toutes les clefs du dictionnaire, et on passe par la classe PyVersatile
- // qui convertit un Versatile en PyObject et vice versa
- PyObject *key, *value;
- Py_ssize_t pos = 0;
- while (PyDict_Next($input, &pos, &key, &value)) {
- std::string mk = PyString_AsString(key);
- Batch::PyVersatile PyV = value;
- PyV.setName(mk);
- PM[mk] = PyV;
- }
-
- $1 = PM;
- }
- catch (Batch::GenericException & ex) {
- std::string msg = ex.type + " : " + ex.message;
- PyErr_SetString(PyExc_RuntimeWarning, msg.c_str());
- return NULL;
- }
- catch (...) {
- PyErr_SetString(PyExc_RuntimeWarning, "unknown exception");
- return NULL;
- }
-}
-
-%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) Batch::Environnement
-{
- $1 = PyDict_Check($input)? 1 : 0;
-}
-
-# // construction d'un dictionnaire Python a partir d'un objet Environnement C++
-%typemap(out) Batch::Environnement
-{
- $result = PyDict_New();
-
- // on itere sur toutes les clefs de la map
- for(Batch::Environnement::const_iterator it=$1.begin(); it!=$1.end(); it++) {
- std::string key = (*it).first;
- std::string val = (*it).second;
- PyDict_SetItem($result,
- PyString_FromString(key.c_str()),
- PyString_FromString(val.c_str()));
- }
-}
-
-
-# // construction d'un objet Environnement C++ a partir d'un dictionnaire Python
-%typemap(in) Batch::Environnement & (Batch::Environnement E)
-{
- if (!PyDict_Check($input)) {
- PyErr_SetString(PyExc_ValueError,"Expected a dictionnary");
- return NULL;
- }
-
- // on itere sur toutes les clefs du dictionnaire
- PyObject *key, *value;
- Py_ssize_t pos = 0;
- while (PyDict_Next($input, &pos, &key, &value)) {
- std::string mk = PyString_AsString(key);
- std::string val = PyString_AsString(value);
- E[mk] = val;
- }
-
- $1 = &E; // $1 est une reference donc on lui passe une adresse
-}
-
-
-
-# // construction d'un objet Environnement C++ a partir d'un dictionnaire Python
-%typemap(in) Batch::Environnement (Batch::Environnement E)
-{
- if (!PyDict_Check($input)) {
- PyErr_SetString(PyExc_ValueError,"Expected a dictionnary");
- return NULL;
- }
-
- // on itere sur toutes les clefs du dictionnaire
- PyObject *key, *value;
- Py_ssize_t pos = 0;
- while (PyDict_Next($input, &pos, &key, &value)) {
- std::string mk = PyString_AsString(key);
- std::string val = PyString_AsString(value);
- E[mk] = val;
- }
-
- $1 = E;
-}
-
-
-
-# // construction d'une string Python a partir d'une string STL
-%typemap(python,out) std::string
-{
- $result = PyString_FromString($1.c_str());
-}
-
-
-
-# // construction d'une string STL a partir d'une string Python
-#%typemap(in) string & (string S)
-#{
-## if (!PyString_Check($input)) {
-# PyErr_SetString(PyExc_ValueError,"Expected a string");
-# return NULL;
-# }
-#
-# S = string(PyString_AsString($input));
-# $1 = &S; // $1 est une reference donc on lui passe une adresse
-#}
-
-
-
-# // construction d'une string STL a partir d'une string Python
-#%typemap(in) string (string S)
-#{
-## if (!PyString_Check($input)) {
-# PyErr_SetString(PyExc_ValueError,"Expected a string");
-# return NULL;
-# }
-#
-# S = string(PyString_AsString($input));
-# $1 = S;
-#}
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
*/
//=============================================================================
-Engines_Component_i::Engines_Component_i():_myConnexionToRegistry(0), _notifSupplier(0)
+Engines_Component_i::Engines_Component_i():_myConnexionToRegistry(0), _notifSupplier(0), _id(0)
{
//ASSERT(0);
MESSAGE("Default Constructor, not for normal use...");
//=============================================================================
Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName,
- const char *interfaceName,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
bool notif,
bool regist ) :
_instanceName(instanceName),
_graphName("") ,
_nodeName(""),
_studyId(-1),
+ _id(0),
+ _contId(0),
_CanceledThread(false)
{
MESSAGE("Component constructor with instanceName "<< _instanceName);
_graphName("") ,
_nodeName(""),
_studyId(-1),
+ _id(0),
+ _contId(0),
_CanceledThread(false)
{
MESSAGE("Component constructor with instanceName "<< _instanceName);
_orb = CORBA::ORB::_duplicate(orb);
_poa = PortableServer::POA::_duplicate(poa);
_container=Engines::Container::_duplicate(container);
- try
- {
- _contId=_poa->reference_to_id(container);
- }
- catch(PortableServer::POA::WrongAdapter)
- {
- //not created by this poa
- _contId = 0;
- }
const CORBA::String_var ior = _orb->object_to_string(_container);
if(regist)
_myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str());
MESSAGE("Component destructor");
Engines_Container_i::decInstanceCnt(_interfaceName);
if(_myConnexionToRegistry)delete _myConnexionToRegistry;
+ _myConnexionToRegistry = 0 ;
if(_notifSupplier)delete _notifSupplier;
+ _notifSupplier = 0;
+ if(_id) delete _id;
+ _id=0;
}
//=============================================================================
void Engines_Component_i::destroy()
{
MESSAGE("Engines_Component_i::destroy()");
- //SCRUTE(pd_refCount);
-
- if(_myConnexionToRegistry)delete _myConnexionToRegistry;
- _myConnexionToRegistry = 0 ;
- if(_notifSupplier)delete _notifSupplier;
- _notifSupplier = 0;
- if(_id)
- delete(_id) ;
- //SCRUTE(pd_refCount);
- _thisObj->_remove_ref();
- //SCRUTE(pd_refCount);
+ //SCRUTE(_refcount_value());
+ _poa->deactivate_object(*_id);
+ //SCRUTE(_refcount_value());
+ _remove_ref();
+ //SCRUTE(_refcount_value());
MESSAGE("Engines_Component_i::destroyed") ;
}
#endif
{
if ( _Sleeping )
- {
- return false ;
- }
+ {
+ return false ;
+ }
else
{
#ifndef WIN32
- RetVal = Killer( _ThreadId ,SIGINT ) ;
+ RetVal = Killer( _ThreadId ,SIGINT ) ;
#else
- RetVal = Killer( *_ThreadId ,SIGINT ) ;
+ RetVal = Killer( *_ThreadId ,SIGINT ) ;
#endif
- //if ( RetVal ) _Sleeping = true;
+ //if ( RetVal ) _Sleeping = true;
}
}
{
if ( _Sleeping )
{
- _Sleeping = false ;
- RetVal = true ;
+ _Sleeping = false ;
+ RetVal = true ;
}
else
{
- RetVal = false ;
+ RetVal = false ;
}
}
return RetVal ;
#else
if ( pthread_self().p != _ThreadId->p )
#endif
- {
+ {
if ( _Sleeping )
- {
- }
+ {
+ }
else
- {
- // Get Cpu in the appropriate thread with that object !...
- theEngines_Component = this ;
+ {
+ // Get Cpu in the appropriate thread with that object !...
+ theEngines_Component = this ;
#ifndef WIN32
- Killer( _ThreadId ,SIGUSR1 ) ;
+ Killer( _ThreadId ,SIGUSR1 ) ;
#else
- Killer( *_ThreadId ,SIGUSR11 ) ;
+ Killer( *_ThreadId ,SIGUSR11 ) ;
#endif
- }
+ }
cpu = _ThreadCpuUsed ;
- }
+ }
else
- {
- _ThreadCpuUsed = CpuUsed() ;
- cpu = _ThreadCpuUsed ;
- // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
- // << _serviceName << " " << cpu << endl ;
+ {
+ _ThreadCpuUsed = CpuUsed() ;
+ cpu = _ThreadCpuUsed ;
+ // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
+ // << _serviceName << " " << cpu << endl ;
}
}
else
{
- cpu = _ThreadCpuUsed ;
- // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
- // << _serviceName << " " << cpu<< endl ;
+ cpu = _ThreadCpuUsed ;
+ // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
+ // << _serviceName << " " << cpu<< endl ;
}
}
else
Engines_Container_i *Engines_Component_i::GetContainerPtr()
{
- return dynamic_cast<Engines_Container_i*>(_poa->id_to_servant(*_contId)) ;
+ PortableServer::ObjectId_var contId=_poa->reference_to_id(_container);
+ return dynamic_cast<Engines_Container_i*>(_poa->id_to_servant(contId)) ;
}
//=============================================================================
void Engines_Component_i::beginService(const char *serviceName)
{
-#ifndef WIN32
- MESSAGE(pthread_self() << "Send BeginService notification for " <<serviceName
- << endl << "Component instance : " << _instanceName << endl << endl);
-#else
- MESSAGE(pthread_self().p << "Send BeginService notification for " <<serviceName
- << endl << "Component instance : " << _instanceName << endl << endl);
-#endif
+ std::cerr << "beginService for " << serviceName << " Component instance : " << _instanceName << std::endl;
+
#ifndef WIN32
_ThreadId = pthread_self() ;
#else
perror("pthread_setcancelstate ") ;
exit(0) ;
}
-// MESSAGE(pthread_self() << " Return from BeginService for " << serviceName
-// << " ThreadId " << _ThreadId << " StartUsed " << _StartUsed
-// << " _graphName " << _graphName << " _nodeName " << _nodeName );
- // --- for supervisor : all strings given with setProperties
- // are set in environment
- bool overwrite = true;
+ // --- all strings given with setProperties are set in environment
map<std::string,CORBA::Any>::iterator it;
for (it = _fieldsDict.begin(); it != _fieldsDict.end(); it++)
{
std::string cle((*it).first);
if ((*it).second.type()->kind() == CORBA::tk_string)
- {
- const char* value;
- (*it).second >>= value;
- // ---todo: replace __GNUC__ test by an autoconf macro AC_CHECK_FUNC.
-#if defined __GNUC__
-// int ret = setenv(cle.c_str(), value, overwrite);
- setenv(cle.c_str(), value, overwrite);
-#else
- //CCRT porting : setenv not defined in stdlib.h
- std::string s(cle);
- s+='=';
- s+=value;
- // char* cast because 1st arg of linux putenv function
- // is not a const char* !
-// int ret=putenv((char *)s.c_str());
- putenv((char *)s.c_str());
- //End of CCRT porting
-#endif
- MESSAGE("--- setenv: "<<cle<<" = "<< value);
- }
+ {
+ const char* value;
+ (*it).second >>= value;
+ std::string s(cle);
+ s+='=';
+ s+=value;
+ putenv((char *)s.c_str());
+ MESSAGE("--- setenv: "<<cle<<" = "<< value);
+ }
}
}
if ( !_CanceledThread )
_ThreadCpuUsed = CpuUsed_impl() ;
-#ifndef WIN32
- MESSAGE(pthread_self() << " Send EndService notification for " << serviceName
- << endl << " Component instance : " << _instanceName << " StartUsed "
+ float cpus=_ThreadCpuUsed/1000.;
+ std::cerr << "endService for " << serviceName << " Component instance : " << _instanceName ;
+ std::cerr << " Cpu Used: " << cpus << " (s) " << std::endl;
+ MESSAGE("Send EndService notification for " << serviceName
+ << endl << " Component instance : " << _instanceName << " StartUsed "
<< _StartUsed << " _ThreadCpuUsed "<< _ThreadCpuUsed << endl <<endl);
-#else
- MESSAGE(pthread_self().p << " Send EndService notification for " << serviceName
- << endl << " Component instance : " << _instanceName << " StartUsed "
- << _StartUsed << " _ThreadCpuUsed "<< _ThreadCpuUsed << endl <<endl);
-#endif
_ThreadId = 0 ;
}
#endif
{
if ( signum == 0 )
- {
- if ( pthread_cancel( ThreadId ) )
- {
- perror("Killer pthread_cancel error") ;
- return false ;
- }
- else
- {
-#ifndef WIN32
- MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
- << " pthread_canceled") ;
+ {
+ if ( pthread_cancel( ThreadId ) )
+ {
+ perror("Killer pthread_cancel error") ;
+ return false ;
+ }
+ else
+ {
+#ifdef WNT
+ MESSAGE("Killer : ThreadId " << ThreadId.p << " pthread_canceled") ;
#else
- MESSAGE(pthread_self().p << "Killer : ThreadId " << ThreadId.p
- << " pthread_canceled") ;
+ MESSAGE("Killer : ThreadId " << ThreadId << " pthread_canceled") ;
#endif
- }
- }
+ }
+ }
else
- {
- if ( pthread_kill( ThreadId , signum ) == -1 )
- {
- perror("Killer pthread_kill error") ;
- return false ;
- }
- else
- {
-#ifndef WIN32
- MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
- << " pthread_killed(" << signum << ")") ;
+ {
+ if ( pthread_kill( ThreadId , signum ) == -1 )
+ {
+ perror("Killer pthread_kill error") ;
+ return false ;
+ }
+ else
+ {
+#ifdef WNT
+ MESSAGE("Killer : ThreadId " << ThreadId.p << " pthread_killed(" << signum << ")") ;
#else
- MESSAGE(pthread_self().p << "Killer : ThreadId " << ThreadId.p
- << " pthread_killed(" << signum << ")") ;
+ MESSAGE("Killer : ThreadId " << ThreadId << " pthread_killed(" << signum << ")") ;
#endif
- }
- }
+ }
+ }
}
return true ;
}
if ( _ThreadId || _Executed )
{
if ( getrusage( RUSAGE_SELF , &usage ) == -1 )
- {
- perror("Engines_Component_i::CpuUsed") ;
- return 0 ;
- }
- cpu = usage.ru_utime.tv_sec - _StartUsed ;
+ {
+ perror("Engines_Component_i::CpuUsed") ;
+ return 0 ;
+ }
+ //cpu time is calculated in millisecond (user+system times)
+ cpu = usage.ru_utime.tv_sec*1000 +usage.ru_utime.tv_usec/1000;
+ cpu = cpu+ usage.ru_stime.tv_sec*1000 +usage.ru_stime.tv_usec/1000;
+ cpu=cpu-_StartUsed ;
// cout << pthread_self() << " Engines_Component_i::CpuUsed " << " "
// << _serviceName << usage.ru_utime.tv_sec << " - " << _StartUsed
// << " = " << cpu << endl ;
// << _StartUsed << endl ;
}
#else
- // NOT implementet yet
+ // NOT implementet yet
#endif
//=============================================================================
void Engines_Component_i::sendMessage(const char *event_type,
- const char *message)
+ const char *message)
{
_notifSupplier->Send(_graphName.c_str(), _nodeName.c_str(), event_type, message);
}
//=============================================================================
Engines::TMPFile* Engines_Component_i::DumpPython(CORBA::Object_ptr theStudy,
- CORBA::Boolean isPublished,
- CORBA::Boolean& isValidScript)
+ CORBA::Boolean isPublished,
+ CORBA::Boolean& isValidScript)
{
const char* aScript = "def RebuildData(theStudy): pass";
char* aBuffer = new char[strlen(aScript)+1];
Engines::Salome_file_ptr
Engines_Component_i::getInputFileToService(const char* service_name,
- const char* Salome_file_name)
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we throw an exception.
_Service_file_map_it = _Input_Service_file_map.find(service_name);
Engines::Salome_file_ptr
Engines_Component_i::setInputFileToService(const char* service_name,
- const char* Salome_file_name)
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we add it.
_Service_file_map_it = _Input_Service_file_map.find(service_name);
Engines::Salome_file_ptr
Engines_Component_i::getOutputFileToService(const char* service_name,
- const char* Salome_file_name)
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we throw an exception.
_Service_file_map_it = _Output_Service_file_map.find(service_name);
Engines::Salome_file_ptr
Engines_Component_i::setOutputFileToService(const char* service_name,
- const char* Salome_file_name)
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we add it.
_Service_file_map_it = _Output_Service_file_map.find(service_name);
//=============================================================================
void
Engines_Component_i::configureSalome_file(std::string service_name,
- std::string file_port_name,
- Salome_file_i * file)
+ std::string file_port_name,
+ Salome_file_i * file)
{
// By default this method does nothing
}
+//=============================================================================
+/*!
+ * C++ method: return the name of the container associated with this component
+ * This name does not contains the "/Containers" string and all "/" are replaced by "_"
+ * \return the container name (reformatted)
+ */
+//=============================================================================
+std::string Engines_Component_i::getContainerName()
+{
+ CORBA::String_var containerName=_container->name();
+ std::string name(containerName);
+ name.erase(0,12);
+ string::size_type slash =name.find_first_of('/');
+ if(slash != std::string::npos)
+ name[slash]='_';
+ return name;
+}
map<std::string, void *> Engines_Container_i::_toRemove_map;
omni_mutex Engines_Container_i::_numInstanceMutex ;
+static PyObject* _pyCont;
+
+int checkifexecutable(const std::string&);
+int findpathof(std::string&, const std::string&);
+
/*! \class Engines_Container_i
* \brief C++ implementation of Engines::Container interface
*
if (!_isSupervContainer)
{
-#ifdef WIN32
-
- PyEval_AcquireLock();
- PyThreadState *myTstate = PyThreadState_New(KERNEL_PYTHON::_interp);
- PyThreadState *myoldTstate = PyThreadState_Swap(myTstate);
-#else
- Py_ACQUIRE_NEW_THREAD;
-#endif
+ PyGILState_STATE gstate = PyGILState_Ensure();
#ifdef WIN32
// mpv: this is temporary solution: there is a unregular crash if not
#endif
PyRun_SimpleString("import SALOME_Container\n");
PyRun_SimpleString((char*)myCommand.c_str());
- Py_RELEASE_NEW_THREAD;
+ PyObject *mainmod = PyImport_AddModule("__main__");
+ PyObject *globals = PyModule_GetDict(mainmod);
+ _pyCont = PyDict_GetItemString(globals, "pyCont");
+
+ PyGILState_Release(gstate);
}
fileTransfer_i* aFileTransfer = new fileTransfer_i();
// ignore this entry and continue
}
}
+ _listInstances_map.clear();
_NS->Destroy_FullDirectory(_containerName.c_str());
_NS->Destroy_Name(_containerName.c_str());
- //_remove_ref();
- //_poa->deactivate_object(*_id);
if(_isServantAloneInProcess)
{
MESSAGE("Effective Shutdown of container Begins...");
{
string path( getenv("PATH") );
if ( path.size() == 0 )
- return 0;
-
+ return 0;
+
char path_spr =
#ifdef WIN32
';';
return true;
}
+ std::string retso="";
#ifndef WIN32
void* handle;
handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
+ if ( !handle )retso=dlerror();
#else
HINSTANCE handle;
handle = LoadLibrary( impl_name.c_str() );
// --- try import Python component
INFOS("try import Python component "<<componentName);
+ std::string retpy;
if (_isSupervContainer)
{
INFOS("Supervision Container does not support Python Component Engines");
}
else
{
- Py_ACQUIRE_NEW_THREAD;
- PyObject *mainmod = PyImport_AddModule("__main__");
- PyObject *globals = PyModule_GetDict(mainmod);
- PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
- PyObject *result = PyObject_CallMethod(pyCont,
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject *result = PyObject_CallMethod(_pyCont,
(char*)"import_component",
(char*)"s",componentName);
- int ret= PyInt_AsLong(result);
+
+ retpy=PyString_AsString(result);
Py_XDECREF(result);
- SCRUTE(ret);
- Py_RELEASE_NEW_THREAD;
+ SCRUTE(retpy);
+ PyGILState_Release(gstate);
- if (ret) // import possible: Python component
+ if (retpy=="") // import possible: Python component
{
_numInstanceMutex.lock() ; // lock to be alone (stl container write)
- _library_map[aCompName] = (void *)pyCont; // any non O value OK
+ _library_map[aCompName] = (void *)_pyCont; // any non O value OK
_numInstanceMutex.unlock() ;
MESSAGE("import Python: "<<aCompName<<" OK");
return true;
INFOS( "Impossible to load component: " << componentName );
INFOS( "Can't load shared library: " << impl_name );
+ std::cerr << retso << std::endl;
INFOS( "Can't import Python module: " << componentName );
+ std::cerr << retpy << std::endl;
INFOS( "Can't execute program: " << executable );
return false;
}
string component_registerName =
_containerName + "/" + instanceName;
- Py_ACQUIRE_NEW_THREAD;
- PyObject *mainmod = PyImport_AddModule("__main__");
- PyObject *globals = PyModule_GetDict(mainmod);
- PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
- PyObject *result = PyObject_CallMethod(pyCont,
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject *result = PyObject_CallMethod(_pyCont,
(char*)"create_component_instance",
(char*)"ssl",
aCompName.c_str(),
string iors = PyString_AsString(result);
Py_DECREF(result);
SCRUTE(iors);
- Py_RELEASE_NEW_THREAD;
+ PyGILState_Release(gstate);
if( iors!="" )
{
Engines_Component_i *servant =
dynamic_cast<Engines_Component_i*>(_poa->reference_to_servant(iobject));
ASSERT(servant);
- //SCRUTE(servant->pd_refCount);
- servant->_remove_ref(); // compensate previous id_to_reference
- //SCRUTE(servant->pd_refCount);
+ //SCRUTE(servant->_refcount_value());
_numInstanceMutex.lock() ; // lock to be alone (stl container write)
_listInstances_map[instanceName] = iobject;
_cntInstances_map[aGenRegisterName] += 1;
_numInstanceMutex.unlock() ;
SCRUTE(aGenRegisterName);
SCRUTE(_cntInstances_map[aGenRegisterName]);
- //SCRUTE(servant->pd_refCount);
-#if defined(_DEBUG_) || defined(_DEBUG)
- bool ret_studyId = servant->setStudyId(studyId);
- ASSERT(ret_studyId);
-#else
servant->setStudyId(studyId);
-#endif
+ servant->_remove_ref(); // do not need servant any more (remove ref from reference_to_servant)
+ //SCRUTE(servant->_refcount_value());
// --- register the engine under the name
// containerName(.dir)/instanceName(.object)
#ifndef WIN32
struct sigaction SigIntAct ;
SigIntAct.sa_sigaction = &SigIntHandler ;
+ sigemptyset(&SigIntAct.sa_mask);
SigIntAct.sa_flags = SA_SIGINFO ;
#endif
}
}
+/*! \brief create a PyNode object to execute remote python code
+ * \param nodeName the name of the node
+ * \param code the python code to load
+ * \return the PyNode
+ */
+Engines::PyNode_ptr Engines_Container_i::createPyNode(const char* nodeName, const char* code)
+{
+ Engines::PyNode_var node= Engines::PyNode::_nil();
+
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject *res = PyObject_CallMethod(_pyCont,
+ (char*)"create_pynode",
+ (char*)"ss",
+ nodeName,
+ code);
+ if(res==NULL)
+ {
+ //internal error
+ PyErr_Print();
+ PyGILState_Release(gstate);
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "can not create a python node";
+ throw SALOME::SALOME_Exception(es);
+ }
+ long ierr=PyInt_AsLong(PyTuple_GetItem(res,0));
+ PyObject* result=PyTuple_GetItem(res,1);
+ std::string astr=PyString_AsString(result);
+ Py_DECREF(res);
+ PyGILState_Release(gstate);
+
+ if(ierr==0)
+ {
+ CORBA::Object_var obj = _orb->string_to_object(astr.c_str());
+ node = Engines::PyNode::_narrow(obj);
+ return node._retn();
+ }
+ else
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = astr.c_str();
+ throw SALOME::SALOME_Exception(es);
+ }
+
+}
# Scripts to be installed
dist_salomescript_PYTHON =\
SALOME_ComponentPy.py \
+ SALOME_PyNode.py \
SALOME_Container.py
# These files are executable scripts
COMMON_CPPFLAGS=\
@PYTHON_INCLUDES@ \
@HDF5_INCLUDES@ \
- -I$(srcdir)/../Batch \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Notification \
-I$(srcdir)/../ResourcesManager \
-I$(srcdir)/../HDFPersist \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@
../SALOMELocalTrace/libSALOMELocalTrace.la \
../Basics/libSALOMEBasics.la \
../HDFPersist/libSalomeHDFPersist.la \
- ../Batch/libSalomeBatch.la \
$(top_builddir)/idl/libSalomeIDLKernel.la \
@CORBA_LIBS@ \
$(PYTHON_LIBS)
#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
import time
import string
import signal
-from omniORB import CORBA, PortableServer
+from omniORB import CORBA, PortableServer, any
import Engines, Engines__POA
import Registry
from Utils_Identity import *
def destroy(self):
MESSAGE( "SALOME_ComponentPy_i::destroy" )
- #id = self._poa.servant_to_id(self)
- #self._poa.deactivate_object(id)
+ id = self._poa.servant_to_id(self)
+ self._poa.deactivate_object(id)
return
#-------------------------------------------------------------------------
def GetContainerRef(self):
MESSAGE( "SALOME_ComponentPy_i::GetContainerRef" )
- #corbaObj_ptr = self._poa.id_to_reference(self._contId)
- #return corbaObj_ptr._narrow(Engines.Container)
return self._contId._narrow(Engines.Container)
#-------------------------------------------------------------------------
self._StartUsed = self.CpuUsed_impl()
self._ThreadCpuUsed = 0
self._Executed = 1
+ print "beginService for ",serviceName," Component instance : ",self._instanceName
MESSAGE( "SALOME_ComponentPy_i::beginService _StartUsed " + str( self._ThreadId ) + " " + str( self._StartUsed ) )
+ for e in self._fieldsDict:
+ key=e.key
+ value=any.from_any(e.value)
+ if isinstance(value,str):
+ os.environ[key]=value
#-------------------------------------------------------------------------
def endService(self , serviceName ):
MESSAGE( "Send EndService notification for " + str( self._ThreadId ) + " " + str(serviceName) + " for graph/node " + str(self._graphName) + " " + str(self._nodeName) + " CpuUsed " + str( self.CpuUsed_impl() ) )
MESSAGE( "Component instance : " + str(self._instanceName) )
+ print "endService for",serviceName,"Component instance :",self._instanceName,"Cpu Used:",self.CpuUsed_impl()," (s) "
+
#-------------------------------------------------------------------------
if ( self._ThreadId | self._Executed ) :
if self._ThreadId == get_ident() :
cpu = time.clock()
- self._ThreadCpuUsed = int(cpu) - self._StartUsed
+ self._ThreadCpuUsed = cpu - self._StartUsed
MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl " + self._serviceName + " " + str( int(cpu) ) + " - " + str( self._StartUsed ) + " = " + str( self._ThreadCpuUsed ) )
return self._ThreadCpuUsed
MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl " + self._serviceName + " " + str( self._ThreadCpuUsed ) )
def DumpPython(self, theStudy, isPublished):
aBuffer = "def RebuildData(theStudy): pass\n\0"
- return (aBuffer, 1)
+ return (aBuffer, 1)
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
def hasObjectInfo(self):
- return 0
+ return 0
#-------------------------------------------------------------------------
public:
Engines_Component_i();
Engines_Component_i(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName,
- const char *interfaceName,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
bool notif = false,
bool regist = true);
//Constructor for standalone component
Engines_Component_i(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- Engines::Container_ptr container,
- const char *instanceName,
- const char *interfaceName,
+ PortableServer::POA_ptr poa,
+ Engines::Container_ptr container,
+ const char *instanceName,
+ const char *interfaceName,
bool notif = false,
bool regist = true);
PortableServer::ObjectId * getId();
Engines_Container_i *GetContainerPtr();
+ std::string getContainerName();
- bool setStudyId(CORBA::Long studyId);
+ virtual bool setStudyId(CORBA::Long studyId);
static bool isMultiStudy();
static bool isMultiInstance();
static std::string GetDynLibraryName(const char *componentName);
if (!isSupervContainer)
{
PyGILState_Ensure();
- //Delete python container that destroy orb from python (pyCont._orb.destroy())
+ //Destroy orb from python (for chasing memory leaks)
+ //PyRun_SimpleString("from omniORB import CORBA");
+ //PyRun_SimpleString("orb=CORBA.ORB_init([''], CORBA.ORB_ID)");
+ //PyRun_SimpleString("orb.destroy()");
Py_Finalize();
}
else
#endif
#endif
- //END_OF(argv[0]);
- //LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
- //bp1->deleteInstance(bp1);
return 0 ;
}
#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
import os
import sys
import string
+import traceback
from omniORB import CORBA, PortableServer
import SALOMEDS
import Engines, Engines__POA
from SALOME_NamingServicePy import *
from SALOME_ComponentPy import *
+import SALOME_PyNode
from SALOME_utilities import *
from Utils_Identity import getShortHostName
#=============================================================================
-#define an implementation of the container interface
+#define an implementation of the container interface for embedding in Container implemented in C++
class SALOME_Container_i:
_orb = None
#-------------------------------------------------------------------------
- #def __del__(self ):
- # self._orb.destroy()
-
def import_component(self, componentName):
MESSAGE( "SALOME_Container_i::import_component" )
- ret=0
+ ret=""
try:
if verbose(): print "try import ",componentName
__import__(componentName)
if verbose(): print "import ",componentName," successful"
- ret=1
except:
+ import traceback
+ ret=traceback.format_exc(10)
if verbose():
- import traceback
traceback.print_exc()
print "import ",componentName," not possible"
return ret
return comp_iors
+ def create_pynode(self,nodeName,code):
+ try:
+ node=SALOME_PyNode.PyNode_i(nodeName,code,self._poa)
+ id_o = self._poa.activate_object(node)
+ comp_o = self._poa.id_to_reference(id_o)
+ comp_iors = self._orb.object_to_string(comp_o)
+ return 0,comp_iors
+ except:
+ exc_typ,exc_val,exc_fr=sys.exc_info()
+ l=traceback.format_exception(exc_typ,exc_val,exc_fr)
+ return 1,"".join(l)
#endif
#include <vector>
#include "Utils_CorbaException.hxx"
-#include "Batch_Date.hxx"
#include <sstream>
#ifdef WITH_PACO_PARALLEL
_NS->Register(refContMan,_ContainerManagerNameInNS);
_isAppliSalomeDefined = (getenv("APPLI") != 0);
+
+#ifdef HAVE_MPI2
+#ifdef WITHOPENMPI
+ if( getenv("OMPI_URI_FILE") != NULL ){
+ system("killall ompi-server");
+ string command;
+ command = "ompi-server -r ";
+ command += getenv("OMPI_URI_FILE");
+ int status=system(command.c_str());
+ if(status!=0)
+ throw SALOME_Exception("Error when launching ompi-server");
+ }
+#endif
+#endif
+
MESSAGE("constructor end");
}
SALOME_ContainerManager::~SALOME_ContainerManager()
{
MESSAGE("destructor");
+#ifdef HAVE_MPI2
+#ifdef WITHOPENMPI
+ if( getenv("OMPI_URI_FILE") != NULL )
+ system("killall ompi-server");
+#endif
+#endif
}
//=============================================================================
{
try
{
- SCRUTE((*iter));
- CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
- Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont))
- {
- MESSAGE("ShutdownContainers: " << (*iter));
- cont->Shutdown();
- }
- else
- MESSAGE("ShutdownContainers: no container ref for " << (*iter));
+ SCRUTE((*iter));
+ CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont))
+ {
+ MESSAGE("ShutdownContainers: " << (*iter));
+ cont->Shutdown();
+ }
+ else
+ MESSAGE("ShutdownContainers: no container ref for " << (*iter));
}
catch(CORBA::SystemException& e)
{
- INFOS("CORBA::SystemException ignored : " << e);
+ INFOS("CORBA::SystemException ignored : " << e);
}
catch(CORBA::Exception&)
{
- INFOS("CORBA::Exception ignored.");
+ INFOS("CORBA::Exception ignored.");
}
catch(...)
{
- INFOS("Unknown exception ignored.");
+ INFOS("Unknown exception ignored.");
}
}
}
//check if an entry exists in Naming service
//if params.mode == "start" or "" shutdown the existing container before launching a new one with that name
//if params.mode == "getorstart" or "get" use the existing container
- containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str());
+ if(params.isMPI)
+ // A parallel container register on zero node in NS
+ containerNameInNS = _NS->BuildContainerNameForNS(params,GetMPIZeroNode(theMachine).c_str());
+ else
+ containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str());
SCRUTE(containerNameInNS);
CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
if(std::string(params.mode.in())=="getorstart"||std::string(params.mode.in())=="get")
return cont._retn(); /* the container exists and params.mode is getorstart or get use it*/
else
- cont->Shutdown(); // shutdown the registered container if it exists
+ {
+ INFOS("A container is already registered with the name: " << containerNameInNS << ", shutdown the existing container");
+ cont->Shutdown(); // shutdown the registered container if it exists
+ }
}
}
catch(CORBA::Exception&)
command = BuildCommandToLaunchRemoteContainer(theMachine,params,container_exe);
//redirect stdout and stderr in a file
- string logFilename="/tmp/"+_NS->ContainerName(params)+"_"+ theMachine +"_"+getenv( "USER" )+".log" ;
- command += " > " + logFilename + " 2>&1 &";
+#ifdef WNT
+ string logFilename=getenv("TEMP");
+ logFilename += "\\";
+#else
+ string logFilename="/tmp";
+ char* val = getenv("SALOME_TMP_DIR");
+ if(val)
+ {
+ struct stat file_info;
+ stat(val, &file_info);
+ bool is_dir = S_ISDIR(file_info.st_mode);
+ if (is_dir)logFilename=val;
+ else std::cerr << "SALOME_TMP_DIR environment variable is not a directory use /tmp instead" << std::endl;
+ }
+ logFilename += "/";
+#endif
+ logFilename += _NS->ContainerName(params)+"_"+ theMachine +"_"+getenv( "USER" )+".log" ;
+ command += " > " + logFilename + " 2>&1";
+#ifdef WNT
+ command = "%PYTHONBIN% -c \"import win32pm ; win32pm.spawnpid(r'" + command + "', '')\"";
+#else
+ command += " &";
+#endif
// launch container with a system call
int status=system(command.c_str());
// Il faut tuer le proxy
try
{
- Engines::Container_var proxy = Engines::Container::_narrow(container_proxy);
- proxy->Shutdown();
+ Engines::Container_var proxy = Engines::Container::_narrow(container_proxy);
+ proxy->Shutdown();
}
catch (...)
{
- INFOS("[StartParallelContainer] Exception catched from proxy Shutdown...");
+ INFOS("[StartParallelContainer] Exception catched from proxy Shutdown...");
}
return ret;
}
obj = _NS->Resolve(containerNameInNS.c_str());
if (CORBA::is_nil(obj))
{
- INFOS("[StartParallelContainer] CONNECTION FAILED From Naming Service !");
- INFOS("[StartParallelContainer] Container name is " << containerNameInNS);
- return ret;
+ INFOS("[StartParallelContainer] CONNECTION FAILED From Naming Service !");
+ INFOS("[StartParallelContainer] Container name is " << containerNameInNS);
+ return ret;
}
try
{
- MESSAGE("[StartParallelContainer] Deploying node : " << container_node_name);
- PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj);
- node->deploy();
- MESSAGE("[StartParallelContainer] node " << container_node_name << " is deployed");
+ MESSAGE("[StartParallelContainer] Deploying node : " << container_node_name);
+ PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj);
+ node->deploy();
+ MESSAGE("[StartParallelContainer] node " << container_node_name << " is deployed");
}
catch(CORBA::SystemException& e)
{
- INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
- INFOS("CORBA::SystemException : " << e);
- return ret;
+ INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
+ INFOS("CORBA::SystemException : " << e);
+ return ret;
}
catch(CORBA::Exception& e)
{
- INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
- INFOS("CORBA::Exception" << e);
- return ret;
+ INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
+ INFOS("CORBA::Exception" << e);
+ return ret;
}
catch(...)
{
- INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
- INFOS("Unknown exception !");
- return ret;
+ INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
+ INFOS("Unknown exception !");
+ return ret;
}
}
//=============================================================================
CORBA::Object_ptr
SALOME_ContainerManager::LaunchParallelContainer(const std::string& command,
- const Engines::MachineParameters& params,
- const std::string& name,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine)
+ const Engines::MachineParameters& params,
+ const std::string& name,
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine)
{
CORBA::Object_ptr obj = CORBA::Object::_nil();
std::string containerNameInNS;
INFOS("[LaunchParallelContainer] Waiting for Parallel Container node " << containerNameInNS << " on " << theMachine);
while (CORBA::is_nil(obj) && count) {
#ifndef WIN32
- sleep(1) ;
+ sleep(1) ;
#else
- Sleep(1000);
+ Sleep(1000);
#endif
- count-- ;
- obj = _NS->Resolve(containerNameInNS.c_str());
+ count-- ;
+ obj = _NS->Resolve(containerNameInNS.c_str());
}
if (CORBA::is_nil(obj))
{
- INFOS("[LaunchParallelContainer] Launch of node failed (or not found) !");
- return obj;
+ INFOS("[LaunchParallelContainer] Launch of node failed (or not found) !");
+ return obj;
}
}
}
{
string command;
int nbproc;
-
+
if ( ! _isAppliSalomeDefined )
command = BuildTempFileToLaunchRemoteContainer(machine, params);
throw SALOME_Exception("Unknown protocol");
if (resInfo.UserName != "")
- {
- command += resInfo.UserName;
- command += "@";
- }
+ {
+ command += resInfo.UserName;
+ command += "@";
+ }
command += machine;
command += " ";
if (resInfo.AppliPath != "")
- command += resInfo.AppliPath; // path relative to user@machine $HOME
+ command += resInfo.AppliPath; // path relative to user@machine $HOME
else
- {
- ASSERT(getenv("APPLI"));
- command += getenv("APPLI"); // path relative to user@machine $HOME
- }
+ {
+ ASSERT(getenv("APPLI"));
+ command += getenv("APPLI"); // path relative to user@machine $HOME
+ }
command += "/runRemote.sh ";
}
if(params.isMPI)
- {
- command += " mpirun -np ";
- std::ostringstream o;
- o << nbproc << " ";
- command += o.str();
+ {
+ command += " mpirun -np ";
+ std::ostringstream o;
+ o << nbproc << " ";
+ command += o.str();
#ifdef WITHLAM
- command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
+ command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
#elif defined(WITHOPENMPI)
- if( getenv("OMPI_URI_FILE") == NULL )
- command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
- else{
- command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
- command += getenv("OMPI_URI_FILE");
- }
-#endif
- command += " SALOME_MPIContainer ";
- }
+ if( getenv("OMPI_URI_FILE") == NULL )
+ command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
+ else{
+ command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
+ command += getenv("OMPI_URI_FILE");
+ }
+#endif
+ command += " SALOME_MPIContainer ";
+ }
else
command += " " +container_exe+ " ";
#elif defined(WITHOPENMPI)
//command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace ";
if( getenv("OMPI_URI_FILE") == NULL )
- command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
+ command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
else
{
command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
tempOutputFile << "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
#elif defined(WITHOPENMPI)
if( getenv("OMPI_URI_FILE") == NULL )
- tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
+ tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
else{
- tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
- tempOutputFile << getenv("OMPI_URI_FILE");
+ tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
+ tempOutputFile << getenv("OMPI_URI_FILE");
}
#endif
}
//=============================================================================
string
SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string& exe_name,
- const Engines::MachineParameters& params,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
- const std::string proxy_hostname)
+ const Engines::MachineParameters& params,
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
+ const std::string proxy_hostname)
{
// This method knows the differences between the proxy and the nodes.
// nb_component_nodes is not used in the same way if it is a proxy or
if (is_a_proxy)
{
machine_file_name = _ResManager->getMachineFile(hostname,
- 1,
- parallelLib);
+ 1,
+ parallelLib);
}
else
{
machine_file_name = _ResManager->getMachineFile(hostname,
- params.nb_component_nodes,
- parallelLib);
+ params.nb_component_nodes,
+ parallelLib);
}
if (machine_file_name == "")
{
std::string command_remote("");
if (remote)
{
- std::string machine_name;
- std::ifstream machine_file(machine_file_name.c_str());
- std::getline(machine_file, machine_name);
- MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name)
-
- // We want to launch a command like :
- // ssh user@machine distantPath/runRemote.sh hostNS portNS
- const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name);
- if (resInfo.Protocol == rsh)
- command_remote = "rsh ";
- else
- command_remote = "ssh ";
- command_remote += resInfo.UserName;
- command_remote += "@";
- command_remote += machine_name;
- command_remote += " ";
- command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
- command_remote += "/runRemote.sh ";
- ASSERT(getenv("NSHOST"));
- command_remote += getenv("NSHOST"); // hostname of CORBA name server
- command_remote += " ";
- ASSERT(getenv("NSPORT"));
- command_remote += getenv("NSPORT"); // port of CORBA name server
- command_remote += " ";
-
- hostname = machine_name;
+ std::string machine_name;
+ std::ifstream machine_file(machine_file_name.c_str());
+ std::getline(machine_file, machine_name);
+ MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name)
+
+ // We want to launch a command like :
+ // ssh user@machine distantPath/runRemote.sh hostNS portNS
+ const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name);
+ if (resInfo.Protocol == rsh)
+ command_remote = "rsh ";
+ else
+ command_remote = "ssh ";
+ command_remote += resInfo.UserName;
+ command_remote += "@";
+ command_remote += machine_name;
+ command_remote += " ";
+ command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
+ command_remote += "/runRemote.sh ";
+ ASSERT(getenv("NSHOST"));
+ command_remote += getenv("NSHOST"); // hostname of CORBA name server
+ command_remote += " ";
+ ASSERT(getenv("NSPORT"));
+ command_remote += getenv("NSPORT"); // port of CORBA name server
+ command_remote += " ";
+
+ hostname = machine_name;
}
command = real_exe_name;
{
std::ifstream * machine_file = NULL;
if (remote)
- machine_file = new std::ifstream(machine_file_name.c_str());
+ machine_file = new std::ifstream(machine_file_name.c_str());
for (int i= 0; i < nb_nodes; i++)
{
- std::string command_remote("");
- if (remote)
- {
- std::string machine_name;
- std::getline(*machine_file, machine_name);
- MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name)
-
- // We want to launch a command like :
- // ssh user@machine distantPath/runRemote.sh hostNS portNS
- const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name);
- if (resInfo.Protocol == rsh)
- command_remote = "rsh ";
- else
- command_remote = "ssh ";
- command_remote += resInfo.UserName;
- command_remote += "@";
- command_remote += machine_name;
- command_remote += " ";
- command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
- command_remote += "/runRemote.sh ";
- ASSERT(getenv("NSHOST"));
- command_remote += getenv("NSHOST"); // hostname of CORBA name server
- command_remote += " ";
- ASSERT(getenv("NSPORT"));
- command_remote += getenv("NSPORT"); // port of CORBA name server
- command_remote += " ";
-
- hostname = machine_name;
- }
-
- std::ostringstream tmp;
- tmp << i;
- std::string proc_number = tmp.str();
-
- std::string command_tmp("");
- command_tmp += real_exe_name;
- command_tmp += " " + _NS->ContainerName(rtn);
- command_tmp += " " + parallelLib;
- command_tmp += " " + proxy_hostname;
- command_tmp += " " + proc_number;
- command_tmp += " -";
- AddOmninamesParams(command_tmp);
-
- // On change _Node_ par _Nodex_ pour avoir chaque noeud
- // sur un fichier
- std::string command_end_tmp = command_end;
- std::string::size_type loc_node = command_end_tmp.find("_Node_");
- if (loc_node != std::string::npos)
- command_end_tmp.insert(loc_node+5, proc_number);
- command += command_begin + command_remote + command_tmp + command_end_tmp;
- vect_machine.push_back(hostname);
+ std::string command_remote("");
+ if (remote)
+ {
+ std::string machine_name;
+ std::getline(*machine_file, machine_name);
+ MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name)
+
+ // We want to launch a command like :
+ // ssh user@machine distantPath/runRemote.sh hostNS portNS
+ const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name);
+ if (resInfo.Protocol == rsh)
+ command_remote = "rsh ";
+ else
+ command_remote = "ssh ";
+ command_remote += resInfo.UserName;
+ command_remote += "@";
+ command_remote += machine_name;
+ command_remote += " ";
+ command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
+ command_remote += "/runRemote.sh ";
+ ASSERT(getenv("NSHOST"));
+ command_remote += getenv("NSHOST"); // hostname of CORBA name server
+ command_remote += " ";
+ ASSERT(getenv("NSPORT"));
+ command_remote += getenv("NSPORT"); // port of CORBA name server
+ command_remote += " ";
+
+ hostname = machine_name;
+ }
+
+ std::ostringstream tmp;
+ tmp << i;
+ std::string proc_number = tmp.str();
+
+ std::string command_tmp("");
+ command_tmp += real_exe_name;
+ command_tmp += " " + _NS->ContainerName(rtn);
+ command_tmp += " " + parallelLib;
+ command_tmp += " " + proxy_hostname;
+ command_tmp += " " + proc_number;
+ command_tmp += " -";
+ AddOmninamesParams(command_tmp);
+
+ // On change _Node_ par _Nodex_ pour avoir chaque noeud
+ // sur un fichier
+ std::string command_end_tmp = command_end;
+ std::string::size_type loc_node = command_end_tmp.find("_Node_");
+ if (loc_node != std::string::npos)
+ command_end_tmp.insert(loc_node+5, proc_number);
+ command += command_begin + command_remote + command_tmp + command_end_tmp;
+ vect_machine.push_back(hostname);
}
if (machine_file)
- delete machine_file;
+ delete machine_file;
}
}
else if (parallelLib == "Mpi")
std::string command_remote("");
const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
if (resInfo.Protocol == rsh)
- command_remote = "rcp ";
+ command_remote = "rcp ";
else
- command_remote = "scp ";
+ command_remote = "scp ";
command_remote += machine_file_name;
command_remote += " ";
int status = system(command_remote.c_str());
if (status == -1)
{
- INFOS("copy of the mpi machine file failed !");
- return "";
+ INFOS("copy of the mpi machine file failed !");
+ return "";
}
}
std::string command_remote("");
if (remote)
{
- // We want to launch a command like :
- // ssh user@machine distantPath/runRemote.sh hostNS portNS
- const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
- if (resInfo.Protocol == rsh)
- command_remote = "rsh ";
- else
- command_remote = "ssh ";
- command_remote += resInfo.UserName;
- command_remote += "@";
- command_remote += remote_machine;
- command_remote += " ";
- command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
- command_remote += "/runRemote.sh ";
- ASSERT(getenv("NSHOST"));
- command_remote += getenv("NSHOST"); // hostname of CORBA name server
- command_remote += " ";
- ASSERT(getenv("NSPORT"));
- command_remote += getenv("NSPORT"); // port of CORBA name server
- command_remote += " ";
-
- hostname = remote_machine;
+ // We want to launch a command like :
+ // ssh user@machine distantPath/runRemote.sh hostNS portNS
+ const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
+ if (resInfo.Protocol == rsh)
+ command_remote = "rsh ";
+ else
+ command_remote = "ssh ";
+ command_remote += resInfo.UserName;
+ command_remote += "@";
+ command_remote += remote_machine;
+ command_remote += " ";
+ command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
+ command_remote += "/runRemote.sh ";
+ ASSERT(getenv("NSHOST"));
+ command_remote += getenv("NSHOST"); // hostname of CORBA name server
+ command_remote += " ";
+ ASSERT(getenv("NSPORT"));
+ command_remote += getenv("NSPORT"); // port of CORBA name server
+ command_remote += " ";
+
+ hostname = remote_machine;
}
// We use Dummy proxy for MPI parallel containers
std::string command_remote("");
if (remote)
{
- const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
- if (resInfo.Protocol == rsh)
- command_remote = "rsh ";
- else
- command_remote = "ssh ";
- command_remote += resInfo.UserName;
- command_remote += "@";
- command_remote += remote_machine;
- command_remote += " ";
-
- std::string new_real_exe_name("");
- new_real_exe_name += resInfo.AppliPath; // path relative to user@machine $HOME
- new_real_exe_name += "/runRemote.sh ";
- ASSERT(getenv("NSHOST"));
- new_real_exe_name += getenv("NSHOST"); // hostname of CORBA name server
- new_real_exe_name += " ";
- ASSERT(getenv("NSPORT"));
- new_real_exe_name += getenv("NSPORT"); // port of CORBA name server
- new_real_exe_name += " ";
-
- real_exe_name = new_real_exe_name + real_exe_name;
- hostname = remote_machine;
+ const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
+ if (resInfo.Protocol == rsh)
+ command_remote = "rsh ";
+ else
+ command_remote = "ssh ";
+ command_remote += resInfo.UserName;
+ command_remote += "@";
+ command_remote += remote_machine;
+ command_remote += " ";
+
+ std::string new_real_exe_name("");
+ new_real_exe_name += resInfo.AppliPath; // path relative to user@machine $HOME
+ new_real_exe_name += "/runRemote.sh ";
+ ASSERT(getenv("NSHOST"));
+ new_real_exe_name += getenv("NSHOST"); // hostname of CORBA name server
+ new_real_exe_name += " ";
+ ASSERT(getenv("NSPORT"));
+ new_real_exe_name += getenv("NSPORT"); // port of CORBA name server
+ new_real_exe_name += " ";
+
+ real_exe_name = new_real_exe_name + real_exe_name;
+ hostname = remote_machine;
}
const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(hostname);
if (resInfo.mpi == lam)
{
- command = "mpiexec -ssi boot ";
- if (resInfo.Protocol == rsh)
- command += "rsh ";
- else
- command += "ssh ";
- command += "-machinefile " + machine_file_name + " ";
- command += "-n " + nbproc + " ";
- command += real_exe_name;
- command += " " + _NS->ContainerName(rtn);
- command += " " + parallelLib;
- command += " " + proxy_hostname;
- command += " -";
- AddOmninamesParams(command);
+ command = "mpiexec -ssi boot ";
+ if (resInfo.Protocol == rsh)
+ command += "rsh ";
+ else
+ command += "ssh ";
+ command += "-machinefile " + machine_file_name + " ";
+ command += "-n " + nbproc + " ";
+ command += real_exe_name;
+ command += " " + _NS->ContainerName(rtn);
+ command += " " + parallelLib;
+ command += " " + proxy_hostname;
+ command += " -";
+ AddOmninamesParams(command);
}
else
{
- command = "mpirun -np " + nbproc + " ";
- command += real_exe_name;
- command += " " + _NS->ContainerName(rtn);
- command += " " + parallelLib;
- command += " " + proxy_hostname;
- command += " -";
- AddOmninamesParams(command);
+ command = "mpirun -np " + nbproc + " ";
+ command += real_exe_name;
+ command += " " + _NS->ContainerName(rtn);
+ command += " " + parallelLib;
+ command += " " + proxy_hostname;
+ command += " -";
+ AddOmninamesParams(command);
}
command = command_begin + command_remote + command + command_end;
for (int i= 0; i < nb_nodes; i++)
- vect_machine.push_back(proxy_hostname);
+ vect_machine.push_back(proxy_hostname);
}
}
else
void fillBatchLaunchedContainers();
std::string BuildCommandToLaunchRemoteContainer(const std::string& machine,
- const Engines::MachineParameters& params,
- const std::string& container_exe="SALOME_Container");
+ const Engines::MachineParameters& params,
+ const std::string& container_exe="SALOME_Container");
std::string BuildCommandToLaunchLocalContainer(const Engines::MachineParameters& params,
const std::string& container_exe="SALOME_Container");
std::string BuildTempFileToLaunchRemoteContainer(const std::string& machine,
- const Engines::MachineParameters& params) throw(SALOME_Exception);
+ const Engines::MachineParameters& params) throw(SALOME_Exception);
void RmTmpFile(std::string& tmpFile);
// For PacO++ Parallel extension
typedef std::vector<std::string> actual_launch_machine_t;
std::string BuildCommandToLaunchParallelContainer(const std::string& exe_name,
- const Engines::MachineParameters& params,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
- const std::string proxy_hostname = "");
+ const Engines::MachineParameters& params,
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
+ const std::string proxy_hostname = "");
CORBA::Object_ptr
LaunchParallelContainer(const std::string& command,
- const Engines::MachineParameters& params,
- const std::string& name,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine);
+ const Engines::MachineParameters& params,
+ const std::string& name,
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine);
CORBA::ORB_var _orb;
PortableServer::POA_var _poa;
#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
#=============================================================================
-#define an implementation of the container interface
+#define an implementation of the container interface for the container implemented in Python
class SALOME_ContainerPy_i (Engines__POA.Container):
_orb = None
self._poa = poa
myMachine=getShortHostName()
Container_path = "/Containers/" + myMachine + "/" + containerName
- #self._containerName = containerName
self._containerName = Container_path
if verbose(): print "container name ",self._containerName
if verbose(): print "import ",componentName," successful"
ret=1
except:
- if verbose():
- import traceback
- traceback.print_exc()
- print "import ",componentName," not possible"
+ import traceback
+ traceback.print_exc()
+ print "import ",componentName," not possible"
return ret
#-------------------------------------------------------------------------
ret = 0
instanceName = componentName + "_inst_" + `self._numInstance`
interfaceName = componentName
- #the_command = "import " + componentName + "\n"
- #the_command = the_command + "comp_i = " + componentName + "." + componentName
- #the_command = the_command + "(self._orb, self._poa, self._this(), self._containerName, instanceName, interfaceName)\n"
- #MESSAGE( "SALOME_ContainerPy_i::load_component_Library :" + str (the_command) )
- #exec the_command
- #comp_o = comp_i._this()
- #if comp_o is not None:
- # ret = 1
- #else:
- # --- try to import Python component
- # retImpl = self.import_component(componentName)
- # if retImpl == 1:
- #import is possible
- # ret = 1
- # else:
- #import isn't possible
- # ret = 0
- #return ret
return self.import_component(componentName)
#-------------------------------------------------------------------------
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Component)
+#include CORBA_SERVER_HEADER(SALOME_PyNode)
#include <iostream>
#include <signal.h>
public:
Engines_Container_i();
Engines_Container_i(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- char * containerName ,
+ PortableServer::POA_ptr poa,
+ char * containerName ,
int argc, char* argv[],
- bool activAndRegist = true,
- bool isServantAloneInProcess = true);
+ bool activAndRegist = true,
+ bool isServantAloneInProcess = true);
virtual ~Engines_Container_i();
// --- CORBA methods
virtual Engines::Component_ptr
create_component_instance( const char* componentName,
- CORBA::Long studyId); // 0 for multiStudy
+ CORBA::Long studyId); // 0 for multiStudy
Engines::Component_ptr
find_component_instance( const char* registeredName,
- CORBA::Long studyId); // 0 for multiStudy
+ CORBA::Long studyId); // 0 for multiStudy
Engines::Component_ptr
load_impl(const char* nameToRegister,
- const char* componentName);
+ const char* componentName);
void remove_impl(Engines::Component_ptr component_i);
virtual Engines::Salome_file_ptr createSalome_file(const char* origFileName);
void copyFile(Engines::Container_ptr container, const char* remoteFile, const char* localFile);
+ Engines::PyNode_ptr createPyNode(const char* nodeName, const char* code);
// --- local C++ methods
Engines::Component_ptr
find_or_create_instance( std::string genericRegisterName,
- std::string componentLibraryName);
+ std::string componentLibraryName);
Engines::Component_ptr
createInstance(std::string genericRegisterName,
- void *handle,
- int studyId);
+ void *handle,
+ int studyId);
static bool isPythonContainer(const char* ContainerName);
static void decInstanceCnt(std::string genericRegisterName);
//=============================================================================
fileRef_i::fileRef_i(Engines::Container_ptr container,
- const char* origFileName)
+ const char* origFileName)
{
MESSAGE("fileRef_i::fileRef_i "<< origFileName);
_container = Engines::Container::_duplicate(container);
//=============================================================================
CORBA::Boolean fileRef_i::addRef(const char* machine,
- const char* fileName)
+ const char* fileName)
{
MESSAGE("fileRef_i::addRef " << machine << " " << fileName);
string theMachine = machine;
if (! _copies[theMachine].empty())
{
INFOS("there is already a copy on " << theMachine << " under the path "
- << _copies[theMachine] << " new ref not added! ");
+ << _copies[theMachine] << " new ref not added! ");
return 0;
}
if (_copies[theMachine].empty())
{
MESSAGE("no copy of " << _machine << _origFileName << " available on "
- << theMachine);
+ << theMachine);
}
else
{
MESSAGE("a copy of " << _machine << _origFileName << "is available on "
- << theMachine << _copies[theMachine]);
+ << theMachine << _copies[theMachine]);
}
return CORBA::string_dup(_copies[theMachine].c_str());
}
public:
fileRef_i();
fileRef_i(Engines::Container_ptr container,
- const char* origFileName);
+ const char* origFileName);
virtual ~fileRef_i();
char* origFileName();
Engines::Container_ptr getContainer();
CORBA::Boolean addRef(const char* machine,
- const char* fileName);
+ const char* fileName);
char* getRef(const char* machine);
--- /dev/null
+#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# File : SALOME_PyNode.py
+# Author : Christian CAREMOLI, EDF
+# Module : SALOME
+# $Header$
+#
+
+import sys,traceback,string
+import linecache
+import cPickle
+import Engines__POA
+import SALOME__POA
+import SALOME
+
+class Generic(SALOME__POA.GenericObj):
+ """A Python implementation of the GenericObj CORBA IDL"""
+ def __init__(self,poa):
+ self.poa=poa
+ self.cnt=1
+
+ def Register(self):
+ self.cnt+=1
+
+ def Destroy(self):
+ self.cnt-=1
+ if self.cnt <= 0:
+ oid=self.poa.servant_to_id(self)
+ self.poa.deactivate_object(oid)
+
+class PyNode_i (Engines__POA.PyNode,Generic):
+ """The implementation of the PyNode CORBA IDL"""
+ def __init__(self, nodeName,code,poa):
+ """Initialize the node : compilation in the local context"""
+ Generic.__init__(self,poa)
+ self.nodeName=nodeName
+ self.code=code
+ linecache.cache[nodeName]=0,None,string.split(code,'\n'),nodeName
+ ccode=compile(code,nodeName,'exec')
+ self.context={}
+ exec ccode in self.context
+
+ def execute(self,funcName,argsin):
+ """Execute the function funcName found in local context with pickled args (argsin)"""
+ try:
+ argsin,kws=cPickle.loads(argsin)
+ func=self.context[funcName]
+ argsout=func(*argsin,**kws)
+ argsout=cPickle.dumps(argsout,-1)
+ return argsout
+ except:
+ exc_typ,exc_val,exc_fr=sys.exc_info()
+ l=traceback.format_exception(exc_typ,exc_val,exc_fr)
+ raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"".join(l),"PyNode: %s, function: %s" % (self.nodeName,funcName),0))
+
if (mode == "all") {
- // Changing path, is now current directory
- path = getcwd(NULL, _path_max);
+ // Changing path, is now current directory
+ path = getcwd(NULL, _path_max);
- std::string group_name("GROUP");
- group_name += file_name;
- hdf_group = new HDFgroup(group_name.c_str(),hdf_file);
- hdf_group->OpenOnDisk();
- hdf_dataset = new HDFdataset("FILE DATASET",hdf_group);
- hdf_dataset->OpenOnDisk();
- size = hdf_dataset->GetSize();
- buffer = new char[size];
+ std::string group_name("GROUP");
+ group_name += file_name;
+ hdf_group = new HDFgroup(group_name.c_str(),hdf_file);
+ hdf_group->OpenOnDisk();
+ hdf_dataset = new HDFdataset("FILE DATASET",hdf_group);
+ hdf_dataset->OpenOnDisk();
+ size = hdf_dataset->GetSize();
+ buffer = new char[size];
- if ( (fd = ::open(file_name.c_str(),O_RDWR|O_CREAT,00666)) <0) {
- SALOME::ExceptionStruct es;
- es.type = SALOME::INTERNAL_ERROR;
- std::string text = "open failed";
- es.text = CORBA::string_dup(text.c_str());
- throw SALOME::SALOME_Exception(es);
- };
- hdf_dataset->ReadFromDisk(buffer);
- if ( write(fd,buffer,size) <0) {
- SALOME::ExceptionStruct es;
- es.type = SALOME::INTERNAL_ERROR;
- std::string text = "write failed";
- es.text = CORBA::string_dup(text.c_str());
- throw SALOME::SALOME_Exception(es);
- };
- // Close the target file
- ::close(fd);
-
- Engines::file infos;
- infos.file_name = CORBA::string_dup(file_name.c_str());
- infos.path = CORBA::string_dup(path.c_str());
- infos.type = CORBA::string_dup(type.c_str());
- infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
- infos.status = CORBA::string_dup(status.c_str());
-
- _fileManaged[file_name] = infos;
-
- // Update Salome_file state
- _state.number_of_files++;
- _state.files_ok = true;
+ if ( (fd = ::open(file_name.c_str(),O_RDWR|O_CREAT,00666)) <0) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "open failed";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ };
+ hdf_dataset->ReadFromDisk(buffer);
+ if ( write(fd,buffer,size) <0) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "write failed";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ };
+ // Close the target file
+ ::close(fd);
+
+ Engines::file infos;
+ infos.file_name = CORBA::string_dup(file_name.c_str());
+ infos.path = CORBA::string_dup(path.c_str());
+ infos.type = CORBA::string_dup(type.c_str());
+ infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
+ infos.status = CORBA::string_dup(status.c_str());
+
+ _fileManaged[file_name] = infos;
+
+ // Update Salome_file state
+ _state.number_of_files++;
+ _state.files_ok = true;
}
else {
- Engines::file infos;
- infos.file_name = CORBA::string_dup(file_name.c_str());
- infos.path = CORBA::string_dup(path.c_str());
- infos.type = CORBA::string_dup(type.c_str());
- infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
- infos.status = CORBA::string_dup(status.c_str());
- // Infos for parallel extensions...
- infos.node = 0;
- infos.container = Engines::Container::_duplicate(_container);
-
- _fileManaged[file_name] = infos;
-
- // Update Salome_file state
- _state.number_of_files++;
- if (status != "ok")
- _state.files_ok = false;
+ Engines::file infos;
+ infos.file_name = CORBA::string_dup(file_name.c_str());
+ infos.path = CORBA::string_dup(path.c_str());
+ infos.type = CORBA::string_dup(type.c_str());
+ infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
+ infos.status = CORBA::string_dup(status.c_str());
+ // Infos for parallel extensions...
+ infos.node = 0;
+ infos.container = Engines::Container::_duplicate(_container);
+
+ _fileManaged[file_name] = infos;
+
+ // Update Salome_file state
+ _state.number_of_files++;
+ if (status != "ok")
+ _state.files_ok = false;
}
}
}
_t_fileDistributedSource::iterator it = _fileDistributedSource.find(file_name);
if (it == _fileDistributedSource.end())
{
- _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file);
+ _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file);
}
}
}
//=============================================================================
void
Salome_file_i::connectDistributedFile(const char * file_name,
- Engines::Salome_file_ptr source_Salome_file)
+ Engines::Salome_file_ptr source_Salome_file)
{
// Test if this file is added
_t_fileManaged::iterator it = _fileManaged.find(file_name);
//=============================================================================
void
Salome_file_i::setDistributedSourceFile(const char* file_name,
- const char * source_file_name)
+ const char * source_file_name)
{
std::string fname(file_name);
if (std::string(file_infos.type.in()) == "local")
{
if (std::string(file_infos.status.in()) == "not_ok")
- result = checkLocalFile(file_infos.file_name.in());
+ result = checkLocalFile(file_infos.file_name.in());
}
else
{
if (std::string(file_infos.status.in()) == "not_ok")
- result = getDistributedFile(file_infos.file_name.in());
+ result = getDistributedFile(file_infos.file_name.in());
}
// if the result is false
// we add this file to files_not_ok
// Configure DistributedFile
virtual void connect(Engines::Salome_file_ptr source_Salome_file);
virtual void connectDistributedFile(const char * file_name,
- Engines::Salome_file_ptr source_Salome_file);
+ Engines::Salome_file_ptr source_Salome_file);
virtual void setDistributedSourceFile(const char* file_name,
- const char * source_file_name);
+ const char * source_file_name);
// Recv and check files
virtual void recvFiles();
map<string, DF_Attribute*>::iterator mi;
for(mi =_node->_attributes.begin(); mi != _node->_attributes.end(); mi++) {
if(mi->second == this) {
- _node->_attributes.erase(mi);
- }
+ _node->_attributes.erase(mi);
+ return;
+ }
}
}
}
delete vn[i];
_root._node->Reset();
+ _root.Nullify();
}
//Returns true if this document is empty
//
#include "DSC_i.hxx"
+//#define MYDEBUG
+
Engines_DSC_i::
Engines_DSC_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
instanceName,
interfaceName)
{
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
#endif
}
bool regist) :
Engines_Component_i(orb, poa, container, instanceName, interfaceName,notif,regist)
{
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
#endif
}
//
#include <string>
#include "DSC_interface.hxx"
+#ifdef WNT
+#else
+#include <sys/time.h>
+#endif
+#include <fstream>
+#include <sys/stat.h>
+#include <sstream>
+#include <stdlib.h>
+
+//#define MYDEBUG
Engines_DSC_interface::Engines_DSC_interface() {}
Engines::DSC::BadPortType BPT;
BPT.expected = CORBA::string_dup("Expected a uses port");
BPT.received = CORBA::string_dup((std::string("Received a provides/none port : ")+uses_port_name).c_str());
+#ifdef MYDEBUG
std::cout << "---- DSC_Interface : MARK 1 ---- exception : " << uses_port_name << "----" << std::endl;
+#endif
throw BPT;
}
}
else
{
+#ifdef MYDEBUG
std::cout << "---- DSC_Interface : MARK 2 ---- exception : " << uses_port_name << "----" << std::endl;
+#endif
throw Engines::DSC::PortNotConnected();
}
rtn_properties = Ports::PortProperties::_duplicate(my_ports[port_name]->port_prop);
return rtn_properties;
}
+
+//Trace functions for DSC operations: a local function (initTrace) and a class method (Engines_DSC_interface::writeEvent)
+static int traceType=-1; // 0=stderr;1=file;
+static int traceLevel=-1; // 0=no trace;1=normal trace;2=detailed trace
+static std::ofstream traceFile;
+static std::ostream *out;
+
+//! Initialize the trace file
+/*!
+ * The trace file depends on an environment variable (DSC_TRACE). If this variable
+ * is equal to 1, the trace file is a file with the name : <TMPDIR>/<container name>.tce.
+ * In all other cases, the trace file is stderr
+ * The environment variable DSC_TRACELEVEL can be used to suppress the trace (value 0)
+ *
+ * \param containerName the name of the container where the trace is built
+ */
+static void initTrace(const std::string& containerName)
+{
+ // if initialization has already been done do nothing
+ if(traceLevel >= 0)return;
+
+ std::string typeenv="0";
+ std::string levelenv="1";
+ char* valenv=0;
+ valenv=getenv("DSC_TRACE");
+ if(valenv)typeenv=valenv;
+ valenv=getenv("DSC_TRACELEVEL");
+ if(valenv)levelenv=valenv;
+
+ if(levelenv=="0")
+ traceLevel=0; // no trace
+ else if(levelenv=="2")
+ traceLevel=2; //detailed trace
+ else
+ traceLevel=1; // normal trace (default)
+
+ if(traceLevel==0)
+ return;
+
+ if(typeenv=="1")
+ {
+ //trace in file
+ traceType=1;
+#ifdef WNT
+ std::string logFilename=getenv("TEMP");
+ logFilename += "\\";
+#else
+ std::string logFilename="/tmp";
+ char* val = getenv("SALOME_TMP_DIR");
+ if(val)
+ {
+ struct stat file_info;
+ stat(val, &file_info);
+ bool is_dir = S_ISDIR(file_info.st_mode);
+ if (is_dir)logFilename=val;
+ }
+ logFilename += "/";
+#endif
+
+ logFilename=logFilename+containerName+".tce";
+ traceFile.open(logFilename.c_str(), std::ios::out | std::ios::app);
+ out=&traceFile;
+ }
+ else
+ {
+ //trace to stderr (default)
+ traceType=0;
+ out=&std::cerr;
+ }
+ //trace heading
+ out->width(17);
+ *out << "Elapsed time" ;
+ *out << " | " ;
+ out->width(16);
+ *out << "Request" ;
+ *out << " | " ;
+ out->width(16);
+ *out << "Container" ;
+ *out << " | " ;
+ out->width(16);
+ *out << "Instance" ;
+ *out << " | " ;
+ out->width(16);
+ *out << "Port" ;
+ *out << " | " ;
+ out->width(24);
+ *out << "Error";
+ *out << " | " ;
+ *out << "Infos" ;
+ *out << std::endl;
+}
+
+
+//! Write a record in the trace file
+/*!
+ * \param request the name of the request executed
+ * \param containerName the name of the container where the request is executed
+ * \param instance_name the name of the component where the request is executed
+ * \param port_name the name of the port that is concerned
+ * \param error if an error has occured, a string that identifies the error
+ * \param message informations about error or about the request
+ */
+void Engines_DSC_interface::writeEvent(const char* request,const std::string& containerName, const char* instance_name,
+ const char* port_name, const char* error, const char* message)
+{
+ if(traceLevel < 0)
+ initTrace(containerName);
+ if(traceLevel == 0)return;
+
+#ifdef WNT
+#else
+ struct timeval tv;
+ gettimeofday(&tv,0);
+ long tt0=tv.tv_sec/3600; //hours
+
+ if(traceType == 2)
+ {
+ //notifier (not used: salome notifier is now obsolete)
+ std::ostringstream msg;
+ msg.width(7);
+ msg << tt0 ;
+ msg << ":" ;
+ long tt1=(tv.tv_sec-3600*tt0)/60;//minutes
+ msg.width(2);
+ msg << tt1 ;
+ msg << ":" ;
+ long tt2=tv.tv_sec - 3600*tt0-60*tt1; //seconds
+ msg.width(2);
+ msg << tt2 ;
+ msg << ":" ;
+ long tt3=tv.tv_usec/1000; //milliseconds
+ msg.width(3);
+ msg << tt3 ;
+ msg << " | " ;
+ msg.width(24);
+ msg << error;
+ msg << " | " ;
+ msg << message ;
+ //send event to notifier (containerName.c_str(),instance_name, request, msg.str().c_str())
+ }
+ else
+ {
+ //cerr or file
+ out->width(7);
+ *out << tt0 ;
+ *out << ":" ;
+ long tt1=(tv.tv_sec-3600*tt0)/60;//minutes
+ out->width(2);
+ *out << tt1 ;
+ *out << ":" ;
+ long tt2=tv.tv_sec - 3600*tt0-60*tt1; //seconds
+ out->width(2);
+ *out << tt2 ;
+ *out << ":" ;
+ long tt3=tv.tv_usec/1000; //milliseconds
+ out->width(3);
+ *out << tt3 ;
+ *out << " | " ;
+ out->width(16);
+ *out << request ;
+ *out << " | " ;
+ out->width(16);
+ *out << containerName ;
+ *out << " | " ;
+ out->width(16);
+ *out << instance_name ;
+ *out << " | " ;
+ out->width(16);
+ *out << port_name ;
+ *out << " | " ;
+ out->width(24);
+ *out << error;
+ *out << " | " ;
+ *out << message ;
+ *out << std::endl;
+ }
+#endif
+}
+
virtual Ports::PortProperties_ptr get_port_properties(const char* port_name)
throw (Engines::DSC::PortNotDefined);
+ static void writeEvent(const char* request,const std::string& containerName, const char* instance_name,
+ const char* port_name, const char* error, const char* message);
+
protected:
/*-------------------------------------------------*/
-I$(top_srcdir)/src/Basics \
-I$(top_srcdir)/src/NamingService \
-I$(top_srcdir)/src/Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : Makefile.am
-# Author : André RIBES (EDF), Eric Fayolle (EDF)
+# Author : André RIBES (EDF), Eric Fayolle (EDF)
# Module : KERNEL
#
include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-I$(top_srcdir)/src/DSC/DSC_User/Datastream \
-I$(top_srcdir)/src/DSC/DSC_User/Datastream/Palm \
-I$(top_srcdir)/src/DSC/DSC_User/Datastream/Calcium \
+ -I$(top_builddir)/src/DSC/DSC_User/Datastream/Calcium \
-I$(top_srcdir)/src/DSC/DSC_User/Basic \
-I$(top_srcdir)/src/DSC/DSC_Basic \
-I$(top_srcdir)/src/SALOMELocalTrace \
-I$(top_srcdir)/src/Utils \
-I$(top_srcdir)/src/Container \
-I$(top_srcdir)/src/Notification \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@
../DSC_Basic/libSalomeDSCContainer.la \
../../Container/libSalomeContainer.la
-_calcium_la_CXXFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS)
+_calcium_la_CPPFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS)
EXTRA_DIST=calcium_wrap.cpp calcium.i
}
~stringArray()
{
- std::cerr << "~stringArray() " << nelem << std::endl;
for(int i=0;i<nelem;i++)
free(data[i]);
delete [] data;
%typemap(out) Ports::Port_ptr
{
$result = api->cxxObjRefToPyObjRef($1, 1);
- //All output Ports::Port_ptr variables are duplicated by security. Need to release them for python . Explanation ??
+ //All output Ports::Port_ptr variables are duplicated by security. Need to release them for python.
CORBA::release($1);
}
%typemap(out) Ports::PortProperties_ptr, Engines::Salome_file_ptr
{
$result = api->cxxObjRefToPyObjRef($1, 1);
+ //the _ptr is duplicated by the routine called.
+ //Need to release it for Python because the call to cxxObjRefToPyObjRef has created another ref with a count of 1
+ CORBA::release($1);
}
%typemap(out) Engines::DSC::uses_port *
CORBA::Boolean is_connected(const char* port_name) throw (Engines::DSC::PortNotDefined);
// End of DSC interface for python components
+ static void setTimeOut();
%extend
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
def checkOutputFilesToService(self,service_name):
return self.proxy.checkOutputFilesToService(service_name)
+ def beginService(self,service_name):
+ SALOME_ComponentPy.SALOME_ComponentPy_i.beginService(self,service_name)
+ self.proxy.setTimeOut()
+
-I$(top_srcdir)/src/SALOMELocalTrace \
-I$(top_srcdir)/src/Basics \
-I$(top_srcdir)/src/Utils \
- -I$(top_builddir)/salome_adm/unix \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
# This local variable defines the list of dependant libraries common to all target in this package.
#include "DisplayPair.hxx"
//
+//#define MYDEBUG
+
// Suppose que le container est trié
template < typename T > struct AdjacentFunctor {
// Suppose que les valeurs passées en paramètres sont triées par ordre croissant
bool operator()(const T &v1) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "AdjacentFunctor: " << _minValue << _maxValue << std::endl;
std::cout << "AdjacentFunctor: " << _min << _max << std::endl;
#endif
if ( v1 <= _minValue && v1 >= _maxValue)
{
_equal= true;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "AdjacentFunctor: _equal : " << v1 << std::endl;
#endif
return true;
if ( v1 < _minValue )
{
_min=v1;_minFound=true;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "AdjacentFunctor: _minFound : " <<_min << std::endl;
#endif
}
else if ( v1 > _maxValue )
{
_max=v1;_maxFound=true;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "AdjacentFunctor: _maxFound : " <<_max << std::endl;
#endif
}
bool isEqual() const { return _equal;}
bool isBounded() const { return _minFound && _maxFound;}
bool getBounds(TNoConst & min, TNoConst & max) const {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "_minFound : " <<_minFound << ", _maxFound " << _maxFound << std::endl;
#endif
if (_minFound && _maxFound ) { min=_min; max=_max; return true; }
// Module : KERNEL
#include "calcium.h"
+#include "calciumf.h"
+#include "CalciumFortranInt.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <stddef.h>
// Interface C de SalomeCalcium
typedef int InfoType;
typedef char bool;
+
/************************************/
/* INTERFACES DE LECTURE EN 0 COPIE */
/************************************/
long _i=*i; \
fflush(stdout); \
fflush(stderr); \
- fprintf(stderr,"Beginning of ecp_" #_name " : %s %d %f\n",nomvar,*i,*ti); \
- \
\
InfoType info = ecp_lecture_##_typeName (component, mode, ti, tf, &_i, \
nomvar, bufferLength, &_nRead, \
ecp_lecture_##_typeName##_free(data); \
};
-#define STAR *
-CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int,);
-CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,);
-CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,);
-CALCIUM_EXT_LECT_INTERFACE_C_(llo,float,int,bool,);
-CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,);
-/* CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]); */
/* L'interface de cette routine diffère de celle obtenue par la macro :
CALCIUM_LECT_INTERFACE_C_.
size_t _nRead;
long _i=*i;
fflush(stdout);fflush(stderr);
- fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti);
-
InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i,
nomvar, bufferLength, &_nRead,
if(mode == CP_SEQUENTIEL)
*i = _i;
*nRead=_nRead;
- fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i);
fflush(stdout);fflush(stderr);
return info;
};
+#define STAR *
+/*REVERIFIER MAINTENANT 0 COPY avec int2integer*/
+CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int2integer,);
+CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,);
+CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,);
+CALCIUM_EXT_LECT_INTERFACE_C_(llo,float,int,bool,);
+CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,);
+/* CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]); */
+
+
/**************************************/
/* INTERFACES DE LECTURE AVEC RECOPIE */
/**************************************/
-#define CALCIUM_LECT_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \
- InfoType cp_##_name (void * component, int mode, \
- _timeType * ti, _timeType * tf, int * i, \
- char * nomvar, int bufferLength, \
- int * nRead, _type _qual * data ) { \
+#define CALCIUM_LECT_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \
+ _calInt cp_##_name (void * component, _calInt mode, \
+ _timeType * ti, _timeType * tf, _calInt * i, \
+ char * nomvar, _calInt bufferLength, \
+ _calInt * nRead, _type _qual * data \
+ lastarg ) { \
+ \
+ int _mode = (int) mode; \
+ size_t _bufferLength = bufferLength; \
size_t _nRead; \
- long _i=*i; \
+ long _i =*i; \
fflush(stdout); \
fflush(stderr); \
- fprintf(stderr,"Beginning of cp_" #_name " : %s %d %f\n",nomvar,*i,*ti); \
\
- if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; \
+ if ( (data == NULL) || (_bufferLength < 1) ) return CPNTNULL; \
\
- InfoType info = ecp_lecture_##_typeName (component, mode, ti, tf, &_i, \
- nomvar, bufferLength, &_nRead, \
+ _calInt info = ecp_lecture_##_typeName (component, _mode, ti, tf, &_i, \
+ nomvar, _bufferLength, &_nRead, \
&data ); \
if(mode == CP_SEQUENTIEL) \
*i = _i; \
*nRead=_nRead; \
- fprintf(stderr,"End of cp_" #_name " : %s %d \n",nomvar,*i); \
fflush(stdout); \
fflush(stderr); \
\
Le paramètre supplémentaire strSize indique la taille fixe et identique
des chaînes stockées dans data (les ports CALCIUM n'en n'ont pas besoin)
*/
-InfoType cp_lch(void * component, int mode, float * ti, float * tf, int * i,
- char * nomvar, int bufferLength, int * nRead,
- char ** data, int strSize) {
- size_t _nRead;
- long _i=*i;
- fflush(stdout);fflush(stderr);
- fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti);
+/* InfoType cp_lch(void * component, int mode, float * ti, float * tf, int * i, */
+/* char * nomvar, int bufferLength, int * nRead, */
+/* char ** data, int strSize) { */
+
+/* size_t _nRead; */
+/* long _i=*i; */
+/* fflush(stdout);fflush(stderr); */
+/* fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti); */
- if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL;
+/* if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; */
- InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i,
- nomvar, bufferLength, &_nRead,
- &data);/*, strSize );
- strSize est inutile pour les ports CALCIUM
- qui gèrent des tailles quelconques de chaines. */
- if(mode == CP_SEQUENTIEL)
- *i = _i;
- *nRead=_nRead;
- fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i);
- fflush(stdout);fflush(stderr);
+/* InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, */
+/* nomvar, bufferLength, &_nRead, */
+/* &data);*/
+/*, strSize ); */
+/* strSize est inutile pour les ports CALCIUM */
+/* qui gèrent des tailles quelconques de chaines. */
+/* if(mode == CP_SEQUENTIEL) */
+/* *i = _i; */
+/* *nRead=_nRead; */
+/* fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i); */
+/* fflush(stdout);fflush(stderr); */
- return info;
-};
+/* return info; */
+/* }; */
/* Definition des méthodes calcium standard */
-
-CALCIUM_LECT_INTERFACE_C_(len,float,int,int,);
-CALCIUM_LECT_INTERFACE_C_(lre,float,float,float,);
-CALCIUM_LECT_INTERFACE_C_(ldb,double,double,double,);
-CALCIUM_LECT_INTERFACE_C_(llo,float,int,bool,);
-CALCIUM_LECT_INTERFACE_C_(lcp,float,float,cplx,);
+/* CALCIUM_LECT_INTERFACE_C_( <suffixe du nom de l'interface à générer>, <type du paramètre temporel>, <type d'entier à utiliser pour les paramètres de type entier>,
+ <type de données>, <nom de l'interface C2CPP à utiliser>, <qualificateur de type optionnel des données>,<paramètres supplémentaire ignoré>)*/
+
+CALCIUM_LECT_INTERFACE_C_(len,float ,int,int ,int2integer,,);
+/*llg ne sera pas disponible si sizeof(long) == 64 bits && cal_int==int
+ sinon problème de conversion de 64bits vers 32bits */
+CALCIUM_LECT_INTERFACE_C_(llg,float ,int,long ,long2integer,,);
+
+CALCIUM_LECT_INTERFACE_C_(lre,float ,int,float ,float,,);
+CALCIUM_LECT_INTERFACE_C_(ldb,double,int,double ,double,,);
+CALCIUM_LECT_INTERFACE_C_(llo,float ,int,int ,bool,,);
+CALCIUM_LECT_INTERFACE_C_(lcp,float ,int,float ,cplx,,);
#define STAR *
-/* CALCIUM_LECT_INTERFACE_C_(lch,float,char,STAR); */
+#define LCH_LAST_PARAM ,int strsize
+CALCIUM_LECT_INTERFACE_C_(lch,float ,int,char ,str,STAR, LCH_LAST_PARAM );
+
+
+/* Definition des méthodes calcium destinées à l'interfaçage fortran
+ avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */
+CALCIUM_LECT_INTERFACE_C_(len_fort_,float ,cal_int,cal_int ,integer,,);
+CALCIUM_LECT_INTERFACE_C_(lin_fort_,float ,cal_int,int ,int2integer,,);
+/*llg ne sera pas disponible si sizeof(long) == 64 bits && cal_int==int
+ sinon problème de conversion de 64bits vers 32bits */
+CALCIUM_LECT_INTERFACE_C_(llg_fort_,float ,cal_int,long ,long2integer,,);
+
+CALCIUM_LECT_INTERFACE_C_(lre_fort_,float ,cal_int,float ,float,,);
+CALCIUM_LECT_INTERFACE_C_(ldb_fort_,double,cal_int,double ,double,,);
+CALCIUM_LECT_INTERFACE_C_(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */
+CALCIUM_LECT_INTERFACE_C_(lcp_fort_,float ,cal_int,float ,cplx,,);
+CALCIUM_LECT_INTERFACE_C_(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_PARAM );
/**********************************************/
/**********************************************/
InfoType cp_cd (void * component, char * instanceName) {
- /* TODO : Trouver le nom de l'instance SALOME*/
- if (instanceName) strcpy(instanceName,"UNDEFINED");
- return CPOK;
+ InfoType info = ecp_cd_(component,instanceName);
+ return info;
}
+
InfoType cp_fin (void * component, int code) {
/* TODO : gérer avec les callbacks des ports DSC */
}
-
/***************************/
/* INTERFACES D'ECRITURE */
/***************************/
-#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \
- InfoType cp_##_name (void * component, int mode, \
- _timeType t, int i, \
- char * nomvar, int nbelem, \
- _type _qual * data ) { \
+#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \
+ _calInt cp_##_name (void * component, _calInt mode, \
+ _timeType t, _calInt i, \
+ char * nomvar, _calInt nbelem, \
+ _type _qual * data \
+ lastarg ) { \
\
- /*long _i=i;*/ \
+ int _mode = mode; \
+ long _i = i; \
+ size_t _nbelem = nbelem; \
+ _timeType _t = t; \
fflush(stdout); \
fflush(stderr); \
- fprintf(stderr,"Beginning of cp_" #_name " : %s %d %f\n",nomvar,i,t); \
if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; \
- \
- InfoType info = ecp_ecriture_##_typeName (component, mode, &t, i, \
- nomvar, nbelem, \
+ \
+ _calInt info = ecp_ecriture_##_typeName (component, _mode, &_t, _i, \
+ nomvar, _nbelem, \
data ); \
- fprintf(stderr,"End of cp_" #_name " : %s %d \n",nomvar,i); \
fflush(stdout); \
fflush(stderr); \
\
}; \
-/* Definition des méthodes calcium standard */
-CALCIUM_ECR_INTERFACE_C_(een,float,int,int,);
-CALCIUM_ECR_INTERFACE_C_(ere,float,float,float,);
-CALCIUM_ECR_INTERFACE_C_(edb,double,double,double,);
-/*CALCIUM_ECR_INTERFACE_C_(elo,float,bool,bool,);*/
-CALCIUM_ECR_INTERFACE_C_(elo,float,int,bool,);
-CALCIUM_ECR_INTERFACE_C_(ecp,float,float,cplx,);
-
-InfoType cp_ech(void * component, int mode, float t, int i,
- char * nomvar, int nbelem,
- char ** data, int strSize) {
+/* InfoType cp_ech(void * component, int mode, float t, int i, */
+/* char * nomvar, int nbelem, */
+/* char ** data, int strSize) { */
- /*long _i=i;*/
- fflush(stdout);fflush(stderr);
- fprintf(stderr,"Beginning of cp_ech: %s %d %f\n",nomvar,i,t);
- if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL;
+/*long _i=i;*/
+/* fflush(stdout);fflush(stderr); */
+/* fprintf(stderr,"Beginning of cp_ech: %s %d %f\n",nomvar,i,t); */
+/* if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; */
- InfoType info = ecp_ecriture_str (component, mode, &t, i,
- nomvar, nbelem,
- data);/*, strSize );*/
- fprintf(stderr,"End of cp_ech: %s %d \n",nomvar,i);
- fflush(stdout);
- fflush(stderr);
+/* InfoType info = ecp_ecriture_str (component, mode, &t, i, */
+/* nomvar, nbelem, */
+/* data); */
+/*, strSize );*/
+/* fprintf(stderr,"End of cp_ech: %s %d \n",nomvar,i); */
+/* fflush(stdout); */
+/* fflush(stderr); */
- return info;
-};
-
+/* return info; */
+/* }; */
+/* Definition des méthodes calcium standard */
+/* CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,type,_typeName,_qual) */
+CALCIUM_ECR_INTERFACE_C_(een,float ,int,int ,int2integer,,);
+CALCIUM_ECR_INTERFACE_C_(elg,float ,int,long ,long2integer,,);
+CALCIUM_ECR_INTERFACE_C_(ere,float ,int,float ,float,,);
+CALCIUM_ECR_INTERFACE_C_(edb,double,int,double,double,,);
+CALCIUM_ECR_INTERFACE_C_(elo,float ,int,int ,bool,,);
+CALCIUM_ECR_INTERFACE_C_(ecp,float ,int,float ,cplx,,);
+CALCIUM_ECR_INTERFACE_C_(ech,float ,int,char ,str,STAR,LCH_LAST_PARAM );
+
+/* Definition des méthodes calcium destinées à l'interfaçage fortran
+ avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */
+
+CALCIUM_ECR_INTERFACE_C_(een_fort_,float ,cal_int,cal_int,integer,,);
+CALCIUM_ECR_INTERFACE_C_(elg_fort_,float ,cal_int,long ,long2integer,,);
+CALCIUM_ECR_INTERFACE_C_(ein_fort_,float ,cal_int,int ,int2integer,,);
+CALCIUM_ECR_INTERFACE_C_(ere_fort_,float ,cal_int,float ,float,,);
+CALCIUM_ECR_INTERFACE_C_(edb_fort_,double,cal_int,double,double,,);
+CALCIUM_ECR_INTERFACE_C_(elo_fort_,float ,cal_int,int ,bool,,);
+CALCIUM_ECR_INTERFACE_C_(ecp_fort_,float ,cal_int,float ,cplx,,);
+CALCIUM_ECR_INTERFACE_C_(ech_fort_,float ,cal_int,char ,str,STAR,LCH_LAST_PARAM );
#include "CalciumInterface.hxx"
#include "calcium.h"
#include <iostream>
+#include <sstream>
#include <string>
#include <exception>
-//#define _DEBUG_
-
PySupervCompo::PySupervCompo( CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
Engines::Container_ptr contain,
extern "C"
{
+ void cp_exit(int);
+ void setDependency(provides_port*, char*, CalciumTypes::DependencyType);
+
void cp_exit(int err)
{
throw CalciumException(err,LOC("Abort coupling"));
void create_calcium_port(Superv_Component_i* compo,char* name,char* type,char *mode,char* depend)
{
-#ifdef _DEBUG_
- std::cerr << "create_calcium_port: " << name << " " << type << " " << mode << " " << depend << std::endl;
-#endif
+ std::stringstream msg;
+ msg << type << " " << mode << " " << depend;
+ CORBA::String_var componentName=compo->instanceName();
+ std::string containerName=compo->getContainerName();
+ Engines_DSC_interface::writeEvent("create_calcium_port",containerName,componentName,name,"",msg.str().c_str());
if(std::string(mode) == "IN")
{
--- /dev/null
+#include "CalciumCInterface.hxx"
+#include "CalciumCxxInterface.hxx"
+
+#include <stdio.h>
+
+
+//#define MYDEBUG
+#ifdef MYDEBUG
+#define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
+#else
+#define DEBTRACE(msg)
+#endif
+
+
+/* Définition de l'Interface entre l'API C et l'API C++
+ L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
+ En C/C++ il utilisera celle définie dans Calcium.c (calcium.h)
+ En C++/CORBA directement celle de CalciumCxxInterface.hxx
+*/
+
+
+#define STAR *
+
+/* Définition de ecp_lecture_... , ecp_ecriture_..., ecp_free_... */
+
+/* Le premier argument est utilisée :
+ - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_
+ - comme second argument template à l'appel de la méthode C++ correspondante
+ ( le type de port correspondant est alors obtenu par un trait)
+ Le second argument est utilisée :
+ - pour typer le paramètre data de la procédure générée
+ - pour déduire le type des paramètres t, ti tf via un trait
+ - comme premier paramètre template à l'appel de la méthode C++ correspondante
+ (pour typer les données passées en paramètre )
+ Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas
+ en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode
+ C++ CALCIUM de lecture repère cette différence de type et charge
+ le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles).
+*/
+// CALCIUM_C2CPP_INTERFACE_CXX_(_name,_porttype,_type,_qual)
+CALCIUM_C2CPP_INTERFACE_CXX_(intc,int,int,);
+CALCIUM_C2CPP_INTERFACE_CXX_(long,long,long,);
+
+CALCIUM_C2CPP_INTERFACE_CXX_(integer,integer,cal_int,);
+CALCIUM_C2CPP_INTERFACE_CXX_(int2integer ,integer, int,);
+CALCIUM_C2CPP_INTERFACE_CXX_(long2integer, integer, long,);
+
+CALCIUM_C2CPP_INTERFACE_CXX_(float,float,float, );
+CALCIUM_C2CPP_INTERFACE_CXX_(double,double,double,);
+/* Fonnctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/
+CALCIUM_C2CPP_INTERFACE_CXX_(bool,bool,int,);
+CALCIUM_C2CPP_INTERFACE_CXX_(cplx,cplx,float,);
+CALCIUM_C2CPP_INTERFACE_CXX_(str,str,char*,);
+
+/* Définition de ecp_fin */
+extern "C" CalciumTypes::InfoType
+ecp_fin_ (void * component, int code) {
+
+ Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
+
+ bool provideLastGivenValue = false;
+ if (code == CalciumTypes::CP_CONT ) provideLastGivenValue = true;
+
+ try {
+ CalciumInterface::ecp_fin( *_component,
+ provideLastGivenValue);
+ } catch ( const CalciumException & ex) { //tester l'arrêt par exception
+ DEBTRACE( ex.what() );
+ return ex.getInfo();
+ }
+ return CalciumTypes::CPOK;
+};
+
+extern "C" CalciumTypes::InfoType
+ecp_cd_ (void * component, char * instanceName) {
+ Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
+ std::string name;
+ CalciumInterface::ecp_cd( *_component,name);
+ strcpy(instanceName,name.c_str());
+ return CalciumTypes::CPOK;
+}
+
+// INTERFACE C/CPP pour les chaines de caractères
+// Le paramètre supplémentaire strsize n'étant pas utilisé
+// j'utilise la génération par la macro CALCIUM_C2CPP_INTERFACE_(str,char*,);
+// extern "C" CalciumTypes::InfoType ecp_lecture_str (void * component, int dependencyType,
+// float * ti, float * tf, long * i,
+// const char * const nomvar, size_t bufferLength,
+// size_t * nRead, char ** *data, size_t strsize ) {
+
+// Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
+// double _ti=*ti;
+// double _tf=*tf;
+// size_t _nRead=0;
+// size_t _bufferLength=bufferLength;
+// CalciumTypes::DependencyType dependencyType=
+// static_cast<CalciumTypes::DependencyType>(dependencyType);
+
+// // - GERER POINTEUR NULL : NOTHING TODO
+// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.)
+
+// DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" )
+// try {
+// CalciumInterface::ecp_lecture< char*, char* >( *_component,
+// dependencyType,
+// _ti, _tf, *i,
+// nomvar,
+// _bufferLength, _nRead, *data);
+// } catch ( const CalciumException & ex) {
+// DEBTRACE( ex.what() );
+// return ex.getInfo();
+// }
+
+// *nRead = _nRead;
+
+// if (dependencyType == CalciumTypes::CP_SEQUENTIEL )
+// *ti=(float)(_ti);
+
+// DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) ;
+
+// return CalciumTypes::CPOK;
+// };
+
+
+// extern "C" void ecp_lecture_str_free (char** data) {
+// CalciumInterface::ecp_free< char*, char* >(data);
+// };
+
+
+// extern "C" CalciumTypes::InfoType ecp_ecriture_str (void * component, int dependencyType,
+// float *t, long i,
+// const char * const nomvar, size_t bufferLength,
+// char ** data, int strsize ) {
+
+// Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
+// /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/
+// double _t=*t;
+// size_t _bufferLength=bufferLength;
+
+// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.)
+
+// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" )
+// try {
+// std::string essai(nomvar);
+// DEBTRACE( "----------->-" << nomvar )
+// CalciumInterface::ecp_ecriture< char*, char* >( *_component,
+// static_cast<CalciumTypes::DependencyType>(dependencyType),
+// _t,i,nomvar,_bufferLength,*data);
+// } catch ( const CalciumException & ex) {
+// std::cerr << ex.what() << std::endl;
+// return ex.getInfo();
+// }
+// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data )
+// return CalciumTypes::CPOK;
+// };
--- /dev/null
+/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+
+ Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ See http: www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+ File : CalciumInterface.hxx
+ Author : Eric Fayolle (EDF)
+ Module : KERNEL
+ Modified by : $LastChangedBy$
+ Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
+ Id : $Id$
+*/
+#ifndef _CALCIUM_C_INTERFACE_H_
+#define _CALCIUM_C_INTERFACE_H_
+
+#include "CalciumMacroCInterface.hxx"
+#include "CalciumTypes.hxx"
+#include "CalciumFortranInt.h"
+#include <cstdlib>
+
+/* Déclaration de l'Interface entre l'API C et l'API C++
+ L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
+ En C/C++ il utilisera celle définie dans Calcium.c (calcium.h)
+2 En C++/CORBA directement celle de CalciumCxxInterface.hxx
+*/
+
+/* En CALCIUM l'utilisation de données de type double
+ implique des dates de type double, pour les autres
+ types de données les dates sont de type float
+*/
+template <class T> struct CalTimeType {
+ typedef float TimeType;
+};
+
+template <> struct CalTimeType<double> {
+ typedef double TimeType;
+};
+
+/* Déclaration de ecp_lecture_... , ecp_ecriture_..., ecp_free_... */
+
+/* Le premier argument est utilisé :
+ - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_
+ Le second argument est utilisé :
+ - comme argument template à l'appel de la méthode C++ correspondante
+ ( le type CORBA de port correspondant est alors obtenu par un trait)
+ Le troisième argument est utilisée :
+ - pour typer le paramètre data de la procédure générée
+ - pour déduire le type des paramètres t, ti tf via un trait
+ - comme premier paramètre template à l'appel de la méthode C++ correspondante
+ (pour typer les données passées en paramètre )
+ Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas
+ en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode
+ C++ CALCIUM de lecture repère cette différence de type et charge
+ le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles).
+ Notons qu'en CORBA CORBA:Long est mappé sur long uniquement si celui-ci est 32bits sinon
+ il sera mappé sur le type int (si il est 32bits). Le type CORBA:LongLong est mappé sur le type long
+ s'il est 64 bits sinon celà peut être un long long (s'il existe).
+*/
+CALCIUM_C2CPP_INTERFACE_HXX_(intc,int,int,);
+CALCIUM_C2CPP_INTERFACE_HXX_(long,long,long,);
+
+CALCIUM_C2CPP_INTERFACE_HXX_(integer,integer,cal_int,);
+CALCIUM_C2CPP_INTERFACE_HXX_(int2integer,integer,int,);
+CALCIUM_C2CPP_INTERFACE_HXX_(long2integer,integer, long,);
+
+CALCIUM_C2CPP_INTERFACE_HXX_(float,float,float, );
+CALCIUM_C2CPP_INTERFACE_HXX_(double,double,double,);
+/* Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/
+CALCIUM_C2CPP_INTERFACE_HXX_(bool,bool,int,);
+CALCIUM_C2CPP_INTERFACE_HXX_(cplx,cplx,float,);
+CALCIUM_C2CPP_INTERFACE_HXX_(str,str,char*,);
+
+/* Déclaration de ecp_fin */
+extern "C" CalciumTypes::InfoType ecp_fin_ (void * component, int code);
+extern "C" CalciumTypes::InfoType ecp_cd_ (void * component, char* instanceName);
+
+#endif
CalciumTypes::DependencyType CalciumCouplingPolicy::getDependencyType () const { return _dependencyType;}
void CalciumCouplingPolicy::setStorageLevel (size_t storageLevel) {
-#ifdef _DEBUG_
- std::cerr << "CalciumCouplingPolicy::setStorageLevel: " << storageLevel << std::endl;
-#endif
+ MESSAGE( "CalciumCouplingPolicy::setStorageLevel: " << storageLevel );
if ( storageLevel < 1 && (storageLevel != CalciumTypes::UNLIMITED_STORAGE_LEVEL) )
- throw CalciumException(CalciumTypes::CPRENA,LOC("Un niveau < 1 n'est pas autorisé"));
+ throw CalciumException(CalciumTypes::CPRENA,LOC("StorageLevel < 1 is not allowed"));
_storageLevel = storageLevel;
}
size_t CalciumCouplingPolicy::getStorageLevel () const {return _storageLevel;}
void CalciumCouplingPolicy::setDateCalSchem (CalciumTypes::DateCalSchem dateCalSchem) {
-#ifdef _DEBUG_
- std::cerr << "CalciumCouplingPolicy::setDateCalSchem: " << dateCalSchem << std::endl;
-#endif
+ MESSAGE( "CalciumCouplingPolicy::setDateCalSchem: " << dateCalSchem );
if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
- throw CalciumException(CalciumTypes::CPITVR,LOC("Il est impossible de positionner un schéma temporel sur un port qui n'est pas en dépendance temporelle"));
+ throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set a temporal scheme on a port that is not time dependent"));
_dateCalSchem = dateCalSchem;
}
CalciumTypes::DateCalSchem CalciumCouplingPolicy::getDateCalSchem () const { return _dateCalSchem; }
void CalciumCouplingPolicy::setAlpha(double alpha) {
-#ifdef _DEBUG_
- std::cerr << "CalciumCouplingPolicy::setAlpha: " << alpha << std::endl;
-#endif
+ MESSAGE( "CalciumCouplingPolicy::setAlpha: " << alpha );
if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
- throw CalciumException(CalciumTypes::CPITVR,LOC("Il est impossible de positionner alpha sur un port qui n'est pas en dépendance temporelle"));
+ throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set alpha on a port that is not time dependent"));
- if ( 0 <= alpha <= 1 ) _alpha = alpha;
+ if ( 0 <= alpha && alpha <= 1 ) _alpha = alpha;
else
- throw CalciumException(CalciumTypes::CPRENA,LOC("Le paramètre alpha doit être compris entre [0,1]"));
+ throw CalciumException(CalciumTypes::CPRENA,LOC("alpha must be between [0,1]"));
}
double CalciumCouplingPolicy::getAlpha() const { return _alpha; }
void CalciumCouplingPolicy::setDeltaT(double deltaT ) {
if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
- throw CalciumException(CalciumTypes::CPITVR,LOC("Le paramètre deltaT sur un port qui n'est pas en dépendance temporelle n'a pas de sens"));
- if ( 0 <= deltaT <= 1 ) _deltaT = deltaT;
+ throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set deltaT on a port that is not time dependent"));
+ if ( 0 <= deltaT && deltaT <= 1 ) _deltaT = deltaT;
else
- throw(CalciumException(CalciumTypes::CPRENA,LOC("Le paramètre deltaT doit être compris entre [0,1]")));
+ throw(CalciumException(CalciumTypes::CPRENA,LOC("deltaT must be between [0,1]")));
}
double CalciumCouplingPolicy::getDeltaT() const {return _deltaT;}
void CalciumCouplingPolicy::setInterpolationSchem (CalciumTypes::InterpolationSchem interpolationSchem) {
-#ifdef _DEBUG_
- std::cerr << "CalciumCouplingPolicy::setInterpolationSchem: " << interpolationSchem << std::endl;
-#endif
+ MESSAGE( "CalciumCouplingPolicy::setInterpolationSchem: " << interpolationSchem );
if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
- throw CalciumException(CalciumTypes::CPITVR,LOC("Le paramètre InterpolationSchem sur un port qui n'est pas en dépendance temporelle n'a pas de sens"));
+ throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set InterpolationSchem on a port that is not time dependent"));
_interpolationSchem=interpolationSchem;
}
void CalciumCouplingPolicy::setExtrapolationSchem (CalciumTypes::ExtrapolationSchem extrapolationSchem) {
if ( _dependencyType != CalciumTypes::TIME_DEPENDENCY )
- throw CalciumException(CalciumTypes::CPITVR,LOC("Le paramètre ExtrapolationSchem sur un port qui n'est pas en dépendance temporelle n'a pas de sens"));
+ throw CalciumException(CalciumTypes::CPITVR,LOC("Can't set ExtrapolationSchem on a port that is not time dependent"));
_extrapolationSchem=extrapolationSchem;
}
void CalciumCouplingPolicy::disconnect(bool provideLastGivenValue) {
if (provideLastGivenValue) {
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::disconnect CP_CONT ------------------" << std::endl;
+#endif
_disconnectDirective = CalciumTypes::CONTINUE;
} else {
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::disconnect CP_ARRET ------------------" << std::endl;
+#endif
_disconnectDirective = CalciumTypes::STOP;
}
#include "CalciumTypes.hxx"
#include "CalciumException.hxx"
+//#define MYDEBUG
+
class CalciumCouplingPolicy : public CouplingPolicy {
const DataId & dataId,
const Iterator & it1) const {
typedef typename iterator_t<Iterator>::value_type value_type;
+#ifdef MYDEBUG
std::cout << "-------- Calcium Generic BoundedDataIdProcessor.apply() called " << std::endl;
+#endif
}
};
MapIterator it2=it1; ++it2;
size_t dataSize1 = DataManipulator::size(it1->second);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId1 : " << dataSize1 << std::endl;
#endif
// Gérer dans calcium la limite de la taille du buffer donnée par
// l'utilisateur.
size_t dataSize2 = DataManipulator::size(it2->second);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId2 : " << dataSize2 << std::endl;
#endif
DataId dataId1 = it1->first;
TimeType t2 = dataId2.first;
TimeType t1 = dataId1.first;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t1 : " << t1 << std::endl;
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t2 : " << t2 << std::endl;
#endif
TimeType t = dataId.first;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t : " << t << std::endl;
#endif
TimeType timeDiff = t2-t1;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de timeDiff : " << timeDiff << std::endl;
#endif
TimeType coeff = (t2-t)/timeDiff;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de coeff : " << coeff << std::endl;
#endif
InnerType const * const InIt1 = DataManipulator::getPointer(it1->second);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t1 : " << std::endl;
std::copy(InIt1,InIt1+dataSize1,std::ostream_iterator<InnerType>(std::cout," "));
std::cout << std::endl;
#endif
InnerType const * const InIt2 = DataManipulator::getPointer(it2->second);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t2 : " << std::endl;
std::copy(InIt2,InIt2+dataSize2,std::ostream_iterator<InnerType>(std::cout," "));
std::cout << std::endl;
Type dataOut = DataManipulator::create(dataSize);
InnerType * const OutIt = DataManipulator::getPointer(dataOut);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : interpolationSchem : " << _couplingPolicy._interpolationSchem << std::endl;
std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : alpha : " << _couplingPolicy._alpha << std::endl;
std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : datecalschem : " << _couplingPolicy._dateCalSchem << std::endl;
// }
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données calculées à t : " << std::endl;
std::copy(OutIt,OutIt+dataSize,std::ostream_iterator<InnerType>(std::cout," "));
std::cout << std::endl;
AdjacentFunctor< key_type > af(expectedDataId);
if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY )
{
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- time expected : " << expectedDataId.first << std::endl;
std::cout << "-------- time expected corrected : " << expectedDataId.first*(1.0-_deltaT) << std::endl;
#endif
typename AssocContainer::iterator current = prev;
while ( (current != storedDatas.end()) && !af(current->first) )
{
-#ifdef _DEBUG_
- std::cout << "------- stored time : " << current->first << std::endl;
+#ifdef MYDEBUG
+ std::cerr << "------- stored time : " << current->first << std::endl;
#endif
// if ( af(current->first) ) break;
prev = current++;
else
wDataIt1 = storedDatas.end();
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl;
#endif
typedef typename Container::value_type value_type;
typedef typename Container::iterator iterator;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::eraseDataId, storedDatasSize : " << storedDatas.size() << std::endl;
#endif
}
// Si l'itérateur pointait sur une valeur que l'on vient de supprimer
if (dist < s ) {
- throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "La gestion du niveau CALCIUM "
+ throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "StorageLevel management "
<< _couplingPolicy._storageLevel <<
- " vient d'entraîner la suppression de la donnée à renvoyer")));
+ " has just removed the data to send")));
}
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::eraseDataId, new storedDatasSize : " << storedDatas.size() << std::endl;
#endif
return;
typedef typename Container::iterator iterator;
// Pas de traitement particulier a effectuer
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK1 ("<< _couplingPolicy._disconnectDirective<<") --------" << std::endl;
#endif
if ( (_couplingPolicy._disconnectDirective) == (CalciumTypes::UNDEFINED_DIRECTIVE) ) return false;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK2 --------" << std::endl;
#endif
// TODO : Ds GenericPort::next il faut convertir en CPSTOPSEQ
if ( _couplingPolicy._disconnectDirective == CalciumTypes::CP_ARRET )
- throw(CalciumException(CalciumTypes::CPINARRET,LOC(OSS()<< "La directive CP_ARRET"
- << " provoque l'interruption de toute lecture de données")));
-#ifdef _DEBUG_
+ throw(CalciumException(CalciumTypes::CPINARRET,LOC(OSS()<< "CP_ARRET directive"
+ << " interrupts all further data reading")));
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK3 --------" << std::endl;
#endif
// S'il n'y a plus de données indique que l'on a pas pu effectuer de traitement
// TODO : Dans la gestion des niveaux il faut peut être interdire un niveau == 0
if ( storedDatas.empty() )
- throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "La directive CP_CONT"
- << " est active mais aucune donnée n'est disponible.")));
+ throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "CP_CONT directive"
+ << " is active but no data is available.")));
// expectedDataId n'a ni été trouvé dans storedDataIds ni encadré mais il se peut
// qu'en mode itératif il ne soit pas plus grand que le plus grand DataId stocké auquel
// cas on doit renvoyer une expection car on n'est plus connecté et on ne pourra jamais
// fournir de données pour ce dataId.
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK4 " << expectedDataId <<" --------" << std::endl;
#endif
// >= expectedDataId
iterator it1 = storedDatas.lower_bound(expectedDataId);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK5 " << std::endl;
for (iterator it=storedDatas.begin();it!=storedDatas.end();++it)
std::cout <<" "<<(*it).first ;
// TODO : Il faut en fait renvoyer le plus proche cf IT ou DT
if (it1 == storedDatas.end())
- throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "La directive CP_CONT"
- << " est active mais le dataId demandé est inférieur ou égal au dernier reçu.")));
+ throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "CP_CONT directive"
+ << " is active but the requested dataId is less or equal to the last one received.")));
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK6 " << std::endl;
#endif
wDataIt1 = storedDatas.end();
--wDataIt1;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor, CP_CONT : " << (*wDataIt1).first << std::endl;
#endif
--- /dev/null
+// 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 : CalciumCxxInterface.cxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
+// Id : $Id$
+//
+
+#include "CalciumCxxInterface.hxx"
+#define PRG_MAIN
+#include "calciumP.h"
+
+using namespace std;
+
+namespace CalciumInterface
+{
+};
+
#include <stdio.h>
-//#define _DEBUG_
+#include <typeinfo>
template <typename T1, typename T2>
struct IsSameType {
static const bool value = true;
};
+extern const char * CPMESSAGE[];
+
+//#define MYDEBUG
#include <boost/type_traits/remove_all_extents.hpp>
namespace CalciumInterface {
- /********************* INTERFACE DE DECONNEXION *****************/
+ /********************* CONNECTION INTERFACE *****************/
static inline void
ecp_cd (Superv_Component_i & component, std::string & instanceName)
{
/* TODO : Trouver le nom de l'instance SALOME*/
- if (instanceName.empty()) instanceName="UNDEFINED";
-
+ CORBA::String_var componentName=component.instanceName();
+ std::string containerName=component.getContainerName();
+ if (instanceName.empty()) instanceName=componentName;
+ Engines_DSC_interface::writeEvent("CP_CD",containerName,componentName,"","","");
}
static void
ecp_fin (Superv_Component_i & component, bool provideLastGivenValue)
{
+ CORBA::String_var componentName=component.instanceName();
+ std::string containerName=component.getContainerName();
+ Engines_DSC_interface::writeEvent("CP_FIN",containerName,componentName,"","","");
+
std::vector<std::string> usesPortNames;
std::vector<std::string>::const_iterator it;
component.get_uses_port_names(usesPortNames);
// uses_port *myUsesPort;
calcium_uses_port* myCalciumUsesPort;
- for (it=usesPortNames.begin(); it != usesPortNames.end(); ++it) {
- try {
-
- myCalciumUsesPort=
- component.Superv_Component_i::get_port< calcium_uses_port >((*it).c_str());
-
-// component.Superv_Component_i::get_port(myUsesPort,(*it).c_str());
-// calcium_uses_port* myCalciumUsesPort=
-// dynamic_cast<calcium_uses_port*>(myUsesPort);
-
-#ifdef _DEBUG_
- std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|"<< *it <<"|----"<<
- // typeid(myUsesPort).name() <<"-------------" <<
- typeid(myCalciumUsesPort).name() <<"-------------" << std::endl;
-#endif
-
-// if ( !myCalciumUsesPort )
-// throw Superv_Component_i::BadCast(LOC(OSS()<<"Impossible de convertir le port "
-// << *it << " en port de type calcium_uses_port." ));
-
- myCalciumUsesPort->disconnect(provideLastGivenValue);
-
- } catch ( const Superv_Component_i::BadCast & ex) {
-#ifdef _DEBUG_
- std::cerr << ex.what() << std::endl;
-#endif
- throw (CalciumException(CalciumTypes::CPTPVR,ex));
- } catch ( const DSC_Exception & ex) {
-#ifdef _DEBUG_
- std::cerr << ex.what() << std::endl;
+ for (it=usesPortNames.begin(); it != usesPortNames.end(); ++it)
+ {
+ try
+ {
+ myCalciumUsesPort= component.Superv_Component_i::get_port< calcium_uses_port >((*it).c_str());
+
+// component.Superv_Component_i::get_port(myUsesPort,(*it).c_str());
+// calcium_uses_port* myCalciumUsesPort=
+// dynamic_cast<calcium_uses_port*>(myUsesPort);
+
+#ifdef MYDEBUG
+ std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|"<< *it <<"|----"<<
+ // typeid(myUsesPort).name() <<"-------------" <<
+ typeid(myCalciumUsesPort).name() <<"-------------" << std::endl;
#endif
- // Exception venant de SupervComponent :
- // PortNotDefined(CPNMVR), PortNotConnected(CPLIEN)
- // ou du port uses : Dsc_Exception
- // On continue à traiter la deconnexion des autres ports uses
- } catch (...) {
- throw (CalciumException(CalciumTypes::CPATAL,"Exception innatendue"));
- // En fonction du mode de gestion des erreurs throw;
+
+// if ( !myCalciumUsesPort )
+// throw Superv_Component_i::BadCast(LOC(OSS()<<"Impossible de convertir le port "
+// << *it << " en port de type calcium_uses_port." ));
+
+ myCalciumUsesPort->disconnect(provideLastGivenValue);
+ }
+ catch ( const Superv_Component_i::BadCast & ex)
+ {
+ Engines_DSC_interface::writeEvent("CP_FIN",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPTPVR],ex.what());
+ throw (CalciumException(CalciumTypes::CPTPVR,ex));
+ }
+ catch ( const DSC_Exception & ex)
+ {
+ Engines_DSC_interface::writeEvent("CP_FIN",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPOK],ex.what());
+ // Exception venant de SupervComponent :
+ // PortNotDefined(CPNMVR), PortNotConnected(CPLIEN)
+ // ou du port uses : Dsc_Exception
+ // On continue à traiter la deconnexion des autres ports uses
+ }
+ catch (...)
+ {
+ Engines_DSC_interface::writeEvent("CP_FIN",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPATAL],"Unexpected exception");
+ throw (CalciumException(CalciumTypes::CPATAL,"Unexpected exception"));
+ // En fonction du mode de gestion des erreurs throw;
+ }
}
- }
}
}
- /********************* INTERFACES DE LECTURE *****************/
+ /********************* READING INTERFACE *****************/
// T1 est le type de données
// T2 est un <nom> de type Calcium permettant de sélectionner le port CORBA correspondant
- // T1 et T2 sont dissociés pour discriminer le cas des nombres complexes
+ // T1 et T2 sont dissociés pour discriminer par exemple le cas des nombres complexes
// -> Les données des nombres complexes sont de type float mais
// le port à utiliser est le port cplx
template <typename T1, typename T2 > static void
ecp_lecture ( Superv_Component_i & component,
- int const & dependencyType,
- double & ti,
- double const & tf,
- long & i,
- const std::string & nomVar,
- size_t bufferLength,
- size_t & nRead,
- T1 * &data )
+ int const & dependencyType,
+ double & ti,
+ double const & tf,
+ long & i,
+ const std::string & nomVar,
+ size_t bufferLength,
+ size_t & nRead,
+ T1 * &data )
{
assert(&component);
+ CORBA::String_var componentName=component.instanceName();
+ std::string containerName=component.getContainerName();
typedef typename ProvidesPortTraits<T2>::PortType PortType;
typedef typename PortType::DataManipulator DataManipulator;
typedef typename DataManipulator::Type CorbaDataType; // Attention != T1
typedef typename DataManipulator::InnerType InnerType;
- CalciumTypes::DependencyType _dependencyType=
+ CalciumTypes::DependencyType _dependencyType=
static_cast<CalciumTypes::DependencyType>(dependencyType);
CorbaDataType corbaData;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl;
#endif
if (nomVar.empty())
- throw CalciumException(CalciumTypes::CPNMVR,
- LOC("Le nom de la variable est <nul>"));
+ {
+ Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPNMVR],"");
+ throw CalciumException(CalciumTypes::CPNMVR, LOC("Empty variable name"));
+ }
PortType * port;
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 2 ------------------" << std::endl;
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(lecture) MARK 2 --"<<typeid(port).name()<<"----------------" << std::endl;
+ T1 t1;
+ T2 t2;
+ std::cout << "-------- CalciumInterface(lecture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(lecture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
#endif
- try {
- port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str());
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 3 ------------------" << std::endl;
-#endif
- } catch ( const Superv_Component_i::PortNotDefined & ex) {
-#ifdef _DEBUG_
- std::cerr << ex.what() << std::endl;
-#endif
- throw (CalciumException(CalciumTypes::CPNMVR,ex));
- } catch ( const Superv_Component_i::PortNotConnected & ex) {
-#ifdef _DEBUG_
- std::cerr << ex.what() << std::endl;;
-#endif
- throw (CalciumException(CalciumTypes::CPLIEN,ex));
- // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN
- } catch ( const Superv_Component_i::BadCast & ex) {
-#ifdef _DEBUG_
- std::cerr << ex.what() << std::endl;
+ try
+ {
+ port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str());
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 3 ------------------" << std::endl;
#endif
- throw (CalciumException(CalciumTypes::CPTPVR,ex));
- }
+ }
+ catch ( const Superv_Component_i::PortNotDefined & ex)
+ {
+ Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPNMVR],ex.what());
+ throw (CalciumException(CalciumTypes::CPNMVR,ex));
+ }
+ catch ( const Superv_Component_i::PortNotConnected & ex)
+ {
+ Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPLIEN],ex.what());
+ throw (CalciumException(CalciumTypes::CPLIEN,ex));
+ // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN
+ }
+ catch ( const Superv_Component_i::BadCast & ex)
+ {
+ Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPTPVR],ex.what());
+ throw (CalciumException(CalciumTypes::CPTPVR,ex));
+ }
// mode == mode du port
CalciumTypes::DependencyType portDependencyType = port->getDependencyType();
if ( portDependencyType == CalciumTypes::UNDEFINED_DEPENDENCY )
- throw CalciumException(CalciumTypes::CPIT,
- LOC(OSS()<<"Le mode de dépendance de la variable "
- << nomVar << " est indéfini."));
+ {
+ Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPIT],"Dependency mode is undefined");
+ throw CalciumException(CalciumTypes::CPIT, LOC(OSS()<<"Dependency mode of variable " << nomVar << " is undefined."));
+ }
- if ( ( portDependencyType != _dependencyType ) &&
- ( _dependencyType != CalciumTypes::SEQUENCE_DEPENDENCY ) )
- throw CalciumException(CalciumTypes::CPITVR,
- LOC(OSS()<<"Le mode de dépendance de la variable "
- << nomVar << ": " << portDependencyType
- << " ne correspond pas au mode demandé."));
+ if ( ( portDependencyType != _dependencyType ) && ( _dependencyType != CalciumTypes::SEQUENCE_DEPENDENCY ) )
+ {
+ Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPIT],
+ "Dependency mode is not the same as the required one");
+ throw CalciumException(CalciumTypes::CPITVR, LOC(OSS()<<"Dependency mode of variable " << nomVar << ": "
+ << portDependencyType << " is not the same as the required one."));
+ }
- if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY ) {
- corbaData = port->get(ti,tf, 0);
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 5 ------------------" << std::endl;
+ std::stringstream msgout,msg;
+ if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY )
+ {
+ try
+ {
+ double tt=ti;
+ msg << "ti=" << ti << ", tf=" << tf ;
+ Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"",msg.str().c_str());
+ corbaData = port->get(tt,tf, 0);
+ msgout << "read t=" << tt ;
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 5 ------------------" << std::endl;
#endif
- }
- else if ( _dependencyType == CalciumTypes::ITERATION_DEPENDENCY ) {
- corbaData = port->get(0, i);
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 6 ------------------" << std::endl;
+ }
+ catch ( const DSC_Exception & ex)
+ {
+ Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),"",ex.what());
+ throw;
+ }
+ }
+ else if ( _dependencyType == CalciumTypes::ITERATION_DEPENDENCY )
+ {
+ try
+ {
+ msg << "i=" << i ;
+ Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"",msg.str().c_str());
+ corbaData = port->get(0, i);
+ msgout << "read i=" << i ;
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 6 ------------------" << std::endl;
#endif
- } else {
- // Lecture en séquence
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl;
+ }
+ catch ( const DSC_Exception & ex)
+ {
+ Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),"",ex.what());
+ throw;
+ }
+ }
+ else
+ {
+ // Sequential read
+ try
+ {
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl;
#endif
- corbaData = port->next(ti,i);
- }
+ Engines_DSC_interface::writeEvent("BEGIN_READ",containerName,componentName,nomVar.c_str(),"","Sequential read");
+ corbaData = port->next(ti,i);
+ msgout << "read ";
+ if(i==0)msgout<< "t=" <<ti;
+ else msgout<< "i=" <<i;
+ }
+ catch ( const DSC_Exception & ex)
+ {
+ Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),"",ex.what());
+ throw;
+ }
+ }
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 8 ------------------" << std::endl;
#endif
size_t corbaDataSize = DataManipulator::size(corbaData);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumInterface(ecp_lecture) corbaDataSize : " << corbaDataSize << std::endl;
#endif
// Vérifie si l'utilisateur demande du 0 copie
- if ( data == NULL ) {
- if ( bufferLength != 0 ) {
- MESSAGE("bufferLength devrait valoir 0 pour l'utilisation du mode sans copie (data==NULL)");
- }
- nRead = corbaDataSize;
- // Si les types T1 et InnerType sont différents, il faudra effectuer tout de même une recopie
- if (!IsSameType<T1,InnerType>::value) data = new T1[nRead];
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 9 ------------------" << std::endl;
+ if ( data == NULL )
+ {
+ if ( bufferLength != 0 )
+ {
+ MESSAGE("bufferLength devrait valoir 0 pour l'utilisation du mode sans copie (data==NULL)");
+ }
+ nRead = corbaDataSize;
+ // Si les types T1 et InnerType sont différents, il faudra effectuer tout de même une recopie
+ if (!IsSameType<T1,InnerType>::value) data = new T1[nRead];
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 9 ------------------" << std::endl;
#endif
- // On essaye de faire du 0 copy si les types T1 et InnerType sont les mêmes.
- // Copy2UserSpace :
- // La raison d'être du foncteur Copy2UserSpace est que le compilateur n'acceptera
- // pas une expresion d'affectation sur des types incompatibles même
- // si cette expression se trouve dans une branche non exécuté d'un test
- // sur la compatibilité des types.
- // En utilisant le foncteur Copy2UserSpace, seul la spécialisation en adéquation
- // avec la compatibilité des types sera compilée
- Copy2UserSpace< IsSameType<T1,InnerType>::value, DataManipulator >::apply(data,corbaData,nRead);
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl;
+ // On essaye de faire du 0 copy si les types T1 et InnerType sont les mêmes.
+ // Copy2UserSpace :
+ // La raison d'être du foncteur Copy2UserSpace est qu'il n'est pas possible de compiler
+ // une expression d'affectation sur des types incompatibles ; même
+ // si cette expression se trouve dans une branche non exécuté d'un test
+ // portant sur la compatibilité des types.
+ // En utilisant le foncteur Copy2UserSpace, seule la spécialisation en adéquation
+ // avec la compatibilité des types sera compilée
+ Copy2UserSpace< IsSameType<T1,InnerType>::value, DataManipulator >::apply(data,corbaData,nRead);
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl;
#endif
- // Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non
- // la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante :
- // DataManipulator::delete_data(corbaData);
- // ni DataManipulator::getPointer(corbaData,true); qui détruit la sequence lorsque l'on
- // prend la propriété du buffer
- // old : Dans les deux cas la structure CORBA n'est plus utile
- // old : Si !IsSameType<T1,InnerType>::value l'objet CORBA est détruit avec son contenu
- // old : Dans l'autre cas seul la coquille CORBA est détruite
- // L'utilisateur devra appeler ecp_free qui déterminera s'il est necessaire
- // de désallouer un buffer intermédiaire ( types différents) ou de rendre la propriété
- } else {
- nRead = std::min < size_t > (corbaDataSize,bufferLength);
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 11 ------------------" << std::endl;
+ // Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non
+ // la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante :
+ // DataManipulator::delete_data(corbaData);
+ // ni DataManipulator::getPointer(corbaData,true); qui détruit la sequence lorsque l'on
+ // prend la propriété du buffer
+ // old : Dans les deux cas la structure CORBA n'est plus utile
+ // old : Si !IsSameType<T1,InnerType>::value l'objet CORBA est détruit avec son contenu
+ // old : Dans l'autre cas seul la coquille CORBA est détruite
+ // L'utilisateur devra appeler ecp_free qui déterminera s'il est necessaire
+ // de désallouer un buffer intermédiaire ( types différents) ou de rendre la propriété
+ }
+ else
+ {
+ nRead = std::min < size_t > (corbaDataSize,bufferLength);
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 11 ------------------" << std::endl;
#endif
- Copy2UserSpace<false, DataManipulator >::apply(data,corbaData,nRead);
- DataManipulator::copy(corbaData,data,nRead);
-
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 12 ------------------" << std::endl;
+ Copy2UserSpace<false, DataManipulator >::apply(data,corbaData,nRead);
+ //Déjà fait ci-dessus :
+ //DataManipulator::copy(corbaData,data,nRead);
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecp_lecture) MARK 12 ------------------" << std::endl;
#endif
- // Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non
- // la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante :
- // DataManipulator::delete_data(corbaData);
- }
-#ifdef _DEBUG_
+ }
+#ifdef MYDEBUG
std::cout << "-------- CalciumInterface(ecp_lecture), Valeur de data : " << std::endl;
std::copy(data,data+nRead,std::ostream_iterator<T1>(std::cout," "));
std::cout << "Ptr :" << data << std::endl;
-
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 13 ------------------" << std::endl;
#endif
-
-
+ Engines_DSC_interface::writeEvent("END_READ",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPOK],msgout.str().c_str());
return;
}
- // T1 est le type de données
+ // T1 is the data type
template <typename T1 > static void
ecp_lecture ( Superv_Component_i & component,
- int const & dependencyType,
- double & ti,
- double const & tf,
- long & i,
- const std::string & nomVar,
- size_t bufferLength,
- size_t & nRead,
- T1 * &data )
+ int const & dependencyType,
+ double & ti,
+ double const & tf,
+ long & i,
+ const std::string & nomVar,
+ size_t bufferLength,
+ size_t & nRead,
+ T1 * &data )
{
ecp_lecture<T1,T1> (component,dependencyType,ti,tf,
- i,nomVar,bufferLength,nRead,data);
+ i,nomVar,bufferLength,nRead,data);
}
- /********************* INTERFACES D'ECRITURE *****************/
+ /********************* WRITING INTERFACE *****************/
// T1 : DataType
// T2 : PortType
template <typename T1, typename T2> static void
ecp_ecriture ( Superv_Component_i & component,
- int const & dependencyType,
- double const & t,
- long const & i,
- const std::string & nomVar,
- size_t bufferLength,
- T1 const & data )
+ int const & dependencyType,
+ double const & t,
+ long const & i,
+ const std::string & nomVar,
+ size_t bufferLength,
+ T1 const & data )
{
assert(&component);
+ CORBA::String_var componentName=component.instanceName();
+ std::string containerName=component.getContainerName();
//typedef typename StarTrait<TT>::NonStarType T;
- typedef typename boost::remove_all_extents< T2 >::type T2_without_extent;
typedef typename boost::remove_all_extents< T1 >::type T1_without_extent;
-
+ typedef typename boost::remove_all_extents< T2 >::type T2_without_extent;
typedef typename UsesPortTraits <T2_without_extent>::PortType UsesPortType;
typedef typename ProvidesPortTraits<T2_without_extent>::PortType ProvidesPortType;// pour obtenir un manipulateur de données
typedef typename ProvidesPortType::DataManipulator DataManipulator;
T1_without_extent const & _data = data;
- CalciumTypes::DependencyType _dependencyType=
+ CalciumTypes::DependencyType _dependencyType=
static_cast<CalciumTypes::DependencyType>(dependencyType);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl;
#endif
- if ( nomVar.empty() ) throw CalciumException(CalciumTypes::CPNMVR,
- LOC("Le nom de la variable est <nul>"));
+ if ( nomVar.empty() )
+ {
+ Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,"",CPMESSAGE[CalciumTypes::CPNMVR],"");
+ throw CalciumException(CalciumTypes::CPNMVR, LOC("Empty variable name"));
+ }
UsesPortType * port;
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecriture) MARK 2 ------------------" << std::endl;
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2 ---"<<typeid(port).name()<<"---------------" << std::endl;
+ T1 t1;
+ T2 t2;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
#endif
- try {
- port = component.Superv_Component_i::get_port< UsesPortType > (nomVar.c_str());
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecriture) MARK 3 ------------------" << std::endl;
-#endif
- } catch ( const Superv_Component_i::PortNotDefined & ex) {
-#ifdef _DEBUG_
- std::cerr << ex.what() << std::endl;
-#endif
- throw (CalciumException(CalciumTypes::CPNMVR,ex));
- } catch ( const Superv_Component_i::PortNotConnected & ex) {
-#ifdef _DEBUG_
- std::cerr << ex.what() << std::endl;;
-#endif
- throw (CalciumException(CalciumTypes::CPLIEN,ex));
- // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN
- } catch ( const Superv_Component_i::BadCast & ex) {
-#ifdef _DEBUG_
- std::cerr << ex.what() << std::endl;
+ try
+ {
+ port = component.Superv_Component_i::get_port< UsesPortType > (nomVar.c_str());
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecriture) MARK 3 ------------------" << std::endl;
#endif
- throw (CalciumException(CalciumTypes::CPTPVR,ex));
- }
+ }
+ catch ( const Superv_Component_i::PortNotDefined & ex)
+ {
+ Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPNMVR],ex.what());
+ throw (CalciumException(CalciumTypes::CPNMVR,ex));
+ }
+ catch ( const Superv_Component_i::PortNotConnected & ex)
+ {
+ Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPLIEN],ex.what());
+ throw (CalciumException(CalciumTypes::CPLIEN,ex));
+ // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN
+ }
+ catch ( const Superv_Component_i::BadCast & ex)
+ {
+ Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPTPVR],ex.what());
+ throw (CalciumException(CalciumTypes::CPTPVR,ex));
+ }
// mode == mode du port
// On pourrait créer la méthode CORBA dans le mode de Couplage CALCIUM.
// }
if ( _dependencyType == CalciumTypes::UNDEFINED_DEPENDENCY )
- throw CalciumException(CalciumTypes::CPIT,
- LOC(OSS()<<"Le mode de dépendance demandé pour la variable "
- << nomVar << " est indéfini."));
+ {
+ Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPIT],"Dependency mode is undefined");
+ throw CalciumException(CalciumTypes::CPIT, LOC(OSS()<<"Dependency mode of variable " << nomVar << " is undefined."));
+ }
if ( _dependencyType == CalciumTypes::SEQUENCE_DEPENDENCY )
- throw CalciumException(CalciumTypes::CPIT,
- LOC(OSS()<<"Le mode de dépendance SEQUENCE_DEPENDENCY pour la variable "
- << nomVar << " est impossible en écriture."));
+ {
+ Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPIT],
+ "SEQUENCE_DEPENDENCY mode is not possible when writing");
+ throw CalciumException(CalciumTypes::CPIT, LOC(OSS()<<"Dependency mode SEQUENCE_DEPENDENCY for variable " << nomVar
+ << " is not possible when writing."));
+ }
// Il faudrait que le port provides génère une exception si le mode donnée n'est pas
// le bon. La seule façon de le faire est d'envoyer -1 en temps si on n'est en itération
// ---->
// if ( portDependencyType != _dependencyType )
// throw CalciumException(CalciumTypes::CPITVR,
-// LOC(OSS()<<"Le mode de dépendance de la variable "
-// << nomVar << " ne correspond pas au mode demandé."));
+// LOC(OSS()<<"Le mode de dépendance de la variable "
+// << nomVar << " ne correspond pas au mode demandé."));
if ( bufferLength < 1 )
- throw CalciumException(CalciumTypes::CPNTNULL,
- LOC(OSS()<<"Le buffer a envoyer est de taille nulle "));
-
+ {
+ Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPNTNULL],"Buffer to send is empty");
+ throw CalciumException(CalciumTypes::CPNTNULL, LOC(OSS()<<"Buffer to send is empty"));
+ }
-#ifdef _DEBUG_
+ CorbaDataType corbaData;
+#ifdef MYDEBUG
std::cout << "-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl;
#endif
- CorbaDataType corbaData;
-
// Si les types Utilisateurs et CORBA sont différents
// il faut effectuer une recopie sinon on utilise directement le
// OLD : Il faut effectuer une copie dans le port provides.
// OLD : Cette copie est effectuée dans GenericPortUses::put
// OLD : en fonction de la collocalisation ou non.
+#ifdef MYDEBUG
+ T1_without_extent t1b;
+ InnerType t2b;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 4b1 -----" << typeid(t1b).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 4b2 -----" << typeid(t2b).name() << "-------------" << std::endl;
+#endif
+
Copy2CorbaSpace<IsSameType<T1_without_extent,InnerType>::value, DataManipulator >::apply(corbaData,_data,bufferLength);
- //TODO : GERER LES EXCEPTIONS ICI : ex le port n'est pas connecté
- if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY ) {
- try
- {
- port->put(*corbaData,t, -1);
- }
- catch ( const DSC_Exception & ex)
+ //TODO : GERER LES EXCEPTIONS ICI : ex le port n'est pas connecte
+ if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY )
{
- throw (CalciumException(CalciumTypes::CPATAL,ex.what()));
- }
- //Le -1 peut être traité par le cst DataIdContainer et transformé en 0
- //Etre obligé de mettre une étoile ds (*corbadata) va poser des pb pour les types <> seq
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl;
+ try
+ {
+ port->put(*corbaData,t, -1);
+ std::stringstream msg;
+ msg << "t=" << t ;
+ Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPOK],msg.str().c_str());
+ }
+ catch ( const DSC_Exception & ex)
+ {
+ Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPATAL],ex.what());
+ throw (CalciumException(CalciumTypes::CPATAL,ex.what()));
+ }
+ //Le -1 peut être traité par le cst DataIdContainer et transformé en 0
+ //Etre obligé de mettre une étoile ds (*corbadata) va poser des pb pour les types <> seq
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl;
#endif
- }
- else if ( _dependencyType == CalciumTypes::ITERATION_DEPENDENCY ) {
- try
+ }
+ else if ( _dependencyType == CalciumTypes::ITERATION_DEPENDENCY )
{
- port->put(*corbaData,-1, i);
- }
- catch ( const DSC_Exception & ex)
- {
- throw (CalciumException(CalciumTypes::CPATAL,ex.what()));
- }
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl;
+ try
+ {
+ port->put(*corbaData,-1, i);
+ std::stringstream msg;
+ msg << "i=" << i ;
+ Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPOK],msg.str().c_str());
+ }
+ catch ( const DSC_Exception & ex)
+ {
+ Engines_DSC_interface::writeEvent("WRITE",containerName,componentName,nomVar.c_str(),CPMESSAGE[CalciumTypes::CPATAL],ex.what());
+ throw (CalciumException(CalciumTypes::CPATAL,ex.what()));
+ }
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl;
#endif
- }
-
+ }
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumInterface(ecriture), Valeur de corbaData : " << std::endl;
for (int i = 0; i < corbaData->length(); ++i)
std::cout << "-------- CalciumInterface(ecriture), corbaData[" << i << "] = " << (*corbaData)[i] << std::endl;
// Supprime l'objet CORBA avec eventuellement les données qu'il contient (cas de la recopie)
delete corbaData;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl;
#endif
template <typename T1> static void
ecp_ecriture ( Superv_Component_i & component,
- int const & dependencyType,
- double const & t,
- long const & i,
- const std::string & nomVar,
- size_t bufferLength,
- T1 const & data ) {
+ int const & dependencyType,
+ double const & t,
+ long const & i,
+ const std::string & nomVar,
+ size_t bufferLength,
+ T1 const & data )
+ {
ecp_ecriture<T1,T1> (component,dependencyType,t,i,nomVar,bufferLength,data);
};
--- /dev/null
+/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+
+ Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ See http: www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+ File : CalciumInterface.hxx
+ Author : Eric Fayolle (EDF)
+ Module : KERNEL
+ Modified by : $LastChangedBy$
+ Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
+ Id : $Id$
+*/
+#ifndef _CALCIUM_FORTRAN_INT_H_
+#define _CALCIUM_FORTRAN_INT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef @LONG_OR_INT@ cal_int;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
try { \
\
if (key == "StorageLevel" ) \
- {if ( ok=(value >>= sl) ) Port::setStorageLevel(sl);} \
+ {if ( ( ok=(value >>= sl) ) ) Port::setStorageLevel(sl);} \
else if (key == "Alpha" ) \
- {if ( ok=(value >>= alpha) ) Port::setAlpha(alpha);} \
+ {if ( ( ok=(value >>= alpha) ) ) Port::setAlpha(alpha);} \
else if (key == "DeltaT" ) \
- {if ( ok=(value >>= delta) ) Port::setDeltaT(delta);} \
+ {if ( ( ok=(value >>= delta) ) ) Port::setDeltaT(delta);} \
else if (key == "DependencyType" ) \
- {if ( ok=( value >>= dt) ) Port::setDependencyType(dependencyType[dt]);} \
+ {if ( ( ok=( value >>= dt) ) ) Port::setDependencyType(dependencyType[dt]);} \
else if (key == "DateCalSchem" ) \
- {if ( ok=(value >>= dcs) ) \
+ {if ( ( ok=(value >>= dcs) ) ) \
Port::setDateCalSchem(dateCalSchem[dcs]);} \
else if (key == "InterpolationSchem") \
- {if ( ok=(value >>= is) ) \
+ {if ( ( ok=(value >>= is) ) ) \
Port::setInterpolationSchem(interpolationSchem[is]);} \
else if (key == "ExtrapolationSchem") \
- {if ( ok=(value >>= es) ) \
+ {if ( ( ok=(value >>= es) ) ) \
Port::setExtrapolationSchem(extrapolationSchem[es]);} \
else \
throw Ports::NotDefined(); \
for(int i = 0; i < this->_my_ports->length(); i++) {
CorbaPortTypePtr port = CorbaPortType::_narrow((*this->_my_ports)[i]);
try {
+#ifdef MYDEBUG
std::cerr << "-------- CalciumGenericUsesPort<>::disconnect: "<< i << std::endl;
+#endif
port->disconnect(provideLastGivenValue);
} catch(const CORBA::SystemException& ex){
//Interface CALCIUM des utilisateurs en C++
#include "CalciumCxxInterface.hxx"
-#include "CalciumException.hxx"
-#include "CalciumTypes.hxx"
+/* Déclaration de l'Interface entre l'API C et l'API C++
+ L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
+ En C/C++ il utilisera celle définie dans Calcium.c (calcium.h)
+ En C++/CORBA directement celle de CalciumCxxInterface.hxx
+*/
+#include "CalciumCInterface.hxx"
-#include <stdio.h>
-//Ce fichier déclare et défini l'interfaçage entre l'API utilisteur C et C++
-//Les procédures déclarées n'ont pas vocation à être utilisées directement (celà est
-// cependant possible).
-//#define _DEBUG_
-
-#ifdef _DEBUG_
-#define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
-#else
-#define DEBTRACE(msg)
-#endif
-
-
-// Interface C/C++
-// L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
-// En C/C++ il utilisera celle définie dans Calcium.c
-// En C++/CORBA directement celle de CalciumCxxInterface
-
-// En CALCIUM l'utilisation de données de type double
-// implique des dates de type double, pour les autres
-// types de données les dates sont de type float
-template <class T> struct CalTimeType {
- typedef float TimeType;
-};
-
-template <> struct CalTimeType<double> {
- typedef double TimeType;
-};
-
-// Définition de ecp_fin
-extern "C" CalciumTypes::InfoType
-ecp_fin_ (void * component, int code) {
-
- Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
-
- bool provideLastGivenValue = false;
- if (code == CalciumTypes::CP_CONT ) provideLastGivenValue = true;
-
- try {
- CalciumInterface::ecp_fin( *_component,
- provideLastGivenValue);
- } catch ( const CalciumException & ex) { //tester l'arrêt par exception
- DEBTRACE( ex.what() );
- return ex.getInfo();
- }
- return CalciumTypes::CPOK;
-};
-
-
-// Définition de ecp_lecture_... , ecp_ecriture_..., ecp_free_...
-#define CALCIUM_C2CPP_INTERFACE_(_name,_type,_qual) \
- extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
- CalTimeType< _type _qual >::TimeType * ti, \
- CalTimeType< _type _qual >::TimeType * tf, long * i, \
- const char * const nomvar, size_t bufferLength, \
- size_t * nRead, _type _qual ** data ) { \
- Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
- double _ti=*ti; \
- double _tf=*tf; \
- size_t _nRead=0; \
- size_t _bufferLength=bufferLength; \
- \
- if ( IsSameType< _name , cplx >::value ) _bufferLength*=2; \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \
- try { \
- CalciumInterface::ecp_lecture< _type, _name >( *_component, \
- dependencyType, \
- _ti, _tf, *i, \
- nomvar, \
- _bufferLength, _nRead, *data); \
- } catch ( const CalciumException & ex) { \
- DEBTRACE( ex.what() ); \
- return ex.getInfo(); \
- } catch ( ... ) { \
- std::cerr << "Unexpected exception " << std::endl; \
- return CalciumTypes::CPATAL; \
- } \
- if ( IsSameType< _name , cplx >::value ) { *nRead=_nRead/2; \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \
- } else *nRead = _nRead; \
- if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) \
- *ti=(CalTimeType< _type _qual >::TimeType)(_ti); \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \
- return CalciumTypes::CPOK; \
- }; \
- \
- \
- extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) { \
- CalciumInterface::ecp_free< _type, _name >(data); \
- }; \
- \
- \
- extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
- CalTimeType< _type _qual >::TimeType *t, \
- long i, \
- const char * const nomvar, size_t bufferLength, \
- _type _qual * data ) { \
- Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
- /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ \
- double _t=*t; \
- size_t _bufferLength=bufferLength; \
- if ( IsSameType< _name , cplx >::value ) _bufferLength=_bufferLength*2; \
- DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) \
- try { \
- /*printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar);*/ \
- DEBTRACE( "----------->-" << nomvar ) \
- CalciumInterface::ecp_ecriture< _type, _name >( *_component, \
- dependencyType, \
- _t,i,nomvar,_bufferLength,*data); \
- } catch ( const CalciumException & ex) { \
- std::cerr << ex.what() << std::endl; \
- return ex.getInfo(); \
- } catch ( ... ) { \
- std::cerr << "Unexpected exception " << std::endl; \
- return CalciumTypes::CPATAL; \
- } \
- DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) \
- return CalciumTypes::CPOK; \
- }; \
-
-
-
-#define STAR *
-// Le premier argument est utilisée :
-// - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_
-// - comme second argument template à l'appel de la méthode C++ correspondante
-// ( le type de port correspondant est alors obtenu par un trait)
-// Le second argument est utilisée :
-// - pour typer le paramètre data de la procédure générée
-// - pour déduire le type des paramètres t, ti tf via un trait
-// - comme premier paramètre template à l'appel de la méthode C++ correspondante
-// (pour typer les données passées en paramètre )
-// Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas
-// en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode
-// C++ CALCIUM de lecture repère cette différence de type et charge
-// le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles).
-CALCIUM_C2CPP_INTERFACE_(int,int,);
-CALCIUM_C2CPP_INTERFACE_(float,float, );
-CALCIUM_C2CPP_INTERFACE_(double,double,);
-// Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);
-CALCIUM_C2CPP_INTERFACE_(bool,int,);
-CALCIUM_C2CPP_INTERFACE_(cplx,float,);
-CALCIUM_C2CPP_INTERFACE_(str,char*,);
-
-// INTERFACE C/CPP pour les chaines de caractères
-// Le paramètre supplémentaire strsize n'étant pas utilisé
-// j'utilise la génération par la macro CALCIUM_C2CPP_INTERFACE_(str,char*,);
-// extern "C" CalciumTypes::InfoType ecp_lecture_str (void * component, int dependencyType,
-// float * ti, float * tf, long * i,
-// const char * const nomvar, size_t bufferLength,
-// size_t * nRead, char ** *data, size_t strsize ) {
-
-// Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
-// double _ti=*ti;
-// double _tf=*tf;
-// size_t _nRead=0;
-// size_t _bufferLength=bufferLength;
-// CalciumTypes::DependencyType dependencyType=
-// static_cast<CalciumTypes::DependencyType>(dependencyType);
-
-// // - GERER POINTEUR NULL : NOTHING TODO
-// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.)
-
-// DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" )
-// try {
-// CalciumInterface::ecp_lecture< char*, char* >( *_component,
-// dependencyType,
-// _ti, _tf, *i,
-// nomvar,
-// _bufferLength, _nRead, *data);
-// } catch ( const CalciumException & ex) {
-// DEBTRACE( ex.what() );
-// return ex.getInfo();
-// }
-
-// *nRead = _nRead;
-
-// if (dependencyType == CalciumTypes::CP_SEQUENTIEL )
-// *ti=(float)(_ti);
-
-// DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) ;
-
-// return CalciumTypes::CPOK;
-// };
-
-
-// extern "C" void ecp_lecture_str_free (char** data) {
-// CalciumInterface::ecp_free< char*, char* >(data);
-// };
-
-
-// extern "C" CalciumTypes::InfoType ecp_ecriture_str (void * component, int dependencyType,
-// float *t, long i,
-// const char * const nomvar, size_t bufferLength,
-// char ** data, int strsize ) {
-
-// Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
-// /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/
-// double _t=*t;
-// size_t _bufferLength=bufferLength;
-
-// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.)
-
-// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" )
-// try {
-// std::string essai(nomvar);
-// DEBTRACE( "----------->-" << nomvar )
-// CalciumInterface::ecp_ecriture< char*, char* >( *_component,
-// static_cast<CalciumTypes::DependencyType>(dependencyType),
-// _t,i,nomvar,_bufferLength,*data);
-// } catch ( const CalciumException & ex) {
-// std::cerr << ex.what() << std::endl;
-// return ex.getInfo();
-// }
-// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data )
-// return CalciumTypes::CPOK;
-// };
#endif
--- /dev/null
+/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+
+Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+See http: www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+File : CalciumInterface.hxx
+Author : Eric Fayolle (EDF)
+Module : KERNEL
+Modified by : $LastChangedBy$
+Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
+Id : $Id$
+*/
+
+#ifndef _CALCIUM_MACRO_C_INTERFACE_H_
+#define _CALCIUM_MACRO_C_INTERFACE_H_
+
+
+
+/****** CALCIUM_C2CPP_INTERFACE_HXX_ : ******/
+/****** Declarations: ecp_lecture_... , ecp_ecriture_..., ecp_free_... ******/
+
+#define CALCIUM_C2CPP_INTERFACE_HXX_(_name,_porttype,_type,_qual) \
+ extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
+ CalTimeType< _type _qual >::TimeType * ti, \
+ CalTimeType< _type _qual >::TimeType * tf, long * i, \
+ const char * const nomvar, size_t bufferLength, \
+ size_t * nRead, _type _qual ** data ); \
+ \
+ \
+ extern "C" void ecp_lecture_##_name##_free ( _type _qual * data); \
+ \
+ \
+ extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
+ CalTimeType< _type _qual >::TimeType *t, \
+ long i, \
+ const char * const nomvar, size_t bufferLength, \
+ _type _qual * data ); \
+
+
+
+
+
+/****** CALCIUM_C2CPP_INTERFACE_CXX_ : ******/
+/******Definitions: ecp_lecture_... , ecp_ecriture_..., ecp_free_... ******/
+#define CALCIUM_C2CPP_INTERFACE_CXX_(_name,_porttype,_type,_qual) \
+ extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
+ CalTimeType< _type _qual >::TimeType * ti, \
+ CalTimeType< _type _qual >::TimeType * tf, long * i, \
+ const char * const nomvar, size_t bufferLength, \
+ size_t * nRead, _type _qual ** data ) \
+ { \
+ Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
+ double _ti=*ti; \
+ double _tf=*tf; \
+ size_t _nRead=0; \
+ size_t _bufferLength=bufferLength; \
+ \
+ if ( IsSameType< _porttype , cplx >::value ) _bufferLength*=2; \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \
+ try \
+ { \
+ CalciumInterface::ecp_lecture< _type,_porttype >( *_component, dependencyType, _ti, _tf, *i, nomvar, \
+ _bufferLength, _nRead, *data); \
+ } \
+ catch ( const CalciumException & ex) \
+ { \
+ DEBTRACE( ex.what() ); \
+ return ex.getInfo(); \
+ } \
+ catch ( ... ) \
+ { \
+ DEBTRACE( "Unexpected exception ") ; \
+ return CalciumTypes::CPATAL; \
+ } \
+ if ( IsSameType< _porttype , cplx >::value ) \
+ { \
+ *nRead=_nRead/2; \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \
+ } \
+ else \
+ *nRead = _nRead; \
+ if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) \
+ *ti=(CalTimeType< _type _qual >::TimeType)(_ti); \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \
+ return CalciumTypes::CPOK; \
+ }; \
+ \
+ \
+ extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) \
+ { \
+ CalciumInterface::ecp_free< _type, _porttype >(data); \
+ }; \
+ \
+ \
+ extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
+ CalTimeType< _type _qual >::TimeType *t, \
+ long i, \
+ const char * const nomvar, size_t bufferLength, \
+ _type _qual * data ) \
+ { \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 0 ------------------" ) \
+ Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
+ /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ \
+ double _t=*t; \
+ size_t _bufferLength=bufferLength; \
+ if ( IsSameType< _porttype , cplx >::value ) _bufferLength=_bufferLength*2; \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) \
+ try \
+ { \
+ /*printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar);*/ \
+ DEBTRACE( "----------->-" << nomvar ) \
+ CalciumInterface::ecp_ecriture< _type, _porttype >( *_component, dependencyType, \
+ _t,i,nomvar,_bufferLength,*data); \
+ } \
+ catch ( const CalciumException & ex) \
+ { \
+ DEBTRACE( ex.what() ); \
+ return ex.getInfo(); \
+ } \
+ catch ( ... ) \
+ { \
+ DEBTRACE("Unexpected exception " ); \
+ return CalciumTypes::CPATAL; \
+ } \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) \
+ return CalciumTypes::CPOK; \
+ }; \
+
+
+#endif
template <class T> struct ProvidesPortTraits {
typedef UnknownProvidesPortType<T> PortType;
};
-template <> struct ProvidesPortTraits<int> {
+struct integer {};
+template <> struct ProvidesPortTraits<integer> {
typedef calcium_integer_port_provides PortType;
};
+template <> struct ProvidesPortTraits<int> {
+ typedef calcium_intc_port_provides PortType;
+};
template <> struct ProvidesPortTraits<long> {
- typedef calcium_integer_port_provides PortType;
+ typedef calcium_long_port_provides PortType;
};
template <> struct ProvidesPortTraits<float> {
typedef calcium_real_port_provides PortType;
template <> struct ProvidesPortTraits<str> {
typedef calcium_string_port_provides PortType;
};
+// Définition du type intc pour obtenir le type de port
+// correspondant
+struct intc {};
+template <> struct ProvidesPortTraits<intc> {
+ typedef calcium_intc_port_provides PortType;
+};
template < typename T > struct StarTrait { typedef T NonStarType; };
template <class T> struct UsesPortTraits {
typedef UnknownUsesPortType<T> PortType;
};
-template <> struct UsesPortTraits<int> {
+template <> struct UsesPortTraits<integer> {
typedef calcium_integer_port_uses PortType;
};
+template <> struct UsesPortTraits<int> {
+ typedef calcium_intc_port_uses PortType;
+};
template <> struct UsesPortTraits<long> {
- typedef calcium_integer_port_uses PortType;
+ typedef calcium_long_port_uses PortType;
};
template <> struct UsesPortTraits<float> {
typedef calcium_real_port_uses PortType;
template <> struct UsesPortTraits<cplx> {
typedef calcium_complex_port_uses PortType;
};
+template <> struct UsesPortTraits<intc> {
+ typedef calcium_intc_port_uses PortType;
+};
#endif
CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_integer_port_provides)
+CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_long_port_provides)
+
+CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_intc_port_provides)
+
CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_real_port_provides)
CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_double_port_provides)
+++ /dev/null
-// 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
-//
-// Modified by : $LastChangedBy$
-// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $
-// Id : $Id$
-//
-#ifndef _CALCIUM_PORT_PROVIDES_HXX_
-#define _CALCIUM_PORT_PROVIDES_HXX_
-
-#include <SALOMEconfig.h>
-
-#include "Calcium_Ports.hh"
-#include "CalciumGenericProvidesPort.hxx"
-#include "CalciumCouplingPolicy.hxx"
-
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_integer_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Integer_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_long,CORBA::Long> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_real_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Real_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_double_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Double_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_double,CORBA::Double> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_complex_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Complex_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_logical_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Logical_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_boolean,CORBA::Boolean> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_string_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_String_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_string,char *> ) \
-
-#endif
--- /dev/null
+// 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
+//
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $
+// Id : $Id$
+//
+#ifndef _CALCIUM_PORT_PROVIDES_HXX_
+#define _CALCIUM_PORT_PROVIDES_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericProvidesPort.hxx"
+#include "CalciumCouplingPolicy.hxx"
+
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_integer_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Integer_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_integer,@CALCIUM_CORBA_INT_F77@> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_long_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Long_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_long_long,CORBA::LongLong> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_intc_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Intc_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_long,CORBA::Long> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_real_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Real_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_double_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Double_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_double,CORBA::Double> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_complex_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Complex_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_logical_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Logical_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_boolean,CORBA::Boolean> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_string_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_String_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_string,char *> ) \
+
+#endif
const float EPSILON = 1.e-6;
- /* Type de dependance des variables */
- const int CP_TEMPS = 40;
- const int CP_ITERATION = 41;
- const int CP_SEQUENTIEL = 42;
- /* Mode de dependance inconnu */
+ /* Type de dependance des variables */
+ const int CP_TEMPS = 40;
+ const int CP_ITERATION = 41;
+ const int CP_SEQUENTIEL = 42;
+ /* Mode de dependance inconnu */
const int CPIT = 6;
/* Directive de continuation d'une instance */
typedef int InfoType ;
const int UNLIMITED_STORAGE_LEVEL = CP_ILLIMITE;
typedef enum {UNDEFINED_DEPENDENCY=CPIT,TIME_DEPENDENCY=CP_TEMPS,
- ITERATION_DEPENDENCY=CP_ITERATION,
- // TYPE uniquement utilisé ds CalciumInterface
- SEQUENCE_DEPENDENCY =CP_SEQUENTIEL
+ ITERATION_DEPENDENCY=CP_ITERATION,
+ // TYPE uniquement utilisé ds CalciumInterface
+ SEQUENCE_DEPENDENCY =CP_SEQUENTIEL
} DependencyType;
typedef enum {TI_SCHEM=TI,TF_SCHEM=TF,ALPHA_SCHEM} DateCalSchem;
typedef enum {L0_SCHEM=CP_ESCALIER,L1_SCHEM=CP_LINEAIRE} InterpolationSchem;
typedef enum {UNDEFINED_EXTRA_SCHEM,E0_SCHEM,E1_SCHEM} ExtrapolationSchem;
typedef enum {UNDEFINED_DIRECTIVE=0,CONTINUE=CP_CONT,STOP=CP_ARRET} DisconnectDirective;
- /* Codes d'erreur */
+ /* Codes d'erreur */
- /* Pas d'erreur */
+ /* Pas d'erreur */
const int CPOK = 0;
- /* Emetteur inconnu */
+ /* Emetteur inconnu */
const int CPERIU = 1;
- /* Nom de variable inconnu */
+ /* Nom de variable inconnu */
const int CPNMVR = 2;
- /* Type entree/sortie incompatible */
+ /* Type entree/sortie incompatible */
const int CPIOVR = 3;
- /* Type inconnu */
+ /* Type inconnu */
const int CPTP = 4;
- /* Type de variable incompatible */
+ /* Type de variable incompatible */
const int CPTPVR = 5;
- /* Mode de dependance inconnu */
+ /* Mode de dependance inconnu */
// Déclaré au dessus
// const int CPIT = 6;
- /* Mode dependance incompatible */
+ /* Mode dependance incompatible */
const int CPITVR = 7;
- /* Requete non autorisee */
+ /* Requete non autorisee */
const int CPRENA = 8;
- /* Type de deconnexion incorrect */
+ /* Type de deconnexion incorrect */
const int CPDNTP = 9;
- /* Directive de deconnexion incorrecte */
+ /* Directive de deconnexion incorrecte */
const int CPDNDI = 10;
- /* Nom de code inconnu */
+ /* Nom de code inconnu */
const int CPNMCD = 11;
- /* Nom d'instance inconnu */
+ /* Nom d'instance inconnu */
const int CPNMIN = 12;
- /* Attente */
+ /* Attente */
const int CPATTENTE = 13;
- /* Blocage */
+ /* Blocage */
const int CPBLOC = 14;
- /* Nombre de valeurs transmises egal a zero */
+ /* Nombre de valeurs transmises egal a zero */
const int CPNTNULL = 15;
- /* Longueur de variable insuffisante */
+ /* Longueur de variable insuffisante */
const int CPLGVR = 16;
- /* L'instance doit s'arreter */
+ /* L'instance doit s'arreter */
const int CPSTOP = 17;
- /* Arret anormal */
+ /* Arret anormal */
const int CPATAL = 18;
- /* Coupleur absent */
+ /* Coupleur absent */
const int CPNOCP = 19;
- /* Variable sortante non connectee */
+ /* Variable sortante non connectee */
const int CPCTVR = 20;
- /* Nombre de pas a executer egal a zero */
+ /* Nombre de pas a executer egal a zero */
const int CPPASNULL = 21;
- /* Machine inconnue */
+ /* Machine inconnue */
const int CPMACHINE = 22;
- /* COUPLAGE_GROUPE non positionnee */
+ /* COUPLAGE_GROUPE non positionnee */
const int CPGRNU = 23;
- /* Groupe d'instances incorrect */
+ /* Groupe d'instances incorrect */
const int CPGRIN = 24;
- /* Fin du fichier d'entree */
+ /* Fin du fichier d'entree */
const int CPFINFICH = 25;
- /* Erreur de format dans un fichier */
+ /* Erreur de format dans un fichier */
const int CPERRFICH = 26;
- /* Requete d'avance de n pas annulee */
- /* par passage en mode NORMAL */
+ /* Requete d'avance de n pas annulee */
+ /* par passage en mode NORMAL */
const int CPNORERR = 27;
- /* Coupleur en mode NORMAL pour une */
- /* requete RUN_N_PAS ou DEF_* */
+ /* Coupleur en mode NORMAL pour une */
+ /* requete RUN_N_PAS ou DEF_* */
const int CPRUNERR = 28;
- /* Option inconnue */
+ /* Option inconnue */
const int CPOPT = 29;
- /* Valeur d'option inconnue */
+ /* Valeur d'option inconnue */
const int CPVALOPT = 30;
- /* Ecriture impossible par effacement */
+ /* Ecriture impossible par effacement */
const int CPECREFF = 31;
- /* Lecture d'une variable non connectee */
- /* ou n'appartenant pas a un lien VAS */
- /* ou VAV s'il s'agit d'une sortante */
+ /* Lecture d'une variable non connectee */
+ /* ou n'appartenant pas a un lien VAS */
+ /* ou VAV s'il s'agit d'une sortante */
const int CPLIEN = 32;
/* Lecture d'une variable d'une instance*/
- /* deconnectee avec directive CP_ARRET */
+ /* deconnectee avec directive CP_ARRET */
const int CPINARRET = 33;
- /* Les lectures sequentielles ne pourront plus */
- /* etre satisfaites : instance productrice arretee */
+ /* Les lectures sequentielles ne pourront plus */
+ /* etre satisfaites : instance productrice arretee */
const int CPSTOPSEQ = 34;
- /* Erreur dans la chaine de declaration */
+ /* Erreur dans la chaine de declaration */
const int CPDECL = 35;
/* Erreur dans l'execution de l'instance ajoutee */
const int CPINEXEC = 36;
- /* Erreur PVM */
+ /* Erreur PVM */
// const int CPPVM = 37;
// const int CPCOM = 37;
/* Erreur detectee au niveau de l'int CPERRINST = 38;
- /* Mode d'execution non defini */
+ /* Mode d'execution non defini */
// const int CPMODE = 39;
- /* Instance deconnectee */
+ /* Instance deconnectee */
const int CPINSTDEC = 40;
}
// Id : $Id$
//
#include "CalciumTypes2CorbaTypes.hxx"
+#include "utilities.h"
#include <iostream>
using namespace std;
map<CalciumTypes::DependencyType,
Ports::Calcium_Ports::DependencyType > &
table = ( map<CalciumTypes::DependencyType,
- Ports::Calcium_Ports::DependencyType > & ) *this ;
+ Ports::Calcium_Ports::DependencyType > & ) *this ;
-table[CalciumTypes::TIME_DEPENDENCY ] = Ports::Calcium_Ports::TIME_DEPENDENCY ;
-table[CalciumTypes::ITERATION_DEPENDENCY ] = Ports::Calcium_Ports::ITERATION_DEPENDENCY ;
-table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ;
+ table[CalciumTypes::TIME_DEPENDENCY ] = Ports::Calcium_Ports::TIME_DEPENDENCY ;
+ table[CalciumTypes::ITERATION_DEPENDENCY ] = Ports::Calcium_Ports::ITERATION_DEPENDENCY ;
+ table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ;
-#ifdef _DEBUG_
-std::cerr << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::TIME_DEPENDENCY<<"] : "<<
- table[CalciumTypes::TIME_DEPENDENCY] << std::endl;
-std::cerr << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::ITERATION_DEPENDENCY<<"] : "<<
- table[CalciumTypes::ITERATION_DEPENDENCY] << std::endl;
-std::cerr << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::UNDEFINED_DEPENDENCY<<"] : "<<
- table[CalciumTypes::UNDEFINED_DEPENDENCY] << std::endl;
-#endif
+ MESSAGE("CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::TIME_DEPENDENCY<<"] : "<< table[CalciumTypes::TIME_DEPENDENCY]);
+ MESSAGE("CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::ITERATION_DEPENDENCY<<"] : "<< table[CalciumTypes::ITERATION_DEPENDENCY]);
+ MESSAGE("CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::UNDEFINED_DEPENDENCY<<"] : "<< table[CalciumTypes::UNDEFINED_DEPENDENCY]);
}
map<CalciumTypes::DependencyType,
Ports::Calcium_Ports::DependencyType > &
table = (map<CalciumTypes::DependencyType,
- Ports::Calcium_Ports::DependencyType >& ) *this ;
+ Ports::Calcium_Ports::DependencyType >& ) *this ;
-#ifdef _DEBUG_
-std::cerr << "CORBA_DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
-#endif
+ MESSAGE("CORBA_DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c]);
assert( table.find( (CalciumTypes::DependencyType)c ) != table.end() ) ;
return table[ (CalciumTypes::DependencyType)c ] ;
#ifndef _COPY_TO_CORBA_SPACE_HXX_
#define _COPY_TO_CORBA_SPACE_HXX_
+
#include <string>
#include <iostream>
#include "CalciumPortTraits.hxx"
+//#define MYDEBUG
+
template <bool zerocopy, typename DataManipulator>
struct Copy2CorbaSpace {
//ESSAI: typedef typename PortType::DataManipulator DataManipulator;
typedef typename DataManipulator::InnerType InnerType;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- Copy2CorbaSpace<true> MARK 1 ------------------" << std::endl;
#endif
// Crée le type corba à partir du data sans lui en donner la propriété.
// DataManipulator::create n'a pas le caractère const sur son paramètre data pour le
// cas de figure où la propriété de la donnée lui est donnée.
corbaData = DataManipulator::create(nRead,const_cast<T2 * > (&data),false);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- Copy2CorbaSpace<true> MARK 2 --(dataPtr : "
<< DataManipulator::getPointer(corbaData,false)<<")----------------" << std::endl;
#endif
corbaData = DataManipulator::create(nRead);
InnerType * dataPtr = DataManipulator::getPointer(corbaData,false);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- Copy2CorbaSpace<false> MARK 1 --(dataPtr : " <<
dataPtr<<")----------------" << std::endl;
#endif
// Attention : Pour les chaines ou tout autre object complexe il faut utiliser une recopie profonde !
std::copy(&data,&data+nRead,dataPtr);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- Copy2CorbaSpace<false> MARK 2 --(nRead: "<<nRead<<")-------------" << std::endl;
std::cerr << "-------- Copy2CorbaSpace<false> MARK 3 : " ;
#include <cstdio>
+//#define MYDEBUG
+
//Les demandes de copies vers l'espace utilisateur
//proviennent d'une procédure de lecture
// Le PORT doit être capable de répondre aux demandes de lecture
// multiples d'une donnée pour une même estampille et doit donc garder un pointeur valide
// sur le buffer. Il se pose cependant un problème s'il décide
- // de supprimer la donnée alors que des client utilise le buffer (historique) !
+ // de supprimer la donnée alors que des client utilise le buffer (historique calcium) !
// La seule façon de gérer proprement cette situation est d'utiliser un shared_pointer (TODO).
// Pour l'instant l'utilisateur du mode zero copie doit s'assurer que le niveau d'historique
// utilisé par le port est compatible avec son utilisation des buffers. Il doit
- // être également conscient que s'il modifie le buffer, il est modifier pour tous les
+ // être également conscient que s'il modifie le buffer, il est modifié pour tous les
// utilisateurs actuels et futurs.
//REF: InnerType * dataPtr = DataManipulator::getPointer(corbaData,true);
// Cette ligne poserait uun problème dans la méthode appelante, si elle
// ne testait pas que les types utilisateurs et CORBA sont identiques :
// ex : InnerType == Corba::Long et d'un T == int
- // C'est l'objet de la procédure suivante
+ // C'est l'objet de la spécialisation ci-dessous.
data = dataPtr;
// En zero copie l'utilisateur doit appeler ecp_free ( cas ou un buffer intermédiaire
typedef typename DataManipulator::InnerType InnerType;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
InnerType * dataPtr = NULL;
// Affiche la valeur du pointeur de la structure corba
// et les pointeurs contenus le cas échéant
//std::copy(dataPtr,dataPtr+nRead,data);
DataManipulator::copy(corbaData,data,nRead);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
tmpData = data;
std::cerr << "-------- Copy2UserSpace<false> MARK 1c --data("<<tmpData<<")[0.."<<
DataManipulator::size(corbaData) <<"] : ----------------" << std::endl;
// Id : $Id$
//
#include "CorbaTypes2CalciumTypes.hxx"
+#include "utilities.h"
#include <iostream>
using namespace std;
map<Ports::Calcium_Ports::DependencyType,
CalciumTypes::DependencyType > &
table = ( map<Ports::Calcium_Ports::DependencyType,
- CalciumTypes::DependencyType > & ) *this ;
+ CalciumTypes::DependencyType > & ) *this ;
-table[Ports::Calcium_Ports::TIME_DEPENDENCY ] = CalciumTypes::TIME_DEPENDENCY ;
-table[Ports::Calcium_Ports::ITERATION_DEPENDENCY ] = CalciumTypes::ITERATION_DEPENDENCY ;
-table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ;
+ table[Ports::Calcium_Ports::TIME_DEPENDENCY ] = CalciumTypes::TIME_DEPENDENCY ;
+ table[Ports::Calcium_Ports::ITERATION_DEPENDENCY ] = CalciumTypes::ITERATION_DEPENDENCY ;
+ table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ;
-
-#ifdef _DEBUG_
-std::cerr << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::TIME_DEPENDENCY<<"] : "<<
- table[Ports::Calcium_Ports::TIME_DEPENDENCY] << std::endl;
-std::cerr << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::ITERATION_DEPENDENCY<<"] : "<<
- table[Ports::Calcium_Ports::ITERATION_DEPENDENCY] << std::endl;
-std::cerr << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::UNDEFINED_DEPENDENCY<<"] : "<<
- table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY] << std::endl;
-#endif
+ MESSAGE("DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::TIME_DEPENDENCY<<"] : "<< table[Ports::Calcium_Ports::TIME_DEPENDENCY]);
+ MESSAGE("DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::ITERATION_DEPENDENCY<<"] : "<< table[Ports::Calcium_Ports::ITERATION_DEPENDENCY]);
+ MESSAGE("DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::UNDEFINED_DEPENDENCY<<"] : "<< table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY]);
}
CalciumTypes::DependencyType> &table = (map<Ports::Calcium_Ports::DependencyType,
CalciumTypes::DependencyType>&)*this ;
-#ifdef _DEBUG_
-std::cerr << "DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
-#endif
+ MESSAGE("DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c]);
assert( table.find( (Ports::Calcium_Ports::DependencyType)c ) != table.end() ) ;
return table[ (Ports::Calcium_Ports::DependencyType)c ] ;
calcium_uses_port.hxx \
CalciumGenericUsesPort.hxx \
calcium_provides_port.hxx \
- CalciumProvidesPort.hxx \
- calcium_integer_port_uses.hxx \
+ calcium_intc_port_uses.hxx \
+ calcium_long_port_uses.hxx \
calcium_real_port_uses.hxx \
calcium_double_port_uses.hxx \
calcium_string_port_uses.hxx \
CalciumException.hxx \
CalciumTypes.hxx \
CalciumCxxInterface.hxx \
+ CalciumMacroCInterface.hxx \
+ CalciumCInterface.hxx \
CalciumInterface.hxx \
Copy2UserSpace.hxx \
Copy2CorbaSpace.hxx \
CalciumPortTraits.hxx \
calcium.h \
+ calciumf.h \
Calcium.hxx \
calciumP.h \
calciumE.h \
version.h \
calcium.hf
-EXTRA_DIST=fortoc.h
+nodist_salomeinclude_HEADERS = calcium_integer_port_uses.hxx CalciumProvidesPort.hxx CalciumFortranInt.h
+
+EXTRA_DIST=fortoc.h calcium_integer_port_uses.hxx.in CalciumProvidesPort.hxx.in CalciumFortranInt.h.in
+
+calcium_integer_port_uses.hxx: calcium_integer_port_uses.hxx.in
+CalciumProvidesPort.hxx : CalciumProvidesPort.hxx.in
+CalciumFortranInt.h : CalciumFortranInt.h.in
+
#
# ===============================================================
# Local definitions
COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \
-I$(top_srcdir)/src/DSC/DSC_User/Datastream \
-I$(top_srcdir)/src/DSC/DSC_User/Datastream/Palm \
+ -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Calcium \
-I$(top_srcdir)/src/DSC/DSC_User/Basic \
-I$(top_srcdir)/src/DSC/DSC_Basic \
-I$(top_srcdir)/src/SALOMELocalTrace \
-I$(top_srcdir)/src/Utils \
-I$(top_srcdir)/src/Container \
-I$(top_srcdir)/src/Notification \
- -I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h \
-I$(top_builddir)/idl \
+ -I$(top_builddir)/src/DSC/DSC_User/Datastream/Calcium \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@
# This local variable defines the list of dependant libraries common to all target in this package.
calcium_repository_types.cxx \
CalciumCouplingPolicy.cxx \
CorbaTypes2CalciumTypes.cxx \
+ CalciumCxxInterface.cxx \
CalciumTypes2CorbaTypes.cxx \
+ CalciumCInterface.cxx \
CalciumProvidesPort.cxx \
Calcium.cxx \
calcium_destructors_port_uses.cxx
test_DataIdContainer_LDFLAGS = $(COMMON_LIBS)
+CLEANFILES = calcium_integer_port_uses.hxx CalciumProvidesPort.hxx CalciumFortranInt.h
#endif
);
+extern int cp_elg(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance */
+ /* CP_TEMPS, CP_ITERATION */,
+ float /* E Pas de temps a ecrire */,
+ int /* E Pas d'iteration a ecrire */,
+ char * /* E Nom de la variable a ecrire */,
+ int /* E Nombre de valeurs a ecrire */,
+ long * /* E Tableau d'entiers a ecrire */
+#endif
+);
+
extern int cp_ere(
/* ------ */
#if CPNeedPrototype
#ifndef __CONST_H
#define __CONST_H
-#ifndef TrueOrFalse
-#define TrueOrFalse int
-#define TRUE 1
-#define FALSE 0
+#ifndef TrueOrFalse
+#define TrueOrFalse int
+#define TRUE 1
+#define FALSE 0
#endif
-/* Definition d'un type de donnes pour le stockage du */
-/* des pas de temps */
+/* Definition d'un type de donnes pour le stockage du */
+/* des pas de temps */
#ifdef CRAY
-#define Temps float
-#define FORMAT_TEMPS "%lf"
+#define Temps float
+#define FORMAT_TEMPS "%lf"
#else
-#define Temps double
-#define FORMAT_TEMPS "%lg"
+#define Temps double
+#define FORMAT_TEMPS "%lg"
#endif
/* Precision relative pour tests d'egalite sur les temps */
#define EPSILON 1.e-6
-/* Tailles utilisees lors des transmissions des noms */
-#define VERSION_LEN 144
-#define CODE_LEN 72
-#define VARIABLE_LEN 144
-#define INSTANCE_LEN 72
-#define DRIVER_LEN 72
-
-
-/* Tailles maximums */
-#define ARCHI_LEN 64
-#define ENV_VAR_LEN 256
-#define ACCC_LEN 256
-#define PVM_LEN 256
-#define USER_LEN 256
-#define MACHINE_LEN 256
-#define COMMAND_LEN 256
-#define MAX_LEN 256
-#define FICHIER_LEN 256
-
-/* Nombre de lignes dans une page du fichier erreur *
- * de trace */
-#define NB_LIGNE_ERREUR 45
-#define NB_LIGNE_TRACE 45
-
-
-
-/* Type d'arret d'une instance */
-#define CP_NORMALE 10
-#define CP_ANORMALE 11
-
-/* Directive de continuation d'une instance */
-#define CP_CONT 20
-#define CP_ARRET 21
-
-/* Etat d'une instance */
-#define CP_INITIAL 22
-#define CP_NON_CONNECTE 23
-#define CP_ATTENTE 24
-#define CP_EXECUTION 25
-#define CP_DECONNECTE 26
-#define CP_TERMINE 27
-
-/* Type de variables */
-#define CP_ENTIER 30
-#define CP_REEL 31
-#define CP_DREEL 32
-#define CP_COMPLEXE 33
-#define CP_LOGIQUE 34
-#define CP_CHAINE 35
-
-/* Type de dependance des variables */
-#define CP_TEMPS 40
-#define CP_ITERATION 41
-#define CP_SEQUENTIEL 42
-
-/* Send des variables */
-#define CP_IN 50
-#define CP_OUT 51
-
-/* Type des instances */
-#define CP_NORMAL 60
-#define CP_ESPION 62
-
-/* Niveaux */
-#define CP_ILLIMITE -70
-#define CP_AUTESP -71
-
-/* Mode de trace */
-#define CP_SANS 80
-#define CP_SUCCINCT 81
-#define CP_DETAILLE 82
-
-
-/* Mode d'execution */
-/* La valeur CP_NORMAL definie pour les types */
-/* est aussi utilisee */
-#define CP_PAUSE 91
-
-
-/* Type d'interpolation */
-#define CP_LINEAIRE 100
-#define CP_ESCALIER 101
-
-
-/* Repere dans cycle de temps */
-#define TI 110
-#define TF 111
-
-/* Mode de nettoyage des donnees d'un lien */
-#define CP_TOUTES 120
-#define CP_AUCUNE 121
-#define CP_PAS 122
-
-/* Options configurables */
-#define CP_ROUTE 131
-#define CP_ERREURS 132
-
-/* Valeurs pour l'option CP_ROUTE */
-#define CP_ROUTE_NORMAL 133
-#define CP_ROUTE_DIRECT 134
-
-/* Valeurs pour l'option Comportement en cas d'erreur */
-#define CP_AUTO 135
-#define CP_BLOCAGE 136
-#define CP_MANUEL 137
-
-/* Type de requete de lecture */
-/* La valeur CP_ATTENTE define pour l'etat d'une */
-/* instance est aussi utilisee */
-#define CP_IMMEDIATE 141
-
-/* Definition des types de lien */
-#define CPLVAV 151
-#define CPLVAF 152
-#define CPLVAS 153
-#define CPLCAV 154
-#define CPLFAV 155
-
-/* Codes des entetes des messages (Evenemet *) */
-#define ERREUR 1000
-#define CONNEXION 1001
-#define EMISSION 1002
-#define DECONNEXION 1003
-#define LECTURE_VARIABLE 1004
-#define ECRITURE_VARIABLE 1005
-#define FIN_DE_PAS 1006
-#define AUIN_FIN_DE_PAS 1007
-#define EFFACEMENT 1008
-#define MODE_EXEC 1009
-#define RUN_N_PAS 1010
-#define DEF_CODE 1011
-#define DEF_INSTANCE 1012
-#define DEF_LIEN 1013
-#define DEM_VERSION 1014
-#define SET_OPTION 1015
-#define DEM_OPTION 1016
-#define DEM_CODES 1017
-#define DEM_INSTS_DE_CODE 1018
-#define DEM_VARIABLES 1019
-#define DEM_VARS_DE_CODE 1020
-#define DEM_VARS_DE_INST 1021
-#define DEM_CARS_DE_VARIABLE 1022
-#define DEM_CARS_DE_LIEN 1023
-#define ENV_VALEURS_VARIABLE 1024
-#define ENV_OPTION 1025
-#define ENV_CODES 1026
-#define ENV_INSTS_DE_CODE 1027
-#define ENV_VARIABLES 1028
-#define ENV_VARS_DE_CODE 1029
-#define ENV_VARS_DE_INST 1030
-#define ENV_CARS_DE_VARIABLE 1031
-#define ENV_CARS_DE_LIEN 1032
+/* Tailles utilisees lors des transmissions des noms */
+#define VERSION_LEN 144
+#define CODE_LEN 72
+#define VARIABLE_LEN 144
+#define INSTANCE_LEN 72
+#define DRIVER_LEN 72
+
+
+/* Tailles maximums */
+#define ARCHI_LEN 64
+#define ENV_VAR_LEN 256
+#define ACCC_LEN 256
+#define PVM_LEN 256
+#define USER_LEN 256
+#define MACHINE_LEN 256
+#define COMMAND_LEN 256
+#define MAX_LEN 256
+#define FICHIER_LEN 256
+
+/* Nombre de lignes dans une page du fichier erreur *
+ * de trace */
+#define NB_LIGNE_ERREUR 45
+#define NB_LIGNE_TRACE 45
+
+
+
+/* Type d'arret d'une instance */
+#define CP_NORMALE 10
+#define CP_ANORMALE 11
+
+/* Directive de continuation d'une instance */
+#define CP_CONT 20
+#define CP_ARRET 21
+
+/* Etat d'une instance */
+#define CP_INITIAL 22
+#define CP_NON_CONNECTE 23
+#define CP_ATTENTE 24
+#define CP_EXECUTION 25
+#define CP_DECONNECTE 26
+#define CP_TERMINE 27
+
+/* Type de variables */
+#define CP_ENTIER 30
+#define CP_REEL 31
+#define CP_DREEL 32
+#define CP_COMPLEXE 33
+#define CP_LOGIQUE 34
+#define CP_CHAINE 35
+
+/* Type de dependance des variables */
+#define CP_TEMPS 40
+#define CP_ITERATION 41
+#define CP_SEQUENTIEL 42
+
+/* Send des variables */
+#define CP_IN 50
+#define CP_OUT 51
+
+/* Type des instances */
+#define CP_NORMAL 60
+#define CP_ESPION 62
+
+/* Niveaux */
+#define CP_ILLIMITE -70
+#define CP_AUTESP -71
+
+/* Mode de trace */
+#define CP_SANS 80
+#define CP_SUCCINCT 81
+#define CP_DETAILLE 82
+
+
+/* Mode d'execution */
+/* La valeur CP_NORMAL definie pour les types */
+/* est aussi utilisee */
+#define CP_PAUSE 91
+
+
+/* Type d'interpolation */
+#define CP_LINEAIRE 100
+#define CP_ESCALIER 101
+
+
+/* Repere dans cycle de temps */
+#define TI 110
+#define TF 111
+
+/* Mode de nettoyage des donnees d'un lien */
+#define CP_TOUTES 120
+#define CP_AUCUNE 121
+#define CP_PAS 122
+
+/* Options configurables */
+#define CP_ROUTE 131
+#define CP_ERREURS 132
+
+/* Valeurs pour l'option CP_ROUTE */
+#define CP_ROUTE_NORMAL 133
+#define CP_ROUTE_DIRECT 134
+
+/* Valeurs pour l'option Comportement en cas d'erreur */
+#define CP_AUTO 135
+#define CP_BLOCAGE 136
+#define CP_MANUEL 137
+
+/* Type de requete de lecture */
+/* La valeur CP_ATTENTE define pour l'etat d'une */
+/* instance est aussi utilisee */
+#define CP_IMMEDIATE 141
+
+/* Definition des types de lien */
+#define CPLVAV 151
+#define CPLVAF 152
+#define CPLVAS 153
+#define CPLCAV 154
+#define CPLFAV 155
+
+/* Codes des entetes des messages (Evenemet *) */
+#define ERREUR 1000
+#define CONNEXION 1001
+#define EMISSION 1002
+#define DECONNEXION 1003
+#define LECTURE_VARIABLE 1004
+#define ECRITURE_VARIABLE 1005
+#define FIN_DE_PAS 1006
+#define AUIN_FIN_DE_PAS 1007
+#define EFFACEMENT 1008
+#define MODE_EXEC 1009
+#define RUN_N_PAS 1010
+#define DEF_CODE 1011
+#define DEF_INSTANCE 1012
+#define DEF_LIEN 1013
+#define DEM_VERSION 1014
+#define SET_OPTION 1015
+#define DEM_OPTION 1016
+#define DEM_CODES 1017
+#define DEM_INSTS_DE_CODE 1018
+#define DEM_VARIABLES 1019
+#define DEM_VARS_DE_CODE 1020
+#define DEM_VARS_DE_INST 1021
+#define DEM_CARS_DE_VARIABLE 1022
+#define DEM_CARS_DE_LIEN 1023
+#define ENV_VALEURS_VARIABLE 1024
+#define ENV_OPTION 1025
+#define ENV_CODES 1026
+#define ENV_INSTS_DE_CODE 1027
+#define ENV_VARIABLES 1028
+#define ENV_VARS_DE_CODE 1029
+#define ENV_VARS_DE_INST 1030
+#define ENV_CARS_DE_VARIABLE 1031
+#define ENV_CARS_DE_LIEN 1032
#define ENV_TOPOLOGY 1033
#define R_ENV_TOPOLOGY 1034
#define ENV_MACHINE 1035
-/* Message PVM */
-#define P_HOST_DELETE 2000
-#define P_TASK_EXIT 2001
+/* Message PVM */
+#define P_HOST_DELETE 2000
+#define P_TASK_EXIT 2001
-/* Codes d'erreur */
+/* Codes d'erreur */
-/* Pas d'erreur */
-#define CPOK 0
+/* Pas d'erreur */
+#define CPOK 0
-/* Emetteur inconnu */
-#define CPERIU 1
+/* Emetteur inconnu */
+#define CPERIU 1
-/* Nom de variable inconnu */
-#define CPNMVR 2
+/* Nom de variable inconnu */
+#define CPNMVR 2
-/* Type entree/sortie incompatible */
-#define CPIOVR 3
+/* Type entree/sortie incompatible */
+#define CPIOVR 3
-/* Type inconnu */
-#define CPTP 4
+/* Type inconnu */
+#define CPTP 4
-/* Type de variable incompatible */
-#define CPTPVR 5
+/* Type de variable incompatible */
+#define CPTPVR 5
-/* Mode de dependance inconnu */
-#define CPIT 6
+/* Mode de dependance inconnu */
+#define CPIT 6
-/* Mode dependance incompatible */
-#define CPITVR 7
+/* Mode dependance incompatible */
+#define CPITVR 7
-/* Requete non autorisee */
-#define CPRENA 8
+/* Requete non autorisee */
+#define CPRENA 8
-/* Type de deconnexion incorrect */
-#define CPDNTP 9
+/* Type de deconnexion incorrect */
+#define CPDNTP 9
-/* Directive de deconnexion incorrecte */
-#define CPDNDI 10
+/* Directive de deconnexion incorrecte */
+#define CPDNDI 10
-/* Nom de code inconnu */
-#define CPNMCD 11
+/* Nom de code inconnu */
+#define CPNMCD 11
-/* Nom d'instance inconnu */
-#define CPNMIN 12
+/* Nom d'instance inconnu */
+#define CPNMIN 12
-/* Attente */
-#define CPATTENTE 13
+/* Attente */
+#define CPATTENTE 13
-/* Blocage */
-#define CPBLOC 14
+/* Blocage */
+#define CPBLOC 14
-/* Nombre de valeurs transmises egal a zero */
-#define CPNTNULL 15
+/* Nombre de valeurs transmises egal a zero */
+#define CPNTNULL 15
-/* Longueur de variable insuffisante */
-#define CPLGVR 16
+/* Longueur de variable insuffisante */
+#define CPLGVR 16
-/* L'instance doit s'arreter */
-#define CPSTOP 17
+/* L'instance doit s'arreter */
+#define CPSTOP 17
-/* Arret anormal */
-#define CPATAL 18
+/* Arret anormal */
+#define CPATAL 18
-/* Coupleur abscent */
-#define CPNOCP 19
+/* Coupleur abscent */
+#define CPNOCP 19
-/* Variable sortante non connectee */
-#define CPCTVR 20
+/* Variable sortante non connectee */
+#define CPCTVR 20
-/* Nombre de pas a executer egal a zero */
-#define CPPASNULL 21
+/* Nombre de pas a executer egal a zero */
+#define CPPASNULL 21
-/* Machine inconnue */
-#define CPMACHINE 22
+/* Machine inconnue */
+#define CPMACHINE 22
-/* COUPLAGE_GROUPE non positionnee */
-#define CPGRNU 23
+/* COUPLAGE_GROUPE non positionnee */
+#define CPGRNU 23
-/* Groupe d'instances incorrect */
-#define CPGRIN 24
+/* Groupe d'instances incorrect */
+#define CPGRIN 24
-/* Fin du fichier d'entree */
-#define CPFINFICH 25
+/* Fin du fichier d'entree */
+#define CPFINFICH 25
-/* Erreur de format dans un fichier */
-#define CPERRFICH 26
+/* Erreur de format dans un fichier */
+#define CPERRFICH 26
-/* Requete d'avance de n pas annullee */
-/* par passage en mode NORMAL */
-#define CPNORERR 27
+/* Requete d'avance de n pas annullee */
+/* par passage en mode NORMAL */
+#define CPNORERR 27
-/* Coupleur en mode NORMAL pour une */
-/* requete RUN_N_PAS ou DEF_* */
-#define CPRUNERR 28
+/* Coupleur en mode NORMAL pour une */
+/* requete RUN_N_PAS ou DEF_* */
+#define CPRUNERR 28
-/* Option inconnue */
-#define CPOPT 29
+/* Option inconnue */
+#define CPOPT 29
-/* Valeur d'option inconnue */
-#define CPVALOPT 30
+/* Valeur d'option inconnue */
+#define CPVALOPT 30
-/* Ecriture impossible par effacement */
-#define CPECREFF 31
+/* Ecriture impossible par effacement */
+#define CPECREFF 31
-/* Lecture d'une variable non connectee */
-/* ou n'appartenant pas a un lien VAS */
-/* ou VAV s'il s'agit d'une sortante */
-#define CPLIEN 32
+/* Lecture d'une variable non connectee */
+/* ou n'appartenant pas a un lien VAS */
+/* ou VAV s'il s'agit d'une sortante */
+#define CPLIEN 32
/* Lecture d'une variable d'une instance*/
-/* deconnectee avec directive CP_ARRET */
-#define CPINARRET 33
+/* deconnectee avec directive CP_ARRET */
+#define CPINARRET 33
-/* Les lectures sequentielles ne pourront plus */
-/* etre satisfaites : instance productrice arretee */
-#define CPSTOPSEQ 34
+/* Les lectures sequentielles ne pourront plus */
+/* etre satisfaites : instance productrice arretee */
+#define CPSTOPSEQ 34
-/* Erreur dans la chaine de declaration */
-#define CPDECL 35
+/* Erreur dans la chaine de declaration */
+#define CPDECL 35
/* Erreur dans l'execution de l'instance ajoutee */
-#define CPINEXEC 36
+#define CPINEXEC 36
-/* Erreur PVM */
-#define CPPVM 37
+/* Erreur PVM */
+#define CPPVM 37
-/* Erreur detectee au niveau de l'interface de couplage */
-#define CPERRINST 38
+/* Erreur detectee au niveau de l'interface de couplage */
+#define CPERRINST 38
/* IDM : les deux define suivants ont ete rajoutes a la main*/
/* Erreur de mode d'execution non defini */
-#define CPMODE 39
+#define CPMODE 39
/* Erreur d'instance deconnectee */
-#define CPINSTDEC 40
+#define CPINSTDEC 40
-/* Codes des evenements pour le fichier de trace */
+/* Codes des evenements pour le fichier de trace */
-/* Debut du couplage */
-#define DEBUT_COUPLAGE 0
+/* Debut du couplage */
+#define DEBUT_COUPLAGE 0
-/* Fin du couplage */
-#define FIN_COUPLAGE 1
+/* Fin du couplage */
+#define FIN_COUPLAGE 1
-/* Execution d'une instance par Oacc */
-#define EXEC 2
+/* Execution d'une instance par Oacc */
+#define EXEC 2
-/* Connexion d'une instance */
-#define CPCD 3
+/* Connexion d'une instance */
+#define CPCD 3
-/* Permission d'emettre accordee a l'instance */
-#define CPALLOW 4
+/* Permission d'emettre accordee a l'instance */
+#define CPALLOW 4
-/* Requete d'ecriture */
-#define CPECRI 5
+/* Requete d'ecriture */
+#define CPECRI 5
-/* Requete de lecture */
-#define DEB_LECT 6
+/* Requete de lecture */
+#define DEB_LECT 6
-/* Envoi des donnees suite a une requete de lecture */
-#define FIN_LECT 7
+/* Envoi des donnees suite a une requete de lecture */
+#define FIN_LECT 7
-/* Deconnexion d'une instance */
-#define CPFIN 8
+/* Deconnexion d'une instance */
+#define CPFIN 8
-/* Requete de fin de pas */
-#define CPFINP 9
+/* Requete de fin de pas */
+#define CPFINP 9
-/* Requete d'autorisation de fin de pas */
-#define CPAUFP 10
+/* Requete d'autorisation de fin de pas */
+#define CPAUFP 10
-/* Requete d'interdiction de fin de pas */
-#define CPINFP 11
+/* Requete d'interdiction de fin de pas */
+#define CPINFP 11
-/* Requete d'effacement */
-#define CPEFF 12
+/* Requete d'effacement */
+#define CPEFF 12
-/* Signal d'arret d'une instance */
-#define STOP 13
+/* Signal d'arret d'une instance */
+#define STOP 13
-/* Avis de blocage suite a une requete de lecture */
-#define BLOCAGE 14
+/* Avis de blocage suite a une requete de lecture */
+#define BLOCAGE 14
-/* Requete de passage en mode pause */
-#define CPPAUSE 15
+/* Requete de passage en mode pause */
+#define CPPAUSE 15
-/* Requete de passage en mode normal */
-#define CPNORMAL 16
+/* Requete de passage en mode normal */
+#define CPNORMAL 16
-/* Requete d'execution de n pas */
-#define CPNPAS 17
+/* Requete d'execution de n pas */
+#define CPNPAS 17
-/* Requete de definition d'un code */
-#define CPADCD 18
+/* Requete de definition d'un code */
+#define CPADCD 18
-/* Requete de definition d'une instance */
-#define CPADINCD 19
+/* Requete de definition d'une instance */
+#define CPADINCD 19
-/* Requete de definition d'un lien */
-#define CPADLN 20
+/* Requete de definition d'un lien */
+#define CPADLN 20
-/* Requete d'identification de version */
-#define CPIVERS 21
+/* Requete d'identification de version */
+#define CPIVERS 21
-/* Requete de demande de la liste des codes */
-#define CPICD 22
+/* Requete de demande de la liste des codes */
+#define CPICD 22
-/* Requete de demande des instances d'un code */
-#define CPIINCD 23
+/* Requete de demande des instances d'un code */
+#define CPIINCD 23
/* Requete de demande de la liste des variables globales*/
-#define CPIVR 24
+#define CPIVR 24
-/* Requete de demande des variables d'un code */
-#define CPIVRCD 25
+/* Requete de demande des variables d'un code */
+#define CPIVRCD 25
-/* Requete de demande des variables d'une instance */
-#define CPIVRIN 26
+/* Requete de demande des variables d'une instance */
+#define CPIVRIN 26
-/* Requete de demande d'info sur une variable globale */
-#define CPICAVR 27
+/* Requete de demande d'info sur une variable globale */
+#define CPICAVR 27
-/* Requete de demande des caracteristiques d'un lien */
-#define CPIILIEN 28
+/* Requete de demande des caracteristiques d'un lien */
+#define CPIILIEN 28
-/* Requete de modification d'une option */
-#define CPSETOPT 29
+/* Requete de modification d'une option */
+#define CPSETOPT 29
-/* Requete de consultation d'une option */
-#define CPGETOPT 30
+/* Requete de consultation d'une option */
+#define CPGETOPT 30
-/* Terminaison d'une tache PVM */
-#define TASK_EXIT 31
+/* Terminaison d'une tache PVM */
+#define TASK_EXIT 31
-/* Deconnexion d'une machine */
-#define HOST_DELETE 32
+/* Deconnexion d'une machine */
+#define HOST_DELETE 32
#ifdef PRG_MAIN
-/* Fichier principal de la bibliotheque de couplage */
-
-
-char * CPMESSAGE[] = {
- "Pas d'erreur",
- "Emetteur inconnu",
- "Nom de la variable inconnu",
- "Code entree/sortie differents dans le coupleur et dans le code",
- "Type de variable inconnu",
- "Types de variable differents dans le coupleur et dans le code",
- "Mode de dependance inconnu",
- "Modes de dependance differents dans le coupleur et dans le code",
- "Requete non autorisee",
- "Type de deconnexion incorrect",
- "Directive de deconnexion incorrecte",
- "Nom de code inconnu",
- "Nom d'instance inconnu",
- "Requete en attente",
- "Cas de blocage",
- "Nombre de valeurs transmises egal a zero",
- "Longueur de variable insuffisante",
- "L'instance doit s'arreter",
- "Arret anormal d'une instance",
- "Coupleur abscent, execution manuelle",
- "Variable sortante non connectee",
- "Nombre de pas a executer egal a zero",
- "Machine non declaree",
- "La variable d'environnement COUPLAGE_GROUPE n'est pas positionnee",
- "Le groupe d'instances indique par COUPLAGE_GROUPE est incorrect",
- "Fin du fichier d'entree",
- "Erreur de format dans le fichier d'entree",
- "Requete annulee a cause du passage en mode NORMAL",
- "Le coupleur est en mode d'execution normal",
- "Option inconnue",
- "Valeur d'option incorrecte",
- "Ecriture impossible a cause d'une requete d'effacement",
- "Lecture d'une variable incorrectement connectee",
- "Lecture d'une variable d'une instance deconnectee avec CP_ARRET",
- "Lectures sequentielles plus satisfaites",
- "Erreur dans la chaine de declaration",
- "Erreur dans le lancement de l'instance ajoutee",
- "Erreur PVM",
- "Erreur detectee au niveau de l'instance",
- };
+/* Fichier principal de la bibliotheque de couplage */
+ const char * CPMESSAGE[] = {
+ "",
+ "Emitter unknown",
+ "Variable name unknown",
+ "Different input/output codes in code and supervisor",
+ "Variable type unknown",
+ "Different variable types in code and supervisor",
+ "Dependency mode unknown",
+ "Different dependency modes in code and supervisor",
+ "Unauthorized request",
+ "Unauthorized disconnection request type",
+ "Unauthorized disconnection directive",
+ "Code name unknown",
+ "Instance name unknown",
+ "Waiting request",
+ "Blocking",
+ "Zero value number",
+ "Insufficient variable length",
+ "Instance is going to stop",
+ "Unexpected instance stop",
+ "Manuel execution",
+ "Output variable not connected",
+ "Number of steps to execute is nul",
+ "Non declared computer",
+ "Environment variable COUPLAGE_GROUPE is not set",
+ "Instance group given by COUPLAGE_GROUPE is wrong",
+ "End of input file",
+ "Format error in input file",
+ "Request ignored because of switching to NORMAL mode",
+ "Supervisor is in normal execution mode",
+ "Unknown option",
+ "Option value is wrong",
+ "Impossible to write because of an erasing request",
+ "Reading of a variable wrongly connected",
+ "Reading of a variable of an instance disconnected with CP_ARRET",
+ "Sequential reading no more possible",
+ "Error in declaration",
+ "Error in instance launching",
+ "Communication error",
+ "Error in the instance",
+ "Environnement variable CAL_MODE is not set",
+ "Disconnected instance",
+ };
#else
-extern char * CPMESSAGE[];
+extern const char * CPMESSAGE[];
#endif
-/* Type de variables */
-#define ENTIER 30
-#define REEL 31
-#define DREEL 32
-#define COMPLEXE 33
-#define LOGIQUE 34
-#define CHAINE 35
+/* Type de variables */
+#define ENTIER 30
+#define REEL 31
+#define DREEL 32
+#define COMPLEXE 33
+#define LOGIQUE 34
+#define CHAINE 35
/* Macro minuscule majuscule */
-#define TOUPPER(string) \
+#define TOUPPER(string) \
{\
int i, number = strlen(string);\
for (i = 0; i < number; i++) string[i] = toupper(string[i]); \
}
/* Macro inferieur */
-#define INF(a,b) (a <= b ? a : b)
+#define INF(a,b) (a <= b ? a : b)
/* Macro superieur */
-#define SUP(a,b) (a >= b ? a : b)
+#define SUP(a,b) (a >= b ? a : b)
#endif
// Module : KERNEL
//
#include "calcium_integer_port_uses.hxx"
+#include "calcium_long_port_uses.hxx"
+#include "calcium_intc_port_uses.hxx"
#include "calcium_real_port_uses.hxx"
#include "calcium_double_port_uses.hxx"
#include "calcium_string_port_uses.hxx"
calcium_real_port_uses::~calcium_real_port_uses(void) {};
calcium_double_port_uses::~calcium_double_port_uses(void) {};
calcium_integer_port_uses::~calcium_integer_port_uses(void) {};
+calcium_long_port_uses::~calcium_long_port_uses(void) {};
+calcium_intc_port_uses::~calcium_intc_port_uses(void) {};
calcium_logical_port_uses::~calcium_logical_port_uses(void) {};
calcium_complex_port_uses::~calcium_complex_port_uses(void) {};
calcium_string_port_uses::~calcium_string_port_uses(void) {};
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : calcium_int_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+//
+#ifndef _CALCIUM_INTC_PORT_USES_HXX_
+#define _CALCIUM_INTC_PORT_USES_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_Intc_Port_name[];
+
+class calcium_intc_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_long,
+ CORBA::Long >,
+ Ports::Calcium_Ports::Calcium_Intc_Port,
+ _repository_Calcium_Intc_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_intc_port_uses();
+
+};
+
+#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : calcium_integer_port_uses.hxx
-// Author : Eric Fayolle (EDF)
-// Module : KERNEL
-// Modified by : $LastChangedBy$
-// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
-// Id : $Id$
-//
-#ifndef _CALCIUM_INTEGER_PORT_USES_HXX_
-#define _CALCIUM_INTEGER_PORT_USES_HXX_
-
-#include <SALOMEconfig.h>
-
-#include "Calcium_Ports.hh"
-#include "CalciumGenericUsesPort.hxx"
-
-extern char _repository_Calcium_Integer_Port_name[];
-
-class calcium_integer_port_uses :
- public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_long,
- CORBA::Long >,
- Ports::Calcium_Ports::Calcium_Integer_Port,
- _repository_Calcium_Integer_Port_name
- >
-{
- public :
-
- virtual ~calcium_integer_port_uses();
-
-};
-
-#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : calcium_integer_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+//
+#ifndef _CALCIUM_INTEGER_PORT_USES_HXX_
+#define _CALCIUM_INTEGER_PORT_USES_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_Integer_Port_name[];
+
+class calcium_integer_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_integer,
+ @CALCIUM_CORBA_INT_F77@ >,
+ Ports::Calcium_Ports::Calcium_Integer_Port,
+ _repository_Calcium_Integer_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_integer_port_uses();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : calcium_long_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+//
+#ifndef _CALCIUM_LONG_PORT_USES_HXX_
+#define _CALCIUM_LONG_PORT_USES_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_Long_Port_name[];
+
+class calcium_long_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_long_long,
+ CORBA::LongLong >,
+ Ports::Calcium_Ports::Calcium_Long_Port,
+ _repository_Calcium_Long_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_long_port_uses();
+
+};
+
+#endif
if ( type == "integer")
rtn_port = new calcium_integer_port_provides();
+ if ( type == "long")
+ rtn_port = new calcium_long_port_provides();
+ if ( type == "intc")
+ rtn_port = new calcium_intc_port_provides();
if ( type == "real")
rtn_port = new calcium_real_port_provides();
if ( type == "double")
if ( type == "integer")
rtn_port = new calcium_integer_port_uses();
+ if ( type == "long")
+ rtn_port = new calcium_long_port_uses();
+ if ( type == "intc")
+ rtn_port = new calcium_intc_port_uses();
if ( type == "real")
rtn_port = new calcium_real_port_uses();
if ( type == "double")
#include "CalciumProvidesPort.hxx"
#include "calcium_integer_port_uses.hxx"
+#include "calcium_long_port_uses.hxx"
+#include "calcium_intc_port_uses.hxx"
#include "calcium_real_port_uses.hxx"
#include "calcium_double_port_uses.hxx"
#include "calcium_string_port_uses.hxx"
// Id : $Id$
//
#include "calcium_integer_port_uses.hxx"
+#include "calcium_long_port_uses.hxx"
+#include "calcium_intc_port_uses.hxx"
#include "calcium_real_port_uses.hxx"
#include "calcium_double_port_uses.hxx"
#include "calcium_complex_port_uses.hxx"
#include "calcium_string_port_uses.hxx"
char _repository_Calcium_Integer_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0";
+char _repository_Calcium_Long_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Long_Port:1.0";
+char _repository_Calcium_Intc_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Intc_Port:1.0";
char _repository_Calcium_Real_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0";
char _repository_Calcium_Double_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0";
char _repository_Calcium_Complex_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Complex_Port:1.0";
#include <stdlib.h>
#include "fortoc.h"
#include "calcium.h"
+#include "calciumf.h"
+#include "CalciumFortranInt.h"
#include <stdio.h>
static void* COMPO=0;
extern "C" {
#endif
-static void fstrtocstr(char *cstr, char *fstr,int fstr_len)
+
+static void fstrtocstr(char *cstr, char *fstr,cal_int fstr_len)
{
- int i,iend;
+ cal_int i,iend;
for (iend = fstr_len-1; iend >= 0; iend--)
if (fstr[iend] != ' ') break;
for (i = 0; i <= iend; i++)
cstr[i] = '\0';
}
-static void cstrtofstr(char *cstr, char *fstr,int fstr_len)
+static void cstrtofstr(char *cstr, char *fstr,cal_int fstr_len)
{
- int i, len;
+ cal_int i, len;
len = strlen(cstr);
if (len > fstr_len) len = fstr_len;
for (i = 0; i < len; i++)
fstr[i++] = ' ';
}
-static char * fstr1(char *nom,int nnom)
+static char * fstr1(char *nom,cal_int nnom)
{
char * cnom=(char*)malloc((nnom+1)*sizeof(char));
fstrtocstr(cnom,nom,nnom);
return cnom;
}
-static char * free_str1(char *nom)
+static void free_str1(char *nom)
{
free(nom);
}
-void F_FUNC(cpcd,CPCD)(long *compo,STR_PSTR(nom),int *info STR_PLEN(nom))
+/**********************************************/
+/* INTERFACES DE DÉBUT ET DE FIN DE COUPLAGE */
+/**********************************************/
+
+void F_FUNC(cpcd,CPCD)(long *compo,STR_PSTR(nom),cal_int *info STR_PLEN(nom));
+void F_FUNC(cpfin,CPFIN)(long *compo,cal_int *dep,cal_int *err);
+
+void F_FUNC(cpcd,CPCD)(long *compo,STR_PSTR(nom),cal_int *info STR_PLEN(nom))
{
/* nom is OUT argument */
cp_cd((void *)*compo,STR_PTR(nom));
cstrtofstr(STR_PTR(nom),STR_PTR(nom),STR_LEN(nom));
}
-void F_FUNC(cplen,CPLEN)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom),
- int *max,int *n, int *tab,int *err STR_PLEN(nom))
+void F_FUNC(cpfin,CPFIN)(long *compo,cal_int *dep,cal_int *err)
+{
+ *err=cp_fin((void *)*compo,(int)*dep);
+}
+
+/**************************************/
+/* INTERFACES DE LECTURE */
+/**************************************/
+
+void F_FUNC(cplin,CPLIN)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, int *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cpllg,CPLLG)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, long *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cplen,CPLEN)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, cal_int *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cpllo,CPLLO)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, int *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cpldb,CPLDB)(long *compo,cal_int *dep,double *ti,double *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, double *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cplre,CPLRE)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cplcp,CPLCP)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cplch,CPLCH)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, char *tab,cal_int *err STR_PLEN(nom) STR_PLEN(tab) );
+
+
+void F_FUNC(cplin,CPLIN)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, int *tab,cal_int *err STR_PLEN(nom))
+{
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+
+#if !SIZEOF_INT
+#error "The macro SIZEOF_INT must be defined."
+#elif SIZEOF_INT == 4
+ *err=cp_lin_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+#else
+ fprintf(stderr,"End of CPLIN: %s : Can't use fortran INTEGER*4 because int C is not 32bits long on this machine.\n",
+ cnom);
+#endif
+ free_str1(cnom);
+}
+
+void F_FUNC(cpllg,CPLLG)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, long *tab,cal_int *err STR_PLEN(nom))
+{
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+#if !SIZEOF_LONG
+#error "The macro SIZEOF_LONG must be defined."
+#elif SIZEOF_LONG == 8
+ *err=cp_llg_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+#else
+ fprintf(stderr,"End of CPLLG: %s : Can't use fortran INTEGER*8 because long C is not 64bits long on this machine.\n",
+ cnom);
+#endif
+ free_str1(cnom);
+}
+
+void F_FUNC(cplen,CPLEN)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, cal_int *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
- fprintf(stderr,"CPLEN: %s %f %f\n",cnom,*ti,*tf);
- *err=cp_len((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
- fprintf(stderr,"End of CPLEN: %s \n",cnom);
+ *err=cp_len_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
free_str1(cnom);
}
-void F_FUNC(cpllo,CPLLO)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom),
- int *max,int *n, int *tab,int *err STR_PLEN(nom))
+
+void F_FUNC(cpllo,CPLLO)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, int *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
- fprintf(stderr,"CPLLO: %s %f %f\n",cnom,*ti,*tf);
- *err=cp_llo((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
- fprintf(stderr,"End of CPLLO: %s \n",cnom);
+ *err=cp_llo_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
free_str1(cnom);
}
-void F_FUNC(cpldb,CPLDB)(long *compo,int *dep,double *ti,double *tf,int *iter,STR_PSTR(nom),
- int *max,int *n, double *tab,int *err STR_PLEN(nom))
+void F_FUNC(cpldb,CPLDB)(long *compo,cal_int *dep,double *ti,double *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, double *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
- fprintf(stderr,"CPLDB: %s %f %f \n",cnom, *ti,*tf);
- *err=cp_ldb((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
- fprintf(stderr,"End of CPLDB: %s %f %f \n",cnom,*ti,*tf);
+ *err=cp_ldb_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
free_str1(cnom);
}
-void F_FUNC(cplre,CPLRE)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom),
- int *max,int *n, float *tab,int *err STR_PLEN(nom))
+void F_FUNC(cplre,CPLRE)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
- fprintf(stderr,"CPLRE: %s %f %f \n",cnom, *ti,*tf);
- *err=cp_lre((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
- fprintf(stderr,"End of CPLRE: %s %f %f \n",cnom,*ti,*tf);
+ *err=cp_lre_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
free_str1(cnom);
}
-void F_FUNC(cplcp,CPLCP)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom),
- int *max,int *n, float *tab,int *err STR_PLEN(nom))
+void F_FUNC(cplcp,CPLCP)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
- fprintf(stderr,"CPLCP: %s %f %f \n",cnom, *ti,*tf);
- *err=cp_lcp((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
- fprintf(stderr,"End of CPLCP: %s %f %f \n",cnom,*ti,*tf);
+ *err=cp_lcp_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
free_str1(cnom);
}
-void F_FUNC(cplch,CPLCH)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom),
- int *max,int *n, char *tab,int *err STR_PLEN(nom) STR_PLEN(tab) )
+void F_FUNC(cplch,CPLCH)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, char *tab,cal_int *err STR_PLEN(nom) STR_PLEN(tab) )
{
- char **tabChaine=NULL;
- int index=0;
- char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
- fprintf(stderr,"CPLCH: %s %f %f \n",cnom, *ti,*tf);
+ char **tabChaine = NULL;
+ cal_int index = 0;
+ char* cnom = fstr1(STR_PTR(nom),STR_LEN(nom));
tabChaine = (char **) malloc(sizeof(char *) * (*max));
for (index = 0; index < *max; index++)
tabChaine[index] = (char *) malloc(sizeof(char) * (STR_LEN(tab)+1));
- *err=cp_lch((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tabChaine,STR_LEN(tab));
+ *err=cp_lch_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tabChaine,STR_LEN(tab));
for (index = 0; index < *n; index++)
strncpy(&tab[index * STR_LEN(tab)], tabChaine[index], strlen(tabChaine[index]));
- fprintf(stderr,"End of CPLCH: %s %f %f \n",cnom,*ti,*tf);
if (tabChaine != (char **) NULL) {
for (index = 0; index < *n; index++)
free(tabChaine[index]);
free_str1(cnom);
}
-void F_FUNC(cpech,CPECH)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, char *tab,int *err
+
+/***************************/
+/* INTERFACES D'ECRITURE */
+/***************************/
+void F_FUNC(cpech,CPECH)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, char *tab,cal_int *err
+ STR_PLEN(nom) STR_PLEN(tab));
+void F_FUNC(cpedb,CPEDB)(long *compo,cal_int *dep,double *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cpere,CPERE)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cpecp,CPECP)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cpein,CPEIN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cpelg,CPELG)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, long *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cpeen,CPEEN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, cal_int *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cpelo,CPELO)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_int *err STR_PLEN(nom));
+
+void F_FUNC(cpech,CPECH)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, char *tab,cal_int *err
STR_PLEN(nom) STR_PLEN(tab))
{
char ** tabChaine=NULL;
- int index=0,index2=0;
+ cal_int index=0,index2=0;
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
- fprintf(stderr,"CPECH: %s %f \n",cnom, *ti);
tabChaine = (char **) malloc(sizeof(char *) * *n);
for (index = 0; index < *n; index++) {
}
}
- *err=cp_ech((void *)*compo,*dep,*ti,*iter,cnom,*n,tabChaine,STR_LEN(tab) );
+ *err=cp_ech_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tabChaine,STR_LEN(tab) );
- fprintf(stderr,"End of CPECH: %s %f \n",cnom, *ti);
if (tabChaine != (char **) NULL) {
for (index = 0; index < *n; index++)
free(tabChaine[index]);
free_str1(cnom);
}
-void F_FUNC(cpedb,CPEDB)(long *compo,int *dep,double *ti,int *iter,STR_PSTR(nom),int *n, double *tab,int *err STR_PLEN(nom))
+void F_FUNC(cpedb,CPEDB)(long *compo,cal_int *dep,double *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
- fprintf(stderr,"CPEDB: %s %f \n",cnom, *ti);
- *err=cp_edb((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
- fprintf(stderr,"End of CPEDB: %s %f \n",cnom, *ti);
+ *err=cp_edb_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
free_str1(cnom);
}
-void F_FUNC(cpere,CPERE)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, float *tab,int *err STR_PLEN(nom))
+void F_FUNC(cpere,CPERE)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
- fprintf(stderr,"CPERE: %s %f \n",cnom, *ti);
- *err=cp_ere((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
- fprintf(stderr,"End of CPERE: %s %f \n",cnom, *ti);
+ *err=cp_ere_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
free_str1(cnom);
}
-void F_FUNC(cpecp,CPECP)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, float *tab,int *err STR_PLEN(nom))
+void F_FUNC(cpecp,CPECP)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom))
{
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
- fprintf(stderr,"CPECP: %s %f \n",cnom, *ti);
- *err=cp_ecp((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
- fprintf(stderr,"End of CPECP: %s %f \n",cnom, *ti);
+ *err=cp_ecp_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
free_str1(cnom);
}
-void F_FUNC(cpeen,CPEEN)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, int *tab,int *err STR_PLEN(nom))
+
+void F_FUNC(cpein,CPEIN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_int *err STR_PLEN(nom))
{
+
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
- fprintf(stderr,"CPEEN: %s %f %d\n",cnom, *ti,*iter);
- *err=cp_een((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
- fprintf(stderr,"End of CPEEN: %s %f \n",cnom,*ti);
+#if !SIZEOF_INT
+#error "The macro SIZEOF_INT must be defined."
+#elif SIZEOF_INT == 4
+ *err=cp_ein_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+#else
+ fprintf(stderr,"CPEIN: %s %f %d : Can't use fortran INTEGER*4 because int C is not 32bits long on this machine.\n",
+ cnom, *ti,*iter);
+#endif
free_str1(cnom);
}
-void F_FUNC(cpelo,CPELO)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, int *tab,int *err STR_PLEN(nom))
+void F_FUNC(cpelg,CPELG)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, long *tab,cal_int *err STR_PLEN(nom))
{
+
char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
- fprintf(stderr,"CPELO: %s %f %d\n",cnom, *ti,*iter);
- *err=cp_elo((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
- fprintf(stderr,"End of CPELO: %s %f \n",cnom,*ti);
+#if !SIZEOF_LONG
+#error "The macro SIZEOF_LONG must be defined."
+#elif SIZEOF_LONG == 8
+ *err=cp_elg_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+#else
+ fprintf(stderr,"CPELG: %s %f %d : Can't use fortran INTEGER*8 because long C is not 64bits long on this machine.\n",
+ cnom, *ti,*iter);
+#endif
free_str1(cnom);
}
-void F_FUNC(cpfin,CPFIN)(long *compo,int *dep,int *err)
+void F_FUNC(cpeen,CPEEN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, cal_int *tab,cal_int *err STR_PLEN(nom))
{
- fprintf(stderr,"CPFIN: \n");
- *err=cp_fin((void *)*compo,*dep);
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ *err=cp_een_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+ free_str1(cnom);
}
+void F_FUNC(cpelo,CPELO)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_int *err STR_PLEN(nom))
+{
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ *err=cp_elo_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+ free_str1(cnom);
+}
+
+
#ifdef __cplusplus
}
#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : calcium.h
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+
+/* Outils d'Aide au Couplage de Code de Calcul : $Id$ */
+
+#ifndef __CALCIUMF_H
+#define __CALCIUMF_H
+
+#include "CalciumFortranInt.h"
+
+/*TODO CPCD... */
+
+#define STAR *
+#define LCH_LAST_PARAM ,int strsize
+
+
+#define CALCIUM_ECR_INTERFACE_C_H(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \
+ extern _calInt cp_##_name (void * component, _calInt mode, \
+ _timeType t, _calInt i, \
+ char * nomvar, _calInt nbelem, \
+ _type _qual * data \
+ lastarg ) ; \
+
+
+CALCIUM_ECR_INTERFACE_C_H(een_fort_,float ,cal_int,cal_int,integer,,);
+CALCIUM_ECR_INTERFACE_C_H(elg_fort_,float ,cal_int,long ,long2integer,,);
+CALCIUM_ECR_INTERFACE_C_H(ein_fort_,float ,cal_int,int ,int2integer,,);
+CALCIUM_ECR_INTERFACE_C_H(ere_fort_,float ,cal_int,float ,float,,);
+CALCIUM_ECR_INTERFACE_C_H(edb_fort_,double,cal_int,double,double,,);
+CALCIUM_ECR_INTERFACE_C_H(elo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */
+CALCIUM_ECR_INTERFACE_C_H(ecp_fort_,float ,cal_int,float ,cplx,,);
+CALCIUM_ECR_INTERFACE_C_H(ech_fort_,float ,cal_int,char ,str,STAR,LCH_LAST_PARAM );
+
+
+
+#define CALCIUM_LECT_INTERFACE_C_H(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \
+ extern _calInt cp_##_name (void * component, _calInt mode, \
+ _timeType * ti, _timeType * tf, _calInt * i, \
+ char * nomvar, _calInt bufferLength, \
+ _calInt * nRead, _type _qual * data \
+ lastarg ) ; \
+ \
+
+
+CALCIUM_LECT_INTERFACE_C_H(len_fort_,float ,cal_int,cal_int ,integer,,);
+CALCIUM_LECT_INTERFACE_C_H(llg_fort_,float ,cal_int,long ,long2integer,,);
+CALCIUM_LECT_INTERFACE_C_H(lin_fort_,float ,cal_int,int ,int2integer,,);
+CALCIUM_LECT_INTERFACE_C_H(lre_fort_,float ,cal_int,float ,float,,);
+CALCIUM_LECT_INTERFACE_C_H(ldb_fort_,double,cal_int,double ,double,,);
+CALCIUM_LECT_INTERFACE_C_H(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */
+CALCIUM_LECT_INTERFACE_C_H(lcp_fort_,float ,cal_int,float ,cplx,,);
+CALCIUM_LECT_INTERFACE_C_H(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_PARAM );
+
+
+
+#endif
#include <cstring>
#include <CORBA.h>
+//#define MYDEBUG
// Classes manipulation
// -------------------
// En non collocalisé on recrée une séquence avec le buffer de la première dont on
// a demandé la propriété.
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1 ------------------" << std::endl;
#endif
if ( data.release() ) {
// Crée une nouvelle sequence propriétaire des données du buffer (pas de recopie)
// Les données de la nouvelle séquence seront automatiquement désallouées
// par appel à la méthode freebuf dans le destructeur de la séquence (cf delete_data).
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(0 copy) bis ------"<< p_data <<"------------" << std::endl;
#endif
return new seq_T (max, len, p_data, true);
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(recopie) bis ------"<< &data <<"------------" << std::endl;
#endif
// Crée une nouvelle sequence propriétaire des données du buffer (avec recopie)
// Crée une nouvelle sequence propriétaire des données du buffer (généralement pas de recopie)
// Les données seront automatiquement désallouées par appel interne à la méthode freebuf
// lors de la destruction de l'objet par appel à delete_data.
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Pas de Duplication -----------" << std::endl;
#endif
return new seq_T (len, p_data, true);
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Duplication pour en devenir propriétaire -----------" << std::endl;
#endif
// Crée une nouvelle sequence propriétaire des données du buffer (avec recopie)
#include "CorbaTypeManipulator.hxx"
+#include "Superv_Component_i.hxx"
// SALOME CORBA Exception
#include "Utils_CorbaException.hxx"
// SALOME C++ Exception
#include "Utils_SALOME_Exception.hxx"
+#include "DSC_Exception.hxx"
+#include "utilities.h"
#include <iostream>
#include <map>
#include <algorithm>
#include <iterator>
+//#define MYDEBUG
+
// Classe GenericPort
// --------------------------------
//
template <typename TimeType,typename TagType> void put(CorbaInDataType data, TimeType time, TagType tag);
template <typename TimeType,typename TagType> DataType get(TimeType time, TagType tag);
- template <typename TimeType,typename TagType> DataType get(TimeType ti, TimeType tf, TagType tag = 0);
+ template <typename TimeType,typename TagType> DataType get(TimeType& ti, TimeType tf, TagType tag = 0);
template <typename TimeType,typename TagType> DataType next(TimeType &t, TagType &tag );
void close (PortableServer::POA_var poa, PortableServer::ObjectId_var id);
void wakeupWaiting();
GenericPort<DataManipulator, COUPLING_POLICY>::~GenericPort() {
typename DataTable::iterator it;
for (it=storedDatas.begin(); it!=storedDatas.end(); ++it) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "~GenericPort() : destruction de la donnnée associée au DataId :"<< (*it).first << std::endl;
#endif
DataManipulator::delete_data( (*it).second );
template < typename DataManipulator, typename COUPLING_POLICY> void
GenericPort<DataManipulator, COUPLING_POLICY>::close (PortableServer::POA_var poa,
- PortableServer::ObjectId_var id) {
+ PortableServer::ObjectId_var id) {
// Ferme le port en supprimant le servant
// La desactivation du servant du POA provoque sa suppression
poa->deactivate_object (id);
template < typename DataManipulator, typename COUPLING_POLICY> void
GenericPort<DataManipulator, COUPLING_POLICY>::wakeupWaiting()
{
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- wakeupWaiting ------------------" << std::endl;
#endif
storedDatas_mutex.lock();
if (waitingForAnyDataId || waitingForConvenientDataId) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- wakeupWaiting:signal --------" << std::endl;
std::cout << std::flush;
#endif
template < typename DataManipulator, typename COUPLING_POLICY>
template < typename TimeType,typename TagType>
void GenericPort<DataManipulator, COUPLING_POLICY>::put(CorbaInDataType dataParam,
- TimeType time,
- TagType tag) {
+ TimeType time,
+ TagType tag) {
fflush(stdout);
fflush(stderr);
try {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
// Affichage des donnees pour DEBUGging
std::cerr << "parametres emis: " << time << ", " << tag << std::endl;
DataManipulator::dump(dataParam);
bool expectedDataReceived = false;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 1 ------------------" << std::endl;
#endif
if ( dataIds.empty() ) return;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 1bis ------------------" << std::endl;
#endif
int nbOfIter = 0;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 2 ------ "<< (dataIdIt == dataIds.end()) << "------------" << std::endl;
std::cout << "-------- Put : MARK 2bis "<< (*dataIdIt) <<"------------------" << std::endl;
#endif
for (;dataIdIt != dataIds.end();++dataIdIt) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 3 ------------------" << std::endl;
#endif
// Duplique l'instance de donnée pour les autres dataIds
if (nbOfIter > 0) data = DataManipulator::clone(data);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 3bis -----"<< dataIdIt.operator*() <<"------------" << std::endl;
#endif
DataId currentDataId=*dataIdIt;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "processing dataId : "<< currentDataId << std::endl;
std::cout << "-------- Put : MARK 4 ------------------" << std::endl;
// <=> premier emplacement où l'on pourrait insérer notre DataId
// <=> en général équivaux à (*wDataIt).first >= currentDataId
typename DataTable::iterator wDataIt = storedDatas.lower_bound(currentDataId);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 5 ------------------" << std::endl;
#endif
// On n'a pas trouvé de dataId supérieur au notre ou
- // on a trouvé une clé > à cet Id
+ // on a trouvé une clé > à cet Id
if (wDataIt == storedDatas.end() || storedDatas.key_comp()(currentDataId,(*wDataIt).first) ) {
-#ifdef _DEBUG_
- std::cout << "-------- Put : MARK 6 ------------------" << std::endl;
+#ifdef MYDEBUG
+ std::cout << "-------- Put : MARK 6 ------------------" << std::endl;
#endif
- // Ajoute la donnee dans la table
- wDataIt = storedDatas.insert(wDataIt, make_pair (currentDataId, data));
+ // Ajoute la donnee dans la table
+ wDataIt = storedDatas.insert(wDataIt, make_pair (currentDataId, data));
} else {
- // Si on n'est pas en fin de liste et qu'il n'y a pas de relation d'ordre strict
- // entre notre dataId et le DataId pointé c'est qu'ils sont identiques
-#ifdef _DEBUG_
- std::cout << "-------- Put : MARK 7 ------------------" << std::endl;
-#endif
- // Les données sont remplacées par les nouvelles valeurs
- // lorsque que le dataId existe déjà
- DataType old_data = (*wDataIt).second;
- (*wDataIt).second = data;
- // Detruit la vieille donnee
- DataManipulator::delete_data (old_data);
+ // Si on n'est pas en fin de liste et qu'il n'y a pas de relation d'ordre strict
+ // entre notre dataId et le DataId pointé c'est qu'ils sont identiques
+#ifdef MYDEBUG
+ std::cout << "-------- Put : MARK 7 ------------------" << std::endl;
+#endif
+ // Les données sont remplacées par les nouvelles valeurs
+ // lorsque que le dataId existe déjà
+ DataType old_data = (*wDataIt).second;
+ (*wDataIt).second = data;
+ // Detruit la vieille donnee
+ DataManipulator::delete_data (old_data);
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 8 ------------------" << std::endl;
#endif
// Compte le nombre de dataIds à traiter
++nbOfIter;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : waitingForConvenientDataId : " << waitingForConvenientDataId <<"---" << std::endl;
std::cout << "-------- Put : waitingForAnyDataId : " << waitingForAnyDataId <<"---" << std::endl;
std::cout << "-------- Put : currentDataId : " << currentDataId <<"---" << std::endl;
// sur les dataIds (à cause du lock utilisé dans la méthode put et les méthodes get )
// rem : Utilisation de l'évaluation gauche droite du logical C or
if ( waitingForAnyDataId ||
- ( waitingForConvenientDataId &&
- isDataIdConveniant(storedDatas, expectedDataId, dummy1, dummy2, dummy3) )
- ) {
-#ifdef _DEBUG_
- std::cout << "-------- Put : MARK 10 ------------------" << std::endl;
-#endif
- //Doit pouvoir réveiller le get ici (a vérifier)
- expectedDataReceived = true;
+ ( waitingForConvenientDataId &&
+ isDataIdConveniant(storedDatas, expectedDataId, dummy1, dummy2, dummy3) )
+ ) {
+#ifdef MYDEBUG
+ std::cout << "-------- Put : MARK 10 ------------------" << std::endl;
+#endif
+ //Doit pouvoir réveiller le get ici (a vérifier)
+ expectedDataReceived = true;
}
}
if (expectedDataReceived) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 11 ------------------" << std::endl;
#endif
// si waitingForAnyDataId était positionné, c'est forcément lui qui a activer
// expectedDataReceived à true
if (waitingForAnyDataId)
- waitingForAnyDataId = false;
+ waitingForAnyDataId = false;
else
- waitingForConvenientDataId = false;
+ waitingForConvenientDataId = false;
// Reveille le thread du destinataire (stoppe son attente)
// Ne faudrait-il pas réveiller plutôt tous les threads ?
// Celui réveillé ne correspond pas forcément à celui qui demande
// Pb2 : également si deux attentes de DataIds même différents car on n'en stocke qu'un !
// Conclusion : Pour l'instant on ne gère pas un service multithreadé qui effectue
// des lectures simultanées sur le même port !
-#ifdef _DEBUG_
- std::cout << "-------- Put : new datas available ------------------" << std::endl;
+#ifdef MYDEBUG
+ std::cerr << "-------- Put : new datas available ------------------" << std::endl;
#endif
fflush(stdout);fflush(stderr);
cond_instance.signal();
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 12 ------------------" << std::endl;
#endif
// Deverouille l'acces a la table : On peut remonter l'appel au dessus de expected...
storedDatas_mutex.unlock();
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 13 ------------------" << std::endl;
#endif
fflush(stdout);
template < typename TimeType,typename TagType>
typename DataManipulator::Type
GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType time,
- TagType tag)
+ TagType tag)
// REM : Laisse passer toutes les exceptions
// En particulier les SALOME_Exceptions qui viennent de la COUPLING_POLICY
// Pour déclarer le throw avec l'exception spécifique il faut que je vérifie
bool isEqual, isBounded;
typedef typename DataManipulator::InnerType InnerType;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 1 ------------------" << std::endl;
#endif
expectedDataId = DataId(time,tag);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 2 ------------------" << std::endl;
#endif
// - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first
// Méthode provenant de la COUPLING_POLICY
isDataIdConveniant(storedDatas,expectedDataId,isEqual,isBounded,wDataIt1);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 3 ------------------" << std::endl;
#endif
// L'ordre des différents tests est important
if ( isEqual ) {
-#ifdef _DEBUG_
- std::cout << "-------- Get : MARK 4 ------------------" << std::endl;
-#endif
- // La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM.
- // Si l'utilisateur supprime la donnée, storedDataIds devient incohérent
- // C'est EraseDataId qui choisi ou non de supprimer la donnée
- // Du coup interaction potentielle entre le 0 copy et gestion de l'historique
- dataToTransmit = (*wDataIt1).second;
-
-#ifdef _DEBUG_
- std::cout << "-------- Get : MARK 5 ------------------" << std::endl;
- std::cout << "-------- Get : Données trouvées à t : " << std::endl;
- typename DataManipulator::InnerType const * const InIt1 = DataManipulator::getPointer(dataToTransmit);
- size_t N = DataManipulator::size(dataToTransmit);
- std::copy(InIt1, InIt1 + N,
- std::ostream_iterator< InnerType > (std::cout," "));
- std::cout << std::endl;
-#endif
-
- // Décide de la suppression de certaines instances de données
- // La donnée contenu dans la structure CORBA et son dataId sont désallouées
- // Méthode provenant de la COUPLING_POLICY
- typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
- processEraseDataId.apply(storedDatas,wDataIt1);
-#ifdef _DEBUG_
- std::cout << "-------- Get : MARK 6 ------------------" << std::endl;
-#endif
- break;
+#ifdef MYDEBUG
+ std::cout << "-------- Get : MARK 4 ------------------" << std::endl;
+#endif
+ // La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM.
+ // Si l'utilisateur supprime la donnée, storedDataIds devient incohérent
+ // C'est EraseDataId qui choisi ou non de supprimer la donnée
+ // Du coup interaction potentielle entre le 0 copy et gestion de l'historique
+ dataToTransmit = (*wDataIt1).second;
+
+#ifdef MYDEBUG
+ std::cout << "-------- Get : MARK 5 ------------------" << std::endl;
+ std::cout << "-------- Get : Données trouvées à t : " << std::endl;
+ typename DataManipulator::InnerType const * const InIt1 = DataManipulator::getPointer(dataToTransmit);
+ size_t N = DataManipulator::size(dataToTransmit);
+ std::copy(InIt1, InIt1 + N,
+ std::ostream_iterator< InnerType > (std::cout," "));
+ std::cout << std::endl;
+#endif
+
+ // Décide de la suppression de certaines instances de données
+ // La donnée contenu dans la structure CORBA et son dataId sont désallouées
+ // Méthode provenant de la COUPLING_POLICY
+ typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
+ processEraseDataId.apply(storedDatas,wDataIt1);
+#ifdef MYDEBUG
+ std::cout << "-------- Get : MARK 6 ------------------" << std::endl;
+#endif
+ break;
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 7 ------------------" << std::endl;
#endif
// Le DataId demandé n'est pas trouvé mais est encadré ET la politique de couplage
// implémente une méthode processBoundedDataId capable de générer les données à retourner
if ( isBounded ) {
- // Pour être cohérent avec la politique du bloc précédent
- // on stocke la paire (dataId,données interpolées ).
- // CALCIUM ne stockait pas les données interpolées.
- // Cependant comme les données sont censées être produites
- // par ordre croissant de DataId, de nouvelles données ne devrait pas améliorer
- // l'interpolation.
-#ifdef _DEBUG_
- std::cout << "-------- Get : MARK 8 ------------------" << std::endl;
-#endif
-
- typedef typename COUPLING_POLICY::template BoundedDataIdProcessor<DataManipulator> BDI;
- BDI processBoundedDataId(*this);
- // typename COUPLING_POLICY::template BoundedDataIdProcessor<DataManipulator> processBoundedDataId(*this);
- //si static BDIP::apply(dataToTransmit,expectedDataId,wDataIt1);
- //ancienne version template processBoundedDataId<DataManipulator>(dataToTransmit,expectedDataId,wDataIt1);
- //BDIP processBoundedDataId;
- processBoundedDataId.apply(dataToTransmit,expectedDataId,wDataIt1);
+ // Pour être cohérent avec la politique du bloc précédent
+ // on stocke la paire (dataId,données interpolées ).
+ // CALCIUM ne stockait pas les données interpolées.
+ // Cependant comme les données sont censées être produites
+ // par ordre croissant de DataId, de nouvelles données ne devrait pas améliorer
+ // l'interpolation.
+#ifdef MYDEBUG
+ std::cout << "-------- Get : MARK 8 ------------------" << std::endl;
+#endif
+
+ typedef typename COUPLING_POLICY::template BoundedDataIdProcessor<DataManipulator> BDI;
+ BDI processBoundedDataId(*this);
+ // typename COUPLING_POLICY::template BoundedDataIdProcessor<DataManipulator> processBoundedDataId(*this);
+ //si static BDIP::apply(dataToTransmit,expectedDataId,wDataIt1);
+ //ancienne version template processBoundedDataId<DataManipulator>(dataToTransmit,expectedDataId,wDataIt1);
+ //BDIP processBoundedDataId;
+ processBoundedDataId.apply(dataToTransmit,expectedDataId,wDataIt1);
- // Il ne peut pas y avoir déjà une clé expectedDataId dans storedDatas (utilisation de la notation [] )
- // La nouvelle donnée produite est stockée, ce n'était pas le cas dans CALCIUM
- // Cette opération n'a peut être pas un caractère générique.
- // A déplacer en paramètre de la méthode précédente ? ou déléguer ce choix au mode de couplage ?
- storedDatas[expectedDataId]=dataToTransmit;
-
-#ifdef _DEBUG_
- std::cout << "-------- Get : Données calculées à t : " << std::endl;
- typename DataManipulator::InnerType const * const InIt1 = DataManipulator::getPointer(dataToTransmit);
- size_t N = DataManipulator::size(dataToTransmit);
+ // Il ne peut pas y avoir déjà une clé expectedDataId dans storedDatas (utilisation de la notation [] )
+ // La nouvelle donnée produite est stockée, ce n'était pas le cas dans CALCIUM
+ // Cette opération n'a peut être pas un caractère générique.
+ // A déplacer en paramètre de la méthode précédente ? ou déléguer ce choix au mode de couplage ?
+ storedDatas[expectedDataId]=dataToTransmit;
+
+#ifdef MYDEBUG
+ std::cout << "-------- Get : Données calculées à t : " << std::endl;
+ typename DataManipulator::InnerType const * const InIt1 = DataManipulator::getPointer(dataToTransmit);
+ size_t N = DataManipulator::size(dataToTransmit);
- std::copy(InIt1, InIt1 + N,
- std::ostream_iterator< InnerType > (std::cout," "));
- std::cout << std::endl;
- std::cout << "-------- Get : MARK 9 ------------------" << std::endl;
+ std::copy(InIt1, InIt1 + N,
+ std::ostream_iterator< InnerType > (std::cout," "));
+ std::cout << std::endl;
+ std::cout << "-------- Get : MARK 9 ------------------" << std::endl;
#endif
- typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
- processEraseDataId.apply(storedDatas,wDataIt1);
+ typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
+ processEraseDataId.apply(storedDatas,wDataIt1);
- break;
+ break;
}
// Délègue au mode de couplage la gestion d'une demande de donnée non disponible
// Réception bloquante sur le dataId demandé
// Si l'instance de donnée n'est pas trouvee
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 10 ------------------" << std::endl;
#endif
//Positionné à faux dans la méthode put
waitingForConvenientDataId = true;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 11 ------------------" << std::endl;
// Ici on attend que la méthode put recoive la donnée
std::cout << "-------- Get : waiting datas ------------------" << std::endl;
#endif
fflush(stdout);fflush(stderr);
- cond_instance.wait();
-
-#ifdef _DEBUG_
+ unsigned long ts, tns,rs=Superv_Component_i::dscTimeOut;
+ if(rs==0)
+ cond_instance.wait();
+ else
+ {
+ //Timed wait on omni condition
+ omni_thread::get_time(&ts,&tns, rs,0);
+ int success=cond_instance.timedwait(ts,tns);
+ if(!success)
+ {
+ // Waiting too long probably blocking
+ std::stringstream msg;
+ msg<<"Timeout ("<<rs<<" s) exceeded";
+ Engines_DSC_interface::writeEvent("BLOCKING","","","","Probably blocking",msg.str().c_str());
+ throw DSC_Exception(msg.str());
+ }
+ }
+
+
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 12 ------------------" << std::endl;
#endif
}
// Deverouille l'acces a la table
storedDatas_mutex.unlock();
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 13 ------------------" << std::endl;
#endif
template < typename DataManipulator, typename COUPLING_POLICY >
template < typename TimeType,typename TagType>
typename DataManipulator::Type
-GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType ti,
- TimeType tf,
- TagType tag ) {
- TimeType t = COUPLING_POLICY::getEffectiveTime(ti,tf);
- return get(t,tag);
+GenericPort<DataManipulator, COUPLING_POLICY>::get(TimeType& ti,
+ TimeType tf,
+ TagType tag ) {
+ ti = COUPLING_POLICY::getEffectiveTime(ti,tf);
+ return get(ti,tag);
}
template < typename TimeType,typename TagType>
typename DataManipulator::Type
GenericPort<DataManipulator, COUPLING_POLICY>::next(TimeType &t,
- TagType &tag ) {
+ TagType &tag ) {
typedef typename COUPLING_POLICY::DataId DataId;
try {
storedDatas_mutex.lock();// Gérer les Exceptions ds le corps de la méthode
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 1 ---lastDataIdSet ("<<lastDataIdSet<<")---------------" << std::endl;
#endif
// Délègue au mode de couplage la gestion d'une demande de donnée non disponible
// si le port est deconnecté
if ( processDisconnect.apply(storedDatas, lastDataId, wDataIt1) ) {
- waitingForAnyDataId = false; break;
+ waitingForAnyDataId = false; break;
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 2 ------------------" << std::endl;
#endif
//Positionné à faux dans la méthode put
waitingForAnyDataId = true;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 3 ------------------" << std::endl;
// Ici on attend que la méthode put recoive la donnée
std::cout << "-------- Next : waiting datas ------------------" << std::endl;
#endif
fflush(stdout);fflush(stderr);
- cond_instance.wait();
+ unsigned long ts, tns,rs=Superv_Component_i::dscTimeOut;
+ if(rs==0)
+ cond_instance.wait();
+ else
+ {
+ //Timed wait on omni condition
+ omni_thread::get_time(&ts,&tns, rs,0);
+ int success=cond_instance.timedwait(ts,tns);
+ if(!success)
+ {
+ // Waiting too long probably blocking
+ std::stringstream msg;
+ msg<<"Timeout ("<<rs<<" s) exceeded";
+ Engines_DSC_interface::writeEvent("BLOCKING","","","","Probably blocking",msg.str().c_str());
+ throw DSC_Exception(msg.str());
+ }
+ }
if (lastDataIdSet) {
-#ifdef _DEBUG_
- std::cout << "-------- Next : MARK 4 ------------------" << std::endl;
+#ifdef MYDEBUG
+ std::cout << "-------- Next : MARK 4 ------------------" << std::endl;
#endif
- wDataIt1 = storedDatas.upper_bound(lastDataId);
+ wDataIt1 = storedDatas.upper_bound(lastDataId);
} else {
-#ifdef _DEBUG_
- std::cout << "-------- Next : MARK 5 ------------------" << std::endl;
+#ifdef MYDEBUG
+ std::cout << "-------- Next : MARK 5 ------------------" << std::endl;
#endif
- lastDataIdSet = true;
- wDataIt1 = storedDatas.begin();
+ lastDataIdSet = true;
+ wDataIt1 = storedDatas.begin();
}
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 6 ------------------" << std::endl;
#endif
tag = getTag ( (*wDataIt1).first );
dataToTransmit = (*wDataIt1).second;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 7 ------------------" << std::endl;
#endif
lastDataId = (*wDataIt1).first;
typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
processEraseDataId.apply(storedDatas, wDataIt1);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 8 ------------------" << std::endl;
#endif
} catch (...) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 8bis ------------------" << std::endl;
#endif
waitingForAnyDataId = false;
}
storedDatas_mutex.unlock();
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 9 ------------------" << std::endl;
#endif
CorbaPortTypeVar port = CorbaPortType::_narrow((*_my_ports)[i]);
//if (i) { PB1
//OLD : copyOfData = DataManipulator::clone(data);
-#ifdef _DEBUG_
- std::cout << "-------- GenericUsesPort::put -------- " << std::endl;
+#ifdef MYDEBUG
+ std::cerr << "-------- GenericUsesPort::put -------- " << std::endl;
#endif
//} PB1
try {
// OLD : port->put(*copyOfData,time,tag);
} catch(const CORBA::SystemException& ex) {
//OLD : DataManipulator::delete_data(copyOfData);
- throw DSC_Exception(LOC(OSS() << "Impossible d'invoquer la méthode put sur le port n°"
+ throw DSC_Exception(LOC(OSS() << "Can't invoke put method on port number "
<< i << "( i>= 0)"));
}
{
if (_my_ports) delete _my_ports;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "GenericUsesPort::uses_port_changed" << std::endl;
#endif
_my_ports = new_uses_port;
-I$(top_srcdir)/src/SALOMELocalTrace \
-I$(top_srcdir)/src/Basics \
-I$(top_srcdir)/src/Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(top_srcdir)/src/SALOMELocalTrace \
-I$(top_srcdir)/src/Basics \
-I$(top_srcdir)/src/Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@
DSC_EXCEPTION_CXX(Superv_Component_i,BadProperty);
std::map<std::string, port_factory*> Superv_Component_i::_factory_map;
+long Superv_Component_i::dscTimeOut=0;
+
Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
bool notif) :
Engines_DSC_i(orb, poa, contId, instanceName, interfaceName)
{
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl;
#endif
+ setTimeOut();
}
Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
bool regist) :
Engines_DSC_i(orb, poa, container, instanceName, interfaceName,notif,regist)
{
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl;
#endif
+ setTimeOut();
}
}
if (rtn_port == NULL)
- throw BadFabType( LOC(OSS()<< "Impossible d'accéder à la fabrique "
+ throw BadFabType( LOC(OSS()<< "No way to get the port factory "
<<port_fab_type));
return rtn_port;
}
if (rtn_proxy == NULL)
- throw BadFabType( LOC(OSS()<< "Impossible d'accéder à la fabrique "
+ throw BadFabType( LOC(OSS()<< "No way to get the port factory "
<<port_fab_type));
return rtn_proxy;
add_port(port, port_name);
}
else if (s_port_type == "uses") {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "---- Superv_Component_i::add_port : MARK 1 ---- " << std::endl;
#endif
uses_port * port = create_uses_data_port(port_fab_type);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "---- Superv_Component_i::add_port : MARK 2 ---- " << std::endl;
#endif
add_port(port, port_name);
}
else
- throw BadType( LOC(OSS()<< "Le port_type doit être soit 'provides' soit 'uses' not "
+ throw BadType( LOC(OSS()<< "port_type must be either 'provides' either 'uses' not "
<< port_type));
}
}
catch (const Engines::DSC::PortAlreadyDefined&) {
- throw PortAlreadyDefined( LOC(OSS()<< "Le port provides "
- << provides_port_name <<" existe déjà."));
+ throw PortAlreadyDefined( LOC(OSS()<< "provides port "
+ << provides_port_name <<" already exist."));
}
catch (const Engines::DSC::NilPort&) {
- throw NilPort( LOC(OSS()<< "Le pointeur sur port provides est nul."));
+ throw NilPort( LOC(OSS()<< "provides port pointer is nul."));
}
catch (const Engines::DSC::BadProperty&) {
- throw BadProperty( LOC(OSS()<< "La propriété est mal définie"));
+ throw BadProperty( LOC(OSS()<< "Property is not well defined"));
}
}
my_superv_ports[uses_port_name] = new_superv_port;
}
catch (const Engines::DSC::PortAlreadyDefined&) {
- throw PortAlreadyDefined( LOC(OSS()<< "Le port uses "
- << uses_port_name <<" existe déjà."));
+ throw PortAlreadyDefined( LOC(OSS()<< "uses port "
+ << uses_port_name <<" already exists."));
}
catch (const Engines::DSC::NilPort&) {
- throw NilPort( LOC(OSS()<< "Le pointeur sur port uses est nul."));
+ throw NilPort( LOC(OSS()<< "uses port pointer is nul."));
}
catch (const Engines::DSC::BadProperty&) {
- throw BadProperty( LOC(OSS()<< "La propriété est mal définie"));
+ throw BadProperty( LOC(OSS()<< "Property is not well defined"));
}
}
Ports::Port_var portref=Engines_DSC_interface::get_provides_port(provides_port_name, false);
port = my_superv_ports[provides_port_name]->p_ref;
} catch (const Engines::DSC::PortNotDefined&) {
- throw PortNotDefined( LOC(OSS()<< "Le port provides "
- << provides_port_name <<" n'existe pas."));
+ throw PortNotDefined( LOC(OSS()<< "provides port "
+ << provides_port_name <<" does not exist."));
} catch (const Engines::DSC::PortNotConnected&) {
- throw PortNotConnected( LOC(OSS()<< "Le port provides " << provides_port_name
- << " n'est pas connecté."));
+ throw PortNotConnected( LOC(OSS()<< "provides port " << provides_port_name
+ << " is not connected."));
}
}
delete portseq;
port = my_superv_ports[uses_port_name]->u_ref;
} catch (const Engines::DSC::PortNotDefined&) {
- throw PortNotDefined( LOC(OSS()<< "Le port uses "
- << uses_port_name <<" n'existe pas."));
+ throw PortNotDefined( LOC(OSS()<< "uses port "
+ << uses_port_name <<" does not exist."));
} catch (const Engines::DSC::PortNotConnected&) {
- throw PortNotConnected( LOC(OSS()<< "Le port uses " << uses_port_name
- << " n'est pas connecté."));
+ throw PortNotConnected( LOC(OSS()<< "uses port " << uses_port_name
+ << " is not connected."));
}
}
for (it=my_superv_ports.begin(); it!=my_superv_ports.end();++it)
if( (*it).second->p_ref == NULL ) port_names.push_back((*it).first);
}
+
+void Superv_Component_i::setTimeOut()
+{
+ char* valenv=getenv("DSC_TIMEOUT");
+ if(valenv)
+ {
+ std::istringstream iss(valenv);
+ long temp;
+ if (iss >> temp)
+ if(temp >=0)
+ Superv_Component_i::dscTimeOut=temp;
+ }
+}
+
+void Superv_Component_i::beginService(const char *serviceName)
+{
+ Engines_DSC_i::beginService(serviceName);
+ setTimeOut();
+}
#include "DSC_Exception.hxx"
#include <vector>
+//#define MYDEBUG
/*! \class Superv_Component_i
* \brief This class implements DSC_User component.
* a programming level for service's developpers who want to use DSC ports.
*
* This class has two level for using and declare ports. The higher level proposes
- * operations to add ports that are provided by default by Salomé like Calcium ports.
+ * operations to add ports that are provided by default by SALOME like Calcium ports.
* It provides too some methods to add their own DSC_User ports.
*
* \note This class doesn't implement the init_service CORBA operation.
*/
virtual port_factory * get_factory(const std::string & factory_name);
+ /*!
+ */
+ static long dscTimeOut;
+ static void setTimeOut();
+ void beginService(const char *serviceName);
+
private:
// Factory map
typedef std::map<std::string, port_factory*> factory_map_t;
~superv_port_t()
{
if(u_ref)delete u_ref;
- if(p_ref)delete p_ref;
+ if(p_ref)
+ {
+ // do not delete CORBA servant : deactivate it and then call _remove_ref or delete
+ PortableServer::ServantBase* servant=dynamic_cast<PortableServer::ServantBase*>(p_ref);
+ if(servant)
+ {
+ PortableServer::POA_var poa =servant->_default_POA();
+ PortableServer::ObjectId_var oid = poa->servant_to_id(servant);
+ poa->deactivate_object(oid);
+ servant->_remove_ref();
+ }
+ }
};
// For uses ports.
uses_port * u_ref;
assert(port_name);
SpecificPortType * retPort;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "---- Superv_Component_i::add_port : Mark 0 ---- " << port_name << "----" << std::endl;
#endif
add_port(port, port_name);
retPort = dynamic_cast<SpecificPortType *>(port);
if ( retPort == NULL ) { delete port;
- throw BadCast( LOC("La conversion vers le type de port demandé n'est pas possible " ));
+ throw BadCast( LOC("Can't cast to asked port type " ));
}
}
else if (s_port_type == "uses") {
uses_port * port = create_uses_data_port(port_fab_type);
add_port(port, port_name);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "---- Superv_Component_i::add_port : Mark 1 ---- " << port << "----" << std::endl;
std::cout << "---- Superv_Component_i::add_port : Mark 1 ---- get_repository_id()" << port->get_repository_id() << std::endl;
#endif
retPort = dynamic_cast<SpecificPortType *>(port);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "---- Superv_Component_i::add_port : Mark 2 ---- " << retPort << "----" << std::endl;
#endif
if ( retPort == NULL ) { delete port;
- throw BadCast( LOC("La conversion vers le type de port demandé n'est pas possible " ));
+ throw BadCast( LOC("Can't cast to asked port type " ));
}
}
else
- throw BadType(LOC(OSS()<< "Le port_type doit être soit 'provides' soit 'uses' not "
+ throw BadType(LOC(OSS()<< "port_type must be either 'provides' either 'uses' not "
<< port_type));
return retPort;
}
} catch (const Engines::DSC::PortNotDefined&) {
- throw PortNotDefined( LOC(OSS()<< "Le port "
- << port_name <<" n'existe pas."));
+ throw PortNotDefined( LOC(OSS()<< "port "
+ << port_name <<" does not exist."));
} catch (const Engines::DSC::PortNotConnected&) {
- throw PortNotConnected( LOC(OSS()<< "Le port " << port_name
- << " n'est pas connecté."));
+ throw PortNotConnected( LOC(OSS()<< "port " << port_name
+ << " is not connected."));
}
retPort = dynamic_cast<SpecificPortType *>(port);
if ( retPort == NULL ) {
- delete port;
- throw BadCast( LOC("La conversion vers le type de port demandé n'est pas possible " ));
+ throw BadCast( LOC("Can't cast to required port type " ));
}
return retPort;
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "base_port.hxx"
+#include <omniORB4/CORBA.h>
base_port::base_port()
base_port::~base_port()
{
- delete default_properties;
+ //do not call delete on corba servant: deactivate it and then call _remove_ref or delete
+ PortableServer::POA_var poa =default_properties->_default_POA();
+ PortableServer::ObjectId_var oid = poa->servant_to_id(default_properties);
+ poa->deactivate_object(oid);
+ default_properties->_remove_ref();
}
Ports::PortProperties_ptr
-I$(top_srcdir)/src/NamingService \
-I$(top_srcdir)/src/Utils \
-I$(top_srcdir)/src/DSC/DSC_Basic \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
-I$(top_srcdir)/src/Registry \
-I$(top_srcdir)/src/Utils \
libSalomeGenericObj_la_CPPFLAGS = \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
libSalomeGenericObj_la_LIBADD = \
----------------------------------------------------------------------------*/
#include "hdfi.h"
+#include <string.h>
/*
* - Name: HDFobjectIdentify
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
Help.py \
PyInterp.py \
salome.py \
- salome_shared_modules.py \
batchmode_salome.py \
- import_hook.py \
salome_test.py \
salome_kernel.py \
salome_study.py \
salome_iapp.py \
salome_ComponentGUI.py \
- omnipatch.py \
iparameters.py \
salome_version.py \
- salome_notebook.py
+ salome_notebook.py \
+ salome_pynode.py \
+ salome_genericobj.py
endif
sharedpkgpython_PYTHON = kernel_shared_modules.py
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
l.append((subname,submod))
return l
-def import_hook(name, globals=None, locals=None, fromlist=None):
+def import_hook(name, globals=None, locals=None, fromlist=None, *args):
""" Import replacement for sharing modules among multiple interpreters
Mostly update sys.modules before doing real import
"""
#print "import_hook",name,fromlist
m=get_shared_imported(name,fromlist)
- module= original_import(name, globals, locals, fromlist)
+ module= original_import(name, globals, locals, fromlist, *args)
if fromlist:
#when fromlist is specified, module is the real module
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+"""
+ When imported this module adds to CORBA objref from GenericObj type
+ automatic management of reference count
+ The reference count is incremented when the local proxy is created (assignment of __omni_obj attribute)
+ and is decremented when the local proxy is deleted (call of __del__)
+
+ The GenericObj class for proxy is modified by adding two methods : __del__ and __setattr__
+ The module must be imported before any other import of SALOME CORBA module
+"""
+import omniORB
+import SALOME
+
+def mydel(self):
+ self.Destroy()
+ omniORB.CORBA.Object.__del__(self)
+
+def mysetattr(self,attr,value):
+ self.__dict__[attr]=value
+ if attr == "__omni_obj":
+ self.Register()
+
+SALOME._objref_GenericObj.__del__=mydel
+SALOME._objref_GenericObj.__setattr__=mysetattr
+
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2008 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#
import salome
+class PseudoStudyForNoteBook(object):
+
+ def __init__(self, **kwargs):
+ self.kwargs = kwargs
+ pass
+
+ def GetVariableNames(self):
+ return self.kwargs.keys()
+
+ def IsVariable(self, variableName):
+ return variableName in self.kwargs
+
+ def IsReal(self, variableName):
+ val = self.kwargs[variableName]
+ try:
+ float(val)
+ return True
+ except:
+ pass
+ return False
+
+ IsInteger = IsReal
+ IsBoolean = IsReal
+
+ def IsString(self, variableName):
+ return not self.IsReal(variableName)
+
+ def GetString(self, variableName):
+ return self.kwargs[variableName]
+
+ def GetReal(self, variableName):
+ return float(self.kwargs[variableName])
+
+ GetInteger = GetReal
+ GetBoolean = GetReal
+
+ pass
+
class NoteBook:
def __init__(self, Study):
elif type(variable) == bool:
self.myStudy.SetBoolean(variableName, variable)
+ elif type(variable) == str:
+ self.myStudy.SetString(variableName, variable)
+
def get(self, variableName):
"""
Return value of the variable with name "variableName".
elif self.myStudy.IsBoolean(variableName):
aResult = self.myStudy.GetBoolean(variableName)
+
+ elif self.myStudy.IsString(variableName):
+ aResult = self.myStudy.GetString(variableName)
+ aResult_orig = aResult
+ l = self.myStudy.GetVariableNames()
+ l.remove(variableName)
+ # --
+ # To avoid the smallest strings to be replaced first,
+ # the list is sorted by decreasing lengths
+ # --
+ l.sort(key=str.__len__)
+ l.reverse()
+ for name in l:
+ if aResult.find(name) >= 0:
+ val = self.get(name)
+ aResult = aResult.replace(name, "%s"%(val))
+ pass
+ pass
+ try:
+ aResult = eval(aResult)
+ except Exception, e:
+ msg = str(e)
+ msg += "\n"
+ msg += "A problem occurs while parsing "
+ msg += "the variable %s "%(variableName.__repr__())
+ msg += "with value %s ..."%(aResult_orig.__repr__())
+ msg += "\n"
+ msg += "Please, check your notebook !"
+ raise Exception(msg)
+ pass
return aResult
exists in the study, otherwise return false.
"""
return self.myStudy.IsVariable(variableName)
-
-notebook = NoteBook(salome.myStudy)
\ No newline at end of file
+
+ def setAs(self, variableName, typ):
+ value = self.get(variableName)
+ value = float(typ(value))
+ self.myStudy.SetStringAsDouble(variableName, value)
+ return
+
+ def setAsReal(self, variableName):
+ self.setAs(variableName, float)
+ return
+
+ def setAsInteger(self, variableName):
+ self.setAs(variableName, int)
+ return
+
+ def setAsBool(self, variableName):
+ self.setAs(variableName, bool)
+ return
+
+ def check(self):
+ for variableName in self.myStudy.GetVariableNames():
+ self.get(variableName)
+ pass
+ return
+
+ pass
+
+def checkThisNoteBook(**kwargs):
+ study = PseudoStudyForNoteBook(**kwargs)
+ note_book = NoteBook(study)
+ note_book.check()
+ return
+
+notebook = NoteBook(salome.myStudy)
--- /dev/null
+# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# File : salome_pynode.py
+# Author : Christian CAREMOLI, EDF
+# Module : SALOME
+# $Header$
+#
+
+"""
+ When imported this module adds to CORBA proxy (from PyNode type) automatic pickle and unpickle
+ of arguments and results when calling execute method. It also converts the SALOME exception into a standard python
+ exception
+"""
+import omniORB
+import cPickle
+import SALOME
+import Engines
+
+class SmartPyNode(Engines._objref_PyNode):
+ def __init__(self):
+ Engines._objref_PyNode.__init__(self)
+
+ def execute(self,functionName,*args,**kws):
+ try:
+ args=cPickle.dumps((args,kws),-1)
+ results=Engines._objref_PyNode.execute(self,functionName,args)
+ x=cPickle.loads(results)
+ return x
+ except SALOME.SALOME_Exception, e:
+ raise ValueError(e.details.text)
+
+ def __getattr__(self,name):
+ """ a trick to be able to call directly a remote method by its name : no need to use execute"""
+ if name[0]== '_':
+ raise AttributeError, name
+ def afunc(*args,**kws):
+ return self.execute(name,*args,**kws)
+ return afunc
+
+#Register the new proxy for PyNode
+omniORB.registerObjref(Engines._objref_PyNode._NP_RepositoryId, SmartPyNode)
+
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
import visu_gui
medFileName = "pointe.med"
-medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFileName
+if sys.platform != "win32":
+ medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFileName
+else:
+ medFile = os.getenv('DATA_DIR') + '\\MedFiles\\' + medFileName
+ pass
print "Load ", medFile
studyCurrent = salome.myStudyName
if sys.platform != "win32":
tmpDir = "/tmp/"
else:
- tmpDir = os.getenv('TEMP') + '/'
+ tmpDir = os.getenv('TEMP') + '\\'
medFileNew = tmpDir + str(random.randint(0,1000000)) + "_" + medFileName
print " -- Copy " + medFile + " to " + medFileNew
os.system(copyCommand + " " + medFile + " " + medFileNew)
medFile = medFileNew
- os.system("chmod 755 " + medFile)
+ if sys.platform != "win32":
+ os.system("chmod 755 " + medFile)
+ pass
if os.access(medFile, os.W_OK) :
med_comp.readStructFileWithFieldType(medFile,studyCurrent)
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "BatchTest.hxx"
+#include "Launcher.hxx"
+
+#ifdef WITH_LIBBATCH
+#include <Batch/Batch_Date.hxx>
+#include <Batch/Batch_MpiImpl.hxx>
+#endif
-#include "Batch_Date.hxx"
-#include "MpiImpl.hxx"
#include "utilities.h"
#include <sys/stat.h>
#endif
BatchTest::BatchTest(const Engines::MachineDefinition& batch_descr)
{
+#ifdef WITH_LIBBATCH
_batch_descr = batch_descr;
// Getting date
_test_filename += _date + "_test_cluster_file_";
_test_filename += _batch_descr.alias.in();
_base_filename = _date + "_test_cluster_file_" + _batch_descr.alias.in();
+#endif
}
BatchTest::~BatchTest() {}
std::string
BatchTest::test_jobsubmit_mpi()
{
+#ifdef WITH_LIBBATCH
int status;
std::string home;
std::string command;
}
result = "OK";
return result;
+#else
+ throw LauncherException("Method BatchTest::test_jobsubmit_mpi is not available "
+ "(libBatch was not present at compilation time)");
+#endif
}
std::string
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include "Launcher.hxx"
-#include "Batch_Date.hxx"
-#include "Batch_FactBatchManager_eLSF.hxx"
-#include "Batch_FactBatchManager_ePBS.hxx"
-#include "Batch_BatchManager_eClient.hxx"
-#include "Batch_FactBatchManager_eSGE.hxx"
+#ifdef WITH_LIBBATCH
+#include <Batch/Batch_Date.hxx>
+#include <Batch/Batch_FactBatchManager_eLSF.hxx>
+#include <Batch/Batch_FactBatchManager_ePBS.hxx>
+#include <Batch/Batch_BatchManager_eClient.hxx>
+#include <Batch/Batch_FactBatchManager_eSGE.hxx>
+#endif
+
#include "SALOME_Launcher_Handler.hxx"
#include "Launcher.hxx"
#include <iostream>
#if defined(_DEBUG_) || defined(_DEBUG)
cerr << "Launcher_cpp destructor" << endl;
#endif
+
+#ifdef WITH_LIBBATCH
std::map < string, Batch::BatchManager_eClient * >::const_iterator it1;
for(it1=_batchmap.begin();it1!=_batchmap.end();it1++)
delete it1->second;
std::map < std::pair<std::string,long> , Batch::Job* >::const_iterator it2;
for(it2=_jobmap.begin();it2!=_jobmap.end();it2++)
delete it2->second;
+#endif
}
//=============================================================================
long Launcher_cpp::submitJob( const std::string xmlExecuteFile,
const std::string clusterName) throw(LauncherException)
{
+#ifdef WITH_LIBBATCH
#if defined(_DEBUG_) || defined(_DEBUG)
cout << "BEGIN OF Launcher_cpp::submitJob" << endl;
#endif
_jobmap[ pair<string,long>(cname,jobId) ] = job;
}
catch(const Batch::EmulationException &ex){
- throw LauncherException(ex.msg.c_str());
+ throw LauncherException(ex.message.c_str());
}
return jobId;
+#else
+ throw LauncherException("Method Launcher_cpp::submitJob is not available "
+ "(libBatch was not present at compilation time)");
+#endif
}
//=============================================================================
const batchParams& batch_params,
const machineParams& params) throw(LauncherException)
{
+#ifdef WITH_LIBBATCH
#if defined(_DEBUG_) || defined(_DEBUG)
cerr << "BEGIN OF Launcher_cpp::submitSalomeJob" << endl;
#endif
for(int i=0;i<filesToExport.size();i++)
param[INFILE] += Batch::Couple( filesToExport[i], getRemoteFile(tmpdir,filesToExport[i]) );
- ostringstream file_name_output;
- file_name_output << "~/" << tmpdir << "/" << "output.log*";
- ostringstream file_name_error;
- file_name_error << "~/" << tmpdir << "/" << "error.log*";
- ostringstream file_container_log;
- file_container_log << "~/" << tmpdir << "/" << "YACS_Server*";
- param[OUTFILE] = Batch::Couple( "", file_name_output.str());
- param[OUTFILE] += Batch::Couple( "", file_name_error.str());
- param[OUTFILE] += Batch::Couple( "", file_container_log.str());
-
+ param[OUTFILE] = Batch::Couple( "", "~/" + tmpdir + "/" + "output.log*" );
+ param[OUTFILE] += Batch::Couple( "", "~/" + tmpdir + "/" + "error.log*" );
+ param[OUTFILE] += Batch::Couple( "", "~/" + tmpdir + "/" + "YACS_Server*" );
for(int i=0;i<filesToImport.size();i++)
- param[OUTFILE] += Batch::Couple( "", filesToImport[i] );
+ param[OUTFILE] += Batch::Couple( "", "~/" + tmpdir + "/" + filesToImport[i] );
param[NBPROC] = batch_params.nb_proc;
param[WORKDIR] = batch_params.batch_directory;
_jobmap[ pair<string,long>(clustername,jobId) ] = job;
}
catch(const Batch::EmulationException &ex){
- throw LauncherException(ex.msg.c_str());
+ throw LauncherException(ex.message.c_str());
}
return jobId;
+#else
+ throw LauncherException("Method Launcher_cpp::submitSalomeJob is not available "
+ "(libBatch was not present at compilation time)");
+#endif
}
//=============================================================================
string Launcher_cpp::queryJob( long id,
const machineParams& params) throw(LauncherException)
{
+#ifdef WITH_LIBBATCH
if(!_ResManager)
throw LauncherException("You must set Resources Manager to Launcher!!");
par = jinfo.getParametre();
}
catch(const Batch::EmulationException &ex){
- throw LauncherException(ex.msg.c_str());
+ throw LauncherException(ex.message.c_str());
}
return par[STATE];
+#else
+ throw LauncherException("Method Launcher_cpp::queryJob is not available "
+ "(libBatch was not present at compilation time)");
+#endif
}
string Launcher_cpp::queryJob( long id,
- const std::string clusterName)
+ const std::string clusterName) throw (LauncherException)
{
machineParams params;
params.hostname = clusterName;
void Launcher_cpp::deleteJob( const long id,
const machineParams& params) throw(LauncherException)
{
+#ifdef WITH_LIBBATCH
if(!_ResManager)
throw LauncherException("You must set Resources Manager to Launcher!!");
Batch::JobId jobId( _batchmap[clustername], oss.str() );
jobId.deleteJob();
+#else
+ throw LauncherException("Method Launcher_cpp::deleteJob is not available "
+ "(libBatch was not present at compilation time)");
+#endif
}
void Launcher_cpp::deleteJob( long id,
- const std::string clusterName)
+ const std::string clusterName) throw (LauncherException)
{
machineParams params;
params.hostname = clusterName;
const long id,
const machineParams& params) throw(LauncherException)
{
+#ifdef WITH_LIBBATCH
if(!_ResManager)
throw LauncherException("You must set Resources Manager to Launcher!!");
Batch::Job* job = _jobmap[ pair<string,long>(clustername,id) ];
_batchmap[clustername]->importOutputFiles( *job, directory );
+#else
+ throw LauncherException("Method Launcher_cpp::getResultsJob is not available "
+ "(libBatch was not present at compilation time)");
+#endif
}
void Launcher_cpp::getResultsJob( const std::string directory,
long id,
- const std::string clusterName)
+ const std::string clusterName) throw (LauncherException)
{
machineParams params;
params.hostname = clusterName;
Batch::BatchManager_eClient *Launcher_cpp::FactoryBatchManager( const ParserResourcesType& params ) throw(LauncherException)
{
-
- std::string hostname, protocol, mpi;
+#ifdef WITH_LIBBATCH
+ std::string hostname, mpi;
+ Batch::CommunicationProtocolType protocol;
Batch::FactBatchManager_eClient* fact;
hostname = params.Alias;
switch(params.Protocol){
case rsh:
- protocol = "rsh";
+ protocol = Batch::RSH;
break;
case ssh:
- protocol = "ssh";
+ protocol = Batch::SSH;
break;
default:
throw LauncherException("unknown protocol");
#endif
throw LauncherException("no batchmanager for that cluster");
}
- return (*fact)(hostname.c_str(),protocol.c_str(),mpi.c_str());
+ return (*fact)(hostname.c_str(), protocol, mpi.c_str());
+#else
+ throw LauncherException("Method Launcher_cpp::FactoryBatchManager is not available "
+ "(libBatch was not present at compilation time)");
+#endif
}
string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const string dirForTmpFiles, const ParserResourcesType& params)
{
+#ifdef WITH_LIBBATCH
#ifndef WIN32 //TODO: need for porting on Windows
int idx = dirForTmpFiles.find("Batch/");
std::string filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length());
+ std::string dfilelogtemp = params.AppliPath + "/" + filelogtemp;
string::size_type p1 = fileToExecute.find_last_of("/");
string::size_type p2 = fileToExecute.find_last_of(".");
// Begin
tempOutputFile << "#! /bin/sh -f" << endl ;
- tempOutputFile << "cd " ;
- tempOutputFile << params.AppliPath << endl ;
+ tempOutputFile << "cd ~/" ;
+ tempOutputFile << dirForTmpFiles << endl ;
tempOutputFile << "export SALOME_BATCH=1\n";
tempOutputFile << "export PYTHONPATH=~/" ;
tempOutputFile << dirForTmpFiles ;
// Code for rank 0 : launch runAppli and a container
// RunAppli
if(params.ModulesList.size()>0)
- tempOutputFile << " ./runAppli --terminal --modules=" ;
+ tempOutputFile << " " << params.AppliPath << "/runAppli --terminal --modules=" ;
else
- tempOutputFile << " ./runAppli --terminal ";
+ tempOutputFile << " " << params.AppliPath << "/runAppli --terminal ";
for ( int i = 0 ; i < params.ModulesList.size() ; i++ ) {
tempOutputFile << params.ModulesList[i] ;
if ( i != params.ModulesList.size()-1 )
// Wait NamingService
tempOutputFile << " current=0\n"
<< " stop=20\n"
- << " while ! test -f " << filelogtemp << "\n"
+ << " while ! test -f " << dfilelogtemp << "\n"
<< " do\n"
<< " sleep 2\n"
<< " let current=current+1\n"
<< " exit\n"
<< " fi\n"
<< " done\n"
- << " port=`cat " << filelogtemp << "`\n";
+ << " port=`cat " << dfilelogtemp << "`\n";
// Wait other containers
tempOutputFile << " for ((ip=1; ip < ";
tempOutputFile << " arglist=\"$arglist YACS_Server_\"$ip" << endl ;
tempOutputFile << " done" << endl ;
tempOutputFile << " sleep 5" << endl ;
- tempOutputFile << " ./runSession waitContainers.py $arglist" << endl ;
+ tempOutputFile << " " << params.AppliPath << "/runSession waitContainers.py $arglist" << endl ;
// Launch user script
- tempOutputFile << " ./runSession python ~/" << dirForTmpFiles << "/" << fileNameToExecute << ".py" << endl;
+ tempOutputFile << " " << params.AppliPath << "/runSession python ~/" << dirForTmpFiles << "/" << fileNameToExecute << ".py" << endl;
// Stop application
- tempOutputFile << " rm " << filelogtemp << "\n"
- << " ./runSession shutdownSalome.py" << endl;
+ tempOutputFile << " rm " << dfilelogtemp << "\n"
+ << " " << params.AppliPath << "/runSession shutdownSalome.py" << endl;
// -------------------------------------
// Other nodes launch a container
// Wait NamingService
tempOutputFile << " current=0\n"
<< " stop=20\n"
- << " while ! test -f " << filelogtemp << "\n"
+ << " while ! test -f " << dfilelogtemp << "\n"
<< " do\n"
<< " sleep 2\n"
<< " let current=current+1\n"
<< " exit\n"
<< " fi\n"
<< " done\n"
- << " port=`cat " << filelogtemp << "`\n";
+ << " port=`cat " << dfilelogtemp << "`\n";
// Launching container
- tempOutputFile << " ./runSession SALOME_Container YACS_Server_";
+ tempOutputFile << " " << params.AppliPath << "/runSession SALOME_Container YACS_Server_";
tempOutputFile << mpiImpl->rank()
<< " > ~/" << dirForTmpFiles << "/YACS_Server_"
<< mpiImpl->rank() << "_container_log." << filelogtemp
return "";
#endif
+#else
+ throw LauncherException("Method Launcher_cpp::buildSalomeCouplingScript is not available "
+ "(libBatch was not present at compilation time)");
+#endif
}
MpiImpl *Launcher_cpp::FactoryMpiImpl(MpiImplType mpi) throw(LauncherException)
{
+#ifdef WITH_LIBBATCH
switch(mpi){
case lam:
return new MpiImpl_LAM();
oss << mpi << " : not yet implemented";
throw LauncherException(oss.str().c_str());
}
-
+#else
+ throw LauncherException("Method Launcher_cpp::FactoryMpiImpl is not available "
+ "(libBatch was not present at compilation time)");
+#endif
}
string Launcher_cpp::getTmpDirForBatchFiles()
{
+#ifdef WITH_LIBBATCH
string ret;
string thedate;
ret = string("Batch/");
ret += thedate;
return ret;
+#else
+ throw LauncherException("Method Launcher_cpp::getTmpDirForBatchFiles is not available "
+ "(libBatch was not present at compilation time)");
+#endif
}
string Launcher_cpp::getRemoteFile( std::string remoteDir, std::string localFile )
const machineParams& params) throw(LauncherException);
std::string queryJob( const long jobId, const machineParams& params) throw(LauncherException);
- std::string queryJob( const long jobId, const std::string clusterName);
+ std::string queryJob( const long jobId, const std::string clusterName) throw(LauncherException);
void deleteJob( const long jobId, const machineParams& params) throw(LauncherException);
- void deleteJob( const long jobId, const std::string clusterName);
+ void deleteJob( const long jobId, const std::string clusterName) throw(LauncherException);
void getResultsJob( const std::string directory, const long jobId, const machineParams& params ) throw(LauncherException);
- void getResultsJob( const std::string directory, const long jobId, const std::string clusterName );
+ void getResultsJob( const std::string directory, const long jobId, const std::string clusterName ) throw (LauncherException);
void SetResourcesManager( ResourcesManager_cpp* rm ) { _ResManager = rm; }
@PYTHON_INCLUDES@ \
@MPI_INCLUDES@ \
@LIBXML_INCLUDES@ \
- -I$(srcdir)/../Batch \
+ @LIBBATCH_INCLUDES@ \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Notification \
-I$(srcdir)/../ResourcesManager \
-I$(srcdir)/../Container \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+if WITH_LIBBATCH
+ COMMON_CPPFLAGS += -DWITH_LIBBATCH
+endif
+
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
../Registry/libRegistry.la \
../Utils/libOpUtil.la \
../SALOMELocalTrace/libSALOMELocalTrace.la \
../Basics/libSALOMEBasics.la \
- ../Batch/libSalomeBatch.la \
$(top_builddir)/idl/libSalomeIDLKernel.la \
+ @LIBBATCH_LIBS@ \
@MPI_LIBS@ \
@CORBA_LIBS@ \
@LIBXML_LIBS@ \
Launcher.cxx
libLauncher_la_CPPFLAGS =\
- -I$(srcdir)/../Batch \
-I$(srcdir)/../ResourcesManager \
+ @LIBBATCH_INCLUDES@ \
@MPI_INCLUDES@ \
@LIBXML_INCLUDES@
+if WITH_LIBBATCH
+ libLauncher_la_CPPFLAGS += -DWITH_LIBBATCH
+endif
+
libLauncher_la_LDFLAGS =\
-no-undefined -version-info=0:0:0 \
@LDEXPDYNFLAGS@
libLauncher_la_LIBADD =\
- ../Batch/libSalomeBatch.la \
- ../ResourcesManager/libSalomeResourcesManager.la \
+ ../ResourcesManager/libResourcesManager.la \
+ @LIBBATCH_LIBS@ \
@MPI_LIBS@ \
@LIBXML_LIBS@
SALOME_LauncherServer_LDADD =\
libSalomeLauncher.la \
../Basics/libSALOMEBasics.la \
+ $(LIBBATCH_LIBS) \
$(MPI_LIBS) \
$(CORBA_LIBS) \
$(LIBXML_LIBS) \
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-I$(srcdir)/../Utils \
-I$(srcdir)/../Container \
-I$(srcdir)/../ResourcesManager \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@
char **argv = &xargv;
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
// LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ _NSnew=0;
if (!ns)
{
_NS = new SALOME_NamingService(orb);
+ _NSnew=_NS;
}
else _NS = ns;
//add try catch
SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA()
{
+ if(_NSnew)delete _NSnew;
}
//=============================================================================
{
// containerName doesn't contain "/" => Local container
params->container_name=CORBA::string_dup(stContainer);
- params->hostname=CORBA::string_dup(Kernel_Utils::GetHostname().c_str());
+ params->hostname="";
}
else
{
string portNumber (::getenv ("NSPORT") );
if ( !portNumber.empty() )
{
+#ifdef WNT
+#else
string cmd ;
cmd = string( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*")
+ portNumber
}
catch ( ... ) {
}
+#endif
}
// NPAL 18309 (Kill Notifd)
containerDest->copyFile(containerSrc,fileSrc,fileDest);
}
+/*! \brief get the naming service used by the life cycle
+ *
+ * \return the naming service
+ */
+SALOME_NamingService * SALOME_LifeCycleCORBA::namingService()
+{
+ return _NS;
+}
+
+/*! \brief get the orb used by the life cycle
+ *
+ * \return the orb
+ */
+CORBA::ORB_ptr SALOME_LifeCycleCORBA::orb()
+{
+ return _NS->orb();
+}
+
Engines::ContainerManager_ptr getContainerManager();
Engines::ResourcesManager_ptr getResourcesManager();
+ SALOME_NamingService * namingService();
+ CORBA::ORB_ptr orb();
void copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest);
void shutdownServers();
int studyId);
SALOME_NamingService *_NS;
+ SALOME_NamingService *_NSnew;
Engines::ContainerManager_var _ContManager;
Engines::ResourcesManager_var _ResManager;
-I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \
-I$(srcdir)/$(RPATH)/ResourcesManager \
-I$(srcdir)/$(RPATH)/LifeCycleCORBA \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
for(int i=0;i<10;i++){
sprintf(st,"first_%d",i);
p.container_name = CORBA::string_dup(st);
- p.policy="best";
+ p.policy="first";
cont = _ContManager->GiveContainer(p);
if(CORBA::is_nil(cont)) error = true;
}
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
+
import unittest
import salome
import Engines
+# -*- coding: iso-8859-1 -*-
+
import unittest
import salome
import LifeCycleCORBA
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
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 \
SALOME_Logger_Server.cxx
libSalomeLoggerServer_la_CPPFLAGS =\
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
libSalomeLoggerServer_la_LDFLAGS = -no-undefined -version-info=0:0:0
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
else
{
Py_ACQUIRE_NEW_THREAD;
- PyObject *mainmod = PyImport_AddModule("__main__");
+ PyObject *mainmod = PyImport_AddModule((char *)"__main__");
PyObject *globals = PyModule_GetDict(mainmod);
PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
PyObject *result = PyObject_CallMethod(pyCont,
- "import_component",
- "s",componentName);
- int ret= PyInt_AsLong(result);
+ (char*)"import_component",
+ (char*)"s",componentName);
+ std::string ret= PyString_AsString(result);
SCRUTE(ret);
Py_RELEASE_NEW_THREAD;
- if (ret) // import possible: Python component
+ if (ret=="") // import possible: Python component
{
_library_map[aCompName] = (void *)pyCont; // any non O value OK
MESSAGE("[" << _numproc << "] import Python: "<<aCompName<<" OK");
_containerName + "/" + instanceName;
Py_ACQUIRE_NEW_THREAD;
- PyObject *mainmod = PyImport_AddModule("__main__");
+ PyObject *mainmod = PyImport_AddModule((char*)"__main__");
PyObject *globals = PyModule_GetDict(mainmod);
PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
PyObject *result = PyObject_CallMethod(pyCont,
- "create_component_instance",
- "ssl",
+ (char*)"create_component_instance",
+ (char*)"ssl",
aCompName.c_str(),
instanceName.c_str(),
studyId);
return iobject._retn();
}
+ return Engines::Component::_nil() ;
}
Engines::Component_ptr
{
thread_st *st = (thread_st*)s;
(Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->load_component_Library(st->compoName.c_str());
+ return NULL;
}
void *th_createcomponentinstance(void *s)
{
thread_st *st = (thread_st*)s;
(Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->create_component_instance(st->compoName.c_str(),st->studyId);
+ return NULL;
}
void *th_loadimpl(void *s)
{
thread_st *st = (thread_st*)s;
(Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->load_impl(st->nameToRegister.c_str(),st->compoName.c_str());
+ return NULL;
}
void *th_removeimpl(void *s)
{
thread_st *st = (thread_st*)s;
(Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->remove_impl(st->cptr);
+ return NULL;
}
void *th_finalizeremoval(void *s)
{
thread_st *st = (thread_st*)s;
(Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->finalize_removal();
+ return NULL;
}
-
}
#ifdef HAVE_MPI2
-void MPIObject_i::remoteMPI2Connect(bool high, string service)
+void MPIObject_i::remoteMPI2Connect(string service)
{
int i;
char port_name[MPI_MAX_PORT_NAME];
else
MPI_Comm_connect(port_name_clt, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &(_icom[service]) );
- /* create global communicator */
- MPI_Intercomm_merge(_icom[service],high,&(_gcom[service]));
+ /* create global communicator: servers have low index in global communicator*/
+ MPI_Intercomm_merge(_icom[service],!_srv[service],&(_gcom[service]));
/* only rank 0 can be server for unpublish name */
if(_numproc != 0) _srv[service] = false;
void BCastIOR(CORBA::ORB_ptr orb,Engines::MPIObject_ptr pobj,bool amiCont);
#ifdef HAVE_MPI2
// MPI2 connection
- void remoteMPI2Connect(bool high, std::string service);
+ void remoteMPI2Connect(std::string service);
// MPI2 disconnection
void remoteMPI2Disconnect(std::string service);
#endif
-I$(srcdir)/../Notification \
-I$(srcdir)/../ResourcesManager \
-I$(srcdir)/../Container \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
int main(int argc, char* argv[])
{
int nbproc, numproc;
- Engines_MPIContainer_i * myContainer=NULL;
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD,&nbproc);
// obtain the root poa manager
PortableServer::POAManager_var pman = root_poa->the_POAManager();
- // define policy objects
- PortableServer::ImplicitActivationPolicy_var implicitActivation =
- root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
-
- // default = NO_IMPLICIT_ACTIVATION
- PortableServer::ThreadPolicy_var threadPolicy =
- root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ;
- // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
-
- // create policy list
- CORBA::PolicyList policyList;
- policyList.length(2);
- policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
- policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
-
- // create the child POA
- PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
- PortableServer::POA_var factory_poa =
- root_poa->create_POA("factory_poa", pman, policyList) ;
- //with nil_mgr instead of pman, a new POA manager is created with the new POA
-
- // destroy policy objects
- implicitActivation->destroy() ;
- threadPolicy->destroy() ;
-
- char *containerName = "";
+ char *containerName = (char *)"";
if (argc >1)
{
containerName = argv[1] ;
}
MESSAGE("[" << numproc << "] MPIContainer: load MPIContainer servant");
- new Engines_MPIContainer_i(nbproc,numproc,orb,factory_poa, containerName,argc,argv);
+ new Engines_MPIContainer_i(nbproc,numproc,orb,root_poa, containerName,argc,argv);
pman->activate();
MPIContainer \
TestMPIContainer
-SUBDIR_BATCH= \
- Batch \
- Batch_SWIG
-
SUBDIR_PARALLEL= ParallelContainer
$(SUBDIR_CORBA) \
$(SUBDIR_MPI) \
$(SUBDIR_PARALLEL) \
- $(SUBDIR_BATCH) \
$(SUBDIR_CPPUNIT_BASE) \
$(SUBDIR_CPPUNIT_CORBA) \
$(SUBDIR_CPPUNIT_GENERAL)
#
if WITHONLYLAUNCHER
- SUBDIRS = Batch Batch_SWIG ResourcesManager Launcher
+ SUBDIRS = Basics ResourcesManager Launcher
else
SUBDIRS = $(SUBDIR_BASE)
-if WITH_BATCH
- SUBDIRS += $(SUBDIR_BATCH)
-endif
-
if CORBA_GEN
SUBDIRS += $(SUBDIR_CORBA)
endif
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@LIBXML_INCLUDES@ \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-I$(srcdir)/../Notification \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
- -I$(top_builddir)/salome_adm/unix \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Basics \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
*
* Initializes ORB reference and naming service root context.
* For use after default constructor.
+ * If param orb is null, the orb is initialized
* \param orb CORBA::ORB_ptr arguments
*/
// ============================================================================
MESSAGE("SALOME_NamingService initialisation");
Utils_Locker lock (&_myMutex);
- _orb = CORBA::ORB::_duplicate(orb);
+ if(orb)
+ _orb = CORBA::ORB::_duplicate(orb);
+ else
+ {
+ int argc=0;
+ _orb = CORBA::ORB_init(argc, 0); // Here we make the assumption that the orb has already been initialized
+ }
_initialize_root_context();
}
return _orb->object_to_string(_root_context);
}
+/*! \brief get the orb used by the naming service
+ *
+ * \return the orb
+ */
+CORBA::ORB_ptr SALOME_NamingService::orb()
+{
+ return _orb;
+}
+
virtual ~SALOME_NamingService();
- void init_orb(CORBA::ORB_ptr orb);
+ void init_orb(CORBA::ORB_ptr orb=0);
void Register(CORBA::Object_ptr ObjRef,
const char* Path)
throw(ServiceUnreachable);
virtual void Destroy_FullDirectory(const char* Path)
throw(ServiceUnreachable);
char* getIORaddr();
+ CORBA::ORB_ptr orb();
protected:
Utils_Mutex _myMutex;
#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
#-------------------------------------------------------------------------
- def __init__(self, orb):
+ def __init__(self, orb=None):
"""
Standard Constructor, with ORB reference.
Initializes the naming service root context
"""
#MESSAGE ( "SALOME_NamingServicePy_i::__init__" )
+ if orb is None:
+ orb=CORBA.ORB_init([''], CORBA.ORB_ID)
self._orb = orb
# initialize root context and current context
ok = 0
-I$(srcdir)/$(RPATH)/Basics \
-I$(srcdir)/$(RPATH)/SALOMELocalTrace \
-I$(srcdir)/$(RPATH)/Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(top_srcdir)/src/Registry \
-I$(top_srcdir)/src/Utils \
-I$(srcdir)/../HDFPersist \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
-I$(top_srcdir)/src/SALOMETraceCollector \
@PYTHON_INCLUDES@ \
PyObject *result = PyObject_CallMethod(pyCont,
(char*)"import_component",
(char*)"s",componentName);
- int ret_p= PyInt_AsLong(result);
+ std::string ret_p= PyString_AsString(result);
Py_XDECREF(result);
Py_RELEASE_NEW_THREAD;
- if (ret_p) // import possible: Python component
+ if (ret_p=="") // import possible: Python component
{
MESSAGE("import Python: " << aCompName <<" OK");
}
PyObject *result = PyObject_CallMethod(pyCont,
(char*)"import_component",
(char*)"s",componentName);
- int ret_p= PyInt_AsLong(result);
+ std::string ret_p= PyString_AsString(result);
Py_XDECREF(result);
Py_RELEASE_NEW_THREAD;
- if (ret_p) // import possible: Python component
+ if (ret_p=="") // import possible: Python component
{
_library_map[aCompName] = (void *)pyCont; // any non O value OK
MESSAGE("import Python: " << aCompName <<" OK");
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
Registry::Components_var Connexion( int argc , char **argv , const char *ptrSessionName ) throw( CommException )
{
- Registry::Components_var varComponents = 0 ;
- ASSERT(ptrSessionName) ;
- ASSERT(strlen(ptrSessionName)>0) ;
- const char *registryName = "Registry" ;
-
- try
- {
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init( argc , argv ) ;
-
- SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
- ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
- naming.init_orb( orb ) ;
-
- // Recuperation de la reference de l'objet
- CORBA::Object_var object = naming.Resolve( registryName ) ;
- if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ;
-
- // Specialisation de l'objet generique
- varComponents = Registry::Components::_narrow( object ) ;
- ASSERT(! CORBA::is_nil(varComponents)) ;
- }
- catch( ... )
- {
- throw CommException ( "NamingService Connexion Error" ) ;
- }
- return varComponents ;
+ Registry::Components_var varComponents = 0 ;
+ ASSERT(ptrSessionName) ;
+ ASSERT(strlen(ptrSessionName)>0) ;
+ const char *registryName = "Registry" ;
+
+ try
+ {
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ CORBA::ORB_var &orb = init( argc , argv ) ;
+
+ SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
+ ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
+ naming.init_orb( orb ) ;
+
+ // Recuperation de la reference de l'objet
+ CORBA::Object_var object = naming.Resolve( registryName ) ;
+ if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ;
+
+ // Specialisation de l'objet generique
+ varComponents = Registry::Components::_narrow( object ) ;
+ ASSERT(! CORBA::is_nil(varComponents)) ;
+ }
+ catch( ... )
+ {
+ throw CommException ( "NamingService Connexion Error" ) ;
+ }
+ return varComponents ;
}
RegistryConnexion::RegistryConnexion( int argc , char **argv , const char *ior , const char *ptrSessionName, const char *componentName ): \
- _Ior(duplicate(ior)), _VarComponents( Connexion(argc,argv,ptrSessionName) ), _SessionName(ptrSessionName),_Name(""), _Id(0)
+ _Ior(duplicate(ior)), _VarComponents( Connexion(argc,argv,ptrSessionName) ), _SessionName(ptrSessionName),_Name(""), _Id(0)
{
- this->add( componentName ) ;
+ this->add( componentName ) ;
}
RegistryConnexion::RegistryConnexion( void ): _Ior(0), _VarComponents( 0 ), _Name(""), _Id(0)
{
- INTERRUPTION(EXIT_FAILURE) ;
+ INTERRUPTION(EXIT_FAILURE) ;
}
RegistryConnexion::~RegistryConnexion()
{
- BEGIN_OF("RegistryConnexion::~RegistryConnexion()" ) ;
- if( _Id != 0 )
- {
- ASSERT(_SessionName!="" ) ;
- ASSERT(_Name!="" ) ;
- _VarComponents->remove( _Id ) ;
- }
- _Id = 0 ;
-#ifndef WIN32
- delete [] _Ior;
-#else
- delete [] (char*) _Ior;
-#endif
- _Ior = 0;
- _SessionName = "";
- _Name = "" ;
- END_OF("RegistryConnexion::~RegistryConnexion()" ) ;
+ BEGIN_OF("RegistryConnexion::~RegistryConnexion()" ) ;
+ if( _Id != 0 )
+ {
+ ASSERT(_SessionName!="" ) ;
+ ASSERT(_Name!="" ) ;
+ _VarComponents->remove( _Id ) ;
+ }
+ _Id = 0 ;
+ delete [] (char*) _Ior;
+ _Ior = 0;
+ _SessionName = "";
+ _Name = "" ;
+ END_OF("RegistryConnexion::~RegistryConnexion()" ) ;
}
void RegistryConnexion::add( const char *aName )
{
- ASSERT(_SessionName!="" ) ;
- ASSERT(_Name=="" ) ;
- ASSERT(_Id==0 ) ;
- ASSERT(aName) ;
- SCRUTE(aName) ;
- ASSERT(strlen( aName )>0) ;
-
- const Identity lesInfos( aName ) ;
- Registry::Infos infos ;
- infos.name = CORBA::string_dup( lesInfos.name() ) ;
- infos.pid = lesInfos.pid() ;
- infos.machine = CORBA::string_dup( lesInfos.host_char() ) ;
- infos.adip = CORBA::string_dup( lesInfos.adip() ) ;
- infos.uid = (long)lesInfos.uid() ;
- infos.pwname = CORBA::string_dup( lesInfos.pwname() ) ;
- infos.tc_start = lesInfos.start() ;
- infos.tc_hello = 0 ;
- infos.tc_end = 0 ;
- infos.difftime = 0 ;
- infos.cdir = CORBA::string_dup( lesInfos.rep() ) ;
- infos.status = -1 ;
- infos.ior = CORBA::string_dup(_Ior);
-
- ASSERT(!CORBA::is_nil(this->_VarComponents)) ;
-
- CORBA::ULong id = _VarComponents->add( infos ) ;
-
- SCRUTE(aName) ; SCRUTE(id) ;
- ASSERT(id) ;
-
- _Id = id ;
- _Name = aName ;
-
- return ;
+ ASSERT(_SessionName!="" ) ;
+ ASSERT(_Name=="" ) ;
+ ASSERT(_Id==0 ) ;
+ ASSERT(aName) ;
+ SCRUTE(aName) ;
+ ASSERT(strlen( aName )>0) ;
+
+ const Identity lesInfos( aName ) ;
+ Registry::Infos infos ;
+ infos.name = CORBA::string_dup( lesInfos.name() ) ;
+ infos.pid = lesInfos.pid() ;
+ infos.machine = CORBA::string_dup( lesInfos.host_char() ) ;
+ infos.adip = CORBA::string_dup( lesInfos.adip() ) ;
+ infos.uid = (long)lesInfos.uid() ;
+ infos.pwname = CORBA::string_dup( lesInfos.pwname() ) ;
+ infos.tc_start = lesInfos.start() ;
+ infos.tc_hello = 0 ;
+ infos.tc_end = 0 ;
+ infos.difftime = 0 ;
+ infos.cdir = CORBA::string_dup( lesInfos.rep() ) ;
+ infos.status = -1 ;
+ infos.ior = CORBA::string_dup(_Ior);
+
+ ASSERT(!CORBA::is_nil(this->_VarComponents)) ;
+
+ CORBA::ULong id = _VarComponents->add( infos ) ;
+
+ SCRUTE(aName) ; SCRUTE(id) ;
+ ASSERT(id) ;
+
+ _Id = id ;
+ _Name = aName ;
+
+ return ;
}
void RegistryConnexion::remove( void )
{
- ASSERT(_Id>0) ;
- ASSERT(!CORBA::is_nil(this->_VarComponents)) ;
- _VarComponents->remove( _Id ) ;
+ ASSERT(_Id>0) ;
+ ASSERT(!CORBA::is_nil(this->_VarComponents)) ;
+ _VarComponents->remove( _Id ) ;
- _Name = "" ;
- _Id = 0 ;
+ _Name = "" ;
+ _Id = 0 ;
- return ;
+ return ;
}
using namespace std;
/* ------------------------------*/
-/* Constructeurs et Destructeurs */
+/* Constructors and Destructors */
/* ------------------------------*/
RegistryService::RegistryService( void ) : _SessionName(0), _Compteur(0)
{
- MESSAGE("Passage dans RegistryService::RegistryService()") ;
- _orb = CORBA::ORB::_nil();
+ MESSAGE("RegistryService::RegistryService()") ;
+ _orb = CORBA::ORB::_nil();
}
-
RegistryService::~RegistryService()
{
- BEGIN_OF("RegistryService::~RegistryService()") ;
- map<int,client_infos *>::iterator im;
- for (im=_reg.begin();im!=_reg.end(); im++)
- {
-#if defined(_DEBUG_) || defined(_DEBUG)
- const client_infos &lesInfos = *(*im).second ;
- MESSAGE("Deletion") ; SCRUTE( lesInfos._name ) ;
-#endif
- _reg.erase ( im ) ;
- }
- ASSERT(_reg.size()==0) ;
- for (im=_fin.begin();im!=_fin.end(); im++)
- {
-#if defined(_DEBUG_) || defined(_DEBUG)
- const client_infos &lesInfos = *(*im).second ;
- MESSAGE("Deletion") ; SCRUTE( lesInfos._name ) ;
-#endif
- _fin.erase ( im ) ;
- }
- ASSERT(_fin.size()==0) ;
- _Compteur = -1 ;
- if ( _SessionName )
- {
-#ifndef WIN32
- delete [] _SessionName ;
-#else
- delete [] (char*)_SessionName ;
-#endif
- _SessionName = 0 ;
- }
- END_OF("RegistryService::~RegistryService()") ;
+ BEGIN_OF("RegistryService::~RegistryService()") ;
+ map<int,client_infos *>::iterator im;
+ for (im=_reg.begin();im!=_reg.end(); im++)
+ {
+ MESSAGE("Delete _reg item " << im->second->_name) ;
+ delete im->second;
+ }
+ for (im=_fin.begin();im!=_fin.end(); im++)
+ {
+ MESSAGE("Delete _fin item " << im->second->_name) ;
+ delete im->second;
+ }
+ _Compteur = -1 ;
+ if ( _SessionName )
+ {
+ delete [] (char*)_SessionName ;
+ _SessionName = 0 ;
+ }
+ END_OF("RegistryService::~RegistryService()") ;
}
/* ------------------------------*/
-/* Contrats IDL */
+/* IDL contracts */
/* ------------------------------*/
CORBA::ULong RegistryService::size ( void )
{
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
- return _reg.size() ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+ return _reg.size() ;
}
-
CORBA::ULong RegistryService::add( const Registry::Infos & infos )
{
- BEGIN_OF("RegistryService::add") ;
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
- client_infos *ptr_Component = new client_infos( infos ) ;
- ASSERT(ptr_Component) ;
- SCRUTE(ptr_Component->_name) ;
-
- _Compteur++;
- _reg[_Compteur]=ptr_Component;
-
- END_OF("RegistryService::add") ;
- return (CORBA::ULong)_Compteur ;
+ BEGIN_OF("RegistryService::add") ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+ client_infos *ptr_Component = new client_infos( infos ) ;
+ ASSERT(ptr_Component) ;
+ SCRUTE(ptr_Component->_name) ;
+
+ _Compteur++;
+ _reg[_Compteur]=ptr_Component;
+
+ END_OF("RegistryService::add") ;
+ return (CORBA::ULong)_Compteur ;
}
-#ifndef WIN32
-void RegistryService::remove( const CORBA::ULong id)
-#else
void RegistryService::remove( CORBA::ULong id)
-#endif
{
- BEGIN_OF("RegistryService::remove") ;
- SCRUTE(id) ;
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
-
- ASSERT(_reg.find(id)!=_reg.end())
- _reg[id]->_status=TERMINATED;
- _reg[id]->_ts_end = time(NULL) ;
-
- _fin[id]=_reg[id];
- SCRUTE(_fin.size()) ;
-
- map<int,client_infos *>::iterator pos = _reg.find ( id ) ;
- _reg.erase ( pos ) ;
- SCRUTE(_reg.size()) ;
- SCRUTE(_fin.size()) ;
-
- END_OF("RegistryService::remove") ;
- return ;
+ BEGIN_OF("RegistryService::remove") ;
+ SCRUTE(id) ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+
+ ASSERT(_reg.find(id)!=_reg.end())
+ _reg[id]->_status=TERMINATED;
+ _reg[id]->_ts_end = time(NULL) ;
+
+ _fin[id]=_reg[id];
+ _reg.erase(id);
+
+ SCRUTE(_reg.size()) ;
+ SCRUTE(_fin.size()) ;
+
+ END_OF("RegistryService::remove") ;
+ return ;
}
-#ifndef WIN32
-void RegistryService::hello( const CORBA::ULong id )
-#else
void RegistryService::hello( CORBA::ULong id )
-#endif
{
- BEGIN_OF("RegistryService::hello") ;
- SCRUTE(id) ;
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
-
- ASSERT(_reg.find(id)!=_reg.end())
- _reg[id]->_ts_hello = time(NULL) ;
-
- END_OF("RegistryService::hello") ;
- return ;
-}
+ BEGIN_OF("RegistryService::hello") ;
+ SCRUTE(id) ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+ ASSERT(_reg.find(id)!=_reg.end())
+ _reg[id]->_ts_hello = time(NULL) ;
+
+ END_OF("RegistryService::hello") ;
+ return ;
+}
void RegistryService::end( void )
{
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
- BEGIN_OF( "RegistryService::end( void )" ) ;
- exit( EXIT_SUCCESS ) ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+ BEGIN_OF( "RegistryService::end( void )" ) ;
+ exit( EXIT_SUCCESS ) ;
}
-
Registry::AllInfos* RegistryService::getall( void )
{
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
- return RegistryService::makeseq(_reg) ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+ return RegistryService::makeseq(_reg) ;
}
Registry::AllInfos* RegistryService::history( void )
{
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
- return RegistryService::makeseq(_fin) ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+ return RegistryService::makeseq(_fin) ;
}
Registry::AllInfos* RegistryService::makeseq(map<int,client_infos *> &mymap )
{
- int i=0 ;
+ int i=0 ;
- Registry::AllInfos *all = new Registry::AllInfos ;
- ASSERT(all) ;
- const int RegLength = mymap.size();
- all->length(RegLength);
+ Registry::AllInfos *all = new Registry::AllInfos ;
+ ASSERT(all) ;
+ const int RegLength = mymap.size();
+ all->length(RegLength);
- map<int,client_infos *>::iterator im;
- for (im=mymap.begin();im!=mymap.end(); im++)
+ map<int,client_infos *>::iterator im;
+ for (im=mymap.begin();im!=mymap.end(); im++)
{
- Registry::Infos &infos = (*all)[i] ;
- const client_infos &lesInfos = *(*im).second ;
- infos.name = CORBA::string_dup( lesInfos._name ) ;
- infos.pid = lesInfos._pid ;
- infos.pwname = lesInfos._pwname ;
- infos.machine = CORBA::string_dup( lesInfos._machine ) ;
- infos.adip = CORBA::string_dup( lesInfos._adip ) ;
- infos.uid = lesInfos._uid ;
- infos.tc_start = lesInfos._ts_start + lesInfos._difftime ;
- infos.tc_hello = lesInfos._ts_hello + lesInfos._difftime ;
- infos.tc_end = lesInfos._ts_end + lesInfos._difftime ;
- infos.difftime = lesInfos._difftime ;
- infos.cdir = CORBA::string_dup( lesInfos._cdir ) ;
- infos.status = lesInfos._status ;
-
- i++;
- }
-
- return all ;
+ Registry::Infos &infos = (*all)[i] ;
+ const client_infos &lesInfos = *(*im).second ;
+ infos.name = CORBA::string_dup( lesInfos._name ) ;
+ infos.pid = lesInfos._pid ;
+ infos.pwname = lesInfos._pwname ;
+ infos.machine = CORBA::string_dup( lesInfos._machine ) ;
+ infos.adip = CORBA::string_dup( lesInfos._adip ) ;
+ infos.uid = lesInfos._uid ;
+ infos.tc_start = lesInfos._ts_start + lesInfos._difftime ;
+ infos.tc_hello = lesInfos._ts_hello + lesInfos._difftime ;
+ infos.tc_end = lesInfos._ts_end + lesInfos._difftime ;
+ infos.difftime = lesInfos._difftime ;
+ infos.cdir = CORBA::string_dup( lesInfos._cdir ) ;
+ infos.status = lesInfos._status ;
+
+ i++;
+ }
+
+ return all ;
}
/* ------------------------------*/
-/* Autres */
+/* Others */
/* ------------------------------*/
RegistryService::client_infos::client_infos( const Registry::Infos &infos ):\
- _ior(duplicate(infos.ior)),\
- _name(duplicate(infos.name)),\
- _pid(infos.pid),\
- _machine(duplicate(infos.machine)),\
- _adip(duplicate(infos.adip)),\
- _uid(infos.uid),\
- _pwname(duplicate(infos.pwname)),\
- _ts_start(time(NULL)),\
- _difftime(infos.tc_start - _ts_start),\
- _cdir(duplicate(infos.cdir)),\
- _ts_hello(_ts_start),\
- _ts_end(0),\
- _status(RUNNING)
+ _ior(duplicate(infos.ior)),\
+ _name(duplicate(infos.name)),\
+ _pid(infos.pid),\
+ _machine(duplicate(infos.machine)),\
+ _adip(duplicate(infos.adip)),\
+ _uid(infos.uid),\
+ _pwname(duplicate(infos.pwname)),\
+ _ts_start(time(NULL)),\
+ _difftime(infos.tc_start - _ts_start),\
+ _cdir(duplicate(infos.cdir)),\
+ _ts_hello(_ts_start),\
+ _ts_end(0),\
+ _status(RUNNING)
{
- // SCRUTE(_ior) ;
- ;
}
RegistryService::client_infos::~client_infos()
{
- delete [] (char*)_ior ; (char*&)_ior = NULL ;
- delete [] (char*)_name ; (char*&)_name = NULL ;
- delete [] (char*)_machine ; (char*&)_machine = NULL ;
- delete [] (char*)_pwname ; (char*&)_pwname = NULL ;
- delete [] (char*)_adip ; (char*&)_adip = NULL ;
- delete [] (char*)_cdir ; (char*&)_cdir = NULL ;
+ delete [] (char*)_ior ; (char*&)_ior = NULL ;
+ delete [] (char*)_name ; (char*&)_name = NULL ;
+ delete [] (char*)_machine ; (char*&)_machine = NULL ;
+ delete [] (char*)_pwname ; (char*&)_pwname = NULL ;
+ delete [] (char*)_adip ; (char*&)_adip = NULL ;
+ delete [] (char*)_cdir ; (char*&)_cdir = NULL ;
}
void RegistryService::SessionName( const char *sessionName )
{
- ASSERT(sessionName) ;
- ASSERT(strlen(sessionName)>0) ;
- _SessionName = duplicate(sessionName) ;
- return ;
+ ASSERT(sessionName) ;
+ ASSERT(strlen(sessionName)>0) ;
+ _SessionName = duplicate(sessionName) ;
+ return ;
}
void RegistryService::ping()
{
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@LIBXML_INCLUDES@ \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
libResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0
libResourcesManager_la_LIBADD =\
- ../Utils/libOpUtil.la \
+ ../Basics/libSALOMEBasics.la \
@LIBXML_LIBS@
// PaCO++ parallel container case
std::string parallelLib(params.parallelLib);
- if (params.nb_component_nodes > 0 and parallelLib != "")
+ if (params.nb_component_nodes > 0 && parallelLib != "")
{
#if defined(_DEBUG_) || defined(_DEBUG)
std::cerr << "[GetFittingResources] ParallelContainer case" << std::endl;
#include "SALOME_LoadRateManager.hxx"
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef WNT
+#else
#include <unistd.h>
+#endif
// --- WARNING ---
// The call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done
std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
return false;
}
+ return true;
}
bool
-I$(srcdir)/../GenericObj \
-I$(srcdir)/../SALOMEDSClient \
-I$(srcdir)/../LifeCycleCORBA \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
SALOMEDS::Locker lock;
aValue = dynamic_cast<SALOMEDSImpl_AttributeIOR*>(_local_impl)->Value();
}
- else aValue = SALOMEDS::AttributeIOR::_narrow(_corba_impl)->Value();
+ else aValue = (CORBA::String_var)((SALOMEDS::AttributeIOR_var)SALOMEDS::AttributeIOR::_narrow(_corba_impl))->Value();
return aValue;
}
SALOMEDS::Locker lock;
dynamic_cast<SALOMEDSImpl_AttributeIOR*>(_local_impl)->SetValue(value);
}
- else SALOMEDS::AttributeIOR::_narrow(_corba_impl)->SetValue(value.c_str());
+ else ((SALOMEDS::AttributeIOR_var)SALOMEDS::AttributeIOR::_narrow(_corba_impl))->SetValue(value.c_str());
}
return c_s._retn();
}
+
void SALOMEDS_AttributeIOR_i::SetValue(const char* value)
{
SALOMEDS::Locker lock;
string anExtStr((char *)Str.in());
dynamic_cast<SALOMEDSImpl_AttributeIOR*>(_impl)->SetValue(anExtStr);
}
+
+SALOMEDS_AttributeIOR_i::~SALOMEDS_AttributeIOR_i()
+{}
SALOMEDS_AttributeIOR_i(SALOMEDSImpl_AttributeIOR* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
- ~SALOMEDS_AttributeIOR_i() {};
+ ~SALOMEDS_AttributeIOR_i();
char* Value();
void SetValue(const char* value);
SALOMEDS::Locker lock;
aValue = dynamic_cast<SALOMEDSImpl_AttributeName*>(_local_impl)->Value();
}
- else aValue = SALOMEDS::AttributeName::_narrow(_corba_impl)->Value();
+ else aValue = (CORBA::String_var)((SALOMEDS::AttributeName_var)SALOMEDS::AttributeName::_narrow(_corba_impl))->Value();
return aValue;
}
SALOMEDS::Locker lock;
dynamic_cast<SALOMEDSImpl_AttributeName*>(_local_impl)->SetValue(value);
}
- else SALOMEDS::AttributeName::_narrow(_corba_impl)->SetValue(value.c_str());
+ else ((SALOMEDS::AttributeName_var)SALOMEDS::AttributeName::_narrow(_corba_impl))->SetValue(value.c_str());
}
SALOMEDS::Locker lock;
ret = dynamic_cast<SALOMEDSImpl_AttributePixMap*>(_local_impl)->HasPixMap();
}
- else ret = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->HasPixMap();
+ else ret = ((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->HasPixMap();
return ret;
}
SALOMEDS::Locker lock;
aValue = dynamic_cast<SALOMEDSImpl_AttributePixMap*>(_local_impl)->GetPixMap();
}
- else aValue = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->GetPixMap();
+ else aValue = (CORBA::String_var)((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->GetPixMap();
return aValue;
}
SALOMEDS::Locker lock;
dynamic_cast<SALOMEDSImpl_AttributePixMap*>(_local_impl)->SetPixMap(value);
}
- else SALOMEDS::AttributePixMap::_narrow(_corba_impl)->SetPixMap(value.c_str());
+ else ((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->SetPixMap(value.c_str());
}
dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
anImpl->ChangeCreatorName(theName);
} else
- SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str());
+ ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetUserName(theName.c_str());
}
std::string SALOMEDS_AttributeStudyProperties::GetUserName()
aName = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetCreatorName();
}
#ifndef WIN32
- else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName();
+ else aName = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUserName();
#else
- else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserNameA();
+ else aName = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUserNameA();
#endif
return aName;
}
string S;
anImpl->SetModification(S, theMinute, theHour, theDay, theMonth, theYear);
} else {
- SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute,
+ ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetCreationDate(theMinute,
theHour,
theDay,
theMonth,
(_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear);
} else {
CORBA::Long aMinute, anHour, aDay, aMonth, anYear;
- ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationDate(aMinute,
+ ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetCreationDate(aMinute,
anHour,
aDay,
aMonth,
else //Not defined
dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetCreationMode(0);
}
- else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(theMode.c_str());
+ else ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetCreationMode(theMode.c_str());
}
std::string SALOMEDS_AttributeStudyProperties::GetCreationMode()
if (mode == 2) aMode = "copy from";
}
else
- aMode = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationMode();
+ aMode = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetCreationMode();
return aMode;
}
dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetModified(theModified);
}
else
- SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified);
+ ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetModified(theModified);
}
bool SALOMEDS_AttributeStudyProperties::IsModified()
ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->IsModified();
}
else
- ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified();
+ ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->IsModified();
return ret;
}
isModified = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetModified();
}
else
- isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified();
+ isModified = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetModified();
return isModified;
}
dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetLocked(theLocked);
}
else
- SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked);
+ ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetLocked(theLocked);
}
bool SALOMEDS_AttributeStudyProperties::IsLocked()
ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->IsLocked();
}
else
- ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked();
+ ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->IsLocked();
return ret;
}
SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
anImpl->SetModification(theName, theMinute, theHour, theDay, theMonth, theYear);
} else
- SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(theName.c_str(),
+ ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetModification(theName.c_str(),
theMinute,
theHour,
theDay,
} else {
SALOMEDS::StringSeq_var aNames;
SALOMEDS::LongSeq_var aMinutes, aHours, aDays, aMonths, aYears;
- SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModificationsList(aNames.out(),
+ ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetModificationsList(aNames.out(),
aMinutes.out(),
aHours.out(),
aDays.out(),
SALOMEDS::Locker lock;
aSO = new SALOMEDS_SObject(_local_impl->Value());
}
- else aSO = new SALOMEDS_SObject(_corba_impl->Value());
+ else {
+ SALOMEDS::SObject_var so=_corba_impl->Value();
+ aSO = new SALOMEDS_SObject(so);
+ }
return _PTR(SObject)(aSO);
}
public virtual SALOME::GenericObj_i
{
private:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_ChildIterator* _it;
public:
SALOMEDS::unlock();
bool isOk = _driver->CanCopy(so.in());
+ so->Destroy();
SALOMEDS::lock();
return isOk;
aType = _local_impl->Type();
}
else {
- aType = _corba_impl->Type();
+ aType = (CORBA::String_var)_corba_impl->Type();
}
return aType;
}
aType = _local_impl->GetClassType();
}
else {
- aType = _corba_impl->GetClassType();
+ aType = (CORBA::String_var)_corba_impl->GetClassType();
}
return aType;
}
aSO = new SALOMEDS_SObject(_local_impl->GetSObject());
}
else {
- aSO = new SALOMEDS_SObject(_corba_impl->GetSObject());
+ aSO = new SALOMEDS_SObject((SALOMEDS::SObject_var)_corba_impl->GetSObject());
}
return _PTR(SObject)(aSO);
{
SALOMEDS_GenericAttribute* aGA = NULL;
if(!CORBA::is_nil(theGA)) {
- std::string aTypeOfAttribute = theGA->GetClassType();
+ CORBA::String_var astr=theGA->GetClassType();
+ std::string aTypeOfAttribute = astr.in();
__CreateGenericClientAttributeCORBA
}
return aGA;
_impl = theImpl;
}
+SALOMEDS_GenericAttribute_i::~SALOMEDS_GenericAttribute_i()
+{
+}
+
void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection)
{
SALOMEDS::Locker lock;
return CORBA::string_dup(type.c_str());
}
- return (char*)"";
+ return CORBA::string_dup("");
}
char* SALOMEDS_GenericAttribute_i::GetClassType()
return CORBA::string_dup(class_type.c_str());
}
- return (char*)"";
+ return CORBA::string_dup("");
}
protected:
DF_Attribute* _impl;
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
public:
SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb);
- virtual ~SALOMEDS_GenericAttribute_i() {};
+ virtual ~SALOMEDS_GenericAttribute_i();
void CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection);
SALOMEDS::Locker lock;
aType = (dynamic_cast<SALOMEDSImpl_SComponent*>(GetLocalImpl()))->ComponentDataType();
}
- else aType = (SALOMEDS::SComponent::_narrow(GetCORBAImpl()))->ComponentDataType();
+ else
+ {
+ SALOMEDS::SComponent_var aCompo=SALOMEDS::SComponent::_narrow(GetCORBAImpl());
+ CORBA::String_var aString = aCompo->ComponentDataType();
+ aType=aString.in();
+ }
return aType;
}
SALOMEDS::SComponent_ptr SALOMEDS_SComponent::GetSComponent()
{
if(_isLocal) {
- if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl()));
+ if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_narrow(GetCORBAImpl());
SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(*(dynamic_cast<SALOMEDSImpl_SComponent*>(GetLocalImpl())), _orb);
_corba_impl = SALOMEDS::SComponent::_duplicate(aSCO);
return aSCO._retn();
}
else {
- return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl()));
+ return SALOMEDS::SComponent::_narrow(GetCORBAImpl());
}
return SALOMEDS::SComponent::_nil();
}
SALOMEDS::Locker lock;
aSCO = new SALOMEDS_SComponent(_local_impl->Value());
}
- else aSCO = new SALOMEDS_SComponent(_corba_impl->Value());
+ else aSCO = new SALOMEDS_SComponent((SALOMEDS::SComponent_var)_corba_impl->Value());
return _PTR(SComponent)(aSCO);
}
private:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_SComponentIterator* _impl;
public:
SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const SALOMEDSImpl_SComponent& theImpl, CORBA::ORB_ptr theORB)
{
SALOMEDS_SComponent_i* sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB);
- SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this());
- return sco._retn();
+ return sco_servant->_this();
}
//============================================================================
SALOMEDS::Locker lock;
aValue = _local_impl->GetID();
}
- else aValue = _corba_impl->GetID();
+ else aValue = (CORBA::String_var)_corba_impl->GetID();
return aValue;
}
SALOMEDS::Locker lock;
return _PTR(SComponent)(new SALOMEDS_SComponent(_local_impl->GetFatherComponent()));
}
- return _PTR(SComponent)(new SALOMEDS_SComponent(_corba_impl->GetFatherComponent()));
+ return _PTR(SComponent)(new SALOMEDS_SComponent((SALOMEDS::SComponent_var)_corba_impl->GetFatherComponent()));
}
_PTR(SObject) SALOMEDS_SObject::GetFather()
SALOMEDS::Locker lock;
return _PTR(SObject)(new SALOMEDS_SObject(_local_impl->GetFather()));
}
- return _PTR(SObject)(new SALOMEDS_SObject(_corba_impl->GetFather()));
+ return _PTR(SObject)(new SALOMEDS_SObject((SALOMEDS::SObject_var)_corba_impl->GetFather()));
}
bool SALOMEDS_SObject::FindAttribute(_PTR(GenericAttribute)& anAttribute,
SALOMEDS::Locker lock;
return _PTR(Study)(new SALOMEDS_Study(_local_impl->GetStudy()));
}
- return _PTR(Study)(new SALOMEDS_Study(_corba_impl->GetStudy()));
+ SALOMEDS::Study_var study=_corba_impl->GetStudy();
+ return _PTR(Study)(new SALOMEDS_Study(study));
}
std::string SALOMEDS_SObject::Name()
SALOMEDS::Locker lock;
aName = _local_impl->Name();
}
- else aName = _corba_impl->Name();
+ else aName = (CORBA::String_var)_corba_impl->Name();
return aName;
}
SALOMEDS::Locker lock;
aName = _local_impl->GetName();
}
- else aName = _corba_impl->GetName();
+ else aName = (CORBA::String_var) _corba_impl->GetName();
return aName;
}
SALOMEDS::Locker lock;
aComment = _local_impl->GetComment();
}
- else aComment = _corba_impl->GetComment();
+ else aComment = (CORBA::String_var) _corba_impl->GetComment();
return aComment;
}
SALOMEDS::Locker lock;
anIOR = _local_impl->GetIOR();
}
- else anIOR = _corba_impl->GetIOR();
+ else anIOR = (CORBA::String_var) _corba_impl->GetIOR();
return anIOR;
}
CORBA::Object_ptr GetObject();
SALOMEDS::SObject_ptr GetSObject();
- SALOMEDS::SObject_ptr GetCORBAImpl() { return SALOMEDS::SObject::_duplicate(_corba_impl); }
+ SALOMEDS::SObject_var GetCORBAImpl() { return _corba_impl; }
SALOMEDSImpl_SObject* GetLocalImpl() { return _local_impl; }
private:
SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const SALOMEDSImpl_SObject& theImpl, CORBA::ORB_ptr theORB)
{
SALOMEDS_SObject_i* so_servant = new SALOMEDS_SObject_i(theImpl, theORB);
- SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this());
- return so._retn();
+ return so_servant->_this();
}
SALOMEDS::Locker lock;
DF_Attribute* anAttr = NULL;
if(_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute)) {
- anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+ anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb);
return true;
}
for(int i = 0; i < length; i++) {
SALOMEDSImpl_GenericAttribute* anAttr = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(aSeq[i]);
SALOMEDS::GenericAttribute_var anAttribute;
- anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+ anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb);
if (!CORBA::is_nil(anAttribute)) {
SeqOfAttr[i] = anAttribute;
}
public virtual SALOME::GenericObj_i
{
protected:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_SObject* _impl;
public:
SALOMEDS::Locker lock;
aRef = _local_impl->GetPersistentReference();
}
- else aRef = _corba_impl->GetPersistentReference();
+ else aRef = (CORBA::String_var)_corba_impl->GetPersistentReference();
return aRef;
}
SALOMEDS::Locker lock;
aProp = new SALOMEDS_AttributeStudyProperties(_local_impl->GetProperties());
}
- else aProp = new SALOMEDS_AttributeStudyProperties(_corba_impl->GetProperties());
+ else aProp = new SALOMEDS_AttributeStudyProperties((SALOMEDS::AttributeStudyProperties_var)_corba_impl->GetProperties());
return _PTR(AttributeStudyProperties)(aProp);
}
_corba_impl->SetBoolean((char*)theVarName.c_str(),theValue);
}
+void SALOMEDS_Study::SetString(const string& theVarName, const string& theValue)
+{
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+ _local_impl->SetStringVariable(theVarName,
+ theValue,
+ SALOMEDSImpl_GenericVariable::STRING_VAR);
+ }
+ else
+ _corba_impl->SetString((char*)theVarName.c_str(),(char*)theValue.c_str());
+}
+
+void SALOMEDS_Study::SetStringAsDouble(const string& theVarName, const double theValue)
+{
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+ _local_impl->SetStringVariableAsDouble(theVarName,
+ theValue,
+ SALOMEDSImpl_GenericVariable::STRING_VAR);
+ }
+ else
+ _corba_impl->SetStringAsDouble((char*)theVarName.c_str(),theValue);
+}
+
double SALOMEDS_Study::GetReal(const string& theVarName)
{
double aResult;
return aResult;
}
+std::string SALOMEDS_Study::GetString(const string& theVarName)
+{
+ std::string aResult;
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+ aResult = _local_impl->GetStringVariableValue(theVarName);
+ }
+ else
+ aResult = _corba_impl->GetString((char*)theVarName.c_str());
+ return aResult;
+}
+
bool SALOMEDS_Study::IsReal(const string& theVarName)
{
bool aResult;
return aResult;
}
+bool SALOMEDS_Study::IsString(const string& theVarName)
+{
+ bool aResult;
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+ aResult = _local_impl->IsTypeOf(theVarName,
+ SALOMEDSImpl_GenericVariable::STRING_VAR);
+ }
+ else
+ aResult = _corba_impl->IsString((char*)theVarName.c_str());
+ return aResult;
+}
+
bool SALOMEDS_Study::IsVariable(const string& theVarName)
{
bool aResult;
virtual void SetReal(const std::string& theVarName, const double theValue);
virtual void SetInteger(const std::string& theVarName, const int theValue);
virtual void SetBoolean(const std::string& theVarName, const bool theValue);
+ virtual void SetString(const std::string& theVarName, const std::string& theValue);
+ virtual void SetStringAsDouble(const std::string& theVarName, const double theValue);
virtual double GetReal(const std::string& theVarName);
virtual int GetInteger(const std::string& theVarName);
virtual bool GetBoolean(const std::string& theVarName);
+ virtual std::string GetString(const std::string& theVarName);
virtual bool IsReal(const std::string& theVarName);
virtual bool IsInteger(const std::string& theVarName);
virtual bool IsBoolean(const std::string& theVarName);
+ virtual bool IsString(const std::string& theVarName);
virtual bool IsVariable(const std::string& theVarName);
virtual std::vector<std::string> GetVariableNames();
{
SALOMEDS::Locker lock;
CheckLocked();
- SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID());
+ CORBA::String_var anID=aComponent->GetID();
+ SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anID.in());
CORBA::String_var iorstr = _orb->object_to_string(IOR);
_impl->DefineComponentInstance(aSCO, (char*)iorstr.in());
SALOMEDS::Locker lock;
CheckLocked();
ASSERT(!CORBA::is_nil(aComponent));
- SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID());
+ CORBA::String_var cid=aComponent->GetID();
+ SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(cid.in());
_impl->RemoveComponent(aSCO);
}
CheckLocked();
SALOMEDSImpl_SObject aFO, aSO;
- aFO = _impl->GetOwner()->GetSObject(theFatherObject->GetID());
+ CORBA::String_var anID=theFatherObject->GetID();
+ aFO = _impl->GetOwner()->GetSObject(anID.in());
aSO = _impl->NewObject(aFO);
if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO,_orb);
{
SALOMEDS::Locker lock;
CheckLocked();
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ CORBA::String_var anID=anObject->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->RemoveObject(aSO);
}
{
SALOMEDS::Locker lock;
CheckLocked();
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ CORBA::String_var anID=anObject->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->RemoveObjectWithChildren(aSO);
}
SALOMEDS::Locker lock;
Unexpect aCatch(SBSalomeException);
- SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anSCO->GetID());
+ CORBA::String_var anID=anSCO->GetID();
+ SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anID.in());
SALOMEDS_Driver_i* driver = new SALOMEDS_Driver_i(aDriver, _orb);
bool isDone = _impl->LoadWith(aSCO, driver);
delete driver;
SALOMEDS::GenericAttribute_var anAttribute;
if(anAttr)
- anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+ anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb);
return anAttribute._retn();
}
{
SALOMEDS::Locker lock;
ASSERT(!CORBA::is_nil(anObject));
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ CORBA::String_var anID = anObject->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
DF_Attribute* anAttr;
if(!_impl->FindAttribute(aSO, anAttr, string(aTypeOfAttribute))) return false;
- anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+ anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb);
return true;
}
SALOMEDS::Locker lock;
CheckLocked();
ASSERT(!CORBA::is_nil(anObject));
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ CORBA::String_var anID = anObject->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->RemoveAttribute(aSO, string(aTypeOfAttribute));
}
ASSERT(!CORBA::is_nil(theReferencedObject));
SALOMEDSImpl_SObject aSO, aRefSO;
- aSO = _impl->GetOwner()->GetSObject(me->GetID());
- aRefSO = _impl->GetOwner()->GetSObject(theReferencedObject->GetID());
+ CORBA::String_var anID = me->GetID();
+ aSO = _impl->GetOwner()->GetSObject(anID.in());
+ anID=theReferencedObject->GetID();
+ aRefSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->Addreference(aSO, aRefSO);
}
SALOMEDS::Locker lock;
CheckLocked();
ASSERT(!CORBA::is_nil(me));
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(me->GetID());
+ CORBA::String_var anID = me->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->RemoveReference(aSO);
}
SALOMEDS::Locker lock;
CheckLocked();
ASSERT(!CORBA::is_nil(anObject));
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ CORBA::String_var anID=anObject->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->SetGUID(aSO, string(theGUID));
}
{
SALOMEDS::Locker lock;
ASSERT(!CORBA::is_nil(anObject));
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ CORBA::String_var anID=anObject->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
return _impl->IsGUID(aSO, string(theGUID));
}
Unexpect aCatch(SBLockProtection);
CheckLocked();
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID());
+ CORBA::String_var anID=theSO->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->SetName(aSO, string(theValue));
}
Unexpect aCatch(SBLockProtection);
CheckLocked();
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID());
+ CORBA::String_var anID=theSO->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->SetComment(aSO, string(theValue));
}
Unexpect aCatch(SBLockProtection);
CheckLocked();
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID());
+ CORBA::String_var anID=theSO->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->SetIOR(aSO, string(theValue));
}
class SALOMEDS_StudyBuilder_i: public POA_SALOMEDS::StudyBuilder
{
private:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_StudyBuilder* _impl;
public:
MESSAGE("NewStudy : Creating the CORBA servant holding it... ");
- SALOMEDS_Study_i *Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb);
- SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this());
+ SALOMEDS_Study_i *Study_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb);
+ PortableServer::ObjectId_var servantid = _poa->activate_object(Study_servant); // to use poa registered in _mapOfPOA
+ SALOMEDS::Study_var Study = Study_servant->_this();
// Register study in the naming service
// Path to acces the study
_mapOfPOA[Study->StudyId()] = _poa;
- return Study;
+ return Study._retn();
}
//============================================================================
MESSAGE("Open : Creating the CORBA servant holding it... ");
// Temporary aStudyUrl in place of study name
- SALOMEDS_Study_i * Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb);
- SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this());
+ SALOMEDS_Study_i * Study_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb);
+ PortableServer::ObjectId_var servantid = _poa->activate_object(Study_servant); // to use poa register in _mapOfPOA
+ SALOMEDS::Study_var Study = Study_servant->_this();
// Assign the value of the IOR in the study->root
CORBA::String_var IORStudy = _orb->object_to_string(Study);
aStudyImpl->SetTransientReference((char*)IORStudy.in());
+ _mapOfPOA[Study->StudyId()] = _poa;
+
// Register study in the naming service
// Path to acces the study
if(!_name_service->Change_Directory("/Study")) MESSAGE( "Unable to access the study directory" )
else _name_service->Register(Study, CORBA::string_dup(aStudyImpl->Name().c_str()));
- return Study;
+ return Study._retn();
}
SALOMEDS::unlock();
aStudy->Close();
SALOMEDS::lock();
+
+ //remove study servant
+ PortableServer::POA_ptr poa=GetPOA(aStudy);
+ PortableServer::ServantBase* aservant=poa->reference_to_servant(aStudy);
+ PortableServer::ObjectId_var anObjectId = poa->servant_to_id(aservant);
+ poa->deactivate_object(anObjectId.in());
+ aservant->_remove_ref(); // decrement for the call to reference_to_servant
+ aservant->_remove_ref(); // to delete the object
}
//============================================================================
return SALOMEDS::Study::_nil();
}
- SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb);
- SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(aStudy_servant->_this());
-
- return aStudy._retn();
+ SALOMEDS_Study_i* aStudy_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb);
+ return aStudy_servant->_this();
}
//============================================================================
return SALOMEDS::Study::_nil();
}
- SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb);
- CORBA::Object_var obj = aStudy_servant->_this();
- SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(obj);
-
- return aStudy._retn();
+ SALOMEDS_Study_i* aStudy_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb);
+ return aStudy_servant->_this();
}
SALOMEDS::Study_var aStudy = theObject->GetStudy();
SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID());
+ CORBA::String_var anID = theObject->GetID();
+ SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in());
SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
bool ret = _impl->CanCopy(anObject, aDriver);
SALOMEDS::Study_var aStudy = theObject->GetStudy();
SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID());
+ CORBA::String_var anID = theObject->GetID();
+ SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in());
SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
bool ret = _impl->Copy(anObject, aDriver);
SALOMEDS::Study_var aStudy = theObject->GetStudy();
SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID());
+ CORBA::String_var anID = theObject->GetID();
+ SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in());
SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
bool ret = _impl->CanPaste(anObject, aDriver);
SALOMEDS::Study_var aStudy = theObject->GetStudy();
SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID());
+ CORBA::String_var anID = theObject->GetID();
+ SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in());
SALOMEDSImpl_SObject aNewSO;
try {
//
#include "utilities.h"
#include "SALOMEDS_Study_i.hxx"
+#include "SALOMEDS_StudyManager_i.hxx"
#include "SALOMEDS_UseCaseIterator_i.hxx"
#include "SALOMEDS_GenericAttribute_i.hxx"
#include "SALOMEDS_AttributeStudyProperties_i.hxx"
using namespace std;
+std::map<SALOMEDSImpl_Study* , SALOMEDS_Study_i*> SALOMEDS_Study_i::_mapOfStudies;
+
//============================================================================
/*! Function : SALOMEDS_Study_i
* Purpose : SALOMEDS_Study_i constructor
//============================================================================
SALOMEDS_Study_i::~SALOMEDS_Study_i()
{
+ //delete the builder servant
+ PortableServer::POA_var poa=_builder->_default_POA();
+ PortableServer::ObjectId_var anObjectId = poa->servant_to_id(_builder);
+ poa->deactivate_object(anObjectId.in());
+ _builder->_remove_ref();
+
+ //delete implementation
+ delete _impl;
+ _mapOfStudies.erase(_impl);
}
//============================================================================
{
SALOMEDS::Locker lock;
- SALOMEDSImpl_SObject aSO = _impl->GetSObject(theSO->GetID());
+ CORBA::String_var anID=theSO->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetSObject(anID.in());
SALOMEDSImpl_ChildIterator anItr(aSO);
//Create iterator
SALOMEDS_ChildIterator_i* it_servant = new SALOMEDS_ChildIterator_i(anItr, _orb);
- SALOMEDS::ChildIterator_var it = SALOMEDS::ChildIterator::_narrow(it_servant->_this());
- return it;
+ return it_servant->_this();
}
return SALOMEDS::Study::_nil();
}
+SALOMEDS_Study_i* SALOMEDS_Study_i::GetStudyServant(SALOMEDSImpl_Study* aStudyImpl, CORBA::ORB_ptr orb)
+{
+ if (_mapOfStudies.find(aStudyImpl) != _mapOfStudies.end())
+ return _mapOfStudies[aStudyImpl];
+ else
+ {
+ SALOMEDS_Study_i *Study_servant = new SALOMEDS_Study_i(aStudyImpl, orb);
+ _mapOfStudies[aStudyImpl]=Study_servant;
+ return Study_servant;
+ }
+}
+
void SALOMEDS_Study_i::IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute)
{
SALOMEDS::Locker lock;
SALOMEDS::SComponentIterator_var itcomponent = NewComponentIterator();
for (; itcomponent->More(); itcomponent->Next()) {
SALOMEDS::SComponent_var sco = itcomponent->Value();
- MESSAGE ( "Look for an engine for data type :"<< sco->ComponentDataType());
+ CORBA::String_var compodatatype=sco->ComponentDataType();
+ MESSAGE ( "Look for an engine for data type :"<< compodatatype);
// if there is an associated Engine call its method for closing
CORBA::String_var IOREngine;
if (sco->ComponentIOR(IOREngine)) {
// we have found the associated engine to write the data
- MESSAGE ( "We have found an engine for data type :"<< sco->ComponentDataType());
+ MESSAGE ( "We have found an engine for data type :"<< compodatatype);
//_narrow can throw a corba exception
try
{
catch (CORBA::Exception&)
{/*pass*/ }
}
+ sco->Destroy();
}
+ //Does not need any more this iterator
+ itcomponent->Destroy();
+
+
_impl->Close();
}
SALOMEDSImpl_GenericVariable::BOOLEAN_VAR);
}
+//============================================================================
+/*! Function : SetString
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::SetString(const char* theVarName, const char* theValue)
+{
+ _impl->SetStringVariable(string(theVarName),
+ theValue,
+ SALOMEDSImpl_GenericVariable::STRING_VAR);
+}
+
+//============================================================================
+/*! Function : SetStringAsDouble
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDS_Study_i::SetStringAsDouble(const char* theVarName, CORBA::Double theValue)
+{
+ _impl->SetStringVariableAsDouble(string(theVarName),
+ theValue,
+ SALOMEDSImpl_GenericVariable::STRING_VAR);
+}
+
//============================================================================
/*! Function : GetReal
* Purpose :
return (bool)_impl->GetVariableValue(string(theVarName));
}
+//============================================================================
+/*! Function : GetString
+ * Purpose :
+ */
+//============================================================================
+char* SALOMEDS_Study_i::GetString(const char* theVarName)
+{
+ return CORBA::string_dup(_impl->GetStringVariableValue(string(theVarName)).c_str());
+}
+
//============================================================================
/*! Function : IsReal
* Purpose :
SALOMEDSImpl_GenericVariable::BOOLEAN_VAR);
}
+//============================================================================
+/*! Function : IsString
+ * Purpose :
+ */
+//============================================================================
+CORBA::Boolean SALOMEDS_Study_i::IsString(const char* theVarName)
+{
+ return _impl->IsTypeOf(string(theVarName),
+ SALOMEDSImpl_GenericVariable::STRING_VAR);
+}
+
//============================================================================
/*! Function : IsVariable
* Purpose :
class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study
{
private:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_Study* _impl;
SALOMEDS_StudyBuilder_i* _builder;
+ static std::map<SALOMEDSImpl_Study*, SALOMEDS_Study_i*> _mapOfStudies;
public:
virtual void StudyId(CORBA::Short id);
static SALOMEDS::Study_ptr GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb);
+ static SALOMEDS_Study_i* GetStudyServant(SALOMEDSImpl_Study*, CORBA::ORB_ptr orb);
static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute);
virtual void SetBoolean(const char* theVarName, CORBA::Boolean theValue);
+ virtual void SetString(const char* theVarName, const char* theValue);
+
+ virtual void SetStringAsDouble(const char* theVarName, CORBA::Double theValue);
+
virtual CORBA::Double GetReal(const char* theVarName);
virtual CORBA::Long GetInteger(const char* theVarName);
virtual CORBA::Boolean GetBoolean(const char* theVarName);
+ virtual char* GetString(const char* theVarName);
+
virtual CORBA::Boolean IsReal(const char* theVarName);
virtual CORBA::Boolean IsInteger(const char* theVarName);
virtual CORBA::Boolean IsBoolean(const char* theVarName);
+ virtual CORBA::Boolean IsString(const char* theVarName);
+
virtual CORBA::Boolean IsVariable(const char* theVarName);
virtual SALOMEDS::ListOfStrings* GetVariableNames();
{
private:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_UseCaseBuilder* _impl;
public:
public virtual SALOME::GenericObj_i
{
private:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_UseCaseIterator* _impl;
public:
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-I$(srcdir)/$(RPATH)/SALOMEDSClient \
-I$(srcdir)/$(RPATH)/DF \
-I$(srcdir)/$(RPATH)/SALOMEDSImpl -I$(srcdir)/$(RPATH)/SALOMEDSImpl/Test \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# This local variable defines the list of CPPFLAGS common to all target in this package.
COMMON_CPPFLAGS= \
@BOOST_CPPFLAGS@ \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
virtual void SetReal(const std::string& theVarName, const double theValue) = 0;
virtual void SetInteger(const std::string& theVarName, const int theValue) = 0;
virtual void SetBoolean(const std::string& theVarName, const bool theValue) = 0;
+ virtual void SetString(const std::string& theVarName, const std::string& theValue) = 0;
+ virtual void SetStringAsDouble(const std::string& theVarName, const double theValue) = 0;
virtual double GetReal(const std::string& theVarName) = 0;
virtual int GetInteger(const std::string& theVarName) = 0;
virtual bool GetBoolean(const std::string& theVarName) = 0;
+ virtual std::string GetString(const std::string& theVarName) = 0;
virtual bool IsReal(const std::string& theVarName) = 0;
virtual bool IsInteger(const std::string& theVarName) = 0;
virtual bool IsBoolean(const std::string& theVarName) = 0;
+ virtual bool IsString(const std::string& theVarName) = 0;
virtual bool IsVariable(const std::string& theVarName) = 0;
virtual std::vector<std::string> GetVariableNames() = 0;
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../HDFPersist \
-I$(srcdir)/../DF \
+ -I$(srcdir)/../GenericObj \
+ -I$(top_builddir)/idl \
@HDF5_INCLUDES@ \
- @BOOST_CPPFLAGS@
+ @BOOST_CPPFLAGS@ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
../HDFPersist/libSalomeHDFPersist.la \
../DF/libDF.la \
+ ../GenericObj/libSalomeGenericObj.la \
@HDF5_LIBS@
libSalomeDSImpl_la_CPPFLAGS = $(COMMON_CPPFLAGS)
libSalomeDSImpl_la_LDFLAGS = -no-undefined -version-info=0:0:0
-libSalomeDSImpl_la_LIBADD = $(COMMON_LIBS)
+libSalomeDSImpl_la_LIBADD = $(COMMON_LIBS) $(CORBA_LIBS)
#
# ===============================================================
testDS_SOURCES = testDS.cxx
testDS_CPPFLAGS = $(COMMON_CPPFLAGS)
testDS_LDADD = libSalomeDSImpl.la \
- $(HDF5_LIBS)
+ $(HDF5_LIBS) $(CORBA_LIBS)
using namespace std;
+//to disable automatic genericobj management comment the following line
+#define WITHGENERICOBJ
+
+#ifdef WITHGENERICOBJ
+#include "SALOME_GenericObj_i.hh"
+
+static CORBA::ORB_var getORB()
+{
+ int argc=0;
+ return CORBA::ORB_init(argc,0);
+}
+
+void IORGenericObjDecref(const std::string& anIOR)
+{
+ CORBA::Object_var obj;
+ SALOME::GenericObj_var gobj;
+ try
+ {
+ obj = getORB()->string_to_object(anIOR.c_str());
+ if(obj->_non_existent())return;
+ gobj = SALOME::GenericObj::_narrow(obj);
+ if(! CORBA::is_nil(gobj) )
+ {
+ gobj->Destroy();
+ }
+ }
+ catch(const CORBA::Exception& e)
+ {
+ }
+}
+
+void IORGenericObjIncref(const std::string& anIOR)
+{
+ CORBA::Object_var obj;
+ SALOME::GenericObj_var gobj;
+ try
+ {
+ obj = getORB()->string_to_object(anIOR.c_str());
+ if(obj->_non_existent())return;
+ gobj = SALOME::GenericObj::_narrow(obj);
+ if(! CORBA::is_nil(gobj) )
+ {
+ gobj->Register();
+ }
+ }
+ catch(const CORBA::Exception& e)
+ {
+ }
+}
+#else
+void IORGenericObjDecref(const std::string& anIOR)
+{}
+void IORGenericObjIncref(const std::string& anIOR)
+{}
+#endif
+
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L,
- const std::string& S)
+ const std::string& S)
{
SALOMEDSImpl_AttributeIOR* A = NULL;
if (!(A=(SALOMEDSImpl_AttributeIOR*)L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
}
A->SetValue(S);
- SALOMEDSImpl_Study::IORUpdated(A);
return A;
}
{
CheckLocked();
- SALOMEDSImpl_Study::GetStudy(Label());
+ SALOMEDSImpl_Study* study=SALOMEDSImpl_Study::GetStudy(Label());
Backup();
+ //remove IOR entry in study
+ if(theValue != myString)
+ {
+ IORGenericObjIncref(theValue);
+ IORGenericObjDecref(myString);
+ study->DeleteIORLabelMapItem(myString);
+ }
+
myString = theValue;
+ //add IOR entry in study
SALOMEDSImpl_Study::IORUpdated(this);
}
{
}
+SALOMEDSImpl_AttributeIOR::~SALOMEDSImpl_AttributeIOR()
+{
+ IORGenericObjDecref(myString);
+}
+
//=======================================================================
//function : ID
//purpose :
void Restore(DF_Attribute* with);
DF_Attribute* NewEmpty() const;
void Paste(DF_Attribute* into);
- ~SALOMEDSImpl_AttributeIOR() {}
+ ~SALOMEDSImpl_AttributeIOR() ;
};
public:
//Supported types of the nootebook variables
- enum VariableTypes{REAL_VAR, INTEGER_VAR, BOOLEAN_VAR};
+ enum VariableTypes{REAL_VAR, INTEGER_VAR, BOOLEAN_VAR, STRING_VAR};
SALOMEDSImpl_GenericVariable(VariableTypes theType, const std::string& theName);
~SALOMEDSImpl_GenericVariable();
return true;
}
+//============================================================================
+/*! Function :
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_ScalarVariable::setStringValue(const string& theValue)
+{
+
+ if(myStrValue == theValue)
+ return false;
+
+ myStrValue = theValue;
+ return true;
+}
+
//============================================================================
/*! Function : getValue()
* Purpose :
return myValue;
}
+//============================================================================
+/*! Function : getStringValue()
+ * Purpose :
+ */
+//============================================================================
+string SALOMEDSImpl_ScalarVariable::getStringValue() const
+{
+ return myStrValue;
+}
+
//============================================================================
/*! Function : Save()
* Purpose :
sprintf(buffer, "%d", (int)myValue);
break;
}
+ case SALOMEDSImpl_GenericVariable::STRING_VAR:
+ {
+ sprintf(buffer, "\"%s\"", myStrValue.c_str());
+ break;
+ }
default:break;
}
return string(buffer);
sprintf(buffer, "%s", "False");
break;
}
+ case SALOMEDSImpl_GenericVariable::STRING_VAR:
+ {
+ sprintf(buffer, "\"%s\"", myStrValue.c_str());
+ break;
+ }
default:break;
}
return string(buffer);
bool setValue(const double theValue);
double getValue() const;
+ bool setStringValue(const std::string& theValue);
+ std::string getStringValue() const;
+
virtual std::string Save() const;
virtual std::string SaveToScript() const;
virtual std::string SaveType() const;
private:
double myValue;
+ std::string myStrValue;
};
#define VARIABLE_SEPARATOR ':'
#define OPERATION_SEPARATOR '|'
-
//============================================================================
/*! Function : SALOMEDSImpl_Study
* Purpose : SALOMEDSImpl_Study constructor
*/
//============================================================================
SALOMEDSImpl_Study::SALOMEDSImpl_Study(const DF_Document* doc,
- const string& study_name)
+ const string& study_name)
{
_name = study_name;
_doc = (DF_Document*)doc;
*/
//============================================================================
SALOMEDSImpl_Study::~SALOMEDSImpl_Study()
-{}
+{
+ delete _builder;
+ delete _cb;
+ delete _useCaseBuilder;
+}
//============================================================================
/*! Function : GetPersistentReference
ID = SC.GetID();
if(aComponentID == ID)
{
- // ComponentID found
- _find = true;
+ // ComponentID found
+ _find = true;
compo = SC;
}
}
for (; it.More();it.Next()){
if(!_find)
{
- SALOMEDSImpl_SComponent SC = it.Value();
- if (SC.GetName() == anObjectName)
- {
- _find = true;
- RefSO = SC;
-
- }
- if (!_find) RefSO = _FindObject(SC, anObjectName, _find);
+ SALOMEDSImpl_SComponent SC = it.Value();
+ if (SC.GetName() == anObjectName)
+ {
+ _find = true;
+ RefSO = SC;
+
+ }
+ if (!_find) RefSO = _FindObject(SC, anObjectName, _find);
}
}
if(!RefSO) _errorCode = "No object was found";
*/
//============================================================================
vector<SALOMEDSImpl_SObject> SALOMEDSImpl_Study::FindObjectByName(const string& anObjectName,
- const string& aComponentName)
+ const string& aComponentName)
{
_errorCode = "";
SALOMEDSImpl_SObject CSO = it.Value();
if ( CSO.GetName() == anObjectName ) {
- /* add to list */
- listSO.push_back(CSO) ;
+ /* add to list */
+ listSO.push_back(CSO) ;
}
/* looks also for eventual children */
for ( ; anIterator.More(); anIterator.Next() ) {
aLabel = anIterator.Value();
if((anAttr=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
- if(anAttr->Value() == aToken) {
- if(i == (len-1)) { //The searched label is found (no part of the path is left)
- return GetSObject(aLabel);
- }
-
- anIterator.Init(aLabel, false);
- break;
- }
+ if(anAttr->Value() == aToken) {
+ if(i == (len-1)) { //The searched label is found (no part of the path is left)
+ return GetSObject(aLabel);
+ }
+
+ anIterator.Init(aLabel, false);
+ break;
+ }
}
}
if(aFather) {
aName = aFather.GetName();
if(!aName.empty() && aName != "") {
- aValue = GetObjectPath(aFather);
- aPath = aValue + aPath;
+ aValue = GetObjectPath(aFather);
+ aPath = aValue + aPath;
}
}
}
SALOMEDSImpl_AttributeLocalID* anID;
if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) {
if (anID->Value() == DIRECTORYID) {
- SALOMEDSImpl_AttributeName* aName;
- if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
- aResultSeq.push_back(aName->Value());
- }
+ SALOMEDSImpl_AttributeName* aName;
+ if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
+ aResultSeq.push_back(aName->Value());
+ }
}
}
}
SALOMEDSImpl_AttributeLocalID* anID;
if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) {
if (anID->Value() == FILELOCALID) {
- SALOMEDSImpl_AttributePersistentRef* aName;
- if ((aName=(SALOMEDSImpl_AttributePersistentRef*)aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
- std::string aFileName = aName->Value();
- if (aFileName.size() > 0)
- aResultSeq.push_back(aFileName.substr(strlen(FILEID), aFileName.size()));
- }
+ SALOMEDSImpl_AttributePersistentRef* aName;
+ if ((aName=(SALOMEDSImpl_AttributePersistentRef*)aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
+ std::string aFileName = aName->Value();
+ if (aFileName.size() > 0)
+ aResultSeq.push_back(aFileName.substr(strlen(FILEID), aFileName.size()));
+ }
}
}
}
*/
//============================================================================
SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObject(const SALOMEDSImpl_SObject& SO,
- const string& theObjectName,
- bool& _find)
+ const string& theObjectName,
+ bool& _find)
{
SALOMEDSImpl_SObject RefSO;
if(!SO) return RefSO;
for (; it.More(); it.Next()){
if(!_find)
{
- if ((anAttr=(SALOMEDSImpl_AttributeName*)it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
- {
+ if ((anAttr=(SALOMEDSImpl_AttributeName*)it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
+ {
string Val(anAttr->Value());
- if (Val == theObjectName)
- {
- RefSO = GetSObject(it.Value());
- _find = true;
- }
- }
- if (!_find) RefSO = _FindObject(GetSObject(it.Value()), theObjectName, _find);
+ if (Val == theObjectName)
+ {
+ RefSO = GetSObject(it.Value());
+ _find = true;
+ }
+ }
+ if (!_find) RefSO = _FindObject(GetSObject(it.Value()), theObjectName, _find);
}
}
return RefSO;
//============================================================================
SALOMEDSImpl_SObject
SALOMEDSImpl_Study::_FindObjectIOR(const SALOMEDSImpl_SObject& SO,
- const string& theObjectIOR,
- bool& _find)
+ const string& theObjectIOR,
+ bool& _find)
{
SALOMEDSImpl_SObject RefSO, aSO;
if(!SO) return RefSO;
for (; it.More();it.Next()){
if(!_find)
{
- if ((anAttr=(SALOMEDSImpl_AttributeIOR*)it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID())))
- {
+ if ((anAttr=(SALOMEDSImpl_AttributeIOR*)it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID())))
+ {
string Val(anAttr->Value());
- if (Val == theObjectIOR)
- {
- RefSO = GetSObject(it.Value());
- _find = true;
- }
- }
- aSO = GetSObject(it.Value());
- if (!_find) RefSO = _FindObjectIOR(aSO, theObjectIOR, _find);
+ if (Val == theObjectIOR)
+ {
+ RefSO = GetSObject(it.Value());
+ _find = true;
+ }
+ }
+ aSO = GetSObject(it.Value());
+ if (!_find) RefSO = _FindObjectIOR(aSO, theObjectIOR, _find);
}
}
return RefSO;
myIORLabels[anIOR] = aLabel;
}
+void SALOMEDSImpl_Study::DeleteIORLabelMapItem(const std::string& anIOR)
+{
+ if (myIORLabels.find(anIOR) != myIORLabels.end())
+ {
+ //remove the ior entry and decref the genericobj (if it's one)
+ myIORLabels.erase(anIOR);
+ }
+}
+
SALOMEDSImpl_Study* SALOMEDSImpl_Study::GetStudy(const DF_Label& theLabel)
{
SALOMEDSImpl_StudyHandle* Att;
char aDate[20];
sprintf(aDate, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
(int)(aDays[anIndex]), (int)(aMonths[anIndex]), (int)(aYears[anIndex]),
- (int)(aHours[anIndex]), (int)(aMinutes[anIndex]));
+ (int)(aHours[anIndex]), (int)(aMinutes[anIndex]));
aDates.push_back(aDate);
}
return aDates;
*/
//============================================================================
DF_Attribute* SALOMEDSImpl_Study::GetAttribute(const string& theEntry,
- const string& theType)
+ const string& theType)
{
SALOMEDSImpl_SObject aSO = GetSObject(theEntry);
DF_Attribute* anAttr;
*/
//============================================================================
bool SALOMEDSImpl_Study::DumpStudy(const string& thePath,
- const string& theBaseName,
- bool isPublished,
- SALOMEDSImpl_DriverFactory* theFactory)
+ const string& theBaseName,
+ bool isPublished,
+ SALOMEDSImpl_DriverFactory* theFactory)
{
_errorCode = "";
//Output to the main Study script required Python modules import,
//set sys.path and add a creation of the study.
+ fp << "# -*- coding: iso-8859-1 -*-\n" << endl;
+
fp << GetDumpStudyComment() << endl << endl;
fp << "import sys" << endl;
- fp << "import os.path" << endl;
fp << "import " << aBatchModeScript << endl << endl;
fp << aBatchModeScript << ".salome_init()" << endl << endl;
- fp << _GetNoteBookAccess() << endl;
+ fp << _GetNoteBookAccess();
- // IPAL21005 (Dump/load python script works only with absolute path)
- // try to use '__file__' to get an absolute path to the generated scripts
- // or use the path passed to this method (case of using execfile() command)
- fp << "#Get absolute path to generated scripts:" << endl;
- fp << "try:" << endl;
- fp << " absPath = os.path.dirname(__file__)" << endl;
- fp << "except NameError:" << endl;
- fp << " absPath = \'" << thePath << "\'" << endl;
- fp << " pass" << endl;
- fp << "sys.path.insert( 0, absPath )" << endl << endl;
- //fp << "sys.path.insert( 0, \'" << thePath << "\')" << endl << endl;
+ fp << "sys.path.insert( 0, r\'" << thePath << "\')" << endl << endl;
//Dump NoteBook Variables
fp << _GetStudyVariablesScript();
string IOREngine;
try {
if (!sco.ComponentIOR(IOREngine)) {
- if (!aCompType.empty()) {
-
- aDriver = theFactory->GetDriverByType(aCompType);
-
- if (aDriver != NULL) {
- SALOMEDSImpl_StudyBuilder* SB = NewBuilder();
- if(!SB->LoadWith(sco, aDriver)) {
- _errorCode = SB->GetErrorCode();
- return false;
- }
- }
- else continue;
- }
+ if (!aCompType.empty()) {
+
+ aDriver = theFactory->GetDriverByType(aCompType);
+
+ if (aDriver != NULL) {
+ SALOMEDSImpl_StudyBuilder* SB = NewBuilder();
+ if(!SB->LoadWith(sco, aDriver)) {
+ _errorCode = SB->GetErrorCode();
+ return false;
+ }
+ }
+ else continue;
+ }
}
else {
- aDriver = theFactory->GetDriverByIOR(IOREngine);
+ aDriver = theFactory->GetDriverByIOR(IOREngine);
}
} catch(...) {
_errorCode = "Can not restore information to dump it";
}
void dumpSO(const SALOMEDSImpl_SObject& theSO,
- fstream& fp,
- const string& Tab,
- SALOMEDSImpl_Study* theStudy);
+ fstream& fp,
+ const string& Tab,
+ SALOMEDSImpl_Study* theStudy);
//============================================================================
/*! Function : dump
void dumpSO(const SALOMEDSImpl_SObject& theSO,
- fstream& fp,
- const string& Tab,
- SALOMEDSImpl_Study* theStudy)
+ fstream& fp,
+ const string& Tab,
+ SALOMEDSImpl_Study* theStudy)
{
string aTab(Tab), anID(theSO.GetID());
fp << aTab << anID << endl;
*/
//============================================================================
SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetModuleParameters(const char* theID,
- const char* theModuleName,
- int theSavePoint)
+ const char* theModuleName,
+ int theSavePoint)
{
if(theSavePoint <= 0) return NULL;
SALOMEDSImpl_AttributeParameter* main_ap = GetCommonParameters(theID, theSavePoint);
Modify();
}
+//============================================================================
+/*! Function : SetStringVariable
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDSImpl_Study::SetStringVariable(const string& theVarName,
+ const string& theValue,
+ const SALOMEDSImpl_GenericVariable::VariableTypes theType)
+{
+ bool modified = false;
+ SALOMEDSImpl_GenericVariable* aGVar = GetVariable(theVarName);
+
+ if( aGVar == NULL ) {
+
+ SALOMEDSImpl_ScalarVariable* aSVar = new SALOMEDSImpl_ScalarVariable(theType, theVarName);
+
+ aSVar->setStringValue(theValue);
+ myNoteBookVars.push_back(aSVar);
+ modified = true;
+ }
+ else {
+ if(SALOMEDSImpl_ScalarVariable* aSVar = dynamic_cast<SALOMEDSImpl_ScalarVariable*>(aGVar)) {
+ modified = aSVar->setStringValue(theValue) || modified;
+ modified = aSVar->setType(theType) || modified;
+ }
+ }
+ if(modified)
+ Modify();
+}
+
+//============================================================================
+/*! Function : SetStringVariableAsDouble
+ * Purpose :
+ */
+//============================================================================
+void SALOMEDSImpl_Study::SetStringVariableAsDouble(const string& theVarName,
+ const double theValue,
+ const SALOMEDSImpl_GenericVariable::VariableTypes theType)
+{
+ SALOMEDSImpl_GenericVariable* aGVar = GetVariable(theVarName);
+ if(SALOMEDSImpl_ScalarVariable* aSVar = dynamic_cast<SALOMEDSImpl_ScalarVariable*>(aGVar))
+ aSVar->setValue(theValue);
+}
+
//============================================================================
/*! Function : GetReal
* Purpose :
return 0;
}
+//============================================================================
+/*! Function : GetString
+ * Purpose :
+ */
+//============================================================================
+string SALOMEDSImpl_Study::GetStringVariableValue(const string& theVarName)
+{
+ SALOMEDSImpl_GenericVariable* aGVar = GetVariable(theVarName);
+
+ if(aGVar != NULL )
+ if(SALOMEDSImpl_ScalarVariable* aSVar = dynamic_cast<SALOMEDSImpl_ScalarVariable*>(aGVar))
+ return aSVar->getStringValue();
+
+ return 0;
+}
+
//============================================================================
/*! Function : IsTypeOf
* Purpose :
*/
//============================================================================
bool SALOMEDSImpl_Study::FindVariableAttribute(SALOMEDSImpl_StudyBuilder* theStudyBuilder,
- SALOMEDSImpl_SObject theSObject,
- const std::string& theName)
+ SALOMEDSImpl_SObject theSObject,
+ const std::string& theName)
{
SALOMEDSImpl_ChildIterator anIter = NewChildIterator( theSObject );
for( ; anIter.More(); anIter.Next() )
vector< vector<string> > aSections = ParseVariables( aString );
for( int i = 0, n = aSections.size(); i < n; i++ )
{
- vector<string> aVector = aSections[i];
- for( int j = 0, m = aVector.size(); j < m; j++ )
- {
- string aStr = aVector[j];
- if( aStr.compare( theName ) == 0 )
- return true;
- }
+ vector<string> aVector = aSections[i];
+ for( int j = 0, m = aVector.size(); j < m; j++ )
+ {
+ string aStr = aVector[j];
+ if( aStr.compare( theName ) == 0 )
+ return true;
+ }
}
}
}
*/
//============================================================================
void SALOMEDSImpl_Study::ReplaceVariableAttribute(SALOMEDSImpl_StudyBuilder* theStudyBuilder,
- SALOMEDSImpl_SObject theSObject,
- const std::string& theSource,
- const std::string& theDest)
+ SALOMEDSImpl_SObject theSObject,
+ const std::string& theSource,
+ const std::string& theDest)
{
SALOMEDSImpl_ChildIterator anIter = NewChildIterator( theSObject );
for( ; anIter.More(); anIter.Next() )
vector< vector<string> > aSections = ParseVariables( aCurrentString );
for( int i = 0, n = aSections.size(); i < n; i++ )
{
- vector<string> aVector = aSections[i];
- for( int j = 0, m = aVector.size(); j < m; j++ )
- {
- string aStr = aVector[j];
- if( aStr.compare( theSource ) == 0 )
- {
- isChanged = true;
- aStr = theDest;
- }
-
- aNewString.append( aStr );
- if( j != m - 1 )
- aNewString.append( ":" );
- }
- if( i != n - 1 )
- aNewString.append( "|" );
+ vector<string> aVector = aSections[i];
+ for( int j = 0, m = aVector.size(); j < m; j++ )
+ {
+ string aStr = aVector[j];
+ if( aStr.compare( theSource ) == 0 )
+ {
+ isChanged = true;
+ aStr = theDest;
+ }
+
+ aNewString.append( aStr );
+ if( j != m - 1 )
+ aNewString.append( ":" );
+ }
+ if( i != n - 1 )
+ aNewString.append( "|" );
}
if( isChanged )
- aStringAttr->SetValue( aNewString );
+ aStringAttr->SetValue( aNewString );
}
}
}
virtual void StudyId(int id);
+ virtual void DeleteIORLabelMapItem(const std::string& anIOR);
virtual void UpdateIORLabelMap(const std::string& anIOR, const std::string& aLabel);
virtual std::vector<SALOMEDSImpl_SObject> FindDependances(const SALOMEDSImpl_SObject& anObject);
const double theValue,
const SALOMEDSImpl_GenericVariable::VariableTypes);
+ void SetStringVariable(const std::string& theVarName,
+ const std::string& theValue,
+ const SALOMEDSImpl_GenericVariable::VariableTypes);
+
+ void SetStringVariableAsDouble(const std::string& theVarName,
+ const double theValue,
+ const SALOMEDSImpl_GenericVariable::VariableTypes);
+
double GetVariableValue(const std::string& theVarName);
+ std::string GetStringVariableValue(const std::string& theVarName);
+
bool IsTypeOf(const std::string& theVarName,
SALOMEDSImpl_GenericVariable::VariableTypes theType) const;
#include <HDFOI.hxx>
#include <stdlib.h>
+#include <string.h>
using namespace std;
SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map
if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ _study->DeleteIORLabelMapItem(anAttr->Value());
}
Lab.ForgetAllAttributes();
}
SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map
if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ _study->DeleteIORLabelMapItem(anAttr->Value());
}
DF_ChildIterator it(Lab, true);
}
SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map
if ((anAttr=(SALOMEDSImpl_AttributeIOR*)aLabel.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ _study->DeleteIORLabelMapItem(anAttr->Value());
}
}
if (aTypeOfAttribute == string("AttributeIOR")) { // Remove from IORLabel map
SALOMEDSImpl_AttributeIOR* anAttr = NULL;
if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ _study->DeleteIORLabelMapItem(anAttr->Value());
}
}
#include "HDFOI.hxx"
#include <iostream>
#include <stdlib.h>
+#include <string.h>
+
+#ifdef WIN32
+#include <Windows.h>
+#endif
+
+//Warning undef of Ascii Winwows define
+#ifdef WIN32
+# undef GetUserName
+#endif
using namespace std;
//============================================================================
SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager()
{
+ _appli->Close(_clipboard);
// Destroy application
delete _appli;
}
}
aStudy->Close();
+ DF_Document* doc=aStudy->GetDocument();
+ _appli->Close(doc);
}
//============================================================================
* Purpose : save the study in HDF file
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl,
+bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aStudyUrl,
SALOMEDSImpl_Study* aStudy,
SALOMEDSImpl_DriverFactory* aFactory,
bool theMultiFile,
return false;
}
+ //Create a temporary url to which the study is saved
+ string aUrl = SALOMEDSImpl_Tool::GetTmpDir() + SALOMEDSImpl_Tool::GetNameFromPath(aStudyUrl);
+
int aLocked = aStudy->GetProperties()->IsLocked();
if (aLocked) aStudy->GetProperties()->SetLocked(false);
}
string anOldName = aStudy->Name();
- aStudy->URL(aUrl);
+ aStudy->URL(aStudyUrl);
// To change for Save
// Do not have to do a new file but just a Open??? Rewrite all informations after erasing evrything??
if (theASCII) { // save file in ASCII format
HDFascii::ConvertFromHDFToASCII(aUrl.c_str(), true);
}
+
+ //Now it's necessary to copy files from the temporary directory to the user defined directory.
+
+ // The easiest way to get a list of file in the temporary directory
+
+ string aCmd, aTmpFileDir = SALOMEDSImpl_Tool::GetTmpDir();
+ string aTmpFile = aTmpFileDir +"files";
+ string aStudyTmpDir = SALOMEDSImpl_Tool::GetDirFromPath(aUrl);
+
+#ifdef WIN32
+ aCmd = "dir /B \"" + aStudyTmpDir +"\" > " + aTmpFile;
+#else
+ aCmd ="ls -1 \"" + aStudyTmpDir +"\" > " + aTmpFile;
+#endif
+ system(aCmd.c_str());
+
+ // Iterate and move files in the temporary directory
+ FILE* fp = fopen(aTmpFile.c_str(), "r");
+ if(!fp) return false;
+ char* buffer = new char[2047];
+ while(!feof(fp)) {
+ if((fgets(buffer, 2046, fp)) == NULL) break;
+ size_t aLen = strlen(buffer);
+ if(buffer[aLen-1] == '\n') buffer[aLen-1] = char(0);
+#ifdef WIN32
+ aCmd = "move /Y \"" + aStudyTmpDir + string(buffer) + "\" \"" + SALOMEDSImpl_Tool::GetDirFromPath(aStudyUrl) +"\"";
+#else
+ aCmd = "mv -f \"" + aStudyTmpDir + string(buffer) + "\" \"" + SALOMEDSImpl_Tool::GetDirFromPath(aStudyUrl)+"\"";
+#endif
+ system(aCmd.c_str());
+ }
+
+ delete []buffer;
+ fclose(fp);
+
+ // Perform cleanup
+#ifdef WIN32
+ DeleteFileA(aTmpFile.c_str());
+#else
+ unlink(aTmpFile.c_str());
+#endif
+
+#ifdef WIN32
+ RemoveDirectoryA(aTmpFileDir.c_str());
+ RemoveDirectoryA(aStudyTmpDir.c_str());
+#else
+ rmdir(aTmpFileDir.c_str());
+ rmdir(aStudyTmpDir.c_str());
+#endif
return true;
}
{
#ifdef WIN32
if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
- if ( GetLastError () != ERROR_FILE_NOT_FOUND ) {
+ if ( GetLastError () == ERROR_FILE_NOT_FOUND ) {
return false;
}
}
// purpose : Returns the dir by the path
//============================================================================
string SALOMEDSImpl_Tool::GetDirFromPath(const string& thePath) {
- if (thePath.empty()) return "";
+#ifdef WIN32
+ string separator = "\\";
+#else
+ string separator = "/";
+#endif
- int pos = thePath.rfind('/');
string path;
- if(pos > 0) {
- path = thePath.substr(0, pos+1);
- }
- if(path.empty()) {
- pos = thePath.rfind('\\');
- if(pos > 0) path = thePath.substr(0, pos+1);
- }
- if(path.empty()) {
- pos = thePath.rfind('|');
- if(pos > 0) path = thePath.substr(0, pos+1);
- }
- if(path.empty()) {
- path = thePath+"/";
- }
-
+ if (!thePath.empty()) {
+ int pos = thePath.rfind('/');
+ if (pos < 0) pos = thePath.rfind('\\');
+ if (pos < 0) pos = thePath.rfind('|');
+
+ if (pos > 0)
+ path = thePath.substr(0, pos+1);
+ else
+ path = string(".") + separator;
+
#ifdef WIN32 //Check if the only disk letter is given as path
- if(path.size() == 2 && path[1] == ':') path +='\\';
+ if (path.size() == 2 && path[1] == ':') path += separator;
#endif
-
- for(int i = 0, len = path.size(); i<len; i++)
- if(path[i] == '|') path[i] = '/';
+
+ while ( (pos=path.find('|')) >= 0 )
+ path.replace(pos, 1, separator);
+ }
+
return path;
}
-I$(srcdir)/$(RPATH)/LifeCycleCORBA \
-I$(srcdir)/$(RPATH)/DF \
-I$(srcdir)/$(RPATH)/SALOMEDSImpl \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
libwith_loggerTraceCollector_la_CPPFLAGS =\
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
@CPPUNIT_INCLUDES@ \
-I$(srcdir)/$(RPATH)/Basics -I$(srcdir)/$(RPATH)/Basics/Test \
-I$(srcdir)/$(RPATH)/SALOMELocalTrace -I$(srcdir)/$(RPATH)/SALOMELocalTrace/Test\
- -I$(srcdir)/$(RPATH)/SALOMETraceCollector \
- -I$(top_builddir)/salome_adm/unix
+ -I$(srcdir)/$(RPATH)/SALOMETraceCollector
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-I$(srcdir)/../Basics \
-I$(srcdir)/../Utils \
-I$(srcdir)/../SALOMELocalTrace \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \
@HDF5_INCLUDES@ \
-I$(srcdir)/../Notification \
-I$(srcdir)/../ResourcesManager \
-I$(srcdir)/../Container \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-I$(srcdir)/../ResourcesManager \
-I$(srcdir)/../Container \
-I$(srcdir)/../MPIContainer \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
UnitTests_CPPFLAGS =\
@CPPUNIT_INCLUDES@ \
-I$(srcdir)/../Basics -I$(srcdir)/../Basics/Test \
- -I$(srcdir)/../SALOMELocalTrace -I$(srcdir)/../SALOMELocalTrace/Test \
- -I$(top_builddir)/salome_adm/unix
+ -I$(srcdir)/../SALOMELocalTrace -I$(srcdir)/../SALOMELocalTrace/Test
if CORBA_GEN
UnitTests_CPPFLAGS +=\
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
libOpUtil_la_CPPFLAGS = \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-I$(srcdir)/$(RPATH)/Basics -I$(srcdir)/$(RPATH)/Basics/Test \
-I$(srcdir)/$(RPATH)/SALOMELocalTrace -I$(srcdir)/$(RPATH)/SALOMELocalTrace/Test \
-I$(srcdir)/$(RPATH)/SALOMETraceCollector -I$(srcdir)/$(RPATH)/SALOMETraceCollector/Test \
- -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \
- -I$(top_builddir)/salome_adm/unix
+ -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
#! /usr/bin/env python
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
public :
SALOME_Exception( const char *text, const char *fileName=0, const unsigned int lineNumber=0 );
SALOME_Exception( const SALOME_Exception &ex );
- ~SALOME_Exception() throw ();
+ virtual ~SALOME_Exception() throw ();
friend std::ostream & operator<<( std::ostream &os , const SALOME_Exception &ex );
virtual const char *what( void ) const throw () ;
} ;
+# -*- coding: iso-8859-1 -*-
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,