From: barate Date: Tue, 22 Sep 2009 08:38:34 +0000 (+0000) Subject: Merged from V5_1_main X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bb9c8416ec8a94916a2f76e602fc54e917e17b29;p=modules%2Fkernel.git Merged from V5_1_main --- diff --git a/Makefile.am b/Makefile.am index 6d46bb852..8407412a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,7 +40,7 @@ endif DIST_SUBDIRS= salome_adm idl src doc bin resources -DISTCLEANFILES = a.out +DISTCLEANFILES = a.out local-install.sh salomeinclude_DATA = KERNEL_version.h diff --git a/bin/Makefile.am b/bin/Makefile.am index 000aeda4b..5ad8d82e4 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -50,6 +50,7 @@ dist_salomescript_SCRIPTS = \ runSalome \ runSalome.csh \ runSalome.ksh \ + runSalome.bat \ waitNS.sh # These files are python files diff --git a/bin/appli_clean.sh b/bin/appli_clean.sh index a5413a737..521940cd4 100644 --- a/bin/appli_clean.sh +++ b/bin/appli_clean.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, @@ -21,5 +21,31 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # #clean appli -# -rm -rf bin lib share doc idl env.d envd USERS getAppliPath.py searchFreePort.sh runAppli runConsole runSession runRemote.sh runTests SalomeApp.xml *.pyc *~ .bashrc + +DELCOM="rm -rf bin lib share doc idl env.d envd USERS getAppliPath.py searchFreePort.sh runAppli runConsole runSession runRemote.sh runTests SalomeApp.xml *.pyc *~ .bashrc" +DOIT="false" + +if [ $# > 0 ] +then + if [ "x$1" == "x-f" ] + then DOIT="true" + fi +fi + +if [ $DOIT == "false" ] +then + echo "Do you want to delete a SALOME application in this directory ? " `pwd` + echo "command to execute: " $DELCOM + echo "enter yes or no" + read ANSWER + echo "ANSWER="$ANSWER + if [ "x$ANSWER" == "xyes" ] + then + DOIT="true" + fi +fi + +if [ $DOIT == "true" ] +then + $DELCOM +fi diff --git a/bin/appli_gen.py b/bin/appli_gen.py index e6d035518..4e0220908 100644 --- a/bin/appli_gen.py +++ b/bin/appli_gen.py @@ -253,7 +253,7 @@ def install(prefix,config_file,verbose=0): command=""" - + """ diff --git a/bin/appli_install.sh b/bin/appli_install.sh index e587c1251..68e505a73 100644 --- a/bin/appli_install.sh +++ b/bin/appli_install.sh @@ -58,7 +58,7 @@ fi VERSION=V3_2_0 -for module in KERNEL MED GUI GEOM SMESH VISU SUPERV LIGHT NETGENPLUGIN PYCALCULATOR; +for module in KERNEL MED GUI GEOM SMESH VISU LIGHT NETGENPLUGIN PYCALCULATOR; do echo " ========= " ${module}; python virtual_salome.py -v --prefix="." --module=$INSTALL_ROOT/${module}_${VERSION} diff --git a/bin/appliskel/SalomeApp.xml b/bin/appliskel/SalomeApp.xml index 7caea4e03..267d9272e 100644 --- a/bin/appliskel/SalomeApp.xml +++ b/bin/appliskel/SalomeApp.xml @@ -16,7 +16,7 @@ - + @@ -39,7 +39,6 @@ - @@ -62,10 +61,6 @@ -
- - -
diff --git a/bin/appliskel/env.d/envSalome.sh b/bin/appliskel/env.d/envSalome.sh index e85232ef1..b97e88343 100644 --- a/bin/appliskel/env.d/envSalome.sh +++ b/bin/appliskel/env.d/envSalome.sh @@ -35,7 +35,6 @@ export SalomeAppConfig=${HOME}/${APPLI} export GEOM_ROOT_DIR=${REPINST}/GEOM_V301 export MED_ROOT_DIR=${REPINST}/MED_V301 export SMESH_ROOT_DIR=${REPINST}/SMESH_V301 -export SUPERV_ROOT_DIR=${REPINST}/SUPERV_V301 export VISU_ROOT_DIR=${REPINST}/VISU_V301 export NETGENPLUGIN_ROOT_DIR=${REPINST}/NETGENPLUGIN_V301 export COMPONENT_ROOT_DIR=${REPINST}/COMPONENT_V301 diff --git a/bin/appliskel/runSession b/bin/appliskel/runSession index 716fbe6d9..ba6019c79 100755 --- a/bin/appliskel/runSession +++ b/bin/appliskel/runSession @@ -28,6 +28,39 @@ APPLI_HOME=`dirname $0` +NSPORT=last +NSHOST=localhost + +usage() +{ + echo "Connect to a SALOME session (local or remote)" + echo "" + echo "Usage: $(basename $0) [ -p PORT ] [ -m MACHINE ] [ -h ] [command]" + echo "" + echo " -p PORT : The port to connect to " + echo " -m MACHINE : The machine to connect to " + echo " -h : Print this message" + echo " command : The command to execute in the SALOME session" + echo "" + echo "If the command is not given a shell is opened" + echo "If PORT and MACHINE are not given, try to connect to the last active session on the local machine" + echo "If PORT and MACHINE are given, try to connect to the remote session associated with PORT on MACHINE" + echo "If MACHINE is not given, try to connect to the session associated to PORT on the local machine" + echo "If PORT is not given, try to connect to the remote session associated to port 2810 on MACHINE" + echo "" +} + +while getopts 'm:p:h' OPTION + do + case $OPTION in + m)NSHOST="$OPTARG" ;; + p)NSPORT="$OPTARG" ;; + h|?) usage + exit 1 ;; + esac + done +shift $(($OPTIND - 1)) + # --- retrieve APPLI path, relative to $HOME, set ${APPLI} export APPLI=`${APPLI_HOME}/getAppliPath.py` @@ -36,32 +69,47 @@ export APPLI=`${APPLI_HOME}/getAppliPath.py` . ${HOME}/${APPLI}/envd ${HOME}/${APPLI} -if test "x$1" == "xNSPORT"; then - NSPORT=$2 - export NSPORT - myhost=`hostname` - OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${myhost}_${NSPORT}.cfg - export OMNIORB_CONFIG - NSHOST=${myhost} - export NSHOST - shift 2 -else - - # --- set omniORB configuration to current session if any - - fileOmniConfig=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg - - if [ -f $fileOmniConfig ]; then - OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg +if test "x${NSPORT}" == "xlast"; then + #PORT is not given + if test "x${NSHOST}" == "xlocalhost"; then + #MACHINE and PORT are not given + # --- set omniORB configuration to current session if any + fileOmniConfig=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg + if [ -f $fileOmniConfig ]; then + OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg + export OMNIORB_CONFIG + # --- set environment variables for port and hostname of NamingService + NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host` + NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port` + export NSPORT + export NSHOST + fi + else + #MACHINE is given PORT is not given + NSPORT=2810 + OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${NSHOST}_${NSPORT}.cfg export OMNIORB_CONFIG - - # --- set environment variables for port and hostname of NamingService - - NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host` - export NSHOST - NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port` + #if omniorb config file exists do not override (perhaps too conservative) + if [ ! -f ${OMNIORB_CONFIG} ]; then + echo "InitRef = NameService=corbaname::${NSHOST}:${NSPORT}" > ${OMNIORB_CONFIG} + fi export NSPORT + export NSHOST + fi +else + #PORT is given + if test "x${NSHOST}" == "xlocalhost"; then + #MACHINE is not given PORT is given + NSHOST=`hostname` + fi + OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${NSHOST}_${NSPORT}.cfg + export OMNIORB_CONFIG + #if omniorb config file exists do not override (perhaps too conservative) + if [ ! -f ${OMNIORB_CONFIG} ]; then + echo "InitRef = NameService=corbaname::${NSHOST}:${NSPORT}" > ${OMNIORB_CONFIG} fi + export NSPORT + export NSHOST fi # --- invoke shell with or without args diff --git a/bin/envSalome.py b/bin/envSalome.py index 348c0a460..6908084d1 100755 --- a/bin/envSalome.py +++ b/bin/envSalome.py @@ -42,4 +42,11 @@ sys.argv = argv[1:] #runSalome.set_env(args, modules_list, modules_root_dir) setenv.main(True); +if sys.platform == "win32": + if len(argv) >= 2: + # Fix a problem of spaces in argv[1] + argv[1] = '"%s"'%(argv[1]) + pass + pass + os.execvp(argv[0],argv) diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 87630757e..004ac6b7a 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -56,6 +56,7 @@ batch_nam = "batch" test_nam = "test" play_nam = "play" gdb_session_nam = "gdb_session" +ddd_session_nam = "ddd_session" # values in XML configuration file giving specific module parameters ( section) # which are stored in opts with key _ (eg SMESH_plugins) @@ -69,7 +70,7 @@ script_nam = "pyscript" # possible choices for the "embedded" and "standalone" parameters embedded_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "SalomeAppEngine" ] -standalone_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "pyContainer", "supervContainer"] +standalone_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "pyContainer"] # values of boolean type (must be '0' or '1'). # xml_parser.boolValue() is used for correct setting @@ -451,7 +452,9 @@ def CreateOptionParser (theAdditionalOptions=[]): help_str = "Python script(s) to be imported. Python scripts are imported " help_str += "in the order of their appearance. In GUI mode python scripts " help_str += "are imported in the embedded python interpreter of current study, " - help_str += "otherwise in an external python interpreter" + help_str += "otherwise in an external python interpreter. " + help_str += "Note: this option is obsolete. Instead you can pass Python script(s) " + help_str += "directly as positional parameter." o_u = optparse.Option("-u", "--execute", metavar="", @@ -625,6 +628,13 @@ def CreateOptionParser (theAdditionalOptions=[]): dest="gdb_session", default=False, help=help_str) + # ddd session + help_str = "Launch session with ddd" + o_ddd = optparse.Option("--ddd-session", + action="store_true", + dest="ddd_session", default=False, + help=help_str) + # All options opt_list = [o_t,o_g, # GUI/Terminal o_d,o_o, # Desktop @@ -647,7 +657,9 @@ def CreateOptionParser (theAdditionalOptions=[]): o_nspl, o_test, # Write/read test script file with help of TestRecorder o_play, # Reproducing test script with help of TestRecorder - o_gdb] + o_gdb, + o_ddd, + ] #std_options = ["gui", "desktop", "log_file", "py_scripts", "resources", # "xterm", "modules", "embedded", "standalone", @@ -656,7 +668,7 @@ def CreateOptionParser (theAdditionalOptions=[]): opt_list += theAdditionalOptions - a_usage = "%prog [options] [STUDY_FILE]" + a_usage = "%prog [options] [STUDY_FILE] [PYTHON_FILE [PYTHON_FILE ...]]" version_str = "Salome %s" % version() pars = optparse.OptionParser(usage=a_usage, version=version_str, option_list=opt_list) @@ -851,8 +863,6 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): if args["session_gui"]: if cmd_opts.splash is not None: args[splash_nam] = cmd_opts.splash - if len(cmd_args) > 0: - args["study_hdf"] = cmd_args[0] else: args["session_gui"] = False args[splash_nam] = False @@ -874,6 +884,13 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): listlist = cmd_opts.py_scripts for listi in listlist: args[script_nam] += re.split( "[:;,]", listi) + for arg in cmd_args: + if arg[-3:] == ".py": + args[script_nam].append(arg) + elif not args["study_hdf"]: + args["study_hdf"] = arg + pass + pass # xterm if cmd_opts.xterm is not None: args[xterm_nam] = cmd_opts.xterm @@ -931,6 +948,10 @@ def get_env(theAdditionalOptions=[], appname="SalomeApp"): if cmd_opts.gdb_session is not None: args[gdb_session_nam] = cmd_opts.gdb_session + # Ddd session in xterm + if cmd_opts.ddd_session is not None: + args[ddd_session_nam] = cmd_opts.ddd_session + #################################################### # Add values to args for add_opt in theAdditionalOptions: diff --git a/bin/nameserver.py b/bin/nameserver.py index 32fa88627..e4ae95334 100755 --- a/bin/nameserver.py +++ b/bin/nameserver.py @@ -63,14 +63,6 @@ class NamingServer(Server): #print "Can't create " + upath pass - #os.system("touch " + upath + "/dummy") - for fname in os.listdir(upath): - try: - if not fname.startswith("."): os.remove(upath + "/" + fname) - except: - pass - #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log") - if verbose(): print "Name Service... ", #hname=os.environ["HOST"] #commands.getoutput("hostname") if sys.platform == "win32": @@ -89,6 +81,27 @@ class NamingServer(Server): #aPort=(ss.join().split(':'))[2]; #aPort=re.findall("\d+", ss[0])[0] + # \begin{E.A.} + # put the log files of omniNames in different directory with port reference, + # it is cleaner on linux and it is a fix for salome since it is impossible to + # remove the log files if the corresponding omniNames has not been killed. + # \end{E.A.} + + upath += "/omniNames_%s"%(aPort) + try: + os.mkdir(upath) + except: + #print "Can't create " + upath + pass + + #os.system("touch " + upath + "/dummy") + for fname in os.listdir(upath): + try: + os.remove(upath + "/" + fname) + except: + pass + #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log") + #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/" #print "sed command = ", aSedCommand #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"]) diff --git a/bin/orbmodule.py b/bin/orbmodule.py index d9aa08d7a..4b77a3b52 100755 --- a/bin/orbmodule.py +++ b/bin/orbmodule.py @@ -127,13 +127,13 @@ class client: # -------------------------------------------------------------------------- - def waitNS(self,name,typobj=None,maxcount=60): + def waitNS(self,name,typobj=None,maxcount=240): count=0 delta=0.5 print "Searching %s in Naming Service " % name, while(1): count += 1 - if count > maxcount : raise "Impossible de trouver %s" % name + if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name obj=self.Resolve(name) if obj : print " found in %s seconds " % ((count-1)*delta) @@ -160,7 +160,7 @@ class client: try: os.kill(thePID,0) except: - raise "Process %d for %s not found" % (thePID,theName) + raise RuntimeError, "Process %d for %s not found" % (thePID,theName) aCount += 1 anObj = self.Resolve(theName) if anObj: @@ -208,7 +208,7 @@ class client: print "Searching %s in Naming Service " % name, while(1): count += 1 - if count > maxcount : raise "Impossible de trouver %s" % name + if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name obj=self.ResolveLogger(name) if obj : print " found in %s seconds " % ((count-1)*delta) diff --git a/bin/runSalome b/bin/runSalome index b56fbc634..dba8a38de 100755 --- a/bin/runSalome +++ b/bin/runSalome @@ -32,7 +32,7 @@ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/ # - if the config file does not exist, it is created with default values. # # -# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,SUPERV,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer,supervContainer --xterm --killall +# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer --xterm --killall # # parameters from command line supersede those from SalomeApp.xml # @@ -40,7 +40,7 @@ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/ # (embedded = same process) or in a separate process (standalone): # --> registry,study,moduleCatalog,cppContainer # Other CORBA servers could only be launched in separate process (standalone): -# --> pyContainer,supervContainer +# --> pyContainer # # $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h # help diff --git a/bin/runSalome.bat b/bin/runSalome.bat new file mode 100644 index 000000000..127ca4b92 --- /dev/null +++ b/bin/runSalome.bat @@ -0,0 +1,23 @@ +@REM Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +@REM +@REM Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +@REM CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +@REM +@REM This library is free software; you can redistribute it and/or +@REM modify it under the terms of the GNU Lesser General Public +@REM License as published by the Free Software Foundation; either +@REM version 2.1 of the License. +@REM +@REM This library is distributed in the hope that it will be useful, +@REM but WITHOUT ANY WARRANTY; without even the implied warranty of +@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +@REM Lesser General Public License for more details. +@REM +@REM You should have received a copy of the GNU Lesser General Public +@REM License along with this library; if not, write to the Free Software +@REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +@REM +@REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +@REM + +@"%PYTHONBIN%" "%KERNEL_ROOT_DIR%\bin\salome\envSalome.py" "%PYTHONBIN%" "%KERNEL_ROOT_DIR%\bin\salome\runSalome.py" %* diff --git a/bin/runSalome.csh b/bin/runSalome.csh index e88c3fe6c..7a76d17e8 100755 --- a/bin/runSalome.csh +++ b/bin/runSalome.csh @@ -22,4 +22,4 @@ # -runSalome --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --killall +runSalome --gui --modules=GEOM,SMESH,VISU,MED --killall diff --git a/bin/runSalome.ksh b/bin/runSalome.ksh index 58d0edef6..719fb0576 100644 --- a/bin/runSalome.ksh +++ b/bin/runSalome.ksh @@ -75,7 +75,7 @@ fi # - if the config file does not exist, it is created with default values. # # -# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,SUPERV,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer,supervContainer --xterm --killall +# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer --xterm --killall # # parameters from command line supersede those from SalomeApp.xml # @@ -83,7 +83,7 @@ fi # (embedded = same process) or in a separate process (standalone): # --> registry,study,moduleCatalog,cppContainer # Other CORBA servers could only be launched in separate process (standalone): -# --> pyContainer,supervContainer +# --> pyContainer # # $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h # help @@ -96,4 +96,4 @@ fi # # ----------------------------------------------------------------------------- # Example on CCRT (without ihm) : -# ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --terminal --modules=MED,CALCULATOR,COMPONENT --standalone=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer --killall +# ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --terminal --modules=MED,CALCULATOR,COMPONENT --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall diff --git a/bin/runSalome.py b/bin/runSalome.py index f5b95927f..071340362 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -30,7 +30,7 @@ import orbmodule import setenv from server import * from launchConfigureParser import verbose -#process_id = {} move to server.py +from server import process_id # ----------------------------------------------------------------------------- @@ -80,7 +80,7 @@ def kill_salome(args): # ----------------------------------------------------------------------------- # -# Definition des classes d'objets pour le lancement des Server CORBA +# Class definitions to launch CORBA Servers # class InterpServer(Server): @@ -88,7 +88,6 @@ class InterpServer(Server): self.args=args env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("LD_LIBRARY_PATH")] self.CMD=['xterm', '-e']+ env_ld_library_path + ['python'] - #self.CMD=['xterm', '-e', 'python'] def run(self): global process_id @@ -195,17 +194,6 @@ class ContainerPYServer(Server): # --- -class ContainerSUPERVServer(Server): - def __init__(self,args): - self.args=args - self.initArgs() - # if sys.platform == "win32": -# self.CMD=[os.environ["KERNEL_ROOT_DIR"] + "/win32/" + os.environ["BIN_ENV"] + "/" + 'SALOME_Container' + ".exe",'SuperVisionContainer'] -# else: - self.CMD=['SALOME_Container','SuperVisionContainer'] - -# --- - class LoggerServer(Server): def __init__(self,args): self.args=args @@ -258,8 +246,6 @@ class SessionServer(Server): self.SCMD2+=['CPP'] if 'pyContainer' in self.args['standalone'] or 'pyContainer' in self.args['embedded']: self.SCMD2+=['PY'] - if 'supervContainer' in self.args['standalone']: - self.SCMD2+=['SUPERV'] if self.args['gui']: session_gui = True if self.args.has_key('session_gui'): @@ -320,7 +306,7 @@ class SessionServer(Server): elif self.args.has_key('play'): self.CMD+=['-play'] + self.args['play'] - if self.args["gdb_session"]: + if self.args["gdb_session"] or self.args["ddd_session"]: f = open(".gdbinit4salome", "w") f.write("set args ") args = " ".join(self.CMD[1:]) @@ -329,7 +315,11 @@ class SessionServer(Server): f.write(args) f.write("\n") f.close() - self.CMD = ["xterm", "-e", "gdb", "--command=.gdbinit4salome", self.CMD[0]] + if self.args["ddd_session"]: + self.CMD = ["ddd", "--command=.gdbinit4salome", self.CMD[0]] + elif self.args["gdb_session"]: + self.CMD = ["xterm", "-e", "gdb", "--command=.gdbinit4salome", self.CMD[0]] + pass pass # --- @@ -407,9 +397,6 @@ def startGUI(): import SALOME import SALOMEDS import SALOME_ModuleCatalog - reload(Engines) - reload(SALOME) - reload(SALOMEDS) import SALOME_Session_idl session=clt.waitNS("/Kernel/Session",SALOME.Session) session.GetInterface() @@ -423,7 +410,7 @@ def startSalome(args, modules_list, modules_root_dir): if verbose(): print "startSalome ", args # - # Initialisation ORB et Naming Service + # Initialisation ORB and Naming Service # clt=orbmodule.client(args) @@ -440,8 +427,8 @@ def startSalome(args, modules_list, modules_root_dir): f.write(os.environ['NSPORT']) f.close() - # (non obligatoire) Lancement Logger Server - # et attente de sa disponibilite dans le naming service + # Launch Logger Server (optional) + # and wait until it is registered in naming service # if args['logger']: @@ -458,7 +445,7 @@ def startSalome(args, modules_list, modules_root_dir): myServer=NotifyServer(args,modules_root_dir) myServer.run() - # Lancement Session Server (to show splash ASAP) + # Launch Session Server (to show splash ASAP) # if args["gui"]: @@ -467,8 +454,8 @@ def startSalome(args, modules_list, modules_root_dir): mySessionServ.run() # - # Lancement Registry Server, - # attente de la disponibilite du Registry dans le Naming Service + # Launch Registry Server, + # and wait until it is registered in naming service # if ('registry' not in args['embedded']) | (args["gui"] == 0) : @@ -480,10 +467,9 @@ def startSalome(args, modules_list, modules_root_dir): clt.waitNSPID("/Registry",myServer.PID) # - # Lancement Catalog Server, - # attente de la disponibilite du Catalog Server dans le Naming Service + # Launch Catalog Server, + # and wait until it is registered in naming service # - if ('moduleCatalog' not in args['embedded']) | (args["gui"] == 0): cataServer=CatalogServer(args) @@ -496,8 +482,8 @@ def startSalome(args, modules_list, modules_root_dir): clt.waitNSPID("/Kernel/ModulCatalog",cataServer.PID,SALOME_ModuleCatalog.ModuleCatalog) # - # Lancement SalomeDS Server, - # attente de la disponibilite du SalomeDS dans le Naming Service + # Launch SalomeDS Server, + # and wait until it is registered in naming service # #print "ARGS = ",args @@ -511,7 +497,7 @@ def startSalome(args, modules_list, modules_root_dir): clt.waitNSPID("/myStudyManager",myServer.PID) # - # Lancement LauncherServer + # Launch LauncherServer # myCmServer = LauncherServer(args) @@ -537,8 +523,8 @@ def startSalome(args, modules_list, modules_root_dir): theComputer = getShortHostName() # - # Lancement Container C++ local, - # attente de la disponibilite du Container C++ local dans le Naming Service + # Launch local C++ Container (FactoryServer), + # and wait until it is registered in naming service # if ('cppContainer' in args['standalone']) | (args["gui"] == 0) : @@ -550,9 +536,8 @@ def startSalome(args, modules_list, modules_root_dir): clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",myServer.PID) # - # Lancement Container Python local, - # attente de la disponibilite du Container Python local - # dans le Naming Service + # Launch local Python Container (FactoryServerPy), + # and wait until it is registered in naming service # if 'pyContainer' in args['standalone']: @@ -564,21 +549,7 @@ def startSalome(args, modules_list, modules_root_dir): clt.waitNSPID("/Containers/" + theComputer + "/FactoryServerPy",myServer.PID) # - # Lancement Container Supervision local, - # attente de la disponibilite du Container Supervision local - # dans le Naming Service - # - - if 'supervContainer' in args['standalone']: - myServer=ContainerSUPERVServer(args) - myServer.run() - if sys.platform == "win32": - clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer") - else: - clt.waitNSPID("/Containers/" + theComputer + "/SuperVisionContainer",myServer.PID) - - # - # Attente de la disponibilite du Session Server dans le Naming Service + # Wait until Session Server is registered in naming service # if args["gui"]: @@ -587,9 +558,6 @@ def startSalome(args, modules_list, modules_root_dir): import SALOME import SALOMEDS import SALOME_ModuleCatalog - reload(Engines) - reload(SALOME) - reload(SALOMEDS) import SALOME_Session_idl if sys.platform == "win32": session=clt.waitNS("/Kernel/Session",SALOME.Session) @@ -626,7 +594,7 @@ def startSalome(args, modules_list, modules_root_dir): anInterp=InterpServer(args) anInterp.run() - # set PYTHONINSPECT variable + # set PYTHONINSPECT variable (python interpreter in interactive mode) if args['pinter']: os.environ["PYTHONINSPECT"]="1" import readline @@ -678,7 +646,7 @@ def useSalome(args, modules_list, modules_root_dir): """%filedict # - # Impression arborescence Naming Service + # Print Naming Service directory list # if clt != None: @@ -699,13 +667,14 @@ def useSalome(args, modules_list, modules_root_dir): if toimport[ i ] == 'killall': clt.showNS() killAllPorts() - import sys sys.exit(0) else: scrname = toimport[ i ] if len(scrname) > 2 and (len(scrname) - string.rfind(scrname, ".py") == 3): print 'executing',scrname + sys.path.insert( 0, os.path.dirname(scrname)) execfile(scrname,globals()) + del sys.path[0] else: print 'importing',scrname doimport = 'import ' + scrname @@ -752,7 +721,7 @@ def searchFreePort(args, save_config=1): os.remove( tmp_file ); # def portIsUsed(port, data): - regObj = re.compile( "tcp.*:([0-9]+).*:.*listen", re.IGNORECASE ); + regObj = re.compile( ".*tcp.*:([0-9]+).*:.*listen", re.IGNORECASE ); for item in data: try: p = int(regObj.match(item).group(1)) @@ -834,7 +803,7 @@ def searchFreePort(args, save_config=1): msg = "\n" msg += "Can't find a free port to launch omniNames\n" msg += "Try to kill the running servers and then launch SALOME again.\n" - raise msg + raise RuntimeError, msg NSPORT=NSPORT+1 pass return @@ -856,7 +825,6 @@ def no_main(): def main(): """Salome launch as a main application""" - import sys from salome_utils import getHostName print "runSalome running on %s" % getHostName() args, modules_list, modules_root_dir = setenv.get_config() diff --git a/bin/salome.launch b/bin/salome.launch index 1b5bbdd1b..5c71df7ef 100644 --- a/bin/salome.launch +++ b/bin/salome.launch @@ -13,7 +13,6 @@ - @@ -26,6 +25,5 @@ pyContainer - supervContainer diff --git a/bin/salome_session.py b/bin/salome_session.py index be227c89f..021721af0 100644 --- a/bin/salome_session.py +++ b/bin/salome_session.py @@ -96,7 +96,7 @@ def searchFreePort(): msg = "" msg += "Can not find a free port to launch omniNames\n" msg += "Kill the running servers and try again.\n" - raise msg + raise RuntimeError, msg NSPORT = NSPORT+1 pass os.environ['NSHOST'] = hostname diff --git a/bin/salome_utils.py b/bin/salome_utils.py index 61d609273..54e3e9e3b 100644 --- a/bin/salome_utils.py +++ b/bin/salome_utils.py @@ -183,12 +183,12 @@ def getAppName(): # --- -def getPortNumber(): +def getPortNumber(use_default=True): """ Get current naming server port number: 1. try NSPORT environment variable 1. if fails, try to parse config file defined by OMNIORB_CONFIG environment variable - 2. if fails, return 2809 as default port number + 2. if fails, return 2809 as default port number (if use_default is True) or None (id use_default is False) """ import os try: @@ -197,7 +197,8 @@ def getPortNumber(): pass port = getPortFromORBcfg() if port is not None: return port - return 2809 # '2809' is default port number + if use_default: return 2809 # '2809' is default port number + return None # --- @@ -351,22 +352,40 @@ def generateFileName( dir, prefix = None, suffix = None, extension = None, # --- -def makeTmpDir( path ): +def makeTmpDir( path, mode=0777 ): """ Make temporary directory with the specified path. If the directory exists then clear its contents. Parameters: - path : absolute path to the directory to be created. + - mode : access mode """ import os - if os.path.exists( path ): - os.system( "rm -rf " + path + "/*" ) + import sys + if sys.platform == "win32": + os.system( "rmdir /S /Q " + '"' + path + '"' ) + os.system( "mkdir " + '"' + path + '"' ) + else: + os.system( "rm -rf " + path + "/*" ) + pass pass else: - os.makedirs( path, 0777 ) - pass + dirs = path.split("/") + shift1 = shift2 = 0 + if not dirs[0]: shift1 = 1 + if dirs[-1]: shift2 = 1 + for i in range(1+shift1,len(dirs)+shift2): + p = "/".join(dirs[:i]) + try: + os.mkdir(p, mode) + os.chmod(p, mode) + except: + pass + pass + pass + pass # --- @@ -399,10 +418,20 @@ def uniteFiles( src_file, dest_file ): dest.writelines( dest_lines ) dest.close() - command = "cat " + src_file + " >> " + dest_file + import sys + if sys.platform == "win32": + command = "type " + '"' + src_file + '"' + " >> " + '"' + dest_file + '"' + else: + command = "cat " + src_file + " >> " + dest_file + pass pass else: - command = "cp " + src_file + " " + dest_file + import sys + if sys.platform == "win32": + command = "copy " + '"' + src_file + '"' + " " + '"' + dest_file + '"' + " > nul" + else: + command = "cp " + src_file + " " + dest_file + pass pass os.system( command ) diff --git a/bin/setenv.py b/bin/setenv.py index cde2e1165..1ec62d8e5 100755 --- a/bin/setenv.py +++ b/bin/setenv.py @@ -142,10 +142,6 @@ def get_config(silent=False): modules_list.remove("GUI") pass - if "SUPERV" in modules_list and not 'supervContainer' in args['standalone']: - args['standalone'].append("supervContainer") - pass - return args, modules_list, modules_root_dir # ----------------------------------------------------------------------------- @@ -154,12 +150,15 @@ def set_env(args, modules_list, modules_root_dir, silent=False): """Add to the PATH-variables modules specific paths""" import os - from salome_utils import getTmpDir, generateFileName, makeTmpDir + from salome_utils import getTmpDir, generateFileName, makeTmpDir, getPortNumber # create temporary directory for environment files needed by modules from the list - tmp_dir = getTmpDir() - env_dir = generateFileName(tmp_dir, prefix="env", with_port=True) - makeTmpDir(env_dir) + port = getPortNumber(False) + if port: + tmp_dir = getTmpDir() + env_dir = generateFileName(tmp_dir, prefix="env", with_port=True) + makeTmpDir(env_dir) + pass python_version="python%d.%d" % sys.version_info[0:2] modules_root_dir_list = [] @@ -198,13 +197,15 @@ def set_env(args, modules_list, modules_root_dir, silent=False): salome_subdir, "shared_modules"), "PYTHONPATH") - + # set environment by modules from the list - try: - mod=__import__(module.lower()+"_setenv") - mod.set_env(args) - pass - except: + if port: + try: + mod=__import__(module.lower()+"_setenv") + mod.set_env(args) + pass + except: + pass pass pass pass @@ -223,12 +224,7 @@ def set_env(args, modules_list, modules_root_dir, silent=False): if args['logger']: os.environ["SALOME_trace"]="with_logger" - # set environment for SUPERV module - os.environ["ENABLE_MACRO_NODE"]="1" # set resources variables if not yet set - # Done now by launchConfigureParser.py - #if os.getenv("GUI_ROOT_DIR"): - #if not os.getenv("SalomeAppConfig"): os.environ["SalomeAppConfig"] = os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui" os.environ["CSF_SALOMEDS_ResourcesDefaults"] \ = os.path.join(modules_root_dir["KERNEL"],"share", diff --git a/configure.ac b/configure.ac index 64068a439..ec63ffb86 100644 --- a/configure.ac +++ b/configure.ac @@ -24,14 +24,14 @@ # ================================================================ #AC_PREREQ(2.59) # -AC_INIT([Salome2 Project], [5.1.1], [paul.rascle@edf.fr], [SalomeKERNEL]) +AC_INIT([Salome2 Project], [5.1.2], [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)}'` @@ -92,6 +92,9 @@ AC_ARG_WITH(onlylauncher, [], [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 # ---------------------------------------------------------------------------- @@ -118,6 +121,7 @@ echo --------------------------------------------- echo AC_PROG_MAKE_SET AC_PROG_INSTALL +AC_LOCAL_INSTALL echo echo --------------------------------------------- @@ -174,6 +178,14 @@ AC_CXX_HAVE_SSTREAM # Testing linker AC_LINKER_OPTIONS +echo +echo --------------------------------------------- +echo testing Fortran INTEGER size for CALCIUM +echo --------------------------------------------- +echo + +CHECK_CALCIUM + echo echo --------------------------------------------- echo testing threads @@ -406,7 +418,7 @@ echo CHECK_HTML_GENERATORS # Additional conditional to avoid compilation of non-portable code -AM_CONDITIONAL(WINDOWS, 0) +AM_CONDITIONAL(WINDOWS, [ test ]) echo echo ============================================================ @@ -530,78 +542,82 @@ echo # autoscan, the Makefile list is generated in the output file configure.scan. # This could be helpfull to update de configuration. AC_OUTPUT([ \ - ./KERNEL_version.h \ - ./salome_adm/unix/SALOMEconfig.ref \ - ./salome_adm/Makefile \ - ./salome_adm/cmake_files/Makefile \ - ./salome_adm/unix/Makefile \ - ./salome_adm/unix/config_files/Makefile \ - Makefile \ - ./bin/Makefile \ - ./bin/VERSION \ - ./doc/Makefile \ - ./doc/salome/Makefile \ - ./doc/salome/tui/Makefile \ - ./doc/salome/tui/doxyfile \ - ./doc/salome/gui/Makefile \ - ./doc/salome/gui/doxyfile \ - ./idl/Makefile \ - ./resources/Makefile \ - ./resources/KERNELCatalog.xml \ - ./resources/CatalogResources.xml \ - ./src/Makefile \ - ./src/Basics/Makefile \ - ./src/Basics/Test/Makefile \ - ./src/Batch/Makefile \ - ./src/Batch_SWIG/Makefile \ - ./src/Communication/Makefile \ - ./src/Communication_SWIG/Makefile \ - ./src/Container/Makefile \ - ./src/ParallelContainer/Makefile \ - ./src/DF/Makefile \ - ./src/DSC/Makefile \ - ./src/DSC/DSC_Basic/Makefile \ - ./src/DSC/DSC_User/Makefile \ - ./src/DSC/DSC_User/Basic/Makefile \ - ./src/DSC/DSC_User/Datastream/Makefile \ - ./src/DSC/DSC_User/Datastream/Palm/Makefile \ - ./src/DSC/DSC_User/Datastream/Calcium/Makefile \ - ./src/DSC/ParallelDSC/Makefile \ - ./src/DSC/DSC_Python/Makefile \ - ./src/GenericObj/Makefile \ - ./src/HDFPersist/Makefile \ - ./src/KERNEL_PY/Makefile \ - ./src/Launcher/Makefile \ - ./src/LifeCycleCORBA/Makefile \ - ./src/LifeCycleCORBA/Test/Makefile \ - ./src/LifeCycleCORBA_SWIG/Makefile \ - ./src/LifeCycleCORBA_SWIG/Test/Makefile \ - ./src/Logger/Makefile \ - ./src/Logger/Test/Makefile \ - ./src/ModuleCatalog/Makefile \ - ./src/ModuleGenerator/Makefile \ - ./src/ModuleGenerator/testIDLparser \ - ./src/MPIContainer/Makefile \ - ./src/NamingService/Makefile \ - ./src/NamingService/Test/Makefile \ - ./src/Notification/Makefile \ - ./src/NOTIFICATION_SWIG/Makefile \ - ./src/Registry/Makefile \ - ./src/ResourcesManager/Makefile \ - ./src/SALOMEDS/Makefile \ - ./src/SALOMEDS/Test/Makefile \ - ./src/SALOMEDSClient/Makefile \ - ./src/SALOMEDSImpl/Makefile \ - ./src/SALOMEDSImpl/Test/Makefile \ - ./src/SALOMELocalTrace/Makefile \ - ./src/SALOMELocalTrace/Test/Makefile \ - ./src/SALOMETraceCollector/Makefile \ - ./src/SALOMETraceCollector/Test/Makefile \ - ./src/TestContainer/Makefile \ - ./src/TestMPIContainer/Makefile \ - ./src/TOOLSDS/Makefile \ - ./src/UnitTests/Makefile \ - ./src/Utils/Makefile \ - ./src/Utils/Test/Makefile \ + KERNEL_version.h \ + salome_adm/unix/SALOMEconfig.ref \ + salome_adm/Makefile \ + salome_adm/cmake_files/Makefile \ + salome_adm/unix/Makefile \ + salome_adm/unix/config_files/Makefile \ + Makefile \ + bin/Makefile \ + bin/VERSION \ + doc/Makefile \ + doc/salome/Makefile \ + doc/salome/tui/Makefile \ + doc/salome/tui/doxyfile \ + doc/salome/gui/Makefile \ + doc/salome/gui/doxyfile \ + idl/Makefile \ + idl/Calcium_Ports.idl \ + resources/Makefile \ + resources/KERNELCatalog.xml \ + resources/CatalogResources.xml \ + src/Makefile \ + src/Basics/Makefile \ + src/Basics/Test/Makefile \ + src/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/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx \ + src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx \ + src/DSC/DSC_User/Datastream/Calcium/CalciumFortranInt.h \ + src/DSC/ParallelDSC/Makefile \ + src/DSC/DSC_Python/Makefile \ + src/GenericObj/Makefile \ + src/HDFPersist/Makefile \ + src/KERNEL_PY/Makefile \ + src/Launcher/Makefile \ + src/LifeCycleCORBA/Makefile \ + src/LifeCycleCORBA/Test/Makefile \ + src/LifeCycleCORBA_SWIG/Makefile \ + src/LifeCycleCORBA_SWIG/Test/Makefile \ + src/Logger/Makefile \ + src/Logger/Test/Makefile \ + src/ModuleCatalog/Makefile \ + src/ModuleGenerator/Makefile \ + src/ModuleGenerator/testIDLparser \ + src/MPIContainer/Makefile \ + src/NamingService/Makefile \ + src/NamingService/Test/Makefile \ + src/Notification/Makefile \ + src/NOTIFICATION_SWIG/Makefile \ + src/Registry/Makefile \ + src/ResourcesManager/Makefile \ + src/SALOMEDS/Makefile \ + src/SALOMEDS/Test/Makefile \ + src/SALOMEDSClient/Makefile \ + src/SALOMEDSImpl/Makefile \ + src/SALOMEDSImpl/Test/Makefile \ + src/SALOMELocalTrace/Makefile \ + src/SALOMELocalTrace/Test/Makefile \ + src/SALOMETraceCollector/Makefile \ + src/SALOMETraceCollector/Test/Makefile \ + src/TestContainer/Makefile \ + src/TestMPIContainer/Makefile \ + src/TOOLSDS/Makefile \ + src/UnitTests/Makefile \ + src/Utils/Makefile \ + src/Utils/Test/Makefile \ ]) diff --git a/idl/Calcium_Ports.idl b/idl/Calcium_Ports.idl deleted file mode 100644 index 9f1096498..000000000 --- a/idl/Calcium_Ports.idl +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : 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 seq_long; - typedef sequence seq_float; - typedef sequence seq_double; - typedef sequence seq_string; - typedef sequence seq_boolean; - typedef seq_float seq_complex; - - interface Calcium_Integer_Port : Calcium_Port { - void put (in seq_long data, in double time, in long tag); - }; - - interface Calcium_Real_Port : Calcium_Port { - void put (in seq_float data, in double time, in long tag); - }; - - interface Calcium_Double_Port : Calcium_Port { - void put (in seq_double data, in double time, in long tag); - }; - - interface Calcium_String_Port : Calcium_Port { - void put (in seq_string data, in double time, in long tag); - }; - - interface Calcium_Logical_Port : Calcium_Port { - void put (in seq_boolean data, in double time, in long tag); - }; - - interface Calcium_Complex_Port : Calcium_Port { - void put (in seq_complex data, in double time, in long tag); - }; - - }; -}; - -#endif diff --git a/idl/Calcium_Ports.idl.in b/idl/Calcium_Ports.idl.in new file mode 100644 index 000000000..7556d945d --- /dev/null +++ b/idl/Calcium_Ports.idl.in @@ -0,0 +1,96 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SALOME_Ports.idl +// Author : Eric Fayolle, EDF +// +#ifndef _CALCIUM_PORTS_IDL_ +#define _CALCIUM_PORTS_IDL_ + +#include "SALOME_Ports.idl" + +module Ports { + + module Calcium_Ports { + + const long UNLIMITED_STORAGE_LEVEL = -70; + enum DependencyType { UNDEFINED_DEPENDENCY, TIME_DEPENDENCY, ITERATION_DEPENDENCY }; + enum DateCalSchem { TI_SCHEM, TF_SCHEM , ALPHA_SCHEM}; + enum InterpolationSchem { L0_SCHEM, L1_SCHEM }; + enum ExtrapolationSchem { UNDEFINED_EXTRA_SCHEM, E0_SCHEM, E1_SCHEM}; + + // enum DisconnectDirective {UNDEFINED_DIRECTIVE,CONTINUE,STOP}; + typedef boolean DisconnectDirective; + const DisconnectDirective stop = FALSE; + const DisconnectDirective cont = TRUE; + + interface Calcium_Port : Ports::Data_Port, Ports::PortProperties { + void disconnect(in DisconnectDirective mode); + }; + + typedef sequence seq_long; + typedef sequence seq_long_long; + typedef sequence< @CALCIUM_IDL_INT_F77@ > seq_integer; + + typedef sequence seq_float; + typedef sequence seq_double; + typedef sequence seq_string; + typedef sequence seq_boolean; + typedef seq_float seq_complex; + + //Fortran int size conforming port + interface Calcium_Integer_Port : Calcium_Port { + void put (in seq_integer data, in double time, in long tag); + }; + + interface Calcium_Intc_Port : Calcium_Port { + void put (in seq_long data, in double time, in long tag); + }; + + interface Calcium_Long_Port : Calcium_Port { + void put (in seq_long_long data, in double time, in long tag); + }; + + + interface Calcium_Real_Port : Calcium_Port { + void put (in seq_float data, in double time, in long tag); + }; + + interface Calcium_Double_Port : Calcium_Port { + void put (in seq_double data, in double time, in long tag); + }; + + interface Calcium_String_Port : Calcium_Port { + void put (in seq_string data, in double time, in long tag); + }; + + interface Calcium_Logical_Port : Calcium_Port { + void put (in seq_boolean data, in double time, in long tag); + }; + + interface Calcium_Complex_Port : Calcium_Port { + void put (in seq_complex data, in double time, in long tag); + }; + + }; +}; + +#endif diff --git a/idl/Makefile.am b/idl/Makefile.am index 6da3cef76..556ebe1b1 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -26,7 +26,7 @@ # include $(top_srcdir)/salome_adm/unix/make_common_starter.am -AM_CXXFLAGS = -fPIC +AM_CXXFLAGS += -fPIC BASEIDL_FILES = \ SALOME_Exception.idl \ @@ -46,7 +46,6 @@ BASEIDL_FILES = \ nstest.idl \ DSC_Engines.idl \ SALOME_Ports.idl \ - Calcium_Ports.idl \ Palm_Ports.idl \ SALOME_PACOExtension.idl \ SALOME_ParamPorts.idl @@ -71,7 +70,8 @@ EXTRA_DIST= $(BASEIDL_FILES) $(MPIIDL_FILES) $(OTHER_IDL_FILES) \ SALOME_PACOExtension.xml SALOME_ParamPorts.xml # This variable defines the files to be installed -salomeidl_DATA = $(IDL_FILES) +salomeidl_DATA = $(IDL_FILES) +nodist_salomeidl_DATA = Calcium_Ports.idl # Sources built from idl files # BUILT_SOURCE = first thing done on make all @@ -212,8 +212,8 @@ XML = SALOME_Component.xml DSC_Engines.xml SALOME_Ports.xml \ endif idldir = $(prefix)/idl/salome -nodist_idl_DATA = ${XML} ${IDL_PACO} -nodist_salomeinclude_HEADERS = ${INCLUDES_PACO} +nodist_idl_DATA = ${XML} ${IDL_PACO} Calcium_Ports.idl +nodist_salomeinclude_HEADERS = ${INCLUDES_PACO} BUILT_SOURCES = $(IDL_SOURCES) $(PAR) $(PAR_INCLUDES) @@ -226,54 +226,49 @@ SALOME_ParamPortsPaCO.idl SALOME_ParamPortsPaCO.hxx SALOME_ParamPortsPaCO.cxx : lib_LTLIBRARIES = libSalomeIDLKernel.la $(PAR_LIB) nodist_libSalomeIDLKernel_la_SOURCES = $(IDL_SOURCES) $(DYNIDL_SRCS) -libSalomeIDLKernel_la_CPPFLAGS =-I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h \ - -I$(top_builddir)/idl \ +libSalomeIDLKernel_la_CPPFLAGS =-I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ libSalomeIDLKernel_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeIDLKernel_la_LIBADD = @CORBA_LIBS@ nodist_libSalomeParallelIDLKernel_la_SOURCES = $(PAR) $(GEN_PACO) -libSalomeParallelIDLKernel_la_CPPFLAGS =-I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h \ - -I$(top_builddir)/idl \ +libSalomeParallelIDLKernel_la_CPPFLAGS =-I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \ @PACO_INCLUDES@ libSalomeParallelIDLKernel_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeParallelIDLKernel_la_LIBADD = libSalomeIDLKernel.la @PACO_LIBS@ # These variables defines the building process of CORBA files -OMNIORB_IDL = @OMNIORB_IDL@ -OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ -OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_builddir)/salome/idl -IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -Wba -I$(top_builddir)/salome/idl -IDLPYFLAGS = @IDLPYFLAGS@ +IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(srcdir) -I$(top_builddir)/salome/idl +IDLPYFLAGS = @IDLPYFLAGS@ -I$(srcdir) # potential problem on parallel make on the following - multiple outputs SUFFIXES = .idl .hh SK.cc .idlSK.cc: - $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + $(IDL) $(IDLCXXFLAGS) $< SK.cc.hh: #Dummy rule to replace the following one (for parallel make) #.idl.hh: -# $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< +# $(IDL) $(IDLCXXFLAGS) $< if WITH_PACO_PARALLEL %PaCO.idl %PaCO.hxx %PaCO.cxx : %.idl %.xml - $(OMNIORB_IDL) -p@PACOPATH@/lib/python -bpaco -Wb$(top_srcdir)/idl/$*.xml,$(srcdir):@PACOPATH@/idl $(top_srcdir)/idl/$*.idl + $(IDL) -p@PACOPATH@/lib/python -bpaco -Wb$(top_srcdir)/idl/$*.xml,$(srcdir):@PACOPATH@/idl $(top_srcdir)/idl/$*.idl -%.hxx: %.idl - $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) -Wbh=.hxx -Wbs=.cxx $< +.idl.hxx: + $(IDL) $(IDLCXXFLAGS) -Wbh=.hxx -Wbs=.cxx $< endif -install-exec-local: $(IDL_FILES:%=$(top_srcdir)/idl/%) +install-exec-local: $(IDL_FILES:%=$(top_srcdir)/idl/%) Calcium_Ports.idl $(INSTALL) -d $(DESTDIR)$(salomepythondir) ls $^ | while read file; do \ - $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \ + $(IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \ done if WITH_PACO_PARALLEL ls $(top_builddir)/idl/*.idl | while read file; do \ - $(OMNIORB_IDL) $(IDLPYFLAGS) -I$(top_srcdir)/idl -I@PACOPATH@/idl -C$(DESTDIR)$(salomepythondir) $$file ; \ + $(IDL) $(IDLPYFLAGS) -I$(top_srcdir)/idl -I@PACOPATH@/idl -C$(DESTDIR)$(salomepythondir) $$file ; \ done endif @@ -282,13 +277,13 @@ uninstall-local: rm -rf $(DESTDIR)$(salomepythondir)/* mostlyclean-local: - -rm -f *.hh *.cc .depidl + -rm -f *.hh *.cc .depidl Calcium_Ports.idl # we use cpp to generate dependencies between idl files. # option x c tells the preprocessor to consider idl as a c file. # if an idl is modified, all idl dependencies are rebuilt -.depidl: $(IDL_FILES) +.depidl: $(IDL_FILES) Calcium_Ports.idl @echo "" > $@ @for dep in $^ dummy; do \ if [ $$dep != "dummy" ]; then \ @@ -300,5 +295,6 @@ mostlyclean-local: -include .depidl -CLEANFILES = *PaCO* *.hxx *.cxx +CLEANFILES = *PaCO* *.hxx *.cxx Calcium_Ports.idl + diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index 80b69b51a..8e44c7438 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -34,7 +34,7 @@ #include "SALOME_GenericObj.idl" /*! \brief - This package contains the interfaces used for creation, managment + This package contains the interfaces used for creation, management and modification of the %Study */ module SALOMEDS diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index db817c063..6e70b41e1 100644 --- a/idl/SALOME_Component.idl +++ b/idl/SALOME_Component.idl @@ -52,6 +52,12 @@ module Engines any value; }; + //! Structure data type to hold reference on data + struct dataref + { + string ref; + }; + typedef sequence FieldsDict; interface Component ; @@ -203,15 +209,6 @@ module Engines //! Determines whether the server has already been loaded or not. void ping(); -// -// Set study associated to component instance -// \param studyId -// (=0: multistudy component instance, -// >0: study id associated to this instance -// \return false if already set with a different value (change not possible) -// -// boolean setStudyId(in long studyId); - //! Get study associated to component instance /*! get study associated to component instance diff --git a/resources/KERNELCatalog.xml.in b/resources/KERNELCatalog.xml.in index 917418b52..35b2edea4 100644 --- a/resources/KERNELCatalog.xml.in +++ b/resources/KERNELCatalog.xml.in @@ -23,6 +23,9 @@ + + + diff --git a/salome_adm/cmake_files/FindBOOST.cmake b/salome_adm/cmake_files/FindBOOST.cmake index d46eb032a..4f052d011 100644 --- a/salome_adm/cmake_files/FindBOOST.cmake +++ b/salome_adm/cmake_files/FindBOOST.cmake @@ -121,8 +121,13 @@ IF(BOOST_STATUS) SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_${name}}) ENDFOREACH(name thread date_time signals filesystem system) ELSE(WINDOWS) - FIND_LIBRARY(BOOST_LIB_THREAD boost_thread ${BOOST_LIB_PATHS}) - SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_THREAD}) + FOREACH(name thread date_time signals filesystem system) + FIND_LIBRARY(BOOST_LIB_${name} boost_${name} PATHS ${BOOST_LIB_PATHS}) + IF(NOT BOOST_LIB_${name}) + SET(BOOST_STATUS 0) + ENDIF(NOT BOOST_LIB_${name}) + SET(BOOST_LIBS ${BOOST_LIBS} ${BOOST_LIB_${name}}) + ENDFOREACH(name thread date_time signals filesystem system) ENDIF(WINDOWS) ENDIF(BOOST_STATUS) diff --git a/salome_adm/cmake_files/FindPLATFORM.cmake b/salome_adm/cmake_files/FindPLATFORM.cmake index dfc8242c3..f0ab69771 100644 --- a/salome_adm/cmake_files/FindPLATFORM.cmake +++ b/salome_adm/cmake_files/FindPLATFORM.cmake @@ -70,6 +70,8 @@ ELSE(WINDOWS) SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl) ENDIF(WINDOWS) +SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4) + # SET(PLATFORM_CPPFLAGS) # # # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT -D_CRT_SECURE_NO_WARNINGS) # # SET(RM del) diff --git a/salome_adm/cmake_files/FindPYTHON.cmake b/salome_adm/cmake_files/FindPYTHON.cmake index a03b563a4..6c6768139 100644 --- a/salome_adm/cmake_files/FindPYTHON.cmake +++ b/salome_adm/cmake_files/FindPYTHON.cmake @@ -199,6 +199,7 @@ ENDIF(PYTHON_STATUS) # ---- IF(PYTHON_STATUS) + SET(PYTHON_CPPFLAGS ${PYTHON_INCLUDES}) ELSE(PYTHON_STATUS) IF(PYTHON_IS_MANDATORY) MESSAGE(FATAL_ERROR "python not found ... mandatory ... abort") diff --git a/salome_adm/cmake_files/am2cmake.py b/salome_adm/cmake_files/am2cmake.py index fde4aff60..00b58695d 100644 --- a/salome_adm/cmake_files/am2cmake.py +++ b/salome_adm/cmake_files/am2cmake.py @@ -510,12 +510,38 @@ class CMakeFile(object): INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindBLSURF.cmake) """) pass + if self.module == "hexoticplugin": + newlines.append(""" + SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR}) + SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) + SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR}) + INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake) + INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) + INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake) + """) + pass + if self.module == "ghs3dplugin": + newlines.append(""" + SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR}) + SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) + SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR}) + INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake) + INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) + INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake) + """) + pass if self.module == "visu": newlines.append(""" SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR}) INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake) """) pass + if self.module == "yacs": + newlines.append(""" + INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindEXPAT.cmake) + INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindGRAPHVIZ.cmake) + """) + pass pass pass # -- @@ -525,6 +551,9 @@ class CMakeFile(object): SET(WITH_BATCH 1) set(VERSION 5.1.2) set(XVERSION 0x050102) + SET(CALCIUM_IDL_INT_F77 long) + SET(CALCIUM_CORBA_INT_F77 CORBA::Long) + SET(LONG_OR_INT int) """) elif self.module == "gui": newlines.append(""" @@ -536,7 +565,7 @@ class CMakeFile(object): SET(ENABLE_PLOT2DVIEWER ON) SET(ENABLE_PYCONSOLE ON) SET(ENABLE_SUPERVGRAPHVIEWER ON) - # SET(ENABLE_QXGRAPHVIEWER ON) + SET(ENABLE_QXGRAPHVIEWER ON) set(VERSION 5.1.2) set(XVERSION 0x050102) """) @@ -560,6 +589,9 @@ class CMakeFile(object): elif self.module == "med": newlines.append(""" SET(MED_ENABLE_KERNEL ON) + IF(NOT WINDOWS) + SET(MED_ENABLE_SPLITTER ON) + ENDIF(NOT WINDOWS) SET(MED_ENABLE_GUI ON) """) pass @@ -578,6 +610,17 @@ class CMakeFile(object): SET(BLSURFPLUGIN_ENABLE_GUI ON) """) pass + elif self.module == "ghs3dplugin": + newlines.append(""" + SET(GHS3DPLUGIN_ENABLE_GUI ON) + """) + pass + elif self.module == "yacs": + newlines.append(""" + SET(SALOME_KERNEL ON) + SET(HAS_GUI ON) + """) + pass # -- pass # -- @@ -589,6 +632,19 @@ class CMakeFile(object): SET(AM_CXXFLAGS) SET(LDADD) """) + if self.module == "kernel": + newlines.append(r''' + SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h) + SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h) + ''') + else: + if self.module not in ["yacs"]: + newlines.append(r''' + SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h) + SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h) + ''') + pass + pass # -- return @@ -830,7 +886,7 @@ class CMakeFile(object): # -- # -- - for key in ["bin_PROGRAMS"]: + for key in ["bin_PROGRAMS", "check_PROGRAMS"]: if self.__thedict__.has_key(key): self.addBinTarget(key, newlines) pass @@ -852,6 +908,11 @@ class CMakeFile(object): key = "IDL_FILES" if self.__thedict__.has_key(key): + if self.module == "kernel": + newlines.append(''' + SET(IDL_FILES ${IDL_FILES} Calcium_Ports.idl) + ''') + pass newlines.append(''' FOREACH(input ${IDL_FILES}) STRING(REGEX REPLACE ".idl" "" base ${input}) @@ -859,9 +920,19 @@ class CMakeFile(object): SET(outputs ${src}) SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc) SET(outputs ${outputs} ${dynsrc}) + 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) @@ -876,6 +947,10 @@ class CMakeFile(object): FOREACH(f ${IDLPYFLAGS}) SET(flags "${flags} ${f}") ENDFOREACH(f ${IDLPYFLAGS}) + STRING(REGEX MATCH "-bpython" ISBPYTHON ${flags}) + IF(NOT ISBPYTHON) + SET(flags "-bpython ${flags}") + ENDIF(NOT ISBPYTHON) SET(IDLPYFLAGS ${flags}) STRING(REPLACE "\\\\" "/" IDLPYFLAGS ${IDLPYFLAGS}) INSTALL(CODE "SET(IDLPYFLAGS ${IDLPYFLAGS})") @@ -924,6 +999,24 @@ class CMakeFile(object): ''') pass + # -- + # -- + if self.__thedict__.has_key("BUILT_SOURCES"): + newlines.append(''' + FOREACH(f ${BUILT_SOURCES}) + IF(f MATCHES "WRAP.cxx$") + # STRING(REGEX REPLACE "WRAP.cxx" "WRAP.h" inc ${f}) + STRING(REGEX REPLACE "WRAP.cxx" ".i" input ${f}) + ADD_CUSTOM_COMMAND( + OUTPUT ${f} # ${inc} + COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} ${SWIG_PYTHON_INCLUDES} ${MYSWIG_FLAGS} -o ${f} ${CMAKE_CURRENT_SOURCE_DIR}/${input} + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${input} + ) + ENDIF(f MATCHES "WRAP.cxx$") + ENDFOREACH(f ${BUILT_SOURCES}) + ''') + pass + # -- # -- key = "MOC_FILES" @@ -1023,6 +1116,7 @@ class CMakeFile(object): "nodist_salomescript_DATA" : "bin/salome", "salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome", "nodist_salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome", + "dist_salomepython_DATA" : "lib/python${PYTHON_VERSION}/site-packages/salome", "sharedpkgpython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome/shared_modules", } if self.module == "medfile": @@ -1065,9 +1159,11 @@ class CMakeFile(object): # -- newlines.append(r''' SET(libs ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS}) - IF(name STREQUAL SALOMEBasics) + FOREACH(lib SALOMEBasics SalomeBatch) + IF(name STREQUAL lib) SET(libs ${libs} ${PTHREAD_LIBS}) - ENDIF(name STREQUAL SALOMEBasics) + ENDIF(name STREQUAL lib) + ENDFOREACH(lib SALOMEBasics SalomeBatch) ''') if key == "bin_PROGRAMS": newlines.append(r''' @@ -1080,10 +1176,11 @@ class CMakeFile(object): GET_FILENAME_COMPONENT(ext ${lib} EXT) IF(ext STREQUAL .la) GET_FILENAME_COMPONENT(lib ${lib} NAME_WE) - STRING(REPLACE "lib" "" lib ${lib}) + STRING(REGEX REPLACE "^lib" "" lib ${lib}) ENDIF(ext STREQUAL .la) SET(vars) SET(vars ${vars} -no-undefined) + SET(vars ${vars} -lvtkWidgets) IF(WINDOWS) SET(vars ${vars} -module) SET(vars ${vars} -Wl,-E) @@ -1092,7 +1189,6 @@ class CMakeFile(object): SET(vars ${vars} -lm) SET(vars ${vars} -lboost_thread) SET(vars ${vars} -lboost_signals) - SET(vars ${vars} -lvtkWidgets) ENDIF(WINDOWS) FOREACH(v ${vars}) IF(lib STREQUAL v) @@ -1142,6 +1238,14 @@ class CMakeFile(object): ENDIF(WINDOWS) ''') # -- + if self.module == "yacs": + newlines.append(r''' + IF(WINDOWS) + SET(var ${var} -DNOGDI) + ENDIF(WINDOWS) + ''') + pass + # -- newlines.append(r''' IF(WINDOWS) SET(targets) @@ -1151,6 +1255,7 @@ class CMakeFile(object): SET(dir $ENV{F2CHOME}) STRING(REPLACE "\\\\" "/" dir ${dir}) SET(var ${var} -I${dir}) + SET(var ${var} -DF2C_BUILD) ENDIF(name STREQUAL ${target}) ENDFOREACH(target ${targets}) ENDIF(WINDOWS) @@ -1162,10 +1267,14 @@ class CMakeFile(object): SET(var ${var} -I${CMAKE_CURRENT_BINARY_DIR}) ''') pass - if key == "bin_PROGRAMS": + newlines.append(r''' + SET(var ${var} ${AM_CPPFLAGS}) + SET(var ${var} ${AM_CXXFLAGS}) + ''') + if self.module == "yacs": newlines.append(r''' - SET(var ${var} ${AM_CPPFLAGS}) - SET(var ${var} ${AM_CXXFLAGS}) + SET(var ${var} -DYACS_PTHREAD) + SET(var ${var} -DCMAKE_BUILD) ''') pass newlines.append(r''' @@ -1178,6 +1287,7 @@ class CMakeFile(object): IF(WINDOWS) SET(vars ${vars} -include SALOMEconfig.h) SET(vars ${vars} -ftemplate-depth-32) + SET(vars ${vars} -fPIC) ENDIF(WINDOWS) SET(flags) FOREACH(f ${var}) @@ -1281,12 +1391,15 @@ class CMakeFile(object): ENDFOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES}) ''') newlines.append(r''' - SET(build_srcs) + SET(l ${nodist_${amname}_SOURCES}) + 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) @@ -1294,7 +1407,6 @@ class CMakeFile(object): SET(build_srcs ${build_srcs} ${CMAKE_CURRENT_BINARY_DIR}/${f}) ENDIF(ext STREQUAL .py) ENDFOREACH(f ${l}) - SET(srcs ${build_srcs} ${srcs}) ''') # -- # Add the library to cmake @@ -1402,7 +1514,7 @@ class CMakeFile(object): def addBinTarget(self, key, newlines): # -- newlines.append(r''' - FOREACH(amname ${bin_PROGRAMS}) + FOREACH(amname ${bin_PROGRAMS} ${check_PROGRAMS}) ''') # -- newlines.append(r''' @@ -1427,26 +1539,28 @@ class CMakeFile(object): ''') pass # -- - newlines.append(r''' - IF(WINDOWS) - INSTALL(TARGETS ${name} DESTINATION ${DEST}) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe DESTINATION ${DEST} RENAME ${amname}.exe) - INSTALL(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe)") - ELSE(WINDOWS) - SET(PERMS) - SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE) - SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE) - SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name} DESTINATION ${DEST} PERMISSIONS ${PERMS} RENAME ${amname}) - ENDIF(WINDOWS) - ''') + if key == "bin_PROGRAMS": + newlines.append(r''' + IF(WINDOWS) + INSTALL(TARGETS ${name} DESTINATION ${DEST}) + INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe DESTINATION ${DEST} RENAME ${amname}.exe) + INSTALL(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe)") + ELSE(WINDOWS) + SET(PERMS) + SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE) + SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE) + SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name} DESTINATION ${DEST} PERMISSIONS ${PERMS} RENAME ${amname}) + ENDIF(WINDOWS) + ''') + pass # -- newlines.append(r''' ENDIF(nb) ''') # -- newlines.append(r''' - ENDFOREACH(amname ${bin_PROGRAMS}) + ENDFOREACH(amname ${bin_PROGRAMS} ${check_PROGRAMS}) ''') # -- return diff --git a/salome_adm/cmake_files/install_python_from_idl.cmake b/salome_adm/cmake_files/install_python_from_idl.cmake index da4eed0e2..b37544c52 100644 --- a/salome_adm/cmake_files/install_python_from_idl.cmake +++ b/salome_adm/cmake_files/install_python_from_idl.cmake @@ -22,4 +22,4 @@ SET(FULLDIR ${CMAKE_INSTALL_PREFIX}/${DIR}) FILE(MAKE_DIRECTORY ${FULLDIR}) MESSAGE(STATUS "Compiling ${IDL_FILE} into ${FULLDIR}") -EXECUTE_PROCESS(COMMAND ${OMNIORB_IDL_PYTHON} ${IDLPYFLAGS} -C${FULLDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${IDL_FILE}) +EXECUTE_PROCESS(COMMAND ${OMNIORB_IDL_PYTHON} ${IDLPYFLAGS} -C${FULLDIR} ${IDL_FILE}) diff --git a/salome_adm/unix/SALOMEconfig.ref.in b/salome_adm/unix/SALOMEconfig.ref.in index add14555f..9849e32b4 100644 --- a/salome_adm/unix/SALOMEconfig.ref.in +++ b/salome_adm/unix/SALOMEconfig.ref.in @@ -20,42 +20,62 @@ // 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@" +#ifndef RCP +# define RCP "@RCP@" +#endif /* A path to a rm-like command */ -#define RM "@RM@" +#ifndef RM +# define RM "@RM@" +#endif /* A path to a cp-like command */ +#ifndef CP #define CP "@CP@" +#endif /* A path to a rsh-like command */ +#ifndef RSH #define RSH "@RSH@" +#endif /* A path to a scp-like command */ +#ifndef SCP #define SCP "@SCP@" +#endif /* A path to a sh-like command */ +#ifndef SH #define SH "@SH@" +#endif /* A path to a ssh-like command */ +#ifndef SSH #define SSH "@SSH@" +#endif // This is only to suppress warning messages with defines redefined (cause of omniORB that exports these names) +#ifdef PACKAGE +#undef PACKAGE +#endif #ifdef PACKAGE_BUGREPORT #undef PACKAGE_BUGREPORT #endif @@ -71,9 +91,10 @@ #ifdef PACKAGE_VERSION #undef PACKAGE_VERSION #endif +#ifdef VERSION +#undef VERSION +#endif #ifdef _POSIX_C_SOURCE #undef _POSIX_C_SOURCE #endif - -#endif diff --git a/salome_adm/unix/config_files/Makefile.am b/salome_adm/unix/config_files/Makefile.am index 68649d934..705501002 100644 --- a/salome_adm/unix/config_files/Makefile.am +++ b/salome_adm/unix/config_files/Makefile.am @@ -52,6 +52,7 @@ ac_cxx_template_options.m4 \ ac_cxx_use_std_iostream.m4 \ ac_cxx_warnings.m4 \ ac_linker_options.m4 \ +ac_check_sizeof_fortran.m4 \ acx_pthread.m4 \ check_Kernel.m4 \ check_boost.m4 \ @@ -59,6 +60,7 @@ check_cas.m4 \ check_corba.m4 \ check_cppunit.m4 \ check_f77.m4 \ +check_calcium.m4 \ check_hdf5.m4 \ check_htmlgen.m4 \ check_lam.m4 \ @@ -77,7 +79,8 @@ pyembed.m4 \ python.m4 \ check_libxml.m4 \ check_local.m4 \ -check_paco++.m4 +check_paco++.m4 \ +local_install.m4 dist_salome4depr_DATA=\ $(DEPRECATED_FILES) diff --git a/salome_adm/unix/config_files/ac_check_sizeof_fortran.m4 b/salome_adm/unix/config_files/ac_check_sizeof_fortran.m4 new file mode 100644 index 000000000..29a1d3074 --- /dev/null +++ b/salome_adm/unix/config_files/ac_check_sizeof_fortran.m4 @@ -0,0 +1,49 @@ +AC_DEFUN([AC_CHECK_SIZEOF_FORTRAN], [ + AC_REQUIRE([AC_F77_WRAPPERS]) + AC_CACHE_CHECK([size of Fortran [$1]], [ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])],[ + AC_LANG_SAVE() + AC_LANG([Fortran 77]) + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([ + subroutine fsize() + $1 i(2) + call csize(i(1), i(2)) + end + ]) + ],[ + AC_LANG([C]) + cp conftest.$ac_objext conftestf.$ac_objext + old_LDFLAGS="$LDFLAGS" + LDFLAGS="conftestf.$ac_objext $LDFLAGS" +#"$ac_cv_f77_libs" + AC_TRY_RUN([ +# include +# define CSIZE F77_FUNC(csize,CSIZE) +# define FSIZE F77_FUNC(fsize,FSIZE) + static long size_val; + /* Called by Fortran */ + void CSIZE (i1p, i2p) + char *i1p, *i2p; + { + size_val = (i2p - i1p); + } + main() { + FILE *f=fopen ("conftestval","w"); + if (!f) return 1; + /* Call the Fortran function */ + FSIZE (); + fprintf (f, "%d\n", size_val); + return 0; + } + ]) + LDFLAGS="$old_LDFLAGS" + ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])=`cat conftestval` + rm -f conftestval conftestf.$ac_objext + ]) + AC_LANG_RESTORE() + ]) + AC_DEFINE_UNQUOTED(SIZEOF_FORTRAN_[]translit($1, [a-z *], [A-Z_p]), + [$ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])], + [The size of a Fortran `$1', as computed by sizeof.]) + +]) diff --git a/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 b/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 index 3473cf26e..3625d5902 100644 --- a/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 +++ b/salome_adm/unix/config_files/ac_cxx_depend_flag.m4 @@ -25,10 +25,9 @@ dnl define CXX_DEPEND_FLAG dnl @version $Id$ dnl @author Marc Tajchman dnl -AC_DEFUN([AC_DEPEND_FLAG], -[AC_CACHE_CHECK(which flag for dependency information generation, -ac_cv_depend_flag, -[AC_LANG_SAVE +AC_DEFUN([AC_DEPEND_FLAG],[ + AC_MSG_CHECKING([which flag for dependency information generation]) + AC_LANG_SAVE AC_LANG_C echo "conftest.o: conftest.c" > conftest.verif echo "int main() { return 0; }" > conftest.c @@ -213,6 +212,8 @@ dnl use g++ option -MG : asume unknown file will be construct later printf " C++ : ${DEPCXX} ${CXX_DEPEND_FLAG}" AC_LANG_RESTORE + AC_MSG_RESULT([ ... done]) + AC_SUBST(DEPCC) AC_SUBST(DEPCXX) AC_SUBST(DEPCXXFLAGS) @@ -220,4 +221,3 @@ dnl use g++ option -MG : asume unknown file will be construct later AC_SUBST(CXX_DEPEND_FLAG) AC_SUBST(MACHINE) ]) -]) diff --git a/salome_adm/unix/config_files/ac_cxx_have_sstream.m4 b/salome_adm/unix/config_files/ac_cxx_have_sstream.m4 index 24be4c5d9..852bc6ccb 100644 --- a/salome_adm/unix/config_files/ac_cxx_have_sstream.m4 +++ b/salome_adm/unix/config_files/ac_cxx_have_sstream.m4 @@ -26,18 +26,23 @@ dnl @version $Id$ dnl modified by Marc Tajchman (CEA) - 10/10/2002 dnl -AC_DEFUN([AC_CXX_HAVE_SSTREAM], -[AC_CACHE_CHECK(whether the compiler has stringstream, -HAVE_SSTREAM, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[stringstream message; message << "Hello"; return 0;], - HAVE_SSTREAM=yes, HAVE_SSTREAM=no) - AC_LANG_RESTORE -]) -AC_SUBST(HAVE_SSTREAM) +AC_DEFUN([AC_CXX_HAVE_SSTREAM],[ + AC_CACHE_CHECK([whether the compiler has stringstream], + [ac_cv_prog_cxx_have_sstream], + [ac_cv_prog_cxx_have_sstream=no + AC_REQUIRE([AC_CXX_NAMESPACES]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + #include + #ifdef HAVE_NAMESPACES + using namespace std; + #endif + ], + [stringstream message; message << "Hello"; return 0;], + [ac_cv_prog_cxx_have_sstream=yes],[ac_cv_prog_cxx_have_sstream=no]) + AC_LANG_RESTORE + ]) + HAVE_SSTREAM=$ac_cv_prog_cxx_have_sstream + AC_SUBST(HAVE_SSTREAM) ]) diff --git a/salome_adm/unix/config_files/check_calcium.m4 b/salome_adm/unix/config_files/check_calcium.m4 new file mode 100644 index 000000000..7a81e0164 --- /dev/null +++ b/salome_adm/unix/config_files/check_calcium.m4 @@ -0,0 +1,58 @@ +AC_DEFUN([CHECK_CALCIUM], [ + +## Guess where as cal_int type is provided by --with-cal_int option +## or auto-detection must be used + +AC_ARG_WITH([cal_int], + AC_HELP_STRING([--with-cal_int=], + [Use for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.]), + [], + [withval=no]) + +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(int) + +if test "x$withval" = "xno" +then + AC_REQUIRE([CHECK_F77]) + AC_CHECK_SIZEOF_FORTRAN(integer) + + if test "x$ac_cv_sizeof_fortran_integer" = "x8" ; then + AC_DEFINE(HAVE_F77INT64,[], + [The size of a Fortran integer, as computed by sizeof.]) + test "x$ac_cv_sizeof_long" = "x8" || AC_MSG_ERROR([Size of C type long expected to be eight bytes]) + LONG_OR_INT="long" + CALCIUM_IDL_INT_F77="long long" + CALCIUM_CORBA_INT_F77="CORBA::LongLong" + elif test "x$ac_cv_sizeof_fortran_integer" = "x4" ; then + test "x$ac_cv_sizeof_int" = "x4" || AC_MSG_ERROR([Size of C type int expected to be four bytes]) + LONG_OR_INT="int" + CALCIUM_IDL_INT_F77="long" + CALCIUM_CORBA_INT_F77="CORBA::Long" + else + AC_MSG_ERROR([Size of Fortran type integer is neither four nor eigth bytes]) + fi + +elif test "x$withval" = "xint" +then + LONG_OR_INT="int" + CALCIUM_IDL_INT_F77="long" + CALCIUM_CORBA_INT_F77="CORBA::Long" + AC_MSG_NOTICE([Using C type int for cal_int]) + +elif test "x$withval" = "xlong" +then + LONG_OR_INT="long" + CALCIUM_IDL_INT_F77="long long" + CALCIUM_CORBA_INT_F77="CORBA::LongLong" + AC_MSG_NOTICE([Using C type long for cal_int]) +else + AC_MSG_ERROR([Fortran type integer must be mapped to C type int or C type long]) +fi + +AC_SUBST(CALCIUM_IDL_INT_F77) +AC_SUBST(CALCIUM_CORBA_INT_F77) +AC_SUBST(LONG_OR_INT) +AC_DEFINE_UNQUOTED([CAL_INT],[$LONG_OR_INT], + [The C type to be used for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.]) +]) diff --git a/salome_adm/unix/config_files/check_f77.m4 b/salome_adm/unix/config_files/check_f77.m4 index e03c6c165..668026e1e 100644 --- a/salome_adm/unix/config_files/check_f77.m4 +++ b/salome_adm/unix/config_files/check_f77.m4 @@ -22,7 +22,6 @@ dnl AC_DEFUN([CHECK_F77],[ AC_PROG_F77 - AC_F77_LIBRARY_LDFLAGS AC_F77_WRAPPERS diff --git a/salome_adm/unix/config_files/local_install.m4 b/salome_adm/unix/config_files/local_install.m4 new file mode 100644 index 000000000..34c523a87 --- /dev/null +++ b/salome_adm/unix/config_files/local_install.m4 @@ -0,0 +1,65 @@ +dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +dnl +dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl +dnl --- +dnl File : local_install.m4 +dnl Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +dnl --- +dnl + +dnl The purpose of below autoconf macro is to generate custom install script +dnl to be used instead of global /usr/bin/install one. +dnl The difference is that resulting install script does not install file passed +dnl as parameter if its target copy exists and the file is not changed, i.e +dnl source and target files are the identical. +dnl The check is performed by the diff command. + +AC_DEFUN([AC_LOCAL_INSTALL], +[ +GLOBAL_INSTALL=$INSTALL +absdir=`pwd` +INSTALL=${absdir}/local-install.sh +cat > ${INSTALL} << EOF +#!/bin/sh + +nb_args=\$[#] +args=\$[*] +if test \$nb_args -gt 1 ; then + nb=\$(expr \$nb_args - 2) + shift \$nb + target=\$[2] + if test -f \$target ; then + orig=\$[1] + if test -f \$orig ; then + diff \$orig \$target > /dev/null 2>&1 + if test \$[?] = 0 ; then + echo \$orig and \$target are identical + exit 0 + fi + fi + fi +fi +${GLOBAL_INSTALL} \$args +EOF +chmod +x ${INSTALL} +AC_SUBST(INSTALL) +AC_SUBST(GLOBAL_INSTALL) +])dnl diff --git a/salome_adm/unix/make_common_starter.am b/salome_adm/unix/make_common_starter.am index 13a4014ad..deb5ea9b3 100644 --- a/salome_adm/unix/make_common_starter.am +++ b/salome_adm/unix/make_common_starter.am @@ -19,6 +19,19 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # + +# ============================================================ +# The following is to avoid PACKAGE_... env variable +# redefinition compilation warnings +# ============================================================ +if !WITHONLYLAUNCHER + AM_CXXFLAGS = -I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h + AM_CPPFLAGS = -I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h +else WITHONLYLAUNCHER + AM_CXXFLAGS = + AM_CPPFLAGS = +endif + # ============================================================ # This file defines the common definitions used in several # Makefile. This file must be included, if needed, by the file diff --git a/src/Batch/Batch_BatchManager_Local_RSH.cxx b/src/Batch/Batch_BatchManager_Local_RSH.cxx index 5165ba981..9392f8d63 100644 --- a/src/Batch/Batch_BatchManager_Local_RSH.cxx +++ b/src/Batch/Batch_BatchManager_Local_RSH.cxx @@ -29,7 +29,7 @@ * */ -#ifdef HAVE_CONFIG_H +#ifdef HAVE_SALOME_CONFIG # include #endif diff --git a/src/Batch/Batch_BatchManager_Local_SH.cxx b/src/Batch/Batch_BatchManager_Local_SH.cxx index 797f55c42..6eb790933 100644 --- a/src/Batch/Batch_BatchManager_Local_SH.cxx +++ b/src/Batch/Batch_BatchManager_Local_SH.cxx @@ -29,7 +29,7 @@ * */ -#ifdef HAVE_CONFIG_H +#ifdef HAVE_SALOME_CONFIG # include #endif diff --git a/src/Batch/Batch_BatchManager_Local_SSH.cxx b/src/Batch/Batch_BatchManager_Local_SSH.cxx index 723f91dbe..59c77fccc 100644 --- a/src/Batch/Batch_BatchManager_Local_SSH.cxx +++ b/src/Batch/Batch_BatchManager_Local_SSH.cxx @@ -29,7 +29,7 @@ * */ -#ifdef HAVE_CONFIG_H +#ifdef HAVE_SALOME_CONFIG # include #endif diff --git a/src/Batch/Makefile.am b/src/Batch/Makefile.am index 8d115a68f..75bf277bc 100644 --- a/src/Batch/Makefile.am +++ b/src/Batch/Makefile.am @@ -118,12 +118,7 @@ LIB_SRC = \ Batch_JobInfo_eSGE.cxx \ MpiImpl.cxx - LIB_CPPFLAGS = ${PYTHON_INCLUDES} -if !WITHONLYLAUNCHER - LIB_CPPFLAGS += -I$(top_builddir)/salome_adm/unix -endif - LIB_LIBADD = $(PYTHON_LIBS) # @@ -160,10 +155,6 @@ LIB_SRC +=\ Batch_Job_Local.cxx \ Batch_IOMutex.cxx -if !WITHONLYLAUNCHER - LIB_CPPFLAGS += -DHAVE_CONFIG_H -endif - endif # diff --git a/src/Communication/Makefile.am b/src/Communication/Makefile.am index 936d52524..53acb4558 100644 --- a/src/Communication/Makefile.am +++ b/src/Communication/Makefile.am @@ -50,7 +50,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/Communication_SWIG/Makefile.am b/src/Communication_SWIG/Makefile.am index 48ef7c401..4b2074d20 100644 --- a/src/Communication_SWIG/Makefile.am +++ b/src/Communication_SWIG/Makefile.am @@ -64,7 +64,6 @@ _libSALOME_Comm_la_CPPFLAGS =\ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index eca25186b..75d053454 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -88,10 +88,10 @@ Engines_Component_i::Engines_Component_i():_myConnexionToRegistry(0), _notifSupp //============================================================================= Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName, bool notif, bool regist ) : _instanceName(instanceName), @@ -259,17 +259,18 @@ void Engines_Component_i::ping() void Engines_Component_i::destroy() { MESSAGE("Engines_Component_i::destroy()"); - //SCRUTE(pd_refCount); + //SCRUTE(_refcount_value()); if(_myConnexionToRegistry)delete _myConnexionToRegistry; _myConnexionToRegistry = 0 ; if(_notifSupplier)delete _notifSupplier; _notifSupplier = 0; + _poa->deactivate_object(*_id); if(_id) delete(_id) ; - //SCRUTE(pd_refCount); - _thisObj->_remove_ref(); - //SCRUTE(pd_refCount); + //SCRUTE(_refcount_value()); + _remove_ref(); + //SCRUTE(_refcount_value()); MESSAGE("Engines_Component_i::destroyed") ; } @@ -448,17 +449,17 @@ bool Engines_Component_i::Suspend_impl() #endif { if ( _Sleeping ) - { - return false ; - } + { + return false ; + } else { #ifndef WIN32 - RetVal = Killer( _ThreadId ,SIGINT ) ; + RetVal = Killer( _ThreadId ,SIGINT ) ; #else - RetVal = Killer( *_ThreadId ,SIGINT ) ; + RetVal = Killer( *_ThreadId ,SIGINT ) ; #endif - //if ( RetVal ) _Sleeping = true; + //if ( RetVal ) _Sleeping = true; } } @@ -495,12 +496,12 @@ bool Engines_Component_i::Resume_impl() { if ( _Sleeping ) { - _Sleeping = false ; - RetVal = true ; + _Sleeping = false ; + RetVal = true ; } else { - RetVal = false ; + RetVal = false ; } } return RetVal ; @@ -524,35 +525,35 @@ CORBA::Long Engines_Component_i::CpuUsed_impl() #else if ( pthread_self().p != _ThreadId->p ) #endif - { + { if ( _Sleeping ) - { - } + { + } else - { - // Get Cpu in the appropriate thread with that object !... - theEngines_Component = this ; + { + // Get Cpu in the appropriate thread with that object !... + theEngines_Component = this ; #ifndef WIN32 - Killer( _ThreadId ,SIGUSR1 ) ; + Killer( _ThreadId ,SIGUSR1 ) ; #else - Killer( *_ThreadId ,SIGUSR11 ) ; + Killer( *_ThreadId ,SIGUSR11 ) ; #endif - } + } cpu = _ThreadCpuUsed ; - } + } else - { - _ThreadCpuUsed = CpuUsed() ; - cpu = _ThreadCpuUsed ; - // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl " - // << _serviceName << " " << cpu << endl ; + { + _ThreadCpuUsed = CpuUsed() ; + cpu = _ThreadCpuUsed ; + // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl " + // << _serviceName << " " << cpu << endl ; } } else { - cpu = _ThreadCpuUsed ; - // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl " - // << _serviceName << " " << cpu<< endl ; + cpu = _ThreadCpuUsed ; + // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl " + // << _serviceName << " " << cpu<< endl ; } } else @@ -623,11 +624,12 @@ void Engines_Component_i::beginService(const char *serviceName) { #ifndef WIN32 MESSAGE(pthread_self() << "Send BeginService notification for " <kind() == CORBA::tk_string) - { - const char* value; - (*it).second >>= value; - // ---todo: replace __GNUC__ test by an autoconf macro AC_CHECK_FUNC. + { + 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); +// 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 + //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: "< Engines_Container_i::_library_map; map Engines_Container_i::_toRemove_map; omni_mutex Engines_Container_i::_numInstanceMutex ; +static PyObject* _pyCont; + +int checkifexecutable(const std::string&); +int findpathof(std::string&, const std::string&); + /*! \class Engines_Container_i * \brief C++ implementation of Engines::Container interface * @@ -191,14 +196,7 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, if (!_isSupervContainer) { -#ifdef WIN32 - - PyEval_AcquireLock(); - PyThreadState *myTstate = PyThreadState_New(KERNEL_PYTHON::_interp); - PyThreadState *myoldTstate = PyThreadState_Swap(myTstate); -#else - Py_ACQUIRE_NEW_THREAD; -#endif + PyGILState_STATE gstate = PyGILState_Ensure(); #ifdef WIN32 // mpv: this is temporary solution: there is a unregular crash if not @@ -210,7 +208,11 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb, #endif PyRun_SimpleString("import SALOME_Container\n"); PyRun_SimpleString((char*)myCommand.c_str()); - Py_RELEASE_NEW_THREAD; + PyObject *mainmod = PyImport_AddModule("__main__"); + PyObject *globals = PyModule_GetDict(mainmod); + _pyCont = PyDict_GetItemString(globals, "pyCont"); + + PyGILState_Release(gstate); } fileTransfer_i* aFileTransfer = new fileTransfer_i(); @@ -350,11 +352,10 @@ void Engines_Container_i::Shutdown() // ignore this entry and continue } } + _listInstances_map.clear(); _NS->Destroy_FullDirectory(_containerName.c_str()); _NS->Destroy_Name(_containerName.c_str()); - //_remove_ref(); - //_poa->deactivate_object(*_id); if(_isServantAloneInProcess) { MESSAGE("Effective Shutdown of container Begins..."); @@ -404,8 +405,8 @@ int findpathof(string& pth, const string& exe) { string path( getenv("PATH") ); if ( path.size() == 0 ) - return 0; - + return 0; + char path_spr = #ifdef WIN32 ';'; @@ -519,9 +520,11 @@ Engines_Container_i::load_component_Library(const char* componentName) return true; } + std::string retso=""; #ifndef WIN32 void* handle; handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ; + if ( !handle )retso=dlerror(); #else HINSTANCE handle; handle = LoadLibrary( impl_name.c_str() ); @@ -538,6 +541,7 @@ Engines_Container_i::load_component_Library(const char* componentName) // --- try import Python component INFOS("try import Python component "<(_poa->reference_to_servant(iobject)); ASSERT(servant); - //SCRUTE(servant->pd_refCount); - servant->_remove_ref(); // compensate previous id_to_reference - //SCRUTE(servant->pd_refCount); + //SCRUTE(servant->_refcount_value()); _numInstanceMutex.lock() ; // lock to be alone (stl container write) _listInstances_map[instanceName] = iobject; _cntInstances_map[aGenRegisterName] += 1; _numInstanceMutex.unlock() ; SCRUTE(aGenRegisterName); SCRUTE(_cntInstances_map[aGenRegisterName]); - //SCRUTE(servant->pd_refCount); -#if defined(_DEBUG_) || defined(_DEBUG) - bool ret_studyId = servant->setStudyId(studyId); - ASSERT(ret_studyId); -#else servant->setStudyId(studyId); -#endif + servant->_remove_ref(); // do not need servant any more (remove ref from reference_to_servant) + //SCRUTE(servant->_refcount_value()); // --- register the engine under the name // containerName(.dir)/instanceName(.object) @@ -1243,6 +1238,7 @@ void ActSigIntHandler() #ifndef WIN32 struct sigaction SigIntAct ; SigIntAct.sa_sigaction = &SigIntHandler ; + sigemptyset(&SigIntAct.sa_mask); SigIntAct.sa_flags = SA_SIGINFO ; #endif diff --git a/src/Container/Makefile.am b/src/Container/Makefile.am index 9c6bffe17..a80fc288e 100644 --- a/src/Container/Makefile.am +++ b/src/Container/Makefile.am @@ -71,7 +71,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Notification \ -I$(srcdir)/../ResourcesManager \ -I$(srcdir)/../HDFPersist \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@ diff --git a/src/Container/SALOME_ComponentPy.py b/src/Container/SALOME_ComponentPy.py index 1d5722ad9..da1f89f15 100755 --- a/src/Container/SALOME_ComponentPy.py +++ b/src/Container/SALOME_ComponentPy.py @@ -288,7 +288,7 @@ class SALOME_ComponentPy_i (Engines__POA.Component): def DumpPython(self, theStudy, isPublished): aBuffer = "def RebuildData(theStudy): pass\n\0" - return (aBuffer, 1) + return (aBuffer, 1) #------------------------------------------------------------------------- @@ -298,7 +298,7 @@ class SALOME_ComponentPy_i (Engines__POA.Component): #------------------------------------------------------------------------- def hasObjectInfo(self): - return 0 + return 0 #------------------------------------------------------------------------- diff --git a/src/Container/SALOME_Component_i.hxx b/src/Container/SALOME_Component_i.hxx index 2285e5f4d..b87f3212b 100644 --- a/src/Container/SALOME_Component_i.hxx +++ b/src/Container/SALOME_Component_i.hxx @@ -55,18 +55,18 @@ class CONTAINER_EXPORT Engines_Component_i: public: Engines_Component_i(); Engines_Component_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - PortableServer::ObjectId * contId, - const char *instanceName, - const char *interfaceName, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName, bool notif = false, bool regist = true); //Constructor for standalone component Engines_Component_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - Engines::Container_ptr container, - const char *instanceName, - const char *interfaceName, + PortableServer::POA_ptr poa, + Engines::Container_ptr container, + const char *instanceName, + const char *interfaceName, bool notif = false, bool regist = true); @@ -120,7 +120,7 @@ public: PortableServer::ObjectId * getId(); Engines_Container_i *GetContainerPtr(); - bool setStudyId(CORBA::Long studyId); + virtual bool setStudyId(CORBA::Long studyId); static bool isMultiStudy(); static bool isMultiInstance(); static std::string GetDynLibraryName(const char *componentName); diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index cdcfc64a9..c4a1e0dba 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -200,7 +200,10 @@ int main(int argc, char* argv[]) if (!isSupervContainer) { PyGILState_Ensure(); - //Delete python container that destroy orb from python (pyCont._orb.destroy()) + //Destroy orb from python (for chasing memory leaks) + //PyRun_SimpleString("from omniORB import CORBA"); + //PyRun_SimpleString("orb=CORBA.ORB_init([''], CORBA.ORB_ID)"); + //PyRun_SimpleString("orb.destroy()"); Py_Finalize(); } else @@ -235,9 +238,6 @@ int main(int argc, char* argv[]) #endif #endif - //END_OF(argv[0]); - //LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance(); - //bp1->deleteInstance(bp1); return 0 ; } diff --git a/src/Container/SALOME_Container.py b/src/Container/SALOME_Container.py index 1a92f6b54..73ba33123 100644 --- a/src/Container/SALOME_Container.py +++ b/src/Container/SALOME_Container.py @@ -46,7 +46,7 @@ from launchConfigureParser import verbose #============================================================================= -#define an implementation of the container interface +#define an implementation of the container interface for embedding in Container implemented in C++ class SALOME_Container_i: _orb = None @@ -67,20 +67,17 @@ class SALOME_Container_i: #------------------------------------------------------------------------- - #def __del__(self ): - # self._orb.destroy() - def import_component(self, componentName): MESSAGE( "SALOME_Container_i::import_component" ) - ret=0 + ret="" try: if verbose(): print "try import ",componentName __import__(componentName) if verbose(): print "import ",componentName," successful" - ret=1 except: + import traceback + ret=traceback.format_exc(10) if verbose(): - import traceback traceback.print_exc() print "import ",componentName," not possible" return ret diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 0ac18204f..d1e401c85 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -81,6 +81,21 @@ SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableSer _NS->Register(refContMan,_ContainerManagerNameInNS); _isAppliSalomeDefined = (getenv("APPLI") != 0); + +#ifdef HAVE_MPI2 +#ifdef WITHOPENMPI + if( getenv("OMPI_URI_FILE") != NULL ){ + system("killall ompi-server"); + string command; + command = "ompi-server -r "; + command += getenv("OMPI_URI_FILE"); + int status=system(command.c_str()); + if(status!=0) + throw SALOME_Exception("Error when launching ompi-server"); + } +#endif +#endif + MESSAGE("constructor end"); } @@ -93,6 +108,12 @@ SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableSer SALOME_ContainerManager::~SALOME_ContainerManager() { MESSAGE("destructor"); +#ifdef HAVE_MPI2 +#ifdef WITHOPENMPI + if( getenv("OMPI_URI_FILE") != NULL ) + system("killall ompi-server"); +#endif +#endif } //============================================================================= @@ -147,28 +168,28 @@ void SALOME_ContainerManager::ShutdownContainers() { try { - SCRUTE((*iter)); - CORBA::Object_var obj=_NS->Resolve((*iter).c_str()); - Engines::Container_var cont=Engines::Container::_narrow(obj); - if(!CORBA::is_nil(cont)) - { - MESSAGE("ShutdownContainers: " << (*iter)); - cont->Shutdown(); - } - else - MESSAGE("ShutdownContainers: no container ref for " << (*iter)); + SCRUTE((*iter)); + CORBA::Object_var obj=_NS->Resolve((*iter).c_str()); + Engines::Container_var cont=Engines::Container::_narrow(obj); + if(!CORBA::is_nil(cont)) + { + MESSAGE("ShutdownContainers: " << (*iter)); + cont->Shutdown(); + } + else + MESSAGE("ShutdownContainers: no container ref for " << (*iter)); } catch(CORBA::SystemException& e) { - INFOS("CORBA::SystemException ignored : " << e); + INFOS("CORBA::SystemException ignored : " << e); } catch(CORBA::Exception&) { - INFOS("CORBA::Exception ignored."); + INFOS("CORBA::Exception ignored."); } catch(...) { - INFOS("Unknown exception ignored."); + INFOS("Unknown exception ignored."); } } } @@ -273,7 +294,11 @@ SALOME_ContainerManager::StartContainer(const Engines::MachineParameters& params //check if an entry exists in Naming service //if params.mode == "start" or "" shutdown the existing container before launching a new one with that name //if params.mode == "getorstart" or "get" use the existing container - containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str()); + if(params.isMPI) + // A parallel container register on zero node in NS + containerNameInNS = _NS->BuildContainerNameForNS(params,GetMPIZeroNode(theMachine).c_str()); + else + containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str()); SCRUTE(containerNameInNS); CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str()); @@ -287,7 +312,10 @@ SALOME_ContainerManager::StartContainer(const Engines::MachineParameters& params if(std::string(params.mode.in())=="getorstart"||std::string(params.mode.in())=="get") return cont._retn(); /* the container exists and params.mode is getorstart or get use it*/ else - cont->Shutdown(); // shutdown the registered container if it exists + { + INFOS("A container is already registered with the name: " << containerNameInNS << ", shutdown the existing container"); + cont->Shutdown(); // shutdown the registered container if it exists + } } } catch(CORBA::Exception&) @@ -310,8 +338,29 @@ SALOME_ContainerManager::StartContainer(const Engines::MachineParameters& params command = BuildCommandToLaunchRemoteContainer(theMachine,params,container_exe); //redirect stdout and stderr in a file - string logFilename="/tmp/"+_NS->ContainerName(params)+"_"+ theMachine +"_"+getenv( "USER" )+".log" ; - command += " > " + logFilename + " 2>&1 &"; +#ifdef WNT + string logFilename=getenv("TEMP"); + logFilename += "\\"; +#else + string logFilename="/tmp"; + char* val = getenv("SALOME_TMP_DIR"); + if(val) + { + struct stat file_info; + stat(val, &file_info); + bool is_dir = S_ISDIR(file_info.st_mode); + if (is_dir)logFilename=val; + else std::cerr << "SALOME_TMP_DIR environment variable is not a directory use /tmp instead" << std::endl; + } + logFilename += "/"; +#endif + logFilename += _NS->ContainerName(params)+"_"+ theMachine +"_"+getenv( "USER" )+".log" ; + command += " > " + logFilename + " 2>&1"; +#ifdef WNT + command = "%PYTHONBIN% -c \"import win32pm ; win32pm.spawnpid(r'" + command + "', '')\""; +#else + command += " &"; +#endif // launch container with a system call int status=system(command.c_str()); @@ -599,12 +648,12 @@ SALOME_ContainerManager::StartParallelContainer(const Engines::MachineParameters // Il faut tuer le proxy try { - Engines::Container_var proxy = Engines::Container::_narrow(container_proxy); - proxy->Shutdown(); + Engines::Container_var proxy = Engines::Container::_narrow(container_proxy); + proxy->Shutdown(); } catch (...) { - INFOS("[StartParallelContainer] Exception catched from proxy Shutdown..."); + INFOS("[StartParallelContainer] Exception catched from proxy Shutdown..."); } return ret; } @@ -622,34 +671,34 @@ SALOME_ContainerManager::StartParallelContainer(const Engines::MachineParameters obj = _NS->Resolve(containerNameInNS.c_str()); if (CORBA::is_nil(obj)) { - INFOS("[StartParallelContainer] CONNECTION FAILED From Naming Service !"); - INFOS("[StartParallelContainer] Container name is " << containerNameInNS); - return ret; + INFOS("[StartParallelContainer] CONNECTION FAILED From Naming Service !"); + INFOS("[StartParallelContainer] Container name is " << containerNameInNS); + return ret; } try { - MESSAGE("[StartParallelContainer] Deploying node : " << container_node_name); - PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj); - node->deploy(); - MESSAGE("[StartParallelContainer] node " << container_node_name << " is deployed"); + MESSAGE("[StartParallelContainer] Deploying node : " << container_node_name); + PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj); + node->deploy(); + MESSAGE("[StartParallelContainer] node " << container_node_name << " is deployed"); } catch(CORBA::SystemException& e) { - INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS); - INFOS("CORBA::SystemException : " << e); - return ret; + INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS); + INFOS("CORBA::SystemException : " << e); + return ret; } catch(CORBA::Exception& e) { - INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS); - INFOS("CORBA::Exception" << e); - return ret; + INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS); + INFOS("CORBA::Exception" << e); + return ret; } catch(...) { - INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS); - INFOS("Unknown exception !"); - return ret; + INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS); + INFOS("Unknown exception !"); + return ret; } } @@ -715,9 +764,9 @@ SALOME_ContainerManager::StartParallelContainer(const Engines::MachineParameters //============================================================================= CORBA::Object_ptr SALOME_ContainerManager::LaunchParallelContainer(const std::string& command, - const Engines::MachineParameters& params, - const std::string& name, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine) + const Engines::MachineParameters& params, + const std::string& name, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine) { CORBA::Object_ptr obj = CORBA::Object::_nil(); std::string containerNameInNS; @@ -768,17 +817,17 @@ SALOME_ContainerManager::LaunchParallelContainer(const std::string& command, INFOS("[LaunchParallelContainer] Waiting for Parallel Container node " << containerNameInNS << " on " << theMachine); while (CORBA::is_nil(obj) && count) { #ifndef WIN32 - sleep(1) ; + sleep(1) ; #else - Sleep(1000); + Sleep(1000); #endif - count-- ; - obj = _NS->Resolve(containerNameInNS.c_str()); + count-- ; + obj = _NS->Resolve(containerNameInNS.c_str()); } if (CORBA::is_nil(obj)) { - INFOS("[LaunchParallelContainer] Launch of node failed (or not found) !"); - return obj; + INFOS("[LaunchParallelContainer] Launch of node failed (or not found) !"); + return obj; } } } @@ -851,7 +900,7 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer { string command; int nbproc; - + if ( ! _isAppliSalomeDefined ) command = BuildTempFileToLaunchRemoteContainer(machine, params); @@ -882,21 +931,21 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer throw SALOME_Exception("Unknown protocol"); if (resInfo.UserName != "") - { - command += resInfo.UserName; - command += "@"; - } + { + command += resInfo.UserName; + command += "@"; + } command += machine; command += " "; if (resInfo.AppliPath != "") - command += resInfo.AppliPath; // path relative to user@machine $HOME + command += resInfo.AppliPath; // path relative to user@machine $HOME else - { - ASSERT(getenv("APPLI")); - command += getenv("APPLI"); // path relative to user@machine $HOME - } + { + ASSERT(getenv("APPLI")); + command += getenv("APPLI"); // path relative to user@machine $HOME + } command += "/runRemote.sh "; @@ -919,23 +968,23 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer } if(params.isMPI) - { - command += " mpirun -np "; - std::ostringstream o; - o << nbproc << " "; - command += o.str(); + { + command += " mpirun -np "; + std::ostringstream o; + o << nbproc << " "; + command += o.str(); #ifdef WITHLAM - command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace "; + command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace "; #elif defined(WITHOPENMPI) - if( getenv("OMPI_URI_FILE") == NULL ) - command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; - else{ - command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; - command += getenv("OMPI_URI_FILE"); - } -#endif - command += " SALOME_MPIContainer "; - } + if( getenv("OMPI_URI_FILE") == NULL ) + command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; + else{ + command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; + command += getenv("OMPI_URI_FILE"); + } +#endif + command += " SALOME_MPIContainer "; + } else command += " " +container_exe+ " "; @@ -991,7 +1040,7 @@ SALOME_ContainerManager::BuildCommandToLaunchLocalContainer #elif defined(WITHOPENMPI) //command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace "; if( getenv("OMPI_URI_FILE") == NULL ) - command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; + command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; else { command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; @@ -1197,10 +1246,10 @@ SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer tempOutputFile << "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace "; #elif defined(WITHOPENMPI) if( getenv("OMPI_URI_FILE") == NULL ) - tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; + tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; else{ - tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; - tempOutputFile << getenv("OMPI_URI_FILE"); + tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; + tempOutputFile << getenv("OMPI_URI_FILE"); } #endif } @@ -1283,9 +1332,9 @@ SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer //============================================================================= string SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string& exe_name, - const Engines::MachineParameters& params, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine, - const std::string proxy_hostname) + const Engines::MachineParameters& params, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine, + const std::string proxy_hostname) { // This method knows the differences between the proxy and the nodes. // nb_component_nodes is not used in the same way if it is a proxy or @@ -1338,14 +1387,14 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string if (is_a_proxy) { machine_file_name = _ResManager->getMachineFile(hostname, - 1, - parallelLib); + 1, + parallelLib); } else { machine_file_name = _ResManager->getMachineFile(hostname, - params.nb_component_nodes, - parallelLib); + params.nb_component_nodes, + parallelLib); } if (machine_file_name == "") { @@ -1393,32 +1442,32 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string std::string command_remote(""); if (remote) { - std::string machine_name; - std::ifstream machine_file(machine_file_name.c_str()); - std::getline(machine_file, machine_name); - MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name) - - // We want to launch a command like : - // ssh user@machine distantPath/runRemote.sh hostNS portNS - const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name); - if (resInfo.Protocol == rsh) - command_remote = "rsh "; - else - command_remote = "ssh "; - command_remote += resInfo.UserName; - command_remote += "@"; - command_remote += machine_name; - command_remote += " "; - command_remote += resInfo.AppliPath; // path relative to user@machine $HOME - command_remote += "/runRemote.sh "; - ASSERT(getenv("NSHOST")); - command_remote += getenv("NSHOST"); // hostname of CORBA name server - command_remote += " "; - ASSERT(getenv("NSPORT")); - command_remote += getenv("NSPORT"); // port of CORBA name server - command_remote += " "; - - hostname = machine_name; + std::string machine_name; + std::ifstream machine_file(machine_file_name.c_str()); + std::getline(machine_file, machine_name); + MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name) + + // We want to launch a command like : + // ssh user@machine distantPath/runRemote.sh hostNS portNS + const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name); + if (resInfo.Protocol == rsh) + command_remote = "rsh "; + else + command_remote = "ssh "; + command_remote += resInfo.UserName; + command_remote += "@"; + command_remote += machine_name; + command_remote += " "; + command_remote += resInfo.AppliPath; // path relative to user@machine $HOME + command_remote += "/runRemote.sh "; + ASSERT(getenv("NSHOST")); + command_remote += getenv("NSHOST"); // hostname of CORBA name server + command_remote += " "; + ASSERT(getenv("NSPORT")); + command_remote += getenv("NSPORT"); // port of CORBA name server + command_remote += " "; + + hostname = machine_name; } command = real_exe_name; @@ -1436,63 +1485,63 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string { std::ifstream * machine_file = NULL; if (remote) - machine_file = new std::ifstream(machine_file_name.c_str()); + machine_file = new std::ifstream(machine_file_name.c_str()); for (int i= 0; i < nb_nodes; i++) { - std::string command_remote(""); - if (remote) - { - std::string machine_name; - std::getline(*machine_file, machine_name); - MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name) - - // We want to launch a command like : - // ssh user@machine distantPath/runRemote.sh hostNS portNS - const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name); - if (resInfo.Protocol == rsh) - command_remote = "rsh "; - else - command_remote = "ssh "; - command_remote += resInfo.UserName; - command_remote += "@"; - command_remote += machine_name; - command_remote += " "; - command_remote += resInfo.AppliPath; // path relative to user@machine $HOME - command_remote += "/runRemote.sh "; - ASSERT(getenv("NSHOST")); - command_remote += getenv("NSHOST"); // hostname of CORBA name server - command_remote += " "; - ASSERT(getenv("NSPORT")); - command_remote += getenv("NSPORT"); // port of CORBA name server - command_remote += " "; - - hostname = machine_name; - } - - std::ostringstream tmp; - tmp << i; - std::string proc_number = tmp.str(); - - std::string command_tmp(""); - command_tmp += real_exe_name; - command_tmp += " " + _NS->ContainerName(rtn); - command_tmp += " " + parallelLib; - command_tmp += " " + proxy_hostname; - command_tmp += " " + proc_number; - command_tmp += " -"; - AddOmninamesParams(command_tmp); - - // On change _Node_ par _Nodex_ pour avoir chaque noeud - // sur un fichier - std::string command_end_tmp = command_end; - std::string::size_type loc_node = command_end_tmp.find("_Node_"); - if (loc_node != std::string::npos) - command_end_tmp.insert(loc_node+5, proc_number); - command += command_begin + command_remote + command_tmp + command_end_tmp; - vect_machine.push_back(hostname); + std::string command_remote(""); + if (remote) + { + std::string machine_name; + std::getline(*machine_file, machine_name); + MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name) + + // We want to launch a command like : + // ssh user@machine distantPath/runRemote.sh hostNS portNS + const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name); + if (resInfo.Protocol == rsh) + command_remote = "rsh "; + else + command_remote = "ssh "; + command_remote += resInfo.UserName; + command_remote += "@"; + command_remote += machine_name; + command_remote += " "; + command_remote += resInfo.AppliPath; // path relative to user@machine $HOME + command_remote += "/runRemote.sh "; + ASSERT(getenv("NSHOST")); + command_remote += getenv("NSHOST"); // hostname of CORBA name server + command_remote += " "; + ASSERT(getenv("NSPORT")); + command_remote += getenv("NSPORT"); // port of CORBA name server + command_remote += " "; + + hostname = machine_name; + } + + std::ostringstream tmp; + tmp << i; + std::string proc_number = tmp.str(); + + std::string command_tmp(""); + command_tmp += real_exe_name; + command_tmp += " " + _NS->ContainerName(rtn); + command_tmp += " " + parallelLib; + command_tmp += " " + proxy_hostname; + command_tmp += " " + proc_number; + command_tmp += " -"; + AddOmninamesParams(command_tmp); + + // On change _Node_ par _Nodex_ pour avoir chaque noeud + // sur un fichier + std::string command_end_tmp = command_end; + std::string::size_type loc_node = command_end_tmp.find("_Node_"); + if (loc_node != std::string::npos) + command_end_tmp.insert(loc_node+5, proc_number); + command += command_begin + command_remote + command_tmp + command_end_tmp; + vect_machine.push_back(hostname); } if (machine_file) - delete machine_file; + delete machine_file; } } else if (parallelLib == "Mpi") @@ -1516,9 +1565,9 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string std::string command_remote(""); const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine); if (resInfo.Protocol == rsh) - command_remote = "rcp "; + command_remote = "rcp "; else - command_remote = "scp "; + command_remote = "scp "; command_remote += machine_file_name; command_remote += " "; @@ -1531,8 +1580,8 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string int status = system(command_remote.c_str()); if (status == -1) { - INFOS("copy of the mpi machine file failed !"); - return ""; + INFOS("copy of the mpi machine file failed !"); + return ""; } } @@ -1541,27 +1590,27 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string std::string command_remote(""); if (remote) { - // We want to launch a command like : - // ssh user@machine distantPath/runRemote.sh hostNS portNS - const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine); - if (resInfo.Protocol == rsh) - command_remote = "rsh "; - else - command_remote = "ssh "; - command_remote += resInfo.UserName; - command_remote += "@"; - command_remote += remote_machine; - command_remote += " "; - command_remote += resInfo.AppliPath; // path relative to user@machine $HOME - command_remote += "/runRemote.sh "; - ASSERT(getenv("NSHOST")); - command_remote += getenv("NSHOST"); // hostname of CORBA name server - command_remote += " "; - ASSERT(getenv("NSPORT")); - command_remote += getenv("NSPORT"); // port of CORBA name server - command_remote += " "; - - hostname = remote_machine; + // We want to launch a command like : + // ssh user@machine distantPath/runRemote.sh hostNS portNS + const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine); + if (resInfo.Protocol == rsh) + command_remote = "rsh "; + else + command_remote = "ssh "; + command_remote += resInfo.UserName; + command_remote += "@"; + command_remote += remote_machine; + command_remote += " "; + command_remote += resInfo.AppliPath; // path relative to user@machine $HOME + command_remote += "/runRemote.sh "; + ASSERT(getenv("NSHOST")); + command_remote += getenv("NSHOST"); // hostname of CORBA name server + command_remote += " "; + ASSERT(getenv("NSPORT")); + command_remote += getenv("NSPORT"); // port of CORBA name server + command_remote += " "; + + hostname = remote_machine; } // We use Dummy proxy for MPI parallel containers @@ -1582,61 +1631,61 @@ SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string std::string command_remote(""); if (remote) { - const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine); - if (resInfo.Protocol == rsh) - command_remote = "rsh "; - else - command_remote = "ssh "; - command_remote += resInfo.UserName; - command_remote += "@"; - command_remote += remote_machine; - command_remote += " "; - - std::string new_real_exe_name(""); - new_real_exe_name += resInfo.AppliPath; // path relative to user@machine $HOME - new_real_exe_name += "/runRemote.sh "; - ASSERT(getenv("NSHOST")); - new_real_exe_name += getenv("NSHOST"); // hostname of CORBA name server - new_real_exe_name += " "; - ASSERT(getenv("NSPORT")); - new_real_exe_name += getenv("NSPORT"); // port of CORBA name server - new_real_exe_name += " "; - - real_exe_name = new_real_exe_name + real_exe_name; - hostname = remote_machine; + const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine); + if (resInfo.Protocol == rsh) + command_remote = "rsh "; + else + command_remote = "ssh "; + command_remote += resInfo.UserName; + command_remote += "@"; + command_remote += remote_machine; + command_remote += " "; + + std::string new_real_exe_name(""); + new_real_exe_name += resInfo.AppliPath; // path relative to user@machine $HOME + new_real_exe_name += "/runRemote.sh "; + ASSERT(getenv("NSHOST")); + new_real_exe_name += getenv("NSHOST"); // hostname of CORBA name server + new_real_exe_name += " "; + ASSERT(getenv("NSPORT")); + new_real_exe_name += getenv("NSPORT"); // port of CORBA name server + new_real_exe_name += " "; + + real_exe_name = new_real_exe_name + real_exe_name; + hostname = remote_machine; } const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(hostname); if (resInfo.mpi == lam) { - command = "mpiexec -ssi boot "; - if (resInfo.Protocol == rsh) - command += "rsh "; - else - command += "ssh "; - command += "-machinefile " + machine_file_name + " "; - command += "-n " + nbproc + " "; - command += real_exe_name; - command += " " + _NS->ContainerName(rtn); - command += " " + parallelLib; - command += " " + proxy_hostname; - command += " -"; - AddOmninamesParams(command); + command = "mpiexec -ssi boot "; + if (resInfo.Protocol == rsh) + command += "rsh "; + else + command += "ssh "; + command += "-machinefile " + machine_file_name + " "; + command += "-n " + nbproc + " "; + command += real_exe_name; + command += " " + _NS->ContainerName(rtn); + command += " " + parallelLib; + command += " " + proxy_hostname; + command += " -"; + AddOmninamesParams(command); } else { - command = "mpirun -np " + nbproc + " "; - command += real_exe_name; - command += " " + _NS->ContainerName(rtn); - command += " " + parallelLib; - command += " " + proxy_hostname; - command += " -"; - AddOmninamesParams(command); + command = "mpirun -np " + nbproc + " "; + command += real_exe_name; + command += " " + _NS->ContainerName(rtn); + command += " " + parallelLib; + command += " " + proxy_hostname; + command += " -"; + AddOmninamesParams(command); } command = command_begin + command_remote + command + command_end; for (int i= 0; i < nb_nodes; i++) - vect_machine.push_back(proxy_hostname); + vect_machine.push_back(proxy_hostname); } } else diff --git a/src/Container/SALOME_ContainerManager.hxx b/src/Container/SALOME_ContainerManager.hxx index d5f4b2b2d..e401de3be 100644 --- a/src/Container/SALOME_ContainerManager.hxx +++ b/src/Container/SALOME_ContainerManager.hxx @@ -77,14 +77,14 @@ protected: void fillBatchLaunchedContainers(); std::string BuildCommandToLaunchRemoteContainer(const std::string& machine, - const Engines::MachineParameters& params, - const std::string& container_exe="SALOME_Container"); + const Engines::MachineParameters& params, + const std::string& container_exe="SALOME_Container"); std::string BuildCommandToLaunchLocalContainer(const Engines::MachineParameters& params, const std::string& container_exe="SALOME_Container"); std::string BuildTempFileToLaunchRemoteContainer(const std::string& machine, - const Engines::MachineParameters& params) throw(SALOME_Exception); + const Engines::MachineParameters& params) throw(SALOME_Exception); void RmTmpFile(std::string& tmpFile); @@ -99,14 +99,14 @@ protected: // For PacO++ Parallel extension typedef std::vector actual_launch_machine_t; std::string BuildCommandToLaunchParallelContainer(const std::string& exe_name, - const Engines::MachineParameters& params, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine, - const std::string proxy_hostname = ""); + const Engines::MachineParameters& params, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine, + const std::string proxy_hostname = ""); CORBA::Object_ptr LaunchParallelContainer(const std::string& command, - const Engines::MachineParameters& params, - const std::string& name, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine); + const Engines::MachineParameters& params, + const std::string& name, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine); CORBA::ORB_var _orb; PortableServer::POA_var _poa; diff --git a/src/Container/SALOME_ContainerPy.py b/src/Container/SALOME_ContainerPy.py index 955a1d8d9..2e3d893eb 100755 --- a/src/Container/SALOME_ContainerPy.py +++ b/src/Container/SALOME_ContainerPy.py @@ -42,7 +42,7 @@ from launchConfigureParser import verbose #============================================================================= -#define an implementation of the container interface +#define an implementation of the container interface for the container implemented in Python class SALOME_ContainerPy_i (Engines__POA.Container): _orb = None @@ -58,7 +58,6 @@ class SALOME_ContainerPy_i (Engines__POA.Container): self._poa = poa myMachine=getShortHostName() Container_path = "/Containers/" + myMachine + "/" + containerName - #self._containerName = containerName self._containerName = Container_path if verbose(): print "container name ",self._containerName @@ -174,10 +173,9 @@ class SALOME_ContainerPy_i (Engines__POA.Container): if verbose(): print "import ",componentName," successful" ret=1 except: - if verbose(): - import traceback - traceback.print_exc() - print "import ",componentName," not possible" + import traceback + traceback.print_exc() + print "import ",componentName," not possible" return ret #------------------------------------------------------------------------- @@ -187,24 +185,6 @@ class SALOME_ContainerPy_i (Engines__POA.Container): ret = 0 instanceName = componentName + "_inst_" + `self._numInstance` interfaceName = componentName - #the_command = "import " + componentName + "\n" - #the_command = the_command + "comp_i = " + componentName + "." + componentName - #the_command = the_command + "(self._orb, self._poa, self._this(), self._containerName, instanceName, interfaceName)\n" - #MESSAGE( "SALOME_ContainerPy_i::load_component_Library :" + str (the_command) ) - #exec the_command - #comp_o = comp_i._this() - #if comp_o is not None: - # ret = 1 - #else: - # --- try to import Python component - # retImpl = self.import_component(componentName) - # if retImpl == 1: - #import is possible - # ret = 1 - # else: - #import isn't possible - # ret = 0 - #return ret return self.import_component(componentName) #------------------------------------------------------------------------- diff --git a/src/Container/SALOME_Container_i.hxx b/src/Container/SALOME_Container_i.hxx index 9dae83fb6..e45b939e6 100644 --- a/src/Container/SALOME_Container_i.hxx +++ b/src/Container/SALOME_Container_i.hxx @@ -53,11 +53,11 @@ class CONTAINER_EXPORT Engines_Container_i: public: Engines_Container_i(); Engines_Container_i(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - char * containerName , + PortableServer::POA_ptr poa, + char * containerName , int argc, char* argv[], - bool activAndRegist = true, - bool isServantAloneInProcess = true); + bool activAndRegist = true, + bool isServantAloneInProcess = true); virtual ~Engines_Container_i(); // --- CORBA methods @@ -66,15 +66,15 @@ public: virtual Engines::Component_ptr create_component_instance( const char* componentName, - CORBA::Long studyId); // 0 for multiStudy + CORBA::Long studyId); // 0 for multiStudy Engines::Component_ptr find_component_instance( const char* registeredName, - CORBA::Long studyId); // 0 for multiStudy + CORBA::Long studyId); // 0 for multiStudy Engines::Component_ptr load_impl(const char* nameToRegister, - const char* componentName); + const char* componentName); void remove_impl(Engines::Component_ptr component_i); @@ -101,12 +101,12 @@ public: Engines::Component_ptr find_or_create_instance( std::string genericRegisterName, - std::string componentLibraryName); + std::string componentLibraryName); Engines::Component_ptr createInstance(std::string genericRegisterName, - void *handle, - int studyId); + void *handle, + int studyId); static bool isPythonContainer(const char* ContainerName); static void decInstanceCnt(std::string genericRegisterName); diff --git a/src/Container/SALOME_FileRef_i.cxx b/src/Container/SALOME_FileRef_i.cxx index 62c06dbcb..f4b670be7 100644 --- a/src/Container/SALOME_FileRef_i.cxx +++ b/src/Container/SALOME_FileRef_i.cxx @@ -48,7 +48,7 @@ fileRef_i::fileRef_i() //============================================================================= fileRef_i::fileRef_i(Engines::Container_ptr container, - const char* origFileName) + const char* origFileName) { MESSAGE("fileRef_i::fileRef_i "<< origFileName); _container = Engines::Container::_duplicate(container); @@ -126,7 +126,7 @@ Engines::Container_ptr fileRef_i::getContainer() //============================================================================= CORBA::Boolean fileRef_i::addRef(const char* machine, - const char* fileName) + const char* fileName) { MESSAGE("fileRef_i::addRef " << machine << " " << fileName); string theMachine = machine; @@ -147,7 +147,7 @@ CORBA::Boolean fileRef_i::addRef(const char* machine, if (! _copies[theMachine].empty()) { INFOS("there is already a copy on " << theMachine << " under the path " - << _copies[theMachine] << " new ref not added! "); + << _copies[theMachine] << " new ref not added! "); return 0; } @@ -173,12 +173,12 @@ char* fileRef_i::getRef(const char* machine) if (_copies[theMachine].empty()) { MESSAGE("no copy of " << _machine << _origFileName << " available on " - << theMachine); + << theMachine); } else { MESSAGE("a copy of " << _machine << _origFileName << "is available on " - << theMachine << _copies[theMachine]); + << theMachine << _copies[theMachine]); } return CORBA::string_dup(_copies[theMachine].c_str()); } diff --git a/src/Container/SALOME_FileRef_i.hxx b/src/Container/SALOME_FileRef_i.hxx index 357473bf6..53266d217 100644 --- a/src/Container/SALOME_FileRef_i.hxx +++ b/src/Container/SALOME_FileRef_i.hxx @@ -42,7 +42,7 @@ class CONTAINER_EXPORT fileRef_i: public: fileRef_i(); fileRef_i(Engines::Container_ptr container, - const char* origFileName); + const char* origFileName); virtual ~fileRef_i(); char* origFileName(); @@ -52,7 +52,7 @@ public: Engines::Container_ptr getContainer(); CORBA::Boolean addRef(const char* machine, - const char* fileName); + const char* fileName); char* getRef(const char* machine); diff --git a/src/Container/Salome_file_i.cxx b/src/Container/Salome_file_i.cxx index 567fd1dc5..25949f9fc 100644 --- a/src/Container/Salome_file_i.cxx +++ b/src/Container/Salome_file_i.cxx @@ -175,66 +175,66 @@ Salome_file_i::load(const char* hdf5_file) { if (mode == "all") { - // Changing path, is now current directory - path = getcwd(NULL, _path_max); + // Changing path, is now current directory + path = getcwd(NULL, _path_max); - std::string group_name("GROUP"); - group_name += file_name; - hdf_group = new HDFgroup(group_name.c_str(),hdf_file); - hdf_group->OpenOnDisk(); - hdf_dataset = new HDFdataset("FILE DATASET",hdf_group); - hdf_dataset->OpenOnDisk(); - size = hdf_dataset->GetSize(); - buffer = new char[size]; + std::string group_name("GROUP"); + group_name += file_name; + hdf_group = new HDFgroup(group_name.c_str(),hdf_file); + hdf_group->OpenOnDisk(); + hdf_dataset = new HDFdataset("FILE DATASET",hdf_group); + hdf_dataset->OpenOnDisk(); + size = hdf_dataset->GetSize(); + buffer = new char[size]; - if ( (fd = ::open(file_name.c_str(),O_RDWR|O_CREAT,00666)) <0) { - SALOME::ExceptionStruct es; - es.type = SALOME::INTERNAL_ERROR; - std::string text = "open failed"; - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - }; - hdf_dataset->ReadFromDisk(buffer); - if ( write(fd,buffer,size) <0) { - SALOME::ExceptionStruct es; - es.type = SALOME::INTERNAL_ERROR; - std::string text = "write failed"; - es.text = CORBA::string_dup(text.c_str()); - throw SALOME::SALOME_Exception(es); - }; - // Close the target file - ::close(fd); - - Engines::file infos; - infos.file_name = CORBA::string_dup(file_name.c_str()); - infos.path = CORBA::string_dup(path.c_str()); - infos.type = CORBA::string_dup(type.c_str()); - infos.source_file_name = CORBA::string_dup(source_file_name.c_str()); - infos.status = CORBA::string_dup(status.c_str()); - - _fileManaged[file_name] = infos; - - // Update Salome_file state - _state.number_of_files++; - _state.files_ok = true; + if ( (fd = ::open(file_name.c_str(),O_RDWR|O_CREAT,00666)) <0) { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "open failed"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + }; + hdf_dataset->ReadFromDisk(buffer); + if ( write(fd,buffer,size) <0) { + SALOME::ExceptionStruct es; + es.type = SALOME::INTERNAL_ERROR; + std::string text = "write failed"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + }; + // Close the target file + ::close(fd); + + Engines::file infos; + infos.file_name = CORBA::string_dup(file_name.c_str()); + infos.path = CORBA::string_dup(path.c_str()); + infos.type = CORBA::string_dup(type.c_str()); + infos.source_file_name = CORBA::string_dup(source_file_name.c_str()); + infos.status = CORBA::string_dup(status.c_str()); + + _fileManaged[file_name] = infos; + + // Update Salome_file state + _state.number_of_files++; + _state.files_ok = true; } else { - Engines::file infos; - infos.file_name = CORBA::string_dup(file_name.c_str()); - infos.path = CORBA::string_dup(path.c_str()); - infos.type = CORBA::string_dup(type.c_str()); - infos.source_file_name = CORBA::string_dup(source_file_name.c_str()); - infos.status = CORBA::string_dup(status.c_str()); - // Infos for parallel extensions... - infos.node = 0; - infos.container = Engines::Container::_duplicate(_container); - - _fileManaged[file_name] = infos; - - // Update Salome_file state - _state.number_of_files++; - if (status != "ok") - _state.files_ok = false; + Engines::file infos; + infos.file_name = CORBA::string_dup(file_name.c_str()); + infos.path = CORBA::string_dup(path.c_str()); + infos.type = CORBA::string_dup(type.c_str()); + infos.source_file_name = CORBA::string_dup(source_file_name.c_str()); + infos.status = CORBA::string_dup(status.c_str()); + // Infos for parallel extensions... + infos.node = 0; + infos.container = Engines::Container::_duplicate(_container); + + _fileManaged[file_name] = infos; + + // Update Salome_file state + _state.number_of_files++; + if (status != "ok") + _state.files_ok = false; } } } @@ -631,7 +631,7 @@ Salome_file_i::connect(Engines::Salome_file_ptr source_Salome_file) _t_fileDistributedSource::iterator it = _fileDistributedSource.find(file_name); if (it == _fileDistributedSource.end()) { - _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file); + _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file); } } } @@ -671,7 +671,7 @@ Salome_file_i::connect(Engines::Salome_file_ptr source_Salome_file) //============================================================================= void Salome_file_i::connectDistributedFile(const char * file_name, - Engines::Salome_file_ptr source_Salome_file) + Engines::Salome_file_ptr source_Salome_file) { // Test if this file is added _t_fileManaged::iterator it = _fileManaged.find(file_name); @@ -697,7 +697,7 @@ Salome_file_i::connectDistributedFile(const char * file_name, //============================================================================= void Salome_file_i::setDistributedSourceFile(const char* file_name, - const char * source_file_name) + const char * source_file_name) { std::string fname(file_name); @@ -738,12 +738,12 @@ Salome_file_i::recvFiles() { if (std::string(file_infos.type.in()) == "local") { if (std::string(file_infos.status.in()) == "not_ok") - result = checkLocalFile(file_infos.file_name.in()); + result = checkLocalFile(file_infos.file_name.in()); } else { if (std::string(file_infos.status.in()) == "not_ok") - result = getDistributedFile(file_infos.file_name.in()); + result = getDistributedFile(file_infos.file_name.in()); } // if the result is false // we add this file to files_not_ok diff --git a/src/Container/Salome_file_i.hxx b/src/Container/Salome_file_i.hxx index d92ab4f4c..d493dc089 100644 --- a/src/Container/Salome_file_i.hxx +++ b/src/Container/Salome_file_i.hxx @@ -58,9 +58,9 @@ class CONTAINER_EXPORT Salome_file_i: // Configure DistributedFile virtual void connect(Engines::Salome_file_ptr source_Salome_file); virtual void connectDistributedFile(const char * file_name, - Engines::Salome_file_ptr source_Salome_file); + Engines::Salome_file_ptr source_Salome_file); virtual void setDistributedSourceFile(const char* file_name, - const char * source_file_name); + const char * source_file_name); // Recv and check files virtual void recvFiles(); diff --git a/src/DF/DF_Attribute.cxx b/src/DF/DF_Attribute.cxx index 64cd7de7b..a3560c60c 100644 --- a/src/DF/DF_Attribute.cxx +++ b/src/DF/DF_Attribute.cxx @@ -41,8 +41,9 @@ DF_Attribute::~DF_Attribute() map::iterator mi; for(mi =_node->_attributes.begin(); mi != _node->_attributes.end(); mi++) { if(mi->second == this) { - _node->_attributes.erase(mi); - } + _node->_attributes.erase(mi); + return; + } } } } diff --git a/src/DF/DF_Document.cxx b/src/DF/DF_Document.cxx index 5840bc330..68fe98559 100644 --- a/src/DF/DF_Document.cxx +++ b/src/DF/DF_Document.cxx @@ -103,6 +103,7 @@ void DF_Document::Clear() delete vn[i]; _root._node->Reset(); + _root.Nullify(); } //Returns true if this document is empty diff --git a/src/DSC/DSC_Basic/DSC_i.cxx b/src/DSC/DSC_Basic/DSC_i.cxx index 75f3f05c7..b4a98493f 100644 --- a/src/DSC/DSC_Basic/DSC_i.cxx +++ b/src/DSC/DSC_Basic/DSC_i.cxx @@ -25,6 +25,8 @@ // #include "DSC_i.hxx" +//#define MYDEBUG + Engines_DSC_i:: Engines_DSC_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, @@ -37,7 +39,7 @@ Engines_DSC_i(CORBA::ORB_ptr orb, instanceName, interfaceName) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl; #endif } @@ -52,7 +54,7 @@ Engines_DSC_i(CORBA::ORB_ptr orb, bool regist) : Engines_Component_i(orb, poa, container, instanceName, interfaceName,notif,regist) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl; #endif } diff --git a/src/DSC/DSC_Basic/DSC_interface.cxx b/src/DSC/DSC_Basic/DSC_interface.cxx index eb6db311c..fcfd8edf4 100644 --- a/src/DSC/DSC_Basic/DSC_interface.cxx +++ b/src/DSC/DSC_Basic/DSC_interface.cxx @@ -26,6 +26,8 @@ #include #include "DSC_interface.hxx" +//#define MYDEBUG + Engines_DSC_interface::Engines_DSC_interface() {} Engines_DSC_interface::~Engines_DSC_interface() @@ -154,7 +156,9 @@ Engines_DSC_interface::get_uses_port(const char* uses_port_name) Engines::DSC::BadPortType BPT; BPT.expected = CORBA::string_dup("Expected a uses port"); BPT.received = CORBA::string_dup((std::string("Received a provides/none port : ")+uses_port_name).c_str()); +#ifdef MYDEBUG std::cout << "---- DSC_Interface : MARK 1 ---- exception : " << uses_port_name << "----" << std::endl; +#endif throw BPT; } @@ -164,7 +168,9 @@ Engines_DSC_interface::get_uses_port(const char* uses_port_name) } else { +#ifdef MYDEBUG std::cout << "---- DSC_Interface : MARK 2 ---- exception : " << uses_port_name << "----" << std::endl; +#endif throw Engines::DSC::PortNotConnected(); } diff --git a/src/DSC/DSC_Basic/Makefile.am b/src/DSC/DSC_Basic/Makefile.am index e29f456d5..532edf0b7 100644 --- a/src/DSC/DSC_Basic/Makefile.am +++ b/src/DSC/DSC_Basic/Makefile.am @@ -50,7 +50,6 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \ -I$(top_srcdir)/src/Basics \ -I$(top_srcdir)/src/NamingService \ -I$(top_srcdir)/src/Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/DSC/DSC_Python/Makefile.am b/src/DSC/DSC_Python/Makefile.am index e5d9bf04a..034a89778 100644 --- a/src/DSC/DSC_Python/Makefile.am +++ b/src/DSC/DSC_Python/Makefile.am @@ -20,7 +20,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # File : Makefile.am -# Author : André RIBES (EDF), Eric Fayolle (EDF) +# Author : André RIBES (EDF), Eric Fayolle (EDF) # Module : KERNEL # include $(top_srcdir)/salome_adm/unix/make_common_starter.am @@ -37,6 +37,7 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \ -I$(top_srcdir)/src/DSC/DSC_User/Datastream \ -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Palm \ -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Calcium \ + -I$(top_builddir)/src/DSC/DSC_User/Datastream/Calcium \ -I$(top_srcdir)/src/DSC/DSC_User/Basic \ -I$(top_srcdir)/src/DSC/DSC_Basic \ -I$(top_srcdir)/src/SALOMELocalTrace \ @@ -44,7 +45,6 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \ -I$(top_srcdir)/src/Utils \ -I$(top_srcdir)/src/Container \ -I$(top_srcdir)/src/Notification \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@ @@ -71,7 +71,7 @@ _calcium_la_LIBADD = ../DSC_User/Datastream/Calcium/libCalciumC.la \ ../DSC_Basic/libSalomeDSCContainer.la \ ../../Container/libSalomeContainer.la -_calcium_la_CXXFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS) +_calcium_la_CPPFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS) EXTRA_DIST=calcium_wrap.cpp calcium.i diff --git a/src/DSC/DSC_User/Basic/Makefile.am b/src/DSC/DSC_User/Basic/Makefile.am index 9b77a6a6e..0acf127aa 100644 --- a/src/DSC/DSC_User/Basic/Makefile.am +++ b/src/DSC/DSC_User/Basic/Makefile.am @@ -50,7 +50,6 @@ COMMON_CPPFLAGS= -I$(top_builddir)/idl \ -I$(top_srcdir)/src/SALOMELocalTrace \ -I$(top_srcdir)/src/Basics \ -I$(top_srcdir)/src/Utils \ - -I$(top_builddir)/salome_adm/unix \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ # This local variable defines the list of dependant libraries common to all target in this package. diff --git a/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx b/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx index f53198c76..7f909cc19 100644 --- a/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx +++ b/src/DSC/DSC_User/Datastream/AdjacentFunctor.hxx @@ -34,6 +34,8 @@ #include "DisplayPair.hxx" // +//#define MYDEBUG + // Suppose que le container est trié template < typename T > struct AdjacentFunctor { @@ -50,14 +52,14 @@ template < typename T > struct AdjacentFunctor { // Suppose que les valeurs passées en paramètres sont triées par ordre croissant bool operator()(const T &v1) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "AdjacentFunctor: " << _minValue << _maxValue << std::endl; std::cout << "AdjacentFunctor: " << _min << _max << std::endl; #endif if ( v1 <= _minValue && v1 >= _maxValue) { _equal= true; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "AdjacentFunctor: _equal : " << v1 << std::endl; #endif return true; @@ -65,14 +67,14 @@ template < typename T > struct AdjacentFunctor { if ( v1 < _minValue ) { _min=v1;_minFound=true; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "AdjacentFunctor: _minFound : " <<_min << std::endl; #endif } else if ( v1 > _maxValue ) { _max=v1;_maxFound=true; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "AdjacentFunctor: _maxFound : " <<_max << std::endl; #endif } @@ -101,7 +103,7 @@ template < typename T > struct AdjacentFunctor { bool isEqual() const { return _equal;} bool isBounded() const { return _minFound && _maxFound;} bool getBounds(TNoConst & min, TNoConst & max) const { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "_minFound : " <<_minFound << ", _maxFound " << _maxFound << std::endl; #endif if (_minFound && _maxFound ) { min=_min; max=_max; return true; } diff --git a/src/DSC/DSC_User/Datastream/Calcium/Calcium.c b/src/DSC/DSC_User/Datastream/Calcium/Calcium.c index 94d41020e..ccef0947f 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Calcium.c +++ b/src/DSC/DSC_User/Datastream/Calcium/Calcium.c @@ -24,15 +24,19 @@ // Module : KERNEL #include "calcium.h" +#include "calciumf.h" +#include "CalciumFortranInt.h" #include #include #include +#include // Interface C de SalomeCalcium typedef int InfoType; typedef char bool; + /************************************/ /* INTERFACES DE LECTURE EN 0 COPIE */ /************************************/ @@ -77,13 +81,6 @@ typedef char bool; ecp_lecture_##_typeName##_free(data); \ }; -#define STAR * -CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int,); -CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,); -CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,); -CALCIUM_EXT_LECT_INTERFACE_C_(llo,float,int,bool,); -CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,); -/* CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]); */ /* L'interface de cette routine diffère de celle obtenue par la macro : CALCIUM_LECT_INTERFACE_C_. @@ -119,25 +116,39 @@ void ecp_lch_free (char* * data) { \ }; +#define STAR * +/*REVERIFIER MAINTENANT 0 COPY avec int2integer*/ +CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int2integer,); +CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,); +CALCIUM_EXT_LECT_INTERFACE_C_(ldb,double,double,double,); +CALCIUM_EXT_LECT_INTERFACE_C_(llo,float,int,bool,); +CALCIUM_EXT_LECT_INTERFACE_C_(lcp,float,float,cplx,); +/* CALCIUM_EXT_LECT_INTERFACE_C_(lch,float,char,STAR[]); */ + + /**************************************/ /* INTERFACES DE LECTURE AVEC RECOPIE */ /**************************************/ -#define CALCIUM_LECT_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \ - InfoType cp_##_name (void * component, int mode, \ - _timeType * ti, _timeType * tf, int * i, \ - char * nomvar, int bufferLength, \ - int * nRead, _type _qual * data ) { \ +#define CALCIUM_LECT_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \ + _calInt cp_##_name (void * component, _calInt mode, \ + _timeType * ti, _timeType * tf, _calInt * i, \ + char * nomvar, _calInt bufferLength, \ + _calInt * nRead, _type _qual * data \ + lastarg ) { \ + \ + int _mode = (int) mode; \ + size_t _bufferLength = bufferLength; \ size_t _nRead; \ - long _i=*i; \ + long _i =*i; \ fflush(stdout); \ fflush(stderr); \ fprintf(stderr,"Beginning of cp_" #_name " : %s %d %f\n",nomvar,*i,*ti); \ \ - if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; \ + if ( (data == NULL) || (_bufferLength < 1) ) return CPNTNULL; \ \ - InfoType info = ecp_lecture_##_typeName (component, mode, ti, tf, &_i, \ - nomvar, bufferLength, &_nRead, \ + _calInt info = ecp_lecture_##_typeName (component, _mode, ti, tf, &_i, \ + nomvar, _bufferLength, &_nRead, \ &data ); \ if(mode == CP_SEQUENTIEL) \ *i = _i; \ @@ -158,42 +169,66 @@ void ecp_lch_free (char* * data) { \ Le paramètre supplémentaire strSize indique la taille fixe et identique des chaînes stockées dans data (les ports CALCIUM n'en n'ont pas besoin) */ -InfoType cp_lch(void * component, int mode, float * ti, float * tf, int * i, - char * nomvar, int bufferLength, int * nRead, - char ** data, int strSize) { - size_t _nRead; - long _i=*i; - fflush(stdout);fflush(stderr); - fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti); +/* InfoType cp_lch(void * component, int mode, float * ti, float * tf, int * i, */ +/* char * nomvar, int bufferLength, int * nRead, */ +/* char ** data, int strSize) { */ + +/* size_t _nRead; */ +/* long _i=*i; */ +/* fflush(stdout);fflush(stderr); */ +/* fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti); */ - if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; +/* if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; */ - InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, - nomvar, bufferLength, &_nRead, - &data);/*, strSize ); - strSize est inutile pour les ports CALCIUM - qui gèrent des tailles quelconques de chaines. */ - if(mode == CP_SEQUENTIEL) - *i = _i; - *nRead=_nRead; - fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i); - fflush(stdout);fflush(stderr); +/* InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, */ +/* nomvar, bufferLength, &_nRead, */ +/* &data);*/ +/*, strSize ); */ +/* strSize est inutile pour les ports CALCIUM */ +/* qui gèrent des tailles quelconques de chaines. */ +/* if(mode == CP_SEQUENTIEL) */ +/* *i = _i; */ +/* *nRead=_nRead; */ +/* fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i); */ +/* fflush(stdout);fflush(stderr); */ - return info; -}; +/* return info; */ +/* }; */ /* Definition des méthodes calcium standard */ - -CALCIUM_LECT_INTERFACE_C_(len,float,int,int,); -CALCIUM_LECT_INTERFACE_C_(lre,float,float,float,); -CALCIUM_LECT_INTERFACE_C_(ldb,double,double,double,); -CALCIUM_LECT_INTERFACE_C_(llo,float,int,bool,); -CALCIUM_LECT_INTERFACE_C_(lcp,float,float,cplx,); +/* CALCIUM_LECT_INTERFACE_C_( , , , + , , ,)*/ + +CALCIUM_LECT_INTERFACE_C_(len,float ,int,int ,int2integer,,); +/*llg ne sera pas disponible si sizeof(long) == 64 bits && cal_int==int + sinon problème de conversion de 64bits vers 32bits */ +CALCIUM_LECT_INTERFACE_C_(llg,float ,int,long ,long2integer,,); + +CALCIUM_LECT_INTERFACE_C_(lre,float ,int,float ,float,,); +CALCIUM_LECT_INTERFACE_C_(ldb,double,int,double ,double,,); +CALCIUM_LECT_INTERFACE_C_(llo,float ,int,int ,bool,,); +CALCIUM_LECT_INTERFACE_C_(lcp,float ,int,float ,cplx,,); #define STAR * -/* CALCIUM_LECT_INTERFACE_C_(lch,float,char,STAR); */ +#define LCH_LAST_PARAM ,int strsize +CALCIUM_LECT_INTERFACE_C_(lch,float ,int,char ,str,STAR, LCH_LAST_PARAM ); + + +/* Definition des méthodes calcium destinées à l'interfaçage fortran + avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */ +CALCIUM_LECT_INTERFACE_C_(len_fort_,float ,cal_int,cal_int ,integer,,); +CALCIUM_LECT_INTERFACE_C_(lin_fort_,float ,cal_int,int ,int2integer,,); +/*llg ne sera pas disponible si sizeof(long) == 64 bits && cal_int==int + sinon problème de conversion de 64bits vers 32bits */ +CALCIUM_LECT_INTERFACE_C_(llg_fort_,float ,cal_int,long ,long2integer,,); + +CALCIUM_LECT_INTERFACE_C_(lre_fort_,float ,cal_int,float ,float,,); +CALCIUM_LECT_INTERFACE_C_(ldb_fort_,double,cal_int,double ,double,,); +CALCIUM_LECT_INTERFACE_C_(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ +CALCIUM_LECT_INTERFACE_C_(lcp_fort_,float ,cal_int,float ,cplx,,); +CALCIUM_LECT_INTERFACE_C_(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_PARAM ); /**********************************************/ @@ -205,6 +240,7 @@ InfoType cp_cd (void * component, char * instanceName) { if (instanceName) strcpy(instanceName,"UNDEFINED"); return CPOK; } + InfoType cp_fin (void * component, int code) { /* TODO : gérer avec les callbacks des ports DSC */ @@ -214,25 +250,28 @@ InfoType cp_fin (void * component, int code) { } - /***************************/ /* INTERFACES D'ECRITURE */ /***************************/ -#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \ - InfoType cp_##_name (void * component, int mode, \ - _timeType t, int i, \ - char * nomvar, int nbelem, \ - _type _qual * data ) { \ +#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \ + _calInt cp_##_name (void * component, _calInt mode, \ + _timeType t, _calInt i, \ + char * nomvar, _calInt nbelem, \ + _type _qual * data \ + lastarg ) { \ \ - /*long _i=i;*/ \ + int _mode = mode; \ + long _i = i; \ + size_t _nbelem = nbelem; \ + _timeType _t = t; \ fflush(stdout); \ fflush(stderr); \ - fprintf(stderr,"Beginning of cp_" #_name " : %s %d %f\n",nomvar,i,t); \ + 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); \ @@ -242,33 +281,46 @@ InfoType cp_fin (void * component, int code) { }; \ -/* Definition des méthodes calcium standard */ - -CALCIUM_ECR_INTERFACE_C_(een,float,int,int,); -CALCIUM_ECR_INTERFACE_C_(ere,float,float,float,); -CALCIUM_ECR_INTERFACE_C_(edb,double,double,double,); -/*CALCIUM_ECR_INTERFACE_C_(elo,float,bool,bool,);*/ -CALCIUM_ECR_INTERFACE_C_(elo,float,int,bool,); -CALCIUM_ECR_INTERFACE_C_(ecp,float,float,cplx,); -InfoType cp_ech(void * component, int mode, float t, int i, - char * nomvar, int nbelem, - char ** data, int strSize) { +/* InfoType cp_ech(void * component, int mode, float t, int i, */ +/* char * nomvar, int nbelem, */ +/* char ** data, int strSize) { */ - /*long _i=i;*/ - fflush(stdout);fflush(stderr); - fprintf(stderr,"Beginning of cp_ech: %s %d %f\n",nomvar,i,t); - if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; +/*long _i=i;*/ +/* fflush(stdout);fflush(stderr); */ +/* fprintf(stderr,"Beginning of cp_ech: %s %d %f\n",nomvar,i,t); */ +/* if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; */ - InfoType info = ecp_ecriture_str (component, mode, &t, i, - nomvar, nbelem, - data);/*, strSize );*/ - fprintf(stderr,"End of cp_ech: %s %d \n",nomvar,i); - fflush(stdout); - fflush(stderr); +/* InfoType info = ecp_ecriture_str (component, mode, &t, i, */ +/* nomvar, nbelem, */ +/* data); */ +/*, strSize );*/ +/* fprintf(stderr,"End of cp_ech: %s %d \n",nomvar,i); */ +/* fflush(stdout); */ +/* fflush(stderr); */ - return info; -}; - +/* return info; */ +/* }; */ +/* Definition des méthodes calcium standard */ +/* CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,type,_typeName,_qual) */ +CALCIUM_ECR_INTERFACE_C_(een,float ,int,int ,int2integer,,); +CALCIUM_ECR_INTERFACE_C_(elg,float ,int,long ,long2integer,,); +CALCIUM_ECR_INTERFACE_C_(ere,float ,int,float ,float,,); +CALCIUM_ECR_INTERFACE_C_(edb,double,int,double,double,,); +CALCIUM_ECR_INTERFACE_C_(elo,float ,int,int ,bool,,); +CALCIUM_ECR_INTERFACE_C_(ecp,float ,int,float ,cplx,,); +CALCIUM_ECR_INTERFACE_C_(ech,float ,int,char ,str,STAR,LCH_LAST_PARAM ); + +/* Definition des méthodes calcium destinées à l'interfaçage fortran + avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */ + +CALCIUM_ECR_INTERFACE_C_(een_fort_,float ,cal_int,cal_int,integer,,); +CALCIUM_ECR_INTERFACE_C_(elg_fort_,float ,cal_int,long ,long2integer,,); +CALCIUM_ECR_INTERFACE_C_(ein_fort_,float ,cal_int,int ,int2integer,,); +CALCIUM_ECR_INTERFACE_C_(ere_fort_,float ,cal_int,float ,float,,); +CALCIUM_ECR_INTERFACE_C_(edb_fort_,double,cal_int,double,double,,); +CALCIUM_ECR_INTERFACE_C_(elo_fort_,float ,cal_int,int ,bool,,); +CALCIUM_ECR_INTERFACE_C_(ecp_fort_,float ,cal_int,float ,cplx,,); +CALCIUM_ECR_INTERFACE_C_(ech_fort_,float ,cal_int,char ,str,STAR,LCH_LAST_PARAM ); diff --git a/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx b/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx index eec2ea22f..ef9dab545 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/Calcium.cxx @@ -26,8 +26,6 @@ #include #include -//#define _DEBUG_ - PySupervCompo::PySupervCompo( CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, Engines::Container_ptr contain, @@ -45,6 +43,9 @@ PySupervCompo::~PySupervCompo() extern "C" { + void cp_exit(int); + void setDependency(provides_port*, char*, CalciumTypes::DependencyType); + void cp_exit(int err) { throw CalciumException(err,LOC("Abort coupling")); @@ -84,9 +85,7 @@ extern "C" void create_calcium_port(Superv_Component_i* compo,char* name,char* type,char *mode,char* depend) { -#ifdef _DEBUG_ - std::cerr << "create_calcium_port: " << name << " " << type << " " << mode << " " << depend << std::endl; -#endif + MESSAGE( "create_calcium_port: " << name << " " << type << " " << mode << " " << depend ); if(std::string(mode) == "IN") { diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx new file mode 100644 index 000000000..8c9dd313c --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.cxx @@ -0,0 +1,146 @@ +#include "CalciumCInterface.hxx" +#include "CalciumCxxInterface.hxx" + +#include + + +//#define MYDEBUG +#ifdef MYDEBUG +#define DEBTRACE(msg) {std::cerr<(component); + + bool provideLastGivenValue = false; + if (code == CalciumTypes::CP_CONT ) provideLastGivenValue = true; + + try { + CalciumInterface::ecp_fin( *_component, + provideLastGivenValue); + } catch ( const CalciumException & ex) { //tester l'arrêt par exception + DEBTRACE( ex.what() ); + return ex.getInfo(); + } + return CalciumTypes::CPOK; +}; + +// INTERFACE C/CPP pour les chaines de caractères +// Le paramètre supplémentaire strsize n'étant pas utilisé +// j'utilise la génération par la macro CALCIUM_C2CPP_INTERFACE_(str,char*,); +// extern "C" CalciumTypes::InfoType ecp_lecture_str (void * component, int dependencyType, +// float * ti, float * tf, long * i, +// const char * const nomvar, size_t bufferLength, +// size_t * nRead, char ** *data, size_t strsize ) { + +// Superv_Component_i * _component = static_cast(component); +// double _ti=*ti; +// double _tf=*tf; +// size_t _nRead=0; +// size_t _bufferLength=bufferLength; +// CalciumTypes::DependencyType dependencyType= +// static_cast(dependencyType); + +// // - GERER POINTEUR NULL : NOTHING TODO +// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.) + +// DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) +// try { +// CalciumInterface::ecp_lecture< char*, char* >( *_component, +// dependencyType, +// _ti, _tf, *i, +// nomvar, +// _bufferLength, _nRead, *data); +// } catch ( const CalciumException & ex) { +// DEBTRACE( ex.what() ); +// return ex.getInfo(); +// } + +// *nRead = _nRead; + +// if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) +// *ti=(float)(_ti); + +// DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) ; + +// return CalciumTypes::CPOK; +// }; + + +// extern "C" void ecp_lecture_str_free (char** data) { +// CalciumInterface::ecp_free< char*, char* >(data); +// }; + + +// extern "C" CalciumTypes::InfoType ecp_ecriture_str (void * component, int dependencyType, +// float *t, long i, +// const char * const nomvar, size_t bufferLength, +// char ** data, int strsize ) { + +// Superv_Component_i * _component = static_cast(component); +// /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ +// double _t=*t; +// size_t _bufferLength=bufferLength; + +// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.) + +// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) +// try { +// std::string essai(nomvar); +// DEBTRACE( "----------->-" << nomvar ) +// CalciumInterface::ecp_ecriture< char*, char* >( *_component, +// static_cast(dependencyType), +// _t,i,nomvar,_bufferLength,*data); +// } catch ( const CalciumException & ex) { +// std::cerr << ex.what() << std::endl; +// return ex.getInfo(); +// } +// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) +// return CalciumTypes::CPOK; +// }; diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx new file mode 100644 index 000000000..e30e6739a --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCInterface.hxx @@ -0,0 +1,92 @@ +/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE + + Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, + CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + See http: www.salome-platform.org/ or email : webmaster.salome@opencascade.com + + File : CalciumInterface.hxx + Author : Eric Fayolle (EDF) + Module : KERNEL + Modified by : $LastChangedBy$ + Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $ + Id : $Id$ +*/ +#ifndef _CALCIUM_C_INTERFACE_H_ +#define _CALCIUM_C_INTERFACE_H_ + +#include "CalciumMacroCInterface.hxx" +#include "CalciumTypes.hxx" +#include "CalciumFortranInt.h" +#include + +/* Déclaration de l'Interface entre l'API C et l'API C++ + L'utilisateur CALCIUM n'a normalement pas a utliser cette interface + En C/C++ il utilisera celle définie dans Calcium.c (calcium.h) +2 En C++/CORBA directement celle de CalciumCxxInterface.hxx +*/ + +/* En CALCIUM l'utilisation de données de type double + implique des dates de type double, pour les autres + types de données les dates sont de type float +*/ +template struct CalTimeType { + typedef float TimeType; +}; + +template <> struct CalTimeType { + typedef double TimeType; +}; + +/* Déclaration de ecp_lecture_... , ecp_ecriture_..., ecp_free_... */ + +/* Le premier argument est utilisé : + - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_ + Le second argument est utilisé : + - comme argument template à l'appel de la méthode C++ correspondante + ( le type CORBA de port correspondant est alors obtenu par un trait) + Le troisième argument est utilisée : + - pour typer le paramètre data de la procédure générée + - pour déduire le type des paramètres t, ti tf via un trait + - comme premier paramètre template à l'appel de la méthode C++ correspondante + (pour typer les données passées en paramètre ) + Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas + en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode + C++ CALCIUM de lecture repère cette différence de type et charge + le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles). + Notons qu'en CORBA CORBA:Long est mappé sur long uniquement si celui-ci est 32bits sinon + il sera mappé sur le type int (si il est 32bits). Le type CORBA:LongLong est mappé sur le type long + s'il est 64 bits sinon celà peut être un long long (s'il existe). +*/ +CALCIUM_C2CPP_INTERFACE_HXX_(intc,int,int,); +CALCIUM_C2CPP_INTERFACE_HXX_(long,long,long,); + +CALCIUM_C2CPP_INTERFACE_HXX_(integer,integer,cal_int,); +CALCIUM_C2CPP_INTERFACE_HXX_(int2integer,integer,int,); +CALCIUM_C2CPP_INTERFACE_HXX_(long2integer,integer, long,); + +CALCIUM_C2CPP_INTERFACE_HXX_(float,float,float, ); +CALCIUM_C2CPP_INTERFACE_HXX_(double,double,double,); +/* Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/ +CALCIUM_C2CPP_INTERFACE_HXX_(bool,bool,int,); +CALCIUM_C2CPP_INTERFACE_HXX_(cplx,cplx,float,); +CALCIUM_C2CPP_INTERFACE_HXX_(str,str,char*,); + +/* Déclaration de ecp_fin */ +extern "C" CalciumTypes::InfoType ecp_fin_ (void * component, int code); + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx index cd8dc62ec..16f85bbd4 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.cxx @@ -38,18 +38,14 @@ void CalciumCouplingPolicy::setDependencyType (CalciumTypes::DependencyType depe CalciumTypes::DependencyType CalciumCouplingPolicy::getDependencyType () const { return _dependencyType;} void CalciumCouplingPolicy::setStorageLevel (size_t storageLevel) { -#ifdef _DEBUG_ - std::cerr << "CalciumCouplingPolicy::setStorageLevel: " << storageLevel << std::endl; -#endif + MESSAGE( "CalciumCouplingPolicy::setStorageLevel: " << storageLevel ); if ( storageLevel < 1 && (storageLevel != CalciumTypes::UNLIMITED_STORAGE_LEVEL) ) throw CalciumException(CalciumTypes::CPRENA,LOC("Un niveau < 1 n'est pas autorisé")); _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")); _dateCalSchem = dateCalSchem; @@ -58,13 +54,11 @@ void CalciumCouplingPolicy::setDateCalSchem (CalciumTypes::DateCalSchem da 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")); - 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]")); } @@ -74,16 +68,14 @@ 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; + if ( 0 <= deltaT && deltaT <= 1 ) _deltaT = deltaT; else throw(CalciumException(CalciumTypes::CPRENA,LOC("Le paramètre deltaT doit être compris entre [0,1]"))); } double CalciumCouplingPolicy::getDeltaT() const {return _deltaT;} void CalciumCouplingPolicy::setInterpolationSchem (CalciumTypes::InterpolationSchem interpolationSchem) { -#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")); _interpolationSchem=interpolationSchem; diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx index 383f7a698..ab4448cef 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCouplingPolicy.hxx @@ -39,6 +39,8 @@ #include "CalciumTypes.hxx" #include "CalciumException.hxx" +//#define MYDEBUG + class CalciumCouplingPolicy : public CouplingPolicy { @@ -196,14 +198,14 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor< MapIterator it2=it1; ++it2; size_t dataSize1 = DataManipulator::size(it1->second); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId1 : " << dataSize1 << std::endl; #endif // Gérer dans calcium la limite de la taille du buffer donnée par // l'utilisateur. size_t dataSize2 = DataManipulator::size(it2->second); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId2 : " << dataSize2 << std::endl; #endif @@ -212,31 +214,31 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor< DataId dataId1 = it1->first; TimeType t2 = dataId2.first; TimeType t1 = dataId1.first; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t1 : " << t1 << std::endl; std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t2 : " << t2 << std::endl; #endif TimeType t = dataId.first; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t : " << t << std::endl; #endif TimeType timeDiff = t2-t1; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de timeDiff : " << timeDiff << std::endl; #endif TimeType coeff = (t2-t)/timeDiff; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de coeff : " << coeff << std::endl; #endif InnerType const * const InIt1 = DataManipulator::getPointer(it1->second); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t1 : " << std::endl; std::copy(InIt1,InIt1+dataSize1,std::ostream_iterator(std::cout," ")); std::cout << std::endl; #endif InnerType const * const InIt2 = DataManipulator::getPointer(it2->second); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t2 : " << std::endl; std::copy(InIt2,InIt2+dataSize2,std::ostream_iterator(std::cout," ")); std::cout << std::endl; @@ -244,7 +246,7 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor< Type dataOut = DataManipulator::create(dataSize); InnerType * const OutIt = DataManipulator::getPointer(dataOut); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : interpolationSchem : " << _couplingPolicy._interpolationSchem << std::endl; std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : alpha : " << _couplingPolicy._alpha << std::endl; std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : datecalschem : " << _couplingPolicy._dateCalSchem << std::endl; @@ -265,7 +267,7 @@ struct CalciumCouplingPolicy::BoundedDataIdProcessor< // } } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données calculées à t : " << std::endl; std::copy(OutIt,OutIt+dataSize,std::ostream_iterator(std::cout," ")); std::cout << std::endl; @@ -290,7 +292,7 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co AdjacentFunctor< key_type > af(expectedDataId); if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY ) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- time expected : " << expectedDataId.first << std::endl; std::cout << "-------- time expected corrected : " << expectedDataId.first*(1.0-_deltaT) << std::endl; #endif @@ -317,8 +319,8 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co typename AssocContainer::iterator current = prev; while ( (current != storedDatas.end()) && !af(current->first) ) { -#ifdef _DEBUG_ - std::cout << "------- stored time : " << current->first << std::endl; +#ifdef MYDEBUG + std::cerr << "------- stored time : " << current->first << std::endl; #endif // if ( af(current->first) ) break; prev = current++; @@ -336,7 +338,7 @@ bool CalciumCouplingPolicy::isDataIdConveniant( AssocContainer & storedDatas, co else wDataIt1 = storedDatas.end(); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl; #endif @@ -366,7 +368,7 @@ struct CalciumCouplingPolicy::EraseDataIdProcessor { typedef typename Container::value_type value_type; typedef typename Container::iterator iterator; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::eraseDataId, storedDatasSize : " << storedDatas.size() << std::endl; #endif @@ -388,7 +390,7 @@ struct CalciumCouplingPolicy::EraseDataIdProcessor { " vient d'entraîner la suppression de la donnée à renvoyer"))); } } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::eraseDataId, new storedDatasSize : " << storedDatas.size() << std::endl; #endif return; @@ -422,12 +424,12 @@ struct CalciumCouplingPolicy::DisconnectProcessor { typedef typename Container::iterator iterator; // Pas de traitement particulier a effectuer -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK1 ("<< _couplingPolicy._disconnectDirective<<") --------" << std::endl; #endif if ( (_couplingPolicy._disconnectDirective) == (CalciumTypes::UNDEFINED_DIRECTIVE) ) return false; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK2 --------" << std::endl; #endif @@ -435,7 +437,7 @@ struct CalciumCouplingPolicy::DisconnectProcessor { 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_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK3 --------" << std::endl; #endif @@ -450,13 +452,13 @@ struct CalciumCouplingPolicy::DisconnectProcessor { // 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 ; @@ -468,13 +470,13 @@ struct CalciumCouplingPolicy::DisconnectProcessor { 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."))); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK6 " << std::endl; #endif wDataIt1 = storedDatas.end(); --wDataIt1; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor, CP_CONT : " << (*wDataIt1).first << std::endl; #endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx index a0af9e501..3d3ba931a 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumCxxInterface.hxx @@ -42,7 +42,7 @@ #include -//#define _DEBUG_ +#include template struct IsSameType { @@ -53,6 +53,7 @@ struct IsSameType { static const bool value = true; }; +//#define MYDEBUG #include @@ -91,7 +92,7 @@ namespace CalciumInterface { // calcium_uses_port* myCalciumUsesPort= // dynamic_cast(myUsesPort); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|"<< *it <<"|----"<< // typeid(myUsesPort).name() <<"-------------" << typeid(myCalciumUsesPort).name() <<"-------------" << std::endl; @@ -104,14 +105,10 @@ namespace CalciumInterface { myCalciumUsesPort->disconnect(provideLastGivenValue); } catch ( const Superv_Component_i::BadCast & ex) { -#ifdef _DEBUG_ - std::cerr << ex.what() << std::endl; -#endif + MESSAGE(ex.what()); throw (CalciumException(CalciumTypes::CPTPVR,ex)); } catch ( const DSC_Exception & ex) { -#ifdef _DEBUG_ - std::cerr << ex.what() << std::endl; -#endif + MESSAGE(ex.what()); // Exception venant de SupervComponent : // PortNotDefined(CPNMVR), PortNotConnected(CPLIEN) // ou du port uses : Dsc_Exception @@ -154,7 +151,7 @@ namespace CalciumInterface { // T1 est le type de données // T2 est un de type Calcium permettant de sélectionner le port CORBA correspondant - // T1 et T2 sont dissociés pour discriminer le cas des nombres complexes + // T1 et T2 sont dissociés pour discriminer par exemple le cas des nombres complexes // -> Les données des nombres complexes sont de type float mais // le port à utiliser est le port cplx template static void @@ -180,7 +177,7 @@ namespace CalciumInterface { CorbaDataType corbaData; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl; #endif @@ -188,30 +185,28 @@ namespace CalciumInterface { throw CalciumException(CalciumTypes::CPNMVR, LOC("Le nom de la variable est ")); PortType * port; -#ifdef _DEBUG_ - std::cout << "-------- CalciumInterface(ecp_lecture) MARK 2 ------------------" << std::endl; +#ifdef MYDEBUG + std::cout << "-------- CalciumInterface(lecture) MARK 2 --"< (nomVar.c_str()); -#ifdef _DEBUG_ +#ifdef MYDEBUG 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 + MESSAGE(ex.what()); throw (CalciumException(CalciumTypes::CPNMVR,ex)); } catch ( const Superv_Component_i::PortNotConnected & ex) { -#ifdef _DEBUG_ - std::cerr << ex.what() << std::endl;; -#endif + MESSAGE(ex.what()); throw (CalciumException(CalciumTypes::CPLIEN,ex)); // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN } catch ( const Superv_Component_i::BadCast & ex) { -#ifdef _DEBUG_ - std::cerr << ex.what() << std::endl; -#endif + MESSAGE(ex.what()); throw (CalciumException(CalciumTypes::CPTPVR,ex)); } @@ -233,28 +228,28 @@ namespace CalciumInterface { if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY ) { corbaData = port->get(ti,tf, 0); -#ifdef _DEBUG_ +#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_ +#ifdef MYDEBUG std::cout << "-------- CalciumInterface(ecp_lecture) MARK 6 ------------------" << std::endl; #endif } else { // Lecture en séquence -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl; #endif corbaData = port->next(ti,i); } -#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 @@ -266,19 +261,19 @@ namespace CalciumInterface { nRead = corbaDataSize; // Si les types T1 et InnerType sont différents, il faudra effectuer tout de même une recopie if (!IsSameType::value) data = new T1[nRead]; -#ifdef _DEBUG_ +#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 + // 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 - // sur la compatibilité des types. - // En utilisant le foncteur Copy2UserSpace, seul la spécialisation en adéquation + // portant sur la compatibilité des types. + // En utilisant le foncteur Copy2UserSpace, seule la spécialisation en adéquation // avec la compatibilité des types sera compilée Copy2UserSpace< IsSameType::value, DataManipulator >::apply(data,corbaData,nRead); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl; #endif // Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non @@ -293,20 +288,18 @@ namespace CalciumInterface { // 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_ +#ifdef MYDEBUG std::cout << "-------- CalciumInterface(ecp_lecture) MARK 11 ------------------" << std::endl; #endif Copy2UserSpace::apply(data,corbaData,nRead); - DataManipulator::copy(corbaData,data,nRead); + //Déjà fait ci-dessus : + //DataManipulator::copy(corbaData,data,nRead); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumInterface(ecp_lecture) MARK 12 ------------------" << std::endl; #endif - // Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non - // la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante : - // DataManipulator::delete_data(corbaData); } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumInterface(ecp_lecture), Valeur de data : " << std::endl; std::copy(data,data+nRead,std::ostream_iterator(std::cout," ")); std::cout << "Ptr :" << data << std::endl; @@ -352,9 +345,8 @@ namespace CalciumInterface { assert(&component); //typedef typename StarTrait::NonStarType T; - typedef typename boost::remove_all_extents< T2 >::type T2_without_extent; typedef typename boost::remove_all_extents< T1 >::type T1_without_extent; - + typedef typename boost::remove_all_extents< T2 >::type T2_without_extent; typedef typename UsesPortTraits ::PortType UsesPortType; typedef typename ProvidesPortTraits::PortType ProvidesPortType;// pour obtenir un manipulateur de données typedef typename ProvidesPortType::DataManipulator DataManipulator; @@ -368,36 +360,34 @@ namespace CalciumInterface { CalciumTypes::DependencyType _dependencyType= static_cast(dependencyType); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl; #endif if ( nomVar.empty() ) throw CalciumException(CalciumTypes::CPNMVR, LOC("Le nom de la variable est ")); UsesPortType * port; -#ifdef _DEBUG_ - std::cout << "-------- CalciumInterface(ecriture) MARK 2 ------------------" << std::endl; +#ifdef MYDEBUG + std::cout << "-------- CalciumInterface(ecriture) MARK 2 ---"< (nomVar.c_str()); -#ifdef _DEBUG_ +#ifdef MYDEBUG 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 + MESSAGE(ex.what()); throw (CalciumException(CalciumTypes::CPNMVR,ex)); } catch ( const Superv_Component_i::PortNotConnected & ex) { -#ifdef _DEBUG_ - std::cerr << ex.what() << std::endl;; -#endif + MESSAGE(ex.what()); throw (CalciumException(CalciumTypes::CPLIEN,ex)); // VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN } catch ( const Superv_Component_i::BadCast & ex) { -#ifdef _DEBUG_ - std::cerr << ex.what() << std::endl; -#endif + MESSAGE(ex.what()); throw (CalciumException(CalciumTypes::CPTPVR,ex)); } @@ -440,10 +430,10 @@ namespace CalciumInterface { LOC(OSS()<<"Le buffer a envoyer est de taille nulle ")); -#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 @@ -466,6 +456,13 @@ namespace CalciumInterface { // OLD : Il faut effectuer une copie dans le port provides. // OLD : Cette copie est effectuée dans GenericPortUses::put // OLD : en fonction de la collocalisation ou non. +#ifdef MYDEBUG + T1_without_extent t1b; + InnerType t2b; + std::cout << "-------- CalciumInterface(ecriture) MARK 4b1 -----" << typeid(t1b).name() << "-------------" << std::endl; + std::cout << "-------- CalciumInterface(ecriture) MARK 4b2 -----" << typeid(t2b).name() << "-------------" << std::endl; +#endif + Copy2CorbaSpace::value, DataManipulator >::apply(corbaData,_data,bufferLength); //TODO : GERER LES EXCEPTIONS ICI : ex le port n'est pas connecté @@ -480,7 +477,7 @@ namespace CalciumInterface { } //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_ +#ifdef MYDEBUG std::cout << "-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl; #endif } @@ -493,13 +490,13 @@ namespace CalciumInterface { { throw (CalciumException(CalciumTypes::CPATAL,ex.what())); } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl; #endif } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumInterface(ecriture), Valeur de corbaData : " << std::endl; for (int i = 0; i < corbaData->length(); ++i) std::cout << "-------- CalciumInterface(ecriture), corbaData[" << i << "] = " << (*corbaData)[i] << std::endl; @@ -509,7 +506,7 @@ namespace CalciumInterface { // Supprime l'objet CORBA avec eventuellement les données qu'il contient (cas de la recopie) delete corbaData; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl; #endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumFortranInt.h.in b/src/DSC/DSC_User/Datastream/Calcium/CalciumFortranInt.h.in new file mode 100644 index 000000000..8e4d2a0ff --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumFortranInt.h.in @@ -0,0 +1,42 @@ +/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE + + Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, + CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + See http: www.salome-platform.org/ or email : webmaster.salome@opencascade.com + + File : CalciumInterface.hxx + Author : Eric Fayolle (EDF) + Module : KERNEL + Modified by : $LastChangedBy$ + Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $ + Id : $Id$ +*/ +#ifndef _CALCIUM_FORTRAN_INT_H_ +#define _CALCIUM_FORTRAN_INT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef @LONG_OR_INT@ cal_int; + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx index 50ae4bd53..bfd6b3fdc 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumGenericProvidesPort.hxx @@ -180,21 +180,21 @@ try { \ \ if (key == "StorageLevel" ) \ - {if ( ok=(value >>= sl) ) Port::setStorageLevel(sl);} \ + {if ( ( ok=(value >>= sl) ) ) Port::setStorageLevel(sl);} \ else if (key == "Alpha" ) \ - {if ( ok=(value >>= alpha) ) Port::setAlpha(alpha);} \ + {if ( ( ok=(value >>= alpha) ) ) Port::setAlpha(alpha);} \ else if (key == "DeltaT" ) \ - {if ( ok=(value >>= delta) ) Port::setDeltaT(delta);} \ + {if ( ( ok=(value >>= delta) ) ) Port::setDeltaT(delta);} \ else if (key == "DependencyType" ) \ - {if ( ok=( value >>= dt) ) Port::setDependencyType(dependencyType[dt]);} \ + {if ( ( ok=( value >>= dt) ) ) Port::setDependencyType(dependencyType[dt]);} \ else if (key == "DateCalSchem" ) \ - {if ( ok=(value >>= dcs) ) \ + {if ( ( ok=(value >>= dcs) ) ) \ Port::setDateCalSchem(dateCalSchem[dcs]);} \ else if (key == "InterpolationSchem") \ - {if ( ok=(value >>= is) ) \ + {if ( ( ok=(value >>= is) ) ) \ Port::setInterpolationSchem(interpolationSchem[is]);} \ else if (key == "ExtrapolationSchem") \ - {if ( ok=(value >>= es) ) \ + {if ( ( ok=(value >>= es) ) ) \ Port::setExtrapolationSchem(extrapolationSchem[es]);} \ else \ throw Ports::NotDefined(); \ diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx index 5d2422fa0..7b991a210 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumInterface.hxx @@ -32,229 +32,14 @@ //Interface CALCIUM des utilisateurs en C++ #include "CalciumCxxInterface.hxx" -#include "CalciumException.hxx" -#include "CalciumTypes.hxx" +/* Déclaration de l'Interface entre l'API C et l'API C++ + L'utilisateur CALCIUM n'a normalement pas a utliser cette interface + En C/C++ il utilisera celle définie dans Calcium.c (calcium.h) + En C++/CORBA directement celle de CalciumCxxInterface.hxx +*/ +#include "CalciumCInterface.hxx" -#include -//Ce fichier déclare et défini l'interfaçage entre l'API utilisteur C et C++ -//Les procédures déclarées n'ont pas vocation à être utilisées directement (celà est -// cependant possible). -//#define _DEBUG_ - -#ifdef _DEBUG_ -#define DEBTRACE(msg) {std::cerr< struct CalTimeType { - typedef float TimeType; -}; - -template <> struct CalTimeType { - typedef double TimeType; -}; - -// Définition de ecp_fin -extern "C" CalciumTypes::InfoType -ecp_fin_ (void * component, int code) { - - Superv_Component_i * _component = static_cast(component); - - bool provideLastGivenValue = false; - if (code == CalciumTypes::CP_CONT ) provideLastGivenValue = true; - - try { - CalciumInterface::ecp_fin( *_component, - provideLastGivenValue); - } catch ( const CalciumException & ex) { //tester l'arrêt par exception - DEBTRACE( ex.what() ); - return ex.getInfo(); - } - return CalciumTypes::CPOK; -}; - - -// Définition de ecp_lecture_... , ecp_ecriture_..., ecp_free_... -#define CALCIUM_C2CPP_INTERFACE_(_name,_type,_qual) \ - extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \ - CalTimeType< _type _qual >::TimeType * ti, \ - CalTimeType< _type _qual >::TimeType * tf, long * i, \ - const char * const nomvar, size_t bufferLength, \ - size_t * nRead, _type _qual ** data ) { \ - Superv_Component_i * _component = static_cast(component); \ - double _ti=*ti; \ - double _tf=*tf; \ - size_t _nRead=0; \ - size_t _bufferLength=bufferLength; \ - \ - if ( IsSameType< _name , cplx >::value ) _bufferLength*=2; \ - DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \ - try { \ - CalciumInterface::ecp_lecture< _type, _name >( *_component, \ - dependencyType, \ - _ti, _tf, *i, \ - nomvar, \ - _bufferLength, _nRead, *data); \ - } catch ( const CalciumException & ex) { \ - DEBTRACE( ex.what() ); \ - return ex.getInfo(); \ - } catch ( ... ) { \ - std::cerr << "Unexpected exception " << std::endl; \ - return CalciumTypes::CPATAL; \ - } \ - if ( IsSameType< _name , cplx >::value ) { *nRead=_nRead/2; \ - DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \ - DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \ - DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \ - } else *nRead = _nRead; \ - if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) \ - *ti=(CalTimeType< _type _qual >::TimeType)(_ti); \ - DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \ - return CalciumTypes::CPOK; \ - }; \ - \ - \ - extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) { \ - CalciumInterface::ecp_free< _type, _name >(data); \ - }; \ - \ - \ - extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \ - CalTimeType< _type _qual >::TimeType *t, \ - long i, \ - const char * const nomvar, size_t bufferLength, \ - _type _qual * data ) { \ - Superv_Component_i * _component = static_cast(component); \ - /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ \ - double _t=*t; \ - size_t _bufferLength=bufferLength; \ - if ( IsSameType< _name , cplx >::value ) _bufferLength=_bufferLength*2; \ - DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) \ - try { \ - /*printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar);*/ \ - DEBTRACE( "----------->-" << nomvar ) \ - CalciumInterface::ecp_ecriture< _type, _name >( *_component, \ - dependencyType, \ - _t,i,nomvar,_bufferLength,*data); \ - } catch ( const CalciumException & ex) { \ - std::cerr << ex.what() << std::endl; \ - return ex.getInfo(); \ - } catch ( ... ) { \ - std::cerr << "Unexpected exception " << std::endl; \ - return CalciumTypes::CPATAL; \ - } \ - DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) \ - return CalciumTypes::CPOK; \ - }; \ - - - -#define STAR * -// Le premier argument est utilisée : -// - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_ -// - comme second argument template à l'appel de la méthode C++ correspondante -// ( le type de port correspondant est alors obtenu par un trait) -// Le second argument est utilisée : -// - pour typer le paramètre data de la procédure générée -// - pour déduire le type des paramètres t, ti tf via un trait -// - comme premier paramètre template à l'appel de la méthode C++ correspondante -// (pour typer les données passées en paramètre ) -// Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas -// en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode -// C++ CALCIUM de lecture repère cette différence de type et charge -// le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles). -CALCIUM_C2CPP_INTERFACE_(int,int,); -CALCIUM_C2CPP_INTERFACE_(float,float, ); -CALCIUM_C2CPP_INTERFACE_(double,double,); -// Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,); -CALCIUM_C2CPP_INTERFACE_(bool,int,); -CALCIUM_C2CPP_INTERFACE_(cplx,float,); -CALCIUM_C2CPP_INTERFACE_(str,char*,); - -// INTERFACE C/CPP pour les chaines de caractères -// Le paramètre supplémentaire strsize n'étant pas utilisé -// j'utilise la génération par la macro CALCIUM_C2CPP_INTERFACE_(str,char*,); -// extern "C" CalciumTypes::InfoType ecp_lecture_str (void * component, int dependencyType, -// float * ti, float * tf, long * i, -// const char * const nomvar, size_t bufferLength, -// size_t * nRead, char ** *data, size_t strsize ) { - -// Superv_Component_i * _component = static_cast(component); -// double _ti=*ti; -// double _tf=*tf; -// size_t _nRead=0; -// size_t _bufferLength=bufferLength; -// CalciumTypes::DependencyType dependencyType= -// static_cast(dependencyType); - -// // - GERER POINTEUR NULL : NOTHING TODO -// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.) - -// DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) -// try { -// CalciumInterface::ecp_lecture< char*, char* >( *_component, -// dependencyType, -// _ti, _tf, *i, -// nomvar, -// _bufferLength, _nRead, *data); -// } catch ( const CalciumException & ex) { -// DEBTRACE( ex.what() ); -// return ex.getInfo(); -// } - -// *nRead = _nRead; - -// if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) -// *ti=(float)(_ti); - -// DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) ; - -// return CalciumTypes::CPOK; -// }; - - -// extern "C" void ecp_lecture_str_free (char** data) { -// CalciumInterface::ecp_free< char*, char* >(data); -// }; - - -// extern "C" CalciumTypes::InfoType ecp_ecriture_str (void * component, int dependencyType, -// float *t, long i, -// const char * const nomvar, size_t bufferLength, -// char ** data, int strsize ) { - -// Superv_Component_i * _component = static_cast(component); -// /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ -// double _t=*t; -// size_t _bufferLength=bufferLength; - -// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.) - -// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) -// try { -// std::string essai(nomvar); -// DEBTRACE( "----------->-" << nomvar ) -// CalciumInterface::ecp_ecriture< char*, char* >( *_component, -// static_cast(dependencyType), -// _t,i,nomvar,_bufferLength,*data); -// } catch ( const CalciumException & ex) { -// std::cerr << ex.what() << std::endl; -// return ex.getInfo(); -// } -// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) -// return CalciumTypes::CPOK; -// }; #endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumMacroCInterface.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumMacroCInterface.hxx new file mode 100644 index 000000000..d819f95da --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumMacroCInterface.hxx @@ -0,0 +1,137 @@ +/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE + +Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, 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_ : ******/ +/****** Déclaration de 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_ : ******/ +/******Définition de ecp_lecture_... , ecp_ecriture_..., ecp_free_... ******/ +#define CALCIUM_C2CPP_INTERFACE_CXX_(_name,_porttype,_type,_qual) \ + extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \ + CalTimeType< _type _qual >::TimeType * ti, \ + CalTimeType< _type _qual >::TimeType * tf, long * i, \ + const char * const nomvar, size_t bufferLength, \ + size_t * nRead, _type _qual ** data ) { \ + Superv_Component_i * _component = static_cast(component); \ + double _ti=*ti; \ + double _tf=*tf; \ + size_t _nRead=0; \ + size_t _bufferLength=bufferLength; \ + \ + if ( IsSameType< _porttype , cplx >::value ) _bufferLength*=2; \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \ + try { \ + CalciumInterface::ecp_lecture< _type,_porttype >( *_component, \ + dependencyType, \ + _ti, _tf, *i, \ + nomvar, \ + _bufferLength, _nRead, *data); \ + } catch ( const CalciumException & ex) { \ + DEBTRACE( ex.what() ); \ + return ex.getInfo(); \ + } catch ( ... ) { \ + DEBTRACE( "Unexpected exception ") ; \ + return CalciumTypes::CPATAL; \ + } \ + if ( IsSameType< _porttype , cplx >::value ) { *nRead=_nRead/2; \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \ + } else *nRead = _nRead; \ + if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) \ + *ti=(CalTimeType< _type _qual >::TimeType)(_ti); \ + DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \ + return CalciumTypes::CPOK; \ + }; \ + \ + \ + extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) { \ + CalciumInterface::ecp_free< _type, _porttype >(data); \ + }; \ + \ + \ + extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \ + CalTimeType< _type _qual >::TimeType *t, \ + long i, \ + const char * const nomvar, size_t bufferLength, \ + _type _qual * data ) { \ + DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 0 ------------------" ) \ + Superv_Component_i * _component = static_cast(component); \ + /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ \ + double _t=*t; \ + size_t _bufferLength=bufferLength; \ + if ( IsSameType< _porttype , cplx >::value ) _bufferLength=_bufferLength*2; \ + fprintf(stderr,"Beginning of ecp_ecriture_" #_name " : %s %ld %e\n",nomvar,i,_t); \ + 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; \ + } \ + fprintf(stderr,"End of ecp_ecriture_" #_name " : %s %ld %e\n",nomvar,i,_t); \ + DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) \ + return CalciumTypes::CPOK; \ + }; \ + + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx index b607de119..10fb323fc 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumPortTraits.hxx @@ -38,11 +38,15 @@ template struct UnknownProvidesPortType {}; template struct ProvidesPortTraits { typedef UnknownProvidesPortType PortType; }; -template <> struct ProvidesPortTraits { +struct integer {}; +template <> struct ProvidesPortTraits { typedef calcium_integer_port_provides PortType; }; +template <> struct ProvidesPortTraits { + typedef calcium_intc_port_provides PortType; +}; template <> struct ProvidesPortTraits { - typedef calcium_integer_port_provides PortType; + typedef calcium_long_port_provides PortType; }; template <> struct ProvidesPortTraits { typedef calcium_real_port_provides PortType; @@ -65,6 +69,12 @@ struct str {}; template <> struct ProvidesPortTraits { typedef calcium_string_port_provides PortType; }; +// Définition du type intc pour obtenir le type de port +// correspondant +struct intc {}; +template <> struct ProvidesPortTraits { + typedef calcium_intc_port_provides PortType; +}; template < typename T > struct StarTrait { typedef T NonStarType; }; @@ -76,11 +86,14 @@ template struct UnknownUsesPortType {}; template struct UsesPortTraits { typedef UnknownUsesPortType PortType; }; -template <> struct UsesPortTraits { +template <> struct UsesPortTraits { typedef calcium_integer_port_uses PortType; }; +template <> struct UsesPortTraits { + typedef calcium_intc_port_uses PortType; +}; template <> struct UsesPortTraits { - typedef calcium_integer_port_uses PortType; + typedef calcium_long_port_uses PortType; }; template <> struct UsesPortTraits { typedef calcium_real_port_uses PortType; @@ -97,5 +110,8 @@ template <> struct UsesPortTraits { template <> struct UsesPortTraits { typedef calcium_complex_port_uses PortType; }; +template <> struct UsesPortTraits { + typedef calcium_intc_port_uses PortType; +}; #endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx index b6a25e6f9..7baab48d9 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.cxx @@ -24,6 +24,10 @@ CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_integer_port_provides) +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_long_port_provides) + +CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_intc_port_provides) + CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_real_port_provides) CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_double_port_provides) diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx deleted file mode 100644 index d22453a39..000000000 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Modified by : $LastChangedBy$ -// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $ -// Id : $Id$ -// -#ifndef _CALCIUM_PORT_PROVIDES_HXX_ -#define _CALCIUM_PORT_PROVIDES_HXX_ - -#include - -#include "Calcium_Ports.hh" -#include "CalciumGenericProvidesPort.hxx" -#include "CalciumCouplingPolicy.hxx" - - -CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_integer_port_provides, \ - POA_Ports::Calcium_Ports::Calcium_Integer_Port, \ - seq_u_manipulation ) \ - -CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_real_port_provides, \ - POA_Ports::Calcium_Ports::Calcium_Real_Port, \ - seq_u_manipulation ) \ - -CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_double_port_provides, \ - POA_Ports::Calcium_Ports::Calcium_Double_Port, \ - seq_u_manipulation ) \ - -CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_complex_port_provides, \ - POA_Ports::Calcium_Ports::Calcium_Complex_Port, \ - seq_u_manipulation ) \ - -CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_logical_port_provides, \ - POA_Ports::Calcium_Ports::Calcium_Logical_Port, \ - seq_u_manipulation ) \ - -CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_string_port_provides, \ - POA_Ports::Calcium_Ports::Calcium_String_Port, \ - seq_u_manipulation ) \ - -#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx.in b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx.in new file mode 100644 index 000000000..efa4b7bf1 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx.in @@ -0,0 +1,68 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $ +// Id : $Id$ +// +#ifndef _CALCIUM_PORT_PROVIDES_HXX_ +#define _CALCIUM_PORT_PROVIDES_HXX_ + +#include + +#include "Calcium_Ports.hh" +#include "CalciumGenericProvidesPort.hxx" +#include "CalciumCouplingPolicy.hxx" + + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_integer_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Integer_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_long_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Long_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_intc_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Intc_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_real_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Real_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_double_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Double_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_complex_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Complex_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_logical_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_Logical_Port, \ + seq_u_manipulation ) \ + +CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_string_port_provides, \ + POA_Ports::Calcium_Ports::Calcium_String_Port, \ + seq_u_manipulation ) \ + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx index e99de9a6a..b94d092f7 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/CalciumTypes2CorbaTypes.cxx @@ -24,6 +24,7 @@ // Id : $Id$ // #include "CalciumTypes2CorbaTypes.hxx" +#include "utilities.h" #include using namespace std; @@ -61,21 +62,16 @@ CORBA_DEPENDENCY_TYPE::CORBA_DEPENDENCY_TYPE() : map & table = ( map & ) *this ; + Ports::Calcium_Ports::DependencyType > & ) *this ; -table[CalciumTypes::TIME_DEPENDENCY ] = Ports::Calcium_Ports::TIME_DEPENDENCY ; -table[CalciumTypes::ITERATION_DEPENDENCY ] = Ports::Calcium_Ports::ITERATION_DEPENDENCY ; -table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ; + table[CalciumTypes::TIME_DEPENDENCY ] = Ports::Calcium_Ports::TIME_DEPENDENCY ; + table[CalciumTypes::ITERATION_DEPENDENCY ] = Ports::Calcium_Ports::ITERATION_DEPENDENCY ; + table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ; -#ifdef _DEBUG_ -std::cerr << "CORBA_DEPENDENCY_TYPE() : table["< & table = (map& ) *this ; + Ports::Calcium_Ports::DependencyType >& ) *this ; -#ifdef _DEBUG_ -std::cerr << "CORBA_DEPENDENCY_TYPE() : ::operator["< #include #include "CalciumPortTraits.hxx" +//#define MYDEBUG + template struct Copy2CorbaSpace { @@ -44,7 +47,7 @@ struct Copy2CorbaSpace { //ESSAI: typedef typename PortType::DataManipulator DataManipulator; typedef typename DataManipulator::InnerType InnerType; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- Copy2CorbaSpace MARK 1 ------------------" << std::endl; #endif // Crée le type corba à partir du data sans lui en donner la propriété. @@ -52,7 +55,7 @@ struct Copy2CorbaSpace { // DataManipulator::create n'a pas le caractère const sur son paramètre data pour le // cas de figure où la propriété de la donnée lui est donnée. corbaData = DataManipulator::create(nRead,const_cast (&data),false); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- Copy2CorbaSpace MARK 2 --(dataPtr : " << DataManipulator::getPointer(corbaData,false)<<")----------------" << std::endl; #endif @@ -75,14 +78,14 @@ Copy2CorbaSpace { corbaData = DataManipulator::create(nRead); InnerType * dataPtr = DataManipulator::getPointer(corbaData,false); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- Copy2CorbaSpace MARK 1 --(dataPtr : " << dataPtr<<")----------------" << std::endl; #endif // Attention : Pour les chaines ou tout autre object complexe il faut utiliser une recopie profonde ! std::copy(&data,&data+nRead,dataPtr); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "-------- Copy2CorbaSpace MARK 2 --(nRead: "< MARK 3 : " ; diff --git a/src/DSC/DSC_User/Datastream/Calcium/Copy2UserSpace.hxx b/src/DSC/DSC_User/Datastream/Calcium/Copy2UserSpace.hxx index 9d5054126..c97876d51 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/Copy2UserSpace.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/Copy2UserSpace.hxx @@ -35,6 +35,8 @@ #include +//#define MYDEBUG + //Les demandes de copies vers l'espace utilisateur //proviennent d'une procédure de lecture @@ -69,11 +71,11 @@ struct Copy2UserSpace{ // Le PORT doit être capable de répondre aux demandes de lecture // multiples d'une donnée pour une même estampille et doit donc garder un pointeur valide // sur le buffer. Il se pose cependant un problème s'il décide - // de supprimer la donnée alors que des client utilise le buffer (historique) ! + // de supprimer la donnée alors que des client utilise le buffer (historique calcium) ! // La seule façon de gérer proprement cette situation est d'utiliser un shared_pointer (TODO). // Pour l'instant l'utilisateur du mode zero copie doit s'assurer que le niveau d'historique // utilisé par le port est compatible avec son utilisation des buffers. Il doit - // être également conscient que s'il modifie le buffer, il est modifier pour tous les + // être également conscient que s'il modifie le buffer, il est modifié pour tous les // utilisateurs actuels et futurs. //REF: InnerType * dataPtr = DataManipulator::getPointer(corbaData,true); @@ -84,7 +86,7 @@ struct Copy2UserSpace{ // Cette ligne poserait uun problème dans la méthode appelante, si elle // ne testait pas que les types utilisateurs et CORBA sont identiques : // ex : InnerType == Corba::Long et d'un T == int - // C'est l'objet de la procédure suivante + // C'est l'objet de la spécialisation ci-dessous. data = dataPtr; // En zero copie l'utilisateur doit appeler ecp_free ( cas ou un buffer intermédiaire @@ -106,7 +108,7 @@ struct Copy2UserSpace { typedef typename DataManipulator::InnerType InnerType; -#ifdef _DEBUG_ +#ifdef MYDEBUG InnerType * dataPtr = NULL; // Affiche la valeur du pointeur de la structure corba // et les pointeurs contenus le cas échéant @@ -139,7 +141,7 @@ struct Copy2UserSpace { //std::copy(dataPtr,dataPtr+nRead,data); DataManipulator::copy(corbaData,data,nRead); -#ifdef _DEBUG_ +#ifdef MYDEBUG tmpData = data; std::cerr << "-------- Copy2UserSpace MARK 1c --data("< using namespace std; @@ -61,21 +62,15 @@ DEPENDENCY_TYPE::DEPENDENCY_TYPE() : map & table = ( map & ) *this ; + CalciumTypes::DependencyType > & ) *this ; -table[Ports::Calcium_Ports::TIME_DEPENDENCY ] = CalciumTypes::TIME_DEPENDENCY ; -table[Ports::Calcium_Ports::ITERATION_DEPENDENCY ] = CalciumTypes::ITERATION_DEPENDENCY ; -table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ; + table[Ports::Calcium_Ports::TIME_DEPENDENCY ] = CalciumTypes::TIME_DEPENDENCY ; + table[Ports::Calcium_Ports::ITERATION_DEPENDENCY ] = CalciumTypes::ITERATION_DEPENDENCY ; + table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ; - -#ifdef _DEBUG_ -std::cerr << "DEPENDENCY_TYPE() : table["< &table = (map&)*this ; -#ifdef _DEBUG_ -std::cerr << "DEPENDENCY_TYPE() : ::operator["< + +#include "Calcium_Ports.hh" +#include "CalciumGenericUsesPort.hxx" + +extern char _repository_Calcium_Intc_Port_name[]; + +class calcium_intc_port_uses : + public virtual CalciumGenericUsesPort< seq_u_manipulation, + Ports::Calcium_Ports::Calcium_Intc_Port, + _repository_Calcium_Intc_Port_name + > +{ + public : + + virtual ~calcium_intc_port_uses(); + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx deleted file mode 100644 index a19dab7cc..000000000 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : calcium_integer_port_uses.hxx -// Author : Eric Fayolle (EDF) -// Module : KERNEL -// Modified by : $LastChangedBy$ -// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ -// Id : $Id$ -// -#ifndef _CALCIUM_INTEGER_PORT_USES_HXX_ -#define _CALCIUM_INTEGER_PORT_USES_HXX_ - -#include - -#include "Calcium_Ports.hh" -#include "CalciumGenericUsesPort.hxx" - -extern char _repository_Calcium_Integer_Port_name[]; - -class calcium_integer_port_uses : - public virtual CalciumGenericUsesPort< seq_u_manipulation, - Ports::Calcium_Ports::Calcium_Integer_Port, - _repository_Calcium_Integer_Port_name - > -{ - public : - - virtual ~calcium_integer_port_uses(); - -}; - -#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx.in b/src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx.in new file mode 100644 index 000000000..ddc228a8d --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx.in @@ -0,0 +1,52 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : calcium_integer_port_uses.hxx +// Author : Eric Fayolle (EDF) +// Module : KERNEL +// Modified by : $LastChangedBy$ +// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $ +// Id : $Id$ +// +#ifndef _CALCIUM_INTEGER_PORT_USES_HXX_ +#define _CALCIUM_INTEGER_PORT_USES_HXX_ + +#include + +#include "Calcium_Ports.hh" +#include "CalciumGenericUsesPort.hxx" + +extern char _repository_Calcium_Integer_Port_name[]; + +class calcium_integer_port_uses : + public virtual CalciumGenericUsesPort< seq_u_manipulation, + Ports::Calcium_Ports::Calcium_Integer_Port, + _repository_Calcium_Integer_Port_name + > +{ + public : + + virtual ~calcium_integer_port_uses(); + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_long_port_uses.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_long_port_uses.hxx new file mode 100644 index 000000000..7c2e4222f --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_long_port_uses.hxx @@ -0,0 +1,52 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, 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 + +#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::Calcium_Long_Port, + _repository_Calcium_Long_Port_name + > +{ + public : + + virtual ~calcium_long_port_uses(); + +}; + +#endif diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx index a99ec947f..a7fc37f3c 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.cxx @@ -43,6 +43,10 @@ calcium_port_factory::create_data_servant(string type) { if ( type == "integer") rtn_port = new calcium_integer_port_provides(); + if ( type == "long") + rtn_port = new calcium_long_port_provides(); + if ( type == "intc") + rtn_port = new calcium_intc_port_provides(); if ( type == "real") rtn_port = new calcium_real_port_provides(); if ( type == "double") @@ -63,6 +67,10 @@ calcium_port_factory::create_data_proxy(string type) { if ( type == "integer") rtn_port = new calcium_integer_port_uses(); + if ( type == "long") + rtn_port = new calcium_long_port_uses(); + if ( type == "intc") + rtn_port = new calcium_intc_port_uses(); if ( type == "real") rtn_port = new calcium_real_port_uses(); if ( type == "double") diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx index cd019e80a..48aa6e20b 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_port_factory.hxx @@ -37,6 +37,8 @@ #include "CalciumProvidesPort.hxx" #include "calcium_integer_port_uses.hxx" +#include "calcium_long_port_uses.hxx" +#include "calcium_intc_port_uses.hxx" #include "calcium_real_port_uses.hxx" #include "calcium_double_port_uses.hxx" #include "calcium_string_port_uses.hxx" diff --git a/src/DSC/DSC_User/Datastream/Calcium/calcium_repository_types.cxx b/src/DSC/DSC_User/Datastream/Calcium/calcium_repository_types.cxx index 89852ed1f..08b3f1a50 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calcium_repository_types.cxx +++ b/src/DSC/DSC_User/Datastream/Calcium/calcium_repository_types.cxx @@ -27,6 +27,8 @@ // Id : $Id$ // #include "calcium_integer_port_uses.hxx" +#include "calcium_long_port_uses.hxx" +#include "calcium_intc_port_uses.hxx" #include "calcium_real_port_uses.hxx" #include "calcium_double_port_uses.hxx" #include "calcium_complex_port_uses.hxx" @@ -34,6 +36,8 @@ #include "calcium_string_port_uses.hxx" char _repository_Calcium_Integer_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0"; +char _repository_Calcium_Long_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Long_Port:1.0"; +char _repository_Calcium_Intc_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Intc_Port:1.0"; char _repository_Calcium_Real_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"; char _repository_Calcium_Double_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"; char _repository_Calcium_Complex_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Complex_Port:1.0"; diff --git a/src/DSC/DSC_User/Datastream/Calcium/calciumf.c b/src/DSC/DSC_User/Datastream/Calcium/calciumf.c index 4ebb051fb..18e4ec5de 100644 --- a/src/DSC/DSC_User/Datastream/Calcium/calciumf.c +++ b/src/DSC/DSC_User/Datastream/Calcium/calciumf.c @@ -23,6 +23,8 @@ #include #include "fortoc.h" #include "calcium.h" +#include "calciumf.h" +#include "CalciumFortranInt.h" #include static void* COMPO=0; @@ -31,9 +33,10 @@ static void* COMPO=0; extern "C" { #endif -static void fstrtocstr(char *cstr, char *fstr,int fstr_len) + +static void fstrtocstr(char *cstr, char *fstr,cal_int fstr_len) { - int i,iend; + cal_int i,iend; for (iend = fstr_len-1; iend >= 0; iend--) if (fstr[iend] != ' ') break; for (i = 0; i <= iend; i++) @@ -41,9 +44,9 @@ static void fstrtocstr(char *cstr, char *fstr,int fstr_len) cstr[i] = '\0'; } -static void cstrtofstr(char *cstr, char *fstr,int fstr_len) +static void cstrtofstr(char *cstr, char *fstr,cal_int fstr_len) { - int i, len; + cal_int i, len; len = strlen(cstr); if (len > fstr_len) len = fstr_len; for (i = 0; i < len; i++) @@ -52,7 +55,7 @@ static void cstrtofstr(char *cstr, char *fstr,int fstr_len) fstr[i++] = ' '; } -static char * fstr1(char *nom,int nnom) +static char * fstr1(char *nom,cal_int nnom) { char * cnom=(char*)malloc((nnom+1)*sizeof(char)); fstrtocstr(cnom,nom,nnom); @@ -64,7 +67,11 @@ static char * 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)) { /* nom is OUT argument */ cp_cd((void *)*compo,STR_PTR(nom)); @@ -72,69 +79,117 @@ void F_FUNC(cpcd,CPCD)(long *compo,STR_PSTR(nom),int *info STR_PLEN(nom)) cstrtofstr(STR_PTR(nom),STR_PTR(nom),STR_LEN(nom)); } -void F_FUNC(cplen,CPLEN)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom), - int *max,int *n, int *tab,int *err STR_PLEN(nom)) +void F_FUNC(cpfin,CPFIN)(long *compo,cal_int *dep,cal_int *err) +{ + fprintf(stderr,"CPFIN: \n"); + *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)) +{ + char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); + fprintf(stderr,"CPLIN: %s %f %f\n",cnom,*ti,*tf); + +#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 + fprintf(stderr,"End of CPLIN: %s \n",cnom); + 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)); + fprintf(stderr,"CPLLG: %s %f %f\n",cnom,*ti,*tf); +#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 + fprintf(stderr,"End of CPLLG: %s \n",cnom); + 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); + *err=cp_len_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); fprintf(stderr,"End of CPLEN: %s \n",cnom); free_str1(cnom); } -void F_FUNC(cpllo,CPLLO)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom), - int *max,int *n, int *tab,int *err STR_PLEN(nom)) + +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); + *err=cp_llo_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); fprintf(stderr,"End of CPLLO: %s \n",cnom); free_str1(cnom); } -void F_FUNC(cpldb,CPLDB)(long *compo,int *dep,double *ti,double *tf,int *iter,STR_PSTR(nom), - int *max,int *n, double *tab,int *err STR_PLEN(nom)) +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); + *err=cp_ldb_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); fprintf(stderr,"End of CPLDB: %s %f %f \n",cnom,*ti,*tf); free_str1(cnom); } -void F_FUNC(cplre,CPLRE)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom), - int *max,int *n, float *tab,int *err STR_PLEN(nom)) +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); + *err=cp_lre_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); fprintf(stderr,"End of CPLRE: %s %f %f \n",cnom,*ti,*tf); free_str1(cnom); } -void F_FUNC(cplcp,CPLCP)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom), - int *max,int *n, float *tab,int *err STR_PLEN(nom)) +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); + *err=cp_lcp_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab); fprintf(stderr,"End of CPLCP: %s %f %f \n",cnom,*ti,*tf); free_str1(cnom); } -void F_FUNC(cplch,CPLCH)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom), - int *max,int *n, char *tab,int *err STR_PLEN(nom) STR_PLEN(tab) ) +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)); + char **tabChaine = NULL; + cal_int index = 0; + char* cnom = fstr1(STR_PTR(nom),STR_LEN(nom)); fprintf(stderr,"CPLCH: %s %f %f \n",cnom, *ti,*tf); tabChaine = (char **) malloc(sizeof(char *) * (*max)); for (index = 0; index < *max; index++) tabChaine[index] = (char *) malloc(sizeof(char) * (STR_LEN(tab)+1)); - *err=cp_lch((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tabChaine,STR_LEN(tab)); + *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])); @@ -148,11 +203,16 @@ void F_FUNC(cplch,CPLCH)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_ free_str1(cnom); } -void F_FUNC(cpech,CPECH)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, char *tab,int *err + +/***************************/ +/* INTERFACES D'ECRITURE */ +/***************************/ + +void F_FUNC(cpech,CPECH)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, char *tab,cal_int *err STR_PLEN(nom) STR_PLEN(tab)) { 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); @@ -169,7 +229,7 @@ void F_FUNC(cpech,CPECH)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom), } } - *err=cp_ech((void *)*compo,*dep,*ti,*iter,cnom,*n,tabChaine,STR_LEN(tab) ); + *err=cp_ech_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tabChaine,STR_LEN(tab) ); fprintf(stderr,"End of CPECH: %s %f \n",cnom, *ti); if (tabChaine != (char **) NULL) { @@ -181,56 +241,86 @@ void F_FUNC(cpech,CPECH)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom), free_str1(cnom); } -void F_FUNC(cpedb,CPEDB)(long *compo,int *dep,double *ti,int *iter,STR_PSTR(nom),int *n, double *tab,int *err STR_PLEN(nom)) +void F_FUNC(cpedb,CPEDB)(long *compo,cal_int *dep,double *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom)) { char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom)); fprintf(stderr,"CPEDB: %s %f \n",cnom, *ti); - *err=cp_edb((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); + *err=cp_edb_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); fprintf(stderr,"End of CPEDB: %s %f \n",cnom, *ti); free_str1(cnom); } -void F_FUNC(cpere,CPERE)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, float *tab,int *err STR_PLEN(nom)) +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); + *err=cp_ere_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); fprintf(stderr,"End of CPERE: %s %f \n",cnom, *ti); free_str1(cnom); } -void F_FUNC(cpecp,CPECP)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, float *tab,int *err STR_PLEN(nom)) +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); + *err=cp_ecp_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); fprintf(stderr,"End of CPECP: %s %f \n",cnom, *ti); free_str1(cnom); } -void F_FUNC(cpeen,CPEEN)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, int *tab,int *err STR_PLEN(nom)) + +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,"CPEIN: %s %f %d\n",cnom, *ti,*iter); +#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 + fprintf(stderr,"End of CPIN: %s %f \n",cnom,*ti); + free_str1(cnom); +} + +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,"CPELG: %s %f %d\n",cnom, *ti,*iter); +#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 + fprintf(stderr,"End of CPELG: %s %f \n",cnom,*ti); + free_str1(cnom); +} + +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)) { 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); + *err=cp_een_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); fprintf(stderr,"End of CPEEN: %s %f \n",cnom,*ti); free_str1(cnom); } -void F_FUNC(cpelo,CPELO)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, int *tab,int *err STR_PLEN(nom)) +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)); fprintf(stderr,"CPELO: %s %f %d\n",cnom, *ti,*iter); - *err=cp_elo((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); + *err=cp_elo_fort_((void *)*compo,*dep,*ti,*iter,cnom,*n,tab); fprintf(stderr,"End of CPELO: %s %f \n",cnom,*ti); free_str1(cnom); } -void F_FUNC(cpfin,CPFIN)(long *compo,int *dep,int *err) -{ - fprintf(stderr,"CPFIN: \n"); - *err=cp_fin((void *)*compo,*dep); -} #ifdef __cplusplus } diff --git a/src/DSC/DSC_User/Datastream/Calcium/calciumf.h b/src/DSC/DSC_User/Datastream/Calcium/calciumf.h new file mode 100644 index 000000000..d4056e3f1 --- /dev/null +++ b/src/DSC/DSC_User/Datastream/Calcium/calciumf.h @@ -0,0 +1,78 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : calcium.h +// Author : Eric Fayolle (EDF) +// Module : KERNEL + +/* Outils d'Aide au Couplage de Code de Calcul : $Id$ */ + +#ifndef __CALCIUMF_H +#define __CALCIUMF_H + +#include "CalciumFortranInt.h" + +/*TODO CPCD... */ + +#define STAR * +#define LCH_LAST_PARAM ,int strsize + + +#define CALCIUM_ECR_INTERFACE_C_H(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \ + extern _calInt cp_##_name (void * component, _calInt mode, \ + _timeType t, _calInt i, \ + char * nomvar, _calInt nbelem, \ + _type _qual * data \ + lastarg ) ; \ + + +CALCIUM_ECR_INTERFACE_C_H(een_fort_,float ,cal_int,cal_int,integer,,); +CALCIUM_ECR_INTERFACE_C_H(elg_fort_,float ,cal_int,long ,long2integer,,); +CALCIUM_ECR_INTERFACE_C_H(ein_fort_,float ,cal_int,int ,int2integer,,); +CALCIUM_ECR_INTERFACE_C_H(ere_fort_,float ,cal_int,float ,float,,); +CALCIUM_ECR_INTERFACE_C_H(edb_fort_,double,cal_int,double,double,,); +CALCIUM_ECR_INTERFACE_C_H(elo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ +CALCIUM_ECR_INTERFACE_C_H(ecp_fort_,float ,cal_int,float ,cplx,,); +CALCIUM_ECR_INTERFACE_C_H(ech_fort_,float ,cal_int,char ,str,STAR,LCH_LAST_PARAM ); + + + +#define CALCIUM_LECT_INTERFACE_C_H(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \ + extern _calInt cp_##_name (void * component, _calInt mode, \ + _timeType * ti, _timeType * tf, _calInt * i, \ + char * nomvar, _calInt bufferLength, \ + _calInt * nRead, _type _qual * data \ + lastarg ) ; \ + \ + + +CALCIUM_LECT_INTERFACE_C_H(len_fort_,float ,cal_int,cal_int ,integer,,); +CALCIUM_LECT_INTERFACE_C_H(llg_fort_,float ,cal_int,long ,long2integer,,); +CALCIUM_LECT_INTERFACE_C_H(lin_fort_,float ,cal_int,int ,int2integer,,); +CALCIUM_LECT_INTERFACE_C_H(lre_fort_,float ,cal_int,float ,float,,); +CALCIUM_LECT_INTERFACE_C_H(ldb_fort_,double,cal_int,double ,double,,); +CALCIUM_LECT_INTERFACE_C_H(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */ +CALCIUM_LECT_INTERFACE_C_H(lcp_fort_,float ,cal_int,float ,cplx,,); +CALCIUM_LECT_INTERFACE_C_H(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_PARAM ); + + + +#endif diff --git a/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx b/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx index 7cf7501c2..ada58a3c7 100644 --- a/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx +++ b/src/DSC/DSC_User/Datastream/CorbaTypeManipulator.hxx @@ -33,6 +33,7 @@ #include #include +//#define MYDEBUG // Classes manipulation // ------------------- @@ -227,7 +228,7 @@ public: // En non collocalisé on recrée une séquence avec le buffer de la première dont on // a demandé la propriété. -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1 ------------------" << std::endl; #endif if ( data.release() ) { @@ -236,13 +237,13 @@ public: // Crée une nouvelle sequence propriétaire des données du buffer (pas de recopie) // Les données de la nouvelle séquence seront automatiquement désallouées // par appel à la méthode freebuf dans le destructeur de la séquence (cf delete_data). -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(0 copy) bis ------"<< p_data <<"------------" << std::endl; #endif return new seq_T (max, len, p_data, true); } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(recopie) bis ------"<< &data <<"------------" << std::endl; #endif // Crée une nouvelle sequence propriétaire des données du buffer (avec recopie) @@ -397,12 +398,12 @@ public: // Crée une nouvelle sequence propriétaire des données du buffer (généralement pas de recopie) // Les données seront automatiquement désallouées par appel interne à la méthode freebuf // lors de la destruction de l'objet par appel à delete_data. -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Pas de Duplication -----------" << std::endl; #endif return new seq_T (len, p_data, true); } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Duplication pour en devenir propriétaire -----------" << std::endl; #endif // Crée une nouvelle sequence propriétaire des données du buffer (avec recopie) diff --git a/src/DSC/DSC_User/Datastream/GenericPort.hxx b/src/DSC/DSC_User/Datastream/GenericPort.hxx index ac7e29411..4372c9dfb 100644 --- a/src/DSC/DSC_User/Datastream/GenericPort.hxx +++ b/src/DSC/DSC_User/Datastream/GenericPort.hxx @@ -35,6 +35,7 @@ #include "Utils_CorbaException.hxx" // SALOME C++ Exception #include "Utils_SALOME_Exception.hxx" +#include "utilities.h" #include #include @@ -43,6 +44,8 @@ #include #include +//#define MYDEBUG + // Classe GenericPort // -------------------------------- // @@ -104,7 +107,7 @@ template < typename DataManipulator, typename COUPLING_POLICY> GenericPort::~GenericPort() { typename DataTable::iterator it; for (it=storedDatas.begin(); it!=storedDatas.end(); ++it) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "~GenericPort() : destruction de la donnnée associée au DataId :"<< (*it).first << std::endl; #endif DataManipulator::delete_data( (*it).second ); @@ -122,12 +125,12 @@ GenericPort::close (PortableServer::POA_var po template < typename DataManipulator, typename COUPLING_POLICY> void GenericPort::wakeupWaiting() { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- wakeupWaiting ------------------" << std::endl; #endif storedDatas_mutex.lock(); if (waitingForAnyDataId || waitingForConvenientDataId) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- wakeupWaiting:signal --------" << std::endl; std::cout << std::flush; #endif @@ -150,7 +153,7 @@ void GenericPort::put(CorbaInDataType dataPara fflush(stdout); fflush(stderr); try { -#ifdef _DEBUG_ +#ifdef MYDEBUG // Affichage des donnees pour DEBUGging std::cerr << "parametres emis: " << time << ", " << tag << std::endl; DataManipulator::dump(dataParam); @@ -173,11 +176,11 @@ void GenericPort::put(CorbaInDataType dataPara bool expectedDataReceived = false; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 1 ------------------" << std::endl; #endif if ( dataIds.empty() ) return; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 1bis ------------------" << std::endl; #endif @@ -188,7 +191,7 @@ void GenericPort::put(CorbaInDataType dataPara int nbOfIter = 0; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 2 ------ "<< (dataIdIt == dataIds.end()) << "------------" << std::endl; std::cout << "-------- Put : MARK 2bis "<< (*dataIdIt) <<"------------------" << std::endl; #endif @@ -196,18 +199,18 @@ void GenericPort::put(CorbaInDataType dataPara for (;dataIdIt != dataIds.end();++dataIdIt) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 3 ------------------" << std::endl; #endif // Duplique l'instance de donnée pour les autres dataIds if (nbOfIter > 0) data = DataManipulator::clone(data); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 3bis -----"<< dataIdIt.operator*() <<"------------" << std::endl; #endif DataId currentDataId=*dataIdIt; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "processing dataId : "<< currentDataId << std::endl; std::cout << "-------- Put : MARK 4 ------------------" << std::endl; @@ -221,14 +224,14 @@ void GenericPort::put(CorbaInDataType dataPara // <=> premier emplacement où l'on pourrait insérer notre DataId // <=> en général équivaux à (*wDataIt).first >= currentDataId typename DataTable::iterator wDataIt = storedDatas.lower_bound(currentDataId); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 5 ------------------" << std::endl; #endif // On n'a pas trouvé de dataId supérieur au notre ou // on a trouvé une clé > à cet Id if (wDataIt == storedDatas.end() || storedDatas.key_comp()(currentDataId,(*wDataIt).first) ) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 6 ------------------" << std::endl; #endif // Ajoute la donnee dans la table @@ -236,7 +239,7 @@ void GenericPort::put(CorbaInDataType dataPara } 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_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 7 ------------------" << std::endl; #endif // Les données sont remplacées par les nouvelles valeurs @@ -247,13 +250,13 @@ void GenericPort::put(CorbaInDataType dataPara 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; @@ -278,7 +281,7 @@ void GenericPort::put(CorbaInDataType dataPara ( waitingForConvenientDataId && isDataIdConveniant(storedDatas, expectedDataId, dummy1, dummy2, dummy3) ) ) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Put : MARK 10 ------------------" << std::endl; #endif //Doit pouvoir réveiller le get ici (a vérifier) @@ -287,7 +290,7 @@ void GenericPort::put(CorbaInDataType dataPara } 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 @@ -305,20 +308,18 @@ void GenericPort::put(CorbaInDataType dataPara // Pb2 : également si deux attentes de DataIds même différents car on n'en stocke qu'un ! // Conclusion : Pour l'instant on ne gère pas un service multithreadé qui effectue // des lectures simultanées sur le même port ! -#ifdef _DEBUG_ - std::cout << "-------- Put : new datas available ------------------" << std::endl; -#endif + MESSAGE("-------- Put : new datas available ------------------"); 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); @@ -357,11 +358,11 @@ GenericPort::get(TimeType time, bool isEqual, isBounded; typedef typename DataManipulator::InnerType InnerType; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 1 ------------------" << std::endl; #endif expectedDataId = DataId(time,tag); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 2 ------------------" << std::endl; #endif @@ -379,14 +380,14 @@ GenericPort::get(TimeType time, // - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first // Méthode provenant de la COUPLING_POLICY isDataIdConveniant(storedDatas,expectedDataId,isEqual,isBounded,wDataIt1); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 3 ------------------" << std::endl; #endif // L'ordre des différents tests est important if ( isEqual ) { -#ifdef _DEBUG_ +#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. @@ -395,7 +396,7 @@ GenericPort::get(TimeType time, // Du coup interaction potentielle entre le 0 copy et gestion de l'historique dataToTransmit = (*wDataIt1).second; -#ifdef _DEBUG_ +#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); @@ -410,13 +411,13 @@ GenericPort::get(TimeType time, // Méthode provenant de la COUPLING_POLICY typename COUPLING_POLICY::template EraseDataIdProcessor processEraseDataId(*this); processEraseDataId.apply(storedDatas,wDataIt1); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 6 ------------------" << std::endl; #endif break; } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 7 ------------------" << std::endl; #endif @@ -430,7 +431,7 @@ GenericPort::get(TimeType time, // 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_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 8 ------------------" << std::endl; #endif @@ -448,7 +449,7 @@ GenericPort::get(TimeType time, // 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_ +#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); @@ -472,12 +473,12 @@ GenericPort::get(TimeType time, // Réception bloquante sur le dataId demandé // Si l'instance de donnée n'est pas trouvee -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 10 ------------------" << std::endl; #endif //Positionné à faux dans la méthode put waitingForConvenientDataId = true; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 11 ------------------" << std::endl; // Ici on attend que la méthode put recoive la donnée @@ -486,7 +487,7 @@ GenericPort::get(TimeType time, fflush(stdout);fflush(stderr); cond_instance.wait(); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 12 ------------------" << std::endl; #endif } @@ -499,7 +500,7 @@ GenericPort::get(TimeType time, // Deverouille l'acces a la table storedDatas_mutex.unlock(); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Get : MARK 13 ------------------" << std::endl; #endif @@ -538,7 +539,7 @@ GenericPort::next(TimeType &t, try { storedDatas_mutex.lock();// Gérer les Exceptions ds le corps de la méthode -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 1 ---lastDataIdSet ("<::next(TimeType &t, 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; @@ -585,12 +586,12 @@ GenericPort::next(TimeType &t, cond_instance.wait(); if (lastDataIdSet) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 4 ------------------" << std::endl; #endif wDataIt1 = storedDatas.upper_bound(lastDataId); } else { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 5 ------------------" << std::endl; #endif lastDataIdSet = true; @@ -598,7 +599,7 @@ GenericPort::next(TimeType &t, } } -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 6 ------------------" << std::endl; #endif @@ -606,7 +607,7 @@ GenericPort::next(TimeType &t, tag = getTag ( (*wDataIt1).first ); dataToTransmit = (*wDataIt1).second; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 7 ------------------" << std::endl; #endif lastDataId = (*wDataIt1).first; @@ -614,11 +615,11 @@ GenericPort::next(TimeType &t, typename COUPLING_POLICY::template EraseDataIdProcessor processEraseDataId(*this); processEraseDataId.apply(storedDatas, wDataIt1); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 8 ------------------" << std::endl; #endif } catch (...) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 8bis ------------------" << std::endl; #endif waitingForAnyDataId = false; @@ -627,7 +628,7 @@ GenericPort::next(TimeType &t, } storedDatas_mutex.unlock(); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "-------- Next : MARK 9 ------------------" << std::endl; #endif diff --git a/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx b/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx index 0d397e172..25cd00348 100644 --- a/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx +++ b/src/DSC/DSC_User/Datastream/GenericUsesPort.hxx @@ -107,16 +107,14 @@ GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::put CorbaPortTypeVar port = CorbaPortType::_narrow((*_my_ports)[i]); //if (i) { PB1 //OLD : copyOfData = DataManipulator::clone(data); -#ifdef _DEBUG_ - std::cout << "-------- GenericUsesPort::put -------- " << std::endl; -#endif + MESSAGE("-------- GenericUsesPort::put -------- " ); //} PB1 try { port->put(data,time,tag); // OLD : port->put(*copyOfData,time,tag); } catch(const CORBA::SystemException& ex) { //OLD : DataManipulator::delete_data(copyOfData); - throw DSC_Exception(LOC(OSS() << "Impossible d'invoquer la méthode put sur le port n°" + throw DSC_Exception(LOC(OSS() << "Can't invoke put method on port number " << i << "( i>= 0)")); } @@ -137,9 +135,7 @@ GenericUsesPort< DataManipulator, CorbaPortType, repositoryName, UsesPort { if (_my_ports) delete _my_ports; -#ifdef _DEBUG_ - std::cerr << "GenericUsesPort::uses_port_changed" << std::endl; -#endif + MESSAGE("GenericUsesPort::uses_port_changed"); _my_ports = new_uses_port; } diff --git a/src/DSC/DSC_User/Datastream/Palm/Makefile.am b/src/DSC/DSC_User/Datastream/Palm/Makefile.am index 8d663d52d..d47ea5789 100644 --- a/src/DSC/DSC_User/Datastream/Palm/Makefile.am +++ b/src/DSC/DSC_User/Datastream/Palm/Makefile.am @@ -51,7 +51,6 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \ -I$(top_srcdir)/src/SALOMELocalTrace \ -I$(top_srcdir)/src/Basics \ -I$(top_srcdir)/src/Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/DSC/DSC_User/Makefile.am b/src/DSC/DSC_User/Makefile.am index 9c6f39364..2248445c1 100644 --- a/src/DSC/DSC_User/Makefile.am +++ b/src/DSC/DSC_User/Makefile.am @@ -52,7 +52,6 @@ COMMON_CPPFLAGS= \ -I$(top_srcdir)/src/SALOMELocalTrace \ -I$(top_srcdir)/src/Basics \ -I$(top_srcdir)/src/Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@ diff --git a/src/DSC/DSC_User/Superv_Component_i.cxx b/src/DSC/DSC_User/Superv_Component_i.cxx index 15bb1894f..acbd47875 100644 --- a/src/DSC/DSC_User/Superv_Component_i.cxx +++ b/src/DSC/DSC_User/Superv_Component_i.cxx @@ -45,7 +45,7 @@ Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb, bool notif) : Engines_DSC_i(orb, poa, contId, instanceName, interfaceName) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl; #endif } @@ -58,7 +58,7 @@ Superv_Component_i::Superv_Component_i(CORBA::ORB_ptr orb, bool regist) : Engines_DSC_i(orb, poa, container, instanceName, interfaceName,notif,regist) { -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl; #endif } @@ -163,11 +163,11 @@ Superv_Component_i::add_port(const char * port_fab_type, 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); diff --git a/src/DSC/DSC_User/Superv_Component_i.hxx b/src/DSC/DSC_User/Superv_Component_i.hxx index ec6d8abcb..29f8483f3 100644 --- a/src/DSC/DSC_User/Superv_Component_i.hxx +++ b/src/DSC/DSC_User/Superv_Component_i.hxx @@ -35,6 +35,7 @@ #include "DSC_Exception.hxx" #include +//#define MYDEBUG /*! \class Superv_Component_i * \brief This class implements DSC_User component. @@ -297,7 +298,7 @@ Superv_Component_i::add_port(const char * port_fab_type, assert(port_name); SpecificPortType * retPort; -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "---- Superv_Component_i::add_port : Mark 0 ---- " << port_name << "----" << std::endl; #endif @@ -313,12 +314,12 @@ Superv_Component_i::add_port(const char * port_fab_type, else if (s_port_type == "uses") { uses_port * port = create_uses_data_port(port_fab_type); add_port(port, port_name); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "---- Superv_Component_i::add_port : Mark 1 ---- " << port << "----" << std::endl; std::cout << "---- Superv_Component_i::add_port : Mark 1 ---- get_repository_id()" << port->get_repository_id() << std::endl; #endif retPort = dynamic_cast(port); -#ifdef _DEBUG_ +#ifdef MYDEBUG std::cout << "---- Superv_Component_i::add_port : Mark 2 ---- " << retPort << "----" << std::endl; #endif if ( retPort == NULL ) { delete port; diff --git a/src/DSC/ParallelDSC/Makefile.am b/src/DSC/ParallelDSC/Makefile.am index 64346973e..d98dc9a5b 100644 --- a/src/DSC/ParallelDSC/Makefile.am +++ b/src/DSC/ParallelDSC/Makefile.am @@ -50,7 +50,6 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \ -I$(top_srcdir)/src/NamingService \ -I$(top_srcdir)/src/Utils \ -I$(top_srcdir)/src/DSC/DSC_Basic \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ -I$(top_srcdir)/src/Registry \ -I$(top_srcdir)/src/Utils \ diff --git a/src/GenericObj/Makefile.am b/src/GenericObj/Makefile.am index 115e2b722..d159e87be 100644 --- a/src/GenericObj/Makefile.am +++ b/src/GenericObj/Makefile.am @@ -39,7 +39,6 @@ libSalomeGenericObj_la_LDFLAGS = -no-undefined -version-info=0:0:0 libSalomeGenericObj_la_CPPFLAGS = \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ libSalomeGenericObj_la_LIBADD = \ diff --git a/src/HDFPersist/HDFobjectIdentify.c b/src/HDFPersist/HDFobjectIdentify.c index 5ec213de8..a5bc7710f 100644 --- a/src/HDFPersist/HDFobjectIdentify.c +++ b/src/HDFPersist/HDFobjectIdentify.c @@ -26,6 +26,7 @@ SALOME HDFPersist : implementation of HDF persitent ( save/ restore ) ----------------------------------------------------------------------------*/ #include "hdfi.h" +#include /* * - Name: HDFobjectIdentify diff --git a/src/KERNEL_PY/Makefile.am b/src/KERNEL_PY/Makefile.am index 869e2f913..c94ecdd7d 100755 --- a/src/KERNEL_PY/Makefile.am +++ b/src/KERNEL_PY/Makefile.am @@ -36,18 +36,16 @@ if CORBA_GEN Help.py \ PyInterp.py \ salome.py \ - salome_shared_modules.py \ batchmode_salome.py \ - import_hook.py \ salome_test.py \ salome_kernel.py \ salome_study.py \ salome_iapp.py \ salome_ComponentGUI.py \ - omnipatch.py \ iparameters.py \ salome_version.py \ - salome_notebook.py + salome_notebook.py \ + salome_genericobj.py endif sharedpkgpython_PYTHON = kernel_shared_modules.py diff --git a/src/KERNEL_PY/salome_genericobj.py b/src/KERNEL_PY/salome_genericobj.py new file mode 100644 index 000000000..053f4ae1b --- /dev/null +++ b/src/KERNEL_PY/salome_genericobj.py @@ -0,0 +1,24 @@ +""" + When imported this module adds to CORBA objref from GenericObj type + automatic management of reference count + The reference count is incremented when the local proxy is created (assignment of __omni_obj attribute) + and is decremented when the local proxy is deleted (call of __del__) + + The GenericObj class for proxy is modified by adding two methods : __del__ and __setattr__ + The module must be imported before any other import of SALOME CORBA module +""" +import omniORB +import SALOME + +def mydel(self): + self.Destroy() + omniORB.CORBA.Object.__del__(self) + +def mysetattr(self,attr,value): + self.__dict__[attr]=value + if attr == "__omni_obj": + self.Register() + +SALOME._objref_GenericObj.__del__=mydel +SALOME._objref_GenericObj.__setattr__=mysetattr + diff --git a/src/KERNEL_PY/salome_test.py b/src/KERNEL_PY/salome_test.py index a62cbafe9..e0aab705c 100755 --- a/src/KERNEL_PY/salome_test.py +++ b/src/KERNEL_PY/salome_test.py @@ -479,7 +479,11 @@ import VISU import visu_gui medFileName = "pointe.med" -medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFileName +if sys.platform != "win32": + medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFileName +else: + medFile = os.getenv('DATA_DIR') + '\\MedFiles\\' + medFileName + pass print "Load ", medFile studyCurrent = salome.myStudyName @@ -494,7 +498,7 @@ try: if sys.platform != "win32": tmpDir = "/tmp/" else: - tmpDir = os.getenv('TEMP') + '/' + tmpDir = os.getenv('TEMP') + '\\' medFileNew = tmpDir + str(random.randint(0,1000000)) + "_" + medFileName print " -- Copy " + medFile + " to " + medFileNew @@ -505,7 +509,9 @@ try: os.system(copyCommand + " " + medFile + " " + medFileNew) medFile = medFileNew - os.system("chmod 755 " + medFile) + if sys.platform != "win32": + os.system("chmod 755 " + medFile) + pass if os.access(medFile, os.W_OK) : med_comp.readStructFileWithFieldType(medFile,studyCurrent) diff --git a/src/Launcher/Makefile.am b/src/Launcher/Makefile.am index 97e08d2a0..574c04b33 100644 --- a/src/Launcher/Makefile.am +++ b/src/Launcher/Makefile.am @@ -61,7 +61,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Notification \ -I$(srcdir)/../ResourcesManager \ -I$(srcdir)/../Container \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/LifeCycleCORBA/Makefile.am b/src/LifeCycleCORBA/Makefile.am index c24e369f9..a7d1e58d7 100644 --- a/src/LifeCycleCORBA/Makefile.am +++ b/src/LifeCycleCORBA/Makefile.am @@ -56,7 +56,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Utils \ -I$(srcdir)/../Container \ -I$(srcdir)/../ResourcesManager \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@ diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index eb2d2d914..534553609 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -85,9 +85,11 @@ SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns) char **argv = &xargv; CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb); + _NSnew=0; if (!ns) { _NS = new SALOME_NamingService(orb); + _NSnew=_NS; } else _NS = ns; //add try catch @@ -115,6 +117,7 @@ SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns) SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA() { + if(_NSnew)delete _NSnew; } //============================================================================= @@ -274,7 +277,7 @@ SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName, { // containerName doesn't contain "/" => Local container params->container_name=CORBA::string_dup(stContainer); - params->hostname=CORBA::string_dup(Kernel_Utils::GetHostname().c_str()); + params->hostname=""; } else { @@ -534,6 +537,8 @@ void SALOME_LifeCycleCORBA::killOmniNames() string portNumber (::getenv ("NSPORT") ); if ( !portNumber.empty() ) { +#ifdef WNT +#else string cmd ; cmd = string( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*") + portNumber @@ -544,6 +549,7 @@ void SALOME_LifeCycleCORBA::killOmniNames() } catch ( ... ) { } +#endif } // NPAL 18309 (Kill Notifd) @@ -731,3 +737,21 @@ void SALOME_LifeCycleCORBA::copyFile(const char* hostSrc, const char* fileSrc, c containerDest->copyFile(containerSrc,fileSrc,fileDest); } +/*! \brief get the naming service used by the life cycle + * + * \return the naming service + */ +SALOME_NamingService * SALOME_LifeCycleCORBA::namingService() +{ + return _NS; +} + +/*! \brief get the orb used by the life cycle + * + * \return the orb + */ +CORBA::ORB_ptr SALOME_LifeCycleCORBA::orb() +{ + return _NS->orb(); +} + diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx index 4083c428b..c22385796 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx @@ -102,6 +102,8 @@ public: Engines::ContainerManager_ptr getContainerManager(); Engines::ResourcesManager_ptr getResourcesManager(); + SALOME_NamingService * namingService(); + CORBA::ORB_ptr orb(); void copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest); void shutdownServers(); @@ -126,6 +128,7 @@ protected: int studyId); SALOME_NamingService *_NS; + SALOME_NamingService *_NSnew; Engines::ContainerManager_var _ContManager; Engines::ResourcesManager_var _ResManager; diff --git a/src/LifeCycleCORBA/Test/Makefile.am b/src/LifeCycleCORBA/Test/Makefile.am index c54e98603..3583ff67d 100644 --- a/src/LifeCycleCORBA/Test/Makefile.am +++ b/src/LifeCycleCORBA/Test/Makefile.am @@ -58,7 +58,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \ -I$(srcdir)/$(RPATH)/ResourcesManager \ -I$(srcdir)/$(RPATH)/LifeCycleCORBA \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/LifeCycleCORBA/TestContainerManager.cxx b/src/LifeCycleCORBA/TestContainerManager.cxx index aaa52b195..d9a3a82e3 100644 --- a/src/LifeCycleCORBA/TestContainerManager.cxx +++ b/src/LifeCycleCORBA/TestContainerManager.cxx @@ -90,7 +90,7 @@ int main (int argc, char * argv[]) for(int i=0;i<10;i++){ sprintf(st,"first_%d",i); p.container_name = CORBA::string_dup(st); - p.policy="best"; + p.policy="first"; cont = _ContManager->GiveContainer(p); if(CORBA::is_nil(cont)) error = true; } diff --git a/src/LifeCycleCORBA_SWIG/Makefile.am b/src/LifeCycleCORBA_SWIG/Makefile.am index 0b5126cbe..de1dfbe77 100644 --- a/src/LifeCycleCORBA_SWIG/Makefile.am +++ b/src/LifeCycleCORBA_SWIG/Makefile.am @@ -65,7 +65,6 @@ _libSALOME_LifeCycleCORBA_la_CPPFLAGS =\ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/Logger/Makefile.am b/src/Logger/Makefile.am index e763aa4f6..9ffd07621 100644 --- a/src/Logger/Makefile.am +++ b/src/Logger/Makefile.am @@ -45,7 +45,6 @@ SALOME_Logger_Server_SOURCES = \ SALOME_Logger_Server_LDADD = libSalomeLoggerServer.la SALOME_Logger_Server_CPPFLAGS =\ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Basics \ @@ -58,7 +57,6 @@ libSalomeLoggerServer_la_SOURCES =\ SALOME_Logger_Server.cxx libSalomeLoggerServer_la_CPPFLAGS =\ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ libSalomeLoggerServer_la_LDFLAGS = -no-undefined -version-info=0:0:0 diff --git a/src/MPIContainer/MPIContainer_i.cxx b/src/MPIContainer/MPIContainer_i.cxx index 943238344..b127d2a32 100644 --- a/src/MPIContainer/MPIContainer_i.cxx +++ b/src/MPIContainer/MPIContainer_i.cxx @@ -187,17 +187,17 @@ bool Engines_MPIContainer_i::Lload_component_Library(const char* componentName) else { Py_ACQUIRE_NEW_THREAD; - PyObject *mainmod = PyImport_AddModule("__main__"); + PyObject *mainmod = PyImport_AddModule((char *)"__main__"); PyObject *globals = PyModule_GetDict(mainmod); PyObject *pyCont = PyDict_GetItemString(globals, "pyCont"); PyObject *result = PyObject_CallMethod(pyCont, - "import_component", - "s",componentName); - int ret= PyInt_AsLong(result); + (char*)"import_component", + (char*)"s",componentName); + std::string ret= PyString_AsString(result); SCRUTE(ret); Py_RELEASE_NEW_THREAD; - if (ret) // import possible: Python component + if (ret=="") // import possible: Python component { _library_map[aCompName] = (void *)pyCont; // any non O value OK MESSAGE("[" << _numproc << "] import Python: "<tior))[st->ip]))->load_component_Library(st->compoName.c_str()); + return NULL; } void *th_createcomponentinstance(void *s) { thread_st *st = (thread_st*)s; (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->create_component_instance(st->compoName.c_str(),st->studyId); + return NULL; } void *th_loadimpl(void *s) { thread_st *st = (thread_st*)s; (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->load_impl(st->nameToRegister.c_str(),st->compoName.c_str()); + return NULL; } void *th_removeimpl(void *s) { thread_st *st = (thread_st*)s; (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->remove_impl(st->cptr); + return NULL; } void *th_finalizeremoval(void *s) { thread_st *st = (thread_st*)s; (Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->finalize_removal(); + return NULL; } - diff --git a/src/MPIContainer/MPIObject_i.cxx b/src/MPIContainer/MPIObject_i.cxx index af78c0f2c..075a0b16e 100644 --- a/src/MPIContainer/MPIObject_i.cxx +++ b/src/MPIContainer/MPIObject_i.cxx @@ -124,7 +124,7 @@ void MPIObject_i::BCastIOR(CORBA::ORB_ptr orb, Engines::MPIObject_ptr pobj, bool } #ifdef HAVE_MPI2 -void MPIObject_i::remoteMPI2Connect(bool high, string service) +void MPIObject_i::remoteMPI2Connect(string service) { int i; char port_name[MPI_MAX_PORT_NAME]; @@ -192,8 +192,8 @@ void MPIObject_i::remoteMPI2Connect(bool high, string service) else MPI_Comm_connect(port_name_clt, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &(_icom[service]) ); - /* create global communicator */ - MPI_Intercomm_merge(_icom[service],high,&(_gcom[service])); + /* create global communicator: servers have low index in global communicator*/ + MPI_Intercomm_merge(_icom[service],!_srv[service],&(_gcom[service])); /* only rank 0 can be server for unpublish name */ if(_numproc != 0) _srv[service] = false; diff --git a/src/MPIContainer/MPIObject_i.hxx b/src/MPIContainer/MPIObject_i.hxx index 66d24f58d..9b07b25b2 100644 --- a/src/MPIContainer/MPIObject_i.hxx +++ b/src/MPIContainer/MPIObject_i.hxx @@ -60,7 +60,7 @@ class MPIObject_i: public POA_Engines::MPIObject void BCastIOR(CORBA::ORB_ptr orb,Engines::MPIObject_ptr pobj,bool amiCont); #ifdef HAVE_MPI2 // MPI2 connection - void remoteMPI2Connect(bool high, std::string service); + void remoteMPI2Connect(std::string service); // MPI2 disconnection void remoteMPI2Disconnect(std::string service); #endif diff --git a/src/MPIContainer/Makefile.am b/src/MPIContainer/Makefile.am index 84bd2bbfe..ae8c2654e 100644 --- a/src/MPIContainer/Makefile.am +++ b/src/MPIContainer/Makefile.am @@ -60,7 +60,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Notification \ -I$(srcdir)/../ResourcesManager \ -I$(srcdir)/../Container \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/MPIContainer/SALOME_MPIContainer.cxx b/src/MPIContainer/SALOME_MPIContainer.cxx index c288ec8cf..7c3b2a672 100644 --- a/src/MPIContainer/SALOME_MPIContainer.cxx +++ b/src/MPIContainer/SALOME_MPIContainer.cxx @@ -30,7 +30,6 @@ using namespace std; int main(int argc, char* argv[]) { int nbproc, numproc; - Engines_MPIContainer_i * myContainer=NULL; MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&nbproc); @@ -51,39 +50,14 @@ int main(int argc, char* argv[]) // obtain the root poa manager PortableServer::POAManager_var pman = root_poa->the_POAManager(); - // define policy objects - PortableServer::ImplicitActivationPolicy_var implicitActivation = - root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ; - - // default = NO_IMPLICIT_ACTIVATION - PortableServer::ThreadPolicy_var threadPolicy = - root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ; - // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL - - // create policy list - CORBA::PolicyList policyList; - policyList.length(2); - policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ; - policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ; - - // create the child POA - PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ; - PortableServer::POA_var factory_poa = - root_poa->create_POA("factory_poa", pman, policyList) ; - //with nil_mgr instead of pman, a new POA manager is created with the new POA - - // destroy policy objects - implicitActivation->destroy() ; - threadPolicy->destroy() ; - - char *containerName = ""; + char *containerName = (char *)""; if (argc >1) { containerName = argv[1] ; } MESSAGE("[" << numproc << "] MPIContainer: load MPIContainer servant"); - new Engines_MPIContainer_i(nbproc,numproc,orb,factory_poa, containerName,argc,argv); + new Engines_MPIContainer_i(nbproc,numproc,orb,root_poa, containerName,argc,argv); pman->activate(); diff --git a/src/Makefile.am b/src/Makefile.am index 52b42f6c2..32cf716f6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -101,7 +101,7 @@ DIST_SUBDIRS = \ # if WITHONLYLAUNCHER - SUBDIRS = Batch Batch_SWIG ResourcesManager Launcher + SUBDIRS = Basics Batch Batch_SWIG ResourcesManager Launcher else SUBDIRS = $(SUBDIR_BASE) diff --git a/src/ModuleCatalog/Makefile.am b/src/ModuleCatalog/Makefile.am index 99160e72e..912622390 100644 --- a/src/ModuleCatalog/Makefile.am +++ b/src/ModuleCatalog/Makefile.am @@ -59,7 +59,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @LIBXML_INCLUDES@ \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/NOTIFICATION_SWIG/Makefile.am b/src/NOTIFICATION_SWIG/Makefile.am index a1b75ed3d..2ba0458ad 100644 --- a/src/NOTIFICATION_SWIG/Makefile.am +++ b/src/NOTIFICATION_SWIG/Makefile.am @@ -49,7 +49,6 @@ _libNOTIFICATION_la_CPPFLAGS =\ -I$(srcdir)/../Notification \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ - -I$(top_builddir)/salome_adm/unix \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/NamingService/Makefile.am b/src/NamingService/Makefile.am index 474f5f02e..93cfad682 100644 --- a/src/NamingService/Makefile.am +++ b/src/NamingService/Makefile.am @@ -52,7 +52,6 @@ libSalomeNS_la_CPPFLAGS = \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Basics \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/NamingService/SALOME_NamingService.cxx b/src/NamingService/SALOME_NamingService.cxx index 9b1d479f5..70d337008 100644 --- a/src/NamingService/SALOME_NamingService.cxx +++ b/src/NamingService/SALOME_NamingService.cxx @@ -90,6 +90,7 @@ SALOME_NamingService::~SALOME_NamingService() * * Initializes ORB reference and naming service root context. * For use after default constructor. + * If param orb is null, the orb is initialized * \param orb CORBA::ORB_ptr arguments */ // ============================================================================ @@ -99,7 +100,13 @@ void SALOME_NamingService::init_orb(CORBA::ORB_ptr orb) MESSAGE("SALOME_NamingService initialisation"); Utils_Locker lock (&_myMutex); - _orb = CORBA::ORB::_duplicate(orb); + if(orb) + _orb = CORBA::ORB::_duplicate(orb); + else + { + int argc=0; + _orb = CORBA::ORB_init(argc, 0); // Here we make the assumption that the orb has already been initialized + } _initialize_root_context(); } @@ -1825,3 +1832,12 @@ char * SALOME_NamingService::getIORaddr() return _orb->object_to_string(_root_context); } +/*! \brief get the orb used by the naming service + * + * \return the orb + */ +CORBA::ORB_ptr SALOME_NamingService::orb() +{ + return _orb; +} + diff --git a/src/NamingService/SALOME_NamingService.hxx b/src/NamingService/SALOME_NamingService.hxx index 6e54c5f7d..df06b2e1c 100644 --- a/src/NamingService/SALOME_NamingService.hxx +++ b/src/NamingService/SALOME_NamingService.hxx @@ -48,7 +48,7 @@ public: virtual ~SALOME_NamingService(); - void init_orb(CORBA::ORB_ptr orb); + void init_orb(CORBA::ORB_ptr orb=0); void Register(CORBA::Object_ptr ObjRef, const char* Path) throw(ServiceUnreachable); @@ -91,6 +91,7 @@ public: virtual void Destroy_FullDirectory(const char* Path) throw(ServiceUnreachable); char* getIORaddr(); + CORBA::ORB_ptr orb(); protected: Utils_Mutex _myMutex; diff --git a/src/NamingService/SALOME_NamingServicePy.py b/src/NamingService/SALOME_NamingServicePy.py index 3797ae961..92ad1360a 100644 --- a/src/NamingService/SALOME_NamingServicePy.py +++ b/src/NamingService/SALOME_NamingServicePy.py @@ -52,13 +52,15 @@ class SALOME_NamingServicePy_i(object): #------------------------------------------------------------------------- - def __init__(self, orb): + def __init__(self, orb=None): """ Standard Constructor, with ORB reference. Initializes the naming service root context """ #MESSAGE ( "SALOME_NamingServicePy_i::__init__" ) + if orb is None: + orb=CORBA.ORB_init([''], CORBA.ORB_ID) self._orb = orb # initialize root context and current context ok = 0 diff --git a/src/NamingService/Test/Makefile.am b/src/NamingService/Test/Makefile.am index 166fd3388..c27525a35 100644 --- a/src/NamingService/Test/Makefile.am +++ b/src/NamingService/Test/Makefile.am @@ -54,7 +54,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/Basics \ -I$(srcdir)/$(RPATH)/SALOMELocalTrace \ -I$(srcdir)/$(RPATH)/Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/Notification/Makefile.am b/src/Notification/Makefile.am index e0b458e4c..b70f2a301 100644 --- a/src/Notification/Makefile.am +++ b/src/Notification/Makefile.am @@ -56,7 +56,6 @@ libSalomeNotification_la_CPPFLAGS =\ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/ParallelContainer/Makefile.am b/src/ParallelContainer/Makefile.am index 59ef7f32f..252c03742 100644 --- a/src/ParallelContainer/Makefile.am +++ b/src/ParallelContainer/Makefile.am @@ -52,7 +52,6 @@ COMMON_CPPFLAGS= -I$(top_srcdir)/src/Container \ -I$(top_srcdir)/src/Registry \ -I$(top_srcdir)/src/Utils \ -I$(srcdir)/../HDFPersist \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ -I$(top_srcdir)/src/SALOMETraceCollector \ @PYTHON_INCLUDES@ \ diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx index ec268dc01..74d4edfe1 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx @@ -209,11 +209,11 @@ Container_proxy_impl_final::load_component_Library(const char* componentName) PyObject *result = PyObject_CallMethod(pyCont, (char*)"import_component", (char*)"s",componentName); - int ret_p= PyInt_AsLong(result); + std::string ret_p= PyString_AsString(result); Py_XDECREF(result); Py_RELEASE_NEW_THREAD; - if (ret_p) // import possible: Python component + if (ret_p=="") // import possible: Python component { MESSAGE("import Python: " << aCompName <<" OK"); } diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx index 1213347d2..d39f0a799 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx @@ -349,11 +349,11 @@ Engines_Parallel_Container_i::load_component_Library(const char* componentName) PyObject *result = PyObject_CallMethod(pyCont, (char*)"import_component", (char*)"s",componentName); - int ret_p= PyInt_AsLong(result); + std::string ret_p= PyString_AsString(result); Py_XDECREF(result); Py_RELEASE_NEW_THREAD; - if (ret_p) // import possible: Python component + if (ret_p=="") // import possible: Python component { _library_map[aCompName] = (void *)pyCont; // any non O value OK MESSAGE("import Python: " << aCompName <<" OK"); diff --git a/src/Registry/Makefile.am b/src/Registry/Makefile.am index 3502d99b7..e9a708e53 100644 --- a/src/Registry/Makefile.am +++ b/src/Registry/Makefile.am @@ -45,7 +45,6 @@ libRegistry_la_CPPFLAGS =\ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @@ -68,6 +67,5 @@ SALOME_Registry_Server_CPPFLAGS =\ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/Registry/RegistryConnexion.cxx b/src/Registry/RegistryConnexion.cxx index 2a505c764..d7686a97b 100644 --- a/src/Registry/RegistryConnexion.cxx +++ b/src/Registry/RegistryConnexion.cxx @@ -43,119 +43,115 @@ using namespace std; Registry::Components_var Connexion( int argc , char **argv , const char *ptrSessionName ) throw( CommException ) { - Registry::Components_var varComponents = 0 ; - ASSERT(ptrSessionName) ; - ASSERT(strlen(ptrSessionName)>0) ; - const char *registryName = "Registry" ; - - try - { - ORB_INIT &init = *SINGLETON_::Instance() ; - ASSERT(SINGLETON_::IsAlreadyExisting()) ; - CORBA::ORB_var &orb = init( argc , argv ) ; - - SALOME_NamingService &naming = *SINGLETON_::Instance() ; - ASSERT(SINGLETON_::IsAlreadyExisting()) ; - naming.init_orb( orb ) ; - - // Recuperation de la reference de l'objet - CORBA::Object_var object = naming.Resolve( registryName ) ; - if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ; - - // Specialisation de l'objet generique - varComponents = Registry::Components::_narrow( object ) ; - ASSERT(! CORBA::is_nil(varComponents)) ; - } - catch( ... ) - { - throw CommException ( "NamingService Connexion Error" ) ; - } - return varComponents ; + Registry::Components_var varComponents = 0 ; + ASSERT(ptrSessionName) ; + ASSERT(strlen(ptrSessionName)>0) ; + const char *registryName = "Registry" ; + + try + { + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()) ; + CORBA::ORB_var &orb = init( argc , argv ) ; + + SALOME_NamingService &naming = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()) ; + naming.init_orb( orb ) ; + + // Recuperation de la reference de l'objet + CORBA::Object_var object = naming.Resolve( registryName ) ; + if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ; + + // Specialisation de l'objet generique + varComponents = Registry::Components::_narrow( object ) ; + ASSERT(! CORBA::is_nil(varComponents)) ; + } + catch( ... ) + { + throw CommException ( "NamingService Connexion Error" ) ; + } + return varComponents ; } RegistryConnexion::RegistryConnexion( int argc , char **argv , const char *ior , const char *ptrSessionName, const char *componentName ): \ - _Ior(duplicate(ior)), _VarComponents( Connexion(argc,argv,ptrSessionName) ), _SessionName(ptrSessionName),_Name(""), _Id(0) + _Ior(duplicate(ior)), _VarComponents( Connexion(argc,argv,ptrSessionName) ), _SessionName(ptrSessionName),_Name(""), _Id(0) { - this->add( componentName ) ; + this->add( componentName ) ; } RegistryConnexion::RegistryConnexion( void ): _Ior(0), _VarComponents( 0 ), _Name(""), _Id(0) { - INTERRUPTION(EXIT_FAILURE) ; + INTERRUPTION(EXIT_FAILURE) ; } RegistryConnexion::~RegistryConnexion() { - BEGIN_OF("RegistryConnexion::~RegistryConnexion()" ) ; - if( _Id != 0 ) - { - ASSERT(_SessionName!="" ) ; - ASSERT(_Name!="" ) ; - _VarComponents->remove( _Id ) ; - } - _Id = 0 ; -#ifndef WIN32 - delete [] _Ior; -#else - delete [] (char*) _Ior; -#endif - _Ior = 0; - _SessionName = ""; - _Name = "" ; - END_OF("RegistryConnexion::~RegistryConnexion()" ) ; + BEGIN_OF("RegistryConnexion::~RegistryConnexion()" ) ; + if( _Id != 0 ) + { + ASSERT(_SessionName!="" ) ; + ASSERT(_Name!="" ) ; + _VarComponents->remove( _Id ) ; + } + _Id = 0 ; + delete [] (char*) _Ior; + _Ior = 0; + _SessionName = ""; + _Name = "" ; + END_OF("RegistryConnexion::~RegistryConnexion()" ) ; } void RegistryConnexion::add( const char *aName ) { - ASSERT(_SessionName!="" ) ; - ASSERT(_Name=="" ) ; - ASSERT(_Id==0 ) ; - ASSERT(aName) ; - SCRUTE(aName) ; - ASSERT(strlen( aName )>0) ; - - const Identity lesInfos( aName ) ; - Registry::Infos infos ; - infos.name = CORBA::string_dup( lesInfos.name() ) ; - infos.pid = lesInfos.pid() ; - infos.machine = CORBA::string_dup( lesInfos.host_char() ) ; - infos.adip = CORBA::string_dup( lesInfos.adip() ) ; - infos.uid = (long)lesInfos.uid() ; - infos.pwname = CORBA::string_dup( lesInfos.pwname() ) ; - infos.tc_start = lesInfos.start() ; - infos.tc_hello = 0 ; - infos.tc_end = 0 ; - infos.difftime = 0 ; - infos.cdir = CORBA::string_dup( lesInfos.rep() ) ; - infos.status = -1 ; - infos.ior = CORBA::string_dup(_Ior); - - ASSERT(!CORBA::is_nil(this->_VarComponents)) ; - - CORBA::ULong id = _VarComponents->add( infos ) ; - - SCRUTE(aName) ; SCRUTE(id) ; - ASSERT(id) ; - - _Id = id ; - _Name = aName ; - - return ; + ASSERT(_SessionName!="" ) ; + ASSERT(_Name=="" ) ; + ASSERT(_Id==0 ) ; + ASSERT(aName) ; + SCRUTE(aName) ; + ASSERT(strlen( aName )>0) ; + + const Identity lesInfos( aName ) ; + Registry::Infos infos ; + infos.name = CORBA::string_dup( lesInfos.name() ) ; + infos.pid = lesInfos.pid() ; + infos.machine = CORBA::string_dup( lesInfos.host_char() ) ; + infos.adip = CORBA::string_dup( lesInfos.adip() ) ; + infos.uid = (long)lesInfos.uid() ; + infos.pwname = CORBA::string_dup( lesInfos.pwname() ) ; + infos.tc_start = lesInfos.start() ; + infos.tc_hello = 0 ; + infos.tc_end = 0 ; + infos.difftime = 0 ; + infos.cdir = CORBA::string_dup( lesInfos.rep() ) ; + infos.status = -1 ; + infos.ior = CORBA::string_dup(_Ior); + + ASSERT(!CORBA::is_nil(this->_VarComponents)) ; + + CORBA::ULong id = _VarComponents->add( infos ) ; + + SCRUTE(aName) ; SCRUTE(id) ; + ASSERT(id) ; + + _Id = id ; + _Name = aName ; + + return ; } void RegistryConnexion::remove( void ) { - ASSERT(_Id>0) ; - ASSERT(!CORBA::is_nil(this->_VarComponents)) ; - _VarComponents->remove( _Id ) ; + ASSERT(_Id>0) ; + ASSERT(!CORBA::is_nil(this->_VarComponents)) ; + _VarComponents->remove( _Id ) ; - _Name = "" ; - _Id = 0 ; + _Name = "" ; + _Id = 0 ; - return ; + return ; } diff --git a/src/Registry/RegistryService.cxx b/src/Registry/RegistryService.cxx index d85e1e755..0dd569c61 100644 --- a/src/Registry/RegistryService.cxx +++ b/src/Registry/RegistryService.cxx @@ -42,223 +42,195 @@ extern "C" using namespace std; /* ------------------------------*/ -/* Constructeurs et Destructeurs */ +/* Constructors and Destructors */ /* ------------------------------*/ RegistryService::RegistryService( void ) : _SessionName(0), _Compteur(0) { - MESSAGE("Passage dans RegistryService::RegistryService()") ; - _orb = CORBA::ORB::_nil(); + MESSAGE("RegistryService::RegistryService()") ; + _orb = CORBA::ORB::_nil(); } - RegistryService::~RegistryService() { - BEGIN_OF("RegistryService::~RegistryService()") ; - map::iterator im; - for (im=_reg.begin();im!=_reg.end(); im++) - { -#if defined(_DEBUG_) || defined(_DEBUG) - const client_infos &lesInfos = *(*im).second ; - MESSAGE("Deletion") ; SCRUTE( lesInfos._name ) ; -#endif - _reg.erase ( im ) ; - } - ASSERT(_reg.size()==0) ; - for (im=_fin.begin();im!=_fin.end(); im++) - { -#if defined(_DEBUG_) || defined(_DEBUG) - const client_infos &lesInfos = *(*im).second ; - MESSAGE("Deletion") ; SCRUTE( lesInfos._name ) ; -#endif - _fin.erase ( im ) ; - } - ASSERT(_fin.size()==0) ; - _Compteur = -1 ; - if ( _SessionName ) - { -#ifndef WIN32 - delete [] _SessionName ; -#else - delete [] (char*)_SessionName ; -#endif - _SessionName = 0 ; - } - END_OF("RegistryService::~RegistryService()") ; + BEGIN_OF("RegistryService::~RegistryService()") ; + map::iterator im; + for (im=_reg.begin();im!=_reg.end(); im++) + { + MESSAGE("Delete _reg item " << im->second->_name) ; + delete im->second; + } + for (im=_fin.begin();im!=_fin.end(); im++) + { + MESSAGE("Delete _fin item " << im->second->_name) ; + delete im->second; + } + _Compteur = -1 ; + if ( _SessionName ) + { + delete [] (char*)_SessionName ; + _SessionName = 0 ; + } + END_OF("RegistryService::~RegistryService()") ; } /* ------------------------------*/ -/* Contrats IDL */ +/* IDL contracts */ /* ------------------------------*/ CORBA::ULong RegistryService::size ( void ) { - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - return _reg.size() ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + return _reg.size() ; } - CORBA::ULong RegistryService::add( const Registry::Infos & infos ) { - BEGIN_OF("RegistryService::add") ; - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - client_infos *ptr_Component = new client_infos( infos ) ; - ASSERT(ptr_Component) ; - SCRUTE(ptr_Component->_name) ; - - _Compteur++; - _reg[_Compteur]=ptr_Component; - - END_OF("RegistryService::add") ; - return (CORBA::ULong)_Compteur ; + BEGIN_OF("RegistryService::add") ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + client_infos *ptr_Component = new client_infos( infos ) ; + ASSERT(ptr_Component) ; + SCRUTE(ptr_Component->_name) ; + + _Compteur++; + _reg[_Compteur]=ptr_Component; + + END_OF("RegistryService::add") ; + return (CORBA::ULong)_Compteur ; } -#ifndef WIN32 -void RegistryService::remove( const CORBA::ULong id) -#else void RegistryService::remove( CORBA::ULong id) -#endif { - BEGIN_OF("RegistryService::remove") ; - SCRUTE(id) ; - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - - ASSERT(_reg.find(id)!=_reg.end()) - _reg[id]->_status=TERMINATED; - _reg[id]->_ts_end = time(NULL) ; - - _fin[id]=_reg[id]; - SCRUTE(_fin.size()) ; - - map::iterator pos = _reg.find ( id ) ; - _reg.erase ( pos ) ; - SCRUTE(_reg.size()) ; - SCRUTE(_fin.size()) ; - - END_OF("RegistryService::remove") ; - return ; + BEGIN_OF("RegistryService::remove") ; + SCRUTE(id) ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + + ASSERT(_reg.find(id)!=_reg.end()) + _reg[id]->_status=TERMINATED; + _reg[id]->_ts_end = time(NULL) ; + + _fin[id]=_reg[id]; + _reg.erase(id); + + SCRUTE(_reg.size()) ; + SCRUTE(_fin.size()) ; + + END_OF("RegistryService::remove") ; + return ; } -#ifndef WIN32 -void RegistryService::hello( const CORBA::ULong id ) -#else void RegistryService::hello( CORBA::ULong id ) -#endif { - BEGIN_OF("RegistryService::hello") ; - SCRUTE(id) ; - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - - ASSERT(_reg.find(id)!=_reg.end()) - _reg[id]->_ts_hello = time(NULL) ; - - END_OF("RegistryService::hello") ; - return ; -} + BEGIN_OF("RegistryService::hello") ; + SCRUTE(id) ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + ASSERT(_reg.find(id)!=_reg.end()) + _reg[id]->_ts_hello = time(NULL) ; + + END_OF("RegistryService::hello") ; + return ; +} void RegistryService::end( void ) { - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - BEGIN_OF( "RegistryService::end( void )" ) ; - exit( EXIT_SUCCESS ) ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + BEGIN_OF( "RegistryService::end( void )" ) ; + exit( EXIT_SUCCESS ) ; } - Registry::AllInfos* RegistryService::getall( void ) { - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - return RegistryService::makeseq(_reg) ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + return RegistryService::makeseq(_reg) ; } Registry::AllInfos* RegistryService::history( void ) { - ASSERT(_SessionName) ; - ASSERT(strlen(_SessionName)>0) ; - return RegistryService::makeseq(_fin) ; + ASSERT(_SessionName) ; + ASSERT(strlen(_SessionName)>0) ; + return RegistryService::makeseq(_fin) ; } Registry::AllInfos* RegistryService::makeseq(map &mymap ) { - int i=0 ; + int i=0 ; - Registry::AllInfos *all = new Registry::AllInfos ; - ASSERT(all) ; - const int RegLength = mymap.size(); - all->length(RegLength); + Registry::AllInfos *all = new Registry::AllInfos ; + ASSERT(all) ; + const int RegLength = mymap.size(); + all->length(RegLength); - map::iterator im; - for (im=mymap.begin();im!=mymap.end(); im++) + map::iterator im; + for (im=mymap.begin();im!=mymap.end(); im++) { - Registry::Infos &infos = (*all)[i] ; - const client_infos &lesInfos = *(*im).second ; - infos.name = CORBA::string_dup( lesInfos._name ) ; - infos.pid = lesInfos._pid ; - infos.pwname = lesInfos._pwname ; - infos.machine = CORBA::string_dup( lesInfos._machine ) ; - infos.adip = CORBA::string_dup( lesInfos._adip ) ; - infos.uid = lesInfos._uid ; - infos.tc_start = lesInfos._ts_start + lesInfos._difftime ; - infos.tc_hello = lesInfos._ts_hello + lesInfos._difftime ; - infos.tc_end = lesInfos._ts_end + lesInfos._difftime ; - infos.difftime = lesInfos._difftime ; - infos.cdir = CORBA::string_dup( lesInfos._cdir ) ; - infos.status = lesInfos._status ; - - i++; - } - - return all ; + Registry::Infos &infos = (*all)[i] ; + const client_infos &lesInfos = *(*im).second ; + infos.name = CORBA::string_dup( lesInfos._name ) ; + infos.pid = lesInfos._pid ; + infos.pwname = lesInfos._pwname ; + infos.machine = CORBA::string_dup( lesInfos._machine ) ; + infos.adip = CORBA::string_dup( lesInfos._adip ) ; + infos.uid = lesInfos._uid ; + infos.tc_start = lesInfos._ts_start + lesInfos._difftime ; + infos.tc_hello = lesInfos._ts_hello + lesInfos._difftime ; + infos.tc_end = lesInfos._ts_end + lesInfos._difftime ; + infos.difftime = lesInfos._difftime ; + infos.cdir = CORBA::string_dup( lesInfos._cdir ) ; + infos.status = lesInfos._status ; + + i++; + } + + return all ; } /* ------------------------------*/ -/* Autres */ +/* Others */ /* ------------------------------*/ RegistryService::client_infos::client_infos( const Registry::Infos &infos ):\ - _ior(duplicate(infos.ior)),\ - _name(duplicate(infos.name)),\ - _pid(infos.pid),\ - _machine(duplicate(infos.machine)),\ - _adip(duplicate(infos.adip)),\ - _uid(infos.uid),\ - _pwname(duplicate(infos.pwname)),\ - _ts_start(time(NULL)),\ - _difftime(infos.tc_start - _ts_start),\ - _cdir(duplicate(infos.cdir)),\ - _ts_hello(_ts_start),\ - _ts_end(0),\ - _status(RUNNING) + _ior(duplicate(infos.ior)),\ + _name(duplicate(infos.name)),\ + _pid(infos.pid),\ + _machine(duplicate(infos.machine)),\ + _adip(duplicate(infos.adip)),\ + _uid(infos.uid),\ + _pwname(duplicate(infos.pwname)),\ + _ts_start(time(NULL)),\ + _difftime(infos.tc_start - _ts_start),\ + _cdir(duplicate(infos.cdir)),\ + _ts_hello(_ts_start),\ + _ts_end(0),\ + _status(RUNNING) { - // SCRUTE(_ior) ; - ; } RegistryService::client_infos::~client_infos() { - delete [] (char*)_ior ; (char*&)_ior = NULL ; - delete [] (char*)_name ; (char*&)_name = NULL ; - delete [] (char*)_machine ; (char*&)_machine = NULL ; - delete [] (char*)_pwname ; (char*&)_pwname = NULL ; - delete [] (char*)_adip ; (char*&)_adip = NULL ; - delete [] (char*)_cdir ; (char*&)_cdir = NULL ; + delete [] (char*)_ior ; (char*&)_ior = NULL ; + delete [] (char*)_name ; (char*&)_name = NULL ; + delete [] (char*)_machine ; (char*&)_machine = NULL ; + delete [] (char*)_pwname ; (char*&)_pwname = NULL ; + delete [] (char*)_adip ; (char*&)_adip = NULL ; + delete [] (char*)_cdir ; (char*&)_cdir = NULL ; } void RegistryService::SessionName( const char *sessionName ) { - ASSERT(sessionName) ; - ASSERT(strlen(sessionName)>0) ; - _SessionName = duplicate(sessionName) ; - return ; + ASSERT(sessionName) ; + ASSERT(strlen(sessionName)>0) ; + _SessionName = duplicate(sessionName) ; + return ; } void RegistryService::ping() { diff --git a/src/ResourcesManager/Makefile.am b/src/ResourcesManager/Makefile.am index 469acb657..90dd1def8 100755 --- a/src/ResourcesManager/Makefile.am +++ b/src/ResourcesManager/Makefile.am @@ -54,7 +54,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../NamingService \ -I$(srcdir)/../Utils \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @LIBXML_INCLUDES@ \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @@ -101,4 +100,5 @@ libResourcesManager_la_CPPFLAGS =\ libResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0 libResourcesManager_la_LIBADD =\ + ../Basics/libSALOMEBasics.la \ @LIBXML_LIBS@ diff --git a/src/SALOMEDS/Makefile.am b/src/SALOMEDS/Makefile.am index 73c36db8d..8ee8a7fa0 100644 --- a/src/SALOMEDS/Makefile.am +++ b/src/SALOMEDS/Makefile.am @@ -69,7 +69,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../GenericObj \ -I$(srcdir)/../SALOMEDSClient \ -I$(srcdir)/../LifeCycleCORBA \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx index 121d87587..f82fbf353 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR.cxx @@ -46,7 +46,7 @@ std::string SALOMEDS_AttributeIOR::Value() SALOMEDS::Locker lock; aValue = dynamic_cast(_local_impl)->Value(); } - else aValue = SALOMEDS::AttributeIOR::_narrow(_corba_impl)->Value(); + else aValue = (CORBA::String_var)((SALOMEDS::AttributeIOR_var)SALOMEDS::AttributeIOR::_narrow(_corba_impl))->Value(); return aValue; } @@ -57,5 +57,5 @@ void SALOMEDS_AttributeIOR::SetValue(const std::string& value) SALOMEDS::Locker lock; dynamic_cast(_local_impl)->SetValue(value); } - else SALOMEDS::AttributeIOR::_narrow(_corba_impl)->SetValue(value.c_str()); + else ((SALOMEDS::AttributeIOR_var)SALOMEDS::AttributeIOR::_narrow(_corba_impl))->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx index 1ca91189e..7d46207e3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.cxx @@ -36,6 +36,7 @@ char* SALOMEDS_AttributeIOR_i::Value() return c_s._retn(); } + void SALOMEDS_AttributeIOR_i::SetValue(const char* value) { SALOMEDS::Locker lock; @@ -44,3 +45,6 @@ void SALOMEDS_AttributeIOR_i::SetValue(const char* value) string anExtStr((char *)Str.in()); dynamic_cast(_impl)->SetValue(anExtStr); } + +SALOMEDS_AttributeIOR_i::~SALOMEDS_AttributeIOR_i() +{} diff --git a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx index c5f05dcb7..a1c415c3d 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeIOR_i.hxx @@ -39,7 +39,7 @@ public: SALOMEDS_AttributeIOR_i(SALOMEDSImpl_AttributeIOR* theAttr, CORBA::ORB_ptr orb) :SALOMEDS_GenericAttribute_i(theAttr, orb) {}; - ~SALOMEDS_AttributeIOR_i() {}; + ~SALOMEDS_AttributeIOR_i(); char* Value(); void SetValue(const char* value); diff --git a/src/SALOMEDS/SALOMEDS_AttributeName.cxx b/src/SALOMEDS/SALOMEDS_AttributeName.cxx index 86a384ddd..4fac58cbb 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeName.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeName.cxx @@ -46,7 +46,7 @@ std::string SALOMEDS_AttributeName::Value() SALOMEDS::Locker lock; aValue = dynamic_cast(_local_impl)->Value(); } - else aValue = SALOMEDS::AttributeName::_narrow(_corba_impl)->Value(); + else aValue = (CORBA::String_var)((SALOMEDS::AttributeName_var)SALOMEDS::AttributeName::_narrow(_corba_impl))->Value(); return aValue; } @@ -57,5 +57,5 @@ void SALOMEDS_AttributeName::SetValue(const std::string& value) SALOMEDS::Locker lock; dynamic_cast(_local_impl)->SetValue(value); } - else SALOMEDS::AttributeName::_narrow(_corba_impl)->SetValue(value.c_str()); + else ((SALOMEDS::AttributeName_var)SALOMEDS::AttributeName::_narrow(_corba_impl))->SetValue(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx b/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx index c7cd068cc..d18ed86b3 100644 --- a/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributePixMap.cxx @@ -46,7 +46,7 @@ bool SALOMEDS_AttributePixMap::HasPixMap() SALOMEDS::Locker lock; ret = dynamic_cast(_local_impl)->HasPixMap(); } - else ret = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->HasPixMap(); + else ret = ((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->HasPixMap(); return ret; } @@ -57,7 +57,7 @@ std::string SALOMEDS_AttributePixMap::GetPixMap() SALOMEDS::Locker lock; aValue = dynamic_cast(_local_impl)->GetPixMap(); } - else aValue = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->GetPixMap(); + else aValue = (CORBA::String_var)((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->GetPixMap(); return aValue; } @@ -68,5 +68,5 @@ void SALOMEDS_AttributePixMap::SetPixMap(const std::string& value) SALOMEDS::Locker lock; dynamic_cast(_local_impl)->SetPixMap(value); } - else SALOMEDS::AttributePixMap::_narrow(_corba_impl)->SetPixMap(value.c_str()); + else ((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->SetPixMap(value.c_str()); } diff --git a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx index d8eacff0a..111ea32c7 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeStudyProperties.cxx @@ -51,7 +51,7 @@ void SALOMEDS_AttributeStudyProperties::SetUserName(const std::string& theName) dynamic_cast(_local_impl); anImpl->ChangeCreatorName(theName); } else - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str()); + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetUserName(theName.c_str()); } std::string SALOMEDS_AttributeStudyProperties::GetUserName() @@ -62,9 +62,9 @@ std::string SALOMEDS_AttributeStudyProperties::GetUserName() aName = dynamic_cast(_local_impl)->GetCreatorName(); } #ifndef WIN32 - else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName(); + else aName = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUserName(); #else - else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserNameA(); + else aName = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUserNameA(); #endif return aName; } @@ -82,7 +82,7 @@ void SALOMEDS_AttributeStudyProperties::SetCreationDate string S; anImpl->SetModification(S, theMinute, theHour, theDay, theMonth, theYear); } else { - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute, + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetCreationDate(theMinute, theHour, theDay, theMonth, @@ -103,7 +103,7 @@ bool SALOMEDS_AttributeStudyProperties::GetCreationDate(int& theMinute, (_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear); } else { CORBA::Long aMinute, anHour, aDay, aMonth, anYear; - ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationDate(aMinute, + ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetCreationDate(aMinute, anHour, aDay, aMonth, @@ -129,7 +129,7 @@ void SALOMEDS_AttributeStudyProperties::SetCreationMode(const std::string& theMo else //Not defined dynamic_cast(_local_impl)->SetCreationMode(0); } - else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(theMode.c_str()); + else ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetCreationMode(theMode.c_str()); } std::string SALOMEDS_AttributeStudyProperties::GetCreationMode() @@ -142,7 +142,7 @@ std::string SALOMEDS_AttributeStudyProperties::GetCreationMode() if (mode == 2) aMode = "copy from"; } else - aMode = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationMode(); + aMode = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetCreationMode(); return aMode; } @@ -153,7 +153,7 @@ void SALOMEDS_AttributeStudyProperties::SetModified(int theModified) dynamic_cast(_local_impl)->SetModified(theModified); } else - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified); + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetModified(theModified); } bool SALOMEDS_AttributeStudyProperties::IsModified() @@ -164,7 +164,7 @@ bool SALOMEDS_AttributeStudyProperties::IsModified() ret = dynamic_cast(_local_impl)->IsModified(); } else - ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified(); + ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->IsModified(); return ret; } @@ -176,7 +176,7 @@ int SALOMEDS_AttributeStudyProperties::GetModified() isModified = dynamic_cast(_local_impl)->GetModified(); } else - isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified(); + isModified = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetModified(); return isModified; } @@ -187,7 +187,7 @@ void SALOMEDS_AttributeStudyProperties::SetLocked(bool theLocked) dynamic_cast(_local_impl)->SetLocked(theLocked); } else - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked); + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetLocked(theLocked); } bool SALOMEDS_AttributeStudyProperties::IsLocked() @@ -198,7 +198,7 @@ bool SALOMEDS_AttributeStudyProperties::IsLocked() ret = dynamic_cast(_local_impl)->IsLocked(); } else - ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked(); + ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->IsLocked(); return ret; } @@ -215,7 +215,7 @@ void SALOMEDS_AttributeStudyProperties::SetModification(const std::string& theNa SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast(_local_impl); anImpl->SetModification(theName, theMinute, theHour, theDay, theMonth, theYear); } else - SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(theName.c_str(), + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetModification(theName.c_str(), theMinute, theHour, theDay, @@ -252,7 +252,7 @@ void SALOMEDS_AttributeStudyProperties::GetModificationsList(std::vectorGetModificationsList(aNames.out(), + ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetModificationsList(aNames.out(), aMinutes.out(), aHours.out(), aDays.out(), diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx index 5cbf2edc0..1f11e67d6 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator.cxx @@ -95,6 +95,9 @@ _PTR(SObject) SALOMEDS_ChildIterator::Value() SALOMEDS::Locker lock; aSO = new SALOMEDS_SObject(_local_impl->Value()); } - else aSO = new SALOMEDS_SObject(_corba_impl->Value()); + else { + SALOMEDS::SObject_var so=_corba_impl->Value(); + aSO = new SALOMEDS_SObject(so); + } return _PTR(SObject)(aSO); } diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx index 057312b44..09ac451e5 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx @@ -43,7 +43,7 @@ class SALOMEDS_ChildIterator_i: public virtual POA_SALOMEDS::ChildIterator, public virtual SALOME::GenericObj_i { private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_ChildIterator* _it; public: diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.cxx b/src/SALOMEDS/SALOMEDS_Driver_i.cxx index 1efad2868..4d851194c 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.cxx @@ -160,6 +160,7 @@ bool SALOMEDS_Driver_i::CanCopy(const SALOMEDSImpl_SObject& theObject) SALOMEDS::unlock(); bool isOk = _driver->CanCopy(so.in()); + so->Destroy(); SALOMEDS::lock(); return isOk; diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx index 827ea4714..a5a64b49b 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute.cxx @@ -99,7 +99,7 @@ std::string SALOMEDS_GenericAttribute::Type() aType = _local_impl->Type(); } else { - aType = _corba_impl->Type(); + aType = (CORBA::String_var)_corba_impl->Type(); } return aType; } @@ -112,7 +112,7 @@ std::string SALOMEDS_GenericAttribute::GetClassType() aType = _local_impl->GetClassType(); } else { - aType = _corba_impl->GetClassType(); + aType = (CORBA::String_var)_corba_impl->GetClassType(); } return aType; } @@ -125,7 +125,7 @@ _PTR(SObject) SALOMEDS_GenericAttribute::GetSObject() aSO = new SALOMEDS_SObject(_local_impl->GetSObject()); } else { - aSO = new SALOMEDS_SObject(_corba_impl->GetSObject()); + aSO = new SALOMEDS_SObject((SALOMEDS::SObject_var)_corba_impl->GetSObject()); } return _PTR(SObject)(aSO); @@ -148,7 +148,8 @@ SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDS:: { SALOMEDS_GenericAttribute* aGA = NULL; if(!CORBA::is_nil(theGA)) { - std::string aTypeOfAttribute = theGA->GetClassType(); + CORBA::String_var astr=theGA->GetClassType(); + std::string aTypeOfAttribute = astr.in(); __CreateGenericClientAttributeCORBA } return aGA; diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx index c68177b5c..29767e091 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx @@ -50,6 +50,10 @@ SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, _impl = theImpl; } +SALOMEDS_GenericAttribute_i::~SALOMEDS_GenericAttribute_i() +{ +} + void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection) { SALOMEDS::Locker lock; @@ -83,7 +87,7 @@ char* SALOMEDS_GenericAttribute_i::Type() return CORBA::string_dup(type.c_str()); } - return (char*)""; + return CORBA::string_dup(""); } char* SALOMEDS_GenericAttribute_i::GetClassType() @@ -94,7 +98,7 @@ char* SALOMEDS_GenericAttribute_i::GetClassType() return CORBA::string_dup(class_type.c_str()); } - return (char*)""; + return CORBA::string_dup(""); } diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx index 8b2893947..69fc111fb 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx @@ -41,11 +41,11 @@ class Standard_EXPORT SALOMEDS_GenericAttribute_i: public virtual POA_SALOMEDS:: protected: DF_Attribute* _impl; - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; public: SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb); - virtual ~SALOMEDS_GenericAttribute_i() {}; + virtual ~SALOMEDS_GenericAttribute_i(); void CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection); diff --git a/src/SALOMEDS/SALOMEDS_SComponent.cxx b/src/SALOMEDS/SALOMEDS_SComponent.cxx index fe7d379fc..30edcb280 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponent.cxx @@ -50,7 +50,12 @@ std::string SALOMEDS_SComponent::ComponentDataType() SALOMEDS::Locker lock; aType = (dynamic_cast(GetLocalImpl()))->ComponentDataType(); } - else aType = (SALOMEDS::SComponent::_narrow(GetCORBAImpl()))->ComponentDataType(); + else + { + SALOMEDS::SComponent_var aCompo=SALOMEDS::SComponent::_narrow(GetCORBAImpl()); + CORBA::String_var aString = aCompo->ComponentDataType(); + aType=aString.in(); + } return aType; } @@ -74,13 +79,13 @@ bool SALOMEDS_SComponent::ComponentIOR(std::string& theID) SALOMEDS::SComponent_ptr SALOMEDS_SComponent::GetSComponent() { if(_isLocal) { - if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl())); + if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_narrow(GetCORBAImpl()); SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(*(dynamic_cast(GetLocalImpl())), _orb); _corba_impl = SALOMEDS::SComponent::_duplicate(aSCO); return aSCO._retn(); } else { - return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl())); + return SALOMEDS::SComponent::_narrow(GetCORBAImpl()); } return SALOMEDS::SComponent::_nil(); } diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx index 9ee6a8e7d..5aea876c1 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator.cxx @@ -84,6 +84,6 @@ _PTR(SComponent) SALOMEDS_SComponentIterator::Value() SALOMEDS::Locker lock; aSCO = new SALOMEDS_SComponent(_local_impl->Value()); } - else aSCO = new SALOMEDS_SComponent(_corba_impl->Value()); + else aSCO = new SALOMEDS_SComponent((SALOMEDS::SComponent_var)_corba_impl->Value()); return _PTR(SComponent)(aSCO); } diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx index ff2e8f16d..1b9e1680c 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx @@ -45,7 +45,7 @@ class SALOMEDS_SComponentIterator_i:public virtual POA_SALOMEDS::SComponentItera private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_SComponentIterator* _impl; public: diff --git a/src/SALOMEDS/SALOMEDS_SComponent_i.cxx b/src/SALOMEDS/SALOMEDS_SComponent_i.cxx index cbe8ed337..48d71ed7d 100644 --- a/src/SALOMEDS/SALOMEDS_SComponent_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponent_i.cxx @@ -33,9 +33,8 @@ using namespace std; SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const SALOMEDSImpl_SComponent& theImpl, CORBA::ORB_ptr theORB) { SALOMEDS_SComponent_i* sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB); - SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this()); - return sco._retn(); + return sco_servant->_this(); } //============================================================================ diff --git a/src/SALOMEDS/SALOMEDS_SObject.cxx b/src/SALOMEDS/SALOMEDS_SObject.cxx index 1c6c05b4a..28df2a5c6 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject.cxx @@ -112,7 +112,7 @@ std::string SALOMEDS_SObject::GetID() SALOMEDS::Locker lock; aValue = _local_impl->GetID(); } - else aValue = _corba_impl->GetID(); + else aValue = (CORBA::String_var)_corba_impl->GetID(); return aValue; } @@ -122,7 +122,7 @@ _PTR(SComponent) SALOMEDS_SObject::GetFatherComponent() SALOMEDS::Locker lock; return _PTR(SComponent)(new SALOMEDS_SComponent(_local_impl->GetFatherComponent())); } - return _PTR(SComponent)(new SALOMEDS_SComponent(_corba_impl->GetFatherComponent())); + return _PTR(SComponent)(new SALOMEDS_SComponent((SALOMEDS::SComponent_var)_corba_impl->GetFatherComponent())); } _PTR(SObject) SALOMEDS_SObject::GetFather() @@ -131,7 +131,7 @@ _PTR(SObject) SALOMEDS_SObject::GetFather() SALOMEDS::Locker lock; return _PTR(SObject)(new SALOMEDS_SObject(_local_impl->GetFather())); } - return _PTR(SObject)(new SALOMEDS_SObject(_corba_impl->GetFather())); + return _PTR(SObject)(new SALOMEDS_SObject((SALOMEDS::SObject_var)_corba_impl->GetFather())); } bool SALOMEDS_SObject::FindAttribute(_PTR(GenericAttribute)& anAttribute, @@ -199,7 +199,8 @@ _PTR(Study) SALOMEDS_SObject::GetStudy() SALOMEDS::Locker lock; return _PTR(Study)(new SALOMEDS_Study(_local_impl->GetStudy())); } - return _PTR(Study)(new SALOMEDS_Study(_corba_impl->GetStudy())); + SALOMEDS::Study_var study=_corba_impl->GetStudy(); + return _PTR(Study)(new SALOMEDS_Study(study)); } std::string SALOMEDS_SObject::Name() @@ -209,7 +210,7 @@ std::string SALOMEDS_SObject::Name() SALOMEDS::Locker lock; aName = _local_impl->Name(); } - else aName = _corba_impl->Name(); + else aName = (CORBA::String_var)_corba_impl->Name(); return aName; } @@ -257,7 +258,7 @@ std::string SALOMEDS_SObject::GetName() SALOMEDS::Locker lock; aName = _local_impl->GetName(); } - else aName = _corba_impl->GetName(); + else aName = (CORBA::String_var) _corba_impl->GetName(); return aName; } @@ -269,7 +270,7 @@ std::string SALOMEDS_SObject::GetComment() SALOMEDS::Locker lock; aComment = _local_impl->GetComment(); } - else aComment = _corba_impl->GetComment(); + else aComment = (CORBA::String_var) _corba_impl->GetComment(); return aComment; } @@ -281,7 +282,7 @@ std::string SALOMEDS_SObject::GetIOR() SALOMEDS::Locker lock; anIOR = _local_impl->GetIOR(); } - else anIOR = _corba_impl->GetIOR(); + else anIOR = (CORBA::String_var) _corba_impl->GetIOR(); return anIOR; } diff --git a/src/SALOMEDS/SALOMEDS_SObject.hxx b/src/SALOMEDS/SALOMEDS_SObject.hxx index b20ceaf78..f4aec2742 100644 --- a/src/SALOMEDS/SALOMEDS_SObject.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject.hxx @@ -71,7 +71,7 @@ public: CORBA::Object_ptr GetObject(); SALOMEDS::SObject_ptr GetSObject(); - SALOMEDS::SObject_ptr GetCORBAImpl() { return SALOMEDS::SObject::_duplicate(_corba_impl); } + SALOMEDS::SObject_var GetCORBAImpl() { return _corba_impl; } SALOMEDSImpl_SObject* GetLocalImpl() { return _local_impl; } private: diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index 985423a52..6398b8a6e 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -49,9 +49,8 @@ using namespace std; SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const SALOMEDSImpl_SObject& theImpl, CORBA::ORB_ptr theORB) { SALOMEDS_SObject_i* so_servant = new SALOMEDS_SObject_i(theImpl, theORB); - SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this()); - return so._retn(); + return so_servant->_this(); } @@ -154,7 +153,7 @@ CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out SALOMEDS::Locker lock; DF_Attribute* anAttr = NULL; if(_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute)) { - anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb); return true; } @@ -180,7 +179,7 @@ SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes() for(int i = 0; i < length; i++) { SALOMEDSImpl_GenericAttribute* anAttr = dynamic_cast(aSeq[i]); SALOMEDS::GenericAttribute_var anAttribute; - anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb); if (!CORBA::is_nil(anAttribute)) { SeqOfAttr[i] = anAttribute; } diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.hxx b/src/SALOMEDS/SALOMEDS_SObject_i.hxx index abf5fd3b3..7190778f3 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.hxx @@ -42,7 +42,7 @@ class Standard_EXPORT SALOMEDS_SObject_i: public virtual POA_SALOMEDS::SObject, public virtual SALOME::GenericObj_i { protected: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_SObject* _impl; public: diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index e97694d1b..bbd079251 100644 --- a/src/SALOMEDS/SALOMEDS_Study.cxx +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -104,7 +104,7 @@ std::string SALOMEDS_Study::GetPersistentReference() SALOMEDS::Locker lock; aRef = _local_impl->GetPersistentReference(); } - else aRef = _corba_impl->GetPersistentReference(); + else aRef = (CORBA::String_var)_corba_impl->GetPersistentReference(); return aRef; } @@ -567,7 +567,7 @@ _PTR(AttributeStudyProperties) SALOMEDS_Study::GetProperties() SALOMEDS::Locker lock; aProp = new SALOMEDS_AttributeStudyProperties(_local_impl->GetProperties()); } - else aProp = new SALOMEDS_AttributeStudyProperties(_corba_impl->GetProperties()); + else aProp = new SALOMEDS_AttributeStudyProperties((SALOMEDS::AttributeStudyProperties_var)_corba_impl->GetProperties()); return _PTR(AttributeStudyProperties)(aProp); } diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx index 4f6cb0596..7ffd82dd7 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx @@ -96,7 +96,8 @@ void SALOMEDS_StudyBuilder_i::DefineComponentInstance(SALOMEDS::SComponent_ptr a { SALOMEDS::Locker lock; CheckLocked(); - SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID()); + CORBA::String_var anID=aComponent->GetID(); + SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anID.in()); CORBA::String_var iorstr = _orb->object_to_string(IOR); _impl->DefineComponentInstance(aSCO, (char*)iorstr.in()); @@ -112,7 +113,8 @@ void SALOMEDS_StudyBuilder_i::RemoveComponent(SALOMEDS::SComponent_ptr aComponen SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(aComponent)); - SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID()); + CORBA::String_var cid=aComponent->GetID(); + SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(cid.in()); _impl->RemoveComponent(aSCO); } @@ -127,7 +129,8 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyBuilder_i::NewObject(SALOMEDS::SObject_ptr t CheckLocked(); SALOMEDSImpl_SObject aFO, aSO; - aFO = _impl->GetOwner()->GetSObject(theFatherObject->GetID()); + CORBA::String_var anID=theFatherObject->GetID(); + aFO = _impl->GetOwner()->GetSObject(anID.in()); aSO = _impl->NewObject(aFO); if(aSO.IsNull()) return SALOMEDS::SObject::_nil(); SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO,_orb); @@ -162,7 +165,8 @@ void SALOMEDS_StudyBuilder_i::RemoveObject(SALOMEDS::SObject_ptr anObject) { SALOMEDS::Locker lock; CheckLocked(); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + CORBA::String_var anID=anObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->RemoveObject(aSO); } @@ -175,7 +179,8 @@ void SALOMEDS_StudyBuilder_i::RemoveObjectWithChildren(SALOMEDS::SObject_ptr anO { SALOMEDS::Locker lock; CheckLocked(); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + CORBA::String_var anID=anObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->RemoveObjectWithChildren(aSO); } @@ -190,7 +195,8 @@ void SALOMEDS_StudyBuilder_i::LoadWith(SALOMEDS::SComponent_ptr anSCO, SALOMEDS::Locker lock; Unexpect aCatch(SBSalomeException); - SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anSCO->GetID()); + CORBA::String_var anID=anSCO->GetID(); + SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anID.in()); SALOMEDS_Driver_i* driver = new SALOMEDS_Driver_i(aDriver, _orb); bool isDone = _impl->LoadWith(aSCO, driver); delete driver; @@ -234,7 +240,7 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA SALOMEDS::GenericAttribute_var anAttribute; if(anAttr) - anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb); return anAttribute._retn(); } @@ -251,12 +257,13 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::FindAttribute(SALOMEDS::SObject_ptr anOb { SALOMEDS::Locker lock; ASSERT(!CORBA::is_nil(anObject)); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + CORBA::String_var anID = anObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); DF_Attribute* anAttr; if(!_impl->FindAttribute(aSO, anAttr, string(aTypeOfAttribute))) return false; - anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb)); + anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb); return true; } @@ -272,7 +279,8 @@ void SALOMEDS_StudyBuilder_i::RemoveAttribute(SALOMEDS::SObject_ptr anObject, SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(anObject)); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + CORBA::String_var anID = anObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->RemoveAttribute(aSO, string(aTypeOfAttribute)); } @@ -290,8 +298,10 @@ void SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me, ASSERT(!CORBA::is_nil(theReferencedObject)); SALOMEDSImpl_SObject aSO, aRefSO; - aSO = _impl->GetOwner()->GetSObject(me->GetID()); - aRefSO = _impl->GetOwner()->GetSObject(theReferencedObject->GetID()); + CORBA::String_var anID = me->GetID(); + aSO = _impl->GetOwner()->GetSObject(anID.in()); + anID=theReferencedObject->GetID(); + aRefSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->Addreference(aSO, aRefSO); } @@ -305,7 +315,8 @@ void SALOMEDS_StudyBuilder_i::RemoveReference(SALOMEDS::SObject_ptr me) SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(me)); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(me->GetID()); + CORBA::String_var anID = me->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->RemoveReference(aSO); } @@ -339,7 +350,8 @@ void SALOMEDS_StudyBuilder_i::SetGUID(SALOMEDS::SObject_ptr anObject, const char SALOMEDS::Locker lock; CheckLocked(); ASSERT(!CORBA::is_nil(anObject)); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + CORBA::String_var anID=anObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->SetGUID(aSO, string(theGUID)); } @@ -352,7 +364,8 @@ bool SALOMEDS_StudyBuilder_i::IsGUID(SALOMEDS::SObject_ptr anObject, const char* { SALOMEDS::Locker lock; ASSERT(!CORBA::is_nil(anObject)); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID()); + CORBA::String_var anID=anObject->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); return _impl->IsGUID(aSO, string(theGUID)); } @@ -518,7 +531,8 @@ void SALOMEDS_StudyBuilder_i::SetName(SALOMEDS::SObject_ptr theSO, const char* t Unexpect aCatch(SBLockProtection); CheckLocked(); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID()); + CORBA::String_var anID=theSO->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->SetName(aSO, string(theValue)); } @@ -534,7 +548,8 @@ void SALOMEDS_StudyBuilder_i::SetComment(SALOMEDS::SObject_ptr theSO, const char Unexpect aCatch(SBLockProtection); CheckLocked(); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID()); + CORBA::String_var anID=theSO->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->SetComment(aSO, string(theValue)); } @@ -550,6 +565,7 @@ void SALOMEDS_StudyBuilder_i::SetIOR(SALOMEDS::SObject_ptr theSO, const char* th Unexpect aCatch(SBLockProtection); CheckLocked(); - SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID()); + CORBA::String_var anID=theSO->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in()); _impl->SetIOR(aSO, string(theValue)); } diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx index 99d0a3af4..caa92dea9 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx @@ -39,7 +39,7 @@ class SALOMEDS_StudyBuilder_i: public POA_SALOMEDS::StudyBuilder { private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_StudyBuilder* _impl; public: diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index c579fa47f..7a09d7a49 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -122,8 +122,9 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name) MESSAGE("NewStudy : Creating the CORBA servant holding it... "); - SALOMEDS_Study_i *Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); - SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); + SALOMEDS_Study_i *Study_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb); + PortableServer::ObjectId_var servantid = _poa->activate_object(Study_servant); // to use poa registered in _mapOfPOA + SALOMEDS::Study_var Study = Study_servant->_this(); // Register study in the naming service // Path to acces the study @@ -139,7 +140,7 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::NewStudy(const char* study_name) _mapOfPOA[Study->StudyId()] = _poa; - return Study; + return Study._retn(); } //============================================================================ @@ -163,19 +164,22 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::Open(const char* aUrl) MESSAGE("Open : Creating the CORBA servant holding it... "); // Temporary aStudyUrl in place of study name - SALOMEDS_Study_i * Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); - SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this()); + SALOMEDS_Study_i * Study_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb); + PortableServer::ObjectId_var servantid = _poa->activate_object(Study_servant); // to use poa register in _mapOfPOA + SALOMEDS::Study_var Study = Study_servant->_this(); // Assign the value of the IOR in the study->root CORBA::String_var IORStudy = _orb->object_to_string(Study); aStudyImpl->SetTransientReference((char*)IORStudy.in()); + _mapOfPOA[Study->StudyId()] = _poa; + // Register study in the naming service // Path to acces the study if(!_name_service->Change_Directory("/Study")) MESSAGE( "Unable to access the study directory" ) else _name_service->Register(Study, CORBA::string_dup(aStudyImpl->Name().c_str())); - return Study; + return Study._retn(); } @@ -202,6 +206,14 @@ void SALOMEDS_StudyManager_i::Close(SALOMEDS::Study_ptr aStudy) SALOMEDS::unlock(); aStudy->Close(); SALOMEDS::lock(); + + //remove study servant + PortableServer::POA_ptr poa=GetPOA(aStudy); + PortableServer::ServantBase* aservant=poa->reference_to_servant(aStudy); + PortableServer::ObjectId_var anObjectId = poa->servant_to_id(aservant); + poa->deactivate_object(anObjectId.in()); + aservant->_remove_ref(); // decrement for the call to reference_to_servant + aservant->_remove_ref(); // to delete the object } //============================================================================ @@ -313,10 +325,8 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByName(const char* aStudyNa return SALOMEDS::Study::_nil(); } - SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); - SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(aStudy_servant->_this()); - - return aStudy._retn(); + SALOMEDS_Study_i* aStudy_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb); + return aStudy_servant->_this(); } //============================================================================ @@ -336,11 +346,8 @@ SALOMEDS::Study_ptr SALOMEDS_StudyManager_i::GetStudyByID(CORBA::Short aStudyID) return SALOMEDS::Study::_nil(); } - SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb); - CORBA::Object_var obj = aStudy_servant->_this(); - SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(obj); - - return aStudy._retn(); + SALOMEDS_Study_i* aStudy_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb); + return aStudy_servant->_this(); } @@ -355,7 +362,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::CanCopy(SALOMEDS::SObject_ptr theObject) SALOMEDS::Study_var aStudy = theObject->GetStudy(); SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); + CORBA::String_var anID = theObject->GetID(); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in()); SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); bool ret = _impl->CanCopy(anObject, aDriver); @@ -374,7 +382,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::Copy(SALOMEDS::SObject_ptr theObject) SALOMEDS::Study_var aStudy = theObject->GetStudy(); SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); + CORBA::String_var anID = theObject->GetID(); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in()); SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); bool ret = _impl->Copy(anObject, aDriver); @@ -393,7 +402,8 @@ CORBA::Boolean SALOMEDS_StudyManager_i::CanPaste(SALOMEDS::SObject_ptr theObject SALOMEDS::Study_var aStudy = theObject->GetStudy(); SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); + CORBA::String_var anID = theObject->GetID(); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in()); SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb); bool ret = _impl->CanPaste(anObject, aDriver); @@ -415,7 +425,8 @@ SALOMEDS::SObject_ptr SALOMEDS_StudyManager_i::Paste(SALOMEDS::SObject_ptr theOb SALOMEDS::Study_var aStudy = theObject->GetStudy(); SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId()); - SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID()); + CORBA::String_var anID = theObject->GetID(); + SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in()); SALOMEDSImpl_SObject aNewSO; try { diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index 3ec35db2b..6b90ace27 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -25,6 +25,7 @@ // #include "utilities.h" #include "SALOMEDS_Study_i.hxx" +#include "SALOMEDS_StudyManager_i.hxx" #include "SALOMEDS_UseCaseIterator_i.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" #include "SALOMEDS_AttributeStudyProperties_i.hxx" @@ -55,6 +56,8 @@ using namespace std; +std::map SALOMEDS_Study_i::_mapOfStudies; + //============================================================================ /*! Function : SALOMEDS_Study_i * Purpose : SALOMEDS_Study_i constructor @@ -76,6 +79,15 @@ SALOMEDS_Study_i::SALOMEDS_Study_i(SALOMEDSImpl_Study* theImpl, //============================================================================ SALOMEDS_Study_i::~SALOMEDS_Study_i() { + //delete the builder servant + PortableServer::POA_var poa=_builder->_default_POA(); + PortableServer::ObjectId_var anObjectId = poa->servant_to_id(_builder); + poa->deactivate_object(anObjectId.in()); + _builder->_remove_ref(); + + //delete implementation + delete _impl; + _mapOfStudies.erase(_impl); } //============================================================================ @@ -421,14 +433,14 @@ SALOMEDS::ChildIterator_ptr SALOMEDS_Study_i::NewChildIterator(SALOMEDS::SObject { SALOMEDS::Locker lock; - SALOMEDSImpl_SObject aSO = _impl->GetSObject(theSO->GetID()); + CORBA::String_var anID=theSO->GetID(); + SALOMEDSImpl_SObject aSO = _impl->GetSObject(anID.in()); SALOMEDSImpl_ChildIterator anItr(aSO); //Create iterator SALOMEDS_ChildIterator_i* it_servant = new SALOMEDS_ChildIterator_i(anItr, _orb); - SALOMEDS::ChildIterator_var it = SALOMEDS::ChildIterator::_narrow(it_servant->_this()); - return it; + return it_servant->_this(); } @@ -582,6 +594,18 @@ SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const DF_Label& theLabel, CORBA:: return SALOMEDS::Study::_nil(); } +SALOMEDS_Study_i* SALOMEDS_Study_i::GetStudyServant(SALOMEDSImpl_Study* aStudyImpl, CORBA::ORB_ptr orb) +{ + if (_mapOfStudies.find(aStudyImpl) != _mapOfStudies.end()) + return _mapOfStudies[aStudyImpl]; + else + { + SALOMEDS_Study_i *Study_servant = new SALOMEDS_Study_i(aStudyImpl, orb); + _mapOfStudies[aStudyImpl]=Study_servant; + return Study_servant; + } +} + void SALOMEDS_Study_i::IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute) { SALOMEDS::Locker lock; @@ -661,12 +685,13 @@ void SALOMEDS_Study_i::Close() SALOMEDS::SComponentIterator_var itcomponent = NewComponentIterator(); for (; itcomponent->More(); itcomponent->Next()) { SALOMEDS::SComponent_var sco = itcomponent->Value(); - MESSAGE ( "Look for an engine for data type :"<< sco->ComponentDataType()); + CORBA::String_var compodatatype=sco->ComponentDataType(); + MESSAGE ( "Look for an engine for data type :"<< compodatatype); // if there is an associated Engine call its method for closing CORBA::String_var IOREngine; if (sco->ComponentIOR(IOREngine)) { // we have found the associated engine to write the data - MESSAGE ( "We have found an engine for data type :"<< sco->ComponentDataType()); + MESSAGE ( "We have found an engine for data type :"<< compodatatype); //_narrow can throw a corba exception try { @@ -685,8 +710,13 @@ void SALOMEDS_Study_i::Close() catch (CORBA::Exception&) {/*pass*/ } } + sco->Destroy(); } + //Does not need any more this iterator + itcomponent->Destroy(); + + _impl->Close(); } diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index 307f09fb2..d53e660d6 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -48,9 +48,10 @@ class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study { private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_Study* _impl; SALOMEDS_StudyBuilder_i* _builder; + static std::map _mapOfStudies; public: @@ -244,6 +245,7 @@ public: virtual void StudyId(CORBA::Short id); static SALOMEDS::Study_ptr GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb); + static SALOMEDS_Study_i* GetStudyServant(SALOMEDSImpl_Study*, CORBA::ORB_ptr orb); static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute); diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx index 864646a0a..af1e5bbed 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx @@ -46,7 +46,7 @@ class SALOMEDS_UseCaseBuilder_i: public virtual POA_SALOMEDS::UseCaseBuilder, { private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_UseCaseBuilder* _impl; public: diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx index d40276d79..0c935f9ea 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx @@ -41,7 +41,7 @@ class SALOMEDS_UseCaseIterator_i: public virtual POA_SALOMEDS::UseCaseIterator, public virtual SALOME::GenericObj_i { private: - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; SALOMEDSImpl_UseCaseIterator* _impl; public: diff --git a/src/SALOMEDS/Test/Makefile.am b/src/SALOMEDS/Test/Makefile.am index f1c357707..532aaa090 100644 --- a/src/SALOMEDS/Test/Makefile.am +++ b/src/SALOMEDS/Test/Makefile.am @@ -60,7 +60,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/SALOMEDSClient \ -I$(srcdir)/$(RPATH)/DF \ -I$(srcdir)/$(RPATH)/SALOMEDSImpl -I$(srcdir)/$(RPATH)/SALOMEDSImpl/Test \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@ diff --git a/src/SALOMEDSClient/Makefile.am b/src/SALOMEDSClient/Makefile.am index f1534abe8..d9736b141 100644 --- a/src/SALOMEDSClient/Makefile.am +++ b/src/SALOMEDSClient/Makefile.am @@ -81,7 +81,6 @@ salomeinclude_HEADERS=\ # This local variable defines the list of CPPFLAGS common to all target in this package. COMMON_CPPFLAGS= \ @BOOST_CPPFLAGS@ \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/SALOMEDSImpl/Makefile.am b/src/SALOMEDSImpl/Makefile.am index 3a16fc238..731cf625a 100644 --- a/src/SALOMEDSImpl/Makefile.am +++ b/src/SALOMEDSImpl/Makefile.am @@ -95,13 +95,16 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../HDFPersist \ -I$(srcdir)/../DF \ + -I$(srcdir)/../GenericObj \ + -I$(top_builddir)/idl \ @HDF5_INCLUDES@ \ - @BOOST_CPPFLAGS@ + @BOOST_CPPFLAGS@ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ ../HDFPersist/libSalomeHDFPersist.la \ ../DF/libDF.la \ + ../GenericObj/libSalomeGenericObj.la \ @HDF5_LIBS@ @@ -215,7 +218,7 @@ libSalomeDSImpl_la_SOURCES =\ libSalomeDSImpl_la_CPPFLAGS = $(COMMON_CPPFLAGS) libSalomeDSImpl_la_LDFLAGS = -no-undefined -version-info=0:0:0 -libSalomeDSImpl_la_LIBADD = $(COMMON_LIBS) +libSalomeDSImpl_la_LIBADD = $(COMMON_LIBS) $(CORBA_LIBS) # # =============================================================== @@ -226,4 +229,4 @@ bin_PROGRAMS = testDS testDS_SOURCES = testDS.cxx testDS_CPPFLAGS = $(COMMON_CPPFLAGS) testDS_LDADD = libSalomeDSImpl.la \ - $(HDF5_LIBS) + $(HDF5_LIBS) $(CORBA_LIBS) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx index fe83cfd63..1c049a87f 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx @@ -28,6 +28,62 @@ using namespace std; +//to disable automatic genericobj management comment the following line +#define WITHGENERICOBJ + +#ifdef WITHGENERICOBJ +#include "SALOME_GenericObj_i.hh" + +static CORBA::ORB_var getORB() +{ + int argc=0; + return CORBA::ORB_init(argc,0); +} + +void IORGenericObjDecref(const std::string& anIOR) +{ + CORBA::Object_var obj; + SALOME::GenericObj_var gobj; + try + { + obj = getORB()->string_to_object(anIOR.c_str()); + if(obj->_non_existent())return; + gobj = SALOME::GenericObj::_narrow(obj); + if(! CORBA::is_nil(gobj) ) + { + gobj->Destroy(); + } + } + catch(const CORBA::Exception& e) + { + } +} + +void IORGenericObjIncref(const std::string& anIOR) +{ + CORBA::Object_var obj; + SALOME::GenericObj_var gobj; + try + { + obj = getORB()->string_to_object(anIOR.c_str()); + if(obj->_non_existent())return; + gobj = SALOME::GenericObj::_narrow(obj); + if(! CORBA::is_nil(gobj) ) + { + gobj->Register(); + } + } + catch(const CORBA::Exception& e) + { + } +} +#else +void IORGenericObjDecref(const std::string& anIOR) +{} +void IORGenericObjIncref(const std::string& anIOR) +{} +#endif + //======================================================================= //function : GetID //purpose : @@ -47,7 +103,7 @@ const std::string& SALOMEDSImpl_AttributeIOR::GetID () //======================================================================= SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L, - const std::string& S) + const std::string& S) { SALOMEDSImpl_AttributeIOR* A = NULL; if (!(A=(SALOMEDSImpl_AttributeIOR*)L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { @@ -56,7 +112,6 @@ SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L, } A->SetValue(S); - SALOMEDSImpl_Study::IORUpdated(A); return A; } @@ -68,11 +123,20 @@ void SALOMEDSImpl_AttributeIOR::SetValue(const std::string& theValue) { CheckLocked(); - SALOMEDSImpl_Study::GetStudy(Label()); + SALOMEDSImpl_Study* study=SALOMEDSImpl_Study::GetStudy(Label()); Backup(); + //remove IOR entry in study + if(theValue != myString) + { + IORGenericObjIncref(theValue); + IORGenericObjDecref(myString); + study->DeleteIORLabelMapItem(myString); + } + myString = theValue; + //add IOR entry in study SALOMEDSImpl_Study::IORUpdated(this); } @@ -94,6 +158,11 @@ SALOMEDSImpl_AttributeIOR::SALOMEDSImpl_AttributeIOR() { } +SALOMEDSImpl_AttributeIOR::~SALOMEDSImpl_AttributeIOR() +{ + IORGenericObjDecref(myString); +} + //======================================================================= //function : ID //purpose : diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx index b0370d3f4..8ebef9533 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.hxx @@ -51,7 +51,7 @@ public: void Restore(DF_Attribute* with); DF_Attribute* NewEmpty() const; void Paste(DF_Attribute* into); - ~SALOMEDSImpl_AttributeIOR() {} + ~SALOMEDSImpl_AttributeIOR() ; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 063562ae3..7832d50c7 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -48,14 +48,13 @@ using namespace std; #define VARIABLE_SEPARATOR ':' #define OPERATION_SEPARATOR '|' - //============================================================================ /*! Function : SALOMEDSImpl_Study * Purpose : SALOMEDSImpl_Study constructor */ //============================================================================ SALOMEDSImpl_Study::SALOMEDSImpl_Study(const DF_Document* doc, - const string& study_name) + const string& study_name) { _name = study_name; _doc = (DF_Document*)doc; @@ -79,7 +78,11 @@ SALOMEDSImpl_Study::SALOMEDSImpl_Study(const DF_Document* doc, */ //============================================================================ SALOMEDSImpl_Study::~SALOMEDSImpl_Study() -{} +{ + delete _builder; + delete _cb; + delete _useCaseBuilder; +} //============================================================================ /*! Function : GetPersistentReference @@ -190,8 +193,8 @@ SALOMEDSImpl_SComponent SALOMEDSImpl_Study::FindComponentID(const string& aCompo ID = SC.GetID(); if(aComponentID == ID) { - // ComponentID found - _find = true; + // ComponentID found + _find = true; compo = SC; } } @@ -223,14 +226,14 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObject(const string& anObjectName) for (; it.More();it.Next()){ if(!_find) { - SALOMEDSImpl_SComponent SC = it.Value(); - if (SC.GetName() == anObjectName) - { - _find = true; - RefSO = SC; - - } - if (!_find) RefSO = _FindObject(SC, anObjectName, _find); + SALOMEDSImpl_SComponent SC = it.Value(); + if (SC.GetName() == anObjectName) + { + _find = true; + RefSO = SC; + + } + if (!_find) RefSO = _FindObject(SC, anObjectName, _find); } } if(!RefSO) _errorCode = "No object was found"; @@ -286,7 +289,7 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::CreateObjectID(const string& anObjectID */ //============================================================================ vector SALOMEDSImpl_Study::FindObjectByName(const string& anObjectName, - const string& aComponentName) + const string& aComponentName) { _errorCode = ""; @@ -308,8 +311,8 @@ vector SALOMEDSImpl_Study::FindObjectByName(const string& SALOMEDSImpl_SObject CSO = it.Value(); if ( CSO.GetName() == anObjectName ) { - /* add to list */ - listSO.push_back(CSO) ; + /* add to list */ + listSO.push_back(CSO) ; } /* looks also for eventual children */ @@ -395,14 +398,14 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectByPath(const string& thePath) for ( ; anIterator.More(); anIterator.Next() ) { aLabel = anIterator.Value(); if((anAttr=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { - if(anAttr->Value() == aToken) { - if(i == (len-1)) { //The searched label is found (no part of the path is left) - return GetSObject(aLabel); - } - - anIterator.Init(aLabel, false); - break; - } + if(anAttr->Value() == aToken) { + if(i == (len-1)) { //The searched label is found (no part of the path is left) + return GetSObject(aLabel); + } + + anIterator.Init(aLabel, false); + break; + } } } @@ -437,8 +440,8 @@ string SALOMEDSImpl_Study::GetObjectPath(const SALOMEDSImpl_SObject& theObject) if(aFather) { aName = aFather.GetName(); if(!aName.empty() && aName != "") { - aValue = GetObjectPath(aFather); - aPath = aValue + aPath; + aValue = GetObjectPath(aFather); + aPath = aValue + aPath; } } } @@ -597,10 +600,10 @@ vector SALOMEDSImpl_Study::GetDirectoryNames(const string& theContext) SALOMEDSImpl_AttributeLocalID* anID; if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) { if (anID->Value() == DIRECTORYID) { - SALOMEDSImpl_AttributeName* aName; - if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { - aResultSeq.push_back(aName->Value()); - } + SALOMEDSImpl_AttributeName* aName; + if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) { + aResultSeq.push_back(aName->Value()); + } } } } @@ -638,12 +641,12 @@ vector SALOMEDSImpl_Study::GetFileNames(const string& theContext) SALOMEDSImpl_AttributeLocalID* anID; if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) { if (anID->Value() == FILELOCALID) { - SALOMEDSImpl_AttributePersistentRef* aName; - if ((aName=(SALOMEDSImpl_AttributePersistentRef*)aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) { - std::string aFileName = aName->Value(); - if (aFileName.size() > 0) - aResultSeq.push_back(aFileName.substr(strlen(FILEID), aFileName.size())); - } + SALOMEDSImpl_AttributePersistentRef* aName; + if ((aName=(SALOMEDSImpl_AttributePersistentRef*)aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) { + std::string aFileName = aName->Value(); + if (aFileName.size() > 0) + aResultSeq.push_back(aFileName.substr(strlen(FILEID), aFileName.size())); + } } } } @@ -814,8 +817,8 @@ void SALOMEDSImpl_Study::URL(const string& url) */ //============================================================================ SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObject(const SALOMEDSImpl_SObject& SO, - const string& theObjectName, - bool& _find) + const string& theObjectName, + bool& _find) { SALOMEDSImpl_SObject RefSO; if(!SO) return RefSO; @@ -829,16 +832,16 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObject(const SALOMEDSImpl_SObject& for (; it.More(); it.Next()){ if(!_find) { - if ((anAttr=(SALOMEDSImpl_AttributeName*)it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) - { + if ((anAttr=(SALOMEDSImpl_AttributeName*)it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) + { string Val(anAttr->Value()); - if (Val == theObjectName) - { - RefSO = GetSObject(it.Value()); - _find = true; - } - } - if (!_find) RefSO = _FindObject(GetSObject(it.Value()), theObjectName, _find); + if (Val == theObjectName) + { + RefSO = GetSObject(it.Value()); + _find = true; + } + } + if (!_find) RefSO = _FindObject(GetSObject(it.Value()), theObjectName, _find); } } return RefSO; @@ -851,8 +854,8 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObject(const SALOMEDSImpl_SObject& //============================================================================ SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObjectIOR(const SALOMEDSImpl_SObject& SO, - const string& theObjectIOR, - bool& _find) + const string& theObjectIOR, + bool& _find) { SALOMEDSImpl_SObject RefSO, aSO; if(!SO) return RefSO; @@ -865,17 +868,17 @@ SALOMEDSImpl_Study::_FindObjectIOR(const SALOMEDSImpl_SObject& SO, for (; it.More();it.Next()){ if(!_find) { - if ((anAttr=(SALOMEDSImpl_AttributeIOR*)it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) - { + if ((anAttr=(SALOMEDSImpl_AttributeIOR*)it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) + { string Val(anAttr->Value()); - if (Val == theObjectIOR) - { - RefSO = GetSObject(it.Value()); - _find = true; - } - } - aSO = GetSObject(it.Value()); - if (!_find) RefSO = _FindObjectIOR(aSO, theObjectIOR, _find); + if (Val == theObjectIOR) + { + RefSO = GetSObject(it.Value()); + _find = true; + } + } + aSO = GetSObject(it.Value()); + if (!_find) RefSO = _FindObjectIOR(aSO, theObjectIOR, _find); } } return RefSO; @@ -961,6 +964,15 @@ void SALOMEDSImpl_Study::UpdateIORLabelMap(const string& anIOR,const string& anE myIORLabels[anIOR] = aLabel; } +void SALOMEDSImpl_Study::DeleteIORLabelMapItem(const std::string& anIOR) +{ + if (myIORLabels.find(anIOR) != myIORLabels.end()) + { + //remove the ior entry and decref the genericobj (if it's one) + myIORLabels.erase(anIOR); + } +} + SALOMEDSImpl_Study* SALOMEDSImpl_Study::GetStudy(const DF_Label& theLabel) { SALOMEDSImpl_StudyHandle* Att; @@ -1041,7 +1053,7 @@ vector SALOMEDSImpl_Study::GetModificationsDate() char aDate[20]; sprintf(aDate, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d", (int)(aDays[anIndex]), (int)(aMonths[anIndex]), (int)(aYears[anIndex]), - (int)(aHours[anIndex]), (int)(aMinutes[anIndex])); + (int)(aHours[anIndex]), (int)(aMinutes[anIndex])); aDates.push_back(aDate); } return aDates; @@ -1140,7 +1152,7 @@ SALOMEDSImpl_SObject SALOMEDSImpl_Study::GetSObject(const DF_Label& theLabel) */ //============================================================================ DF_Attribute* SALOMEDSImpl_Study::GetAttribute(const string& theEntry, - const string& theType) + const string& theType) { SALOMEDSImpl_SObject aSO = GetSObject(theEntry); DF_Attribute* anAttr; @@ -1154,9 +1166,9 @@ DF_Attribute* SALOMEDSImpl_Study::GetAttribute(const string& theEntry, */ //============================================================================ bool SALOMEDSImpl_Study::DumpStudy(const string& thePath, - const string& theBaseName, - bool isPublished, - SALOMEDSImpl_DriverFactory* theFactory) + const string& theBaseName, + bool isPublished, + SALOMEDSImpl_DriverFactory* theFactory) { _errorCode = ""; @@ -1216,7 +1228,7 @@ bool SALOMEDSImpl_Study::DumpStudy(const string& thePath, fp << _GetNoteBookAccess(); - fp << "sys.path.insert( 0, \'" << thePath << "\')" << endl << endl; + fp << "sys.path.insert( 0, r\'" << thePath << "\')" << endl << endl; //Dump NoteBook Variables fp << _GetStudyVariablesScript(); @@ -1246,22 +1258,22 @@ bool SALOMEDSImpl_Study::DumpStudy(const string& thePath, string IOREngine; try { if (!sco.ComponentIOR(IOREngine)) { - if (!aCompType.empty()) { - - aDriver = theFactory->GetDriverByType(aCompType); - - if (aDriver != NULL) { - SALOMEDSImpl_StudyBuilder* SB = NewBuilder(); - if(!SB->LoadWith(sco, aDriver)) { - _errorCode = SB->GetErrorCode(); - return false; - } - } - else continue; - } + if (!aCompType.empty()) { + + aDriver = theFactory->GetDriverByType(aCompType); + + if (aDriver != NULL) { + SALOMEDSImpl_StudyBuilder* SB = NewBuilder(); + if(!SB->LoadWith(sco, aDriver)) { + _errorCode = SB->GetErrorCode(); + return false; + } + } + else continue; + } } else { - aDriver = theFactory->GetDriverByIOR(IOREngine); + aDriver = theFactory->GetDriverByIOR(IOREngine); } } catch(...) { _errorCode = "Can not restore information to dump it"; @@ -1344,9 +1356,9 @@ string SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName) } void dumpSO(const SALOMEDSImpl_SObject& theSO, - fstream& fp, - const string& Tab, - SALOMEDSImpl_Study* theStudy); + fstream& fp, + const string& Tab, + SALOMEDSImpl_Study* theStudy); //============================================================================ /*! Function : dump @@ -1384,9 +1396,9 @@ void SALOMEDSImpl_Study::dump(const string& theFileName) void dumpSO(const SALOMEDSImpl_SObject& theSO, - fstream& fp, - const string& Tab, - SALOMEDSImpl_Study* theStudy) + fstream& fp, + const string& Tab, + SALOMEDSImpl_Study* theStudy) { string aTab(Tab), anID(theSO.GetID()); fp << aTab << anID << endl; @@ -1473,8 +1485,8 @@ SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetCommonParameters(const c */ //============================================================================ SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetModuleParameters(const char* theID, - const char* theModuleName, - int theSavePoint) + const char* theModuleName, + int theSavePoint) { if(theSavePoint <= 0) return NULL; SALOMEDSImpl_AttributeParameter* main_ap = GetCommonParameters(theID, theSavePoint); @@ -1737,8 +1749,8 @@ bool SALOMEDSImpl_Study::IsVariableUsed(const string& theVarName) */ //============================================================================ bool SALOMEDSImpl_Study::FindVariableAttribute(SALOMEDSImpl_StudyBuilder* theStudyBuilder, - SALOMEDSImpl_SObject theSObject, - const std::string& theName) + SALOMEDSImpl_SObject theSObject, + const std::string& theName) { SALOMEDSImpl_ChildIterator anIter = NewChildIterator( theSObject ); for( ; anIter.More(); anIter.Next() ) @@ -1755,13 +1767,13 @@ bool SALOMEDSImpl_Study::FindVariableAttribute(SALOMEDSImpl_StudyBuilder* theStu vector< vector > aSections = ParseVariables( aString ); for( int i = 0, n = aSections.size(); i < n; i++ ) { - vector aVector = aSections[i]; - for( int j = 0, m = aVector.size(); j < m; j++ ) - { - string aStr = aVector[j]; - if( aStr.compare( theName ) == 0 ) - return true; - } + vector aVector = aSections[i]; + for( int j = 0, m = aVector.size(); j < m; j++ ) + { + string aStr = aVector[j]; + if( aStr.compare( theName ) == 0 ) + return true; + } } } } @@ -1792,9 +1804,9 @@ bool SALOMEDSImpl_Study::FindVariableAttribute(const std::string& theName) */ //============================================================================ void SALOMEDSImpl_Study::ReplaceVariableAttribute(SALOMEDSImpl_StudyBuilder* theStudyBuilder, - SALOMEDSImpl_SObject theSObject, - const std::string& theSource, - const std::string& theDest) + SALOMEDSImpl_SObject theSObject, + const std::string& theSource, + const std::string& theDest) { SALOMEDSImpl_ChildIterator anIter = NewChildIterator( theSObject ); for( ; anIter.More(); anIter.Next() ) @@ -1811,26 +1823,26 @@ void SALOMEDSImpl_Study::ReplaceVariableAttribute(SALOMEDSImpl_StudyBuilder* the vector< vector > aSections = ParseVariables( aCurrentString ); for( int i = 0, n = aSections.size(); i < n; i++ ) { - vector aVector = aSections[i]; - for( int j = 0, m = aVector.size(); j < m; j++ ) - { - string aStr = aVector[j]; - if( aStr.compare( theSource ) == 0 ) - { - isChanged = true; - aStr = theDest; - } - - aNewString.append( aStr ); - if( j != m - 1 ) - aNewString.append( ":" ); - } - if( i != n - 1 ) - aNewString.append( "|" ); + vector aVector = aSections[i]; + for( int j = 0, m = aVector.size(); j < m; j++ ) + { + string aStr = aVector[j]; + if( aStr.compare( theSource ) == 0 ) + { + isChanged = true; + aStr = theDest; + } + + aNewString.append( aStr ); + if( j != m - 1 ) + aNewString.append( ":" ); + } + if( i != n - 1 ) + aNewString.append( "|" ); } if( isChanged ) - aStringAttr->SetValue( aNewString ); + aStringAttr->SetValue( aNewString ); } } } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx index 8e29584c3..55a2bca77 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx @@ -196,6 +196,7 @@ public: virtual void StudyId(int id); + virtual void DeleteIORLabelMapItem(const std::string& anIOR); virtual void UpdateIORLabelMap(const std::string& anIOR, const std::string& aLabel); virtual std::vector FindDependances(const SALOMEDSImpl_SObject& anObject); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index 7edbea023..4ec0d3b39 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -205,6 +205,7 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObject(const SALOMEDSImpl_SObject& anObjec SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + _study->DeleteIORLabelMapItem(anAttr->Value()); } Lab.ForgetAllAttributes(); @@ -240,6 +241,7 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const SALOMEDSImpl_SObj } SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + _study->DeleteIORLabelMapItem(anAttr->Value()); } DF_ChildIterator it(Lab, true); @@ -252,6 +254,7 @@ bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const SALOMEDSImpl_SObj } SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map if ((anAttr=(SALOMEDSImpl_AttributeIOR*)aLabel.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + _study->DeleteIORLabelMapItem(anAttr->Value()); } } @@ -533,6 +536,7 @@ bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const SALOMEDSImpl_SObject& anOb if (aTypeOfAttribute == string("AttributeIOR")) { // Remove from IORLabel map SALOMEDSImpl_AttributeIOR* anAttr = NULL; if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) { + _study->DeleteIORLabelMapItem(anAttr->Value()); } } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx index d0b767b49..cef6ad2b8 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyManager.cxx @@ -40,6 +40,15 @@ #include #include +#ifdef WIN32 +#include +#endif + +//Warning undef of Ascii Winwows define +#ifdef WIN32 +# undef GetUserName +#endif + using namespace std; #define USE_CASE_LABEL_ID "0:2" @@ -71,6 +80,7 @@ SALOMEDSImpl_StudyManager::SALOMEDSImpl_StudyManager() //============================================================================ SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager() { + _appli->Close(_clipboard); // Destroy application delete _appli; } @@ -221,6 +231,8 @@ void SALOMEDSImpl_StudyManager::Close(SALOMEDSImpl_Study* aStudy) } aStudy->Close(); + DF_Document* doc=aStudy->GetDocument(); + _appli->Close(doc); } //============================================================================ @@ -443,7 +455,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, * Purpose : save the study in HDF file */ //============================================================================ -bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl, +bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aStudyUrl, SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile, @@ -475,6 +487,9 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl, return false; } + //Create a temporary url to which the study is saved + string aUrl = SALOMEDSImpl_Tool::GetTmpDir() + SALOMEDSImpl_Tool::GetNameFromPath(aStudyUrl); + int aLocked = aStudy->GetProperties()->IsLocked(); if (aLocked) aStudy->GetProperties()->SetLocked(false); @@ -513,7 +528,7 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl, } string anOldName = aStudy->Name(); - aStudy->URL(aUrl); + aStudy->URL(aStudyUrl); // To change for Save // Do not have to do a new file but just a Open??? Rewrite all informations after erasing evrything?? @@ -732,6 +747,55 @@ bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl, if (theASCII) { // save file in ASCII format HDFascii::ConvertFromHDFToASCII(aUrl.c_str(), true); } + + //Now it's necessary to copy files from the temporary directory to the user defined directory. + + // The easiest way to get a list of file in the temporary directory + + string aCmd, aTmpFileDir = SALOMEDSImpl_Tool::GetTmpDir(); + string aTmpFile = aTmpFileDir +"files"; + string aStudyTmpDir = SALOMEDSImpl_Tool::GetDirFromPath(aUrl); + +#ifdef WIN32 + aCmd = "dir /B \"" + aStudyTmpDir +"\" > " + aTmpFile; +#else + aCmd ="ls -1 \"" + aStudyTmpDir +"\" > " + aTmpFile; +#endif + system(aCmd.c_str()); + + // Iterate and move files in the temporary directory + FILE* fp = fopen(aTmpFile.c_str(), "r"); + if(!fp) return false; + char* buffer = new char[2047]; + while(!feof(fp)) { + if((fgets(buffer, 2046, fp)) == NULL) break; + size_t aLen = strlen(buffer); + if(buffer[aLen-1] == '\n') buffer[aLen-1] = char(0); +#ifdef WIN32 + aCmd = "move /Y \"" + aStudyTmpDir + string(buffer) + "\" \"" + SALOMEDSImpl_Tool::GetDirFromPath(aStudyUrl) +"\""; +#else + aCmd = "mv -f \"" + aStudyTmpDir + string(buffer) + "\" \"" + SALOMEDSImpl_Tool::GetDirFromPath(aStudyUrl)+"\""; +#endif + system(aCmd.c_str()); + } + + delete []buffer; + fclose(fp); + + // Perform cleanup +#ifdef WIN32 + DeleteFileA(aTmpFile.c_str()); +#else + unlink(aTmpFile.c_str()); +#endif + +#ifdef WIN32 + RemoveDirectoryA(aTmpFileDir.c_str()); + RemoveDirectoryA(aStudyTmpDir.c_str()); +#else + rmdir(aTmpFileDir.c_str()); + rmdir(aStudyTmpDir.c_str()); +#endif return true; } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx index e19d888f6..a77876658 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Tool.cxx @@ -54,7 +54,7 @@ bool Exists(const string thePath) { #ifdef WIN32 if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) { - if ( GetLastError () != ERROR_FILE_NOT_FOUND ) { + if ( GetLastError () == ERROR_FILE_NOT_FOUND ) { return false; } } @@ -184,31 +184,31 @@ string SALOMEDSImpl_Tool::GetNameFromPath(const string& thePath) { // purpose : Returns the dir by the path //============================================================================ string SALOMEDSImpl_Tool::GetDirFromPath(const string& thePath) { - if (thePath.empty()) return ""; +#ifdef WIN32 + string separator = "\\"; +#else + string separator = "/"; +#endif - int pos = thePath.rfind('/'); string path; - if(pos > 0) { - path = thePath.substr(0, pos+1); - } - if(path.empty()) { - pos = thePath.rfind('\\'); - if(pos > 0) path = thePath.substr(0, pos+1); - } - if(path.empty()) { - pos = thePath.rfind('|'); - if(pos > 0) path = thePath.substr(0, pos+1); - } - if(path.empty()) { - path = thePath+"/"; - } - + if (!thePath.empty()) { + int pos = thePath.rfind('/'); + if (pos < 0) pos = thePath.rfind('\\'); + if (pos < 0) pos = thePath.rfind('|'); + + if (pos > 0) + path = thePath.substr(0, pos+1); + else + path = string(".") + separator; + #ifdef WIN32 //Check if the only disk letter is given as path - if(path.size() == 2 && path[1] == ':') path +='\\'; + if (path.size() == 2 && path[1] == ':') path += separator; #endif - - for(int i = 0, len = path.size(); i= 0 ) + path.replace(pos, 1, separator); + } + return path; } diff --git a/src/SALOMEDSImpl/Test/Makefile.am b/src/SALOMEDSImpl/Test/Makefile.am index 3ac0c73a5..348d2c7c9 100644 --- a/src/SALOMEDSImpl/Test/Makefile.am +++ b/src/SALOMEDSImpl/Test/Makefile.am @@ -58,7 +58,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/LifeCycleCORBA \ -I$(srcdir)/$(RPATH)/DF \ -I$(srcdir)/$(RPATH)/SALOMEDSImpl \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@ diff --git a/src/SALOMETraceCollector/Makefile.am b/src/SALOMETraceCollector/Makefile.am index f9839cf5a..5ca841a30 100644 --- a/src/SALOMETraceCollector/Makefile.am +++ b/src/SALOMETraceCollector/Makefile.am @@ -42,7 +42,6 @@ libwith_loggerTraceCollector_la_SOURCES =\ libwith_loggerTraceCollector_la_CPPFLAGS =\ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/SALOMETraceCollector/Test/Makefile.am b/src/SALOMETraceCollector/Test/Makefile.am index fbe2bd53d..5c8d12654 100644 --- a/src/SALOMETraceCollector/Test/Makefile.am +++ b/src/SALOMETraceCollector/Test/Makefile.am @@ -56,8 +56,7 @@ COMMON_CPPFLAGS=\ @CPPUNIT_INCLUDES@ \ -I$(srcdir)/$(RPATH)/Basics -I$(srcdir)/$(RPATH)/Basics/Test \ -I$(srcdir)/$(RPATH)/SALOMELocalTrace -I$(srcdir)/$(RPATH)/SALOMELocalTrace/Test\ - -I$(srcdir)/$(RPATH)/SALOMETraceCollector \ - -I$(top_builddir)/salome_adm/unix + -I$(srcdir)/$(RPATH)/SALOMETraceCollector # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ diff --git a/src/TOOLSDS/Makefile.am b/src/TOOLSDS/Makefile.am index 8ec3e98d2..306cf7eaf 100644 --- a/src/TOOLSDS/Makefile.am +++ b/src/TOOLSDS/Makefile.am @@ -40,7 +40,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Basics \ -I$(srcdir)/../Utils \ -I$(srcdir)/../SALOMELocalTrace \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \ @HDF5_INCLUDES@ \ diff --git a/src/TestContainer/Makefile.am b/src/TestContainer/Makefile.am index f69747c1c..f520293f0 100644 --- a/src/TestContainer/Makefile.am +++ b/src/TestContainer/Makefile.am @@ -55,7 +55,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../Notification \ -I$(srcdir)/../ResourcesManager \ -I$(srcdir)/../Container \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/TestMPIContainer/Makefile.am b/src/TestMPIContainer/Makefile.am index e1aeb27d9..ee4339847 100644 --- a/src/TestMPIContainer/Makefile.am +++ b/src/TestMPIContainer/Makefile.am @@ -58,7 +58,6 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/../ResourcesManager \ -I$(srcdir)/../Container \ -I$(srcdir)/../MPIContainer \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/UnitTests/Makefile.am b/src/UnitTests/Makefile.am index 5a9efeced..085cf5eff 100644 --- a/src/UnitTests/Makefile.am +++ b/src/UnitTests/Makefile.am @@ -46,8 +46,7 @@ UnitTests_SOURCES = UnitTests.cxx UnitTests_CPPFLAGS =\ @CPPUNIT_INCLUDES@ \ -I$(srcdir)/../Basics -I$(srcdir)/../Basics/Test \ - -I$(srcdir)/../SALOMELocalTrace -I$(srcdir)/../SALOMELocalTrace/Test \ - -I$(top_builddir)/salome_adm/unix + -I$(srcdir)/../SALOMELocalTrace -I$(srcdir)/../SALOMELocalTrace/Test if CORBA_GEN UnitTests_CPPFLAGS +=\ diff --git a/src/Utils/Makefile.am b/src/Utils/Makefile.am index 7b73b1066..599733463 100644 --- a/src/Utils/Makefile.am +++ b/src/Utils/Makefile.am @@ -64,7 +64,6 @@ libOpUtil_la_LDFLAGS = -no-undefined -version-info=0:0:0 libOpUtil_la_CPPFLAGS = \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ - -I$(top_builddir)/salome_adm/unix \ -I$(top_builddir)/idl \ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ diff --git a/src/Utils/Test/Makefile.am b/src/Utils/Test/Makefile.am index fe50c0501..fba0402a8 100644 --- a/src/Utils/Test/Makefile.am +++ b/src/Utils/Test/Makefile.am @@ -54,8 +54,7 @@ COMMON_CPPFLAGS=\ -I$(srcdir)/$(RPATH)/Basics -I$(srcdir)/$(RPATH)/Basics/Test \ -I$(srcdir)/$(RPATH)/SALOMELocalTrace -I$(srcdir)/$(RPATH)/SALOMELocalTrace/Test \ -I$(srcdir)/$(RPATH)/SALOMETraceCollector -I$(srcdir)/$(RPATH)/SALOMETraceCollector/Test \ - -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \ - -I$(top_builddir)/salome_adm/unix + -I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test # This local variable defines the list of dependant libraries common to all target in this package. COMMON_LIBS =\ diff --git a/src/Utils/Utils_SALOME_Exception.hxx b/src/Utils/Utils_SALOME_Exception.hxx index f1caac758..75554924b 100644 --- a/src/Utils/Utils_SALOME_Exception.hxx +++ b/src/Utils/Utils_SALOME_Exception.hxx @@ -74,7 +74,7 @@ protected : public : SALOME_Exception( const char *text, const char *fileName=0, const unsigned int lineNumber=0 ); SALOME_Exception( const SALOME_Exception &ex ); - ~SALOME_Exception() throw (); + virtual ~SALOME_Exception() throw (); friend std::ostream & operator<<( std::ostream &os , const SALOME_Exception &ex ); virtual const char *what( void ) const throw () ; } ;