DIST_SUBDIRS= salome_adm idl src doc bin resources
-DISTCLEANFILES = a.out
+DISTCLEANFILES = a.out local-install.sh
salomeinclude_DATA = KERNEL_version.h
runSalome \
runSalome.csh \
runSalome.ksh \
+ runSalome.bat \
waitNS.sh
# These files are python files
-#!/bin/sh
+#!/bin/bash
# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
#clean appli
-#
-rm -rf bin lib share doc idl env.d envd USERS getAppliPath.py searchFreePort.sh runAppli runConsole runSession runRemote.sh runTests SalomeApp.xml *.pyc *~ .bashrc
+
+DELCOM="rm -rf bin lib share doc idl env.d envd USERS getAppliPath.py searchFreePort.sh runAppli runConsole runSession runRemote.sh runTests SalomeApp.xml *.pyc *~ .bashrc"
+DOIT="false"
+
+if [ $# > 0 ]
+then
+ if [ "x$1" == "x-f" ]
+ then DOIT="true"
+ fi
+fi
+
+if [ $DOIT == "false" ]
+then
+ echo "Do you want to delete a SALOME application in this directory ? " `pwd`
+ echo "command to execute: " $DELCOM
+ echo "enter yes or no"
+ read ANSWER
+ echo "ANSWER="$ANSWER
+ if [ "x$ANSWER" == "xyes" ]
+ then
+ DOIT="true"
+ fi
+fi
+
+if [ $DOIT == "true" ]
+then
+ $DELCOM
+fi
command="""
<parameter name="pyModules" value=""/>
<parameter name="embedded" value="SalomeAppEngine,study,cppContainer,registry,moduleCatalog"/>
- <parameter name="standalone" value="pyContainer,supervContainer"/>
+ <parameter name="standalone" value="pyContainer"/>
</section>
</document>
"""
VERSION=V3_2_0
-for module in KERNEL MED GUI GEOM SMESH VISU SUPERV LIGHT NETGENPLUGIN PYCALCULATOR;
+for module in KERNEL MED GUI GEOM SMESH VISU LIGHT NETGENPLUGIN PYCALCULATOR;
do
echo " ========= " ${module};
python virtual_salome.py -v --prefix="." --module=$INSTALL_ROOT/${module}_${VERSION}
<parameter name="xterm" value="no"/>
<parameter name="portkill" value="no"/>
<parameter name="killall" value="no"/>
- <parameter name="modules" value="GUI,GEOM,SMESH,VISU,SUPERV,MED,COMPONENT,LIGHT,PYHELLO,PYCALCULATOR"/>
+ <parameter name="modules" value="GUI,GEOM,SMESH,VISU,MED,COMPONENT,LIGHT,PYHELLO,PYCALCULATOR"/>
<parameter name="pyModules" value=""/>
<parameter name="embedded" value="SalomeAppEngine,cppContainer,registry,moduleCatalog,study"/>
<parameter name="standalone" value="pyContainer"/>
<parameter name="GEOM" value="${GEOM_ROOT_DIR}/share/salome/resources/geom"/>
<parameter name="SMESH" value="${SMESH_ROOT_DIR}/share/salome/resources/smesh"/>
<parameter name="VISU" value="${VISU_ROOT_DIR}/share/salome/resources/visu"/>
- <parameter name="SUPERV" value="${SUPERV_ROOT_DIR}/share/salome/resources/superv"/>
<parameter name="MED" value="${MED_ROOT_DIR}/share/salome/resources/med"/>
<parameter name="StdMeshers" value="${SMESH_ROOT_DIR}/share/salome/resources/smesh"/>
<parameter name="NETGENPlugin" value="${NETGENPLUGIN_ROOT_DIR}/share/salome/resources/netgenplugin"/>
<parameter name="name" value="Post-Pro"/>
<parameter name="icon" value="ModuleVisu.png"/>
</section>
- <section name="SUPERV">
- <parameter name="name" value="Supervisor"/>
- <parameter name="icon" value="ModuleSupervision.png"/>
- </section>
<section name="MED">
<parameter name="name" value="Med"/>
<parameter name="icon" value="ModuleMed.png"/>
export GEOM_ROOT_DIR=${REPINST}/GEOM_V301
export MED_ROOT_DIR=${REPINST}/MED_V301
export SMESH_ROOT_DIR=${REPINST}/SMESH_V301
-export SUPERV_ROOT_DIR=${REPINST}/SUPERV_V301
export VISU_ROOT_DIR=${REPINST}/VISU_V301
export NETGENPLUGIN_ROOT_DIR=${REPINST}/NETGENPLUGIN_V301
export COMPONENT_ROOT_DIR=${REPINST}/COMPONENT_V301
APPLI_HOME=`dirname $0`
+NSPORT=last
+NSHOST=localhost
+
+usage()
+{
+ echo "Connect to a SALOME session (local or remote)"
+ echo ""
+ echo "Usage: $(basename $0) [ -p PORT ] [ -m MACHINE ] [ -h ] [command]"
+ echo ""
+ echo " -p PORT : The port to connect to "
+ echo " -m MACHINE : The machine to connect to "
+ echo " -h : Print this message"
+ echo " command : The command to execute in the SALOME session"
+ echo ""
+ echo "If the command is not given a shell is opened"
+ echo "If PORT and MACHINE are not given, try to connect to the last active session on the local machine"
+ echo "If PORT and MACHINE are given, try to connect to the remote session associated with PORT on MACHINE"
+ echo "If MACHINE is not given, try to connect to the session associated to PORT on the local machine"
+ echo "If PORT is not given, try to connect to the remote session associated to port 2810 on MACHINE"
+ echo ""
+}
+
+while getopts 'm:p:h' OPTION
+ do
+ case $OPTION in
+ m)NSHOST="$OPTARG" ;;
+ p)NSPORT="$OPTARG" ;;
+ h|?) usage
+ exit 1 ;;
+ esac
+ done
+shift $(($OPTIND - 1))
+
# --- retrieve APPLI path, relative to $HOME, set ${APPLI}
export APPLI=`${APPLI_HOME}/getAppliPath.py`
. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
-if test "x$1" == "xNSPORT"; then
- NSPORT=$2
- export NSPORT
- myhost=`hostname`
- OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${myhost}_${NSPORT}.cfg
- export OMNIORB_CONFIG
- NSHOST=${myhost}
- export NSHOST
- shift 2
-else
-
- # --- set omniORB configuration to current session if any
-
- fileOmniConfig=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg
-
- if [ -f $fileOmniConfig ]; then
- OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg
+if test "x${NSPORT}" == "xlast"; then
+ #PORT is not given
+ if test "x${NSHOST}" == "xlocalhost"; then
+ #MACHINE and PORT are not given
+ # --- set omniORB configuration to current session if any
+ fileOmniConfig=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg
+ if [ -f $fileOmniConfig ]; then
+ OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg
+ export OMNIORB_CONFIG
+ # --- set environment variables for port and hostname of NamingService
+ NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host`
+ NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port`
+ export NSPORT
+ export NSHOST
+ fi
+ else
+ #MACHINE is given PORT is not given
+ NSPORT=2810
+ OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${NSHOST}_${NSPORT}.cfg
export OMNIORB_CONFIG
-
- # --- set environment variables for port and hostname of NamingService
-
- NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host`
- export NSHOST
- NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port`
+ #if omniorb config file exists do not override (perhaps too conservative)
+ if [ ! -f ${OMNIORB_CONFIG} ]; then
+ echo "InitRef = NameService=corbaname::${NSHOST}:${NSPORT}" > ${OMNIORB_CONFIG}
+ fi
export NSPORT
+ export NSHOST
+ fi
+else
+ #PORT is given
+ if test "x${NSHOST}" == "xlocalhost"; then
+ #MACHINE is not given PORT is given
+ NSHOST=`hostname`
+ fi
+ OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${NSHOST}_${NSPORT}.cfg
+ export OMNIORB_CONFIG
+ #if omniorb config file exists do not override (perhaps too conservative)
+ if [ ! -f ${OMNIORB_CONFIG} ]; then
+ echo "InitRef = NameService=corbaname::${NSHOST}:${NSPORT}" > ${OMNIORB_CONFIG}
fi
+ export NSPORT
+ export NSHOST
fi
# --- invoke shell with or without args
#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)
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 (<module_name> section)
# which are stored in opts with key <module_name>_<parameter> (eg SMESH_plugins)
# possible choices for the "embedded" and "standalone" parameters
embedded_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "SalomeAppEngine" ]
-standalone_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "pyContainer", "supervContainer"]
+standalone_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "pyContainer"]
# values of boolean type (must be '0' or '1').
# xml_parser.boolValue() is used for correct setting
help_str = "Python script(s) to be imported. Python scripts are imported "
help_str += "in the order of their appearance. In GUI mode python scripts "
help_str += "are imported in the embedded python interpreter of current study, "
- help_str += "otherwise in an external python interpreter"
+ help_str += "otherwise in an external python interpreter. "
+ help_str += "Note: this option is obsolete. Instead you can pass Python script(s) "
+ help_str += "directly as positional parameter."
o_u = optparse.Option("-u",
"--execute",
metavar="<script1,script2,...>",
dest="gdb_session", default=False,
help=help_str)
+ # ddd session
+ help_str = "Launch session with ddd"
+ o_ddd = optparse.Option("--ddd-session",
+ action="store_true",
+ dest="ddd_session", default=False,
+ help=help_str)
+
# All options
opt_list = [o_t,o_g, # GUI/Terminal
o_d,o_o, # Desktop
o_nspl,
o_test, # Write/read test script file with help of TestRecorder
o_play, # Reproducing test script with help of TestRecorder
- o_gdb]
+ o_gdb,
+ o_ddd,
+ ]
#std_options = ["gui", "desktop", "log_file", "py_scripts", "resources",
# "xterm", "modules", "embedded", "standalone",
opt_list += theAdditionalOptions
- a_usage = "%prog [options] [STUDY_FILE]"
+ a_usage = "%prog [options] [STUDY_FILE] [PYTHON_FILE [PYTHON_FILE ...]]"
version_str = "Salome %s" % version()
pars = optparse.OptionParser(usage=a_usage, version=version_str, option_list=opt_list)
if args["session_gui"]:
if cmd_opts.splash is not None:
args[splash_nam] = cmd_opts.splash
- if len(cmd_args) > 0:
- args["study_hdf"] = cmd_args[0]
else:
args["session_gui"] = False
args[splash_nam] = False
listlist = cmd_opts.py_scripts
for listi in listlist:
args[script_nam] += re.split( "[:;,]", listi)
+ for arg in cmd_args:
+ if arg[-3:] == ".py":
+ args[script_nam].append(arg)
+ elif not args["study_hdf"]:
+ args["study_hdf"] = arg
+ pass
+ pass
# xterm
if cmd_opts.xterm is not None: args[xterm_nam] = cmd_opts.xterm
if cmd_opts.gdb_session is not None:
args[gdb_session_nam] = cmd_opts.gdb_session
+ # Ddd session in xterm
+ if cmd_opts.ddd_session is not None:
+ args[ddd_session_nam] = cmd_opts.ddd_session
+
####################################################
# Add <theAdditionalOptions> values to args
for add_opt in theAdditionalOptions:
#print "Can't create " + upath
pass
- #os.system("touch " + upath + "/dummy")
- for fname in os.listdir(upath):
- try:
- if not fname.startswith("."): os.remove(upath + "/" + fname)
- except:
- pass
- #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log")
-
if verbose(): print "Name Service... ",
#hname=os.environ["HOST"] #commands.getoutput("hostname")
if sys.platform == "win32":
#aPort=(ss.join().split(':'))[2];
#aPort=re.findall("\d+", ss[0])[0]
+ # \begin{E.A.}
+ # put the log files of omniNames in different directory with port reference,
+ # it is cleaner on linux and it is a fix for salome since it is impossible to
+ # remove the log files if the corresponding omniNames has not been killed.
+ # \end{E.A.}
+
+ upath += "/omniNames_%s"%(aPort)
+ try:
+ os.mkdir(upath)
+ except:
+ #print "Can't create " + upath
+ pass
+
+ #os.system("touch " + upath + "/dummy")
+ for fname in os.listdir(upath):
+ try:
+ os.remove(upath + "/" + fname)
+ except:
+ pass
+ #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log")
+
#aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/"
#print "sed command = ", aSedCommand
#aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"])
# --------------------------------------------------------------------------
- def waitNS(self,name,typobj=None,maxcount=60):
+ def waitNS(self,name,typobj=None,maxcount=240):
count=0
delta=0.5
print "Searching %s in Naming Service " % name,
while(1):
count += 1
- if count > maxcount : raise "Impossible de trouver %s" % name
+ if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name
obj=self.Resolve(name)
if obj :
print " found in %s seconds " % ((count-1)*delta)
try:
os.kill(thePID,0)
except:
- raise "Process %d for %s not found" % (thePID,theName)
+ raise RuntimeError, "Process %d for %s not found" % (thePID,theName)
aCount += 1
anObj = self.Resolve(theName)
if anObj:
print "Searching %s in Naming Service " % name,
while(1):
count += 1
- if count > maxcount : raise "Impossible de trouver %s" % name
+ if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name
obj=self.ResolveLogger(name)
if obj :
print " found in %s seconds " % ((count-1)*delta)
# - if the config file does not exist, it is created with default values.
#
#
-# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,SUPERV,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer,supervContainer --xterm --killall
+# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer --xterm --killall
#
# parameters from command line supersede those from SalomeApp.xml
#
# (embedded = same process) or in a separate process (standalone):
# --> registry,study,moduleCatalog,cppContainer
# Other CORBA servers could only be launched in separate process (standalone):
-# --> pyContainer,supervContainer
+# --> pyContainer
#
# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h
# help
--- /dev/null
+@REM Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE\r
+@REM\r
+@REM Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+@REM CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS\r
+@REM\r
+@REM This library is free software; you can redistribute it and/or\r
+@REM modify it under the terms of the GNU Lesser General Public\r
+@REM License as published by the Free Software Foundation; either\r
+@REM version 2.1 of the License.\r
+@REM\r
+@REM This library is distributed in the hope that it will be useful,\r
+@REM but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+@REM Lesser General Public License for more details.\r
+@REM\r
+@REM You should have received a copy of the GNU Lesser General Public\r
+@REM License along with this library; if not, write to the Free Software\r
+@REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+@REM\r
+@REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+@REM\r
+\r
+@"%PYTHONBIN%" "%KERNEL_ROOT_DIR%\bin\salome\envSalome.py" "%PYTHONBIN%" "%KERNEL_ROOT_DIR%\bin\salome\runSalome.py" %*\r
#
-runSalome --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --killall
+runSalome --gui --modules=GEOM,SMESH,VISU,MED --killall
# - if the config file does not exist, it is created with default values.
#
#
-# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,SUPERV,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer,supervContainer --xterm --killall
+# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome --modules=GEOM,SMESH,VISU,MED --embedded=registry,study,moduleCatalog,cppContainer --standalone=pyContainer --xterm --killall
#
# parameters from command line supersede those from SalomeApp.xml
#
# (embedded = same process) or in a separate process (standalone):
# --> registry,study,moduleCatalog,cppContainer
# Other CORBA servers could only be launched in separate process (standalone):
-# --> pyContainer,supervContainer
+# --> pyContainer
#
# $: ${KERNEL_ROOT_DIR}/bin/salome/runSalome -h
# help
#
# -----------------------------------------------------------------------------
# Example on CCRT (without ihm) :
-# ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --terminal --modules=MED,CALCULATOR,COMPONENT --standalone=registry,study,moduleCatalog,cppContainer,pyContainer,supervContainer --killall
+# ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --terminal --modules=MED,CALCULATOR,COMPONENT --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall
import setenv
from server import *
from launchConfigureParser import verbose
-#process_id = {} move to server.py
+from server import process_id
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
#
-# Definition des classes d'objets pour le lancement des Server CORBA
+# Class definitions to launch CORBA Servers
#
class InterpServer(Server):
self.args=args
env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("LD_LIBRARY_PATH")]
self.CMD=['xterm', '-e']+ env_ld_library_path + ['python']
- #self.CMD=['xterm', '-e', 'python']
def run(self):
global process_id
# ---
-class ContainerSUPERVServer(Server):
- def __init__(self,args):
- self.args=args
- self.initArgs()
- # if sys.platform == "win32":
-# self.CMD=[os.environ["KERNEL_ROOT_DIR"] + "/win32/" + os.environ["BIN_ENV"] + "/" + 'SALOME_Container' + ".exe",'SuperVisionContainer']
-# else:
- self.CMD=['SALOME_Container','SuperVisionContainer']
-
-# ---
-
class LoggerServer(Server):
def __init__(self,args):
self.args=args
self.SCMD2+=['CPP']
if 'pyContainer' in self.args['standalone'] or 'pyContainer' in self.args['embedded']:
self.SCMD2+=['PY']
- if 'supervContainer' in self.args['standalone']:
- self.SCMD2+=['SUPERV']
if self.args['gui']:
session_gui = True
if self.args.has_key('session_gui'):
elif self.args.has_key('play'):
self.CMD+=['-play'] + self.args['play']
- if self.args["gdb_session"]:
+ if self.args["gdb_session"] or self.args["ddd_session"]:
f = open(".gdbinit4salome", "w")
f.write("set args ")
args = " ".join(self.CMD[1:])
f.write(args)
f.write("\n")
f.close()
- self.CMD = ["xterm", "-e", "gdb", "--command=.gdbinit4salome", self.CMD[0]]
+ if self.args["ddd_session"]:
+ self.CMD = ["ddd", "--command=.gdbinit4salome", self.CMD[0]]
+ elif self.args["gdb_session"]:
+ self.CMD = ["xterm", "-e", "gdb", "--command=.gdbinit4salome", self.CMD[0]]
+ pass
pass
# ---
import SALOME
import SALOMEDS
import SALOME_ModuleCatalog
- reload(Engines)
- reload(SALOME)
- reload(SALOMEDS)
import SALOME_Session_idl
session=clt.waitNS("/Kernel/Session",SALOME.Session)
session.GetInterface()
if verbose(): print "startSalome ", args
#
- # Initialisation ORB et Naming Service
+ # Initialisation ORB and Naming Service
#
clt=orbmodule.client(args)
f.write(os.environ['NSPORT'])
f.close()
- # (non obligatoire) Lancement Logger Server
- # et attente de sa disponibilite dans le naming service
+ # Launch Logger Server (optional)
+ # and wait until it is registered in naming service
#
if args['logger']:
myServer=NotifyServer(args,modules_root_dir)
myServer.run()
- # Lancement Session Server (to show splash ASAP)
+ # Launch Session Server (to show splash ASAP)
#
if args["gui"]:
mySessionServ.run()
#
- # Lancement Registry Server,
- # attente de la disponibilite du Registry dans le Naming Service
+ # Launch Registry Server,
+ # and wait until it is registered in naming service
#
if ('registry' not in args['embedded']) | (args["gui"] == 0) :
clt.waitNSPID("/Registry",myServer.PID)
#
- # Lancement Catalog Server,
- # attente de la disponibilite du Catalog Server dans le Naming Service
+ # Launch Catalog Server,
+ # and wait until it is registered in naming service
#
-
if ('moduleCatalog' not in args['embedded']) | (args["gui"] == 0):
cataServer=CatalogServer(args)
clt.waitNSPID("/Kernel/ModulCatalog",cataServer.PID,SALOME_ModuleCatalog.ModuleCatalog)
#
- # Lancement SalomeDS Server,
- # attente de la disponibilite du SalomeDS dans le Naming Service
+ # Launch SalomeDS Server,
+ # and wait until it is registered in naming service
#
#print "ARGS = ",args
clt.waitNSPID("/myStudyManager",myServer.PID)
#
- # Lancement LauncherServer
+ # Launch LauncherServer
#
myCmServer = LauncherServer(args)
theComputer = getShortHostName()
#
- # Lancement Container C++ local,
- # attente de la disponibilite du Container C++ local dans le Naming Service
+ # Launch local C++ Container (FactoryServer),
+ # and wait until it is registered in naming service
#
if ('cppContainer' in args['standalone']) | (args["gui"] == 0) :
clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",myServer.PID)
#
- # Lancement Container Python local,
- # attente de la disponibilite du Container Python local
- # dans le Naming Service
+ # Launch local Python Container (FactoryServerPy),
+ # and wait until it is registered in naming service
#
if 'pyContainer' in args['standalone']:
clt.waitNSPID("/Containers/" + theComputer + "/FactoryServerPy",myServer.PID)
#
- # Lancement Container Supervision local,
- # attente de la disponibilite du Container Supervision local
- # dans le Naming Service
- #
-
- if 'supervContainer' in args['standalone']:
- myServer=ContainerSUPERVServer(args)
- myServer.run()
- if sys.platform == "win32":
- clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer")
- else:
- clt.waitNSPID("/Containers/" + theComputer + "/SuperVisionContainer",myServer.PID)
-
- #
- # Attente de la disponibilite du Session Server dans le Naming Service
+ # Wait until Session Server is registered in naming service
#
if args["gui"]:
import SALOME
import SALOMEDS
import SALOME_ModuleCatalog
- reload(Engines)
- reload(SALOME)
- reload(SALOMEDS)
import SALOME_Session_idl
if sys.platform == "win32":
session=clt.waitNS("/Kernel/Session",SALOME.Session)
anInterp=InterpServer(args)
anInterp.run()
- # set PYTHONINSPECT variable
+ # set PYTHONINSPECT variable (python interpreter in interactive mode)
if args['pinter']:
os.environ["PYTHONINSPECT"]="1"
import readline
"""%filedict
#
- # Impression arborescence Naming Service
+ # Print Naming Service directory list
#
if clt != None:
if toimport[ i ] == 'killall':
clt.showNS()
killAllPorts()
- import sys
sys.exit(0)
else:
scrname = toimport[ i ]
if len(scrname) > 2 and (len(scrname) - string.rfind(scrname, ".py") == 3):
print 'executing',scrname
+ sys.path.insert( 0, os.path.dirname(scrname))
execfile(scrname,globals())
+ del sys.path[0]
else:
print 'importing',scrname
doimport = 'import ' + scrname
os.remove( tmp_file );
#
def portIsUsed(port, data):
- regObj = re.compile( "tcp.*:([0-9]+).*:.*listen", re.IGNORECASE );
+ regObj = re.compile( ".*tcp.*:([0-9]+).*:.*listen", re.IGNORECASE );
for item in data:
try:
p = int(regObj.match(item).group(1))
msg = "\n"
msg += "Can't find a free port to launch omniNames\n"
msg += "Try to kill the running servers and then launch SALOME again.\n"
- raise msg
+ raise RuntimeError, msg
NSPORT=NSPORT+1
pass
return
def main():
"""Salome launch as a main application"""
- import sys
from salome_utils import getHostName
print "runSalome running on %s" % getHostName()
args, modules_list, modules_root_dir = setenv.get_config()
<plugin name="GHS3DPlugin"/>
</module>
<module name="VISU"/>
- <module name="SUPERV"/>
<module name="MED"/>
<module name="COMPONENT"/>
<module name="PYCALCULATOR"/>
</embedded-list>
<standalone-list>
<standaloneserver>pyContainer</standaloneserver>
- <standaloneserver>supervContainer</standaloneserver>
</standalone-list>
</Configuration-list>
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
# ---
-def getPortNumber():
+def getPortNumber(use_default=True):
"""
Get current naming server port number:
1. try NSPORT environment variable
1. if fails, try to parse config file defined by OMNIORB_CONFIG environment variable
- 2. if fails, return 2809 as default port number
+ 2. if fails, return 2809 as default port number (if use_default is True) or None (id use_default is False)
"""
import os
try:
pass
port = getPortFromORBcfg()
if port is not None: return port
- return 2809 # '2809' is default port number
+ if use_default: return 2809 # '2809' is default port number
+ return None
# ---
# ---
-def makeTmpDir( path ):
+def makeTmpDir( path, mode=0777 ):
"""
Make temporary directory with the specified path.
If the directory exists then clear its contents.
Parameters:
- path : absolute path to the directory to be created.
+ - mode : access mode
"""
import os
-
if os.path.exists( path ):
- os.system( "rm -rf " + path + "/*" )
+ import sys
+ if sys.platform == "win32":
+ os.system( "rmdir /S /Q " + '"' + path + '"' )
+ os.system( "mkdir " + '"' + path + '"' )
+ else:
+ os.system( "rm -rf " + path + "/*" )
+ pass
pass
else:
- os.makedirs( path, 0777 )
- pass
+ dirs = path.split("/")
+ shift1 = shift2 = 0
+ if not dirs[0]: shift1 = 1
+ if dirs[-1]: shift2 = 1
+ for i in range(1+shift1,len(dirs)+shift2):
+ p = "/".join(dirs[:i])
+ try:
+ os.mkdir(p, mode)
+ os.chmod(p, mode)
+ except:
+ pass
+ pass
+ pass
+ pass
# ---
dest.writelines( dest_lines )
dest.close()
- command = "cat " + src_file + " >> " + dest_file
+ import sys
+ if sys.platform == "win32":
+ command = "type " + '"' + src_file + '"' + " >> " + '"' + dest_file + '"'
+ else:
+ command = "cat " + src_file + " >> " + dest_file
+ pass
pass
else:
- command = "cp " + src_file + " " + dest_file
+ import sys
+ if sys.platform == "win32":
+ command = "copy " + '"' + src_file + '"' + " " + '"' + dest_file + '"' + " > nul"
+ else:
+ command = "cp " + src_file + " " + dest_file
+ pass
pass
os.system( command )
modules_list.remove("GUI")
pass
- if "SUPERV" in modules_list and not 'supervContainer' in args['standalone']:
- args['standalone'].append("supervContainer")
- pass
-
return args, modules_list, modules_root_dir
# -----------------------------------------------------------------------------
"""Add to the PATH-variables modules specific paths"""
import os
- from salome_utils import getTmpDir, generateFileName, makeTmpDir
+ from salome_utils import getTmpDir, generateFileName, makeTmpDir, getPortNumber
# create temporary directory for environment files needed by modules from the list
- tmp_dir = getTmpDir()
- env_dir = generateFileName(tmp_dir, prefix="env", with_port=True)
- makeTmpDir(env_dir)
+ port = getPortNumber(False)
+ if port:
+ tmp_dir = getTmpDir()
+ env_dir = generateFileName(tmp_dir, prefix="env", with_port=True)
+ makeTmpDir(env_dir)
+ pass
python_version="python%d.%d" % sys.version_info[0:2]
modules_root_dir_list = []
salome_subdir,
"shared_modules"),
"PYTHONPATH")
-
+
# set environment by modules from the list
- try:
- mod=__import__(module.lower()+"_setenv")
- mod.set_env(args)
- pass
- except:
+ if port:
+ try:
+ mod=__import__(module.lower()+"_setenv")
+ mod.set_env(args)
+ pass
+ except:
+ pass
pass
pass
pass
if args['logger']:
os.environ["SALOME_trace"]="with_logger"
- # set environment for SUPERV module
- os.environ["ENABLE_MACRO_NODE"]="1"
# set resources variables if not yet set
- # Done now by launchConfigureParser.py
- #if os.getenv("GUI_ROOT_DIR"):
- #if not os.getenv("SalomeAppConfig"): os.environ["SalomeAppConfig"] = os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui"
os.environ["CSF_SALOMEDS_ResourcesDefaults"] \
= os.path.join(modules_root_dir["KERNEL"],"share",
# ================================================================
#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)}'`
[],
[with_onlylauncher="no"])
AM_CONDITIONAL(WITHONLYLAUNCHER, test x$with_onlylauncher = xyes)
+if test "$with_onlylauncher" != "yes"; then
+ AC_DEFINE([HAVE_SALOME_CONFIG], [], [True if SALOMEconfig.h file is used])
+fi
# ----------------------------------------------------------------------------
echo
AC_PROG_MAKE_SET
AC_PROG_INSTALL
+AC_LOCAL_INSTALL
echo
echo ---------------------------------------------
# Testing linker
AC_LINKER_OPTIONS
+echo
+echo ---------------------------------------------
+echo testing Fortran INTEGER size for CALCIUM
+echo ---------------------------------------------
+echo
+
+CHECK_CALCIUM
+
echo
echo ---------------------------------------------
echo testing threads
CHECK_HTML_GENERATORS
# Additional conditional to avoid compilation of non-portable code
-AM_CONDITIONAL(WINDOWS, 0)
+AM_CONDITIONAL(WINDOWS, [ test ])
echo
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 \
])
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : Calcium_Ports.idl
-// Author : Eric Fayolle, EDF
-//
-#ifndef _CALCIUM_PORTS_IDL_
-#define _CALCIUM_PORTS_IDL_
-
-#include "SALOME_Ports.idl"
-
-/*! \file Calcium_Ports.idl \brief interfaces for Calcium ports
-*/
-
-module Ports {
-
-/*! \brief module that contains interfaces to define Calcium ports
-*/
- module Calcium_Ports {
-
- const long UNLIMITED_STORAGE_LEVEL = -70;
- enum DependencyType { UNDEFINED_DEPENDENCY, TIME_DEPENDENCY, ITERATION_DEPENDENCY };
- enum DateCalSchem { TI_SCHEM, TF_SCHEM , ALPHA_SCHEM};
- enum InterpolationSchem { L0_SCHEM, L1_SCHEM };
- enum ExtrapolationSchem { UNDEFINED_EXTRA_SCHEM, E0_SCHEM, E1_SCHEM};
-
- // enum DisconnectDirective {UNDEFINED_DIRECTIVE,CONTINUE,STOP};
- typedef boolean DisconnectDirective;
- const DisconnectDirective stop = FALSE;
- const DisconnectDirective cont = TRUE;
-
- interface Calcium_Port : Ports::Data_Port, Ports::PortProperties {
- void disconnect(in DisconnectDirective mode);
- };
-
- typedef sequence<long> seq_long;
- typedef sequence<float> seq_float;
- typedef sequence<double> seq_double;
- typedef sequence<string> seq_string;
- typedef sequence<boolean> seq_boolean;
- typedef seq_float seq_complex;
-
- interface Calcium_Integer_Port : Calcium_Port {
- void put (in seq_long data, in double time, in long tag);
- };
-
- interface Calcium_Real_Port : Calcium_Port {
- void put (in seq_float data, in double time, in long tag);
- };
-
- interface Calcium_Double_Port : Calcium_Port {
- void put (in seq_double data, in double time, in long tag);
- };
-
- interface Calcium_String_Port : Calcium_Port {
- void put (in seq_string data, in double time, in long tag);
- };
-
- interface Calcium_Logical_Port : Calcium_Port {
- void put (in seq_boolean data, in double time, in long tag);
- };
-
- interface Calcium_Complex_Port : Calcium_Port {
- void put (in seq_complex data, in double time, in long tag);
- };
-
- };
-};
-
-#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SALOME_Ports.idl
+// Author : Eric Fayolle, EDF
+//
+#ifndef _CALCIUM_PORTS_IDL_
+#define _CALCIUM_PORTS_IDL_
+
+#include "SALOME_Ports.idl"
+
+module Ports {
+
+ module Calcium_Ports {
+
+ const long UNLIMITED_STORAGE_LEVEL = -70;
+ enum DependencyType { UNDEFINED_DEPENDENCY, TIME_DEPENDENCY, ITERATION_DEPENDENCY };
+ enum DateCalSchem { TI_SCHEM, TF_SCHEM , ALPHA_SCHEM};
+ enum InterpolationSchem { L0_SCHEM, L1_SCHEM };
+ enum ExtrapolationSchem { UNDEFINED_EXTRA_SCHEM, E0_SCHEM, E1_SCHEM};
+
+ // enum DisconnectDirective {UNDEFINED_DIRECTIVE,CONTINUE,STOP};
+ typedef boolean DisconnectDirective;
+ const DisconnectDirective stop = FALSE;
+ const DisconnectDirective cont = TRUE;
+
+ interface Calcium_Port : Ports::Data_Port, Ports::PortProperties {
+ void disconnect(in DisconnectDirective mode);
+ };
+
+ typedef sequence<long> seq_long;
+ typedef sequence<long long> seq_long_long;
+ typedef sequence< @CALCIUM_IDL_INT_F77@ > seq_integer;
+
+ typedef sequence<float> seq_float;
+ typedef sequence<double> seq_double;
+ typedef sequence<string> seq_string;
+ typedef sequence<boolean> seq_boolean;
+ typedef seq_float seq_complex;
+
+ //Fortran int size conforming port
+ interface Calcium_Integer_Port : Calcium_Port {
+ void put (in seq_integer data, in double time, in long tag);
+ };
+
+ interface Calcium_Intc_Port : Calcium_Port {
+ void put (in seq_long data, in double time, in long tag);
+ };
+
+ interface Calcium_Long_Port : Calcium_Port {
+ void put (in seq_long_long data, in double time, in long tag);
+ };
+
+
+ interface Calcium_Real_Port : Calcium_Port {
+ void put (in seq_float data, in double time, in long tag);
+ };
+
+ interface Calcium_Double_Port : Calcium_Port {
+ void put (in seq_double data, in double time, in long tag);
+ };
+
+ interface Calcium_String_Port : Calcium_Port {
+ void put (in seq_string data, in double time, in long tag);
+ };
+
+ interface Calcium_Logical_Port : Calcium_Port {
+ void put (in seq_boolean data, in double time, in long tag);
+ };
+
+ interface Calcium_Complex_Port : Calcium_Port {
+ void put (in seq_complex data, in double time, in long tag);
+ };
+
+ };
+};
+
+#endif
#
include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-AM_CXXFLAGS = -fPIC
+AM_CXXFLAGS += -fPIC
BASEIDL_FILES = \
SALOME_Exception.idl \
nstest.idl \
DSC_Engines.idl \
SALOME_Ports.idl \
- Calcium_Ports.idl \
Palm_Ports.idl \
SALOME_PACOExtension.idl \
SALOME_ParamPorts.idl
SALOME_PACOExtension.xml SALOME_ParamPorts.xml
# This variable defines the files to be installed
-salomeidl_DATA = $(IDL_FILES)
+salomeidl_DATA = $(IDL_FILES)
+nodist_salomeidl_DATA = Calcium_Ports.idl
# Sources built from idl files
# BUILT_SOURCE = first thing done on make all
endif
idldir = $(prefix)/idl/salome
-nodist_idl_DATA = ${XML} ${IDL_PACO}
-nodist_salomeinclude_HEADERS = ${INCLUDES_PACO}
+nodist_idl_DATA = ${XML} ${IDL_PACO} Calcium_Ports.idl
+nodist_salomeinclude_HEADERS = ${INCLUDES_PACO}
BUILT_SOURCES = $(IDL_SOURCES) $(PAR) $(PAR_INCLUDES)
lib_LTLIBRARIES = libSalomeIDLKernel.la $(PAR_LIB)
nodist_libSalomeIDLKernel_la_SOURCES = $(IDL_SOURCES) $(DYNIDL_SRCS)
-libSalomeIDLKernel_la_CPPFLAGS =-I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h \
- -I$(top_builddir)/idl \
+libSalomeIDLKernel_la_CPPFLAGS =-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
libSalomeIDLKernel_la_LDFLAGS = -no-undefined -version-info=0:0:0
libSalomeIDLKernel_la_LIBADD = @CORBA_LIBS@
nodist_libSalomeParallelIDLKernel_la_SOURCES = $(PAR) $(GEN_PACO)
-libSalomeParallelIDLKernel_la_CPPFLAGS =-I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h \
- -I$(top_builddir)/idl \
+libSalomeParallelIDLKernel_la_CPPFLAGS =-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \
@PACO_INCLUDES@
libSalomeParallelIDLKernel_la_LDFLAGS = -no-undefined -version-info=0:0:0
libSalomeParallelIDLKernel_la_LIBADD = libSalomeIDLKernel.la @PACO_LIBS@
# These variables defines the building process of CORBA files
-OMNIORB_IDL = @OMNIORB_IDL@
-OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@
-OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_builddir)/salome/idl
-IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -Wba -I$(top_builddir)/salome/idl
-IDLPYFLAGS = @IDLPYFLAGS@
+IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(srcdir) -I$(top_builddir)/salome/idl
+IDLPYFLAGS = @IDLPYFLAGS@ -I$(srcdir)
# potential problem on parallel make on the following - multiple outputs
SUFFIXES = .idl .hh SK.cc
.idlSK.cc:
- $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
+ $(IDL) $(IDLCXXFLAGS) $<
SK.cc.hh:
#Dummy rule to replace the following one (for parallel make)
#.idl.hh:
-# $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $<
+# $(IDL) $(IDLCXXFLAGS) $<
if WITH_PACO_PARALLEL
%PaCO.idl %PaCO.hxx %PaCO.cxx : %.idl %.xml
- $(OMNIORB_IDL) -p@PACOPATH@/lib/python -bpaco -Wb$(top_srcdir)/idl/$*.xml,$(srcdir):@PACOPATH@/idl $(top_srcdir)/idl/$*.idl
+ $(IDL) -p@PACOPATH@/lib/python -bpaco -Wb$(top_srcdir)/idl/$*.xml,$(srcdir):@PACOPATH@/idl $(top_srcdir)/idl/$*.idl
-%.hxx: %.idl
- $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) -Wbh=.hxx -Wbs=.cxx $<
+.idl.hxx:
+ $(IDL) $(IDLCXXFLAGS) -Wbh=.hxx -Wbs=.cxx $<
endif
-install-exec-local: $(IDL_FILES:%=$(top_srcdir)/idl/%)
+install-exec-local: $(IDL_FILES:%=$(top_srcdir)/idl/%) Calcium_Ports.idl
$(INSTALL) -d $(DESTDIR)$(salomepythondir)
ls $^ | while read file; do \
- $(OMNIORB_IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \
+ $(IDL) $(IDLPYFLAGS) -C$(DESTDIR)$(salomepythondir) $$file ; \
done
if WITH_PACO_PARALLEL
ls $(top_builddir)/idl/*.idl | while read file; do \
- $(OMNIORB_IDL) $(IDLPYFLAGS) -I$(top_srcdir)/idl -I@PACOPATH@/idl -C$(DESTDIR)$(salomepythondir) $$file ; \
+ $(IDL) $(IDLPYFLAGS) -I$(top_srcdir)/idl -I@PACOPATH@/idl -C$(DESTDIR)$(salomepythondir) $$file ; \
done
endif
rm -rf $(DESTDIR)$(salomepythondir)/*
mostlyclean-local:
- -rm -f *.hh *.cc .depidl
+ -rm -f *.hh *.cc .depidl Calcium_Ports.idl
# we use cpp to generate dependencies between idl files.
# option x c tells the preprocessor to consider idl as a c file.
# if an idl is modified, all idl dependencies are rebuilt
-.depidl: $(IDL_FILES)
+.depidl: $(IDL_FILES) Calcium_Ports.idl
@echo "" > $@
@for dep in $^ dummy; do \
if [ $$dep != "dummy" ]; then \
-include .depidl
-CLEANFILES = *PaCO* *.hxx *.cxx
+CLEANFILES = *PaCO* *.hxx *.cxx Calcium_Ports.idl
+
#include "SALOME_GenericObj.idl"
/*! \brief
- This package contains the interfaces used for creation, managment
+ This package contains the interfaces used for creation, management
and modification of the %Study
*/
module SALOMEDS
any value;
};
+ //! Structure data type to hold reference on data
+ struct dataref
+ {
+ string ref;
+ };
+
typedef sequence<KeyValuePair> FieldsDict;
interface Component ;
//! Determines whether the server has already been loaded or not.
void ping();
-//
-// Set study associated to component instance
-// \param studyId
-// (=0: multistudy component instance,
-// >0: study id associated to this instance
-// \return false if already set with a different value (change not possible)
-//
-// boolean setStudyId(in long studyId);
-
//! Get study associated to component instance
/*!
get study associated to component instance
<sequence name="intvec" content="int"/>
<sequence name="stringvec" content="string"/>
<sequence name="boolvec" content="bool"/>
+ <struct name="dataref" >
+ <member name="ref" type="string"/>
+ </struct>
<objref name="CALCIUM_integer" id="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0"/>
<objref name="CALCIUM_real" id="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"/>
<objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
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)
SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl)
ENDIF(WINDOWS)
+SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4)
+
# SET(PLATFORM_CPPFLAGS)
# # # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT -D_CRT_SECURE_NO_WARNINGS)
# # SET(RM del)
# ----
IF(PYTHON_STATUS)
+ SET(PYTHON_CPPFLAGS ${PYTHON_INCLUDES})
ELSE(PYTHON_STATUS)
IF(PYTHON_IS_MANDATORY)
MESSAGE(FATAL_ERROR "python not found ... mandatory ... abort")
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
# --
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("""
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)
""")
elif self.module == "med":
newlines.append("""
SET(MED_ENABLE_KERNEL ON)
+ IF(NOT WINDOWS)
+ SET(MED_ENABLE_SPLITTER ON)
+ ENDIF(NOT WINDOWS)
SET(MED_ENABLE_GUI ON)
""")
pass
SET(BLSURFPLUGIN_ENABLE_GUI ON)
""")
pass
+ elif self.module == "ghs3dplugin":
+ newlines.append("""
+ SET(GHS3DPLUGIN_ENABLE_GUI ON)
+ """)
+ pass
+ elif self.module == "yacs":
+ newlines.append("""
+ SET(SALOME_KERNEL ON)
+ SET(HAS_GUI ON)
+ """)
+ pass
# --
pass
# --
SET(AM_CXXFLAGS)
SET(LDADD)
""")
+ if self.module == "kernel":
+ newlines.append(r'''
+ SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h)
+ SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h)
+ ''')
+ else:
+ if self.module not in ["yacs"]:
+ newlines.append(r'''
+ SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h)
+ SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h)
+ ''')
+ pass
+ pass
# --
return
# --
# --
- for key in ["bin_PROGRAMS"]:
+ for key in ["bin_PROGRAMS", "check_PROGRAMS"]:
if self.__thedict__.has_key(key):
self.addBinTarget(key, newlines)
pass
key = "IDL_FILES"
if self.__thedict__.has_key(key):
+ if self.module == "kernel":
+ newlines.append('''
+ SET(IDL_FILES ${IDL_FILES} Calcium_Ports.idl)
+ ''')
+ pass
newlines.append('''
FOREACH(input ${IDL_FILES})
STRING(REGEX REPLACE ".idl" "" base ${input})
SET(outputs ${src})
SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc)
SET(outputs ${outputs} ${dynsrc})
+ IF(input STREQUAL Calcium_Ports.idl)
+ SET(input ${CMAKE_CURRENT_BINARY_DIR}/${input})
+ ELSE(input STREQUAL Calcium_Ports.idl)
+ SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
+ ENDIF(input STREQUAL Calcium_Ports.idl)
+ SET(flags ${IDLCXXFLAGS} ${OMNIORB_IDLCXXFLAGS})
+ STRING(REGEX MATCH "-bcxx" ISBCXX ${flags})
+ IF(NOT ISBCXX)
+ SET(flags -bcxx ${flags})
+ ENDIF(NOT ISBCXX)
ADD_CUSTOM_COMMAND(
OUTPUT ${outputs}
- COMMAND ${OMNIORB_IDL} ${IDLCXXFLAGS} ${OMNIORB_IDLCXXFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${input}
+ COMMAND ${OMNIORB_IDL} ${flags} ${input}
MAIN_DEPENDENCY ${input}
)
install(FILES ${input} DESTINATION idl/salome)
FOREACH(f ${IDLPYFLAGS})
SET(flags "${flags} ${f}")
ENDFOREACH(f ${IDLPYFLAGS})
+ STRING(REGEX MATCH "-bpython" ISBPYTHON ${flags})
+ IF(NOT ISBPYTHON)
+ SET(flags "-bpython ${flags}")
+ ENDIF(NOT ISBPYTHON)
SET(IDLPYFLAGS ${flags})
STRING(REPLACE "\\\\" "/" IDLPYFLAGS ${IDLPYFLAGS})
INSTALL(CODE "SET(IDLPYFLAGS ${IDLPYFLAGS})")
''')
pass
+ # --
+ # --
+ if self.__thedict__.has_key("BUILT_SOURCES"):
+ newlines.append('''
+ FOREACH(f ${BUILT_SOURCES})
+ IF(f MATCHES "WRAP.cxx$")
+ # STRING(REGEX REPLACE "WRAP.cxx" "WRAP.h" inc ${f})
+ STRING(REGEX REPLACE "WRAP.cxx" ".i" input ${f})
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${f} # ${inc}
+ COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} ${SWIG_PYTHON_INCLUDES} ${MYSWIG_FLAGS} -o ${f} ${CMAKE_CURRENT_SOURCE_DIR}/${input}
+ MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${input}
+ )
+ ENDIF(f MATCHES "WRAP.cxx$")
+ ENDFOREACH(f ${BUILT_SOURCES})
+ ''')
+ pass
+
# --
# --
key = "MOC_FILES"
"nodist_salomescript_DATA" : "bin/salome",
"salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome",
"nodist_salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome",
+ "dist_salomepython_DATA" : "lib/python${PYTHON_VERSION}/site-packages/salome",
"sharedpkgpython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome/shared_modules",
}
if self.module == "medfile":
# --
newlines.append(r'''
SET(libs ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS})
- IF(name STREQUAL SALOMEBasics)
+ FOREACH(lib SALOMEBasics SalomeBatch)
+ IF(name STREQUAL lib)
SET(libs ${libs} ${PTHREAD_LIBS})
- ENDIF(name STREQUAL SALOMEBasics)
+ ENDIF(name STREQUAL lib)
+ ENDFOREACH(lib SALOMEBasics SalomeBatch)
''')
if key == "bin_PROGRAMS":
newlines.append(r'''
GET_FILENAME_COMPONENT(ext ${lib} EXT)
IF(ext STREQUAL .la)
GET_FILENAME_COMPONENT(lib ${lib} NAME_WE)
- STRING(REPLACE "lib" "" lib ${lib})
+ STRING(REGEX REPLACE "^lib" "" lib ${lib})
ENDIF(ext STREQUAL .la)
SET(vars)
SET(vars ${vars} -no-undefined)
+ SET(vars ${vars} -lvtkWidgets)
IF(WINDOWS)
SET(vars ${vars} -module)
SET(vars ${vars} -Wl,-E)
SET(vars ${vars} -lm)
SET(vars ${vars} -lboost_thread)
SET(vars ${vars} -lboost_signals)
- SET(vars ${vars} -lvtkWidgets)
ENDIF(WINDOWS)
FOREACH(v ${vars})
IF(lib STREQUAL v)
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)
SET(dir $ENV{F2CHOME})
STRING(REPLACE "\\\\" "/" dir ${dir})
SET(var ${var} -I${dir})
+ SET(var ${var} -DF2C_BUILD)
ENDIF(name STREQUAL ${target})
ENDFOREACH(target ${targets})
ENDIF(WINDOWS)
SET(var ${var} -I${CMAKE_CURRENT_BINARY_DIR})
''')
pass
- if key == "bin_PROGRAMS":
+ newlines.append(r'''
+ SET(var ${var} ${AM_CPPFLAGS})
+ SET(var ${var} ${AM_CXXFLAGS})
+ ''')
+ if self.module == "yacs":
newlines.append(r'''
- SET(var ${var} ${AM_CPPFLAGS})
- SET(var ${var} ${AM_CXXFLAGS})
+ SET(var ${var} -DYACS_PTHREAD)
+ SET(var ${var} -DCMAKE_BUILD)
''')
pass
newlines.append(r'''
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})
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)
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
def addBinTarget(self, key, newlines):
# --
newlines.append(r'''
- FOREACH(amname ${bin_PROGRAMS})
+ FOREACH(amname ${bin_PROGRAMS} ${check_PROGRAMS})
''')
# --
newlines.append(r'''
''')
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
SET(FULLDIR ${CMAKE_INSTALL_PREFIX}/${DIR})
FILE(MAKE_DIRECTORY ${FULLDIR})
MESSAGE(STATUS "Compiling ${IDL_FILE} into ${FULLDIR}")
-EXECUTE_PROCESS(COMMAND ${OMNIORB_IDL_PYTHON} ${IDLPYFLAGS} -C${FULLDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${IDL_FILE})
+EXECUTE_PROCESS(COMMAND ${OMNIORB_IDL_PYTHON} ${IDLPYFLAGS} -C${FULLDIR} ${IDL_FILE})
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#ifndef SALOME_CONFIG_H
-#define SALOME_CONFIG_H
-
-#define DEBUG
+/* Debug mode ??? */
+#ifndef DEBUG
+# define DEBUG
+#endif
-#define QUOTE(x) #x
-#define CORBA_CLIENT_HEADER(x) QUOTE(x@IDL_CLN_H@)
-#define CORBA_SERVER_HEADER(x) QUOTE(x@IDL_SRV_H@)
+/* CORBA headers include rules */
+#ifndef CORBA_CLIENT_HEADER
+# define QUOTE(x) #x
+# define CORBA_CLIENT_HEADER(x) QUOTE(x@IDL_CLN_H@)
+# define CORBA_SERVER_HEADER(x) QUOTE(x@IDL_SRV_H@)
+#endif
+/* Platform definition */
#ifndef @MACHINE@
#define @MACHINE@
#endif
-
/* A path to a rcp-like command */
-#define RCP "@RCP@"
+#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
#ifdef PACKAGE_VERSION
#undef PACKAGE_VERSION
#endif
+#ifdef VERSION
+#undef VERSION
+#endif
#ifdef _POSIX_C_SOURCE
#undef _POSIX_C_SOURCE
#endif
-
-#endif
ac_cxx_use_std_iostream.m4 \
ac_cxx_warnings.m4 \
ac_linker_options.m4 \
+ac_check_sizeof_fortran.m4 \
acx_pthread.m4 \
check_Kernel.m4 \
check_boost.m4 \
check_corba.m4 \
check_cppunit.m4 \
check_f77.m4 \
+check_calcium.m4 \
check_hdf5.m4 \
check_htmlgen.m4 \
check_lam.m4 \
python.m4 \
check_libxml.m4 \
check_local.m4 \
-check_paco++.m4
+check_paco++.m4 \
+local_install.m4
dist_salome4depr_DATA=\
$(DEPRECATED_FILES)
--- /dev/null
+AC_DEFUN([AC_CHECK_SIZEOF_FORTRAN], [
+ AC_REQUIRE([AC_F77_WRAPPERS])
+ AC_CACHE_CHECK([size of Fortran [$1]], [ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])],[
+ AC_LANG_SAVE()
+ AC_LANG([Fortran 77])
+ AC_COMPILE_IFELSE([
+ AC_LANG_SOURCE([
+ subroutine fsize()
+ $1 i(2)
+ call csize(i(1), i(2))
+ end
+ ])
+ ],[
+ AC_LANG([C])
+ cp conftest.$ac_objext conftestf.$ac_objext
+ old_LDFLAGS="$LDFLAGS"
+ LDFLAGS="conftestf.$ac_objext $LDFLAGS"
+#"$ac_cv_f77_libs"
+ AC_TRY_RUN([
+# include <stdio.h>
+# define CSIZE F77_FUNC(csize,CSIZE)
+# define FSIZE F77_FUNC(fsize,FSIZE)
+ static long size_val;
+ /* Called by Fortran */
+ void CSIZE (i1p, i2p)
+ char *i1p, *i2p;
+ {
+ size_val = (i2p - i1p);
+ }
+ main() {
+ FILE *f=fopen ("conftestval","w");
+ if (!f) return 1;
+ /* Call the Fortran function */
+ FSIZE ();
+ fprintf (f, "%d\n", size_val);
+ return 0;
+ }
+ ])
+ LDFLAGS="$old_LDFLAGS"
+ ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])=`cat conftestval`
+ rm -f conftestval conftestf.$ac_objext
+ ])
+ AC_LANG_RESTORE()
+ ])
+ AC_DEFINE_UNQUOTED(SIZEOF_FORTRAN_[]translit($1, [a-z *], [A-Z_p]),
+ [$ac_cv_sizeof_fortran_[]translit($1, [A-Z *], [a-z_p])],
+ [The size of a Fortran `$1', as computed by sizeof.])
+
+])
dnl @version $Id$
dnl @author Marc Tajchman
dnl
-AC_DEFUN([AC_DEPEND_FLAG],
-[AC_CACHE_CHECK(which flag for dependency information generation,
-ac_cv_depend_flag,
-[AC_LANG_SAVE
+AC_DEFUN([AC_DEPEND_FLAG],[
+ AC_MSG_CHECKING([which flag for dependency information generation])
+ AC_LANG_SAVE
AC_LANG_C
echo "conftest.o: conftest.c" > conftest.verif
echo "int main() { return 0; }" > conftest.c
printf " C++ : ${DEPCXX} ${CXX_DEPEND_FLAG}"
AC_LANG_RESTORE
+ AC_MSG_RESULT([ ... done])
+
AC_SUBST(DEPCC)
AC_SUBST(DEPCXX)
AC_SUBST(DEPCXXFLAGS)
AC_SUBST(CXX_DEPEND_FLAG)
AC_SUBST(MACHINE)
])
-])
dnl modified by Marc Tajchman (CEA) - 10/10/2002
dnl
-AC_DEFUN([AC_CXX_HAVE_SSTREAM],
-[AC_CACHE_CHECK(whether the compiler has stringstream,
-HAVE_SSTREAM,
-[AC_REQUIRE([AC_CXX_NAMESPACES])
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <sstream>
-#ifdef HAVE_NAMESPACES
-using namespace std;
-#endif],[stringstream message; message << "Hello"; return 0;],
- HAVE_SSTREAM=yes, HAVE_SSTREAM=no)
- AC_LANG_RESTORE
-])
-AC_SUBST(HAVE_SSTREAM)
+AC_DEFUN([AC_CXX_HAVE_SSTREAM],[
+ AC_CACHE_CHECK([whether the compiler has stringstream],
+ [ac_cv_prog_cxx_have_sstream],
+ [ac_cv_prog_cxx_have_sstream=no
+ AC_REQUIRE([AC_CXX_NAMESPACES])
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([
+ #include <sstream>
+ #ifdef HAVE_NAMESPACES
+ using namespace std;
+ #endif
+ ],
+ [stringstream message; message << "Hello"; return 0;],
+ [ac_cv_prog_cxx_have_sstream=yes],[ac_cv_prog_cxx_have_sstream=no])
+ AC_LANG_RESTORE
+ ])
+ HAVE_SSTREAM=$ac_cv_prog_cxx_have_sstream
+ AC_SUBST(HAVE_SSTREAM)
])
--- /dev/null
+AC_DEFUN([CHECK_CALCIUM], [
+
+## Guess where as cal_int type is provided by --with-cal_int option
+## or auto-detection must be used
+
+AC_ARG_WITH([cal_int],
+ AC_HELP_STRING([--with-cal_int=<C type>],
+ [Use <C type> for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.]),
+ [],
+ [withval=no])
+
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(int)
+
+if test "x$withval" = "xno"
+then
+ AC_REQUIRE([CHECK_F77])
+ AC_CHECK_SIZEOF_FORTRAN(integer)
+
+ if test "x$ac_cv_sizeof_fortran_integer" = "x8" ; then
+ AC_DEFINE(HAVE_F77INT64,[],
+ [The size of a Fortran integer, as computed by sizeof.])
+ test "x$ac_cv_sizeof_long" = "x8" || AC_MSG_ERROR([Size of C type long expected to be eight bytes])
+ LONG_OR_INT="long"
+ CALCIUM_IDL_INT_F77="long long"
+ CALCIUM_CORBA_INT_F77="CORBA::LongLong"
+ elif test "x$ac_cv_sizeof_fortran_integer" = "x4" ; then
+ test "x$ac_cv_sizeof_int" = "x4" || AC_MSG_ERROR([Size of C type int expected to be four bytes])
+ LONG_OR_INT="int"
+ CALCIUM_IDL_INT_F77="long"
+ CALCIUM_CORBA_INT_F77="CORBA::Long"
+ else
+ AC_MSG_ERROR([Size of Fortran type integer is neither four nor eigth bytes])
+ fi
+
+elif test "x$withval" = "xint"
+then
+ LONG_OR_INT="int"
+ CALCIUM_IDL_INT_F77="long"
+ CALCIUM_CORBA_INT_F77="CORBA::Long"
+ AC_MSG_NOTICE([Using C type int for cal_int])
+
+elif test "x$withval" = "xlong"
+then
+ LONG_OR_INT="long"
+ CALCIUM_IDL_INT_F77="long long"
+ CALCIUM_CORBA_INT_F77="CORBA::LongLong"
+ AC_MSG_NOTICE([Using C type long for cal_int])
+else
+ AC_MSG_ERROR([Fortran type integer must be mapped to C type int or C type long])
+fi
+
+AC_SUBST(CALCIUM_IDL_INT_F77)
+AC_SUBST(CALCIUM_CORBA_INT_F77)
+AC_SUBST(LONG_OR_INT)
+AC_DEFINE_UNQUOTED([CAL_INT],[$LONG_OR_INT],
+ [The C type to be used for mapping a Fortran integer in C within CALCIUM C/F77 interfaces.])
+])
AC_DEFUN([CHECK_F77],[
AC_PROG_F77
-
AC_F77_LIBRARY_LDFLAGS
AC_F77_WRAPPERS
--- /dev/null
+dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+dnl
+dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+dnl ---
+dnl File : local_install.m4
+dnl Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+dnl ---
+dnl
+
+dnl The purpose of below autoconf macro is to generate custom install script
+dnl to be used instead of global /usr/bin/install one.
+dnl The difference is that resulting install script does not install file passed
+dnl as parameter if its target copy exists and the file is not changed, i.e
+dnl source and target files are the identical.
+dnl The check is performed by the diff command.
+
+AC_DEFUN([AC_LOCAL_INSTALL],
+[
+GLOBAL_INSTALL=$INSTALL
+absdir=`pwd`
+INSTALL=${absdir}/local-install.sh
+cat > ${INSTALL} << EOF
+#!/bin/sh
+
+nb_args=\$[#]
+args=\$[*]
+if test \$nb_args -gt 1 ; then
+ nb=\$(expr \$nb_args - 2)
+ shift \$nb
+ target=\$[2]
+ if test -f \$target ; then
+ orig=\$[1]
+ if test -f \$orig ; then
+ diff \$orig \$target > /dev/null 2>&1
+ if test \$[?] = 0 ; then
+ echo \$orig and \$target are identical
+ exit 0
+ fi
+ fi
+ fi
+fi
+${GLOBAL_INSTALL} \$args
+EOF
+chmod +x ${INSTALL}
+AC_SUBST(INSTALL)
+AC_SUBST(GLOBAL_INSTALL)
+])dnl
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
+# ============================================================
+# The following is to avoid PACKAGE_... env variable
+# redefinition compilation warnings
+# ============================================================
+if !WITHONLYLAUNCHER
+ AM_CXXFLAGS = -I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h
+ AM_CPPFLAGS = -I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h
+else WITHONLYLAUNCHER
+ AM_CXXFLAGS =
+ AM_CPPFLAGS =
+endif
+
# ============================================================
# This file defines the common definitions used in several
# Makefile. This file must be included, if needed, by the file
*
*/
-#ifdef HAVE_CONFIG_H
+#ifdef HAVE_SALOME_CONFIG
# include <SALOMEconfig.h>
#endif
*
*/
-#ifdef HAVE_CONFIG_H
+#ifdef HAVE_SALOME_CONFIG
# include <SALOMEconfig.h>
#endif
*
*/
-#ifdef HAVE_CONFIG_H
+#ifdef HAVE_SALOME_CONFIG
# include <SALOMEconfig.h>
#endif
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)
#
Batch_Job_Local.cxx \
Batch_IOMutex.cxx
-if !WITHONLYLAUNCHER
- LIB_CPPFLAGS += -DHAVE_CONFIG_H
-endif
-
endif
#
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
//=============================================================================
Engines_Component_i::Engines_Component_i(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),
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") ;
}
#endif
{
if ( _Sleeping )
- {
- return false ;
- }
+ {
+ return false ;
+ }
else
{
#ifndef WIN32
- RetVal = Killer( _ThreadId ,SIGINT ) ;
+ RetVal = Killer( _ThreadId ,SIGINT ) ;
#else
- RetVal = Killer( *_ThreadId ,SIGINT ) ;
+ RetVal = Killer( *_ThreadId ,SIGINT ) ;
#endif
- //if ( RetVal ) _Sleeping = true;
+ //if ( RetVal ) _Sleeping = true;
}
}
{
if ( _Sleeping )
{
- _Sleeping = false ;
- RetVal = true ;
+ _Sleeping = false ;
+ RetVal = true ;
}
else
{
- RetVal = false ;
+ RetVal = false ;
}
}
return RetVal ;
#else
if ( pthread_self().p != _ThreadId->p )
#endif
- {
+ {
if ( _Sleeping )
- {
- }
+ {
+ }
else
- {
- // Get Cpu in the appropriate thread with that object !...
- theEngines_Component = this ;
+ {
+ // Get Cpu in the appropriate thread with that object !...
+ theEngines_Component = this ;
#ifndef WIN32
- Killer( _ThreadId ,SIGUSR1 ) ;
+ Killer( _ThreadId ,SIGUSR1 ) ;
#else
- Killer( *_ThreadId ,SIGUSR11 ) ;
+ Killer( *_ThreadId ,SIGUSR11 ) ;
#endif
- }
+ }
cpu = _ThreadCpuUsed ;
- }
+ }
else
- {
- _ThreadCpuUsed = CpuUsed() ;
- cpu = _ThreadCpuUsed ;
- // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
- // << _serviceName << " " << cpu << endl ;
+ {
+ _ThreadCpuUsed = CpuUsed() ;
+ cpu = _ThreadCpuUsed ;
+ // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
+ // << _serviceName << " " << cpu << endl ;
}
}
else
{
- cpu = _ThreadCpuUsed ;
- // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
- // << _serviceName << " " << cpu<< endl ;
+ cpu = _ThreadCpuUsed ;
+ // cout << pthread_self() << " Engines_Component_i::CpuUsed_impl "
+ // << _serviceName << " " << cpu<< endl ;
}
}
else
{
#ifndef WIN32
MESSAGE(pthread_self() << "Send BeginService notification for " <<serviceName
- << endl << "Component instance : " << _instanceName << endl << endl);
+ << endl << "Component instance : " << _instanceName << endl << endl);
#else
MESSAGE(pthread_self().p << "Send BeginService notification for " <<serviceName
- << endl << "Component instance : " << _instanceName << endl << endl);
+ << endl << "Component instance : " << _instanceName << endl << endl);
#endif
+ std::cerr << "beginService for " << serviceName << " Component instance : " << _instanceName << std::endl;
#ifndef WIN32
_ThreadId = pthread_self() ;
#else
{
std::string cle((*it).first);
if ((*it).second.type()->kind() == CORBA::tk_string)
- {
- const char* value;
- (*it).second >>= value;
- // ---todo: replace __GNUC__ test by an autoconf macro AC_CHECK_FUNC.
+ {
+ 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: "<<cle<<" = "<< value);
- }
+ MESSAGE("--- setenv: "<<cle<<" = "<< value);
+ }
}
}
if ( !_CanceledThread )
_ThreadCpuUsed = CpuUsed_impl() ;
+ float cpus=_ThreadCpuUsed/1000.;
+ std::cerr << "endService for " << serviceName << " Component instance : " << _instanceName ;
+ std::cerr << " Cpu Used: " << cpus << " (s) " << std::endl;
#ifndef WIN32
MESSAGE(pthread_self() << " Send EndService notification for " << serviceName
- << endl << " Component instance : " << _instanceName << " StartUsed "
+ << endl << " Component instance : " << _instanceName << " StartUsed "
<< _StartUsed << " _ThreadCpuUsed "<< _ThreadCpuUsed << endl <<endl);
#else
MESSAGE(pthread_self().p << " Send EndService notification for " << serviceName
- << endl << " Component instance : " << _instanceName << " StartUsed "
+ << endl << " Component instance : " << _instanceName << " StartUsed "
<< _StartUsed << " _ThreadCpuUsed "<< _ThreadCpuUsed << endl <<endl);
#endif
_ThreadId = 0 ;
#endif
{
if ( signum == 0 )
- {
- if ( pthread_cancel( ThreadId ) )
- {
- perror("Killer pthread_cancel error") ;
- return false ;
- }
- else
- {
+ {
+ if ( pthread_cancel( ThreadId ) )
+ {
+ perror("Killer pthread_cancel error") ;
+ return false ;
+ }
+ else
+ {
#ifndef WIN32
- MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
- << " pthread_canceled") ;
+ MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
+ << " pthread_canceled") ;
#else
MESSAGE(pthread_self().p << "Killer : ThreadId " << ThreadId.p
- << " pthread_canceled") ;
+ << " pthread_canceled") ;
#endif
- }
- }
+ }
+ }
else
- {
- if ( pthread_kill( ThreadId , signum ) == -1 )
- {
- perror("Killer pthread_kill error") ;
- return false ;
- }
- else
- {
+ {
+ if ( pthread_kill( ThreadId , signum ) == -1 )
+ {
+ perror("Killer pthread_kill error") ;
+ return false ;
+ }
+ else
+ {
#ifndef WIN32
MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
- << " pthread_killed(" << signum << ")") ;
+ << " pthread_killed(" << signum << ")") ;
#else
MESSAGE(pthread_self().p << "Killer : ThreadId " << ThreadId.p
- << " pthread_killed(" << signum << ")") ;
+ << " pthread_killed(" << signum << ")") ;
#endif
- }
- }
+ }
+ }
}
return true ;
}
if ( _ThreadId || _Executed )
{
if ( getrusage( RUSAGE_SELF , &usage ) == -1 )
- {
- perror("Engines_Component_i::CpuUsed") ;
- return 0 ;
- }
- cpu = usage.ru_utime.tv_sec - _StartUsed ;
+ {
+ perror("Engines_Component_i::CpuUsed") ;
+ return 0 ;
+ }
+ //cpu time is calculated in millisecond (user+system times)
+ cpu = usage.ru_utime.tv_sec*1000 +usage.ru_utime.tv_usec/1000;
+ cpu = cpu+ usage.ru_stime.tv_sec*1000 +usage.ru_stime.tv_usec/1000;
+ cpu=cpu-_StartUsed ;
// cout << pthread_self() << " Engines_Component_i::CpuUsed " << " "
// << _serviceName << usage.ru_utime.tv_sec << " - " << _StartUsed
// << " = " << cpu << endl ;
// << _StartUsed << endl ;
}
#else
- // NOT implementet yet
+ // NOT implementet yet
#endif
//=============================================================================
void Engines_Component_i::sendMessage(const char *event_type,
- const char *message)
+ const char *message)
{
_notifSupplier->Send(_graphName.c_str(), _nodeName.c_str(), event_type, message);
}
//=============================================================================
Engines::TMPFile* Engines_Component_i::DumpPython(CORBA::Object_ptr theStudy,
- CORBA::Boolean isPublished,
- CORBA::Boolean& isValidScript)
+ CORBA::Boolean isPublished,
+ CORBA::Boolean& isValidScript)
{
const char* aScript = "def RebuildData(theStudy): pass";
char* aBuffer = new char[strlen(aScript)+1];
Engines::Salome_file_ptr
Engines_Component_i::getInputFileToService(const char* service_name,
- const char* Salome_file_name)
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we throw an exception.
_Service_file_map_it = _Input_Service_file_map.find(service_name);
Engines::Salome_file_ptr
Engines_Component_i::setInputFileToService(const char* service_name,
- const char* Salome_file_name)
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we add it.
_Service_file_map_it = _Input_Service_file_map.find(service_name);
Engines::Salome_file_ptr
Engines_Component_i::getOutputFileToService(const char* service_name,
- const char* Salome_file_name)
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we throw an exception.
_Service_file_map_it = _Output_Service_file_map.find(service_name);
Engines::Salome_file_ptr
Engines_Component_i::setOutputFileToService(const char* service_name,
- const char* Salome_file_name)
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we add it.
_Service_file_map_it = _Output_Service_file_map.find(service_name);
//=============================================================================
void
Engines_Component_i::configureSalome_file(std::string service_name,
- std::string file_port_name,
- Salome_file_i * file)
+ std::string file_port_name,
+ Salome_file_i * file)
{
// By default this method does nothing
}
map<std::string, void *> Engines_Container_i::_toRemove_map;
omni_mutex Engines_Container_i::_numInstanceMutex ;
+static PyObject* _pyCont;
+
+int checkifexecutable(const std::string&);
+int findpathof(std::string&, const std::string&);
+
/*! \class Engines_Container_i
* \brief C++ implementation of Engines::Container interface
*
if (!_isSupervContainer)
{
-#ifdef WIN32
-
- PyEval_AcquireLock();
- PyThreadState *myTstate = PyThreadState_New(KERNEL_PYTHON::_interp);
- PyThreadState *myoldTstate = PyThreadState_Swap(myTstate);
-#else
- Py_ACQUIRE_NEW_THREAD;
-#endif
+ PyGILState_STATE gstate = PyGILState_Ensure();
#ifdef WIN32
// mpv: this is temporary solution: there is a unregular crash if not
#endif
PyRun_SimpleString("import SALOME_Container\n");
PyRun_SimpleString((char*)myCommand.c_str());
- Py_RELEASE_NEW_THREAD;
+ PyObject *mainmod = PyImport_AddModule("__main__");
+ PyObject *globals = PyModule_GetDict(mainmod);
+ _pyCont = PyDict_GetItemString(globals, "pyCont");
+
+ PyGILState_Release(gstate);
}
fileTransfer_i* aFileTransfer = new fileTransfer_i();
// ignore this entry and continue
}
}
+ _listInstances_map.clear();
_NS->Destroy_FullDirectory(_containerName.c_str());
_NS->Destroy_Name(_containerName.c_str());
- //_remove_ref();
- //_poa->deactivate_object(*_id);
if(_isServantAloneInProcess)
{
MESSAGE("Effective Shutdown of container Begins...");
{
string path( getenv("PATH") );
if ( path.size() == 0 )
- return 0;
-
+ return 0;
+
char path_spr =
#ifdef WIN32
';';
return true;
}
+ std::string retso="";
#ifndef WIN32
void* handle;
handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
+ if ( !handle )retso=dlerror();
#else
HINSTANCE handle;
handle = LoadLibrary( impl_name.c_str() );
// --- try import Python component
INFOS("try import Python component "<<componentName);
+ std::string retpy;
if (_isSupervContainer)
{
INFOS("Supervision Container does not support Python Component Engines");
}
else
{
- Py_ACQUIRE_NEW_THREAD;
- PyObject *mainmod = PyImport_AddModule("__main__");
- PyObject *globals = PyModule_GetDict(mainmod);
- PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
- PyObject *result = PyObject_CallMethod(pyCont,
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject *result = PyObject_CallMethod(_pyCont,
(char*)"import_component",
(char*)"s",componentName);
- int ret= PyInt_AsLong(result);
+
+ retpy=PyString_AsString(result);
Py_XDECREF(result);
- SCRUTE(ret);
- Py_RELEASE_NEW_THREAD;
+ SCRUTE(retpy);
+ PyGILState_Release(gstate);
- if (ret) // import possible: Python component
+ if (retpy=="") // import possible: Python component
{
_numInstanceMutex.lock() ; // lock to be alone (stl container write)
- _library_map[aCompName] = (void *)pyCont; // any non O value OK
+ _library_map[aCompName] = (void *)_pyCont; // any non O value OK
_numInstanceMutex.unlock() ;
MESSAGE("import Python: "<<aCompName<<" OK");
return true;
INFOS( "Impossible to load component: " << componentName );
INFOS( "Can't load shared library: " << impl_name );
+ std::cerr << retso << std::endl;
INFOS( "Can't import Python module: " << componentName );
+ std::cerr << retpy << std::endl;
INFOS( "Can't execute program: " << executable );
return false;
}
string component_registerName =
_containerName + "/" + instanceName;
- Py_ACQUIRE_NEW_THREAD;
- PyObject *mainmod = PyImport_AddModule("__main__");
- PyObject *globals = PyModule_GetDict(mainmod);
- PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
- PyObject *result = PyObject_CallMethod(pyCont,
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject *result = PyObject_CallMethod(_pyCont,
(char*)"create_component_instance",
(char*)"ssl",
aCompName.c_str(),
string iors = PyString_AsString(result);
Py_DECREF(result);
SCRUTE(iors);
- Py_RELEASE_NEW_THREAD;
+ PyGILState_Release(gstate);
if( iors!="" )
{
Engines_Component_i *servant =
dynamic_cast<Engines_Component_i*>(_poa->reference_to_servant(iobject));
ASSERT(servant);
- //SCRUTE(servant->pd_refCount);
- servant->_remove_ref(); // compensate previous id_to_reference
- //SCRUTE(servant->pd_refCount);
+ //SCRUTE(servant->_refcount_value());
_numInstanceMutex.lock() ; // lock to be alone (stl container write)
_listInstances_map[instanceName] = iobject;
_cntInstances_map[aGenRegisterName] += 1;
_numInstanceMutex.unlock() ;
SCRUTE(aGenRegisterName);
SCRUTE(_cntInstances_map[aGenRegisterName]);
- //SCRUTE(servant->pd_refCount);
-#if defined(_DEBUG_) || defined(_DEBUG)
- bool ret_studyId = servant->setStudyId(studyId);
- ASSERT(ret_studyId);
-#else
servant->setStudyId(studyId);
-#endif
+ servant->_remove_ref(); // do not need servant any more (remove ref from reference_to_servant)
+ //SCRUTE(servant->_refcount_value());
// --- register the engine under the name
// containerName(.dir)/instanceName(.object)
#ifndef WIN32
struct sigaction SigIntAct ;
SigIntAct.sa_sigaction = &SigIntHandler ;
+ sigemptyset(&SigIntAct.sa_mask);
SigIntAct.sa_flags = SA_SIGINFO ;
#endif
-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@
def DumpPython(self, theStudy, isPublished):
aBuffer = "def RebuildData(theStudy): pass\n\0"
- return (aBuffer, 1)
+ return (aBuffer, 1)
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
def hasObjectInfo(self):
- return 0
+ return 0
#-------------------------------------------------------------------------
public:
Engines_Component_i();
Engines_Component_i(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
- const char *instanceName,
- const char *interfaceName,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
+ const char *instanceName,
+ const char *interfaceName,
bool notif = false,
bool regist = true);
//Constructor for standalone component
Engines_Component_i(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- Engines::Container_ptr container,
- const char *instanceName,
- const char *interfaceName,
+ PortableServer::POA_ptr poa,
+ Engines::Container_ptr container,
+ const char *instanceName,
+ const char *interfaceName,
bool notif = false,
bool regist = true);
PortableServer::ObjectId * getId();
Engines_Container_i *GetContainerPtr();
- bool setStudyId(CORBA::Long studyId);
+ virtual bool setStudyId(CORBA::Long studyId);
static bool isMultiStudy();
static bool isMultiInstance();
static std::string GetDynLibraryName(const char *componentName);
if (!isSupervContainer)
{
PyGILState_Ensure();
- //Delete python container that destroy orb from python (pyCont._orb.destroy())
+ //Destroy orb from python (for chasing memory leaks)
+ //PyRun_SimpleString("from omniORB import CORBA");
+ //PyRun_SimpleString("orb=CORBA.ORB_init([''], CORBA.ORB_ID)");
+ //PyRun_SimpleString("orb.destroy()");
Py_Finalize();
}
else
#endif
#endif
- //END_OF(argv[0]);
- //LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
- //bp1->deleteInstance(bp1);
return 0 ;
}
#=============================================================================
-#define an implementation of the container interface
+#define an implementation of the container interface for embedding in Container implemented in C++
class SALOME_Container_i:
_orb = None
#-------------------------------------------------------------------------
- #def __del__(self ):
- # self._orb.destroy()
-
def import_component(self, componentName):
MESSAGE( "SALOME_Container_i::import_component" )
- ret=0
+ ret=""
try:
if verbose(): print "try import ",componentName
__import__(componentName)
if verbose(): print "import ",componentName," successful"
- ret=1
except:
+ import traceback
+ ret=traceback.format_exc(10)
if verbose():
- import traceback
traceback.print_exc()
print "import ",componentName," not possible"
return ret
_NS->Register(refContMan,_ContainerManagerNameInNS);
_isAppliSalomeDefined = (getenv("APPLI") != 0);
+
+#ifdef HAVE_MPI2
+#ifdef WITHOPENMPI
+ if( getenv("OMPI_URI_FILE") != NULL ){
+ system("killall ompi-server");
+ string command;
+ command = "ompi-server -r ";
+ command += getenv("OMPI_URI_FILE");
+ int status=system(command.c_str());
+ if(status!=0)
+ throw SALOME_Exception("Error when launching ompi-server");
+ }
+#endif
+#endif
+
MESSAGE("constructor end");
}
SALOME_ContainerManager::~SALOME_ContainerManager()
{
MESSAGE("destructor");
+#ifdef HAVE_MPI2
+#ifdef WITHOPENMPI
+ if( getenv("OMPI_URI_FILE") != NULL )
+ system("killall ompi-server");
+#endif
+#endif
}
//=============================================================================
{
try
{
- SCRUTE((*iter));
- CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
- Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont))
- {
- MESSAGE("ShutdownContainers: " << (*iter));
- cont->Shutdown();
- }
- else
- MESSAGE("ShutdownContainers: no container ref for " << (*iter));
+ SCRUTE((*iter));
+ CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont))
+ {
+ MESSAGE("ShutdownContainers: " << (*iter));
+ cont->Shutdown();
+ }
+ else
+ MESSAGE("ShutdownContainers: no container ref for " << (*iter));
}
catch(CORBA::SystemException& e)
{
- INFOS("CORBA::SystemException ignored : " << e);
+ INFOS("CORBA::SystemException ignored : " << e);
}
catch(CORBA::Exception&)
{
- INFOS("CORBA::Exception ignored.");
+ INFOS("CORBA::Exception ignored.");
}
catch(...)
{
- INFOS("Unknown exception ignored.");
+ INFOS("Unknown exception ignored.");
}
}
}
//check if an entry exists in Naming service
//if params.mode == "start" or "" shutdown the existing container before launching a new one with that name
//if params.mode == "getorstart" or "get" use the existing container
- containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str());
+ if(params.isMPI)
+ // A parallel container register on zero node in NS
+ containerNameInNS = _NS->BuildContainerNameForNS(params,GetMPIZeroNode(theMachine).c_str());
+ else
+ containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str());
SCRUTE(containerNameInNS);
CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
if(std::string(params.mode.in())=="getorstart"||std::string(params.mode.in())=="get")
return cont._retn(); /* the container exists and params.mode is getorstart or get use it*/
else
- cont->Shutdown(); // shutdown the registered container if it exists
+ {
+ INFOS("A container is already registered with the name: " << containerNameInNS << ", shutdown the existing container");
+ cont->Shutdown(); // shutdown the registered container if it exists
+ }
}
}
catch(CORBA::Exception&)
command = BuildCommandToLaunchRemoteContainer(theMachine,params,container_exe);
//redirect stdout and stderr in a file
- string logFilename="/tmp/"+_NS->ContainerName(params)+"_"+ theMachine +"_"+getenv( "USER" )+".log" ;
- command += " > " + logFilename + " 2>&1 &";
+#ifdef WNT
+ string logFilename=getenv("TEMP");
+ logFilename += "\\";
+#else
+ string logFilename="/tmp";
+ char* val = getenv("SALOME_TMP_DIR");
+ if(val)
+ {
+ struct stat file_info;
+ stat(val, &file_info);
+ bool is_dir = S_ISDIR(file_info.st_mode);
+ if (is_dir)logFilename=val;
+ else std::cerr << "SALOME_TMP_DIR environment variable is not a directory use /tmp instead" << std::endl;
+ }
+ logFilename += "/";
+#endif
+ logFilename += _NS->ContainerName(params)+"_"+ theMachine +"_"+getenv( "USER" )+".log" ;
+ command += " > " + logFilename + " 2>&1";
+#ifdef WNT
+ command = "%PYTHONBIN% -c \"import win32pm ; win32pm.spawnpid(r'" + command + "', '')\"";
+#else
+ command += " &";
+#endif
// launch container with a system call
int status=system(command.c_str());
// Il faut tuer le proxy
try
{
- Engines::Container_var proxy = Engines::Container::_narrow(container_proxy);
- proxy->Shutdown();
+ Engines::Container_var proxy = Engines::Container::_narrow(container_proxy);
+ proxy->Shutdown();
}
catch (...)
{
- INFOS("[StartParallelContainer] Exception catched from proxy Shutdown...");
+ INFOS("[StartParallelContainer] Exception catched from proxy Shutdown...");
}
return ret;
}
obj = _NS->Resolve(containerNameInNS.c_str());
if (CORBA::is_nil(obj))
{
- INFOS("[StartParallelContainer] CONNECTION FAILED From Naming Service !");
- INFOS("[StartParallelContainer] Container name is " << containerNameInNS);
- return ret;
+ INFOS("[StartParallelContainer] CONNECTION FAILED From Naming Service !");
+ INFOS("[StartParallelContainer] Container name is " << containerNameInNS);
+ return ret;
}
try
{
- MESSAGE("[StartParallelContainer] Deploying node : " << container_node_name);
- PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj);
- node->deploy();
- MESSAGE("[StartParallelContainer] node " << container_node_name << " is deployed");
+ MESSAGE("[StartParallelContainer] Deploying node : " << container_node_name);
+ PaCO::InterfaceParallel_var node = PaCO::InterfaceParallel::_narrow(obj);
+ node->deploy();
+ MESSAGE("[StartParallelContainer] node " << container_node_name << " is deployed");
}
catch(CORBA::SystemException& e)
{
- INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
- INFOS("CORBA::SystemException : " << e);
- return ret;
+ INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
+ INFOS("CORBA::SystemException : " << e);
+ return ret;
}
catch(CORBA::Exception& e)
{
- INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
- INFOS("CORBA::Exception" << e);
- return ret;
+ INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
+ INFOS("CORBA::Exception" << e);
+ return ret;
}
catch(...)
{
- INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
- INFOS("Unknown exception !");
- return ret;
+ INFOS("[StartParallelContainer] Exception in deploying node : " << containerNameInNS);
+ INFOS("Unknown exception !");
+ return ret;
}
}
//=============================================================================
CORBA::Object_ptr
SALOME_ContainerManager::LaunchParallelContainer(const std::string& command,
- const Engines::MachineParameters& params,
- const std::string& name,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine)
+ const Engines::MachineParameters& params,
+ const std::string& name,
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine)
{
CORBA::Object_ptr obj = CORBA::Object::_nil();
std::string containerNameInNS;
INFOS("[LaunchParallelContainer] Waiting for Parallel Container node " << containerNameInNS << " on " << theMachine);
while (CORBA::is_nil(obj) && count) {
#ifndef WIN32
- sleep(1) ;
+ sleep(1) ;
#else
- Sleep(1000);
+ Sleep(1000);
#endif
- count-- ;
- obj = _NS->Resolve(containerNameInNS.c_str());
+ count-- ;
+ obj = _NS->Resolve(containerNameInNS.c_str());
}
if (CORBA::is_nil(obj))
{
- INFOS("[LaunchParallelContainer] Launch of node failed (or not found) !");
- return obj;
+ INFOS("[LaunchParallelContainer] Launch of node failed (or not found) !");
+ return obj;
}
}
}
{
string command;
int nbproc;
-
+
if ( ! _isAppliSalomeDefined )
command = BuildTempFileToLaunchRemoteContainer(machine, params);
throw SALOME_Exception("Unknown protocol");
if (resInfo.UserName != "")
- {
- command += resInfo.UserName;
- command += "@";
- }
+ {
+ command += resInfo.UserName;
+ command += "@";
+ }
command += machine;
command += " ";
if (resInfo.AppliPath != "")
- command += resInfo.AppliPath; // path relative to user@machine $HOME
+ command += resInfo.AppliPath; // path relative to user@machine $HOME
else
- {
- ASSERT(getenv("APPLI"));
- command += getenv("APPLI"); // path relative to user@machine $HOME
- }
+ {
+ ASSERT(getenv("APPLI"));
+ command += getenv("APPLI"); // path relative to user@machine $HOME
+ }
command += "/runRemote.sh ";
}
if(params.isMPI)
- {
- command += " mpirun -np ";
- std::ostringstream o;
- o << nbproc << " ";
- command += o.str();
+ {
+ command += " mpirun -np ";
+ std::ostringstream o;
+ o << nbproc << " ";
+ command += o.str();
#ifdef WITHLAM
- command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
+ command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
#elif defined(WITHOPENMPI)
- if( getenv("OMPI_URI_FILE") == NULL )
- command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
- else{
- command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
- command += getenv("OMPI_URI_FILE");
- }
-#endif
- command += " SALOME_MPIContainer ";
- }
+ if( getenv("OMPI_URI_FILE") == NULL )
+ command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
+ else{
+ command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
+ command += getenv("OMPI_URI_FILE");
+ }
+#endif
+ command += " SALOME_MPIContainer ";
+ }
else
command += " " +container_exe+ " ";
#elif defined(WITHOPENMPI)
//command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace ";
if( getenv("OMPI_URI_FILE") == NULL )
- command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
+ command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
else
{
command_file << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
tempOutputFile << "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
#elif defined(WITHOPENMPI)
if( getenv("OMPI_URI_FILE") == NULL )
- tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
+ tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace";
else{
- tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
- tempOutputFile << getenv("OMPI_URI_FILE");
+ tempOutputFile << "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:";
+ tempOutputFile << getenv("OMPI_URI_FILE");
}
#endif
}
//=============================================================================
string
SALOME_ContainerManager::BuildCommandToLaunchParallelContainer(const std::string& exe_name,
- const Engines::MachineParameters& params,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
- const std::string proxy_hostname)
+ const Engines::MachineParameters& params,
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
+ const std::string proxy_hostname)
{
// This method knows the differences between the proxy and the nodes.
// nb_component_nodes is not used in the same way if it is a proxy or
if (is_a_proxy)
{
machine_file_name = _ResManager->getMachineFile(hostname,
- 1,
- parallelLib);
+ 1,
+ parallelLib);
}
else
{
machine_file_name = _ResManager->getMachineFile(hostname,
- params.nb_component_nodes,
- parallelLib);
+ params.nb_component_nodes,
+ parallelLib);
}
if (machine_file_name == "")
{
std::string command_remote("");
if (remote)
{
- std::string machine_name;
- std::ifstream machine_file(machine_file_name.c_str());
- std::getline(machine_file, machine_name);
- MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name)
-
- // We want to launch a command like :
- // ssh user@machine distantPath/runRemote.sh hostNS portNS
- const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name);
- if (resInfo.Protocol == rsh)
- command_remote = "rsh ";
- else
- command_remote = "ssh ";
- command_remote += resInfo.UserName;
- command_remote += "@";
- command_remote += machine_name;
- command_remote += " ";
- command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
- command_remote += "/runRemote.sh ";
- ASSERT(getenv("NSHOST"));
- command_remote += getenv("NSHOST"); // hostname of CORBA name server
- command_remote += " ";
- ASSERT(getenv("NSPORT"));
- command_remote += getenv("NSPORT"); // port of CORBA name server
- command_remote += " ";
-
- hostname = machine_name;
+ std::string machine_name;
+ std::ifstream machine_file(machine_file_name.c_str());
+ std::getline(machine_file, machine_name);
+ MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name)
+
+ // We want to launch a command like :
+ // ssh user@machine distantPath/runRemote.sh hostNS portNS
+ const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name);
+ if (resInfo.Protocol == rsh)
+ command_remote = "rsh ";
+ else
+ command_remote = "ssh ";
+ command_remote += resInfo.UserName;
+ command_remote += "@";
+ command_remote += machine_name;
+ command_remote += " ";
+ command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
+ command_remote += "/runRemote.sh ";
+ ASSERT(getenv("NSHOST"));
+ command_remote += getenv("NSHOST"); // hostname of CORBA name server
+ command_remote += " ";
+ ASSERT(getenv("NSPORT"));
+ command_remote += getenv("NSPORT"); // port of CORBA name server
+ command_remote += " ";
+
+ hostname = machine_name;
}
command = real_exe_name;
{
std::ifstream * machine_file = NULL;
if (remote)
- machine_file = new std::ifstream(machine_file_name.c_str());
+ machine_file = new std::ifstream(machine_file_name.c_str());
for (int i= 0; i < nb_nodes; i++)
{
- std::string command_remote("");
- if (remote)
- {
- std::string machine_name;
- std::getline(*machine_file, machine_name);
- MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name)
-
- // We want to launch a command like :
- // ssh user@machine distantPath/runRemote.sh hostNS portNS
- const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name);
- if (resInfo.Protocol == rsh)
- command_remote = "rsh ";
- else
- command_remote = "ssh ";
- command_remote += resInfo.UserName;
- command_remote += "@";
- command_remote += machine_name;
- command_remote += " ";
- command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
- command_remote += "/runRemote.sh ";
- ASSERT(getenv("NSHOST"));
- command_remote += getenv("NSHOST"); // hostname of CORBA name server
- command_remote += " ";
- ASSERT(getenv("NSPORT"));
- command_remote += getenv("NSPORT"); // port of CORBA name server
- command_remote += " ";
-
- hostname = machine_name;
- }
-
- std::ostringstream tmp;
- tmp << i;
- std::string proc_number = tmp.str();
-
- std::string command_tmp("");
- command_tmp += real_exe_name;
- command_tmp += " " + _NS->ContainerName(rtn);
- command_tmp += " " + parallelLib;
- command_tmp += " " + proxy_hostname;
- command_tmp += " " + proc_number;
- command_tmp += " -";
- AddOmninamesParams(command_tmp);
-
- // On change _Node_ par _Nodex_ pour avoir chaque noeud
- // sur un fichier
- std::string command_end_tmp = command_end;
- std::string::size_type loc_node = command_end_tmp.find("_Node_");
- if (loc_node != std::string::npos)
- command_end_tmp.insert(loc_node+5, proc_number);
- command += command_begin + command_remote + command_tmp + command_end_tmp;
- vect_machine.push_back(hostname);
+ std::string command_remote("");
+ if (remote)
+ {
+ std::string machine_name;
+ std::getline(*machine_file, machine_name);
+ MESSAGE("[BuildCommandToLaunchParallelContainer] machine file name extracted is " << machine_name)
+
+ // We want to launch a command like :
+ // ssh user@machine distantPath/runRemote.sh hostNS portNS
+ const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(machine_name);
+ if (resInfo.Protocol == rsh)
+ command_remote = "rsh ";
+ else
+ command_remote = "ssh ";
+ command_remote += resInfo.UserName;
+ command_remote += "@";
+ command_remote += machine_name;
+ command_remote += " ";
+ command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
+ command_remote += "/runRemote.sh ";
+ ASSERT(getenv("NSHOST"));
+ command_remote += getenv("NSHOST"); // hostname of CORBA name server
+ command_remote += " ";
+ ASSERT(getenv("NSPORT"));
+ command_remote += getenv("NSPORT"); // port of CORBA name server
+ command_remote += " ";
+
+ hostname = machine_name;
+ }
+
+ std::ostringstream tmp;
+ tmp << i;
+ std::string proc_number = tmp.str();
+
+ std::string command_tmp("");
+ command_tmp += real_exe_name;
+ command_tmp += " " + _NS->ContainerName(rtn);
+ command_tmp += " " + parallelLib;
+ command_tmp += " " + proxy_hostname;
+ command_tmp += " " + proc_number;
+ command_tmp += " -";
+ AddOmninamesParams(command_tmp);
+
+ // On change _Node_ par _Nodex_ pour avoir chaque noeud
+ // sur un fichier
+ std::string command_end_tmp = command_end;
+ std::string::size_type loc_node = command_end_tmp.find("_Node_");
+ if (loc_node != std::string::npos)
+ command_end_tmp.insert(loc_node+5, proc_number);
+ command += command_begin + command_remote + command_tmp + command_end_tmp;
+ vect_machine.push_back(hostname);
}
if (machine_file)
- delete machine_file;
+ delete machine_file;
}
}
else if (parallelLib == "Mpi")
std::string command_remote("");
const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
if (resInfo.Protocol == rsh)
- command_remote = "rcp ";
+ command_remote = "rcp ";
else
- command_remote = "scp ";
+ command_remote = "scp ";
command_remote += machine_file_name;
command_remote += " ";
int status = system(command_remote.c_str());
if (status == -1)
{
- INFOS("copy of the mpi machine file failed !");
- return "";
+ INFOS("copy of the mpi machine file failed !");
+ return "";
}
}
std::string command_remote("");
if (remote)
{
- // We want to launch a command like :
- // ssh user@machine distantPath/runRemote.sh hostNS portNS
- const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
- if (resInfo.Protocol == rsh)
- command_remote = "rsh ";
- else
- command_remote = "ssh ";
- command_remote += resInfo.UserName;
- command_remote += "@";
- command_remote += remote_machine;
- command_remote += " ";
- command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
- command_remote += "/runRemote.sh ";
- ASSERT(getenv("NSHOST"));
- command_remote += getenv("NSHOST"); // hostname of CORBA name server
- command_remote += " ";
- ASSERT(getenv("NSPORT"));
- command_remote += getenv("NSPORT"); // port of CORBA name server
- command_remote += " ";
-
- hostname = remote_machine;
+ // We want to launch a command like :
+ // ssh user@machine distantPath/runRemote.sh hostNS portNS
+ const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
+ if (resInfo.Protocol == rsh)
+ command_remote = "rsh ";
+ else
+ command_remote = "ssh ";
+ command_remote += resInfo.UserName;
+ command_remote += "@";
+ command_remote += remote_machine;
+ command_remote += " ";
+ command_remote += resInfo.AppliPath; // path relative to user@machine $HOME
+ command_remote += "/runRemote.sh ";
+ ASSERT(getenv("NSHOST"));
+ command_remote += getenv("NSHOST"); // hostname of CORBA name server
+ command_remote += " ";
+ ASSERT(getenv("NSPORT"));
+ command_remote += getenv("NSPORT"); // port of CORBA name server
+ command_remote += " ";
+
+ hostname = remote_machine;
}
// We use Dummy proxy for MPI parallel containers
std::string command_remote("");
if (remote)
{
- const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
- if (resInfo.Protocol == rsh)
- command_remote = "rsh ";
- else
- command_remote = "ssh ";
- command_remote += resInfo.UserName;
- command_remote += "@";
- command_remote += remote_machine;
- command_remote += " ";
-
- std::string new_real_exe_name("");
- new_real_exe_name += resInfo.AppliPath; // path relative to user@machine $HOME
- new_real_exe_name += "/runRemote.sh ";
- ASSERT(getenv("NSHOST"));
- new_real_exe_name += getenv("NSHOST"); // hostname of CORBA name server
- new_real_exe_name += " ";
- ASSERT(getenv("NSPORT"));
- new_real_exe_name += getenv("NSPORT"); // port of CORBA name server
- new_real_exe_name += " ";
-
- real_exe_name = new_real_exe_name + real_exe_name;
- hostname = remote_machine;
+ const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(remote_machine);
+ if (resInfo.Protocol == rsh)
+ command_remote = "rsh ";
+ else
+ command_remote = "ssh ";
+ command_remote += resInfo.UserName;
+ command_remote += "@";
+ command_remote += remote_machine;
+ command_remote += " ";
+
+ std::string new_real_exe_name("");
+ new_real_exe_name += resInfo.AppliPath; // path relative to user@machine $HOME
+ new_real_exe_name += "/runRemote.sh ";
+ ASSERT(getenv("NSHOST"));
+ new_real_exe_name += getenv("NSHOST"); // hostname of CORBA name server
+ new_real_exe_name += " ";
+ ASSERT(getenv("NSPORT"));
+ new_real_exe_name += getenv("NSPORT"); // port of CORBA name server
+ new_real_exe_name += " ";
+
+ real_exe_name = new_real_exe_name + real_exe_name;
+ hostname = remote_machine;
}
const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesList(hostname);
if (resInfo.mpi == lam)
{
- command = "mpiexec -ssi boot ";
- if (resInfo.Protocol == rsh)
- command += "rsh ";
- else
- command += "ssh ";
- command += "-machinefile " + machine_file_name + " ";
- command += "-n " + nbproc + " ";
- command += real_exe_name;
- command += " " + _NS->ContainerName(rtn);
- command += " " + parallelLib;
- command += " " + proxy_hostname;
- command += " -";
- AddOmninamesParams(command);
+ command = "mpiexec -ssi boot ";
+ if (resInfo.Protocol == rsh)
+ command += "rsh ";
+ else
+ command += "ssh ";
+ command += "-machinefile " + machine_file_name + " ";
+ command += "-n " + nbproc + " ";
+ command += real_exe_name;
+ command += " " + _NS->ContainerName(rtn);
+ command += " " + parallelLib;
+ command += " " + proxy_hostname;
+ command += " -";
+ AddOmninamesParams(command);
}
else
{
- command = "mpirun -np " + nbproc + " ";
- command += real_exe_name;
- command += " " + _NS->ContainerName(rtn);
- command += " " + parallelLib;
- command += " " + proxy_hostname;
- command += " -";
- AddOmninamesParams(command);
+ command = "mpirun -np " + nbproc + " ";
+ command += real_exe_name;
+ command += " " + _NS->ContainerName(rtn);
+ command += " " + parallelLib;
+ command += " " + proxy_hostname;
+ command += " -";
+ AddOmninamesParams(command);
}
command = command_begin + command_remote + command + command_end;
for (int i= 0; i < nb_nodes; i++)
- vect_machine.push_back(proxy_hostname);
+ vect_machine.push_back(proxy_hostname);
}
}
else
void fillBatchLaunchedContainers();
std::string BuildCommandToLaunchRemoteContainer(const std::string& machine,
- const Engines::MachineParameters& params,
- const std::string& container_exe="SALOME_Container");
+ const Engines::MachineParameters& params,
+ const std::string& container_exe="SALOME_Container");
std::string BuildCommandToLaunchLocalContainer(const Engines::MachineParameters& params,
const std::string& container_exe="SALOME_Container");
std::string BuildTempFileToLaunchRemoteContainer(const std::string& machine,
- const Engines::MachineParameters& params) throw(SALOME_Exception);
+ const Engines::MachineParameters& params) throw(SALOME_Exception);
void RmTmpFile(std::string& tmpFile);
// For PacO++ Parallel extension
typedef std::vector<std::string> actual_launch_machine_t;
std::string BuildCommandToLaunchParallelContainer(const std::string& exe_name,
- const Engines::MachineParameters& params,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
- const std::string proxy_hostname = "");
+ const Engines::MachineParameters& params,
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine,
+ const std::string proxy_hostname = "");
CORBA::Object_ptr
LaunchParallelContainer(const std::string& command,
- const Engines::MachineParameters& params,
- const std::string& name,
- SALOME_ContainerManager::actual_launch_machine_t & vect_machine);
+ const Engines::MachineParameters& params,
+ const std::string& name,
+ SALOME_ContainerManager::actual_launch_machine_t & vect_machine);
CORBA::ORB_var _orb;
PortableServer::POA_var _poa;
#=============================================================================
-#define an implementation of the container interface
+#define an implementation of the container interface for the container implemented in Python
class SALOME_ContainerPy_i (Engines__POA.Container):
_orb = None
self._poa = poa
myMachine=getShortHostName()
Container_path = "/Containers/" + myMachine + "/" + containerName
- #self._containerName = containerName
self._containerName = Container_path
if verbose(): print "container name ",self._containerName
if verbose(): print "import ",componentName," successful"
ret=1
except:
- if verbose():
- import traceback
- traceback.print_exc()
- print "import ",componentName," not possible"
+ import traceback
+ traceback.print_exc()
+ print "import ",componentName," not possible"
return ret
#-------------------------------------------------------------------------
ret = 0
instanceName = componentName + "_inst_" + `self._numInstance`
interfaceName = componentName
- #the_command = "import " + componentName + "\n"
- #the_command = the_command + "comp_i = " + componentName + "." + componentName
- #the_command = the_command + "(self._orb, self._poa, self._this(), self._containerName, instanceName, interfaceName)\n"
- #MESSAGE( "SALOME_ContainerPy_i::load_component_Library :" + str (the_command) )
- #exec the_command
- #comp_o = comp_i._this()
- #if comp_o is not None:
- # ret = 1
- #else:
- # --- try to import Python component
- # retImpl = self.import_component(componentName)
- # if retImpl == 1:
- #import is possible
- # ret = 1
- # else:
- #import isn't possible
- # ret = 0
- #return ret
return self.import_component(componentName)
#-------------------------------------------------------------------------
public:
Engines_Container_i();
Engines_Container_i(CORBA::ORB_ptr orb,
- PortableServer::POA_ptr poa,
- char * containerName ,
+ PortableServer::POA_ptr poa,
+ char * containerName ,
int argc, char* argv[],
- bool activAndRegist = true,
- bool isServantAloneInProcess = true);
+ bool activAndRegist = true,
+ bool isServantAloneInProcess = true);
virtual ~Engines_Container_i();
// --- CORBA methods
virtual Engines::Component_ptr
create_component_instance( const char* componentName,
- CORBA::Long studyId); // 0 for multiStudy
+ CORBA::Long studyId); // 0 for multiStudy
Engines::Component_ptr
find_component_instance( const char* registeredName,
- CORBA::Long studyId); // 0 for multiStudy
+ CORBA::Long studyId); // 0 for multiStudy
Engines::Component_ptr
load_impl(const char* nameToRegister,
- const char* componentName);
+ const char* componentName);
void remove_impl(Engines::Component_ptr component_i);
Engines::Component_ptr
find_or_create_instance( std::string genericRegisterName,
- std::string componentLibraryName);
+ std::string componentLibraryName);
Engines::Component_ptr
createInstance(std::string genericRegisterName,
- void *handle,
- int studyId);
+ void *handle,
+ int studyId);
static bool isPythonContainer(const char* ContainerName);
static void decInstanceCnt(std::string genericRegisterName);
//=============================================================================
fileRef_i::fileRef_i(Engines::Container_ptr container,
- const char* origFileName)
+ const char* origFileName)
{
MESSAGE("fileRef_i::fileRef_i "<< origFileName);
_container = Engines::Container::_duplicate(container);
//=============================================================================
CORBA::Boolean fileRef_i::addRef(const char* machine,
- const char* fileName)
+ const char* fileName)
{
MESSAGE("fileRef_i::addRef " << machine << " " << fileName);
string theMachine = machine;
if (! _copies[theMachine].empty())
{
INFOS("there is already a copy on " << theMachine << " under the path "
- << _copies[theMachine] << " new ref not added! ");
+ << _copies[theMachine] << " new ref not added! ");
return 0;
}
if (_copies[theMachine].empty())
{
MESSAGE("no copy of " << _machine << _origFileName << " available on "
- << theMachine);
+ << theMachine);
}
else
{
MESSAGE("a copy of " << _machine << _origFileName << "is available on "
- << theMachine << _copies[theMachine]);
+ << theMachine << _copies[theMachine]);
}
return CORBA::string_dup(_copies[theMachine].c_str());
}
public:
fileRef_i();
fileRef_i(Engines::Container_ptr container,
- const char* origFileName);
+ const char* origFileName);
virtual ~fileRef_i();
char* origFileName();
Engines::Container_ptr getContainer();
CORBA::Boolean addRef(const char* machine,
- const char* fileName);
+ const char* fileName);
char* getRef(const char* machine);
if (mode == "all") {
- // Changing path, is now current directory
- path = getcwd(NULL, _path_max);
+ // Changing path, is now current directory
+ path = getcwd(NULL, _path_max);
- std::string group_name("GROUP");
- group_name += file_name;
- hdf_group = new HDFgroup(group_name.c_str(),hdf_file);
- hdf_group->OpenOnDisk();
- hdf_dataset = new HDFdataset("FILE DATASET",hdf_group);
- hdf_dataset->OpenOnDisk();
- size = hdf_dataset->GetSize();
- buffer = new char[size];
+ std::string group_name("GROUP");
+ group_name += file_name;
+ hdf_group = new HDFgroup(group_name.c_str(),hdf_file);
+ hdf_group->OpenOnDisk();
+ hdf_dataset = new HDFdataset("FILE DATASET",hdf_group);
+ hdf_dataset->OpenOnDisk();
+ size = hdf_dataset->GetSize();
+ buffer = new char[size];
- if ( (fd = ::open(file_name.c_str(),O_RDWR|O_CREAT,00666)) <0) {
- SALOME::ExceptionStruct es;
- es.type = SALOME::INTERNAL_ERROR;
- std::string text = "open failed";
- es.text = CORBA::string_dup(text.c_str());
- throw SALOME::SALOME_Exception(es);
- };
- hdf_dataset->ReadFromDisk(buffer);
- if ( write(fd,buffer,size) <0) {
- SALOME::ExceptionStruct es;
- es.type = SALOME::INTERNAL_ERROR;
- std::string text = "write failed";
- es.text = CORBA::string_dup(text.c_str());
- throw SALOME::SALOME_Exception(es);
- };
- // Close the target file
- ::close(fd);
-
- Engines::file infos;
- infos.file_name = CORBA::string_dup(file_name.c_str());
- infos.path = CORBA::string_dup(path.c_str());
- infos.type = CORBA::string_dup(type.c_str());
- infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
- infos.status = CORBA::string_dup(status.c_str());
-
- _fileManaged[file_name] = infos;
-
- // Update Salome_file state
- _state.number_of_files++;
- _state.files_ok = true;
+ if ( (fd = ::open(file_name.c_str(),O_RDWR|O_CREAT,00666)) <0) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "open failed";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ };
+ hdf_dataset->ReadFromDisk(buffer);
+ if ( write(fd,buffer,size) <0) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "write failed";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ };
+ // Close the target file
+ ::close(fd);
+
+ Engines::file infos;
+ infos.file_name = CORBA::string_dup(file_name.c_str());
+ infos.path = CORBA::string_dup(path.c_str());
+ infos.type = CORBA::string_dup(type.c_str());
+ infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
+ infos.status = CORBA::string_dup(status.c_str());
+
+ _fileManaged[file_name] = infos;
+
+ // Update Salome_file state
+ _state.number_of_files++;
+ _state.files_ok = true;
}
else {
- Engines::file infos;
- infos.file_name = CORBA::string_dup(file_name.c_str());
- infos.path = CORBA::string_dup(path.c_str());
- infos.type = CORBA::string_dup(type.c_str());
- infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
- infos.status = CORBA::string_dup(status.c_str());
- // Infos for parallel extensions...
- infos.node = 0;
- infos.container = Engines::Container::_duplicate(_container);
-
- _fileManaged[file_name] = infos;
-
- // Update Salome_file state
- _state.number_of_files++;
- if (status != "ok")
- _state.files_ok = false;
+ Engines::file infos;
+ infos.file_name = CORBA::string_dup(file_name.c_str());
+ infos.path = CORBA::string_dup(path.c_str());
+ infos.type = CORBA::string_dup(type.c_str());
+ infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
+ infos.status = CORBA::string_dup(status.c_str());
+ // Infos for parallel extensions...
+ infos.node = 0;
+ infos.container = Engines::Container::_duplicate(_container);
+
+ _fileManaged[file_name] = infos;
+
+ // Update Salome_file state
+ _state.number_of_files++;
+ if (status != "ok")
+ _state.files_ok = false;
}
}
}
_t_fileDistributedSource::iterator it = _fileDistributedSource.find(file_name);
if (it == _fileDistributedSource.end())
{
- _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file);
+ _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file);
}
}
}
//=============================================================================
void
Salome_file_i::connectDistributedFile(const char * file_name,
- Engines::Salome_file_ptr source_Salome_file)
+ Engines::Salome_file_ptr source_Salome_file)
{
// Test if this file is added
_t_fileManaged::iterator it = _fileManaged.find(file_name);
//=============================================================================
void
Salome_file_i::setDistributedSourceFile(const char* file_name,
- const char * source_file_name)
+ const char * source_file_name)
{
std::string fname(file_name);
if (std::string(file_infos.type.in()) == "local")
{
if (std::string(file_infos.status.in()) == "not_ok")
- result = checkLocalFile(file_infos.file_name.in());
+ result = checkLocalFile(file_infos.file_name.in());
}
else
{
if (std::string(file_infos.status.in()) == "not_ok")
- result = getDistributedFile(file_infos.file_name.in());
+ result = getDistributedFile(file_infos.file_name.in());
}
// if the result is false
// we add this file to files_not_ok
// Configure DistributedFile
virtual void connect(Engines::Salome_file_ptr source_Salome_file);
virtual void connectDistributedFile(const char * file_name,
- Engines::Salome_file_ptr source_Salome_file);
+ Engines::Salome_file_ptr source_Salome_file);
virtual void setDistributedSourceFile(const char* file_name,
- const char * source_file_name);
+ const char * source_file_name);
// Recv and check files
virtual void recvFiles();
map<string, DF_Attribute*>::iterator mi;
for(mi =_node->_attributes.begin(); mi != _node->_attributes.end(); mi++) {
if(mi->second == this) {
- _node->_attributes.erase(mi);
- }
+ _node->_attributes.erase(mi);
+ return;
+ }
}
}
}
delete vn[i];
_root._node->Reset();
+ _root.Nullify();
}
//Returns true if this document is empty
//
#include "DSC_i.hxx"
+//#define MYDEBUG
+
Engines_DSC_i::
Engines_DSC_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
instanceName,
interfaceName)
{
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
#endif
}
bool regist) :
Engines_Component_i(orb, poa, container, instanceName, interfaceName,notif,regist)
{
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
#endif
}
#include <string>
#include "DSC_interface.hxx"
+//#define MYDEBUG
+
Engines_DSC_interface::Engines_DSC_interface() {}
Engines_DSC_interface::~Engines_DSC_interface()
Engines::DSC::BadPortType BPT;
BPT.expected = CORBA::string_dup("Expected a uses port");
BPT.received = CORBA::string_dup((std::string("Received a provides/none port : ")+uses_port_name).c_str());
+#ifdef MYDEBUG
std::cout << "---- DSC_Interface : MARK 1 ---- exception : " << uses_port_name << "----" << std::endl;
+#endif
throw BPT;
}
}
else
{
+#ifdef MYDEBUG
std::cout << "---- DSC_Interface : MARK 2 ---- exception : " << uses_port_name << "----" << std::endl;
+#endif
throw Engines::DSC::PortNotConnected();
}
-I$(top_srcdir)/src/Basics \
-I$(top_srcdir)/src/NamingService \
-I$(top_srcdir)/src/Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# File : Makefile.am
-# Author : André RIBES (EDF), Eric Fayolle (EDF)
+# Author : André RIBES (EDF), Eric Fayolle (EDF)
# Module : KERNEL
#
include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-I$(top_srcdir)/src/DSC/DSC_User/Datastream \
-I$(top_srcdir)/src/DSC/DSC_User/Datastream/Palm \
-I$(top_srcdir)/src/DSC/DSC_User/Datastream/Calcium \
+ -I$(top_builddir)/src/DSC/DSC_User/Datastream/Calcium \
-I$(top_srcdir)/src/DSC/DSC_User/Basic \
-I$(top_srcdir)/src/DSC/DSC_Basic \
-I$(top_srcdir)/src/SALOMELocalTrace \
-I$(top_srcdir)/src/Utils \
-I$(top_srcdir)/src/Container \
-I$(top_srcdir)/src/Notification \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@
../DSC_Basic/libSalomeDSCContainer.la \
../../Container/libSalomeContainer.la
-_calcium_la_CXXFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS)
+_calcium_la_CPPFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS)
EXTRA_DIST=calcium_wrap.cpp calcium.i
-I$(top_srcdir)/src/SALOMELocalTrace \
-I$(top_srcdir)/src/Basics \
-I$(top_srcdir)/src/Utils \
- -I$(top_builddir)/salome_adm/unix \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
# This local variable defines the list of dependant libraries common to all target in this package.
#include "DisplayPair.hxx"
//
+//#define MYDEBUG
+
// Suppose que le container est trié
template < typename T > struct AdjacentFunctor {
// Suppose que les valeurs passées en paramètres sont triées par ordre croissant
bool operator()(const T &v1) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "AdjacentFunctor: " << _minValue << _maxValue << std::endl;
std::cout << "AdjacentFunctor: " << _min << _max << std::endl;
#endif
if ( v1 <= _minValue && v1 >= _maxValue)
{
_equal= true;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "AdjacentFunctor: _equal : " << v1 << std::endl;
#endif
return true;
if ( v1 < _minValue )
{
_min=v1;_minFound=true;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "AdjacentFunctor: _minFound : " <<_min << std::endl;
#endif
}
else if ( v1 > _maxValue )
{
_max=v1;_maxFound=true;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "AdjacentFunctor: _maxFound : " <<_max << std::endl;
#endif
}
bool isEqual() const { return _equal;}
bool isBounded() const { return _minFound && _maxFound;}
bool getBounds(TNoConst & min, TNoConst & max) const {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "_minFound : " <<_minFound << ", _maxFound " << _maxFound << std::endl;
#endif
if (_minFound && _maxFound ) { min=_min; max=_max; return true; }
// Module : KERNEL
#include "calcium.h"
+#include "calciumf.h"
+#include "CalciumFortranInt.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <stddef.h>
// Interface C de SalomeCalcium
typedef int InfoType;
typedef char bool;
+
/************************************/
/* INTERFACES DE LECTURE EN 0 COPIE */
/************************************/
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_.
};
+#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; \
Le paramètre supplémentaire strSize indique la taille fixe et identique
des chaînes stockées dans data (les ports CALCIUM n'en n'ont pas besoin)
*/
-InfoType cp_lch(void * component, int mode, float * ti, float * tf, int * i,
- char * nomvar, int bufferLength, int * nRead,
- char ** data, int strSize) {
- size_t _nRead;
- long _i=*i;
- fflush(stdout);fflush(stderr);
- fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti);
+/* InfoType cp_lch(void * component, int mode, float * ti, float * tf, int * i, */
+/* char * nomvar, int bufferLength, int * nRead, */
+/* char ** data, int strSize) { */
+
+/* size_t _nRead; */
+/* long _i=*i; */
+/* fflush(stdout);fflush(stderr); */
+/* fprintf(stderr,"Beginning of cp_lch: %s %d %f\n",nomvar,*i,*ti); */
- if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL;
+/* if ( (data == NULL) || (bufferLength < 1) ) return CPNTNULL; */
- InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i,
- nomvar, bufferLength, &_nRead,
- &data);/*, strSize );
- strSize est inutile pour les ports CALCIUM
- qui gèrent des tailles quelconques de chaines. */
- if(mode == CP_SEQUENTIEL)
- *i = _i;
- *nRead=_nRead;
- fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i);
- fflush(stdout);fflush(stderr);
+/* InfoType info = ecp_lecture_str (component, mode, ti, tf, &_i, */
+/* nomvar, bufferLength, &_nRead, */
+/* &data);*/
+/*, strSize ); */
+/* strSize est inutile pour les ports CALCIUM */
+/* qui gèrent des tailles quelconques de chaines. */
+/* if(mode == CP_SEQUENTIEL) */
+/* *i = _i; */
+/* *nRead=_nRead; */
+/* fprintf(stderr,"End of cp_lch: %s %d \n",nomvar,*i); */
+/* fflush(stdout);fflush(stderr); */
- return info;
-};
+/* return info; */
+/* }; */
/* Definition des méthodes calcium standard */
-
-CALCIUM_LECT_INTERFACE_C_(len,float,int,int,);
-CALCIUM_LECT_INTERFACE_C_(lre,float,float,float,);
-CALCIUM_LECT_INTERFACE_C_(ldb,double,double,double,);
-CALCIUM_LECT_INTERFACE_C_(llo,float,int,bool,);
-CALCIUM_LECT_INTERFACE_C_(lcp,float,float,cplx,);
+/* CALCIUM_LECT_INTERFACE_C_( <suffixe du nom de l'interface à générer>, <type du paramètre temporel>, <type d'entier à utiliser pour les paramètres de type entier>,
+ <type de données>, <nom de l'interface C2CPP à utiliser>, <qualificateur de type optionnel des données>,<paramètres supplémentaire ignoré>)*/
+
+CALCIUM_LECT_INTERFACE_C_(len,float ,int,int ,int2integer,,);
+/*llg ne sera pas disponible si sizeof(long) == 64 bits && cal_int==int
+ sinon problème de conversion de 64bits vers 32bits */
+CALCIUM_LECT_INTERFACE_C_(llg,float ,int,long ,long2integer,,);
+
+CALCIUM_LECT_INTERFACE_C_(lre,float ,int,float ,float,,);
+CALCIUM_LECT_INTERFACE_C_(ldb,double,int,double ,double,,);
+CALCIUM_LECT_INTERFACE_C_(llo,float ,int,int ,bool,,);
+CALCIUM_LECT_INTERFACE_C_(lcp,float ,int,float ,cplx,,);
#define STAR *
-/* CALCIUM_LECT_INTERFACE_C_(lch,float,char,STAR); */
+#define LCH_LAST_PARAM ,int strsize
+CALCIUM_LECT_INTERFACE_C_(lch,float ,int,char ,str,STAR, LCH_LAST_PARAM );
+
+
+/* Definition des méthodes calcium destinées à l'interfaçage fortran
+ avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */
+CALCIUM_LECT_INTERFACE_C_(len_fort_,float ,cal_int,cal_int ,integer,,);
+CALCIUM_LECT_INTERFACE_C_(lin_fort_,float ,cal_int,int ,int2integer,,);
+/*llg ne sera pas disponible si sizeof(long) == 64 bits && cal_int==int
+ sinon problème de conversion de 64bits vers 32bits */
+CALCIUM_LECT_INTERFACE_C_(llg_fort_,float ,cal_int,long ,long2integer,,);
+
+CALCIUM_LECT_INTERFACE_C_(lre_fort_,float ,cal_int,float ,float,,);
+CALCIUM_LECT_INTERFACE_C_(ldb_fort_,double,cal_int,double ,double,,);
+CALCIUM_LECT_INTERFACE_C_(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */
+CALCIUM_LECT_INTERFACE_C_(lcp_fort_,float ,cal_int,float ,cplx,,);
+CALCIUM_LECT_INTERFACE_C_(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_PARAM );
/**********************************************/
if (instanceName) strcpy(instanceName,"UNDEFINED");
return CPOK;
}
+
InfoType cp_fin (void * component, int code) {
/* TODO : gérer avec les callbacks des ports DSC */
}
-
/***************************/
/* INTERFACES D'ECRITURE */
/***************************/
-#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_type,_typeName,_qual) \
- InfoType cp_##_name (void * component, int mode, \
- _timeType t, int i, \
- char * nomvar, int nbelem, \
- _type _qual * data ) { \
+#define CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \
+ _calInt cp_##_name (void * component, _calInt mode, \
+ _timeType t, _calInt i, \
+ char * nomvar, _calInt nbelem, \
+ _type _qual * data \
+ lastarg ) { \
\
- /*long _i=i;*/ \
+ int _mode = mode; \
+ long _i = i; \
+ size_t _nbelem = nbelem; \
+ _timeType _t = t; \
fflush(stdout); \
fflush(stderr); \
- fprintf(stderr,"Beginning of cp_" #_name " : %s %d %f\n",nomvar,i,t); \
+ 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); \
}; \
-/* Definition des méthodes calcium standard */
-
-CALCIUM_ECR_INTERFACE_C_(een,float,int,int,);
-CALCIUM_ECR_INTERFACE_C_(ere,float,float,float,);
-CALCIUM_ECR_INTERFACE_C_(edb,double,double,double,);
-/*CALCIUM_ECR_INTERFACE_C_(elo,float,bool,bool,);*/
-CALCIUM_ECR_INTERFACE_C_(elo,float,int,bool,);
-CALCIUM_ECR_INTERFACE_C_(ecp,float,float,cplx,);
-InfoType cp_ech(void * component, int mode, float t, int i,
- char * nomvar, int nbelem,
- char ** data, int strSize) {
+/* InfoType cp_ech(void * component, int mode, float t, int i, */
+/* char * nomvar, int nbelem, */
+/* char ** data, int strSize) { */
- /*long _i=i;*/
- fflush(stdout);fflush(stderr);
- fprintf(stderr,"Beginning of cp_ech: %s %d %f\n",nomvar,i,t);
- if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL;
+/*long _i=i;*/
+/* fflush(stdout);fflush(stderr); */
+/* fprintf(stderr,"Beginning of cp_ech: %s %d %f\n",nomvar,i,t); */
+/* if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; */
- InfoType info = ecp_ecriture_str (component, mode, &t, i,
- nomvar, nbelem,
- data);/*, strSize );*/
- fprintf(stderr,"End of cp_ech: %s %d \n",nomvar,i);
- fflush(stdout);
- fflush(stderr);
+/* InfoType info = ecp_ecriture_str (component, mode, &t, i, */
+/* nomvar, nbelem, */
+/* data); */
+/*, strSize );*/
+/* fprintf(stderr,"End of cp_ech: %s %d \n",nomvar,i); */
+/* fflush(stdout); */
+/* fflush(stderr); */
- return info;
-};
-
+/* return info; */
+/* }; */
+/* Definition des méthodes calcium standard */
+/* CALCIUM_ECR_INTERFACE_C_(_name,_timeType,_calInt,type,_typeName,_qual) */
+CALCIUM_ECR_INTERFACE_C_(een,float ,int,int ,int2integer,,);
+CALCIUM_ECR_INTERFACE_C_(elg,float ,int,long ,long2integer,,);
+CALCIUM_ECR_INTERFACE_C_(ere,float ,int,float ,float,,);
+CALCIUM_ECR_INTERFACE_C_(edb,double,int,double,double,,);
+CALCIUM_ECR_INTERFACE_C_(elo,float ,int,int ,bool,,);
+CALCIUM_ECR_INTERFACE_C_(ecp,float ,int,float ,cplx,,);
+CALCIUM_ECR_INTERFACE_C_(ech,float ,int,char ,str,STAR,LCH_LAST_PARAM );
+
+/* Definition des méthodes calcium destinées à l'interfaçage fortran
+ avec une taille des INTEGER fortran paramétrés à la configuration du KERNEL */
+
+CALCIUM_ECR_INTERFACE_C_(een_fort_,float ,cal_int,cal_int,integer,,);
+CALCIUM_ECR_INTERFACE_C_(elg_fort_,float ,cal_int,long ,long2integer,,);
+CALCIUM_ECR_INTERFACE_C_(ein_fort_,float ,cal_int,int ,int2integer,,);
+CALCIUM_ECR_INTERFACE_C_(ere_fort_,float ,cal_int,float ,float,,);
+CALCIUM_ECR_INTERFACE_C_(edb_fort_,double,cal_int,double,double,,);
+CALCIUM_ECR_INTERFACE_C_(elo_fort_,float ,cal_int,int ,bool,,);
+CALCIUM_ECR_INTERFACE_C_(ecp_fort_,float ,cal_int,float ,cplx,,);
+CALCIUM_ECR_INTERFACE_C_(ech_fort_,float ,cal_int,char ,str,STAR,LCH_LAST_PARAM );
#include <string>
#include <exception>
-//#define _DEBUG_
-
PySupervCompo::PySupervCompo( CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
Engines::Container_ptr contain,
extern "C"
{
+ void cp_exit(int);
+ void setDependency(provides_port*, char*, CalciumTypes::DependencyType);
+
void cp_exit(int err)
{
throw CalciumException(err,LOC("Abort coupling"));
void create_calcium_port(Superv_Component_i* compo,char* name,char* type,char *mode,char* depend)
{
-#ifdef _DEBUG_
- std::cerr << "create_calcium_port: " << name << " " << type << " " << mode << " " << depend << std::endl;
-#endif
+ MESSAGE( "create_calcium_port: " << name << " " << type << " " << mode << " " << depend );
if(std::string(mode) == "IN")
{
--- /dev/null
+#include "CalciumCInterface.hxx"
+#include "CalciumCxxInterface.hxx"
+
+#include <stdio.h>
+
+
+//#define MYDEBUG
+#ifdef MYDEBUG
+#define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
+#else
+#define DEBTRACE(msg)
+#endif
+
+
+/* Définition de l'Interface entre l'API C et l'API C++
+ L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
+ En C/C++ il utilisera celle définie dans Calcium.c (calcium.h)
+ En C++/CORBA directement celle de CalciumCxxInterface.hxx
+*/
+
+
+#define STAR *
+
+/* Définition de ecp_lecture_... , ecp_ecriture_..., ecp_free_... */
+
+/* Le premier argument est utilisée :
+ - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_
+ - comme second argument template à l'appel de la méthode C++ correspondante
+ ( le type de port correspondant est alors obtenu par un trait)
+ Le second argument est utilisée :
+ - pour typer le paramètre data de la procédure générée
+ - pour déduire le type des paramètres t, ti tf via un trait
+ - comme premier paramètre template à l'appel de la méthode C++ correspondante
+ (pour typer les données passées en paramètre )
+ Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas
+ en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode
+ C++ CALCIUM de lecture repère cette différence de type et charge
+ le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles).
+*/
+// CALCIUM_C2CPP_INTERFACE_CXX_(_name,_porttype,_type,_qual)
+CALCIUM_C2CPP_INTERFACE_CXX_(intc,int,int,);
+CALCIUM_C2CPP_INTERFACE_CXX_(long,long,long,);
+
+CALCIUM_C2CPP_INTERFACE_CXX_(integer,integer,cal_int,);
+CALCIUM_C2CPP_INTERFACE_CXX_(int2integer ,integer, int,);
+CALCIUM_C2CPP_INTERFACE_CXX_(long2integer, integer, long,);
+
+CALCIUM_C2CPP_INTERFACE_CXX_(float,float,float, );
+CALCIUM_C2CPP_INTERFACE_CXX_(double,double,double,);
+/* Fonnctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/
+CALCIUM_C2CPP_INTERFACE_CXX_(bool,bool,int,);
+CALCIUM_C2CPP_INTERFACE_CXX_(cplx,cplx,float,);
+CALCIUM_C2CPP_INTERFACE_CXX_(str,str,char*,);
+
+/* Définition de ecp_fin */
+extern "C" CalciumTypes::InfoType
+ecp_fin_ (void * component, int code) {
+
+ Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
+
+ bool provideLastGivenValue = false;
+ if (code == CalciumTypes::CP_CONT ) provideLastGivenValue = true;
+
+ try {
+ CalciumInterface::ecp_fin( *_component,
+ provideLastGivenValue);
+ } catch ( const CalciumException & ex) { //tester l'arrêt par exception
+ DEBTRACE( ex.what() );
+ return ex.getInfo();
+ }
+ return CalciumTypes::CPOK;
+};
+
+// INTERFACE C/CPP pour les chaines de caractères
+// Le paramètre supplémentaire strsize n'étant pas utilisé
+// j'utilise la génération par la macro CALCIUM_C2CPP_INTERFACE_(str,char*,);
+// extern "C" CalciumTypes::InfoType ecp_lecture_str (void * component, int dependencyType,
+// float * ti, float * tf, long * i,
+// const char * const nomvar, size_t bufferLength,
+// size_t * nRead, char ** *data, size_t strsize ) {
+
+// Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
+// double _ti=*ti;
+// double _tf=*tf;
+// size_t _nRead=0;
+// size_t _bufferLength=bufferLength;
+// CalciumTypes::DependencyType dependencyType=
+// static_cast<CalciumTypes::DependencyType>(dependencyType);
+
+// // - GERER POINTEUR NULL : NOTHING TODO
+// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.)
+
+// DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" )
+// try {
+// CalciumInterface::ecp_lecture< char*, char* >( *_component,
+// dependencyType,
+// _ti, _tf, *i,
+// nomvar,
+// _bufferLength, _nRead, *data);
+// } catch ( const CalciumException & ex) {
+// DEBTRACE( ex.what() );
+// return ex.getInfo();
+// }
+
+// *nRead = _nRead;
+
+// if (dependencyType == CalciumTypes::CP_SEQUENTIEL )
+// *ti=(float)(_ti);
+
+// DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) ;
+
+// return CalciumTypes::CPOK;
+// };
+
+
+// extern "C" void ecp_lecture_str_free (char** data) {
+// CalciumInterface::ecp_free< char*, char* >(data);
+// };
+
+
+// extern "C" CalciumTypes::InfoType ecp_ecriture_str (void * component, int dependencyType,
+// float *t, long i,
+// const char * const nomvar, size_t bufferLength,
+// char ** data, int strsize ) {
+
+// Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
+// /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/
+// double _t=*t;
+// size_t _bufferLength=bufferLength;
+
+// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.)
+
+// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" )
+// try {
+// std::string essai(nomvar);
+// DEBTRACE( "----------->-" << nomvar )
+// CalciumInterface::ecp_ecriture< char*, char* >( *_component,
+// static_cast<CalciumTypes::DependencyType>(dependencyType),
+// _t,i,nomvar,_bufferLength,*data);
+// } catch ( const CalciumException & ex) {
+// std::cerr << ex.what() << std::endl;
+// return ex.getInfo();
+// }
+// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data )
+// return CalciumTypes::CPOK;
+// };
--- /dev/null
+/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+
+ Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ See http: www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+ File : CalciumInterface.hxx
+ Author : Eric Fayolle (EDF)
+ Module : KERNEL
+ Modified by : $LastChangedBy$
+ Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
+ Id : $Id$
+*/
+#ifndef _CALCIUM_C_INTERFACE_H_
+#define _CALCIUM_C_INTERFACE_H_
+
+#include "CalciumMacroCInterface.hxx"
+#include "CalciumTypes.hxx"
+#include "CalciumFortranInt.h"
+#include <cstdlib>
+
+/* Déclaration de l'Interface entre l'API C et l'API C++
+ L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
+ En C/C++ il utilisera celle définie dans Calcium.c (calcium.h)
+2 En C++/CORBA directement celle de CalciumCxxInterface.hxx
+*/
+
+/* En CALCIUM l'utilisation de données de type double
+ implique des dates de type double, pour les autres
+ types de données les dates sont de type float
+*/
+template <class T> struct CalTimeType {
+ typedef float TimeType;
+};
+
+template <> struct CalTimeType<double> {
+ typedef double TimeType;
+};
+
+/* Déclaration de ecp_lecture_... , ecp_ecriture_..., ecp_free_... */
+
+/* Le premier argument est utilisé :
+ - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_
+ Le second argument est utilisé :
+ - comme argument template à l'appel de la méthode C++ correspondante
+ ( le type CORBA de port correspondant est alors obtenu par un trait)
+ Le troisième argument est utilisée :
+ - pour typer le paramètre data de la procédure générée
+ - pour déduire le type des paramètres t, ti tf via un trait
+ - comme premier paramètre template à l'appel de la méthode C++ correspondante
+ (pour typer les données passées en paramètre )
+ Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas
+ en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode
+ C++ CALCIUM de lecture repère cette différence de type et charge
+ le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles).
+ Notons qu'en CORBA CORBA:Long est mappé sur long uniquement si celui-ci est 32bits sinon
+ il sera mappé sur le type int (si il est 32bits). Le type CORBA:LongLong est mappé sur le type long
+ s'il est 64 bits sinon celà peut être un long long (s'il existe).
+*/
+CALCIUM_C2CPP_INTERFACE_HXX_(intc,int,int,);
+CALCIUM_C2CPP_INTERFACE_HXX_(long,long,long,);
+
+CALCIUM_C2CPP_INTERFACE_HXX_(integer,integer,cal_int,);
+CALCIUM_C2CPP_INTERFACE_HXX_(int2integer,integer,int,);
+CALCIUM_C2CPP_INTERFACE_HXX_(long2integer,integer, long,);
+
+CALCIUM_C2CPP_INTERFACE_HXX_(float,float,float, );
+CALCIUM_C2CPP_INTERFACE_HXX_(double,double,double,);
+/* Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);*/
+CALCIUM_C2CPP_INTERFACE_HXX_(bool,bool,int,);
+CALCIUM_C2CPP_INTERFACE_HXX_(cplx,cplx,float,);
+CALCIUM_C2CPP_INTERFACE_HXX_(str,str,char*,);
+
+/* Déclaration de ecp_fin */
+extern "C" CalciumTypes::InfoType ecp_fin_ (void * component, int code);
+
+#endif
CalciumTypes::DependencyType CalciumCouplingPolicy::getDependencyType () const { return _dependencyType;}
void CalciumCouplingPolicy::setStorageLevel (size_t storageLevel) {
-#ifdef _DEBUG_
- std::cerr << "CalciumCouplingPolicy::setStorageLevel: " << storageLevel << std::endl;
-#endif
+ MESSAGE( "CalciumCouplingPolicy::setStorageLevel: " << storageLevel );
if ( storageLevel < 1 && (storageLevel != CalciumTypes::UNLIMITED_STORAGE_LEVEL) )
throw CalciumException(CalciumTypes::CPRENA,LOC("Un niveau < 1 n'est pas autorisé"));
_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;
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]"));
}
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;
#include "CalciumTypes.hxx"
#include "CalciumException.hxx"
+//#define MYDEBUG
+
class CalciumCouplingPolicy : public CouplingPolicy {
MapIterator it2=it1; ++it2;
size_t dataSize1 = DataManipulator::size(it1->second);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId1 : " << dataSize1 << std::endl;
#endif
// Gérer dans calcium la limite de la taille du buffer donnée par
// l'utilisateur.
size_t dataSize2 = DataManipulator::size(it2->second);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId2 : " << dataSize2 << std::endl;
#endif
DataId dataId1 = it1->first;
TimeType t2 = dataId2.first;
TimeType t1 = dataId1.first;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t1 : " << t1 << std::endl;
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t2 : " << t2 << std::endl;
#endif
TimeType t = dataId.first;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t : " << t << std::endl;
#endif
TimeType timeDiff = t2-t1;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de timeDiff : " << timeDiff << std::endl;
#endif
TimeType coeff = (t2-t)/timeDiff;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de coeff : " << coeff << std::endl;
#endif
InnerType const * const InIt1 = DataManipulator::getPointer(it1->second);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t1 : " << std::endl;
std::copy(InIt1,InIt1+dataSize1,std::ostream_iterator<InnerType>(std::cout," "));
std::cout << std::endl;
#endif
InnerType const * const InIt2 = DataManipulator::getPointer(it2->second);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t2 : " << std::endl;
std::copy(InIt2,InIt2+dataSize2,std::ostream_iterator<InnerType>(std::cout," "));
std::cout << std::endl;
Type dataOut = DataManipulator::create(dataSize);
InnerType * const OutIt = DataManipulator::getPointer(dataOut);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : interpolationSchem : " << _couplingPolicy._interpolationSchem << std::endl;
std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : alpha : " << _couplingPolicy._alpha << std::endl;
std::cerr << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : datecalschem : " << _couplingPolicy._dateCalSchem << std::endl;
// }
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données calculées à t : " << std::endl;
std::copy(OutIt,OutIt+dataSize,std::ostream_iterator<InnerType>(std::cout," "));
std::cout << std::endl;
AdjacentFunctor< key_type > af(expectedDataId);
if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY )
{
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- time expected : " << expectedDataId.first << std::endl;
std::cout << "-------- time expected corrected : " << expectedDataId.first*(1.0-_deltaT) << std::endl;
#endif
typename AssocContainer::iterator current = prev;
while ( (current != storedDatas.end()) && !af(current->first) )
{
-#ifdef _DEBUG_
- std::cout << "------- stored time : " << current->first << std::endl;
+#ifdef MYDEBUG
+ std::cerr << "------- stored time : " << current->first << std::endl;
#endif
// if ( af(current->first) ) break;
prev = current++;
else
wDataIt1 = storedDatas.end();
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl;
#endif
typedef typename Container::value_type value_type;
typedef typename Container::iterator iterator;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- CalciumCouplingPolicy::eraseDataId, storedDatasSize : " << storedDatas.size() << std::endl;
#endif
" 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;
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
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
// 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 ;
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
#include <stdio.h>
-//#define _DEBUG_
+#include <typeinfo>
template <typename T1, typename T2>
struct IsSameType {
static const bool value = true;
};
+//#define MYDEBUG
#include <boost/type_traits/remove_all_extents.hpp>
// calcium_uses_port* myCalciumUsesPort=
// dynamic_cast<calcium_uses_port*>(myUsesPort);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|"<< *it <<"|----"<<
// typeid(myUsesPort).name() <<"-------------" <<
typeid(myCalciumUsesPort).name() <<"-------------" << std::endl;
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
// T1 est le type de données
// T2 est un <nom> de type Calcium permettant de sélectionner le port CORBA correspondant
- // T1 et T2 sont dissociés pour discriminer le cas des nombres complexes
+ // T1 et T2 sont dissociés pour discriminer par exemple le cas des nombres complexes
// -> Les données des nombres complexes sont de type float mais
// le port à utiliser est le port cplx
template <typename T1, typename T2 > static void
CorbaDataType corbaData;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl;
#endif
throw CalciumException(CalciumTypes::CPNMVR,
LOC("Le nom de la variable est <nul>"));
PortType * port;
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecp_lecture) MARK 2 ------------------" << std::endl;
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(lecture) MARK 2 --"<<typeid(port).name()<<"----------------" << std::endl;
+ T1 t1;
+ T2 t2;
+ std::cout << "-------- CalciumInterface(lecture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(lecture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
#endif
try {
port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str());
-#ifdef _DEBUG_
+#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));
}
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
nRead = corbaDataSize;
// Si les types T1 et InnerType sont différents, il faudra effectuer tout de même une recopie
if (!IsSameType<T1,InnerType>::value) data = new T1[nRead];
-#ifdef _DEBUG_
+#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<T1,InnerType>::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
// 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<false, DataManipulator >::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<T1>(std::cout," "));
std::cout << "Ptr :" << data << std::endl;
assert(&component);
//typedef typename StarTrait<TT>::NonStarType T;
- typedef typename boost::remove_all_extents< T2 >::type T2_without_extent;
typedef typename boost::remove_all_extents< T1 >::type T1_without_extent;
-
+ typedef typename boost::remove_all_extents< T2 >::type T2_without_extent;
typedef typename UsesPortTraits <T2_without_extent>::PortType UsesPortType;
typedef typename ProvidesPortTraits<T2_without_extent>::PortType ProvidesPortType;// pour obtenir un manipulateur de données
typedef typename ProvidesPortType::DataManipulator DataManipulator;
CalciumTypes::DependencyType _dependencyType=
static_cast<CalciumTypes::DependencyType>(dependencyType);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl;
#endif
if ( nomVar.empty() ) throw CalciumException(CalciumTypes::CPNMVR,
LOC("Le nom de la variable est <nul>"));
UsesPortType * port;
-#ifdef _DEBUG_
- std::cout << "-------- CalciumInterface(ecriture) MARK 2 ------------------" << std::endl;
+#ifdef MYDEBUG
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2 ---"<<typeid(port).name()<<"---------------" << std::endl;
+ T1 t1;
+ T2 t2;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2b1 -----" << typeid(t1).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 2b2 -----" << typeid(t2).name() << "-------------" << std::endl;
#endif
try {
port = component.Superv_Component_i::get_port< UsesPortType > (nomVar.c_str());
-#ifdef _DEBUG_
+#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));
}
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
// OLD : Il faut effectuer une copie dans le port provides.
// OLD : Cette copie est effectuée dans GenericPortUses::put
// OLD : en fonction de la collocalisation ou non.
+#ifdef MYDEBUG
+ T1_without_extent t1b;
+ InnerType t2b;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 4b1 -----" << typeid(t1b).name() << "-------------" << std::endl;
+ std::cout << "-------- CalciumInterface(ecriture) MARK 4b2 -----" << typeid(t2b).name() << "-------------" << std::endl;
+#endif
+
Copy2CorbaSpace<IsSameType<T1_without_extent,InnerType>::value, DataManipulator >::apply(corbaData,_data,bufferLength);
//TODO : GERER LES EXCEPTIONS ICI : ex le port n'est pas connecté
}
//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
}
{
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;
// 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
--- /dev/null
+/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+
+ Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ See http: www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+ File : CalciumInterface.hxx
+ Author : Eric Fayolle (EDF)
+ Module : KERNEL
+ Modified by : $LastChangedBy$
+ Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
+ Id : $Id$
+*/
+#ifndef _CALCIUM_FORTRAN_INT_H_
+#define _CALCIUM_FORTRAN_INT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef @LONG_OR_INT@ cal_int;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
try { \
\
if (key == "StorageLevel" ) \
- {if ( ok=(value >>= sl) ) Port::setStorageLevel(sl);} \
+ {if ( ( ok=(value >>= sl) ) ) Port::setStorageLevel(sl);} \
else if (key == "Alpha" ) \
- {if ( ok=(value >>= alpha) ) Port::setAlpha(alpha);} \
+ {if ( ( ok=(value >>= alpha) ) ) Port::setAlpha(alpha);} \
else if (key == "DeltaT" ) \
- {if ( ok=(value >>= delta) ) Port::setDeltaT(delta);} \
+ {if ( ( ok=(value >>= delta) ) ) Port::setDeltaT(delta);} \
else if (key == "DependencyType" ) \
- {if ( ok=( value >>= dt) ) Port::setDependencyType(dependencyType[dt]);} \
+ {if ( ( ok=( value >>= dt) ) ) Port::setDependencyType(dependencyType[dt]);} \
else if (key == "DateCalSchem" ) \
- {if ( ok=(value >>= dcs) ) \
+ {if ( ( ok=(value >>= dcs) ) ) \
Port::setDateCalSchem(dateCalSchem[dcs]);} \
else if (key == "InterpolationSchem") \
- {if ( ok=(value >>= is) ) \
+ {if ( ( ok=(value >>= is) ) ) \
Port::setInterpolationSchem(interpolationSchem[is]);} \
else if (key == "ExtrapolationSchem") \
- {if ( ok=(value >>= es) ) \
+ {if ( ( ok=(value >>= es) ) ) \
Port::setExtrapolationSchem(extrapolationSchem[es]);} \
else \
throw Ports::NotDefined(); \
//Interface CALCIUM des utilisateurs en C++
#include "CalciumCxxInterface.hxx"
-#include "CalciumException.hxx"
-#include "CalciumTypes.hxx"
+/* Déclaration de l'Interface entre l'API C et l'API C++
+ L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
+ En C/C++ il utilisera celle définie dans Calcium.c (calcium.h)
+ En C++/CORBA directement celle de CalciumCxxInterface.hxx
+*/
+#include "CalciumCInterface.hxx"
-#include <stdio.h>
-//Ce fichier déclare et défini l'interfaçage entre l'API utilisteur C et C++
-//Les procédures déclarées n'ont pas vocation à être utilisées directement (celà est
-// cependant possible).
-//#define _DEBUG_
-
-#ifdef _DEBUG_
-#define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
-#else
-#define DEBTRACE(msg)
-#endif
-
-
-// Interface C/C++
-// L'utilisateur CALCIUM n'a normalement pas a utliser cette interface
-// En C/C++ il utilisera celle définie dans Calcium.c
-// En C++/CORBA directement celle de CalciumCxxInterface
-
-// En CALCIUM l'utilisation de données de type double
-// implique des dates de type double, pour les autres
-// types de données les dates sont de type float
-template <class T> struct CalTimeType {
- typedef float TimeType;
-};
-
-template <> struct CalTimeType<double> {
- typedef double TimeType;
-};
-
-// Définition de ecp_fin
-extern "C" CalciumTypes::InfoType
-ecp_fin_ (void * component, int code) {
-
- Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
-
- bool provideLastGivenValue = false;
- if (code == CalciumTypes::CP_CONT ) provideLastGivenValue = true;
-
- try {
- CalciumInterface::ecp_fin( *_component,
- provideLastGivenValue);
- } catch ( const CalciumException & ex) { //tester l'arrêt par exception
- DEBTRACE( ex.what() );
- return ex.getInfo();
- }
- return CalciumTypes::CPOK;
-};
-
-
-// Définition de ecp_lecture_... , ecp_ecriture_..., ecp_free_...
-#define CALCIUM_C2CPP_INTERFACE_(_name,_type,_qual) \
- extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
- CalTimeType< _type _qual >::TimeType * ti, \
- CalTimeType< _type _qual >::TimeType * tf, long * i, \
- const char * const nomvar, size_t bufferLength, \
- size_t * nRead, _type _qual ** data ) { \
- Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
- double _ti=*ti; \
- double _tf=*tf; \
- size_t _nRead=0; \
- size_t _bufferLength=bufferLength; \
- \
- if ( IsSameType< _name , cplx >::value ) _bufferLength*=2; \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \
- try { \
- CalciumInterface::ecp_lecture< _type, _name >( *_component, \
- dependencyType, \
- _ti, _tf, *i, \
- nomvar, \
- _bufferLength, _nRead, *data); \
- } catch ( const CalciumException & ex) { \
- DEBTRACE( ex.what() ); \
- return ex.getInfo(); \
- } catch ( ... ) { \
- std::cerr << "Unexpected exception " << std::endl; \
- return CalciumTypes::CPATAL; \
- } \
- if ( IsSameType< _name , cplx >::value ) { *nRead=_nRead/2; \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \
- } else *nRead = _nRead; \
- if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) \
- *ti=(CalTimeType< _type _qual >::TimeType)(_ti); \
- DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \
- return CalciumTypes::CPOK; \
- }; \
- \
- \
- extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) { \
- CalciumInterface::ecp_free< _type, _name >(data); \
- }; \
- \
- \
- extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
- CalTimeType< _type _qual >::TimeType *t, \
- long i, \
- const char * const nomvar, size_t bufferLength, \
- _type _qual * data ) { \
- Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
- /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ \
- double _t=*t; \
- size_t _bufferLength=bufferLength; \
- if ( IsSameType< _name , cplx >::value ) _bufferLength=_bufferLength*2; \
- DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) \
- try { \
- /*printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar);*/ \
- DEBTRACE( "----------->-" << nomvar ) \
- CalciumInterface::ecp_ecriture< _type, _name >( *_component, \
- dependencyType, \
- _t,i,nomvar,_bufferLength,*data); \
- } catch ( const CalciumException & ex) { \
- std::cerr << ex.what() << std::endl; \
- return ex.getInfo(); \
- } catch ( ... ) { \
- std::cerr << "Unexpected exception " << std::endl; \
- return CalciumTypes::CPATAL; \
- } \
- DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data ) \
- return CalciumTypes::CPOK; \
- }; \
-
-
-
-#define STAR *
-// Le premier argument est utilisée :
-// - comme suffixe dans la définition des noms ecp_lecture_ , ecp_ecriture_ et ecp_free_
-// - comme second argument template à l'appel de la méthode C++ correspondante
-// ( le type de port correspondant est alors obtenu par un trait)
-// Le second argument est utilisée :
-// - pour typer le paramètre data de la procédure générée
-// - pour déduire le type des paramètres t, ti tf via un trait
-// - comme premier paramètre template à l'appel de la méthode C++ correspondante
-// (pour typer les données passées en paramètre )
-// Notons que dans le cas CALCIUM_C2CPP_INTERFACE_(int,int,), le type int n'existe pas
-// en CORBA, le port CALCIUM correspondant utilise une séquence de long. La méthode
-// C++ CALCIUM de lecture repère cette différence de type et charge
-// le manipulateur de données d'effectuer une recopie (qui fonctionne si les types sont compatibles).
-CALCIUM_C2CPP_INTERFACE_(int,int,);
-CALCIUM_C2CPP_INTERFACE_(float,float, );
-CALCIUM_C2CPP_INTERFACE_(double,double,);
-// Fonctionne mais essai suivant pour simplification de Calcium.c CALCIUM_C2CPP_INTERFACE_(bool,bool,);
-CALCIUM_C2CPP_INTERFACE_(bool,int,);
-CALCIUM_C2CPP_INTERFACE_(cplx,float,);
-CALCIUM_C2CPP_INTERFACE_(str,char*,);
-
-// INTERFACE C/CPP pour les chaines de caractères
-// Le paramètre supplémentaire strsize n'étant pas utilisé
-// j'utilise la génération par la macro CALCIUM_C2CPP_INTERFACE_(str,char*,);
-// extern "C" CalciumTypes::InfoType ecp_lecture_str (void * component, int dependencyType,
-// float * ti, float * tf, long * i,
-// const char * const nomvar, size_t bufferLength,
-// size_t * nRead, char ** *data, size_t strsize ) {
-
-// Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
-// double _ti=*ti;
-// double _tf=*tf;
-// size_t _nRead=0;
-// size_t _bufferLength=bufferLength;
-// CalciumTypes::DependencyType dependencyType=
-// static_cast<CalciumTypes::DependencyType>(dependencyType);
-
-// // - GERER POINTEUR NULL : NOTHING TODO
-// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.)
-
-// DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" )
-// try {
-// CalciumInterface::ecp_lecture< char*, char* >( *_component,
-// dependencyType,
-// _ti, _tf, *i,
-// nomvar,
-// _bufferLength, _nRead, *data);
-// } catch ( const CalciumException & ex) {
-// DEBTRACE( ex.what() );
-// return ex.getInfo();
-// }
-
-// *nRead = _nRead;
-
-// if (dependencyType == CalciumTypes::CP_SEQUENTIEL )
-// *ti=(float)(_ti);
-
-// DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) ;
-
-// return CalciumTypes::CPOK;
-// };
-
-
-// extern "C" void ecp_lecture_str_free (char** data) {
-// CalciumInterface::ecp_free< char*, char* >(data);
-// };
-
-
-// extern "C" CalciumTypes::InfoType ecp_ecriture_str (void * component, int dependencyType,
-// float *t, long i,
-// const char * const nomvar, size_t bufferLength,
-// char ** data, int strsize ) {
-
-// Superv_Component_i * _component = static_cast<Superv_Component_i *>(component);
-// /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/
-// double _t=*t;
-// size_t _bufferLength=bufferLength;
-
-// // - VERIFIER LA TAILLE DES CHAINES RETOURNEES (ELLES DEVRAIENT ETRES CORRECTES SI L'ECRITURE EST BIEN CODEE.)
-
-// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" )
-// try {
-// std::string essai(nomvar);
-// DEBTRACE( "----------->-" << nomvar )
-// CalciumInterface::ecp_ecriture< char*, char* >( *_component,
-// static_cast<CalciumTypes::DependencyType>(dependencyType),
-// _t,i,nomvar,_bufferLength,*data);
-// } catch ( const CalciumException & ex) {
-// std::cerr << ex.what() << std::endl;
-// return ex.getInfo();
-// }
-// DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data :" << data )
-// return CalciumTypes::CPOK;
-// };
#endif
--- /dev/null
+/* Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+
+Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+See http: www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+File : CalciumInterface.hxx
+Author : Eric Fayolle (EDF)
+Module : KERNEL
+Modified by : $LastChangedBy$
+Date : $LastChangedDate: 2007-03-01 13:27:58 +0100 (jeu, 01 mar 2007) $
+Id : $Id$
+*/
+
+#ifndef _CALCIUM_MACRO_C_INTERFACE_H_
+#define _CALCIUM_MACRO_C_INTERFACE_H_
+
+
+
+/****** CALCIUM_C2CPP_INTERFACE_HXX_ : ******/
+/****** 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<Superv_Component_i *>(component); \
+ double _ti=*ti; \
+ double _tf=*tf; \
+ size_t _nRead=0; \
+ size_t _bufferLength=bufferLength; \
+ \
+ if ( IsSameType< _porttype , cplx >::value ) _bufferLength*=2; \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \
+ try { \
+ CalciumInterface::ecp_lecture< _type,_porttype >( *_component, \
+ dependencyType, \
+ _ti, _tf, *i, \
+ nomvar, \
+ _bufferLength, _nRead, *data); \
+ } catch ( const CalciumException & ex) { \
+ DEBTRACE( ex.what() ); \
+ return ex.getInfo(); \
+ } catch ( ... ) { \
+ DEBTRACE( "Unexpected exception ") ; \
+ return CalciumTypes::CPATAL; \
+ } \
+ if ( IsSameType< _porttype , cplx >::value ) { *nRead=_nRead/2; \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \
+ } else *nRead = _nRead; \
+ if (dependencyType == CalciumTypes::CP_SEQUENTIEL ) \
+ *ti=(CalTimeType< _type _qual >::TimeType)(_ti); \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \
+ return CalciumTypes::CPOK; \
+ }; \
+ \
+ \
+ extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) { \
+ CalciumInterface::ecp_free< _type, _porttype >(data); \
+ }; \
+ \
+ \
+ extern "C" CalciumTypes::InfoType ecp_ecriture_##_name (void * component, int dependencyType, \
+ CalTimeType< _type _qual >::TimeType *t, \
+ long i, \
+ const char * const nomvar, size_t bufferLength, \
+ _type _qual * data ) { \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 0 ------------------" ) \
+ Superv_Component_i * _component = static_cast<Superv_Component_i *>(component); \
+ /* Je ne sais pas pourquoi, je n'arrive pas à passer t par valeur : corruption de la pile*/ \
+ double _t=*t; \
+ size_t _bufferLength=bufferLength; \
+ if ( IsSameType< _porttype , cplx >::value ) _bufferLength=_bufferLength*2; \
+ 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
template <class T> struct ProvidesPortTraits {
typedef UnknownProvidesPortType<T> PortType;
};
-template <> struct ProvidesPortTraits<int> {
+struct integer {};
+template <> struct ProvidesPortTraits<integer> {
typedef calcium_integer_port_provides PortType;
};
+template <> struct ProvidesPortTraits<int> {
+ typedef calcium_intc_port_provides PortType;
+};
template <> struct ProvidesPortTraits<long> {
- typedef calcium_integer_port_provides PortType;
+ typedef calcium_long_port_provides PortType;
};
template <> struct ProvidesPortTraits<float> {
typedef calcium_real_port_provides PortType;
template <> struct ProvidesPortTraits<str> {
typedef calcium_string_port_provides PortType;
};
+// Définition du type intc pour obtenir le type de port
+// correspondant
+struct intc {};
+template <> struct ProvidesPortTraits<intc> {
+ typedef calcium_intc_port_provides PortType;
+};
template < typename T > struct StarTrait { typedef T NonStarType; };
template <class T> struct UsesPortTraits {
typedef UnknownUsesPortType<T> PortType;
};
-template <> struct UsesPortTraits<int> {
+template <> struct UsesPortTraits<integer> {
typedef calcium_integer_port_uses PortType;
};
+template <> struct UsesPortTraits<int> {
+ typedef calcium_intc_port_uses PortType;
+};
template <> struct UsesPortTraits<long> {
- typedef calcium_integer_port_uses PortType;
+ typedef calcium_long_port_uses PortType;
};
template <> struct UsesPortTraits<float> {
typedef calcium_real_port_uses PortType;
template <> struct UsesPortTraits<cplx> {
typedef calcium_complex_port_uses PortType;
};
+template <> struct UsesPortTraits<intc> {
+ typedef calcium_intc_port_uses PortType;
+};
#endif
CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_integer_port_provides)
+CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_long_port_provides)
+
+CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_intc_port_provides)
+
CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_real_port_provides)
CALCIUM_GENERIC_PROVIDES_PORT_CXX(calcium_double_port_provides)
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// Modified by : $LastChangedBy$
-// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $
-// Id : $Id$
-//
-#ifndef _CALCIUM_PORT_PROVIDES_HXX_
-#define _CALCIUM_PORT_PROVIDES_HXX_
-
-#include <SALOMEconfig.h>
-
-#include "Calcium_Ports.hh"
-#include "CalciumGenericProvidesPort.hxx"
-#include "CalciumCouplingPolicy.hxx"
-
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_integer_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Integer_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_long,CORBA::Long> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_real_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Real_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_double_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Double_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_double,CORBA::Double> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_complex_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Complex_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_logical_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_Logical_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_boolean,CORBA::Boolean> ) \
-
-CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_string_port_provides, \
- POA_Ports::Calcium_Ports::Calcium_String_Port, \
- seq_u_manipulation<Ports::Calcium_Ports::seq_string,char *> ) \
-
-#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-03-01 13:40:26 +0100 (Thu, 01 Mar 2007) $
+// Id : $Id$
+//
+#ifndef _CALCIUM_PORT_PROVIDES_HXX_
+#define _CALCIUM_PORT_PROVIDES_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericProvidesPort.hxx"
+#include "CalciumCouplingPolicy.hxx"
+
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_integer_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Integer_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_integer,@CALCIUM_CORBA_INT_F77@> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_long_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Long_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_long_long,CORBA::LongLong> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_intc_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Intc_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_long,CORBA::Long> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_real_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Real_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_double_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Double_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_double,CORBA::Double> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_complex_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Complex_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_float,CORBA::Float> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_logical_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_Logical_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_boolean,CORBA::Boolean> ) \
+
+CALCIUM_GENERIC_PROVIDES_PORT_HXX(calcium_string_port_provides, \
+ POA_Ports::Calcium_Ports::Calcium_String_Port, \
+ seq_u_manipulation<Ports::Calcium_Ports::seq_string,char *> ) \
+
+#endif
// Id : $Id$
//
#include "CalciumTypes2CorbaTypes.hxx"
+#include "utilities.h"
#include <iostream>
using namespace std;
map<CalciumTypes::DependencyType,
Ports::Calcium_Ports::DependencyType > &
table = ( map<CalciumTypes::DependencyType,
- Ports::Calcium_Ports::DependencyType > & ) *this ;
+ Ports::Calcium_Ports::DependencyType > & ) *this ;
-table[CalciumTypes::TIME_DEPENDENCY ] = Ports::Calcium_Ports::TIME_DEPENDENCY ;
-table[CalciumTypes::ITERATION_DEPENDENCY ] = Ports::Calcium_Ports::ITERATION_DEPENDENCY ;
-table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ;
+ table[CalciumTypes::TIME_DEPENDENCY ] = Ports::Calcium_Ports::TIME_DEPENDENCY ;
+ table[CalciumTypes::ITERATION_DEPENDENCY ] = Ports::Calcium_Ports::ITERATION_DEPENDENCY ;
+ table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ;
-#ifdef _DEBUG_
-std::cerr << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::TIME_DEPENDENCY<<"] : "<<
- table[CalciumTypes::TIME_DEPENDENCY] << std::endl;
-std::cerr << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::ITERATION_DEPENDENCY<<"] : "<<
- table[CalciumTypes::ITERATION_DEPENDENCY] << std::endl;
-std::cerr << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::UNDEFINED_DEPENDENCY<<"] : "<<
- table[CalciumTypes::UNDEFINED_DEPENDENCY] << std::endl;
-#endif
+ MESSAGE("CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::TIME_DEPENDENCY<<"] : "<< table[CalciumTypes::TIME_DEPENDENCY]);
+ MESSAGE("CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::ITERATION_DEPENDENCY<<"] : "<< table[CalciumTypes::ITERATION_DEPENDENCY]);
+ MESSAGE("CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::UNDEFINED_DEPENDENCY<<"] : "<< table[CalciumTypes::UNDEFINED_DEPENDENCY]);
}
map<CalciumTypes::DependencyType,
Ports::Calcium_Ports::DependencyType > &
table = (map<CalciumTypes::DependencyType,
- Ports::Calcium_Ports::DependencyType >& ) *this ;
+ Ports::Calcium_Ports::DependencyType >& ) *this ;
-#ifdef _DEBUG_
-std::cerr << "CORBA_DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
-#endif
+ MESSAGE("CORBA_DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c]);
assert( table.find( (CalciumTypes::DependencyType)c ) != table.end() ) ;
return table[ (CalciumTypes::DependencyType)c ] ;
#ifndef _COPY_TO_CORBA_SPACE_HXX_
#define _COPY_TO_CORBA_SPACE_HXX_
+
#include <string>
#include <iostream>
#include "CalciumPortTraits.hxx"
+//#define MYDEBUG
+
template <bool zerocopy, typename DataManipulator>
struct Copy2CorbaSpace {
//ESSAI: typedef typename PortType::DataManipulator DataManipulator;
typedef typename DataManipulator::InnerType InnerType;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- Copy2CorbaSpace<true> MARK 1 ------------------" << std::endl;
#endif
// Crée le type corba à partir du data sans lui en donner la propriété.
// DataManipulator::create n'a pas le caractère const sur son paramètre data pour le
// cas de figure où la propriété de la donnée lui est donnée.
corbaData = DataManipulator::create(nRead,const_cast<T2 * > (&data),false);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- Copy2CorbaSpace<true> MARK 2 --(dataPtr : "
<< DataManipulator::getPointer(corbaData,false)<<")----------------" << std::endl;
#endif
corbaData = DataManipulator::create(nRead);
InnerType * dataPtr = DataManipulator::getPointer(corbaData,false);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- Copy2CorbaSpace<false> MARK 1 --(dataPtr : " <<
dataPtr<<")----------------" << std::endl;
#endif
// Attention : Pour les chaines ou tout autre object complexe il faut utiliser une recopie profonde !
std::copy(&data,&data+nRead,dataPtr);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "-------- Copy2CorbaSpace<false> MARK 2 --(nRead: "<<nRead<<")-------------" << std::endl;
std::cerr << "-------- Copy2CorbaSpace<false> MARK 3 : " ;
#include <cstdio>
+//#define MYDEBUG
+
//Les demandes de copies vers l'espace utilisateur
//proviennent d'une procédure de lecture
// Le PORT doit être capable de répondre aux demandes de lecture
// multiples d'une donnée pour une même estampille et doit donc garder un pointeur valide
// sur le buffer. Il se pose cependant un problème s'il décide
- // de supprimer la donnée alors que des client utilise le buffer (historique) !
+ // de supprimer la donnée alors que des client utilise le buffer (historique calcium) !
// La seule façon de gérer proprement cette situation est d'utiliser un shared_pointer (TODO).
// Pour l'instant l'utilisateur du mode zero copie doit s'assurer que le niveau d'historique
// utilisé par le port est compatible avec son utilisation des buffers. Il doit
- // être également conscient que s'il modifie le buffer, il est modifier pour tous les
+ // être également conscient que s'il modifie le buffer, il est modifié pour tous les
// utilisateurs actuels et futurs.
//REF: InnerType * dataPtr = DataManipulator::getPointer(corbaData,true);
// Cette ligne poserait uun problème dans la méthode appelante, si elle
// ne testait pas que les types utilisateurs et CORBA sont identiques :
// ex : InnerType == Corba::Long et d'un T == int
- // C'est l'objet de la procédure suivante
+ // C'est l'objet de la spécialisation ci-dessous.
data = dataPtr;
// En zero copie l'utilisateur doit appeler ecp_free ( cas ou un buffer intermédiaire
typedef typename DataManipulator::InnerType InnerType;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
InnerType * dataPtr = NULL;
// Affiche la valeur du pointeur de la structure corba
// et les pointeurs contenus le cas échéant
//std::copy(dataPtr,dataPtr+nRead,data);
DataManipulator::copy(corbaData,data,nRead);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
tmpData = data;
std::cerr << "-------- Copy2UserSpace<false> MARK 1c --data("<<tmpData<<")[0.."<<
DataManipulator::size(corbaData) <<"] : ----------------" << std::endl;
// Id : $Id$
//
#include "CorbaTypes2CalciumTypes.hxx"
+#include "utilities.h"
#include <iostream>
using namespace std;
map<Ports::Calcium_Ports::DependencyType,
CalciumTypes::DependencyType > &
table = ( map<Ports::Calcium_Ports::DependencyType,
- CalciumTypes::DependencyType > & ) *this ;
+ CalciumTypes::DependencyType > & ) *this ;
-table[Ports::Calcium_Ports::TIME_DEPENDENCY ] = CalciumTypes::TIME_DEPENDENCY ;
-table[Ports::Calcium_Ports::ITERATION_DEPENDENCY ] = CalciumTypes::ITERATION_DEPENDENCY ;
-table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ;
+ table[Ports::Calcium_Ports::TIME_DEPENDENCY ] = CalciumTypes::TIME_DEPENDENCY ;
+ table[Ports::Calcium_Ports::ITERATION_DEPENDENCY ] = CalciumTypes::ITERATION_DEPENDENCY ;
+ table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ;
-
-#ifdef _DEBUG_
-std::cerr << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::TIME_DEPENDENCY<<"] : "<<
- table[Ports::Calcium_Ports::TIME_DEPENDENCY] << std::endl;
-std::cerr << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::ITERATION_DEPENDENCY<<"] : "<<
- table[Ports::Calcium_Ports::ITERATION_DEPENDENCY] << std::endl;
-std::cerr << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::UNDEFINED_DEPENDENCY<<"] : "<<
- table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY] << std::endl;
-#endif
+ MESSAGE("DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::TIME_DEPENDENCY<<"] : "<< table[Ports::Calcium_Ports::TIME_DEPENDENCY]);
+ MESSAGE("DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::ITERATION_DEPENDENCY<<"] : "<< table[Ports::Calcium_Ports::ITERATION_DEPENDENCY]);
+ MESSAGE("DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::UNDEFINED_DEPENDENCY<<"] : "<< table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY]);
}
CalciumTypes::DependencyType> &table = (map<Ports::Calcium_Ports::DependencyType,
CalciumTypes::DependencyType>&)*this ;
-#ifdef _DEBUG_
-std::cerr << "DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
-#endif
+ MESSAGE("DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c]);
assert( table.find( (Ports::Calcium_Ports::DependencyType)c ) != table.end() ) ;
return table[ (Ports::Calcium_Ports::DependencyType)c ] ;
calcium_uses_port.hxx \
CalciumGenericUsesPort.hxx \
calcium_provides_port.hxx \
- CalciumProvidesPort.hxx \
- calcium_integer_port_uses.hxx \
+ calcium_intc_port_uses.hxx \
+ calcium_long_port_uses.hxx \
calcium_real_port_uses.hxx \
calcium_double_port_uses.hxx \
calcium_string_port_uses.hxx \
CalciumException.hxx \
CalciumTypes.hxx \
CalciumCxxInterface.hxx \
+ CalciumMacroCInterface.hxx \
+ CalciumCInterface.hxx \
CalciumInterface.hxx \
Copy2UserSpace.hxx \
Copy2CorbaSpace.hxx \
CalciumPortTraits.hxx \
calcium.h \
+ calciumf.h \
Calcium.hxx \
calciumP.h \
calciumE.h \
version.h \
calcium.hf
-EXTRA_DIST=fortoc.h
+nodist_salomeinclude_HEADERS = calcium_integer_port_uses.hxx CalciumProvidesPort.hxx CalciumFortranInt.h
+
+EXTRA_DIST=fortoc.h calcium_integer_port_uses.hxx.in CalciumProvidesPort.hxx.in CalciumFortranInt.h.in
+
+calcium_integer_port_uses.hxx: calcium_integer_port_uses.hxx.in
+CalciumProvidesPort.hxx : CalciumProvidesPort.hxx.in
+CalciumFortranInt.h : CalciumFortranInt.h.in
+
#
# ===============================================================
# Local definitions
COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \
-I$(top_srcdir)/src/DSC/DSC_User/Datastream \
-I$(top_srcdir)/src/DSC/DSC_User/Datastream/Palm \
+ -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Calcium \
-I$(top_srcdir)/src/DSC/DSC_User/Basic \
-I$(top_srcdir)/src/DSC/DSC_Basic \
-I$(top_srcdir)/src/SALOMELocalTrace \
-I$(top_srcdir)/src/Utils \
-I$(top_srcdir)/src/Container \
-I$(top_srcdir)/src/Notification \
- -I$(top_builddir)/salome_adm/unix -include SALOMEconfig.h \
-I$(top_builddir)/idl \
+ -I$(top_builddir)/src/DSC/DSC_User/Datastream/Calcium \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@
# This local variable defines the list of dependant libraries common to all target in this package.
CalciumCouplingPolicy.cxx \
CorbaTypes2CalciumTypes.cxx \
CalciumTypes2CorbaTypes.cxx \
+ CalciumCInterface.cxx \
CalciumProvidesPort.cxx \
Calcium.cxx \
calcium_destructors_port_uses.cxx
test_DataIdContainer_LDFLAGS = $(COMMON_LIBS)
+CLEANFILES = calcium_integer_port_uses.hxx CalciumProvidesPort.hxx CalciumFortranInt.h
#endif
);
+extern int cp_elg(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance */
+ /* CP_TEMPS, CP_ITERATION */,
+ float /* E Pas de temps a ecrire */,
+ int /* E Pas d'iteration a ecrire */,
+ char * /* E Nom de la variable a ecrire */,
+ int /* E Nombre de valeurs a ecrire */,
+ long * /* E Tableau d'entiers a ecrire */
+#endif
+);
+
extern int cp_ere(
/* ------ */
#if CPNeedPrototype
// Module : KERNEL
//
#include "calcium_integer_port_uses.hxx"
+#include "calcium_long_port_uses.hxx"
+#include "calcium_intc_port_uses.hxx"
#include "calcium_real_port_uses.hxx"
#include "calcium_double_port_uses.hxx"
#include "calcium_string_port_uses.hxx"
calcium_real_port_uses::~calcium_real_port_uses(void) {};
calcium_double_port_uses::~calcium_double_port_uses(void) {};
calcium_integer_port_uses::~calcium_integer_port_uses(void) {};
+calcium_long_port_uses::~calcium_long_port_uses(void) {};
+calcium_intc_port_uses::~calcium_intc_port_uses(void) {};
calcium_logical_port_uses::~calcium_logical_port_uses(void) {};
calcium_complex_port_uses::~calcium_complex_port_uses(void) {};
calcium_string_port_uses::~calcium_string_port_uses(void) {};
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : calcium_int_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+//
+#ifndef _CALCIUM_INTC_PORT_USES_HXX_
+#define _CALCIUM_INTC_PORT_USES_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_Intc_Port_name[];
+
+class calcium_intc_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_long,
+ CORBA::Long >,
+ Ports::Calcium_Ports::Calcium_Intc_Port,
+ _repository_Calcium_Intc_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_intc_port_uses();
+
+};
+
+#endif
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : calcium_integer_port_uses.hxx
-// Author : Eric Fayolle (EDF)
-// Module : KERNEL
-// Modified by : $LastChangedBy$
-// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
-// Id : $Id$
-//
-#ifndef _CALCIUM_INTEGER_PORT_USES_HXX_
-#define _CALCIUM_INTEGER_PORT_USES_HXX_
-
-#include <SALOMEconfig.h>
-
-#include "Calcium_Ports.hh"
-#include "CalciumGenericUsesPort.hxx"
-
-extern char _repository_Calcium_Integer_Port_name[];
-
-class calcium_integer_port_uses :
- public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_long,
- CORBA::Long >,
- Ports::Calcium_Ports::Calcium_Integer_Port,
- _repository_Calcium_Integer_Port_name
- >
-{
- public :
-
- virtual ~calcium_integer_port_uses();
-
-};
-
-#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : calcium_integer_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+//
+#ifndef _CALCIUM_INTEGER_PORT_USES_HXX_
+#define _CALCIUM_INTEGER_PORT_USES_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_Integer_Port_name[];
+
+class calcium_integer_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_integer,
+ @CALCIUM_CORBA_INT_F77@ >,
+ Ports::Calcium_Ports::Calcium_Integer_Port,
+ _repository_Calcium_Integer_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_integer_port_uses();
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : calcium_long_port_uses.hxx
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+// Modified by : $LastChangedBy$
+// Date : $LastChangedDate: 2007-02-28 15:26:32 +0100 (mer, 28 fév 2007) $
+// Id : $Id$
+//
+#ifndef _CALCIUM_LONG_PORT_USES_HXX_
+#define _CALCIUM_LONG_PORT_USES_HXX_
+
+#include <SALOMEconfig.h>
+
+#include "Calcium_Ports.hh"
+#include "CalciumGenericUsesPort.hxx"
+
+extern char _repository_Calcium_Long_Port_name[];
+
+class calcium_long_port_uses :
+ public virtual CalciumGenericUsesPort< seq_u_manipulation<Ports::Calcium_Ports::seq_long_long,
+ CORBA::LongLong >,
+ Ports::Calcium_Ports::Calcium_Long_Port,
+ _repository_Calcium_Long_Port_name
+ >
+{
+ public :
+
+ virtual ~calcium_long_port_uses();
+
+};
+
+#endif
if ( type == "integer")
rtn_port = new calcium_integer_port_provides();
+ if ( type == "long")
+ rtn_port = new calcium_long_port_provides();
+ if ( type == "intc")
+ rtn_port = new calcium_intc_port_provides();
if ( type == "real")
rtn_port = new calcium_real_port_provides();
if ( type == "double")
if ( type == "integer")
rtn_port = new calcium_integer_port_uses();
+ if ( type == "long")
+ rtn_port = new calcium_long_port_uses();
+ if ( type == "intc")
+ rtn_port = new calcium_intc_port_uses();
if ( type == "real")
rtn_port = new calcium_real_port_uses();
if ( type == "double")
#include "CalciumProvidesPort.hxx"
#include "calcium_integer_port_uses.hxx"
+#include "calcium_long_port_uses.hxx"
+#include "calcium_intc_port_uses.hxx"
#include "calcium_real_port_uses.hxx"
#include "calcium_double_port_uses.hxx"
#include "calcium_string_port_uses.hxx"
// Id : $Id$
//
#include "calcium_integer_port_uses.hxx"
+#include "calcium_long_port_uses.hxx"
+#include "calcium_intc_port_uses.hxx"
#include "calcium_real_port_uses.hxx"
#include "calcium_double_port_uses.hxx"
#include "calcium_complex_port_uses.hxx"
#include "calcium_string_port_uses.hxx"
char _repository_Calcium_Integer_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0";
+char _repository_Calcium_Long_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Long_Port:1.0";
+char _repository_Calcium_Intc_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Intc_Port:1.0";
char _repository_Calcium_Real_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0";
char _repository_Calcium_Double_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0";
char _repository_Calcium_Complex_Port_name[]="IDL:Ports/Calcium_Ports/Calcium_Complex_Port:1.0";
#include <stdlib.h>
#include "fortoc.h"
#include "calcium.h"
+#include "calciumf.h"
+#include "CalciumFortranInt.h"
#include <stdio.h>
static void* COMPO=0;
extern "C" {
#endif
-static void fstrtocstr(char *cstr, char *fstr,int fstr_len)
+
+static void fstrtocstr(char *cstr, char *fstr,cal_int fstr_len)
{
- int i,iend;
+ cal_int i,iend;
for (iend = fstr_len-1; iend >= 0; iend--)
if (fstr[iend] != ' ') break;
for (i = 0; i <= iend; i++)
cstr[i] = '\0';
}
-static void cstrtofstr(char *cstr, char *fstr,int fstr_len)
+static void cstrtofstr(char *cstr, char *fstr,cal_int fstr_len)
{
- int i, len;
+ cal_int i, len;
len = strlen(cstr);
if (len > fstr_len) len = fstr_len;
for (i = 0; i < len; i++)
fstr[i++] = ' ';
}
-static char * fstr1(char *nom,int nnom)
+static char * fstr1(char *nom,cal_int nnom)
{
char * cnom=(char*)malloc((nnom+1)*sizeof(char));
fstrtocstr(cnom,nom,nnom);
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));
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]));
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);
}
}
- *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) {
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
}
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : calcium.h
+// Author : Eric Fayolle (EDF)
+// Module : KERNEL
+
+/* Outils d'Aide au Couplage de Code de Calcul : $Id$ */
+
+#ifndef __CALCIUMF_H
+#define __CALCIUMF_H
+
+#include "CalciumFortranInt.h"
+
+/*TODO CPCD... */
+
+#define STAR *
+#define LCH_LAST_PARAM ,int strsize
+
+
+#define CALCIUM_ECR_INTERFACE_C_H(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \
+ extern _calInt cp_##_name (void * component, _calInt mode, \
+ _timeType t, _calInt i, \
+ char * nomvar, _calInt nbelem, \
+ _type _qual * data \
+ lastarg ) ; \
+
+
+CALCIUM_ECR_INTERFACE_C_H(een_fort_,float ,cal_int,cal_int,integer,,);
+CALCIUM_ECR_INTERFACE_C_H(elg_fort_,float ,cal_int,long ,long2integer,,);
+CALCIUM_ECR_INTERFACE_C_H(ein_fort_,float ,cal_int,int ,int2integer,,);
+CALCIUM_ECR_INTERFACE_C_H(ere_fort_,float ,cal_int,float ,float,,);
+CALCIUM_ECR_INTERFACE_C_H(edb_fort_,double,cal_int,double,double,,);
+CALCIUM_ECR_INTERFACE_C_H(elo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */
+CALCIUM_ECR_INTERFACE_C_H(ecp_fort_,float ,cal_int,float ,cplx,,);
+CALCIUM_ECR_INTERFACE_C_H(ech_fort_,float ,cal_int,char ,str,STAR,LCH_LAST_PARAM );
+
+
+
+#define CALCIUM_LECT_INTERFACE_C_H(_name,_timeType,_calInt,_type,_typeName,_qual,lastarg) \
+ extern _calInt cp_##_name (void * component, _calInt mode, \
+ _timeType * ti, _timeType * tf, _calInt * i, \
+ char * nomvar, _calInt bufferLength, \
+ _calInt * nRead, _type _qual * data \
+ lastarg ) ; \
+ \
+
+
+CALCIUM_LECT_INTERFACE_C_H(len_fort_,float ,cal_int,cal_int ,integer,,);
+CALCIUM_LECT_INTERFACE_C_H(llg_fort_,float ,cal_int,long ,long2integer,,);
+CALCIUM_LECT_INTERFACE_C_H(lin_fort_,float ,cal_int,int ,int2integer,,);
+CALCIUM_LECT_INTERFACE_C_H(lre_fort_,float ,cal_int,float ,float,,);
+CALCIUM_LECT_INTERFACE_C_H(ldb_fort_,double,cal_int,double ,double,,);
+CALCIUM_LECT_INTERFACE_C_H(llo_fort_,float ,cal_int,int ,bool,,); /*int pour bool ou cal_int */
+CALCIUM_LECT_INTERFACE_C_H(lcp_fort_,float ,cal_int,float ,cplx,,);
+CALCIUM_LECT_INTERFACE_C_H(lch_fort_,float ,cal_int,char ,str,STAR, LCH_LAST_PARAM );
+
+
+
+#endif
#include <cstring>
#include <CORBA.h>
+//#define MYDEBUG
// Classes manipulation
// -------------------
// En non collocalisé on recrée une séquence avec le buffer de la première dont on
// a demandé la propriété.
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1 ------------------" << std::endl;
#endif
if ( data.release() ) {
// Crée une nouvelle sequence propriétaire des données du buffer (pas de recopie)
// Les données de la nouvelle séquence seront automatiquement désallouées
// par appel à la méthode freebuf dans le destructeur de la séquence (cf delete_data).
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(0 copy) bis ------"<< p_data <<"------------" << std::endl;
#endif
return new seq_T (max, len, p_data, true);
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1(recopie) bis ------"<< &data <<"------------" << std::endl;
#endif
// Crée une nouvelle sequence propriétaire des données du buffer (avec recopie)
// Crée une nouvelle sequence propriétaire des données du buffer (généralement pas de recopie)
// Les données seront automatiquement désallouées par appel interne à la méthode freebuf
// lors de la destruction de l'objet par appel à delete_data.
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Pas de Duplication -----------" << std::endl;
#endif
return new seq_T (len, p_data, true);
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1bis Duplication pour en devenir propriétaire -----------" << std::endl;
#endif
// Crée une nouvelle sequence propriétaire des données du buffer (avec recopie)
#include "Utils_CorbaException.hxx"
// SALOME C++ Exception
#include "Utils_SALOME_Exception.hxx"
+#include "utilities.h"
#include <iostream>
#include <map>
#include <algorithm>
#include <iterator>
+//#define MYDEBUG
+
// Classe GenericPort
// --------------------------------
//
GenericPort<DataManipulator, COUPLING_POLICY>::~GenericPort() {
typename DataTable::iterator it;
for (it=storedDatas.begin(); it!=storedDatas.end(); ++it) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "~GenericPort() : destruction de la donnnée associée au DataId :"<< (*it).first << std::endl;
#endif
DataManipulator::delete_data( (*it).second );
template < typename DataManipulator, typename COUPLING_POLICY> void
GenericPort<DataManipulator, COUPLING_POLICY>::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
fflush(stdout);
fflush(stderr);
try {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
// Affichage des donnees pour DEBUGging
std::cerr << "parametres emis: " << time << ", " << tag << std::endl;
DataManipulator::dump(dataParam);
bool expectedDataReceived = false;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 1 ------------------" << std::endl;
#endif
if ( dataIds.empty() ) return;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 1bis ------------------" << std::endl;
#endif
int nbOfIter = 0;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 2 ------ "<< (dataIdIt == dataIds.end()) << "------------" << std::endl;
std::cout << "-------- Put : MARK 2bis "<< (*dataIdIt) <<"------------------" << std::endl;
#endif
for (;dataIdIt != dataIds.end();++dataIdIt) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 3 ------------------" << std::endl;
#endif
// Duplique l'instance de donnée pour les autres dataIds
if (nbOfIter > 0) data = DataManipulator::clone(data);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 3bis -----"<< dataIdIt.operator*() <<"------------" << std::endl;
#endif
DataId currentDataId=*dataIdIt;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cerr << "processing dataId : "<< currentDataId << std::endl;
std::cout << "-------- Put : MARK 4 ------------------" << std::endl;
// <=> premier emplacement où l'on pourrait insérer notre DataId
// <=> en général équivaux à (*wDataIt).first >= currentDataId
typename DataTable::iterator wDataIt = storedDatas.lower_bound(currentDataId);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Put : MARK 5 ------------------" << std::endl;
#endif
// On n'a pas trouvé de dataId supérieur au notre ou
// on a trouvé une clé > à cet Id
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
} 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
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;
( 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)
}
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
// 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);
bool isEqual, isBounded;
typedef typename DataManipulator::InnerType InnerType;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 1 ------------------" << std::endl;
#endif
expectedDataId = DataId(time,tag);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 2 ------------------" << std::endl;
#endif
// - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first
// Méthode provenant de la COUPLING_POLICY
isDataIdConveniant(storedDatas,expectedDataId,isEqual,isBounded,wDataIt1);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 3 ------------------" << std::endl;
#endif
// L'ordre des différents tests est important
if ( isEqual ) {
-#ifdef _DEBUG_
+#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.
// 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);
// Méthode provenant de la COUPLING_POLICY
typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> 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
// 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
// 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);
// 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
fflush(stdout);fflush(stderr);
cond_instance.wait();
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 12 ------------------" << std::endl;
#endif
}
// Deverouille l'acces a la table
storedDatas_mutex.unlock();
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Get : MARK 13 ------------------" << std::endl;
#endif
try {
storedDatas_mutex.lock();// Gérer les Exceptions ds le corps de la méthode
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 1 ---lastDataIdSet ("<<lastDataIdSet<<")---------------" << std::endl;
#endif
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;
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;
}
}
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 6 ------------------" << std::endl;
#endif
tag = getTag ( (*wDataIt1).first );
dataToTransmit = (*wDataIt1).second;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 7 ------------------" << std::endl;
#endif
lastDataId = (*wDataIt1).first;
typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
processEraseDataId.apply(storedDatas, wDataIt1);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 8 ------------------" << std::endl;
#endif
} catch (...) {
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 8bis ------------------" << std::endl;
#endif
waitingForAnyDataId = false;
}
storedDatas_mutex.unlock();
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "-------- Next : MARK 9 ------------------" << std::endl;
#endif
CorbaPortTypeVar port = CorbaPortType::_narrow((*_my_ports)[i]);
//if (i) { PB1
//OLD : copyOfData = DataManipulator::clone(data);
-#ifdef _DEBUG_
- std::cout << "-------- GenericUsesPort::put -------- " << std::endl;
-#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)"));
}
{
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;
}
-I$(top_srcdir)/src/SALOMELocalTrace \
-I$(top_srcdir)/src/Basics \
-I$(top_srcdir)/src/Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(top_srcdir)/src/SALOMELocalTrace \
-I$(top_srcdir)/src/Basics \
-I$(top_srcdir)/src/Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@
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
}
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
}
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);
#include "DSC_Exception.hxx"
#include <vector>
+//#define MYDEBUG
/*! \class Superv_Component_i
* \brief This class implements DSC_User component.
assert(port_name);
SpecificPortType * retPort;
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "---- Superv_Component_i::add_port : Mark 0 ---- " << port_name << "----" << std::endl;
#endif
else if (s_port_type == "uses") {
uses_port * port = create_uses_data_port(port_fab_type);
add_port(port, port_name);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "---- Superv_Component_i::add_port : Mark 1 ---- " << port << "----" << std::endl;
std::cout << "---- Superv_Component_i::add_port : Mark 1 ---- get_repository_id()" << port->get_repository_id() << std::endl;
#endif
retPort = dynamic_cast<SpecificPortType *>(port);
-#ifdef _DEBUG_
+#ifdef MYDEBUG
std::cout << "---- Superv_Component_i::add_port : Mark 2 ---- " << retPort << "----" << std::endl;
#endif
if ( retPort == NULL ) { delete port;
-I$(top_srcdir)/src/NamingService \
-I$(top_srcdir)/src/Utils \
-I$(top_srcdir)/src/DSC/DSC_Basic \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
-I$(top_srcdir)/src/Registry \
-I$(top_srcdir)/src/Utils \
libSalomeGenericObj_la_CPPFLAGS = \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
libSalomeGenericObj_la_LIBADD = \
----------------------------------------------------------------------------*/
#include "hdfi.h"
+#include <string.h>
/*
* - Name: HDFobjectIdentify
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
--- /dev/null
+"""
+ 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
+
import visu_gui
medFileName = "pointe.med"
-medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFileName
+if sys.platform != "win32":
+ medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFileName
+else:
+ medFile = os.getenv('DATA_DIR') + '\\MedFiles\\' + medFileName
+ pass
print "Load ", medFile
studyCurrent = salome.myStudyName
if sys.platform != "win32":
tmpDir = "/tmp/"
else:
- tmpDir = os.getenv('TEMP') + '/'
+ tmpDir = os.getenv('TEMP') + '\\'
medFileNew = tmpDir + str(random.randint(0,1000000)) + "_" + medFileName
print " -- Copy " + medFile + " to " + medFileNew
os.system(copyCommand + " " + medFile + " " + medFileNew)
medFile = medFileNew
- os.system("chmod 755 " + medFile)
+ if sys.platform != "win32":
+ os.system("chmod 755 " + medFile)
+ pass
if os.access(medFile, os.W_OK) :
med_comp.readStructFileWithFieldType(medFile,studyCurrent)
-I$(srcdir)/../Notification \
-I$(srcdir)/../ResourcesManager \
-I$(srcdir)/../Container \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(srcdir)/../Utils \
-I$(srcdir)/../Container \
-I$(srcdir)/../ResourcesManager \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@
char **argv = &xargv;
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
// LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ _NSnew=0;
if (!ns)
{
_NS = new SALOME_NamingService(orb);
+ _NSnew=_NS;
}
else _NS = ns;
//add try catch
SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA()
{
+ if(_NSnew)delete _NSnew;
}
//=============================================================================
{
// containerName doesn't contain "/" => Local container
params->container_name=CORBA::string_dup(stContainer);
- params->hostname=CORBA::string_dup(Kernel_Utils::GetHostname().c_str());
+ params->hostname="";
}
else
{
string portNumber (::getenv ("NSPORT") );
if ( !portNumber.empty() )
{
+#ifdef WNT
+#else
string cmd ;
cmd = string( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*")
+ portNumber
}
catch ( ... ) {
}
+#endif
}
// NPAL 18309 (Kill Notifd)
containerDest->copyFile(containerSrc,fileSrc,fileDest);
}
+/*! \brief get the naming service used by the life cycle
+ *
+ * \return the naming service
+ */
+SALOME_NamingService * SALOME_LifeCycleCORBA::namingService()
+{
+ return _NS;
+}
+
+/*! \brief get the orb used by the life cycle
+ *
+ * \return the orb
+ */
+CORBA::ORB_ptr SALOME_LifeCycleCORBA::orb()
+{
+ return _NS->orb();
+}
+
Engines::ContainerManager_ptr getContainerManager();
Engines::ResourcesManager_ptr getResourcesManager();
+ SALOME_NamingService * namingService();
+ CORBA::ORB_ptr orb();
void copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest);
void shutdownServers();
int studyId);
SALOME_NamingService *_NS;
+ SALOME_NamingService *_NSnew;
Engines::ContainerManager_var _ContManager;
Engines::ResourcesManager_var _ResManager;
-I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \
-I$(srcdir)/$(RPATH)/ResourcesManager \
-I$(srcdir)/$(RPATH)/LifeCycleCORBA \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
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;
}
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
SALOME_Logger_Server_LDADD = libSalomeLoggerServer.la
SALOME_Logger_Server_CPPFLAGS =\
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Basics \
SALOME_Logger_Server.cxx
libSalomeLoggerServer_la_CPPFLAGS =\
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
libSalomeLoggerServer_la_LDFLAGS = -no-undefined -version-info=0:0:0
else
{
Py_ACQUIRE_NEW_THREAD;
- PyObject *mainmod = PyImport_AddModule("__main__");
+ PyObject *mainmod = PyImport_AddModule((char *)"__main__");
PyObject *globals = PyModule_GetDict(mainmod);
PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
PyObject *result = PyObject_CallMethod(pyCont,
- "import_component",
- "s",componentName);
- int ret= PyInt_AsLong(result);
+ (char*)"import_component",
+ (char*)"s",componentName);
+ std::string ret= PyString_AsString(result);
SCRUTE(ret);
Py_RELEASE_NEW_THREAD;
- if (ret) // import possible: Python component
+ if (ret=="") // import possible: Python component
{
_library_map[aCompName] = (void *)pyCont; // any non O value OK
MESSAGE("[" << _numproc << "] import Python: "<<aCompName<<" OK");
_containerName + "/" + instanceName;
Py_ACQUIRE_NEW_THREAD;
- PyObject *mainmod = PyImport_AddModule("__main__");
+ PyObject *mainmod = PyImport_AddModule((char*)"__main__");
PyObject *globals = PyModule_GetDict(mainmod);
PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
PyObject *result = PyObject_CallMethod(pyCont,
- "create_component_instance",
- "ssl",
+ (char*)"create_component_instance",
+ (char*)"ssl",
aCompName.c_str(),
instanceName.c_str(),
studyId);
return iobject._retn();
}
+ return Engines::Component::_nil() ;
}
Engines::Component_ptr
{
thread_st *st = (thread_st*)s;
(Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->load_component_Library(st->compoName.c_str());
+ return NULL;
}
void *th_createcomponentinstance(void *s)
{
thread_st *st = (thread_st*)s;
(Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->create_component_instance(st->compoName.c_str(),st->studyId);
+ return NULL;
}
void *th_loadimpl(void *s)
{
thread_st *st = (thread_st*)s;
(Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->load_impl(st->nameToRegister.c_str(),st->compoName.c_str());
+ return NULL;
}
void *th_removeimpl(void *s)
{
thread_st *st = (thread_st*)s;
(Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->remove_impl(st->cptr);
+ return NULL;
}
void *th_finalizeremoval(void *s)
{
thread_st *st = (thread_st*)s;
(Engines::MPIContainer::_narrow((*(st->tior))[st->ip]))->finalize_removal();
+ return NULL;
}
-
}
#ifdef HAVE_MPI2
-void MPIObject_i::remoteMPI2Connect(bool high, string service)
+void MPIObject_i::remoteMPI2Connect(string service)
{
int i;
char port_name[MPI_MAX_PORT_NAME];
else
MPI_Comm_connect(port_name_clt, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &(_icom[service]) );
- /* create global communicator */
- MPI_Intercomm_merge(_icom[service],high,&(_gcom[service]));
+ /* create global communicator: servers have low index in global communicator*/
+ MPI_Intercomm_merge(_icom[service],!_srv[service],&(_gcom[service]));
/* only rank 0 can be server for unpublish name */
if(_numproc != 0) _srv[service] = false;
void BCastIOR(CORBA::ORB_ptr orb,Engines::MPIObject_ptr pobj,bool amiCont);
#ifdef HAVE_MPI2
// MPI2 connection
- void remoteMPI2Connect(bool high, std::string service);
+ void remoteMPI2Connect(std::string service);
// MPI2 disconnection
void remoteMPI2Disconnect(std::string service);
#endif
-I$(srcdir)/../Notification \
-I$(srcdir)/../ResourcesManager \
-I$(srcdir)/../Container \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
int main(int argc, char* argv[])
{
int nbproc, numproc;
- Engines_MPIContainer_i * myContainer=NULL;
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD,&nbproc);
// obtain the root poa manager
PortableServer::POAManager_var pman = root_poa->the_POAManager();
- // define policy objects
- PortableServer::ImplicitActivationPolicy_var implicitActivation =
- root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
-
- // default = NO_IMPLICIT_ACTIVATION
- PortableServer::ThreadPolicy_var threadPolicy =
- root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ;
- // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
-
- // create policy list
- CORBA::PolicyList policyList;
- policyList.length(2);
- policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
- policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
-
- // create the child POA
- PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
- PortableServer::POA_var factory_poa =
- root_poa->create_POA("factory_poa", pman, policyList) ;
- //with nil_mgr instead of pman, a new POA manager is created with the new POA
-
- // destroy policy objects
- implicitActivation->destroy() ;
- threadPolicy->destroy() ;
-
- char *containerName = "";
+ char *containerName = (char *)"";
if (argc >1)
{
containerName = argv[1] ;
}
MESSAGE("[" << numproc << "] MPIContainer: load MPIContainer servant");
- new Engines_MPIContainer_i(nbproc,numproc,orb,factory_poa, containerName,argc,argv);
+ new Engines_MPIContainer_i(nbproc,numproc,orb,root_poa, containerName,argc,argv);
pman->activate();
#
if WITHONLYLAUNCHER
- SUBDIRS = Batch Batch_SWIG ResourcesManager Launcher
+ SUBDIRS = Basics Batch Batch_SWIG ResourcesManager Launcher
else
SUBDIRS = $(SUBDIR_BASE)
-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@
-I$(srcdir)/../Notification \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
- -I$(top_builddir)/salome_adm/unix \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Basics \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
*
* Initializes ORB reference and naming service root context.
* For use after default constructor.
+ * If param orb is null, the orb is initialized
* \param orb CORBA::ORB_ptr arguments
*/
// ============================================================================
MESSAGE("SALOME_NamingService initialisation");
Utils_Locker lock (&_myMutex);
- _orb = CORBA::ORB::_duplicate(orb);
+ if(orb)
+ _orb = CORBA::ORB::_duplicate(orb);
+ else
+ {
+ int argc=0;
+ _orb = CORBA::ORB_init(argc, 0); // Here we make the assumption that the orb has already been initialized
+ }
_initialize_root_context();
}
return _orb->object_to_string(_root_context);
}
+/*! \brief get the orb used by the naming service
+ *
+ * \return the orb
+ */
+CORBA::ORB_ptr SALOME_NamingService::orb()
+{
+ return _orb;
+}
+
virtual ~SALOME_NamingService();
- void init_orb(CORBA::ORB_ptr orb);
+ void init_orb(CORBA::ORB_ptr orb=0);
void Register(CORBA::Object_ptr ObjRef,
const char* Path)
throw(ServiceUnreachable);
virtual void Destroy_FullDirectory(const char* Path)
throw(ServiceUnreachable);
char* getIORaddr();
+ CORBA::ORB_ptr orb();
protected:
Utils_Mutex _myMutex;
#-------------------------------------------------------------------------
- def __init__(self, orb):
+ def __init__(self, orb=None):
"""
Standard Constructor, with ORB reference.
Initializes the naming service root context
"""
#MESSAGE ( "SALOME_NamingServicePy_i::__init__" )
+ if orb is None:
+ orb=CORBA.ORB_init([''], CORBA.ORB_ID)
self._orb = orb
# initialize root context and current context
ok = 0
-I$(srcdir)/$(RPATH)/Basics \
-I$(srcdir)/$(RPATH)/SALOMELocalTrace \
-I$(srcdir)/$(RPATH)/Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(top_srcdir)/src/Registry \
-I$(top_srcdir)/src/Utils \
-I$(srcdir)/../HDFPersist \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
-I$(top_srcdir)/src/SALOMETraceCollector \
@PYTHON_INCLUDES@ \
PyObject *result = PyObject_CallMethod(pyCont,
(char*)"import_component",
(char*)"s",componentName);
- int ret_p= PyInt_AsLong(result);
+ std::string ret_p= PyString_AsString(result);
Py_XDECREF(result);
Py_RELEASE_NEW_THREAD;
- if (ret_p) // import possible: Python component
+ if (ret_p=="") // import possible: Python component
{
MESSAGE("import Python: " << aCompName <<" OK");
}
PyObject *result = PyObject_CallMethod(pyCont,
(char*)"import_component",
(char*)"s",componentName);
- int ret_p= PyInt_AsLong(result);
+ std::string ret_p= PyString_AsString(result);
Py_XDECREF(result);
Py_RELEASE_NEW_THREAD;
- if (ret_p) // import possible: Python component
+ if (ret_p=="") // import possible: Python component
{
_library_map[aCompName] = (void *)pyCont; // any non O value OK
MESSAGE("import Python: " << aCompName <<" OK");
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
Registry::Components_var Connexion( int argc , char **argv , const char *ptrSessionName ) throw( CommException )
{
- Registry::Components_var varComponents = 0 ;
- ASSERT(ptrSessionName) ;
- ASSERT(strlen(ptrSessionName)>0) ;
- const char *registryName = "Registry" ;
-
- try
- {
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init( argc , argv ) ;
-
- SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
- ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
- naming.init_orb( orb ) ;
-
- // Recuperation de la reference de l'objet
- CORBA::Object_var object = naming.Resolve( registryName ) ;
- if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ;
-
- // Specialisation de l'objet generique
- varComponents = Registry::Components::_narrow( object ) ;
- ASSERT(! CORBA::is_nil(varComponents)) ;
- }
- catch( ... )
- {
- throw CommException ( "NamingService Connexion Error" ) ;
- }
- return varComponents ;
+ Registry::Components_var varComponents = 0 ;
+ ASSERT(ptrSessionName) ;
+ ASSERT(strlen(ptrSessionName)>0) ;
+ const char *registryName = "Registry" ;
+
+ try
+ {
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ CORBA::ORB_var &orb = init( argc , argv ) ;
+
+ SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
+ ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
+ naming.init_orb( orb ) ;
+
+ // Recuperation de la reference de l'objet
+ CORBA::Object_var object = naming.Resolve( registryName ) ;
+ if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ;
+
+ // Specialisation de l'objet generique
+ varComponents = Registry::Components::_narrow( object ) ;
+ ASSERT(! CORBA::is_nil(varComponents)) ;
+ }
+ catch( ... )
+ {
+ throw CommException ( "NamingService Connexion Error" ) ;
+ }
+ return varComponents ;
}
RegistryConnexion::RegistryConnexion( int argc , char **argv , const char *ior , const char *ptrSessionName, const char *componentName ): \
- _Ior(duplicate(ior)), _VarComponents( Connexion(argc,argv,ptrSessionName) ), _SessionName(ptrSessionName),_Name(""), _Id(0)
+ _Ior(duplicate(ior)), _VarComponents( Connexion(argc,argv,ptrSessionName) ), _SessionName(ptrSessionName),_Name(""), _Id(0)
{
- this->add( componentName ) ;
+ this->add( componentName ) ;
}
RegistryConnexion::RegistryConnexion( void ): _Ior(0), _VarComponents( 0 ), _Name(""), _Id(0)
{
- INTERRUPTION(EXIT_FAILURE) ;
+ INTERRUPTION(EXIT_FAILURE) ;
}
RegistryConnexion::~RegistryConnexion()
{
- BEGIN_OF("RegistryConnexion::~RegistryConnexion()" ) ;
- if( _Id != 0 )
- {
- ASSERT(_SessionName!="" ) ;
- ASSERT(_Name!="" ) ;
- _VarComponents->remove( _Id ) ;
- }
- _Id = 0 ;
-#ifndef WIN32
- delete [] _Ior;
-#else
- delete [] (char*) _Ior;
-#endif
- _Ior = 0;
- _SessionName = "";
- _Name = "" ;
- END_OF("RegistryConnexion::~RegistryConnexion()" ) ;
+ BEGIN_OF("RegistryConnexion::~RegistryConnexion()" ) ;
+ if( _Id != 0 )
+ {
+ ASSERT(_SessionName!="" ) ;
+ ASSERT(_Name!="" ) ;
+ _VarComponents->remove( _Id ) ;
+ }
+ _Id = 0 ;
+ delete [] (char*) _Ior;
+ _Ior = 0;
+ _SessionName = "";
+ _Name = "" ;
+ END_OF("RegistryConnexion::~RegistryConnexion()" ) ;
}
void RegistryConnexion::add( const char *aName )
{
- ASSERT(_SessionName!="" ) ;
- ASSERT(_Name=="" ) ;
- ASSERT(_Id==0 ) ;
- ASSERT(aName) ;
- SCRUTE(aName) ;
- ASSERT(strlen( aName )>0) ;
-
- const Identity lesInfos( aName ) ;
- Registry::Infos infos ;
- infos.name = CORBA::string_dup( lesInfos.name() ) ;
- infos.pid = lesInfos.pid() ;
- infos.machine = CORBA::string_dup( lesInfos.host_char() ) ;
- infos.adip = CORBA::string_dup( lesInfos.adip() ) ;
- infos.uid = (long)lesInfos.uid() ;
- infos.pwname = CORBA::string_dup( lesInfos.pwname() ) ;
- infos.tc_start = lesInfos.start() ;
- infos.tc_hello = 0 ;
- infos.tc_end = 0 ;
- infos.difftime = 0 ;
- infos.cdir = CORBA::string_dup( lesInfos.rep() ) ;
- infos.status = -1 ;
- infos.ior = CORBA::string_dup(_Ior);
-
- ASSERT(!CORBA::is_nil(this->_VarComponents)) ;
-
- CORBA::ULong id = _VarComponents->add( infos ) ;
-
- SCRUTE(aName) ; SCRUTE(id) ;
- ASSERT(id) ;
-
- _Id = id ;
- _Name = aName ;
-
- return ;
+ ASSERT(_SessionName!="" ) ;
+ ASSERT(_Name=="" ) ;
+ ASSERT(_Id==0 ) ;
+ ASSERT(aName) ;
+ SCRUTE(aName) ;
+ ASSERT(strlen( aName )>0) ;
+
+ const Identity lesInfos( aName ) ;
+ Registry::Infos infos ;
+ infos.name = CORBA::string_dup( lesInfos.name() ) ;
+ infos.pid = lesInfos.pid() ;
+ infos.machine = CORBA::string_dup( lesInfos.host_char() ) ;
+ infos.adip = CORBA::string_dup( lesInfos.adip() ) ;
+ infos.uid = (long)lesInfos.uid() ;
+ infos.pwname = CORBA::string_dup( lesInfos.pwname() ) ;
+ infos.tc_start = lesInfos.start() ;
+ infos.tc_hello = 0 ;
+ infos.tc_end = 0 ;
+ infos.difftime = 0 ;
+ infos.cdir = CORBA::string_dup( lesInfos.rep() ) ;
+ infos.status = -1 ;
+ infos.ior = CORBA::string_dup(_Ior);
+
+ ASSERT(!CORBA::is_nil(this->_VarComponents)) ;
+
+ CORBA::ULong id = _VarComponents->add( infos ) ;
+
+ SCRUTE(aName) ; SCRUTE(id) ;
+ ASSERT(id) ;
+
+ _Id = id ;
+ _Name = aName ;
+
+ return ;
}
void RegistryConnexion::remove( void )
{
- ASSERT(_Id>0) ;
- ASSERT(!CORBA::is_nil(this->_VarComponents)) ;
- _VarComponents->remove( _Id ) ;
+ ASSERT(_Id>0) ;
+ ASSERT(!CORBA::is_nil(this->_VarComponents)) ;
+ _VarComponents->remove( _Id ) ;
- _Name = "" ;
- _Id = 0 ;
+ _Name = "" ;
+ _Id = 0 ;
- return ;
+ return ;
}
using namespace std;
/* ------------------------------*/
-/* Constructeurs et Destructeurs */
+/* Constructors and Destructors */
/* ------------------------------*/
RegistryService::RegistryService( void ) : _SessionName(0), _Compteur(0)
{
- MESSAGE("Passage dans RegistryService::RegistryService()") ;
- _orb = CORBA::ORB::_nil();
+ MESSAGE("RegistryService::RegistryService()") ;
+ _orb = CORBA::ORB::_nil();
}
-
RegistryService::~RegistryService()
{
- BEGIN_OF("RegistryService::~RegistryService()") ;
- map<int,client_infos *>::iterator im;
- for (im=_reg.begin();im!=_reg.end(); im++)
- {
-#if defined(_DEBUG_) || defined(_DEBUG)
- const client_infos &lesInfos = *(*im).second ;
- MESSAGE("Deletion") ; SCRUTE( lesInfos._name ) ;
-#endif
- _reg.erase ( im ) ;
- }
- ASSERT(_reg.size()==0) ;
- for (im=_fin.begin();im!=_fin.end(); im++)
- {
-#if defined(_DEBUG_) || defined(_DEBUG)
- const client_infos &lesInfos = *(*im).second ;
- MESSAGE("Deletion") ; SCRUTE( lesInfos._name ) ;
-#endif
- _fin.erase ( im ) ;
- }
- ASSERT(_fin.size()==0) ;
- _Compteur = -1 ;
- if ( _SessionName )
- {
-#ifndef WIN32
- delete [] _SessionName ;
-#else
- delete [] (char*)_SessionName ;
-#endif
- _SessionName = 0 ;
- }
- END_OF("RegistryService::~RegistryService()") ;
+ BEGIN_OF("RegistryService::~RegistryService()") ;
+ map<int,client_infos *>::iterator im;
+ for (im=_reg.begin();im!=_reg.end(); im++)
+ {
+ MESSAGE("Delete _reg item " << im->second->_name) ;
+ delete im->second;
+ }
+ for (im=_fin.begin();im!=_fin.end(); im++)
+ {
+ MESSAGE("Delete _fin item " << im->second->_name) ;
+ delete im->second;
+ }
+ _Compteur = -1 ;
+ if ( _SessionName )
+ {
+ delete [] (char*)_SessionName ;
+ _SessionName = 0 ;
+ }
+ END_OF("RegistryService::~RegistryService()") ;
}
/* ------------------------------*/
-/* Contrats IDL */
+/* IDL contracts */
/* ------------------------------*/
CORBA::ULong RegistryService::size ( void )
{
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
- return _reg.size() ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+ return _reg.size() ;
}
-
CORBA::ULong RegistryService::add( const Registry::Infos & infos )
{
- BEGIN_OF("RegistryService::add") ;
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
- client_infos *ptr_Component = new client_infos( infos ) ;
- ASSERT(ptr_Component) ;
- SCRUTE(ptr_Component->_name) ;
-
- _Compteur++;
- _reg[_Compteur]=ptr_Component;
-
- END_OF("RegistryService::add") ;
- return (CORBA::ULong)_Compteur ;
+ BEGIN_OF("RegistryService::add") ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+ client_infos *ptr_Component = new client_infos( infos ) ;
+ ASSERT(ptr_Component) ;
+ SCRUTE(ptr_Component->_name) ;
+
+ _Compteur++;
+ _reg[_Compteur]=ptr_Component;
+
+ END_OF("RegistryService::add") ;
+ return (CORBA::ULong)_Compteur ;
}
-#ifndef WIN32
-void RegistryService::remove( const CORBA::ULong id)
-#else
void RegistryService::remove( CORBA::ULong id)
-#endif
{
- BEGIN_OF("RegistryService::remove") ;
- SCRUTE(id) ;
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
-
- ASSERT(_reg.find(id)!=_reg.end())
- _reg[id]->_status=TERMINATED;
- _reg[id]->_ts_end = time(NULL) ;
-
- _fin[id]=_reg[id];
- SCRUTE(_fin.size()) ;
-
- map<int,client_infos *>::iterator pos = _reg.find ( id ) ;
- _reg.erase ( pos ) ;
- SCRUTE(_reg.size()) ;
- SCRUTE(_fin.size()) ;
-
- END_OF("RegistryService::remove") ;
- return ;
+ BEGIN_OF("RegistryService::remove") ;
+ SCRUTE(id) ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+
+ ASSERT(_reg.find(id)!=_reg.end())
+ _reg[id]->_status=TERMINATED;
+ _reg[id]->_ts_end = time(NULL) ;
+
+ _fin[id]=_reg[id];
+ _reg.erase(id);
+
+ SCRUTE(_reg.size()) ;
+ SCRUTE(_fin.size()) ;
+
+ END_OF("RegistryService::remove") ;
+ return ;
}
-#ifndef WIN32
-void RegistryService::hello( const CORBA::ULong id )
-#else
void RegistryService::hello( CORBA::ULong id )
-#endif
{
- BEGIN_OF("RegistryService::hello") ;
- SCRUTE(id) ;
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
-
- ASSERT(_reg.find(id)!=_reg.end())
- _reg[id]->_ts_hello = time(NULL) ;
-
- END_OF("RegistryService::hello") ;
- return ;
-}
+ BEGIN_OF("RegistryService::hello") ;
+ SCRUTE(id) ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+ ASSERT(_reg.find(id)!=_reg.end())
+ _reg[id]->_ts_hello = time(NULL) ;
+
+ END_OF("RegistryService::hello") ;
+ return ;
+}
void RegistryService::end( void )
{
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
- BEGIN_OF( "RegistryService::end( void )" ) ;
- exit( EXIT_SUCCESS ) ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+ BEGIN_OF( "RegistryService::end( void )" ) ;
+ exit( EXIT_SUCCESS ) ;
}
-
Registry::AllInfos* RegistryService::getall( void )
{
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
- return RegistryService::makeseq(_reg) ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+ return RegistryService::makeseq(_reg) ;
}
Registry::AllInfos* RegistryService::history( void )
{
- ASSERT(_SessionName) ;
- ASSERT(strlen(_SessionName)>0) ;
- return RegistryService::makeseq(_fin) ;
+ ASSERT(_SessionName) ;
+ ASSERT(strlen(_SessionName)>0) ;
+ return RegistryService::makeseq(_fin) ;
}
Registry::AllInfos* RegistryService::makeseq(map<int,client_infos *> &mymap )
{
- int i=0 ;
+ int i=0 ;
- Registry::AllInfos *all = new Registry::AllInfos ;
- ASSERT(all) ;
- const int RegLength = mymap.size();
- all->length(RegLength);
+ Registry::AllInfos *all = new Registry::AllInfos ;
+ ASSERT(all) ;
+ const int RegLength = mymap.size();
+ all->length(RegLength);
- map<int,client_infos *>::iterator im;
- for (im=mymap.begin();im!=mymap.end(); im++)
+ map<int,client_infos *>::iterator im;
+ for (im=mymap.begin();im!=mymap.end(); im++)
{
- Registry::Infos &infos = (*all)[i] ;
- const client_infos &lesInfos = *(*im).second ;
- infos.name = CORBA::string_dup( lesInfos._name ) ;
- infos.pid = lesInfos._pid ;
- infos.pwname = lesInfos._pwname ;
- infos.machine = CORBA::string_dup( lesInfos._machine ) ;
- infos.adip = CORBA::string_dup( lesInfos._adip ) ;
- infos.uid = lesInfos._uid ;
- infos.tc_start = lesInfos._ts_start + lesInfos._difftime ;
- infos.tc_hello = lesInfos._ts_hello + lesInfos._difftime ;
- infos.tc_end = lesInfos._ts_end + lesInfos._difftime ;
- infos.difftime = lesInfos._difftime ;
- infos.cdir = CORBA::string_dup( lesInfos._cdir ) ;
- infos.status = lesInfos._status ;
-
- i++;
- }
-
- return all ;
+ Registry::Infos &infos = (*all)[i] ;
+ const client_infos &lesInfos = *(*im).second ;
+ infos.name = CORBA::string_dup( lesInfos._name ) ;
+ infos.pid = lesInfos._pid ;
+ infos.pwname = lesInfos._pwname ;
+ infos.machine = CORBA::string_dup( lesInfos._machine ) ;
+ infos.adip = CORBA::string_dup( lesInfos._adip ) ;
+ infos.uid = lesInfos._uid ;
+ infos.tc_start = lesInfos._ts_start + lesInfos._difftime ;
+ infos.tc_hello = lesInfos._ts_hello + lesInfos._difftime ;
+ infos.tc_end = lesInfos._ts_end + lesInfos._difftime ;
+ infos.difftime = lesInfos._difftime ;
+ infos.cdir = CORBA::string_dup( lesInfos._cdir ) ;
+ infos.status = lesInfos._status ;
+
+ i++;
+ }
+
+ return all ;
}
/* ------------------------------*/
-/* Autres */
+/* Others */
/* ------------------------------*/
RegistryService::client_infos::client_infos( const Registry::Infos &infos ):\
- _ior(duplicate(infos.ior)),\
- _name(duplicate(infos.name)),\
- _pid(infos.pid),\
- _machine(duplicate(infos.machine)),\
- _adip(duplicate(infos.adip)),\
- _uid(infos.uid),\
- _pwname(duplicate(infos.pwname)),\
- _ts_start(time(NULL)),\
- _difftime(infos.tc_start - _ts_start),\
- _cdir(duplicate(infos.cdir)),\
- _ts_hello(_ts_start),\
- _ts_end(0),\
- _status(RUNNING)
+ _ior(duplicate(infos.ior)),\
+ _name(duplicate(infos.name)),\
+ _pid(infos.pid),\
+ _machine(duplicate(infos.machine)),\
+ _adip(duplicate(infos.adip)),\
+ _uid(infos.uid),\
+ _pwname(duplicate(infos.pwname)),\
+ _ts_start(time(NULL)),\
+ _difftime(infos.tc_start - _ts_start),\
+ _cdir(duplicate(infos.cdir)),\
+ _ts_hello(_ts_start),\
+ _ts_end(0),\
+ _status(RUNNING)
{
- // SCRUTE(_ior) ;
- ;
}
RegistryService::client_infos::~client_infos()
{
- delete [] (char*)_ior ; (char*&)_ior = NULL ;
- delete [] (char*)_name ; (char*&)_name = NULL ;
- delete [] (char*)_machine ; (char*&)_machine = NULL ;
- delete [] (char*)_pwname ; (char*&)_pwname = NULL ;
- delete [] (char*)_adip ; (char*&)_adip = NULL ;
- delete [] (char*)_cdir ; (char*&)_cdir = NULL ;
+ delete [] (char*)_ior ; (char*&)_ior = NULL ;
+ delete [] (char*)_name ; (char*&)_name = NULL ;
+ delete [] (char*)_machine ; (char*&)_machine = NULL ;
+ delete [] (char*)_pwname ; (char*&)_pwname = NULL ;
+ delete [] (char*)_adip ; (char*&)_adip = NULL ;
+ delete [] (char*)_cdir ; (char*&)_cdir = NULL ;
}
void RegistryService::SessionName( const char *sessionName )
{
- ASSERT(sessionName) ;
- ASSERT(strlen(sessionName)>0) ;
- _SessionName = duplicate(sessionName) ;
- return ;
+ ASSERT(sessionName) ;
+ ASSERT(strlen(sessionName)>0) ;
+ _SessionName = duplicate(sessionName) ;
+ return ;
}
void RegistryService::ping()
{
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Utils \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@LIBXML_INCLUDES@ \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
libResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0
libResourcesManager_la_LIBADD =\
+ ../Basics/libSALOMEBasics.la \
@LIBXML_LIBS@
-I$(srcdir)/../GenericObj \
-I$(srcdir)/../SALOMEDSClient \
-I$(srcdir)/../LifeCycleCORBA \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
SALOMEDS::Locker lock;
aValue = dynamic_cast<SALOMEDSImpl_AttributeIOR*>(_local_impl)->Value();
}
- else aValue = SALOMEDS::AttributeIOR::_narrow(_corba_impl)->Value();
+ else aValue = (CORBA::String_var)((SALOMEDS::AttributeIOR_var)SALOMEDS::AttributeIOR::_narrow(_corba_impl))->Value();
return aValue;
}
SALOMEDS::Locker lock;
dynamic_cast<SALOMEDSImpl_AttributeIOR*>(_local_impl)->SetValue(value);
}
- else SALOMEDS::AttributeIOR::_narrow(_corba_impl)->SetValue(value.c_str());
+ else ((SALOMEDS::AttributeIOR_var)SALOMEDS::AttributeIOR::_narrow(_corba_impl))->SetValue(value.c_str());
}
return c_s._retn();
}
+
void SALOMEDS_AttributeIOR_i::SetValue(const char* value)
{
SALOMEDS::Locker lock;
string anExtStr((char *)Str.in());
dynamic_cast<SALOMEDSImpl_AttributeIOR*>(_impl)->SetValue(anExtStr);
}
+
+SALOMEDS_AttributeIOR_i::~SALOMEDS_AttributeIOR_i()
+{}
SALOMEDS_AttributeIOR_i(SALOMEDSImpl_AttributeIOR* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
- ~SALOMEDS_AttributeIOR_i() {};
+ ~SALOMEDS_AttributeIOR_i();
char* Value();
void SetValue(const char* value);
SALOMEDS::Locker lock;
aValue = dynamic_cast<SALOMEDSImpl_AttributeName*>(_local_impl)->Value();
}
- else aValue = SALOMEDS::AttributeName::_narrow(_corba_impl)->Value();
+ else aValue = (CORBA::String_var)((SALOMEDS::AttributeName_var)SALOMEDS::AttributeName::_narrow(_corba_impl))->Value();
return aValue;
}
SALOMEDS::Locker lock;
dynamic_cast<SALOMEDSImpl_AttributeName*>(_local_impl)->SetValue(value);
}
- else SALOMEDS::AttributeName::_narrow(_corba_impl)->SetValue(value.c_str());
+ else ((SALOMEDS::AttributeName_var)SALOMEDS::AttributeName::_narrow(_corba_impl))->SetValue(value.c_str());
}
SALOMEDS::Locker lock;
ret = dynamic_cast<SALOMEDSImpl_AttributePixMap*>(_local_impl)->HasPixMap();
}
- else ret = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->HasPixMap();
+ else ret = ((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->HasPixMap();
return ret;
}
SALOMEDS::Locker lock;
aValue = dynamic_cast<SALOMEDSImpl_AttributePixMap*>(_local_impl)->GetPixMap();
}
- else aValue = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->GetPixMap();
+ else aValue = (CORBA::String_var)((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->GetPixMap();
return aValue;
}
SALOMEDS::Locker lock;
dynamic_cast<SALOMEDSImpl_AttributePixMap*>(_local_impl)->SetPixMap(value);
}
- else SALOMEDS::AttributePixMap::_narrow(_corba_impl)->SetPixMap(value.c_str());
+ else ((SALOMEDS::AttributePixMap_var)SALOMEDS::AttributePixMap::_narrow(_corba_impl))->SetPixMap(value.c_str());
}
dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
anImpl->ChangeCreatorName(theName);
} else
- SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str());
+ ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetUserName(theName.c_str());
}
std::string SALOMEDS_AttributeStudyProperties::GetUserName()
aName = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetCreatorName();
}
#ifndef WIN32
- else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName();
+ else aName = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUserName();
#else
- else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserNameA();
+ else aName = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUserNameA();
#endif
return aName;
}
string S;
anImpl->SetModification(S, theMinute, theHour, theDay, theMonth, theYear);
} else {
- SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute,
+ ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetCreationDate(theMinute,
theHour,
theDay,
theMonth,
(_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear);
} else {
CORBA::Long aMinute, anHour, aDay, aMonth, anYear;
- ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationDate(aMinute,
+ ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetCreationDate(aMinute,
anHour,
aDay,
aMonth,
else //Not defined
dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetCreationMode(0);
}
- else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(theMode.c_str());
+ else ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetCreationMode(theMode.c_str());
}
std::string SALOMEDS_AttributeStudyProperties::GetCreationMode()
if (mode == 2) aMode = "copy from";
}
else
- aMode = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetCreationMode();
+ aMode = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetCreationMode();
return aMode;
}
dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetModified(theModified);
}
else
- SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified);
+ ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetModified(theModified);
}
bool SALOMEDS_AttributeStudyProperties::IsModified()
ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->IsModified();
}
else
- ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified();
+ ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->IsModified();
return ret;
}
isModified = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetModified();
}
else
- isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified();
+ isModified = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetModified();
return isModified;
}
dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetLocked(theLocked);
}
else
- SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked);
+ ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetLocked(theLocked);
}
bool SALOMEDS_AttributeStudyProperties::IsLocked()
ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->IsLocked();
}
else
- ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked();
+ ret = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->IsLocked();
return ret;
}
SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
anImpl->SetModification(theName, theMinute, theHour, theDay, theMonth, theYear);
} else
- SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(theName.c_str(),
+ ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->SetModification(theName.c_str(),
theMinute,
theHour,
theDay,
} else {
SALOMEDS::StringSeq_var aNames;
SALOMEDS::LongSeq_var aMinutes, aHours, aDays, aMonths, aYears;
- SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModificationsList(aNames.out(),
+ ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetModificationsList(aNames.out(),
aMinutes.out(),
aHours.out(),
aDays.out(),
SALOMEDS::Locker lock;
aSO = new SALOMEDS_SObject(_local_impl->Value());
}
- else aSO = new SALOMEDS_SObject(_corba_impl->Value());
+ else {
+ SALOMEDS::SObject_var so=_corba_impl->Value();
+ aSO = new SALOMEDS_SObject(so);
+ }
return _PTR(SObject)(aSO);
}
public virtual SALOME::GenericObj_i
{
private:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_ChildIterator* _it;
public:
SALOMEDS::unlock();
bool isOk = _driver->CanCopy(so.in());
+ so->Destroy();
SALOMEDS::lock();
return isOk;
aType = _local_impl->Type();
}
else {
- aType = _corba_impl->Type();
+ aType = (CORBA::String_var)_corba_impl->Type();
}
return aType;
}
aType = _local_impl->GetClassType();
}
else {
- aType = _corba_impl->GetClassType();
+ aType = (CORBA::String_var)_corba_impl->GetClassType();
}
return aType;
}
aSO = new SALOMEDS_SObject(_local_impl->GetSObject());
}
else {
- aSO = new SALOMEDS_SObject(_corba_impl->GetSObject());
+ aSO = new SALOMEDS_SObject((SALOMEDS::SObject_var)_corba_impl->GetSObject());
}
return _PTR(SObject)(aSO);
{
SALOMEDS_GenericAttribute* aGA = NULL;
if(!CORBA::is_nil(theGA)) {
- std::string aTypeOfAttribute = theGA->GetClassType();
+ CORBA::String_var astr=theGA->GetClassType();
+ std::string aTypeOfAttribute = astr.in();
__CreateGenericClientAttributeCORBA
}
return aGA;
_impl = theImpl;
}
+SALOMEDS_GenericAttribute_i::~SALOMEDS_GenericAttribute_i()
+{
+}
+
void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection)
{
SALOMEDS::Locker lock;
return CORBA::string_dup(type.c_str());
}
- return (char*)"";
+ return CORBA::string_dup("");
}
char* SALOMEDS_GenericAttribute_i::GetClassType()
return CORBA::string_dup(class_type.c_str());
}
- return (char*)"";
+ return CORBA::string_dup("");
}
protected:
DF_Attribute* _impl;
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
public:
SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb);
- virtual ~SALOMEDS_GenericAttribute_i() {};
+ virtual ~SALOMEDS_GenericAttribute_i();
void CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection);
SALOMEDS::Locker lock;
aType = (dynamic_cast<SALOMEDSImpl_SComponent*>(GetLocalImpl()))->ComponentDataType();
}
- else aType = (SALOMEDS::SComponent::_narrow(GetCORBAImpl()))->ComponentDataType();
+ else
+ {
+ SALOMEDS::SComponent_var aCompo=SALOMEDS::SComponent::_narrow(GetCORBAImpl());
+ CORBA::String_var aString = aCompo->ComponentDataType();
+ aType=aString.in();
+ }
return aType;
}
SALOMEDS::SComponent_ptr SALOMEDS_SComponent::GetSComponent()
{
if(_isLocal) {
- if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl()));
+ if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_narrow(GetCORBAImpl());
SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(*(dynamic_cast<SALOMEDSImpl_SComponent*>(GetLocalImpl())), _orb);
_corba_impl = SALOMEDS::SComponent::_duplicate(aSCO);
return aSCO._retn();
}
else {
- return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl()));
+ return SALOMEDS::SComponent::_narrow(GetCORBAImpl());
}
return SALOMEDS::SComponent::_nil();
}
SALOMEDS::Locker lock;
aSCO = new SALOMEDS_SComponent(_local_impl->Value());
}
- else aSCO = new SALOMEDS_SComponent(_corba_impl->Value());
+ else aSCO = new SALOMEDS_SComponent((SALOMEDS::SComponent_var)_corba_impl->Value());
return _PTR(SComponent)(aSCO);
}
private:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_SComponentIterator* _impl;
public:
SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const SALOMEDSImpl_SComponent& theImpl, CORBA::ORB_ptr theORB)
{
SALOMEDS_SComponent_i* sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB);
- SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this());
- return sco._retn();
+ return sco_servant->_this();
}
//============================================================================
SALOMEDS::Locker lock;
aValue = _local_impl->GetID();
}
- else aValue = _corba_impl->GetID();
+ else aValue = (CORBA::String_var)_corba_impl->GetID();
return aValue;
}
SALOMEDS::Locker lock;
return _PTR(SComponent)(new SALOMEDS_SComponent(_local_impl->GetFatherComponent()));
}
- return _PTR(SComponent)(new SALOMEDS_SComponent(_corba_impl->GetFatherComponent()));
+ return _PTR(SComponent)(new SALOMEDS_SComponent((SALOMEDS::SComponent_var)_corba_impl->GetFatherComponent()));
}
_PTR(SObject) SALOMEDS_SObject::GetFather()
SALOMEDS::Locker lock;
return _PTR(SObject)(new SALOMEDS_SObject(_local_impl->GetFather()));
}
- return _PTR(SObject)(new SALOMEDS_SObject(_corba_impl->GetFather()));
+ return _PTR(SObject)(new SALOMEDS_SObject((SALOMEDS::SObject_var)_corba_impl->GetFather()));
}
bool SALOMEDS_SObject::FindAttribute(_PTR(GenericAttribute)& anAttribute,
SALOMEDS::Locker lock;
return _PTR(Study)(new SALOMEDS_Study(_local_impl->GetStudy()));
}
- return _PTR(Study)(new SALOMEDS_Study(_corba_impl->GetStudy()));
+ SALOMEDS::Study_var study=_corba_impl->GetStudy();
+ return _PTR(Study)(new SALOMEDS_Study(study));
}
std::string SALOMEDS_SObject::Name()
SALOMEDS::Locker lock;
aName = _local_impl->Name();
}
- else aName = _corba_impl->Name();
+ else aName = (CORBA::String_var)_corba_impl->Name();
return aName;
}
SALOMEDS::Locker lock;
aName = _local_impl->GetName();
}
- else aName = _corba_impl->GetName();
+ else aName = (CORBA::String_var) _corba_impl->GetName();
return aName;
}
SALOMEDS::Locker lock;
aComment = _local_impl->GetComment();
}
- else aComment = _corba_impl->GetComment();
+ else aComment = (CORBA::String_var) _corba_impl->GetComment();
return aComment;
}
SALOMEDS::Locker lock;
anIOR = _local_impl->GetIOR();
}
- else anIOR = _corba_impl->GetIOR();
+ else anIOR = (CORBA::String_var) _corba_impl->GetIOR();
return anIOR;
}
CORBA::Object_ptr GetObject();
SALOMEDS::SObject_ptr GetSObject();
- SALOMEDS::SObject_ptr GetCORBAImpl() { return SALOMEDS::SObject::_duplicate(_corba_impl); }
+ SALOMEDS::SObject_var GetCORBAImpl() { return _corba_impl; }
SALOMEDSImpl_SObject* GetLocalImpl() { return _local_impl; }
private:
SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const SALOMEDSImpl_SObject& theImpl, CORBA::ORB_ptr theORB)
{
SALOMEDS_SObject_i* so_servant = new SALOMEDS_SObject_i(theImpl, theORB);
- SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this());
- return so._retn();
+ return so_servant->_this();
}
SALOMEDS::Locker lock;
DF_Attribute* anAttr = NULL;
if(_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute)) {
- anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+ anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb);
return true;
}
for(int i = 0; i < length; i++) {
SALOMEDSImpl_GenericAttribute* anAttr = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(aSeq[i]);
SALOMEDS::GenericAttribute_var anAttribute;
- anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+ anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb);
if (!CORBA::is_nil(anAttribute)) {
SeqOfAttr[i] = anAttribute;
}
public virtual SALOME::GenericObj_i
{
protected:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_SObject* _impl;
public:
SALOMEDS::Locker lock;
aRef = _local_impl->GetPersistentReference();
}
- else aRef = _corba_impl->GetPersistentReference();
+ else aRef = (CORBA::String_var)_corba_impl->GetPersistentReference();
return aRef;
}
SALOMEDS::Locker lock;
aProp = new SALOMEDS_AttributeStudyProperties(_local_impl->GetProperties());
}
- else aProp = new SALOMEDS_AttributeStudyProperties(_corba_impl->GetProperties());
+ else aProp = new SALOMEDS_AttributeStudyProperties((SALOMEDS::AttributeStudyProperties_var)_corba_impl->GetProperties());
return _PTR(AttributeStudyProperties)(aProp);
}
{
SALOMEDS::Locker lock;
CheckLocked();
- SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID());
+ CORBA::String_var anID=aComponent->GetID();
+ SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anID.in());
CORBA::String_var iorstr = _orb->object_to_string(IOR);
_impl->DefineComponentInstance(aSCO, (char*)iorstr.in());
SALOMEDS::Locker lock;
CheckLocked();
ASSERT(!CORBA::is_nil(aComponent));
- SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID());
+ CORBA::String_var cid=aComponent->GetID();
+ SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(cid.in());
_impl->RemoveComponent(aSCO);
}
CheckLocked();
SALOMEDSImpl_SObject aFO, aSO;
- aFO = _impl->GetOwner()->GetSObject(theFatherObject->GetID());
+ CORBA::String_var anID=theFatherObject->GetID();
+ aFO = _impl->GetOwner()->GetSObject(anID.in());
aSO = _impl->NewObject(aFO);
if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO,_orb);
{
SALOMEDS::Locker lock;
CheckLocked();
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ CORBA::String_var anID=anObject->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->RemoveObject(aSO);
}
{
SALOMEDS::Locker lock;
CheckLocked();
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ CORBA::String_var anID=anObject->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->RemoveObjectWithChildren(aSO);
}
SALOMEDS::Locker lock;
Unexpect aCatch(SBSalomeException);
- SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anSCO->GetID());
+ CORBA::String_var anID=anSCO->GetID();
+ SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anID.in());
SALOMEDS_Driver_i* driver = new SALOMEDS_Driver_i(aDriver, _orb);
bool isDone = _impl->LoadWith(aSCO, driver);
delete driver;
SALOMEDS::GenericAttribute_var anAttribute;
if(anAttr)
- anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+ anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb);
return anAttribute._retn();
}
{
SALOMEDS::Locker lock;
ASSERT(!CORBA::is_nil(anObject));
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ CORBA::String_var anID = anObject->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
DF_Attribute* anAttr;
if(!_impl->FindAttribute(aSO, anAttr, string(aTypeOfAttribute))) return false;
- anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+ anAttribute = SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb);
return true;
}
SALOMEDS::Locker lock;
CheckLocked();
ASSERT(!CORBA::is_nil(anObject));
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ CORBA::String_var anID = anObject->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->RemoveAttribute(aSO, string(aTypeOfAttribute));
}
ASSERT(!CORBA::is_nil(theReferencedObject));
SALOMEDSImpl_SObject aSO, aRefSO;
- aSO = _impl->GetOwner()->GetSObject(me->GetID());
- aRefSO = _impl->GetOwner()->GetSObject(theReferencedObject->GetID());
+ CORBA::String_var anID = me->GetID();
+ aSO = _impl->GetOwner()->GetSObject(anID.in());
+ anID=theReferencedObject->GetID();
+ aRefSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->Addreference(aSO, aRefSO);
}
SALOMEDS::Locker lock;
CheckLocked();
ASSERT(!CORBA::is_nil(me));
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(me->GetID());
+ CORBA::String_var anID = me->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->RemoveReference(aSO);
}
SALOMEDS::Locker lock;
CheckLocked();
ASSERT(!CORBA::is_nil(anObject));
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ CORBA::String_var anID=anObject->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->SetGUID(aSO, string(theGUID));
}
{
SALOMEDS::Locker lock;
ASSERT(!CORBA::is_nil(anObject));
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ CORBA::String_var anID=anObject->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
return _impl->IsGUID(aSO, string(theGUID));
}
Unexpect aCatch(SBLockProtection);
CheckLocked();
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID());
+ CORBA::String_var anID=theSO->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->SetName(aSO, string(theValue));
}
Unexpect aCatch(SBLockProtection);
CheckLocked();
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID());
+ CORBA::String_var anID=theSO->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->SetComment(aSO, string(theValue));
}
Unexpect aCatch(SBLockProtection);
CheckLocked();
- SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID());
+ CORBA::String_var anID=theSO->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.in());
_impl->SetIOR(aSO, string(theValue));
}
class SALOMEDS_StudyBuilder_i: public POA_SALOMEDS::StudyBuilder
{
private:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_StudyBuilder* _impl;
public:
MESSAGE("NewStudy : Creating the CORBA servant holding it... ");
- SALOMEDS_Study_i *Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb);
- SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this());
+ SALOMEDS_Study_i *Study_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb);
+ PortableServer::ObjectId_var servantid = _poa->activate_object(Study_servant); // to use poa registered in _mapOfPOA
+ SALOMEDS::Study_var Study = Study_servant->_this();
// Register study in the naming service
// Path to acces the study
_mapOfPOA[Study->StudyId()] = _poa;
- return Study;
+ return Study._retn();
}
//============================================================================
MESSAGE("Open : Creating the CORBA servant holding it... ");
// Temporary aStudyUrl in place of study name
- SALOMEDS_Study_i * Study_servant = new SALOMEDS_Study_i(aStudyImpl, _orb);
- SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(Study_servant->_this());
+ SALOMEDS_Study_i * Study_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb);
+ PortableServer::ObjectId_var servantid = _poa->activate_object(Study_servant); // to use poa register in _mapOfPOA
+ SALOMEDS::Study_var Study = Study_servant->_this();
// Assign the value of the IOR in the study->root
CORBA::String_var IORStudy = _orb->object_to_string(Study);
aStudyImpl->SetTransientReference((char*)IORStudy.in());
+ _mapOfPOA[Study->StudyId()] = _poa;
+
// Register study in the naming service
// Path to acces the study
if(!_name_service->Change_Directory("/Study")) MESSAGE( "Unable to access the study directory" )
else _name_service->Register(Study, CORBA::string_dup(aStudyImpl->Name().c_str()));
- return Study;
+ return Study._retn();
}
SALOMEDS::unlock();
aStudy->Close();
SALOMEDS::lock();
+
+ //remove study servant
+ PortableServer::POA_ptr poa=GetPOA(aStudy);
+ PortableServer::ServantBase* aservant=poa->reference_to_servant(aStudy);
+ PortableServer::ObjectId_var anObjectId = poa->servant_to_id(aservant);
+ poa->deactivate_object(anObjectId.in());
+ aservant->_remove_ref(); // decrement for the call to reference_to_servant
+ aservant->_remove_ref(); // to delete the object
}
//============================================================================
return SALOMEDS::Study::_nil();
}
- SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb);
- SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(aStudy_servant->_this());
-
- return aStudy._retn();
+ SALOMEDS_Study_i* aStudy_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb);
+ return aStudy_servant->_this();
}
//============================================================================
return SALOMEDS::Study::_nil();
}
- SALOMEDS_Study_i* aStudy_servant = new SALOMEDS_Study_i(aStudyImpl, _orb);
- CORBA::Object_var obj = aStudy_servant->_this();
- SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(obj);
-
- return aStudy._retn();
+ SALOMEDS_Study_i* aStudy_servant = SALOMEDS_Study_i::GetStudyServant(aStudyImpl, _orb);
+ return aStudy_servant->_this();
}
SALOMEDS::Study_var aStudy = theObject->GetStudy();
SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID());
+ CORBA::String_var anID = theObject->GetID();
+ SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in());
SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
bool ret = _impl->CanCopy(anObject, aDriver);
SALOMEDS::Study_var aStudy = theObject->GetStudy();
SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID());
+ CORBA::String_var anID = theObject->GetID();
+ SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in());
SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
bool ret = _impl->Copy(anObject, aDriver);
SALOMEDS::Study_var aStudy = theObject->GetStudy();
SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID());
+ CORBA::String_var anID = theObject->GetID();
+ SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in());
SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
bool ret = _impl->CanPaste(anObject, aDriver);
SALOMEDS::Study_var aStudy = theObject->GetStudy();
SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID());
+ CORBA::String_var anID = theObject->GetID();
+ SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(anID.in());
SALOMEDSImpl_SObject aNewSO;
try {
//
#include "utilities.h"
#include "SALOMEDS_Study_i.hxx"
+#include "SALOMEDS_StudyManager_i.hxx"
#include "SALOMEDS_UseCaseIterator_i.hxx"
#include "SALOMEDS_GenericAttribute_i.hxx"
#include "SALOMEDS_AttributeStudyProperties_i.hxx"
using namespace std;
+std::map<SALOMEDSImpl_Study* , SALOMEDS_Study_i*> SALOMEDS_Study_i::_mapOfStudies;
+
//============================================================================
/*! Function : SALOMEDS_Study_i
* Purpose : SALOMEDS_Study_i constructor
//============================================================================
SALOMEDS_Study_i::~SALOMEDS_Study_i()
{
+ //delete the builder servant
+ PortableServer::POA_var poa=_builder->_default_POA();
+ PortableServer::ObjectId_var anObjectId = poa->servant_to_id(_builder);
+ poa->deactivate_object(anObjectId.in());
+ _builder->_remove_ref();
+
+ //delete implementation
+ delete _impl;
+ _mapOfStudies.erase(_impl);
}
//============================================================================
{
SALOMEDS::Locker lock;
- SALOMEDSImpl_SObject aSO = _impl->GetSObject(theSO->GetID());
+ CORBA::String_var anID=theSO->GetID();
+ SALOMEDSImpl_SObject aSO = _impl->GetSObject(anID.in());
SALOMEDSImpl_ChildIterator anItr(aSO);
//Create iterator
SALOMEDS_ChildIterator_i* it_servant = new SALOMEDS_ChildIterator_i(anItr, _orb);
- SALOMEDS::ChildIterator_var it = SALOMEDS::ChildIterator::_narrow(it_servant->_this());
- return it;
+ return it_servant->_this();
}
return SALOMEDS::Study::_nil();
}
+SALOMEDS_Study_i* SALOMEDS_Study_i::GetStudyServant(SALOMEDSImpl_Study* aStudyImpl, CORBA::ORB_ptr orb)
+{
+ if (_mapOfStudies.find(aStudyImpl) != _mapOfStudies.end())
+ return _mapOfStudies[aStudyImpl];
+ else
+ {
+ SALOMEDS_Study_i *Study_servant = new SALOMEDS_Study_i(aStudyImpl, orb);
+ _mapOfStudies[aStudyImpl]=Study_servant;
+ return Study_servant;
+ }
+}
+
void SALOMEDS_Study_i::IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute)
{
SALOMEDS::Locker lock;
SALOMEDS::SComponentIterator_var itcomponent = NewComponentIterator();
for (; itcomponent->More(); itcomponent->Next()) {
SALOMEDS::SComponent_var sco = itcomponent->Value();
- MESSAGE ( "Look for an engine for data type :"<< sco->ComponentDataType());
+ CORBA::String_var compodatatype=sco->ComponentDataType();
+ MESSAGE ( "Look for an engine for data type :"<< compodatatype);
// if there is an associated Engine call its method for closing
CORBA::String_var IOREngine;
if (sco->ComponentIOR(IOREngine)) {
// we have found the associated engine to write the data
- MESSAGE ( "We have found an engine for data type :"<< sco->ComponentDataType());
+ MESSAGE ( "We have found an engine for data type :"<< compodatatype);
//_narrow can throw a corba exception
try
{
catch (CORBA::Exception&)
{/*pass*/ }
}
+ sco->Destroy();
}
+ //Does not need any more this iterator
+ itcomponent->Destroy();
+
+
_impl->Close();
}
class Standard_EXPORT SALOMEDS_Study_i: public POA_SALOMEDS::Study
{
private:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_Study* _impl;
SALOMEDS_StudyBuilder_i* _builder;
+ static std::map<SALOMEDSImpl_Study*, SALOMEDS_Study_i*> _mapOfStudies;
public:
virtual void StudyId(CORBA::Short id);
static SALOMEDS::Study_ptr GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb);
+ static SALOMEDS_Study_i* GetStudyServant(SALOMEDSImpl_Study*, CORBA::ORB_ptr orb);
static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute);
{
private:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_UseCaseBuilder* _impl;
public:
public virtual SALOME::GenericObj_i
{
private:
- CORBA::ORB_ptr _orb;
+ CORBA::ORB_var _orb;
SALOMEDSImpl_UseCaseIterator* _impl;
public:
-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@
# 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@
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../HDFPersist \
-I$(srcdir)/../DF \
+ -I$(srcdir)/../GenericObj \
+ -I$(top_builddir)/idl \
@HDF5_INCLUDES@ \
- @BOOST_CPPFLAGS@
+ @BOOST_CPPFLAGS@ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
../HDFPersist/libSalomeHDFPersist.la \
../DF/libDF.la \
+ ../GenericObj/libSalomeGenericObj.la \
@HDF5_LIBS@
libSalomeDSImpl_la_CPPFLAGS = $(COMMON_CPPFLAGS)
libSalomeDSImpl_la_LDFLAGS = -no-undefined -version-info=0:0:0
-libSalomeDSImpl_la_LIBADD = $(COMMON_LIBS)
+libSalomeDSImpl_la_LIBADD = $(COMMON_LIBS) $(CORBA_LIBS)
#
# ===============================================================
testDS_SOURCES = testDS.cxx
testDS_CPPFLAGS = $(COMMON_CPPFLAGS)
testDS_LDADD = libSalomeDSImpl.la \
- $(HDF5_LIBS)
+ $(HDF5_LIBS) $(CORBA_LIBS)
using namespace std;
+//to disable automatic genericobj management comment the following line
+#define WITHGENERICOBJ
+
+#ifdef WITHGENERICOBJ
+#include "SALOME_GenericObj_i.hh"
+
+static CORBA::ORB_var getORB()
+{
+ int argc=0;
+ return CORBA::ORB_init(argc,0);
+}
+
+void IORGenericObjDecref(const std::string& anIOR)
+{
+ CORBA::Object_var obj;
+ SALOME::GenericObj_var gobj;
+ try
+ {
+ obj = getORB()->string_to_object(anIOR.c_str());
+ if(obj->_non_existent())return;
+ gobj = SALOME::GenericObj::_narrow(obj);
+ if(! CORBA::is_nil(gobj) )
+ {
+ gobj->Destroy();
+ }
+ }
+ catch(const CORBA::Exception& e)
+ {
+ }
+}
+
+void IORGenericObjIncref(const std::string& anIOR)
+{
+ CORBA::Object_var obj;
+ SALOME::GenericObj_var gobj;
+ try
+ {
+ obj = getORB()->string_to_object(anIOR.c_str());
+ if(obj->_non_existent())return;
+ gobj = SALOME::GenericObj::_narrow(obj);
+ if(! CORBA::is_nil(gobj) )
+ {
+ gobj->Register();
+ }
+ }
+ catch(const CORBA::Exception& e)
+ {
+ }
+}
+#else
+void IORGenericObjDecref(const std::string& anIOR)
+{}
+void IORGenericObjIncref(const std::string& anIOR)
+{}
+#endif
+
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L,
- const std::string& S)
+ const std::string& S)
{
SALOMEDSImpl_AttributeIOR* A = NULL;
if (!(A=(SALOMEDSImpl_AttributeIOR*)L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
}
A->SetValue(S);
- SALOMEDSImpl_Study::IORUpdated(A);
return A;
}
{
CheckLocked();
- SALOMEDSImpl_Study::GetStudy(Label());
+ SALOMEDSImpl_Study* study=SALOMEDSImpl_Study::GetStudy(Label());
Backup();
+ //remove IOR entry in study
+ if(theValue != myString)
+ {
+ IORGenericObjIncref(theValue);
+ IORGenericObjDecref(myString);
+ study->DeleteIORLabelMapItem(myString);
+ }
+
myString = theValue;
+ //add IOR entry in study
SALOMEDSImpl_Study::IORUpdated(this);
}
{
}
+SALOMEDSImpl_AttributeIOR::~SALOMEDSImpl_AttributeIOR()
+{
+ IORGenericObjDecref(myString);
+}
+
//=======================================================================
//function : ID
//purpose :
void Restore(DF_Attribute* with);
DF_Attribute* NewEmpty() const;
void Paste(DF_Attribute* into);
- ~SALOMEDSImpl_AttributeIOR() {}
+ ~SALOMEDSImpl_AttributeIOR() ;
};
#define VARIABLE_SEPARATOR ':'
#define OPERATION_SEPARATOR '|'
-
//============================================================================
/*! Function : SALOMEDSImpl_Study
* Purpose : SALOMEDSImpl_Study constructor
*/
//============================================================================
SALOMEDSImpl_Study::SALOMEDSImpl_Study(const DF_Document* doc,
- const string& study_name)
+ const string& study_name)
{
_name = study_name;
_doc = (DF_Document*)doc;
*/
//============================================================================
SALOMEDSImpl_Study::~SALOMEDSImpl_Study()
-{}
+{
+ delete _builder;
+ delete _cb;
+ delete _useCaseBuilder;
+}
//============================================================================
/*! Function : GetPersistentReference
ID = SC.GetID();
if(aComponentID == ID)
{
- // ComponentID found
- _find = true;
+ // ComponentID found
+ _find = true;
compo = SC;
}
}
for (; it.More();it.Next()){
if(!_find)
{
- SALOMEDSImpl_SComponent SC = it.Value();
- if (SC.GetName() == anObjectName)
- {
- _find = true;
- RefSO = SC;
-
- }
- if (!_find) RefSO = _FindObject(SC, anObjectName, _find);
+ SALOMEDSImpl_SComponent SC = it.Value();
+ if (SC.GetName() == anObjectName)
+ {
+ _find = true;
+ RefSO = SC;
+
+ }
+ if (!_find) RefSO = _FindObject(SC, anObjectName, _find);
}
}
if(!RefSO) _errorCode = "No object was found";
*/
//============================================================================
vector<SALOMEDSImpl_SObject> SALOMEDSImpl_Study::FindObjectByName(const string& anObjectName,
- const string& aComponentName)
+ const string& aComponentName)
{
_errorCode = "";
SALOMEDSImpl_SObject CSO = it.Value();
if ( CSO.GetName() == anObjectName ) {
- /* add to list */
- listSO.push_back(CSO) ;
+ /* add to list */
+ listSO.push_back(CSO) ;
}
/* looks also for eventual children */
for ( ; anIterator.More(); anIterator.Next() ) {
aLabel = anIterator.Value();
if((anAttr=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
- if(anAttr->Value() == aToken) {
- if(i == (len-1)) { //The searched label is found (no part of the path is left)
- return GetSObject(aLabel);
- }
-
- anIterator.Init(aLabel, false);
- break;
- }
+ if(anAttr->Value() == aToken) {
+ if(i == (len-1)) { //The searched label is found (no part of the path is left)
+ return GetSObject(aLabel);
+ }
+
+ anIterator.Init(aLabel, false);
+ break;
+ }
}
}
if(aFather) {
aName = aFather.GetName();
if(!aName.empty() && aName != "") {
- aValue = GetObjectPath(aFather);
- aPath = aValue + aPath;
+ aValue = GetObjectPath(aFather);
+ aPath = aValue + aPath;
}
}
}
SALOMEDSImpl_AttributeLocalID* anID;
if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) {
if (anID->Value() == DIRECTORYID) {
- SALOMEDSImpl_AttributeName* aName;
- if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
- aResultSeq.push_back(aName->Value());
- }
+ SALOMEDSImpl_AttributeName* aName;
+ if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
+ aResultSeq.push_back(aName->Value());
+ }
}
}
}
SALOMEDSImpl_AttributeLocalID* anID;
if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) {
if (anID->Value() == FILELOCALID) {
- SALOMEDSImpl_AttributePersistentRef* aName;
- if ((aName=(SALOMEDSImpl_AttributePersistentRef*)aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
- std::string aFileName = aName->Value();
- if (aFileName.size() > 0)
- aResultSeq.push_back(aFileName.substr(strlen(FILEID), aFileName.size()));
- }
+ SALOMEDSImpl_AttributePersistentRef* aName;
+ if ((aName=(SALOMEDSImpl_AttributePersistentRef*)aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
+ std::string aFileName = aName->Value();
+ if (aFileName.size() > 0)
+ aResultSeq.push_back(aFileName.substr(strlen(FILEID), aFileName.size()));
+ }
}
}
}
*/
//============================================================================
SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObject(const SALOMEDSImpl_SObject& SO,
- const string& theObjectName,
- bool& _find)
+ const string& theObjectName,
+ bool& _find)
{
SALOMEDSImpl_SObject RefSO;
if(!SO) return RefSO;
for (; it.More(); it.Next()){
if(!_find)
{
- if ((anAttr=(SALOMEDSImpl_AttributeName*)it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
- {
+ if ((anAttr=(SALOMEDSImpl_AttributeName*)it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
+ {
string Val(anAttr->Value());
- if (Val == theObjectName)
- {
- RefSO = GetSObject(it.Value());
- _find = true;
- }
- }
- if (!_find) RefSO = _FindObject(GetSObject(it.Value()), theObjectName, _find);
+ if (Val == theObjectName)
+ {
+ RefSO = GetSObject(it.Value());
+ _find = true;
+ }
+ }
+ if (!_find) RefSO = _FindObject(GetSObject(it.Value()), theObjectName, _find);
}
}
return RefSO;
//============================================================================
SALOMEDSImpl_SObject
SALOMEDSImpl_Study::_FindObjectIOR(const SALOMEDSImpl_SObject& SO,
- const string& theObjectIOR,
- bool& _find)
+ const string& theObjectIOR,
+ bool& _find)
{
SALOMEDSImpl_SObject RefSO, aSO;
if(!SO) return RefSO;
for (; it.More();it.Next()){
if(!_find)
{
- if ((anAttr=(SALOMEDSImpl_AttributeIOR*)it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID())))
- {
+ if ((anAttr=(SALOMEDSImpl_AttributeIOR*)it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID())))
+ {
string Val(anAttr->Value());
- if (Val == theObjectIOR)
- {
- RefSO = GetSObject(it.Value());
- _find = true;
- }
- }
- aSO = GetSObject(it.Value());
- if (!_find) RefSO = _FindObjectIOR(aSO, theObjectIOR, _find);
+ if (Val == theObjectIOR)
+ {
+ RefSO = GetSObject(it.Value());
+ _find = true;
+ }
+ }
+ aSO = GetSObject(it.Value());
+ if (!_find) RefSO = _FindObjectIOR(aSO, theObjectIOR, _find);
}
}
return RefSO;
myIORLabels[anIOR] = aLabel;
}
+void SALOMEDSImpl_Study::DeleteIORLabelMapItem(const std::string& anIOR)
+{
+ if (myIORLabels.find(anIOR) != myIORLabels.end())
+ {
+ //remove the ior entry and decref the genericobj (if it's one)
+ myIORLabels.erase(anIOR);
+ }
+}
+
SALOMEDSImpl_Study* SALOMEDSImpl_Study::GetStudy(const DF_Label& theLabel)
{
SALOMEDSImpl_StudyHandle* Att;
char aDate[20];
sprintf(aDate, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
(int)(aDays[anIndex]), (int)(aMonths[anIndex]), (int)(aYears[anIndex]),
- (int)(aHours[anIndex]), (int)(aMinutes[anIndex]));
+ (int)(aHours[anIndex]), (int)(aMinutes[anIndex]));
aDates.push_back(aDate);
}
return aDates;
*/
//============================================================================
DF_Attribute* SALOMEDSImpl_Study::GetAttribute(const string& theEntry,
- const string& theType)
+ const string& theType)
{
SALOMEDSImpl_SObject aSO = GetSObject(theEntry);
DF_Attribute* anAttr;
*/
//============================================================================
bool SALOMEDSImpl_Study::DumpStudy(const string& thePath,
- const string& theBaseName,
- bool isPublished,
- SALOMEDSImpl_DriverFactory* theFactory)
+ const string& theBaseName,
+ bool isPublished,
+ SALOMEDSImpl_DriverFactory* theFactory)
{
_errorCode = "";
fp << _GetNoteBookAccess();
- fp << "sys.path.insert( 0, \'" << thePath << "\')" << endl << endl;
+ fp << "sys.path.insert( 0, r\'" << thePath << "\')" << endl << endl;
//Dump NoteBook Variables
fp << _GetStudyVariablesScript();
string IOREngine;
try {
if (!sco.ComponentIOR(IOREngine)) {
- if (!aCompType.empty()) {
-
- aDriver = theFactory->GetDriverByType(aCompType);
-
- if (aDriver != NULL) {
- SALOMEDSImpl_StudyBuilder* SB = NewBuilder();
- if(!SB->LoadWith(sco, aDriver)) {
- _errorCode = SB->GetErrorCode();
- return false;
- }
- }
- else continue;
- }
+ if (!aCompType.empty()) {
+
+ aDriver = theFactory->GetDriverByType(aCompType);
+
+ if (aDriver != NULL) {
+ SALOMEDSImpl_StudyBuilder* SB = NewBuilder();
+ if(!SB->LoadWith(sco, aDriver)) {
+ _errorCode = SB->GetErrorCode();
+ return false;
+ }
+ }
+ else continue;
+ }
}
else {
- aDriver = theFactory->GetDriverByIOR(IOREngine);
+ aDriver = theFactory->GetDriverByIOR(IOREngine);
}
} catch(...) {
_errorCode = "Can not restore information to dump it";
}
void dumpSO(const SALOMEDSImpl_SObject& theSO,
- fstream& fp,
- const string& Tab,
- SALOMEDSImpl_Study* theStudy);
+ fstream& fp,
+ const string& Tab,
+ SALOMEDSImpl_Study* theStudy);
//============================================================================
/*! Function : dump
void dumpSO(const SALOMEDSImpl_SObject& theSO,
- fstream& fp,
- const string& Tab,
- SALOMEDSImpl_Study* theStudy)
+ fstream& fp,
+ const string& Tab,
+ SALOMEDSImpl_Study* theStudy)
{
string aTab(Tab), anID(theSO.GetID());
fp << aTab << anID << endl;
*/
//============================================================================
SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetModuleParameters(const char* theID,
- const char* theModuleName,
- int theSavePoint)
+ const char* theModuleName,
+ int theSavePoint)
{
if(theSavePoint <= 0) return NULL;
SALOMEDSImpl_AttributeParameter* main_ap = GetCommonParameters(theID, theSavePoint);
*/
//============================================================================
bool SALOMEDSImpl_Study::FindVariableAttribute(SALOMEDSImpl_StudyBuilder* theStudyBuilder,
- SALOMEDSImpl_SObject theSObject,
- const std::string& theName)
+ SALOMEDSImpl_SObject theSObject,
+ const std::string& theName)
{
SALOMEDSImpl_ChildIterator anIter = NewChildIterator( theSObject );
for( ; anIter.More(); anIter.Next() )
vector< vector<string> > aSections = ParseVariables( aString );
for( int i = 0, n = aSections.size(); i < n; i++ )
{
- vector<string> aVector = aSections[i];
- for( int j = 0, m = aVector.size(); j < m; j++ )
- {
- string aStr = aVector[j];
- if( aStr.compare( theName ) == 0 )
- return true;
- }
+ vector<string> aVector = aSections[i];
+ for( int j = 0, m = aVector.size(); j < m; j++ )
+ {
+ string aStr = aVector[j];
+ if( aStr.compare( theName ) == 0 )
+ return true;
+ }
}
}
}
*/
//============================================================================
void SALOMEDSImpl_Study::ReplaceVariableAttribute(SALOMEDSImpl_StudyBuilder* theStudyBuilder,
- SALOMEDSImpl_SObject theSObject,
- const std::string& theSource,
- const std::string& theDest)
+ SALOMEDSImpl_SObject theSObject,
+ const std::string& theSource,
+ const std::string& theDest)
{
SALOMEDSImpl_ChildIterator anIter = NewChildIterator( theSObject );
for( ; anIter.More(); anIter.Next() )
vector< vector<string> > aSections = ParseVariables( aCurrentString );
for( int i = 0, n = aSections.size(); i < n; i++ )
{
- vector<string> aVector = aSections[i];
- for( int j = 0, m = aVector.size(); j < m; j++ )
- {
- string aStr = aVector[j];
- if( aStr.compare( theSource ) == 0 )
- {
- isChanged = true;
- aStr = theDest;
- }
-
- aNewString.append( aStr );
- if( j != m - 1 )
- aNewString.append( ":" );
- }
- if( i != n - 1 )
- aNewString.append( "|" );
+ vector<string> aVector = aSections[i];
+ for( int j = 0, m = aVector.size(); j < m; j++ )
+ {
+ string aStr = aVector[j];
+ if( aStr.compare( theSource ) == 0 )
+ {
+ isChanged = true;
+ aStr = theDest;
+ }
+
+ aNewString.append( aStr );
+ if( j != m - 1 )
+ aNewString.append( ":" );
+ }
+ if( i != n - 1 )
+ aNewString.append( "|" );
}
if( isChanged )
- aStringAttr->SetValue( aNewString );
+ aStringAttr->SetValue( aNewString );
}
}
}
virtual void StudyId(int id);
+ virtual void DeleteIORLabelMapItem(const std::string& anIOR);
virtual void UpdateIORLabelMap(const std::string& anIOR, const std::string& aLabel);
virtual std::vector<SALOMEDSImpl_SObject> FindDependances(const SALOMEDSImpl_SObject& anObject);
SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map
if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ _study->DeleteIORLabelMapItem(anAttr->Value());
}
Lab.ForgetAllAttributes();
}
SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map
if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ _study->DeleteIORLabelMapItem(anAttr->Value());
}
DF_ChildIterator it(Lab, true);
}
SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map
if ((anAttr=(SALOMEDSImpl_AttributeIOR*)aLabel.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ _study->DeleteIORLabelMapItem(anAttr->Value());
}
}
if (aTypeOfAttribute == string("AttributeIOR")) { // Remove from IORLabel map
SALOMEDSImpl_AttributeIOR* anAttr = NULL;
if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ _study->DeleteIORLabelMapItem(anAttr->Value());
}
}
#include <stdlib.h>
#include <string.h>
+#ifdef WIN32
+#include <Windows.h>
+#endif
+
+//Warning undef of Ascii Winwows define
+#ifdef WIN32
+# undef GetUserName
+#endif
+
using namespace std;
#define USE_CASE_LABEL_ID "0:2"
//============================================================================
SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager()
{
+ _appli->Close(_clipboard);
// Destroy application
delete _appli;
}
}
aStudy->Close();
+ DF_Document* doc=aStudy->GetDocument();
+ _appli->Close(doc);
}
//============================================================================
* Purpose : save the study in HDF file
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl,
+bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aStudyUrl,
SALOMEDSImpl_Study* aStudy,
SALOMEDSImpl_DriverFactory* aFactory,
bool theMultiFile,
return false;
}
+ //Create a temporary url to which the study is saved
+ string aUrl = SALOMEDSImpl_Tool::GetTmpDir() + SALOMEDSImpl_Tool::GetNameFromPath(aStudyUrl);
+
int aLocked = aStudy->GetProperties()->IsLocked();
if (aLocked) aStudy->GetProperties()->SetLocked(false);
}
string anOldName = aStudy->Name();
- aStudy->URL(aUrl);
+ aStudy->URL(aStudyUrl);
// To change for Save
// Do not have to do a new file but just a Open??? Rewrite all informations after erasing evrything??
if (theASCII) { // save file in ASCII format
HDFascii::ConvertFromHDFToASCII(aUrl.c_str(), true);
}
+
+ //Now it's necessary to copy files from the temporary directory to the user defined directory.
+
+ // The easiest way to get a list of file in the temporary directory
+
+ string aCmd, aTmpFileDir = SALOMEDSImpl_Tool::GetTmpDir();
+ string aTmpFile = aTmpFileDir +"files";
+ string aStudyTmpDir = SALOMEDSImpl_Tool::GetDirFromPath(aUrl);
+
+#ifdef WIN32
+ aCmd = "dir /B \"" + aStudyTmpDir +"\" > " + aTmpFile;
+#else
+ aCmd ="ls -1 \"" + aStudyTmpDir +"\" > " + aTmpFile;
+#endif
+ system(aCmd.c_str());
+
+ // Iterate and move files in the temporary directory
+ FILE* fp = fopen(aTmpFile.c_str(), "r");
+ if(!fp) return false;
+ char* buffer = new char[2047];
+ while(!feof(fp)) {
+ if((fgets(buffer, 2046, fp)) == NULL) break;
+ size_t aLen = strlen(buffer);
+ if(buffer[aLen-1] == '\n') buffer[aLen-1] = char(0);
+#ifdef WIN32
+ aCmd = "move /Y \"" + aStudyTmpDir + string(buffer) + "\" \"" + SALOMEDSImpl_Tool::GetDirFromPath(aStudyUrl) +"\"";
+#else
+ aCmd = "mv -f \"" + aStudyTmpDir + string(buffer) + "\" \"" + SALOMEDSImpl_Tool::GetDirFromPath(aStudyUrl)+"\"";
+#endif
+ system(aCmd.c_str());
+ }
+
+ delete []buffer;
+ fclose(fp);
+
+ // Perform cleanup
+#ifdef WIN32
+ DeleteFileA(aTmpFile.c_str());
+#else
+ unlink(aTmpFile.c_str());
+#endif
+
+#ifdef WIN32
+ RemoveDirectoryA(aTmpFileDir.c_str());
+ RemoveDirectoryA(aStudyTmpDir.c_str());
+#else
+ rmdir(aTmpFileDir.c_str());
+ rmdir(aStudyTmpDir.c_str());
+#endif
return true;
}
{
#ifdef WIN32
if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
- if ( GetLastError () != ERROR_FILE_NOT_FOUND ) {
+ if ( GetLastError () == ERROR_FILE_NOT_FOUND ) {
return false;
}
}
// purpose : Returns the dir by the path
//============================================================================
string SALOMEDSImpl_Tool::GetDirFromPath(const string& thePath) {
- if (thePath.empty()) return "";
+#ifdef WIN32
+ string separator = "\\";
+#else
+ string separator = "/";
+#endif
- int pos = thePath.rfind('/');
string path;
- if(pos > 0) {
- path = thePath.substr(0, pos+1);
- }
- if(path.empty()) {
- pos = thePath.rfind('\\');
- if(pos > 0) path = thePath.substr(0, pos+1);
- }
- if(path.empty()) {
- pos = thePath.rfind('|');
- if(pos > 0) path = thePath.substr(0, pos+1);
- }
- if(path.empty()) {
- path = thePath+"/";
- }
-
+ if (!thePath.empty()) {
+ int pos = thePath.rfind('/');
+ if (pos < 0) pos = thePath.rfind('\\');
+ if (pos < 0) pos = thePath.rfind('|');
+
+ if (pos > 0)
+ path = thePath.substr(0, pos+1);
+ else
+ path = string(".") + separator;
+
#ifdef WIN32 //Check if the only disk letter is given as path
- if(path.size() == 2 && path[1] == ':') path +='\\';
+ if (path.size() == 2 && path[1] == ':') path += separator;
#endif
-
- for(int i = 0, len = path.size(); i<len; i++)
- if(path[i] == '|') path[i] = '/';
+
+ while ( (pos=path.find('|')) >= 0 )
+ path.replace(pos, 1, separator);
+ }
+
return path;
}
-I$(srcdir)/$(RPATH)/LifeCycleCORBA \
-I$(srcdir)/$(RPATH)/DF \
-I$(srcdir)/$(RPATH)/SALOMEDSImpl \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@
libwith_loggerTraceCollector_la_CPPFLAGS =\
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
@CPPUNIT_INCLUDES@ \
-I$(srcdir)/$(RPATH)/Basics -I$(srcdir)/$(RPATH)/Basics/Test \
-I$(srcdir)/$(RPATH)/SALOMELocalTrace -I$(srcdir)/$(RPATH)/SALOMELocalTrace/Test\
- -I$(srcdir)/$(RPATH)/SALOMETraceCollector \
- -I$(top_builddir)/salome_adm/unix
+ -I$(srcdir)/$(RPATH)/SALOMETraceCollector
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
-I$(srcdir)/../Basics \
-I$(srcdir)/../Utils \
-I$(srcdir)/../SALOMELocalTrace \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \
@HDF5_INCLUDES@ \
-I$(srcdir)/../Notification \
-I$(srcdir)/../ResourcesManager \
-I$(srcdir)/../Container \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-I$(srcdir)/../ResourcesManager \
-I$(srcdir)/../Container \
-I$(srcdir)/../MPIContainer \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
UnitTests_CPPFLAGS =\
@CPPUNIT_INCLUDES@ \
-I$(srcdir)/../Basics -I$(srcdir)/../Basics/Test \
- -I$(srcdir)/../SALOMELocalTrace -I$(srcdir)/../SALOMELocalTrace/Test \
- -I$(top_builddir)/salome_adm/unix
+ -I$(srcdir)/../SALOMELocalTrace -I$(srcdir)/../SALOMELocalTrace/Test
if CORBA_GEN
UnitTests_CPPFLAGS +=\
libOpUtil_la_CPPFLAGS = \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
- -I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
-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 =\
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 () ;
} ;