SET(WITH_BATCH 1)
ENABLE_TESTING()
-SET(VERSION "6.5.0")
+SET(VERSION "7.0.0")
SET(VERSION_DEV "1")
INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
nameserver.py
NSparam.py
orbmodule.py
+ ORBConfigFile.py
runNS.py
runSalome.py
salomeConsole.py
salome_session.py
salome_utils.py
+ searchFreePort.py
server.py
setenv.py
showNS.py
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# -* Makefile *-
+# -* Makefile *-
# Author : Guillaume Boulant (CSSI)
# Module : KERNEL
# $Header$
nameserver.py \
NSparam.py \
orbmodule.py \
+ ORBConfigFile.py \
runNS.py \
runSalome.py \
salomeConsole.py \
salome_session.py \
- salome_utils.py \
+ salome_utils.py \
+ searchFreePort.py \
server.py \
setenv.py \
showNS.py \
install-data-hook:
@for f in $(dist_salomescript_PYTHON) ; do \
- chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \
- done
+ chmod -f a+x $(DESTDIR)$(salomescriptdir)/$$f ; \
+ done
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+# IMPORTANT NOTE: do not add any print call (cf. note at the bottom of the file)
+def writeORBConfigFile(path, host, port, kwargs={}):
+
+ from salome_utils import generateFileName
+ omniorb_config = generateFileName(path, prefix="omniORB",
+ extension="cfg",
+ hidden=True,
+ with_hostname=True,
+ with_port=port,
+ **kwargs)
+ import os
+ os.environ['OMNIORB_CONFIG'] = omniorb_config
+ os.environ['NSPORT'] = "%s"%(port)
+ os.environ['NSHOST'] = "%s"%(host)
+
+ from omniORB import CORBA
+ prefix = "" if CORBA.ORB_ID == "omniORB4" else "ORB"
+
+ GIOP_MaxMsgSize=2097152000 # 2 GBytes
+
+ orbdata = []
+ orbdata.append("%sInitRef = NameService=corbaname::%s:%s"%(prefix,host,port))
+ orbdata.append("%sgiopMaxMsgSize = %s # 2 GBytes"%(prefix,GIOP_MaxMsgSize))
+ orbdata.append("%straceLevel = 0 # critical errors only"%(prefix))
+ orbdata.append("")
+
+ f = open(omniorb_config, "w")
+ f.write("\n".join(orbdata))
+ f.close()
+
+ return [ omniorb_config, GIOP_MaxMsgSize ]
+
+# -----------------------------------------------------------------------------
+
+if __name__ == "__main__":
+ import sys, getopt
+
+ path = sys.argv[1]
+ host = sys.argv[2]
+ port = sys.argv[3]
+ argv = sys.argv[4:]
+
+ kwargs = {}
+ for a in argv:
+ alist = str(a).split("=", 1)
+ opt = str(alist[0])
+ arg = alist[1]
+ kwargs[opt] = arg
+ pass
+
+ [ filename, msgSize ] = writeORBConfigFile(path, host, port, kwargs)
+
+ # :TRICKY: print values so they can be read from caller bash script
+ # Example of bash script:
+ # RETURN_VALUES=$(python ORBConfigFile.py path host port)
+ # RETURN_VALUE_1=$(echo ${RETURN_VALUES} | cut -d' ' -f1)
+ # RETURN_VALUE_2=$(echo ${RETURN_VALUES} | cut -d' ' -f2)
+ # ...
+ # IMPORTANT NOTE: this print call MUST BE the first one!!
+ print filename, msgSize
. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
# --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME
+export NSHOST=$1
+export NSPORT=$2
-OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_$1_$2.cfg
-export OMNIORB_CONFIG
-NSHOST=$1
-export NSHOST
-NSPORT=$2
-export NSPORT
-initref="NameService=corbaname::"$1":$2"
-echo "InitRef = $initref" > $OMNIORB_CONFIG
+# Get (in bash) the configuration filename from (Python) ORBConfigFile return values
+RETURN_VALUES=$(${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/ORBConfigFile.py ${HOME}/${APPLI}/USERS ${NSHOST} ${NSPORT} with_username=${USER})
+export OMNIORB_CONFIG=$(echo ${RETURN_VALUES} | cut -d' ' -f1)
#go to the requested working directory if any
if test "x$3" == "xWORKINGDIR"; then
. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
+# --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME
+# Usage: writeConfigFile PORT HOST
+function writeConfigFile
+{
+ if [ $# -ne 2 ]; then
+ echo "Usage: $0 PORT HOST"
+ return
+ fi
+ export NSPORT=$1
+ export NSHOST=$2
+
+ # Get (in bash) the configuration filename from (Python) ORBConfigFile return values
+ RETURN_VALUES=$(${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/ORBConfigFile.py ${HOME}/${APPLI}/USERS ${NSHOST} ${NSPORT} with_username=${USER})
+ export OMNIORB_CONFIG=$(echo ${RETURN_VALUES} | cut -d' ' -f1)
+}
+
+
if test "x${NSPORT}" == "xlast"; then
#PORT is not given
if test "x${NSHOST}" == "xlocalhost"; then
# --- 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
+ export OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg
# --- 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
+ export NSHOST=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py host`
+ export NSPORT=`${KERNEL_ROOT_DIR}/bin/salome/NSparam.py port`
fi
else
#MACHINE is given PORT is not given
- NSPORT=2810
- 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
+ writeConfigFile 2810 ${NSHOST}
fi
else
#PORT is given
if test "x${NSHOST}" == "xlocalhost"; then
#MACHINE is not given PORT is given
- NSHOST=`hostname`
+ 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
+ writeConfigFile ${NSPORT} ${NSHOST}
fi
# --- invoke shell with or without args
if [ $# -ne 0 ] ; then
- ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py -exec $*
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py -exec $*
else
-
- ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc
fi
. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
-# --- define port for CORBA naming service
-
-searchFreePort() {
- echo -n "Searching for a free port for naming service: "
- export NSPORT=2810
- local limit=$NSPORT
- let limit=limit+100
- while [ 1 ]
- do
- aRes=`netstat -ltn | grep -E :${NSPORT}`
- if [ -z "$aRes" ]; then
- echo ${NSPORT} - Ok
- local myhost=`hostname`
- OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${myhost}_${NSPORT}.cfg
- export OMNIORB_CONFIG
- export NSPORT
- NSHOST=${myhost}
- export NSHOST
- local initref="NameService=corbaname::"`hostname`":$NSPORT"
- #echo "ORBInitRef $initref" > $OMNIORB_CONFIG
- echo "InitRef = $initref" > $OMNIORB_CONFIG
- LAST_RUNNING_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${myhost}_test.cfg
- export LAST_RUNNING_CONFIG
- rm ${LAST_RUNNING_CONFIG}
- ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG}
- break
- fi
- echo -n "${NSPORT} "
- if [[ $NSPORT -eq $limit ]] ; then
- echo
- echo "Can't find a free port to launch omniNames"
- echo "Try to kill the running servers and then launch SALOME again."
- exit
- fi
- let NSPORT=NSPORT+1
- done
-}
-
# --- if mpi lam, start lam (seems safe to be done several times)
# arret manuel avec lamhalt
# --- invoque shell with or without args
-searchFreePort
+searchFreePort save test
if [ $# -ne 0 ] ; then
${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -c "$*"
# --- define port for CORBA naming service
+DEFAULT=default
+
+# call: searchFreePort [ save [test] ]
searchFreePort() {
+ # if not specified by optional first parameter, savemode is set to default
+ savemode=${1:-$DEFAULT}
+ # if not specified by optional second parameter, testmode is set to default
+ testmode=${2:-$DEFAULT}
+
echo -n "Searching for a free port for naming service: "
- NSPORT=2810
- export NSPORT
+ export NSPORT=2810
local limit=$NSPORT
let limit=limit+100
+
while [ 1 ]
do
aRes=`netstat -ltn | grep -E :${NSPORT}`
if [ -z "$aRes" ]; then
echo ${NSPORT} - Ok
- local myhost=`hostname`
- OMNIORB_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${myhost}_${NSPORT}.cfg
- export OMNIORB_CONFIG
- export NSPORT
- NSHOST=${myhost}
- export NSHOST
- local initref="NameService=corbaname::"`hostname`":$NSPORT"
- #echo "ORBInitRef $initref" > $OMNIORB_CONFIG
- echo "InitRef = $initref" > $OMNIORB_CONFIG
- LAST_RUNNING_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg
- export LAST_RUNNING_CONFIG
- rm ${LAST_RUNNING_CONFIG}
- ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG}
+ export NSPORT
+ export NSHOST=`hostname`
+
+ RETURN_VALUES=$(${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/ORBConfigFile.py ${HOME}/${APPLI}/USERS ${NSHOST} ${NSPORT} with_username=${USER})
+ export OMNIORB_CONFIG=$(echo ${RETURN_VALUES} | cut -d' ' -f1)
+
+ if [ "$savemode" = save ]
+ then
+ if [ "$testmode" = test ]
+ then
+ export LAST_RUNNING_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_${NSHOST}_test.cfg
+ else
+ export LAST_RUNNING_CONFIG=${HOME}/${APPLI}/USERS/.omniORB_${USER}_last.cfg
+ fi
+
+ rm ${LAST_RUNNING_CONFIG}
+ ln -s ${OMNIORB_CONFIG} ${LAST_RUNNING_CONFIG}
+ fi
+
break
fi
echo -n "${NSPORT} "
let NSPORT=NSPORT+1
done
}
-
if __name__ == "__main__":
killAllPorts()
pass
-
os.remove(omniorb_config)
pass
- if os.path.lexists(last_running_config):return
+ if os.path.lexists(last_running_config):return
#try to relink last.cfg to an existing config file if any
files = glob.glob(os.path.join(os.environ["HOME"],Utils_Identity.getapplipath(),
########## kills all salome processes with the given port ##########
-def shutdownMyPort(port):
+def shutdownMyPort(port, cleanup=True):
"""
Shutdown SALOME session running on the specified port.
Parameters:
- port - port number
"""
if not port: return
-
+
from salome_utils import generateFileName
# set OMNIORB_CONFIG variable to the proper file
home = os.getenv("HOME")
appli = os.getenv("APPLI")
kwargs = {}
- if appli is not None:
+ if appli is not None:
home = os.path.join(os.path.realpath(home), appli,"USERS")
kwargs["with_username"]=True
pass
with_port=port,
**kwargs)
os.environ['OMNIORB_CONFIG'] = omniorb_config
+ os.environ['NSPORT'] = str(port)
# give the chance to the servers to shutdown properly
try:
import time
- import salome_kernel
- orb, lcc, naming_service, cm = salome_kernel.salome_kernel_init()
+ from omniORB import CORBA
+ from LifeCycleCORBA import LifeCycleCORBA
# shutdown all
+ orb = CORBA.ORB_init([''], CORBA.ORB_ID)
+ lcc = LifeCycleCORBA(orb)
lcc.shutdownServers()
# give some time to shutdown to complete
time.sleep(1)
# shutdown omniNames and notifd
- salome_kernel.LifeCycleCORBA.killOmniNames()
+ if cleanup:
+ lcc.killOmniNames()
+ time.sleep(1)
+ pass
+ pass
except:
pass
pass
-
+
def killMyPort(port):
"""
Kill SALOME session running on the specified port.
- port - port number
"""
from salome_utils import getShortHostName, getHostName
-
+
# try to shutdown session nomally
import threading, time
- threading.Thread(target=shutdownMyPort, args=(port,)).start()
+ threading.Thread(target=shutdownMyPort, args=(port,False)).start()
time.sleep(3) # wait a little, then kill processes (should be done if shutdown procedure hangs up)
-
+
# new-style dot-prefixed pidict file
filedict = getPiDict(port, hidden=True)
# provide compatibility with old-style pidict file (not dot-prefixed)
suffix="Pid_omniNames",
extension="log",
with_port=port)
- if not sys.platform == 'win32':
+ if not sys.platform == 'win32':
cmd = 'pid=`ps -eo pid,command | egrep "[0-9] omniNames -start %s"` ; echo $pid > %s' % ( str(port), fpidomniNames )
a = os.system(cmd)
pass
try:
if sys.platform == "win32":
import win32pm
- win32pm.killpid(int(pid),0)
+ win32pm.killpid(int(pid),0)
else:
os.kill(int(pid),signal.SIGKILL)
pass
#
appliCleanOmniOrbConfig(port)
pass
-
+
def killNotifdAndClean(port):
"""
Kill notifd daemon and clean application running on the specified port.
return
if __name__ == "__main__":
+ if len(sys.argv) < 2:
+ print "Usage: "
+ print " %s <port>" % os.path.basename(sys.argv[0])
+ print
+ print "Kills SALOME session running on specified <port>."
+ sys.exit(1)
+ pass
if sys.argv[1] == "--spy":
- pid = sys.argv[2]
- port = sys.argv[3]
- killMyPortSpy(pid, port)
+ if len(sys.argv) > 3:
+ pid = sys.argv[2]
+ port = sys.argv[3]
+ killMyPortSpy(pid, port)
+ pass
sys.exit(0)
pass
for port in sys.argv[1:]:
# get app version
v = version()
if not v: return None # unknown version
-
+
# get default user file name
filename = defaultUserFile(appname, cfgname)
if not filename: return None # default user file name is bad
-
+
# check that default user file exists
if os.path.exists(filename): return filename # user file is found
# ... calculate default version id
id0 = version_id(v)
if not id0: return None # bad version id -> can't detect appropriate file
-
+
# ... get all existing user preferences files
if sys.platform == "win32":
files = glob.glob(os.path.join(getHomeDir(), "%s.xml.*" % appname))
def startElement(self, name, attrs):
self.space.append(name)
self.current = None
-
+
# if we are importing file
if self.space == [doc_tag, import_tag] and nam_att in attrs.getNames():
self.importFile( attrs.getValue(nam_att) )
-
+
# if we are analyzing "section" element and its "name" attribute is
# either "launch" or module name -- set section_name
if self.space == [doc_tag, sec_tag] and nam_att in attrs.getNames():
def endDocument(self):
self.read = None
pass
-
+
def importFile(self, fname):
# get absolute name
if os.path.isabs (fname) :
absfname = fname
else:
absfname = os.path.join(os.path.dirname(self.fileName), fname)
-
+
# check existing and registry file
for ext in ["", ".xml", ".XML"] :
if os.path.exists(absfname + ext) :
else:
if verbose(): print "Configure parser: Error : file %s does not exist" % absfname
return
-
+
# importing file
try:
# copy current options
except:
if verbose(): print "Configure parser: Error : can not read configuration file %s" % absfname
pass
-
+
# -----------------------------------------------------------------------------
# Process --print-port option
if cmd_opts.print_port:
- from runSalome import searchFreePort
+ from searchFreePort import searchFreePort
searchFreePort({})
print "port:%s"%(os.environ['NSPORT'])
sys.exit(0)
except Exception, inst:
print str(currentPort) + ": " + str(inst.args);
currentPort = currentPort+step;
-
-
-
-
+
+
+
+
if (portFound != 1) :
currentPort = -1;
return currentPort;
if (len(sys.argv) > 1) and sys.argv[1] == "-nothing" :
print "port:" + str(freePort);
sys.exit(0)
-
-
-
if freePort < 0 :
print
print "Try to kill the running servers and then launch SALOME again."
print
sys.exit(0)
-
-else :
- omniCfgFileContent = "InitRef = NameService=corbaname::" + str(hostName) + ":" + str(freePort);
- omniCfgFilePath = os.environ.get('HOME') + "/" + ".omniORB_" + str(hostName) + "_" + str(freePort) + ".cfg";
- omni_file = file(omniCfgFilePath,'w+');
- omni_file.write(omniCfgFileContent);
- omni_file.write("\n");
- omni_file.close();
+else :
+ from ORBConfigFile import writeORBConfigFile
+ writeORBConfigFile(os.environ.get('HOME'), hostName, freePort)
if (len(sys.argv) > 1) and sys.argv[1] == "--save-config" :
omniCfgCurrent = os.environ.get('HOME') + "/.omniORB_current.cfg";
else :
#copy the file
shutil.copy(omniCfgFilePath, omniCfgCurrent);
-
+
omniCfgFilePath = omniCfgCurrent;
-
-
-
+
## 2. Set the OMNIORB_CONFIG environment variable
os.environ['OMNIORB_CONFIG']=omniCfgFilePath;
if os.path.isfile(runSalomePyFilePath) :
execfile(runSalomePyFilePath);
-
"""Client for SALOME"""
def __init__(self,args=None):
- #set GIOP message size for bug 10560: impossible to get field values in TUI mode
- sys.argv.extend(["-ORBgiopMaxMsgSize", "104857600"]) ## = 100 * 1024 * 1024
# Initialise the ORB
self.orb=CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
+
# Initialise the Naming Service
self.initNS(args or {})
except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
self.rootContext = None
if verbose(): print "Launch Naming Service++",
-
+
# On lance le Naming Server (doit etre dans le PATH)
test = True
if args['wake_up_session']:
count += 1
if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name
obj=self.Resolve(name)
- if obj :
+ if obj :
print " found in %s seconds " % ((count-1)*delta)
break
else:
sys.stdout.write('+')
sys.stdout.flush()
time.sleep(delta)
-
+
if typobj is None:return obj
nobj = obj._narrow(typobj)
raise RuntimeError, "Process %d for %s not found" % (thePID,theName)
aCount += 1
anObj = self.Resolve(theName)
- if anObj:
+ if anObj:
print " found in %s seconds " % ((aCount-1)*aDelta)
break
else:
time.sleep(aDelta)
pass
pass
-
+
if theTypObj is None:
return anObj
except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
obj = None
return obj
-
+
# --------------------------------------------------------------------------
def waitLogger(self,name,typobj=None,maxcount=40):
count += 1
if count > maxcount : raise RuntimeError, "Impossible de trouver %s" % name
obj=self.ResolveLogger(name)
- if obj :
+ if obj :
print " found in %s seconds " % ((count-1)*delta)
break
else:
sys.stdout.write('+')
sys.stdout.flush()
time.sleep(delta)
-
+
if typobj is None:return obj
nobj = obj._narrow(typobj)
if nobj is None:
print "%s exists but is not a %s" % (name,typobj)
return nobj
-
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-searchFreePort() {
- echo -n "Searching for a free port for naming service: "
- NSPORT=2810
- export NSPORT
- local limit=$NSPORT
- let limit=limit+100
- while [ 1 ]
- do
- aRes=`netstat -ltn | grep -E :${NSPORT}`
- if [ -z "$aRes" ]; then
- echo ${NSPORT} - Ok
- local myhost=`hostname`
- OMNIORB_CONFIG=${HOME}/.omniORB_${myhost}_${NSPORT}.cfg
- export OMNIORB_CONFIG
- local initref="NameService=corbaname::"`hostname`":$NSPORT"
- export NSPORT
- if [[ `python -c "import CORBA; print CORBA.ORB_ID"` = "omniORB4" ]]; then
- echo "InitRef = $initref" > $OMNIORB_CONFIG
- else
- echo "ORBInitRef $initref" > $OMNIORB_CONFIG
- fi
- break
- fi
- echo -n "${NSPORT} "
- if [[ $NSPORT -eq $limit ]] ; then
- echo
- echo "Can't find a free port to launch omniNames"
- echo "Try to kill the running servers and then launch SALOME again."
- exit
- fi
- let NSPORT=NSPORT+1
- done
-}
-
searchFreePort
if [[ "$*" = "-nothing" ]]; then
echo "port:$NSPORT"
elif [ $# -ne 0 ] ; then
- python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
+ python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
else
python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py
fi
# - parameters for launching are taken from SalomeApp.xml;
# - if the config file does not exist, it is created with default values.
#
-#
+#
# $: ${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
# par defaut, les differents serveurs ouvrent des fenêtres xterm
# (cf. runSalome.py)
# le serveur Logger n'est pas obligatoire (commenté dans runSalome.py)
-#
+#
# -----------------------------------------------------------------------------
# Example on CCRT (without ihm) :
# ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py --terminal --modules=MED,CALCULATOR,COMPONENT --standalone=registry,study,moduleCatalog,cppContainer,pyContainer --killall
kill servers from a previous SALOME exection, if needed,
on the CORBA port given in args of runSalome
"""
-
+
from killSalomeWithPort import killMyPort
my_port=str(args['port'])
try:
print "problem in killLocalPort()"
pass
pass
-
+
def givenPortKill(port):
"""
kill servers from a previous SALOME exection, if needed,
on the same CORBA port
"""
-
+
from killSalomeWithPort import killMyPort
my_port=port
try:
self.CMD=['xterm', '-e']+ env_ld_library_path + ['python']
else:
self.CMD=['cmd', '/c', 'start cmd.exe', '/K', 'python']
-
+
def run(self):
global process_id
command = self.CMD
self.SCMD2=[]
home_dir=os.getenv('HOME')
if home_dir is not None:
- self.SCMD2=['-personal',os.path.join(home_dir,'Salome/resources/CatalogModulePersonnel.xml')]
+ self.SCMD2=['-personal',os.path.join(home_dir,'Salome/resources/CatalogModulePersonnel.xml')]
def setpath(self,modules_list,modules_root_dir):
list_modules = modules_list[:]
self.SCMD1+=['--with','ModuleCatalog','(','-common']
home_dir=os.getenv('HOME')
if home_dir is not None:
- self.SCMD2+=['-personal',os.path.join(home_dir,'Salome/resources/CatalogModulePersonnel.xml')]
+ self.SCMD2+=['-personal',os.path.join(home_dir,'Salome/resources/CatalogModulePersonnel.xml')]
self.SCMD2+=[')']
if 'study' in self.args['embedded']:
self.SCMD2+=['--with','SALOMEDS','(',')']
self.SCMD2+=['--with','Container','(','FactoryServer',')']
if 'SalomeAppEngine' in self.args['embedded']:
self.SCMD2+=['--with','SalomeAppEngine','(',')']
-
+
if 'cppContainer' in self.args['standalone'] or 'cppContainer' in self.args['embedded']:
self.SCMD2+=['CPP']
if 'pyContainer' in self.args['standalone'] or 'pyContainer' in self.args['embedded']:
self.SCMD2+=['--study-hdf=%s'%self.args['study_hdf']]
pass
pass
+ if self.args.has_key('pyscript') and len(self.args['pyscript']) > 0:
+ self.SCMD2+=['--pyscript=%s'%(",".join(self.args['pyscript']))]
+ pass
+ pass
pass
if self.args['noexcepthandler']:
self.SCMD2+=['noexcepthandler']
list_modules.insert(0,m)
list_modules.reverse()
self.SCMD2+=['--modules (%s)' % ":".join(list_modules)]
-
- if self.args.has_key('pyscript') and len(self.args['pyscript']) > 0:
- self.SCMD2+=['--pyscript=%s'%(",".join(self.args['pyscript']))]
+ pass
+ pass
def setpath(self,modules_list,modules_root_dir):
list_modules = modules_list[:]
self.CMD = ["xterm", "-e", "gdb", "--command=.gdbinit4salome", self.CMD[0]]
pass
pass
-
+
if self.args["valgrind_session"]:
l = ["valgrind"]
val = os.getenv("VALGRIND_OPTIONS")
pass
self.CMD = l + self.CMD
pass
-
+
# ---
class LauncherServer(Server):
import SALOME_Session_idl
session=clt.waitNS("/Kernel/Session",SALOME.Session)
session.GetInterface()
-
+
# -----------------------------------------------------------------------------
def startSalome(args, modules_list, modules_root_dir):
init_time = os.times()
if verbose(): print "startSalome ", args
-
+
#
# Set server launch command
#
if args.has_key('server_launch_mode'):
Server.set_server_launch_mode(args['server_launch_mode'])
-
+
#
# Wake up session option
#
home = os.getenv("HOME")
appli = os.getenv("APPLI")
kwargs={}
- if appli is not None:
+ if appli is not None:
home = os.path.join(os.path.realpath(home), appli,"USERS")
kwargs["with_username"] = True
pass
os.environ['OMNIORB_CONFIG'] = last_running_config
pass
pass
-
+
#
# Initialisation ORB and Naming Service
#
-
+
clt=orbmodule.client(args)
#
session.GetInterface()
args["session_object"] = session
return clt
-
+
# Save Naming service port name into
# the file args["ns_port_log_file"]
if args.has_key('ns_port_log_file'):
if sys.platform != "win32":
if verbose(): print "Notify Server to launch"
-
+
myServer=NotifyServer(args,modules_root_dir)
myServer.run()
#
# Launch LauncherServer
#
-
+
myCmServer = LauncherServer(args)
myCmServer.setpath(modules_list,modules_root_dir)
myCmServer.run()
from Utils_Identity import getShortHostName
-
+
if os.getenv("HOSTNAME") == None:
if os.getenv("HOST") == None:
os.environ["HOSTNAME"]=getShortHostName()
os.environ["HOSTNAME"]=os.getenv("HOST")
theComputer = getShortHostName()
-
+
#
# Launch local C++ Container (FactoryServer),
# and wait until it is registered in naming service
#
- if ('cppContainer' in args['standalone']) | (args["gui"] == 0) :
+ if ('cppContainer' in args['standalone']) | (args["gui"] == 0) :
myServer=ContainerCPPServer(args)
myServer.run()
if sys.platform == "win32":
#
# Wait until Session Server is registered in naming service
#
-
+
if args["gui"]:
-##----------------
+##----------------
import Engines
import SALOME
import SALOMEDS
# additionnal external python interpreters
#
nbaddi=0
-
+
try:
if 'interp' in args:
nbaddi = args['interp']
print "-------------------------------------------------------------"
print "-- to get an external python interpreter:runSalome --interp=1"
print "-------------------------------------------------------------"
-
+
if verbose(): print "additional external python interpreters: ", nbaddi
if nbaddi:
for i in range(nbaddi):
import readline
except ImportError:
pass
-
+
return clt
# -----------------------------------------------------------------------------
show registered objects in Naming Service.
"""
global process_id
-
+
clt=None
try:
clt = startSalome(args, modules_list, modules_root_dir)
print
print
print "--- Error during Salome launch ---"
-
+
#print process_id
from addToKillList import addToKillList
if verbose(): print """
Saving of the dictionary of Salome processes in %s
To kill SALOME processes from a console (kill all sessions from all ports):
- python killSalome.py
+ python killSalome.py
To kill SALOME from the present interpreter, if it is not closed :
killLocalPort() --> kill this session
(use CORBA port from args of runSalome)
- givenPortKill(port) --> kill a specific session with given CORBA port
+ givenPortKill(port) --> kill a specific session with given CORBA port
killAllPorts() --> kill all sessions
-
+
runSalome, with --killall option, starts with killing
the processes resulting from the previous execution.
"""%filedict
-
+
#
# Print Naming Service directory list
#
-
+
if clt != None:
if verbose():
print
print " --- registered objects tree in Naming Service ---"
clt.showNS()
pass
-
+
if not args['gui'] or not args['session_gui']:
if args['shutdown_servers']:
class __utils__(object):
args['shutdown_servers'] = __utils__(args['port'])
pass
pass
-
+
# run python scripts, passed via --execute option
toimport = []
if args.has_key('pyscript'):
pass
pass
return clt
-
+
def execScript(script_path):
print 'executing', script_path
sys.path.insert(0, os.path.dirname(script_path))
# -----------------------------------------------------------------------------
-def searchFreePort(args, save_config=1):
- print "Searching for a free port for naming service:",
- #
- if sys.platform == "win32":
- tmp_file = os.getenv('TEMP');
- else:
- tmp_file = '/tmp'
- tmp_file = os.path.join(tmp_file, '.netstat_%s'%os.getpid())
- #
- ###status = os.system("netstat -ltn | grep -E :%s > /dev/null 2>&1"%(NSPORT))
- os.system( "netstat -a -n > %s" % tmp_file );
- f = open( tmp_file, 'r' );
- ports = f.readlines();
- f.close();
- os.remove( tmp_file );
- #
- def portIsUsed(port, data):
- regObj = re.compile( ".*tcp.*:([0-9]+).*:.*listen", re.IGNORECASE );
- for item in data:
- try:
- p = int(regObj.match(item).group(1))
- if p == port: return True
- pass
- except:
- pass
- pass
- return False
- #
- NSPORT=2810
- limit=NSPORT+100
- #
- while 1:
- if not portIsUsed(NSPORT, ports):
- print "%s - OK"%(NSPORT)
- #
- from salome_utils import generateFileName, getHostName
- hostname = getHostName()
- #
- home = os.getenv("HOME")
- appli = os.getenv("APPLI")
- kwargs={}
- if appli is not None:
- home = os.path.join(os.path.realpath(home), appli,"USERS")
- kwargs["with_username"]=True
- #
- omniorb_config = generateFileName(home, prefix="omniORB",
- extension="cfg",
- hidden=True,
- with_hostname=True,
- with_port=NSPORT,
- **kwargs)
- orbdata = []
- initref = "NameService=corbaname::%s:%s"%(hostname, NSPORT)
- from omniORB import CORBA
- if CORBA.ORB_ID == "omniORB4":
- orbdata.append("InitRef = %s"%(initref))
- orbdata.append("giopMaxMsgSize = 2097152000 # 2 GBytes")
- orbdata.append("traceLevel = 0 # critical errors only")
- else:
- orbdata.append("ORBInitRef %s"%(initref))
- orbdata.append("ORBgiopMaxMsgSize = 2097152000 # 2 GBytes")
- orbdata.append("ORBtraceLevel = 0 # critical errors only")
- pass
- orbdata.append("")
- f = open(omniorb_config, "w")
- f.write("\n".join(orbdata))
- f.close()
- #
- os.environ['OMNIORB_CONFIG'] = omniorb_config
- os.environ['NSPORT'] = "%s"%(NSPORT)
- os.environ['NSHOST'] = "%s"%(hostname)
- args['port'] = os.environ['NSPORT']
- #
- if save_config:
- last_running_config = generateFileName(home, prefix="omniORB",
- suffix="last",
- extension="cfg",
- hidden=True,
- **kwargs)
- try:
- if sys.platform == "win32":
- import shutil
- shutil.copyfile(omniorb_config, last_running_config)
- else:
- try:
- os.remove(last_running_config)
- except OSError:
- pass
- os.symlink(omniorb_config, last_running_config)
- pass
- pass
- except:
- pass
- break
- print "%s"%(NSPORT),
- if NSPORT == limit:
- 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 RuntimeError, msg
- NSPORT=NSPORT+1
- pass
- return
-
-# -----------------------------------------------------------------------------
-
def no_main():
"""Salome Launch, when embedded in other application"""
fileEnv = os.environ["SALOME_LAUNCH_CONFIG"]
args, modules_list, modules_root_dir = pickle.load(fenv)
fenv.close()
kill_salome(args)
+ from searchFreePort import searchFreePort
searchFreePort(args, 0)
clt = useSalome(args, modules_list, modules_root_dir)
return clt
from salome_utils import getHostName
print "runSalome running on %s" % getHostName()
args, modules_list, modules_root_dir = setenv.get_config()
+
kill_salome(args)
save_config = True
if args.has_key('save_config'):
test = False
pass
if test:
+ from searchFreePort import searchFreePort
searchFreePort(args, save_config)
pass
# --
server.CMD = [os.getenv("PYTHONBIN"), "-m", "killSalomeWithPort", "--spy", "%s"%(os.getpid()), "%s"%(port)]
else:
server.CMD = ["killSalomeWithPort.py", "--spy", "%s"%(os.getpid()), "%s"%(port)]
- server.run()
+ server.run()
# os.system("killSalomeWithPort.py --spy %s %s &"%(os.getpid(), port))
# --
dt = 1.0
if rep == "y":
filename=f
break
-
+
if filename != "":
os.environ['OMNIORB_CONFIG']=filename
else:
rep= raw_input("Do you want to try a local session on port 2810 ? [y|n]")
if rep == "y":
# Try a local session running on port 2810
- sys.argv=sys.argv+['-ORBInitRef','NameService=corbaname::localhost:2810']
+ sys.argv=sys.argv+['-ORBInitRef','NameService=corbaname::localhost:2810']#+['-ORBgiopMaxMsgSize','2097152000'] # 2 GBytes
else:
sys.exit(1)
def startSession(modules=[]):
global _session
if _session: return
+ from searchFreePort import searchFreePort
searchFreePort()
_session = SalomeSession(modules)
return
from salome_utils import getShortHostName
return getShortHostName()
-def searchFreePort():
- """
- Search free port for SALOME session.
- Returns first found free port number.
- """
- print "Searching a free port for naming service:",
- from salome_utils import generateFileName, getHostName
- hostname = getHostName()
- NSPORT = 2810
- limit = NSPORT+100
- while 1:
- print "%s "%(NSPORT),
- status = os.system("netstat -ltn | grep -E :%s"%(NSPORT))
- if status:
- home = os.getenv("HOME")
- appli = os.getenv("APPLI")
- kwargs={}
- if appli is not None:
- home = os.path.join(os.path.realpath(home), appli,"USERS")
- kwargs["with_username"]=True
- omniorb_config = generateFileName(home, prefix="omniORB",
- extension="cfg",
- hidden=True,
- with_hostname=True,
- with_port=NSPORT,
- **kwargs)
- f = open(omniorb_config, "w")
- f.write("ORBInitRef NameService=corbaname::%s:%s\n"%(hostname, NSPORT))
- f.close()
- os.environ['OMNIORB_CONFIG'] = omniorb_config
- last_running_config = generateFileName(home, prefix="omniORB",
- suffix="last",
- extension="cfg",
- hidden=True,
- **kwargs)
- os.environ['LAST_RUNNING_CONFIG'] = last_running_config
- if os.access(last_running_config,os.F_OK):
- os.unlink(last_running_config)
- pass
- os.symlink(omniorb_config,last_running_config)
- print "- Ok"
- break
- if NSPORT == limit:
- msg = ""
- msg += "Can not find a free port to launch omniNames\n"
- msg += "Kill the running servers and try again.\n"
- raise RuntimeError, msg
- NSPORT = NSPORT+1
- pass
- os.environ['NSHOST'] = hostname
- os.environ['NSPORT'] = str(NSPORT)
- return NSPORT
-
class SalomeSession(object):
"""Salome session launcher"""
return int( os.getenv( "NSPORT" ) )
except:
pass
- port = getPortFromORBcfg()
- if port is not None: return port
+ try:
+ port = int( getPortFromORBcfg() )
+ if port is not None: return port
+ except:
+ pass
if use_default: return 2809 # '2809' is default port number
return None
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+def searchFreePort(args={}, save_config=1):
+ """
+ Search free port for SALOME session.
+ Returns first found free port number.
+ """
+ import sys, os, re, shutil
+ print "Searching for a free port for naming service:",
+
+ # :NOTE: Under windows:
+ # netstat options -l and -t are unavailable
+ # grep command is unavailable
+
+ from subprocess import Popen, PIPE
+ (stdout, stderr) = Popen(['netstat','-an'], stdout=PIPE).communicate()
+ import StringIO
+ buf = StringIO.StringIO(stdout)
+ ports = buf.readlines()
+
+ #
+ def portIsUsed(port, data):
+ regObj = re.compile( ".*tcp.*:([0-9]+).*:.*listen", re.IGNORECASE );
+ for item in data:
+ try:
+ p = int(regObj.match(item).group(1))
+ if p == port: return True
+ pass
+ except:
+ pass
+ pass
+ return False
+ #
+ NSPORT=2810
+ limit=NSPORT+100
+ #
+
+ while 1:
+ if not portIsUsed(NSPORT, ports):
+ print "%s - OK"%(NSPORT)
+ #
+ from salome_utils import generateFileName, getHostName
+ hostname = getHostName()
+ #
+ home = os.getenv("HOME")
+ appli = os.getenv("APPLI")
+ kwargs={}
+ if appli is not None:
+ home = os.path.join(os.path.realpath(home), appli,"USERS")
+ kwargs["with_username"]=True
+ #
+ from ORBConfigFile import writeORBConfigFile
+ omniorb_config, giopsize = writeORBConfigFile(home, hostname, NSPORT, kwargs)
+
+ args['port'] = os.environ['NSPORT']
+ #
+ if save_config:
+ last_running_config = generateFileName(home, prefix="omniORB",
+ suffix="last",
+ extension="cfg",
+ hidden=True,
+ **kwargs)
+ os.environ['LAST_RUNNING_CONFIG'] = last_running_config
+ try:
+ if sys.platform == "win32":
+ import shutil
+ shutil.copyfile(omniorb_config, last_running_config)
+ else:
+ try:
+ if os.access(last_running_config, os.F_OK):
+ os.remove(last_running_config)
+ except OSError:
+ pass
+ os.symlink(omniorb_config, last_running_config)
+ pass
+ pass
+ except:
+ pass
+ #
+ break
+ print "%s"%(NSPORT),
+ if NSPORT == limit:
+ 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 RuntimeError, msg
+ NSPORT=NSPORT+1
+ pass
+ return
for module in modules_list :
if modules_root_dir.has_key(module):
module_root_dir = modules_root_dir[module]
- modules_root_dir_list[:0] = [module_root_dir]
+ if module_root_dir not in modules_root_dir_list:
+ modules_root_dir_list[:0] = [module_root_dir]
if sys.platform == "win32":
add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir),
"PATH")
#
import time
-import salome_kernel
-orb, lcc, naming_service, cm = salome_kernel.salome_kernel_init()
+from omniORB import CORBA
+from LifeCycleCORBA import *
+
+orb = CORBA.ORB_init([''], CORBA.ORB_ID)
+lcc = LifeCycleCORBA(orb)
lcc.shutdownServers()
-#give some time to shutdown to complete
time.sleep(1)
-salome_kernel.LifeCycleCORBA.killOmniNames()
+LifeCycleCORBA.killOmniNames()
+time.sleep(1)
--- /dev/null
+# Copyright (C) 2012 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(SPHINXOPTS
+)
+SET(SOURCEDIR
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+SET(PAPEROPT_a4
+ -D
+ latex_paper_size=a4
+)
+SET(ALLSPHINXOPTS
+ -d
+ doctrees
+ ${PAPEROPT_a4}
+ ${SPHINXOPTS}
+ ${SOURCEDIR}
+)
+
+SALOME_CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" "${CMAKE_CURRENT_BINARY_DIR}/conf.py")
+
+IF(WINDOWS)
+ STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\lib\\python2.6\\site-packages\\salome\;%PYTHONPATH%
+ @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}\\bin\\salome\;%PYTHONPATH%
+ @SET PATH=${CMAKE_INSTALL_PREFIX}\\lib\\salome\;%PATH%
+ @SET PYTHONPATH=${OMNIORB_ROOT_USER}\\lib\\x86_win32\;%PYTHONPATH%
+ @SET PYTHONPATH=${OMNIORB_ROOT_USER}\\lib\\python\;%PYTHONPATH%
+ @SET PATH=${OMNIORB_ROOT_USER}\\lib\\x86_win32\;%PATH%
+ ")
+ SET(EXT "bat")
+ SET(CALL_STR "call")
+ELSE(WINDOWS)
+ SET(SCR "export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/python2.6/site-packages/salome:\${PYTHONPATH}
+ export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome:\${PYTHONPATH}
+ export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib/salome:\${LD_LIBRARY_PATH}
+ export PYTHONPATH=${OMNIORB_ROOT_USER}/lib:\${PYTHONPATH}
+ export PYTHONPATH=${OMNIORB_ROOT_USER}/lib/python2.6/site-packages:\${PYTHONPATH}
+ export LD_LIBRARY_PATH=${OMNIORB_ROOT_USER}/lib:\${LD_LIBRARY_PATH}
+ ")
+ SET(EXT "sh")
+ SET(CALL_STR ".")
+ENDIF(WINDOWS)
+
+FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} "${SCR}")
+
+ADD_CUSTOM_TARGET(html_docs ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/env_s.${EXT} && ${SPHINX_EXECUTABLE} -c ${CMAKE_BINARY_DIR}/doc/docutils -b html ${ALLSPHINXOPTS} html
+ COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/KERNEL/docutils''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/KERNEL/docutils''')\"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+)
SET(docdir ${datadir}/doc/salome)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doxyfile)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/static/header.html.in ${CMAKE_CURRENT_SOURCE_DIR}/static/header.html)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html)
ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE}
COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/KERNEL''', True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}/KERNEL''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/KERNEL'''); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/head.png''', r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/KERNEL''')"
VERBATIM
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
-
+ADD_DEPENDENCIES(usr_docs html_docs)
# ...
\endcode
+\anchor salome_myStudy
\li \b myStudy Reference to the current (active) study
This variable can be used to manipulate with the date of the study:
name_1 = salome.generateName("Obj") # name_1 is something like "Obj32"
\endcode
+\li \b GetComponentVersion() Get version of component data stored in
+the study
+
+This function allows to obtain the version of the component data
+stored in the current study.
+\note This function does not provide a current version of the
+component being used but that one initially stored in the study
+document.
+
+The first parameter specifies the name of the component. If the
+specified component data is not stored in the study, the result value
+is "no component data". If the version of data is undefined, the
+result is "unknown".
+
+The second parameter (\c False by default), when set to \c True,
+allows to retrieve all versions of the component data stored in the
+study. This is useful to check if version information is valid (the
+data might be updated and/or re-stored in %SALOME of versions different
+from initial one).
+
+\code
+# get initial version of GEOM module data stored in the study
+geom_version = salome.GetComponentVersion('GEOM')
+# get all versions of GEOM module data stored in the study
+all_geom_versions = salome.GetComponentVersion('GEOM', True)
+\endcode
+
+This function is introduced in %SALOME 6.6.0 (it does not work with
+studies created before version 6.6.0).
+
+\note The study should be initialized before calling this function
+(see \ref salome_myStudy "salome.myStudy").
+
*/
SET(docdir ${datadir}/doc/salome)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doxyfile)
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/static/header.html.in ${CMAKE_CURRENT_SOURCE_DIR}/static/header.html)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/static/header.html.in ${CMAKE_CURRENT_BINARY_DIR}/static/header.html)
ADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE} -u
COMMAND ${DOXYGEN_EXECUTABLE}
-# Doxyfile 1.4.6
+# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "SALOME KERNEL Developer"
-PROJECT_NUMBER =
+PROJECT_NUMBER =
OUTPUT_DIRECTORY = KERNEL
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = NO
-ABBREVIATE_BRIEF =
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF =
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = YES
-STRIP_FROM_PATH = @top_builddir@ @top_srcdir@
-STRIP_FROM_INC_PATH =
+STRIP_FROM_PATH = @top_srcdir@ @top_builddir@
+STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
+QT_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 5
-ALIASES =
+ALIASES =
OPTIMIZE_OUTPUT_FOR_C = YES
-OPTIMIZE_OUTPUT_JAVA = NO
+OPTIMIZE_OUTPUT_JAVA = YES
BUILTIN_STL_SUPPORT = @DOXYGEN_SUPPORT_STL@
DISTRIBUTE_GROUP_DOC = NO
SUBGROUPING = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
-SORT_MEMBER_DOCS = NO
+SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = YES
-GENERATE_TODOLIST = NO
-GENERATE_TESTLIST = NO
-GENERATE_BUGLIST = NO
-GENERATE_DEPRECATEDLIST= NO
-ENABLED_SECTIONS =
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 25
SHOW_USED_FILES = NO
SHOW_DIRECTORIES = NO
-FILE_VERSION_FILTER =
+FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
-INPUT = \
- @top_srcdir@/src/DSC \
- @srcdir@/input
-FILE_PATTERNS = *.dox *.idl *.cxx *.hxx *.h *.hh *.i *c *.cc @DOXYGEN_PYTHON_EXTENSION@
+INPUT = @top_srcdir@/src \
+ @top_srcdir@/bin \
+ @top_srcdir@/idl \
+ @top_builddir@/bin \
+ @srcdir@/input
+FILE_PATTERNS = *.idl *.hxx *.cxx *.h *.c *.hh *.cc @DOXYGEN_PYTHON_EXTENSION@ *.doc
RECURSIVE = YES
-EXCLUDE =
+EXCLUDE =
EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH =
-EXAMPLE_PATTERNS =
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_PATTERNS =
-FILTER_SOURCE_FILES = NO
+IMAGE_PATH = @srcdir@/images
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
+SOURCE_BROWSER = YES
+INLINE_SOURCES = YES
STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = NO
+REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
-USE_HTAGS = NO
+#USE_HTAGS = NO
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
-COLS_IN_ALPHA_INDEX = 3
-IGNORE_PREFIX =
+COLS_IN_ALPHA_INDEX = 2
+IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
HTML_STYLESHEET = @srcdir@/static/doxygen.css
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
-CHM_FILE =
-HHC_LOCATION =
+CHM_FILE =
+HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = YES
TOC_EXPAND = YES
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
-EXTRA_PACKAGES =
-LATEX_HEADER =
+EXTRA_PACKAGES =
+LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
+XML_SCHEMA =
+XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
+PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
+# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED =
-EXPAND_AS_DEFINED =
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = NO
#---------------------------------------------------------------------------
-# Configuration::additions related to external references
+# Configuration::additions related to external references
#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE =
+TAGFILES =
+GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
+# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-GROUP_GRAPHS = NO
-UML_LOOK = YES
+COLLABORATION_GRAPH = NO
+GROUP_GRAPHS = YES
+UML_LOOK = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = NO
+INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
DOT_FONTNAME = Arial
-DOT_PATH =
-DOTFILE_DIRS =
+DOT_PATH =
+DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1200
+MAX_DOT_GRAPH_HEIGHT = 1000
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = NO
DOT_MULTI_TARGETS = NO
-GENERATE_LEGEND = NO
+GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
+# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
\return units
*/
string GetUnits();
+
+ /*!
+ \brief Returns list of components which data was stored
+ (after previous sessions) in the study.
+ \return list of component names
+ */
+ StringSeq GetStoredComponents();
+
+ /*!
+ \brief Returns version of component data stored in the study
+ \param comp component name
+ \return version of stored component data
+ */
+ string GetComponentVersion( in string comp );
+
+ /*!
+ \brief Returns all versions of component data stored in the study
+ \param comp component name
+ \return versions of stored component data
+ */
+ StringSeq GetComponentVersions( in string comp );
};
//==========================================================================
\return an information about the given object.
*/
string getObjectInfo(in long studyId, in string entry);
+
+ //! Get version of the component
+ /*!
+ This method is supposed to be implemented in all derived classes; default implementation
+ returns "unknown" string that means that no version information about the component is available.
+ \note The version of the component is stored to the study, as a part of general persistence
+ mechanism; once stored, version information in the study cannot be changed.
+
+ \return string containing component's version, e.g. "1.0"
+ */
+ string getVersion();
} ;
/*!
ADD_SUBDIRECTORY(unix)
ADD_SUBDIRECTORY(cmake_files)
-SET(input ${CMAKE_CURRENT_SOURCE_DIR}/SALOMEconfig.ref.in)
-SET(output ${CMAKE_CURRENT_BINARY_DIR}/SALOMEconfig.h)
-
-MESSAGE(STATUS "Creation of ${output}")
-CONFIGURE_FILE(${input} ${output})
-INSTALL(FILES ${output} DESTINATION ${KERNEL_salomeinclude_HEADERS})
\ No newline at end of file
+SALOME_CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/SALOMEconfig.ref.in" "${CMAKE_CURRENT_BINARY_DIR}/SALOMEconfig.h" INSTALL ${KERNEL_salomeinclude_HEADERS})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/SALOMEconfig.ref.in DESTINATION salome_adm/unix RENAME SALOMEconfig.h.in)
\ No newline at end of file
SET(PLATFORM_LIBS ${PLATFORM_LIBS} Ws2_32.lib)
SET(PLATFORM_LIBS ${PLATFORM_LIBS} Userenv.lib) # At least for GEOM suit
+ IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") # if platform is Windows 64 bit
+ SET(PLATFORM_CPPFLAGS "${PLATFORM_CPPFLAGS} -D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0 -D_HAS_ITERATOR_DEBUGGING=0") # To avoid runtime error during checking iterators # to be removed
+ SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0 -D_HAS_ITERATOR_DEBUGGING=0") # To avoid runtime error during checking iterators
+ ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
ELSE(WINDOWS)
# SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wparentheses)
# SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wreturn-type)
SET(PLATFORM_LIBS ${PLATFORM_LIBS} -ldl)
ENDIF(WINDOWS)
-SET(PLATFORM_CPPFLAGS "${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${CMAKE_SIZEOF_VOID_P} -DSIZEOF_INT=4") # to be removed
-SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${CMAKE_SIZEOF_VOID_P} -DSIZEOF_INT=4")
+SET(SIZE_OF_LONG ${CMAKE_SIZEOF_VOID_P}) # set sizeof(long) the same as size of pointers, because on all memory models (EXCLUDING WINDOWS 64 bit) it is equivalent values
+IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8" AND WINDOWS) # if it platform Windows 64 bit
+ SET(SIZE_OF_LONG "4") # set sizeof(long) to 4 byte
+ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8" AND WINDOWS)
+
+SET(PLATFORM_CPPFLAGS "${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${SIZE_OF_LONG} -DSIZEOF_INT=4") # to be removed
+SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${SIZE_OF_LONG} -DSIZEOF_INT=4")
SET(COMPILATION_WITH_CMAKE ON)
#----------------------------------------------------------------------------
# SALOME_INSTALL_SCRIPTS is a macro useful for installing scripts.
#
-# USAGE: SALOME_INSTALL_SCRIPTS(file_list path [DEF_PERMS])
+# USAGE: SALOME_INSTALL_SCRIPTS(file_list path [WORKING_DIRECTORY dir] [DEF_PERMS])
#
# ARGUMENTS:
# file_list: IN : list of files to be installed. This list should be quoted.
# only OWNER_WRITE, OWNER_READ, GROUP_READ, and WORLD_READ.
#----------------------------------------------------------------------------
MACRO(SALOME_INSTALL_SCRIPTS file_list path)
- PARSE_ARGUMENTS(SALOME_INSTALL_SCRIPTS "" "DEF_PERMS" ${ARGN})
- SET(PERMS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+ PARSE_ARGUMENTS(SALOME_INSTALL_SCRIPTS "WORKING_DIRECTORY" "DEF_PERMS" ${ARGN})
+ SET(PERMS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
IF(NOT SALOME_INSTALL_SCRIPTS_DEF_PERMS)
SET(PERMS ${PERMS} OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
ENDIF(NOT SALOME_INSTALL_SCRIPTS_DEF_PERMS)
FOREACH(file ${file_list})
- INSTALL(FILES ${file} DESTINATION ${path} PERMISSIONS ${PERMS})
+ SET(PREFIX "")
+ IF(SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY)
+ SET(PREFIX "${SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY}/")
+ ENDIF(SALOME_INSTALL_SCRIPTS_WORKING_DIRECTORY)
+ INSTALL(FILES ${PREFIX}${file} DESTINATION ${path} PERMISSIONS ${PERMS})
GET_FILENAME_COMPONENT(ext ${file} EXT)
IF(ext STREQUAL .py)
INSTALL(CODE "MESSAGE(STATUS \"py compiling ${CMAKE_INSTALL_PREFIX}/${path}/${file}\")")
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)
- INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindBLSURF.cmake)
+ INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindCADSURF.cmake)
""")
pass
if self.module in ["ghs3dplugin", "hexoticplugin"]:
INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
""")
pass
+ if self.module == "jobmanager":
+ newlines.append("""
+ INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
+ """)
+ pass
if self.module == "hxx2salome":
newlines.append("""
SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
pass
# --
newlines.append("""
- set(VERSION 6.5.0)
- set(SHORT_VERSION 6.5)
- set(XVERSION 0x060500)
+ set(VERSION 7.0.0)
+ set(SHORT_VERSION 7.0)
+ set(XVERSION 0x070000)
+ set(VERSION_DEV 1)
""")
pass
# --
)
''')
self.files.append("static/header.html.in")
- elif self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc') or mod in ['kernel', 'gui', 'geom', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui':
+ elif self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc') or mod in ['kernel', 'gui', 'geom', 'med', 'smesh', 'visu', 'blsurfplugin'] and self.root[-len('tui'):] == 'tui' or operator.contains(self.root, 'doc') and mod in ['pyhello']:
newlines.append(r'''
SET(top_builddir
${CMAKE_BINARY_DIR}
${datadir}/doc/salome
)
''')
- self.files.append("static/header.html.in")
+ if mod not in ['blsurfplugin']:
+ self.files.append("static/header.html.in")
if mod in ['geom', 'smesh', 'visu','netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin',"ghs3dprlplugin"] and self.root[-len(mod):] == upmod:
self.files.append("static/header_py.html.in")
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)"""%(input, doc_gui_destination, doc_source, doc_gui_destination, head_source, doc_gui_destination))
from os import path
- if mod in ['geom', 'smesh', 'visu', 'netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin','ghs3dprlplugin'] and self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc'):
+ if mod in ['geom', 'smesh', 'visu', 'netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin','ghs3dprlplugin','pyhello'] and self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc') or mod in ['pyhello'] and operator.contains(self.root, 'doc'):
ign = r"""'*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*'"""
if mod in ['geom', 'smesh']:
if mod == 'geom':
VERBATIM
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)"""%(prepare_generating_doc_src, prepare_generating_doc_src, tmp, upmod, tmp, tmp, input, tmp, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination))
+ newlines.append(r"""ADD_DEPENDENCIES(usr_docs html_docs)""")
else:
config_f = ""
if mod in ['netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin', "ghs3dprlplugin"] :
- config_f = "doxyfile_py"
- else:
- config_f = "doxyfile_idl"
- newlines.append("""\t ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} %s
+ config_f = "${DOXYGEN_EXECUTABLE} doxyfile_py"
+ elif mod not in ['pyhello']:
+ config_f = "${DOXYGEN_EXECUTABLE} doxyfile_idl"
+ newlines.append("""\t ADD_CUSTOM_TARGET(usr_docs %s
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''',True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''',r'''%s''', ignore=shutil.ignore_patterns(%s)); shutil.copy(r'''%s''',r'''%s''')"
VERBATIM
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)"""%(config_f, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination))
- elif mod == 'yacs' and operator.contains(self.root, upmod + '_SRC'+path.sep+'doc'):
+ elif mod in ['yacs', 'jobmanager'] and operator.contains(self.root, upmod + '_SRC'+path.sep+'doc'):
from sys import platform
params = '';
if platform == "win32":
params = '-Q';
ext = "bat"
prf = "call"
+ cmd = "STRING(REPLACE \"/\" \"\\\\\" SCR"
else:
ext = "sh"
prf = ". "
+ cmd = "SET(SCR"
doc_gui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/%s/docutils"%(upmod)
scr = self.writeEnvScript(upmod)
newlines.append(r"""
- IF(WINDOWS)
- STRING(REPLACE "/" "\\" SCR "%s")
- ELSE(WINDOWS)
- SET(SCR "%s")
- ENDIF(WINDOWS)
+ %s "%s")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s "${SCR}")
- ADD_CUSTOM_TARGET(html_docs %s ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s && ${SPHINX_EXECUTABLE} %s -c ${CMAKE_BINARY_DIR}/doc/docutils -W -b html ${ALLSPHINXOPTS} html
+ ADD_CUSTOM_TARGET(html_docs %s ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s && ${SPHINX_EXECUTABLE} %s -c ${CMAKE_BINARY_DIR}/doc/docutils -b html ${ALLSPHINXOPTS} html
COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''%s''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''%s''')\"
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(scr,scr,ext,prf,ext,params, doc_gui_destination, doc_gui_destination))
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(cmd, scr, ext, prf, ext, params, doc_gui_destination, doc_gui_destination))
# --
upmod = self.module.upper()
- if mod in ['kernel', 'gui', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui':
+ if mod in ['kernel', 'gui', 'med', 'smesh', 'visu', 'blsurfplugin'] and self.root[-len('tui'):] == 'tui':
if mod == 'kernel':
tmp = """\tADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE} -u
COMMAND ${DOXYGEN_EXECUTABLE}
if mod == 'visu':
tmp1= r"""\n COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/visuscreen.png''', r'''%s''')" """%(doc_tui_destination)
elif mod == 'smesh':
- extra_srcdir = "${CMAKE_CURRENT_SOURCE_DIR}/extra"
- tmp1= """\n COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/smeshscreen.png''', r'''%s'''); copy(r'''%s/AddNetgenInSalome2.pdf''', r'''%s'''); copy(r'''%s/PluginMeshers.html''', r'''%s''')"
- COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''%s/AddNetgenInSalome2.ps''', r'''%s'''); copy(r'''%s/AddNetgenInSalome2.sxw''', r'''%s''')" """%(doc_tui_destination, extra_srcdir,doc_destination, extra_srcdir,doc_destination, extra_srcdir,doc_destination,extra_srcdir,doc_destination)
+ tmp1= """\n COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/smeshscreen.png''', r'''%s''')" """%(doc_tui_destination)
else:
tmp1=""
doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod)
+ inst_head_command=""
+ if mod not in ['blsurfplugin']:
+ inst_head_command = "; shutil.copy(r'''%s''', r'''%s''')"%(head_source, doc_tui_destination)
newlines.append(tmp + """
- COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s''')" """%(doc_tui_destination, doc_source, doc_tui_destination, head_source, doc_tui_destination) + tmp1 + """
+ COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''%s''', r'''%s''')%s" """%(doc_tui_destination, doc_source, doc_tui_destination, inst_head_command) + tmp1 + """
VERBATIM
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)""")
ENDIF(WINDOWS)
''')
# --
- if self.module in ["geom", "med", "hexoticplugin"]:
+ if self.module in ["geom", "med", "hexoticplugin", "blsurfplugin"]:
newlines.append(r'''
SET(var ${var} -I${CMAKE_CURRENT_SOURCE_DIR})
SET(var ${var} -I${CMAKE_CURRENT_BINARY_DIR})
f.close()
return
- def writeEnvScript(self, upmod):
- from sys import platform, version_info
- p_version = """%s.%s"""%(version_info[0],version_info[1])
- python_path ="PYTHONPATH"
- path = ""
- begin = ""
- end = ""
- delim = ""
- cmd = ""
- pdir = ""
- omni = ""
- omni_py = ""
- if platform == "win32" :
- path = "PATH"
- begin = "%"
- end = "%"
- delim = ";"
- cmd = "@SET "
- omni = "/x86_win32"
- omni_py = "/python"
- pdir = "PDIR"
+ def writeEnvScript(self, upmod, buildmod=True):
+ import os, sys
+ p_version = sys.version[:3]
+ python_path = "PYTHONPATH"
+ root_dir = "%s_ROOT_DIR" % upmod
+ if sys.platform == "win32":
+ script_line = '@SET %(var)s=%(val)s;%%%(var)s%%\n'
+ var_line = '%%%s%%'
+ lib_path = "PATH"
+ omni = "x86_win32"
+ omni_py = "python"
+ pass
else:
- path = "LD_LIBRARY_PATH"
- begin = "\${"
- end = "}"
- delim = ":"
- cmd = "export "
- omni_py = "/python" + p_version + "/" + "site-packages"
- pdir = "INST_ROOT"
-
-
- path_ = begin + path + end
- root_dir_ = begin + upmod + "_ROOT_DIR" + end
- python_path_ = begin + python_path + end
- _python_path_ = delim + python_path_+ "\n"
- _path_ = delim + path_+ "\n"
- _pdir = begin + pdir + end
-
-
- script = cmd + " " + python_path + "=" + root_dir_+"/lib/python" + p_version \
- + "/site-packages/salome" + _python_path_
-
- script = script + cmd + " " + python_path + "=" + root_dir_+"/bin/salome" + \
- _python_path_
-
- script = script + cmd + " "+ path + "=" + root_dir_+"/lib/salome"+ _path_
-
+ script_line = 'export %(var)s=%(val)s:\$%(var)s\n'
+ var_line = '\${%s}'
+ lib_path = "LD_LIBRARY_PATH"
+ omni = ""
+ omni_py = "/".join( ["python%s"%p_version , "site-packages"] )
+ pass
+ #
+ script = ""
+ #
+ if buildmod:
+ script += script_line % { 'var':python_path, 'val':"/".join( ["${CMAKE_INSTALL_PREFIX}", "lib", "python%s"%p_version, "site-packages", "salome"] ) }
+ script += script_line % { 'var':python_path, 'val':"/".join( ["${CMAKE_INSTALL_PREFIX}", "bin", "salome"] ) }
+ script += script_line % { 'var':lib_path, 'val':"/".join( ["${CMAKE_INSTALL_PREFIX}", "lib", "salome"] ) }
+ pass
+ else:
+ script += script_line % { 'var':python_path, 'val':"/".join( [var_line % root_dir, "lib", "python%s"%p_version, "site-packages", "salome"] ) }
+ script += script_line % { 'var':python_path, 'val':"/".join( [var_line % root_dir, "bin", "salome"] ) }
+ script += script_line % { 'var':lib_path, 'val':"/".join( [var_line % root_dir, "lib", "salome"] ) }
+ pass
+ #
if upmod == "KERNEL" :
- script = script + cmd + " " + python_path + "=" + _pdir + \
- "/omniORB-4.1.5/lib" + omni + _python_path_
-
- script = script + cmd + " " + python_path + "=" + _pdir + \
- "/omniORB-4.1.5/lib" + omni_py + _python_path_
-
- script = script + cmd + " "+ path + "=" + _pdir+ "/omniORB-4.1.5/lib" + \
- omni + _path_
-
+ script += "\n"
+ if omni:
+ script += script_line % { 'var':python_path, 'val':"/".join( ["${OMNIORB_ROOT_USER}", "lib", omni] ) }
+ script += script_line % { 'var':lib_path, 'val':"/".join( ["${OMNIORB_ROOT_USER}", "lib", omni] ) }
+ pass
+ else:
+ script += script_line % { 'var':python_path, 'val':"/".join( ["${OMNIORB_ROOT_USER}", "lib"] ) }
+ script += script_line % { 'var':lib_path, 'val':"/".join( ["${OMNIORB_ROOT_USER}", "lib"] ) }
+ pass
+ script += script_line % { 'var':python_path, 'val':"/".join( ["${OMNIORB_ROOT_USER}", "lib", omni_py] ) }
+ pass
+ #
if upmod == "GEOM" :
- script = self.writeEnvScript("KERNEL") + script
- script = self.writeEnvScript("GUI") + script
-
+ script = self.writeEnvScript("KERNEL", False) + "\n" + script
+ script = self.writeEnvScript("GUI", False) + "\n" + script
+ pass
+ #
if upmod == "SMESH" :
- script = self.writeEnvScript("GEOM") + script
-
+ script = self.writeEnvScript("GEOM", False) + "\n" + script
+ pass
+
return script
pass
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-import sys, re
-outfile = open(sys.argv[1], 'wb')
-isCom = False
-for line in open(sys.argv[2], 'rb').readlines():
- if re.match('class '+sys.argv[3]+'DC', line):
+# ...
+# Usage: prepare_generating_doc.py <output_file> <input_file> <myClass>
+# ...
+# 1. myClassDC is replaced by myClass
+# 2. all methods of myClassDC become global methods of Python package
+# ...
+# myClass is passed as command line argument
+# ...
+
+import os, sys, re
+
+# check command line
+if len( sys.argv ) < 4:
+ sys.exit("Usage: %s <output_file> <input_file> <myClass>" % os.path.basename(sys.argv[0]))
+
+# open input file
+try:
+ infile = open(sys.argv[2], 'rb')
+except:
+ sys.exit("File %s is not found" % sys.argv[2])
+ pass
+
+# open output file
+try:
+ outfile = open(sys.argv[1], 'wb')
+except:
+ sys.exit("File %s cannot be opened for write" % sys.argv[1])
+ pass
+
+# parse input file
+
+isCom = False
+isShift = False
+
+for line in infile.readlines():
+ dc_class = sys.argv[3]
+ dc_class_dc = dc_class+'DC'
+
+ if isShift and ( re.match('^class\s+', line) or re.match('^def\s+', line) ):
+ # stop shifting lines as soon as myClassDC definition is over
+ isShift = False
+ pass
+ if re.match('class\s+%s' % dc_class_dc, line):
+ # start shifting lines
+ isShift = True
+ # omit this line (to remove myClassDC from the package)
continue
+
+ # process documentation
n = line.find('"""')
n1 = line[(n+2):].find('"""')
if (n > -1) and (n1 > -1):
if isCom:
if n > -1:
isCom = False
+ pass
continue
else:
if n > -1:
isCom = True
- continue
- line = re.sub(r'^\s+#', '#', line)
- line = re.sub(r'^\s+def', 'def', line)
- line = re.sub(sys.argv[3]+'DC', sys.argv[3], line)
+ continue
+ pass
+
+ # replacements
+ if isShift:
+ line = re.sub(r'^\s+#', '#', line)
+ line = re.sub(r'^\s+def', 'def', line)
+ pass
+ line = re.sub(dc_class_dc, dc_class, line)
+
+ # write resulting line
outfile.write(line)
-outfile.close()
\ No newline at end of file
+
+ pass # end of for
+
+# close input and output files
+infile.close()
+outfile.close()
--- /dev/null
+# Copyright (C) 2012 CEA/DEN, EDF R&D, OPEN CASCADE\r
+#\r
+# This library is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU Lesser General Public\r
+# License as published by the Free Software Foundation; either\r
+# version 2.1 of the License.\r
+#\r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+# Lesser General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+#\r
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+#\r
+\r
+ADD_SUBDIRECTORY(config_files)\r
+\r
+SET(DEPRECATED_FILES\r
+ DEPRECATED/F77config.h.in\r
+ DEPRECATED/sstream.in\r
+ DEPRECATED/envScript.in\r
+ DEPRECATED/depend.in\r
+ DEPRECATED/make_commence.in\r
+ DEPRECATED/make_conclude.in\r
+ DEPRECATED/make_module.in\r
+ DEPRECATED/make_omniorb.in\r
+)\r
+\r
+# The deprecated files are deprecated for the KERNEL but not for the\r
+# related modules (GUI, MED, ...), for now. Some files have to be installed.\r
+INSTALL(FILES ${DEPRECATED_FILES} DESTINATION salome_adm/unix)\r
--- /dev/null
+# Copyright (C) 2012 CEA/DEN, EDF R&D, OPEN CASCADE\r
+#\r
+# This library is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU Lesser General Public\r
+# License as published by the Free Software Foundation; either\r
+# version 2.1 of the License.\r
+#\r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+# Lesser General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+#\r
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+#\r
+ \r
+# The deprecated files are deprecated for the KERNEL but not for the\r
+# related modules (GUI, MED, ...). Some files have to be installed.\r
+SET(DEPRECATED_FILES\r
+ DEPRECATED/ac_cc_warnings.m4\r
+ DEPRECATED/ac_cxx_bool.m4\r
+ DEPRECATED/ac_cxx_mutable.m4\r
+ DEPRECATED/ac_cxx_partial_specialization.m4\r
+ DEPRECATED/ac_cxx_typename.m4\r
+ DEPRECATED/check_mico.m4\r
+ DEPRECATED/check_pthreads.m4\r
+ DEPRECATED/config.sub\r
+ DEPRECATED/config.guess\r
+ DEPRECATED/install-sh\r
+ DEPRECATED/libtool.m4\r
+ DEPRECATED/ltconfig\r
+ DEPRECATED/ltmain.sh\r
+ DEPRECATED/check_Salome.m4\r
+ DEPRECATED/check_java.m4\r
+ DEPRECATED/missing\r
+ DEPRECATED/mkinstalldirs\r
+)\r
+\r
+SET(m4_DATA\r
+ ac_cxx_depend_flag.m4\r
+ ac_cxx_have_sstream.m4\r
+ ac_cxx_namespaces.m4\r
+ ac_cxx_option.m4\r
+ ac_cxx_template_options.m4\r
+ ac_cxx_use_std_iostream.m4\r
+ ac_cxx_warnings.m4\r
+ ac_linker_options.m4\r
+ ac_check_sizeof_fortran.m4\r
+ acx_pthread.m4\r
+ check_Kernel.m4\r
+ check_boost.m4\r
+ check_cas.m4\r
+ check_corba.m4\r
+ check_cppunit.m4\r
+ check_f77.m4\r
+ check_calcium.m4\r
+ check_hdf5.m4\r
+ check_htmlgen.m4\r
+ check_sphinx.m4\r
+ check_lam.m4\r
+ check_libbatch.m4\r
+ check_mpi.m4\r
+ check_openmpi.m4\r
+ check_mpich.m4\r
+ check_omniorb.m4\r
+ check_sockets.m4\r
+ check_swig.m4\r
+ check_vtk.m4\r
+ check_withihm.m4\r
+ enable_pthreads.m4\r
+ production.m4\r
+ pyembed.m4\r
+ python.m4\r
+ check_libxml.m4\r
+ check_paco++.m4\r
+ local_install.m4\r
+ hack_libtool.m4\r
+ check_tbb.m4\r
+)\r
+INSTALL(FILES ${DEPRECATED_FILES} DESTINATION salome_adm/unix/config_files/DEPRECATED)\r
+INSTALL(FILES ${m4_DATA} DESTINATION salome_adm/unix/config_files)\r
CAS_OCAF="$CAS_LDPATH -lPTKernel -lTKernel -lTKCDF -lTKLCAF -lTKPCAF -lTKStdSchema"
CAS_OCAFVIS="$CAS_LDPATH -lTKCAF -lTKPLCAF -lTKPShape -lTKStdLSchema -lTKShapeSchema"
- if test -f $CASROOT/$casdir/lib/libStdPlugin.so ; then
+ if test -f ${CAS_LIBDIR}/libStdPlugin.so ; then
# standard plugin library libStdPlugin has been added in CASCADE 5.2.3
CAS_STDPLUGIN="StdPlugin"
CAS_OCAFVIS="$CAS_OCAFVIS -lStdPlugin -lStdLPlugin"
- elif test -f $CASROOT/$casdir/lib/libTKStdSchema.so ; then
+ elif test -f ${CAS_LIBDIR}/libTKStdSchema.so ; then
# standard plugin has been renamed in CASCADE 6.5
CAS_STDPLUGIN=TKStdSchema
CAS_OCAFVIS="$CAS_OCAFVIS -lTKStdSchema -lTKStdLSchema"
name[slash]='_';
_containerName=name;
}
+
+//=============================================================================
+/*!
+ \brief Get version of the component
+
+ This method is supposed to be implemented in all derived classes; default implementation
+ returns empty string that means that no version information about the component is available.
+
+ \note The version of the component is stored to the study, as a part of general persistence
+ mechanism; once stored, version information in the study cannot be changed.
+
+ \return string containing component's version, e.g. "1.0"
+*/
+char* Engines_Component_i::getVersion()
+{
+ return CORBA::string_dup( "" );
+}
def getObjectInfo(self, studyId, entry):
return ""
+ #-------------------------------------------------------------------------
+
+ def getVersion(self):
+ return "" # empty string means "unknown" version
+
+ pass # end of SALOME_ComponentPy_i
virtual bool hasObjectInfo() { return false; }
virtual char* getObjectInfo(CORBA::Long studyId, const char* entry) { return CORBA::string_dup(""); }
+ // Version information
+ virtual char* getVersion();
+
// --- local C++ methods
PortableServer::ObjectId * getId();
#include <sstream>
#include <string>
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_Session)
+
#ifdef WNT
#include <process.h>
#define getpid _getpid
void SALOME_ContainerManager::ShutdownContainers()
{
MESSAGE("ShutdownContainers");
+
+ SALOME::Session_var session = SALOME::Session::_nil();
+ CORBA::Long pid = 0;
+ CORBA::Object_var objS = _NS->Resolve("/Kernel/Session");
+ if (!CORBA::is_nil(objS))
+ {
+ session = SALOME::Session::_narrow(objS);
+ if (!CORBA::is_nil(session))
+ pid = session->getPID();
+ }
+
bool isOK;
isOK = _NS->Change_Directory("/Containers");
if( isOK ){
try
{
Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont))
+ if(!CORBA::is_nil(cont) && pid != cont->getPID())
lstCont.push_back((*iter));
}
catch(const CORBA::Exception& e)
int cp_een(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,int *eval);
int cp_edb(Superv_Component_i *component,int dep,double t,int n,char *nom,int nval,double *eval);
int cp_ere(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,float *eval);
+int cp_erd(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,float *eval);
int cp_ecp(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,float *ecpval);
int cp_elo(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,int *eval);
int cp_ech(Superv_Component_i *component,int dep,float t,int n,char *nom,int nval,char** eval,int strSize);
int cp_len(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval);
int cp_ldb(Superv_Component_i *component,int dep,double *ti,double *tf,int *niter,char *nom,int nmax,int *nval,double *lval);
int cp_lre(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval);
+int cp_lrd(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval);
int cp_lcp(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lcpval);
int cp_llo(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval);
int cp_lch(Superv_Component_i *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,char** lval,int strSize);
/*REVERIFIER MAINTENANT 0 COPY avec int2integer*/
CALCIUM_EXT_LECT_INTERFACE_C_(len,float,int,int2integer,);
CALCIUM_EXT_LECT_INTERFACE_C_(lre,float,float,float,);
+/*Permet d'envoyer/recevoir des réels sur un port Double */
+CALCIUM_EXT_LECT_INTERFACE_C_(lrd,float ,float ,float2double,);
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 */
/**************************************/
CALCIUM_LECT_INTERFACE_C_(lln,float ,int,long ,long,,);
CALCIUM_LECT_INTERFACE_C_(lre,float ,int,float ,float,,);
+/*Permet d'envoyer/recevoir des réels sur un port Double */
+CALCIUM_LECT_INTERFACE_C_(lrd,float ,int,float ,float2double,,);
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_(llg_fort_,float ,cal_int,long ,long2integer,,);
CALCIUM_LECT_INTERFACE_C_(lre_fort_,float ,cal_int,float ,float,,);
+CALCIUM_LECT_INTERFACE_C_(lrd_fort_,float ,cal_int,float ,float2double,,);
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,,);
sinon problème de conversion de 64bits vers 32bits */
CALCIUM_ECR_INTERFACE_C_(elg,float ,int,long ,long2integer,,);
CALCIUM_ECR_INTERFACE_C_(ere,float ,int,float ,float,,);
+/*Permet d'envoyer/recevoir des réels sur un port Double */
+CALCIUM_ECR_INTERFACE_C_(erd,float ,int,float ,float2double,,);
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 );
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_(erd_fort_,float ,cal_int,float ,float2double,,);
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_C2CPP_INTERFACE_CXX_(float,float,float, );
CALCIUM_C2CPP_INTERFACE_CXX_(double,double,double,);
+
+CALCIUM_C2CPP_INTERFACE_CXX_(float2double,double,float, );
+
/* 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_HXX_(float,float,float, );
CALCIUM_C2CPP_INTERFACE_HXX_(double,double,double,);
+
+CALCIUM_C2CPP_INTERFACE_HXX_(float2double,double,float, );
+
/* 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,);
#endif
);
+extern int cp_lrd(
+/* ------ */
+#if CPNeedPrototype
+ void * component /* Pointeur de type Superv_Component_i* sur le */
+ /* composant SALOME Supervisable */,
+ int /* E Type de dependance ou de lecture */
+ /* CP_TEMPS, CP_ITERATION, CP_SEQUENTIEL */,
+ float * /* E/S Borne inf de l'intervalle de lecture */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ float * /* E Borne Sup de l'intervalle de lecture */,
+ int * /* E/S Pas d'iteration a lire */
+ /* Retourne le pas lu dans le cas de */
+ /* lecture sequentielle */,
+ char * /* E Nom de la variable a lire */,
+ int /* E Nombre max de valeurs a lire */,
+ int * /* S Nombre de valeurs rellement lues */,
+ float * /* S Tableau de flottants pour stocker les */
+ /* valeurs lues */
+#endif
+);
+
+
extern int cp_ldb(
/* ------ */
#if CPNeedPrototype
#endif
);
+extern int cp_erd(
+/* ------ */
+#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 */,
+ float * /* E Tableau de flottants a ecrire */
+#endif
+);
+
+
extern int cp_edb(
/* ------ */
#if CPNeedPrototype
cal_int *max,cal_int *n, double *tab,cal_int *err STR_PLEN(nom));
void F_FUNC(cplre,CPLRE)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cplrd,CPLRD)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
+ cal_int *max,cal_int *n, double *tab,cal_int *err STR_PLEN(nom));
void F_FUNC(cplcp,CPLCP)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
cal_int *max,cal_int *n, float *tab,cal_int *err STR_PLEN(nom));
void F_FUNC(cplch,CPLCH)(long *compo,cal_int *dep,float *ti,float *tf,cal_int *iter,STR_PSTR(nom),
free_str1(cnom);
}
+void F_FUNC(cplrd,CPLRD)(long *compo,cal_int *dep,float *ti,float *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));
+ *err=cp_lrd_fort_((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,(float *)tab);
+ free_str1(cnom);
+}
+
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))
{
STR_PLEN(nom) STR_PLEN(tab));
void F_FUNC(cpedb,CPEDB)(long *compo,cal_int *dep,double *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom));
void F_FUNC(cpere,CPERE)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom));
+void F_FUNC(cperd,CPERD)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom));
void F_FUNC(cpecp,CPECP)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, float *tab,cal_int *err STR_PLEN(nom));
void F_FUNC(cpein,CPEIN)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, int *tab,cal_int *err STR_PLEN(nom));
void F_FUNC(cpelg,CPELG)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, long *tab,cal_int *err STR_PLEN(nom));
free_str1(cnom);
}
+void F_FUNC(cperd,CPERD)(long *compo,cal_int *dep,float *ti,cal_int *iter,STR_PSTR(nom),cal_int *n, double *tab,cal_int *err STR_PLEN(nom))
+{
+ float tti=0.;
+ if(*dep == CP_TEMPS)tti=*ti;
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ *err=cp_erd_fort_((void *)*compo,*dep,tti,*iter,cnom,*n,(float *)tab);
+ free_str1(cnom);
+}
+
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))
{
float tti=0.;
CALCIUM_ECR_INTERFACE_C_H(eln_fort_,float ,cal_int,long ,long,,);
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(erd_fort_,float ,cal_int,float ,float2double,,);
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_LECT_INTERFACE_C_H(lln_fort_,float ,cal_int,long ,long,,);
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(lrd_fort_,float ,cal_int,float ,float2double,,);
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,,);
#--------------------------------------------------------------------------
+def GetComponentVersion(theComponent, all_versions = False):
+ # returns the document list tree (as list)
+ props = myStudy.GetProperties()
+ stored_components = props.GetStoredComponents()
+ version = "no component data" # vsr: better raise an exception in this case?
+ if theComponent in stored_components:
+ if all_versions:
+ version = props.GetComponentVersions(theComponent)
+ for i in range(len(version)):
+ if not version[i]: version[i] = "unknown"
+ pass
+ pass
+ else:
+ version = props.GetComponentVersion(theComponent)
+ if not version: version = "unknown"
+ pass
+ pass
+ return version
+
+ #--------------------------------------------------------------------------
+
def FindFileInDataDir(filename):
import os
datadir = os.getenv("DATA_DIR")
mpiImpl = new MpiImpl_MPICH2();
else if(mpi_type == "openmpi")
mpiImpl = new MpiImpl_OPENMPI();
+ else if(mpi_type == "ompi")
+ mpiImpl = new MpiImpl_OMPI();
else if(mpi_type == "slurmmpi")
mpiImpl = new MpiImpl_SLURM();
else
case openmpi:
mpi = "openmpi";
break;
+ case ompi:
+ mpi = "ompi";
+ break;
case slurmmpi:
mpi = "slurmmpi";
break;
// Author: André RIBES - EDF R&D
//
#include "Launcher_Job_Command.hxx"
+#include "Basics_DirUtils.hxx"
#ifdef WITH_LIBBATCH
#include <Batch/Batch_Constants.hxx>
// File name
std::string launch_date_port_file = launch_date;
- std::string launch_script = "/tmp/runCommand_" + _job_file_name + "_" + launch_date + ".sh";
+ std::string launch_script = Kernel_Utils::GetTmpDir() + "runCommand_" + _job_file_name + "_" + launch_date + ".sh";
std::ofstream launch_script_stream;
launch_script_stream.open(launch_script.c_str(), std::ofstream::out);
// Author: André RIBES - EDF R&D
//
#include "Launcher_Job_SALOME.hxx"
+#include "Basics_DirUtils.hxx"
#ifdef WITH_LIBBATCH
#include <Batch/Batch_Constants.hxx>
// parameters
std::string work_directory = params[Batch::WORKDIR].str();
- std::string launch_script = "/tmp/runSalome_" + _job_file_name + "_" + _launch_date + ".sh";
+ std::string launch_script = Kernel_Utils::GetTmpDir() + "runSalome_" + _job_file_name + "_" + _launch_date + ".sh";
std::ofstream launch_script_stream;
launch_script_stream.open(launch_script.c_str(),
std::ofstream::out
if (!CORBA::is_nil(session))
{
pid = session->getPID();
+ session->Shutdown();
}
}
// ignore and continue
}
+ /*
// 6) Session
if ( !CORBA::is_nil( session ) ) {
try
// ignore and continue
}
}
+ */
// 7) Logger
int argc = 0;
resource.mpi = mpich2;
else if (anMpi == "openmpi")
resource.mpi = openmpi;
+ else if (anMpi == "ompi")
+ resource.mpi = ompi;
else if (anMpi == "slurmmpi")
resource.mpi = slurmmpi;
else if (anMpi == "prun")
resource.mpi = mpich2;
else if (anMpi == "openmpi")
resource.mpi = openmpi;
+ else if (anMpi == "ompi")
+ resource.mpi = ompi;
else if (anMpi == "slurmmpi")
resource.mpi = slurmmpi;
else if (anMpi == "prun")
case openmpi:
xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
break;
+ case ompi:
+ xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "ompi");
+ break;
case slurmmpi:
xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurmmpi");
break;
return "mpich2";
else if (mpi == openmpi)
return "openmpi";
+ else if (mpi == ompi)
+ return "ompi";
else if (mpi == slurmmpi)
return "slurmmpi";
else
enum BatchType {none, pbs, lsf, sge, ssh_batch, ccc, ll, slurm, vishnu};
-enum MpiImplType {nompi, lam, mpich1, mpich2, openmpi, slurmmpi, prun};
+enum MpiImplType {nompi, lam, mpich1, mpich2, openmpi, ompi, slurmmpi, prun};
class RESOURCESMANAGER_EXPORT ResourceDataToSort
{
p_ptr->mpiImpl = "mpich2";
else if( resource.mpi == openmpi )
p_ptr->mpiImpl = "openmpi";
+ else if( resource.mpi == ompi )
+ p_ptr->mpiImpl = "ompi";
else if( resource.mpi == slurmmpi )
p_ptr->mpiImpl = "slurmmpi";
else if( resource.mpi == prun )
resource.mpi = mpich2;
else if (anMpi == "openmpi")
resource.mpi = openmpi;
+ else if (anMpi == "ompi")
+ resource.mpi = ompi;
else if (anMpi == "slurmmpi")
resource.mpi = slurmmpi;
else if (anMpi == "prun")
cluster_it++;
}
}
- else if (resource.mpi == openmpi)
+ else if ((resource.mpi == openmpi) || (resource.mpi == ompi))
{
// Creating machine file
machine_file_name = tmpnam(NULL);
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
- ../TOOLSDS/libTOOLSDS.la \
../NamingService/libSalomeNS.la \
../Utils/libOpUtil.la \
../SALOMELocalTrace/libSALOMELocalTrace.la \
anUnits = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetUnits();
return anUnits;
}
+
+std::vector<std::string> SALOMEDS_AttributeStudyProperties::GetStoredComponents()
+{
+ std::vector<std::string> aComponents;
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+ aComponents = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetStoredComponents();
+ }
+ else {
+ SALOMEDS::StringSeq_var components = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetStoredComponents();
+ int length = components->length();
+ for (int i = 0; i < length; i++) {
+ aComponents.push_back(components[i].in());
+ }
+ }
+ return aComponents;
+}
+
+std::string SALOMEDS_AttributeStudyProperties::GetComponentVersion( const std::string& theComponent )
+{
+ std::string aVersion;
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+ aVersion = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetComponentVersion(theComponent);
+ }
+ else
+ aVersion = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetComponentVersion(theComponent.c_str());
+ return aVersion;
+}
+
+std::vector<std::string> SALOMEDS_AttributeStudyProperties::GetComponentVersions( const std::string& theComponent )
+{
+ std::vector<std::string> aVersions;
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+ aVersions = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetComponentVersions(theComponent);
+ }
+ else {
+ SALOMEDS::StringSeq_var versions = ((SALOMEDS::AttributeStudyProperties_var)SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl))->GetComponentVersions(theComponent.c_str());
+ int length = versions->length();
+ for (int i = 0; i < length; i++) {
+ aVersions.push_back(versions[i].in());
+ }
+ }
+ return aVersions;
+}
virtual void SetComment(const std::string& theComment);
virtual std::string GetComment();
-
+ virtual std::vector<std::string> GetStoredComponents();
+ virtual std::string GetComponentVersion( const std::string& theComponent );
+ virtual std::vector<std::string> GetComponentVersions( const std::string& theComponent );
};
return c_s._retn();
}
+SALOMEDS::StringSeq* SALOMEDS_AttributeStudyProperties_i::GetStoredComponents()
+{
+ SALOMEDS::Locker lock;
+ std::vector<std::string> components = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetStoredComponents();
+ SALOMEDS::StringSeq_var c_components = new SALOMEDS::StringSeq();
+ c_components->length(components.size());
+ for (int i = 0; i < components.size(); i++) {
+ c_components[i] = CORBA::string_dup(components[i].c_str());
+ }
+ return c_components._retn();
+}
+
+char* SALOMEDS_AttributeStudyProperties_i::GetComponentVersion(const char* theComponent)
+{
+ SALOMEDS::Locker lock;
+ std::string version = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetComponentVersion(theComponent);
+ CORBA::String_var c_version = CORBA::string_dup(version.c_str());
+ return c_version._retn();
+}
+
+SALOMEDS::StringSeq* SALOMEDS_AttributeStudyProperties_i::GetComponentVersions(const char* theComponent)
+{
+ SALOMEDS::Locker lock;
+ std::vector<std::string> versions = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetComponentVersions(theComponent);
+ SALOMEDS::StringSeq_var c_versions = new SALOMEDS::StringSeq();
+ c_versions->length(versions.size());
+ for (int i = 0; i < versions.size(); i++) {
+ c_versions[i] = CORBA::string_dup(versions[i].c_str());
+ }
+ return c_versions._retn();
+}
virtual void SetUnits(const char* theUnits);
virtual char* GetUnits();
+
+ virtual SALOMEDS::StringSeq* GetStoredComponents();
+ virtual char* GetComponentVersion(const char* theComponent);
+ virtual SALOMEDS::StringSeq* GetComponentVersions(const char* theComponent);
};
#include "SALOMEDS.hxx"
#include <stdlib.h>
-SALOMEDS_Driver_i::SALOMEDS_Driver_i(SALOMEDS::Driver_ptr theDriver, CORBA::ORB_ptr theORB)
+SALOMEDS_Driver_i::SALOMEDS_Driver_i(Engines::EngineComponent_ptr theEngine, CORBA::ORB_ptr theORB)
{
+ // engine should not be null - component is supposed to be inherited from Engines::EngineComponent
+ _engine = Engines::EngineComponent::_duplicate(theEngine);
+ // driver can be null - if component interface does not inherit SALOMEDS::Driver
+ _driver = SALOMEDS::Driver::_narrow(theEngine);
+ _orb = CORBA::ORB::_duplicate(theORB);
+}
+
+SALOMEDS_Driver_i::SALOMEDS_Driver_i(SALOMEDS::Driver_ptr theDriver, CORBA::ORB_ptr theORB)
+{
+ // driver can be null - if component interface does not inherit SALOMEDS::Driver
_driver = SALOMEDS::Driver::_duplicate(theDriver);
+ // engine can be null - since it is narrowed from SALOMEDS::Driver ptr which can be null
+ _engine = Engines::EngineComponent::_narrow(theDriver);
_orb = CORBA::ORB::_duplicate(theORB);
}
std::string SALOMEDS_Driver_i::GetIOR()
{
std::string ior = "";
- if ( !CORBA::is_nil(_driver) ) {
- CORBA::String_var cior = _orb->object_to_string(_driver);
+ if ( !CORBA::is_nil(_engine) ) {
+ CORBA::String_var cior = _orb->object_to_string(_engine);
ior = cior;
}
return ior;
return dtype;
}
+std::string SALOMEDS_Driver_i::Version()
+{
+ return !CORBA::is_nil( _engine ) ? _engine->getVersion() : std::string("");
+}
+
std::string SALOMEDS_Driver_i::IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject,
const std::string& IORString,
bool isMultiFile,
Engines::TMPFile_var aStream;
CORBA::Boolean aValidScript = true; // VSR: maybe should be false by default ???
- Engines::EngineComponent_ptr aComponent = Engines::EngineComponent::_narrow(_driver);
- if ( !CORBA::is_nil( aComponent ) )
- aStream = aComponent->DumpPython(st.in(), isPublished, isMultiFile, aValidScript);
+ if ( !CORBA::is_nil( _engine ) )
+ aStream = _engine->DumpPython(st.in(), isPublished, isMultiFile, aValidScript);
SALOMEDSImpl_TMPFile* aTMPFile = new Engines_TMPFile_i(aStream._retn());
theStreamLength = aTMPFile->Size();
}
if (!CORBA::is_nil(obj)) {
- SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj);
- return new SALOMEDS_Driver_i(aDriver, _orb);
+ Engines::EngineComponent_var anEngine = Engines::EngineComponent::_narrow(obj);
+ return new SALOMEDS_Driver_i(anEngine, _orb);
}
return NULL;
obj = _orb->string_to_object(theIOR.c_str());
if (!CORBA::is_nil(obj)) {
- SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj);
- return new SALOMEDS_Driver_i(aDriver, _orb);
+ Engines::EngineComponent_var anEngine = Engines::EngineComponent::_narrow(obj);
+ return new SALOMEDS_Driver_i(anEngine, _orb);
}
return NULL;
{
protected:
SALOMEDS::Driver_var _driver;
+ Engines::EngineComponent_var _engine;
CORBA::ORB_var _orb;
public:
-
+ SALOMEDS_Driver_i(Engines::EngineComponent_ptr theEngine, CORBA::ORB_ptr theORB);
SALOMEDS_Driver_i(SALOMEDS::Driver_ptr theDriver, CORBA::ORB_ptr theORB);
-
~SALOMEDS_Driver_i();
virtual std::string GetIOR();
virtual std::string ComponentDataType();
+ virtual std::string Version();
+
virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject,
const std::string& IORString,
bool isMultiFile,
SALOMEDS_SComponent* aSCO = dynamic_cast<SALOMEDS_SComponent*>(theSCO.get());
CORBA::Object_var obj = _orb->string_to_object(theIOR.c_str());
+ Engines::EngineComponent_var anEngine = Engines::EngineComponent::_narrow(obj);
SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj);
if (_isLocal) {
SALOMEDS::Locker lock;
- SALOMEDS_Driver_i* drv = new SALOMEDS_Driver_i(aDriver, _orb);
+ SALOMEDS_Driver_i* drv = new SALOMEDS_Driver_i(anEngine, _orb);
SALOMEDSImpl_SComponent aSCO_impl = *(dynamic_cast<SALOMEDSImpl_SComponent*>(aSCO->GetLocalImpl()));
bool isDone = _local_impl->LoadWith(aSCO_impl, drv);
delete drv;
std::string IOREngine = aSCO.GetIOR();
if(!IOREngine.empty()) {
CORBA::Object_var obj = orb->string_to_object(IOREngine.c_str());
- SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
+ Engines::EngineComponent_var Engine = Engines::EngineComponent::_narrow(obj) ;
driver = new SALOMEDS_Driver_i(Engine, orb);
}
}
std::string IOREngine = aSCO.GetIOR();
if(!IOREngine.empty()) {
CORBA::Object_var obj = orb->string_to_object(IOREngine.c_str());
- SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
+ Engines::EngineComponent_var Engine = Engines::EngineComponent::_narrow(obj) ;
driver = new SALOMEDS_Driver_i(Engine, orb);
}
}
def ComponentDataType(self):
return self._ComponentDataType
+ def Version(self):
+ try:
+ return self.getVersion()
+ except:
+ return ""
+
def Save(self, theComponent, theURL, isMultiFile):
return ""
virtual void SetComment(const std::string& theComment) = 0;
virtual std::string GetComment() = 0;
-
+ virtual std::vector<std::string> GetStoredComponents() = 0;
+ virtual std::string GetComponentVersion( const std::string& theComponent ) = 0;
+ virtual std::vector<std::string> GetComponentVersions( const std::string& theComponent ) = 0;
};
myMonth.clear();
myYear.clear();
myMode = 0; // none
+ myComponentVersions.clear();
}
void SALOMEDSImpl_AttributeStudyProperties::SetModification(const std::string& theUserName,
std::string SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const
{
- if (myUserName.size() == 0)
- return std::string("");
- return myUserName[0];
+ return myUserName.empty() ? std::string("") : myUserName[0];
}
bool SALOMEDSImpl_AttributeStudyProperties::GetCreationDate
void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const int theMode)
{
+ if (theMode == myMode) return;
CheckLocked();
Backup();
myMode = theMode;
return myLocked;
}
-bool SALOMEDSImpl_AttributeStudyProperties::IsLockChanged(const bool theErase) {
+bool SALOMEDSImpl_AttributeStudyProperties::IsLockChanged(const bool theErase)
+{
if (!myLockChanged) return false;
if (theErase) myLockChanged = false;
return true;
myYear.push_back(aYears[i]);
}
myMode = aProp->GetCreationMode();
+ myComponentVersions = aProp->GetComponentsVersions();
// myModified = aProp->GetModified();
// myLocked = aProp->IsLocked();
}
}
aProp->SetCreationMode(myMode);
+ aProp->SetComponentsVersions( myComponentVersions );
// aProp->SetModified(myModified);
// aProp->SetLocked(myLocked);
}
std::string units = GetUnits();
std::string comment = GetComment();
+
+ int aLength1 = 0;
+ std::map<std::string, std::string> versions;
+ versionMap::const_iterator it;
+ for (aLength1 = 0, it = myComponentVersions.begin(); it != myComponentVersions.end(); ++it ) {
+ std::string vlist = "";
+ versionList vl = it->second;
+ versionList::const_iterator vlit;
+ for ( vlit = vl.begin(); vlit != vl.end(); ++vlit ) {
+ if ( vlist != "" ) vlist += ";";
+ vlist += *vlit;
+ }
+ versions[ it->first ] = vlist;
+ aLength1 += it->first.size() + vlist.size() + 2;
+ }
unitsSize = units.size();
commentSize = comment.size();
- char* aProperty = new char[3 + aLength + 12 * aNames.size() + 1 + unitsSize + 1 + commentSize];
+ char* aProperty = new char[3 + aLength + 12 * aNames.size() + 1 + unitsSize + 1 + commentSize + 1 + aLength1 ];
char crMode = (char)GetCreationMode();
if(comment.size() > 0) {
sprintf(&(aProperty[a]),"%s",comment.c_str());
a = strlen(aProperty);
- a++;
}
+ aProperty[a++] = 30; //delimeter of the component versions
+
+ std::map<std::string, std::string>::const_iterator versionsIt;
+ for ( versionsIt = versions.begin(); versionsIt != versions.end(); ++versionsIt ) {
+ sprintf(&(aProperty[a]),"%s=%s",
+ (char*)(versionsIt->first.c_str()),
+ (char*)(versionsIt->second.c_str()));
+ a = strlen(aProperty);
+ aProperty[a++] = 1;
+ }
+
aProperty[a] = 0;
std::string prop(aProperty);
delete aProperty;
return prop;
}
-void SALOMEDSImpl_AttributeStudyProperties::SetUnits(const std::string& theUnits) {
+void SALOMEDSImpl_AttributeStudyProperties::SetUnits(const std::string& theUnits)
+{
if(myUnits == theUnits)
return;
+
+ CheckLocked();
+ Backup();
+
myUnits = theUnits;
}
-std::string SALOMEDSImpl_AttributeStudyProperties::GetUnits() {
+std::string SALOMEDSImpl_AttributeStudyProperties::GetUnits() const
+{
return myUnits;
}
-void SALOMEDSImpl_AttributeStudyProperties::SetComment(const std::string& theComment) {
+void SALOMEDSImpl_AttributeStudyProperties::SetComment(const std::string& theComment)
+{
if(myComment == theComment)
return;
+
+ CheckLocked();
+ Backup();
+
myComment = theComment;
}
-std::string SALOMEDSImpl_AttributeStudyProperties::GetComment() {
+std::string SALOMEDSImpl_AttributeStudyProperties::GetComment() const
+{
return myComment;
}
+void SALOMEDSImpl_AttributeStudyProperties::SetComponentVersion(const std::string& theComponent, const std::string& theVersion)
+{
+ if (!theComponent.empty()) {
+ CheckLocked();
+ Backup();
+ if (myComponentVersions.find(theComponent) == myComponentVersions.end()) myComponentVersions[theComponent] = versionList();
+ if (myComponentVersions[theComponent].empty() || myComponentVersions[theComponent].back() != theVersion)
+ myComponentVersions[theComponent].push_back(theVersion);
+ }
+}
+
+std::vector<std::string> SALOMEDSImpl_AttributeStudyProperties::GetStoredComponents() const
+{
+ std::vector<std::string> components;
+ versionMap::const_iterator it;
+ for (it = myComponentVersions.begin(); it != myComponentVersions.end(); ++it)
+ components.push_back(it->first);
+ return components;
+}
+
+std::string SALOMEDSImpl_AttributeStudyProperties::GetComponentVersion(const std::string& theComponent) const
+{
+ versionList versions = GetComponentVersions(theComponent);
+ return versions.size() > 0 ? versions[0] : std::string("");
+}
+
+std::vector<std::string> SALOMEDSImpl_AttributeStudyProperties::GetComponentVersions(const std::string& theComponent) const
+{
+ versionList versions;
+ versionMap::const_iterator it = myComponentVersions.find(theComponent);
+ if ( it != myComponentVersions.end() ) versions = it->second;
+ return versions;
+}
+
+std::map< std::string, std::vector<std::string> > SALOMEDSImpl_AttributeStudyProperties::GetComponentsVersions() const
+{
+ return myComponentVersions;
+}
+
+void SALOMEDSImpl_AttributeStudyProperties::SetComponentsVersions( const std::map< std::string, std::vector<std::string> >& theVersions )
+{
+ myComponentVersions = theVersions;
+}
void SALOMEDSImpl_AttributeStudyProperties::Load(const std::string& value)
{
SetCreationMode(crMode);
int anIndex;
- for (anIndex = 2; anIndex + 2 < value.size() ;) {
+ // number 13 below is minimal size of modification data record, which has form:
+ // mmhhddMMyyyyname1, where
+ // - mm: minute = 2 bytes
+ // - hh: hour = 2 bytes
+ // - dd: day = 2 bytes
+ // - MM: month = 2 bytes
+ // - yyyy: year = 4 bytes
+ // - name: user's name = arbitrary value, minimal length is 0 bytes
+ // - 1 : records delimiter = 1 byte
+ for (anIndex = 2; anIndex + 13 < value.size() ;) {
char str[10];
int aMinute, aHour, aDay, aMonth, aYear;
str[0] = aCopy[anIndex++];
break;
}
- //Case then study contains units and comment properties
+ //Case when study contains units and comment properties
if( anIndex < value.size() ) {
anIndex++; //skip the delimeter of the sections: char(30)
int unitsSize;
anIndex += unitsSize + 1;
int commentSize;
- for(commentSize = 0; aCopy[anIndex+commentSize] != 0; commentSize++);
+ for(commentSize = 0; aCopy[anIndex+commentSize] != 0 && aCopy[anIndex+commentSize] != 30; commentSize++);
if(commentSize > 0) {
char *aComment = new char[commentSize+1];
SetComment(aComment);
delete [] (aComment);
}
- anIndex += commentSize;
+ anIndex += commentSize + 1;
+ }
+
+ //Case when study contains components versions
+ if( anIndex < value.size() ) {
+ while ( anIndex < value.size() && aCopy[anIndex] != 0 ) {
+ int modSize;
+ for(modSize = 0; aCopy[anIndex+modSize] != '='; modSize++);
+ int verSize;
+ for(verSize = 0; aCopy[anIndex+modSize+1+verSize] != 1; verSize++);
+
+ if(modSize > 0) {
+ char *aModule = new char[modSize+1];
+ strncpy(aModule, &(aCopy[anIndex]), modSize);
+ aModule[modSize] = 0;
+ char *aVersions = new char[verSize+1];
+ if ( verSize > 0 )
+ strncpy(aVersions, &(aCopy[anIndex+modSize+1]), verSize);
+ aVersions[verSize] = 0;
+
+ std::string mVersions = aVersions;
+ int start = 0, idx = mVersions.find( ';', start );
+ while ( idx != std::string::npos ) {
+ SetComponentVersion( aModule, mVersions.substr( start, idx-start ) );
+ start = idx + 1;
+ idx = mVersions.find( ';', start );
+ }
+ SetComponentVersion( aModule, mVersions.substr( start ) );
+
+ delete [] (aModule);
+ delete [] (aVersions);
+ anIndex += modSize + 1 + verSize + 1;
+ }
+ }
}
if (aCopy[1] == 'l') {
#include "DF_Label.hxx"
#include <string>
#include <vector>
+#include <map>
#include "SALOMEDSImpl_GenericAttribute.hxx"
class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeStudyProperties : public SALOMEDSImpl_GenericAttribute
void ChangeCreatorName(const std::string& theUserName);
void SetUnits(const std::string& theUnits);
- std::string GetUnits();
+ std::string GetUnits() const;
void SetComment(const std::string& theComment);
- std::string GetComment();
+ std::string GetComment() const;
void SetCreationMode(const int theMode);
int GetCreationMode() const;
bool IsLocked() const;
bool IsLockChanged(const bool theErase);
+ void SetComponentsVersions( const std::map< std::string, std::vector<std::string> >& theVersions );
+ void SetComponentVersion(const std::string& theComponent, const std::string& theVersion);
+ std::vector<std::string> GetStoredComponents() const;
+ std::string GetComponentVersion(const std::string& theComponent) const;
+ std::vector<std::string> GetComponentVersions(const std::string& theComponent) const;
+ std::map< std::string, std::vector<std::string> > GetComponentsVersions() const;
+
void Restore(DF_Attribute* with);
DF_Attribute* NewEmpty() const;
void Paste(DF_Attribute* into);
private:
+ typedef std::vector<std::string> versionList;
+ typedef std::map<std::string, versionList> versionMap;
std::vector<std::string> myUserName;
std::vector<int> myMinute;
std::vector<int> myYear;
std::string myUnits;
std::string myComment;
- int myMode;
- int myModified;
- bool myLocked;
- bool myLockChanged;
-
+ int myMode;
+ int myModified;
+ bool myLocked;
+ bool myLockChanged;
+ versionMap myComponentVersions;
};
#endif
virtual std::string ComponentDataType() = 0;
+ virtual std::string Version() = 0;
virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject,
const std::string& IORString,
#include "SALOMEDSImpl_SComponent.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "SALOMEDSImpl_ScalarVariable.hxx"
+#include "SALOMEDSImpl_IParameters.hxx"
#include <map>
#include "HDFOI.hxx"
SALOMEDSImpl_Driver*, bool isMultiFile, bool isASCII);
static void ReadNoteBookVariables(SALOMEDSImpl_Study* theStudy, HDFgroup* theGroup);
+namespace {
+ class StudyUnlocker
+ {
+ public:
+ StudyUnlocker( SALOMEDSImpl_Study* study ): myStudy( study ), myLocked( false )
+ {
+ myPrevLocked = myStudy->GetProperties()->IsLocked();
+ resume();
+ }
+ ~StudyUnlocker()
+ {
+ suspend();
+ }
+ void suspend()
+ {
+ if (myLocked) {
+ myStudy->GetProperties()->SetLocked(true);
+ myPrevLocked = myLocked;
+ myLocked = false;
+ }
+ }
+ void resume()
+ {
+ if (myPrevLocked) {
+ myStudy->GetProperties()->SetLocked(false);
+ myLocked = myPrevLocked;
+ myPrevLocked = false;
+ }
+ }
+ private:
+ SALOMEDSImpl_Study* myStudy;
+ bool myLocked;
+ bool myPrevLocked;
+ };
+}
+
//============================================================================
/*! Function : SALOMEDSImpl_StudyManager
* Purpose : SALOMEDSImpl_StudyManager constructor
delete hdf_file; // all related hdf objects will be deleted
+ // unlock study if it is locked, to set components versions
+ StudyUnlocker unlock(Study);
+
+ //For old studies we have to add "unknown" version tag for all stored components
+ SALOMEDSImpl_SComponentIterator itcomponent = Study->NewComponentIterator();
+ for (; itcomponent.More(); itcomponent.Next())
+ {
+ SALOMEDSImpl_SComponent sco = itcomponent.Value();
+ std::string aCompType = sco.GetComment();
+ if ( aCompType == SALOMEDSImpl_IParameters::getDefaultVisualComponent() ) continue;
+ if ( Study->GetProperties()->GetComponentVersions( aCompType ).empty() )
+ Study->GetProperties()->SetComponentVersion( aCompType, "" ); // empty version means "unknown"
+ }
+
return Study;
}
// add modifications list (user and date of save)
SALOMEDSImpl_AttributeStudyProperties* aProp = aStudy->GetProperties();
- int aLocked = aProp->IsLocked();
- if (aLocked) aProp->SetLocked(false);
+ // unlock study if it is locked, to set modification date
+ StudyUnlocker unlock(aStudy);
+
int month=0,day=0,year=0,hh=0,mn=0,ss=0;
SALOMEDSImpl_Tool::GetSystemDate(year, month, day, hh, mn, ss);
aProp->SetModification(SALOMEDSImpl_Tool::GetUserName(),
- mn, hh, day, month, year);
-
- if (aLocked) aProp->SetLocked(true);
+ mn, hh, day, month, year);
+
+ // lock study back if it was locked initially, to write correct value of Locked flag
+ unlock.suspend();
std::vector<std::string> aNames;
std::vector<int> aMinutes, aHours, aDays, aMonths, aYears;
std::string units = aProp->GetUnits();
std::string comment = aProp->GetComment();
- int aLength = 0, anIndex, i, unitsSize = 0, commentSize = 0;
+ std::map< std::string, std::vector<std::string> > allVersions = aProp->GetComponentsVersions();
+ std::map<std::string, std::string> versions;
+
+ int aLength = 0, aLength1 = 0, anIndex, i, unitsSize = 0, commentSize = 0;
+
for(i=1; i<=aNames.size(); i++)
aLength += aNames[i-1].size() + 1;
-
+
+ std::map< std::string, std::vector<std::string> >::const_iterator it;
+ for (it = allVersions.begin(); it != allVersions.end(); ++it ) {
+ std::string vlist = "";
+ std::vector<std::string> vl = it->second;
+ std::vector<std::string>::const_iterator vlit;
+ for ( vlit = vl.begin(); vlit != vl.end(); ++vlit ) {
+ if ( vlist != "" ) vlist += ";";
+ vlist += *vlit;
+ }
+ versions[ it->first ] = vlist;
+ aLength1 += it->first.size() + vlist.size() + 2;
+ }
+
unitsSize = units.size();
commentSize = comment.size();
//.....................................................,
//.....................................................,
//minutes, hours, day, months, year, user name, char(1), char(30) <- !!!! used to define end of section with modifications !!!!
- //units, char(1), comment, char(0)
+ //units, char(1), comment, char(30) <- !!!! used to define start of section with components' versions !!!!
+ //component=versions, char(1),
+ //component=versions, char(1),
+ //...........................,
+ //component=versions, char(1), char(0)
//string length: 1 byte = locked flag, 1 byte = modified flag, (12 + name length + 1) for each name and date, 1 byte (char(30) section delimeter)
// unit length + 1, comment length, "zero" byte
- char* aProperty = new char[3 + aLength + 12 * aNames.size() + 1 + unitsSize + 1 + commentSize ];
-
+ char* aProperty = new char[3 + aLength + 12 * aNames.size() + 1 + unitsSize + 1 + commentSize + 1 + aLength1 ];
sprintf(aProperty,"%c%c", (char)aProp->GetCreationMode(), (aProp->IsLocked())?'l':'u');
if(comment.size() > 0) {
sprintf(&(aProperty[a]),"%s",comment.c_str());
a = strlen(aProperty);
- a++;
+ }
+
+ aProperty[a++] = 30; //delimeter of the component versions
+
+ std::map<std::string, std::string>::const_iterator versionsIt;
+ for ( versionsIt = versions.begin(); versionsIt != versions.end(); ++versionsIt ) {
+ sprintf(&(aProperty[a]),"%s=%s",
+ (char*)(versionsIt->first.c_str()),
+ (char*)(versionsIt->second.c_str()));
+ a = a + versionsIt->first.size() + versionsIt->second.size() + 1;
+ aProperty[a++] = 1;
}
aProperty[a] = 0;
-
+
name_len = (hdf_int32) a;
size[0] = name_len + 1 ;
hdf_dataset = new HDFdataset("AttributeStudyProperties",hdf_group,HDF_STRING,size,1);
// Store previous URL
std::string anOldName = aStudy->Name();
+ // Map to store components' versions
+ std::map<std::string, std::string> componentVersions;
+
//Create a temporary url to which the study is saved
std::string aUrl = SALOMEDSImpl_Tool::GetTmpDir() + SALOMEDSImpl_Tool::GetNameFromPath(aStudyUrl);
- int aLocked = aStudy->GetProperties()->IsLocked();
- if (aLocked) aStudy->GetProperties()->SetLocked(false);
+ // unlock study if it is locked, as some attributes need to be modified
+ StudyUnlocker unlock(aStudy);
SALOMEDSImpl_StudyBuilder* SB= aStudy->NewBuilder();
std::map<std::string, SALOMEDSImpl_Driver*> aMapTypeDriver;
try
{
// mpv 15.12.2003: for saving components we have to load all data from all modules
- SALOMEDSImpl_SComponentIterator itcomponent1 = aStudy->NewComponentIterator();
- for (; itcomponent1.More(); itcomponent1.Next())
+ SALOMEDSImpl_SComponentIterator itcomponent = aStudy->NewComponentIterator();
+ for (; itcomponent.More(); itcomponent.Next())
{
- SALOMEDSImpl_SComponent sco = itcomponent1.Value();
+ SALOMEDSImpl_SComponent sco = itcomponent.Value();
// if there is an associated Engine call its method for saving
std::string IOREngine;
try {
+ SALOMEDSImpl_Driver* aDriver = NULL;
+ std::string aCompType = sco.GetComment();
if (!sco.ComponentIOR(IOREngine)) {
- std::string aCompType = sco.GetComment();
if (!aCompType.empty()) {
- SALOMEDSImpl_Driver* aDriver = aFactory->GetDriverByType(aCompType);
- aMapTypeDriver[aCompType] = aDriver;
+ aDriver = aFactory->GetDriverByType(aCompType);
if (aDriver != NULL) {
if(!SB->LoadWith(sco, aDriver)) {
}
}
}
+ else {
+ aDriver = aFactory->GetDriverByIOR(IOREngine);
+ }
+ aMapTypeDriver[aCompType] = aDriver;
} catch(...) {
_errorCode = "Can not restore information to resave it";
return false;
hdf_group_datacomponent = new HDFgroup("DATACOMPONENT",hdf_file);
hdf_group_datacomponent->CreateOnDisk();
- SALOMEDSImpl_SComponentIterator itcomponent = aStudy->NewComponentIterator();
-
- for (; itcomponent.More(); itcomponent.Next())
+ for (itcomponent.Init(); itcomponent.More(); itcomponent.Next())
{
SALOMEDSImpl_SComponent sco = itcomponent.Value();
std::string IOREngine;
if (sco.ComponentIOR(IOREngine))
{
- SALOMEDSImpl_Driver* Engine = NULL;
- if(aMapTypeDriver.find(componentDataType) != aMapTypeDriver.end()) {
- // we have found the associated engine to write the data
- Engine = aMapTypeDriver[componentDataType];
- }
- else {
- Engine = aFactory->GetDriverByIOR(IOREngine);
- }
-
+ // Engine should be already in the map as it was to added before
+ SALOMEDSImpl_Driver* Engine = aMapTypeDriver[componentDataType];
if (Engine != NULL)
{
SALOMEDSImpl_TMPFile* aStream = NULL;
long length = 0;
+ componentVersions[ componentDataType ] = Engine->Version();
+
if (theASCII) aStream = Engine->SaveASCII(sco,
SALOMEDSImpl_Tool::GetDirFromPath(aUrl),
length,
hdf_group_study_structure = new HDFgroup("STUDY_STRUCTURE",hdf_file);
hdf_group_study_structure->CreateOnDisk();
// save component attributes
- SALOMEDSImpl_SComponentIterator itcomp = aStudy->NewComponentIterator();
- for (; itcomp.More(); itcomp.Next())
+ for (itcomponent.Init(); itcomponent.More(); itcomponent.Next())
{
- SALOMEDSImpl_SComponent SC = itcomp.Value();
+ SALOMEDSImpl_SComponent SC = itcomponent.Value();
std::string scid = SC.GetID();
hdf_sco_group2 = new HDFgroup((char*)scid.c_str(), hdf_group_study_structure);
hdf_sco_group2->CreateOnDisk();
}
hdf_notebook_vars->CloseOnDisk();
hdf_notebook_vars = 0; //will be deleted by hdf_sco_group destructor
-
- if (aLocked) aStudy->GetProperties()->SetLocked(true);
+
+ // record component versions
+ std::map<std::string, std::string>::const_iterator itVersions;
+ for ( itVersions = componentVersions.begin(); itVersions != componentVersions.end(); ++itVersions )
+ aStudy->GetProperties()->SetComponentVersion( itVersions->first, itVersions->second );
+
+ // lock study back if it was locked initially, to write correct value of Locked flag
+ unlock.suspend();
+
//-----------------------------------------------------------------------
//6 - Write the Study Properties
//-----------------------------------------------------------------------