runSalome.py \
salomeConsole.py \
salome_session.py \
- salome_utilities.py \
+ salome_utils.py \
server.py \
setenv.py \
showNS.py \
elif info==port print host
else print 2 strings on stdout on one line: host port
"""
- from salome_utilities import getORBcfgInfo
+ from salome_utils import getORBcfgInfo
my_version, my_host, my_port = getORBcfgInfo()
if info=='host':
# keep print, stdout used in shell
Detect current SALOME session's port number.
Returns port number.
"""
- from salome_utilities import getPortNumber
+ from salome_utils import getPortNumber
port = getPortNumber()
if verbose(): print "myport = ", port
return port
"""
user = os.getenv('USER')
# new-style dot-prefixed pidict file
- fpidict = getPiDict('(\d*)',hidden=True)
+ #fpidict = getPiDict('(\d*)',hidden=True)
+ #problem with WIN32 path slashes
+ fpidict = getPiDict('#####',hidden=True)
dirpidict = os.path.dirname(fpidict)
fpidict = os.path.basename(fpidict)
+ fpidict = fpidict.replace('#####', '(\d*)')
fnamere = re.compile("^%s$" % fpidict)
try:
for f in os.listdir(dirpidict):
except:
pass
# provide compatibility with old-style pidict file (not dot-prefixed)
- fpidict = getPiDict('(\d*)',hidden=False)
+ #fpidict = getPiDict('(\d*)',hidden=False)
+ fpidict = getPiDict('#####',hidden=True)
dirpidict = os.path.dirname(fpidict)
fpidict = os.path.basename(fpidict)
+ fpidict = fpidict.replace('#####', '(\d*)')
fnamere = re.compile("^%s$" % fpidict)
try:
for f in os.listdir(dirpidict):
- hidden : if True, file name is prefixed with . (dot) symbol; this internal parameter is used
to support compatibility with older versions of SALOME
"""
- from salome_utilities import generateFileName, getTmpDir
+ from salome_utils import generateFileName, getTmpDir
dir = ""
if full:
# full path to the pidict file is requested
- ${HOME}/${APPLI}/.omniORB_last.cfg
the last is removed only if the link points to the first file.
"""
- from salome_utilities import generateFileName
+ from salome_utils import generateFileName
home = os.getenv("HOME")
appli = os.getenv("APPLI")
if appli is None:
try:
fpid = open(filedict, 'r')
#
- from salome_utilities import generateFileName
+ from salome_utils import generateFileName
fpidomniNames = generateFileName(os.path.join('/tmp/logs', os.getenv('USER')),
prefix="",
suffix="Pid_omniNames",
def __init__(self,args):
self.args=args
self.initArgs()
- from salome_utilities import generateFileName
+ from salome_utils import generateFileName
if sys.platform == "win32": dirpath = os.environ["HOME"]
else: dirpath = "/tmp"
logfile = generateFileName( dirpath,
if not portIsUsed(NSPORT, ports):
print "%s - OK"%(NSPORT)
#
- from salome_utilities import generateFileName, getHostName
+ from salome_utils import generateFileName, getHostName
hostname = getHostName()
#
home = os.getenv("HOME")
def main():
"""Salome launch as a main application"""
import sys
- from salome_utilities import getHostName
+ from salome_utils import getHostName
print "runSalome running on %s" % getHostName()
args, modules_list, modules_root_dir = setenv.get_config()
kill_salome(args)
socket.gethostname() gives short or complete Hostname, depending on
defined aliases.
"""
- from salome_utilities import getShortHostName
+ from salome_utils import getShortHostName
return getShortHostName()
def searchFreePort():
Returns first found free port number.
"""
print "Searching a free port for naming service:",
- from salome_utilities import generateFileName, getHostName
+ from salome_utils import generateFileName, getHostName
hostname = getHostName()
NSPORT = 2810
limit = NSPORT+100
+++ /dev/null
-# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG
-# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# ---
-#
-# File : salome_utilities.py
-# Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-#
-# ---
-
-"""
-Set of utility functions used by SALOME python scripts.
-"""
-
-#
-# Exported functions
-#
-__all__ = [
- 'getORBcfgInfo',
- 'getHostFromORBcfg',
- 'getPortFromORBcfg',
- 'getUserName',
- 'getHostName',
- 'getShortHostName',
- 'getAppName',
- 'getPortNumber',
- 'getTmpDir',
- 'generateFileName',
- ]
-
-# ---
-
-def _try_bool( arg ):
- """
- Check if specified parameter represents boolean value and returns its value.
- String values like 'True', 'TRUE', 'YES', 'Yes', 'y', 'NO', 'false', 'n', etc
- are supported.
- If <arg> does not represent a boolean, an exception is raised.
- """
- import types
- if type( arg ) == types.BooleanType :
- return arg
- elif type( arg ) == types.StringType :
- v = str( arg ).lower()
- if v in [ "yes", "y", "true" ]: return True
- elif v in [ "no", "n", "false" ]: return False
- pass
- raise Exception("Not boolean value")
-
-# ---
-
-def getORBcfgInfo():
- """
- Get omniORB current configuration.
- Returns a list of three values: [ orb_version, host_name, port_number ].
-
- The information is retrieved from the omniORB configuration file defined
- by the OMNIORB_CONFIG environment variable.
- If omniORB configuration file can not be accessed, a list of three empty
- strings is returned.
- """
- import os, re
- ret = [ "", "", "" ]
- try:
- f = open( os.getenv( "OMNIORB_CONFIG" ) )
- lines = f.readlines()
- f.close()
- regvar = re.compile( "(ORB)?InitRef.*corbaname::(.*):(\d+)\s*$" )
- for l in lines:
- try:
- m = regvar.match( l )
- if m:
- if m.group(1) is None:
- ret[0] = "4"
- else:
- ret[0] = "3"
- pass
- ret[1] = m.group(2)
- ret[2] = m.group(3)
- break
- pass
- except:
- pass
- pass
- pass
- except:
- pass
- return ret
-
-# ---
-
-def getHostFromORBcfg():
- """
- Get current omniORB host.
- """
- return getORBcfgInfo()[1]
-# ---
-
-def getPortFromORBcfg():
- """
- Get current omniORB port.
- """
- return getORBcfgInfo()[2]
-
-# ---
-
-def getUserName():
- """
- Get user name:
- 1. try USER environment variable
- 2. if fails, return 'unknown' as default user name
- """
- import os
- return os.getenv( "USER", "unknown" ) # 'unknown' is default user name
-
-# ---
-
-def getHostName():
- """
- Get host name:
- 1. try socket python module gethostname() function
- 2. if fails, try HOSTNAME environment variable
- 3. if fails, try HOST environment variable
- 4. if fails, return 'unknown' as default host name
- """
- import os
- try:
- import socket
- host = socket.gethostname()
- except:
- host = None
- pass
- if not host: host = os.getenv("HOSTNAME")
- if not host: host = os.getenv("HOST")
- if not host: host = "unknown" # 'unknown' is default host name
- return host
-
-# ---
-
-def getShortHostName():
- """
- Get short host name:
- 1. try socket python module gethostname() function
- 2. if fails, try HOSTNAME environment variable
- 3. if fails, try HOST environment variable
- 4. if fails, return 'unknown' as default host name
- """
- try:
- return getHostName().split('.')[0]
- except:
- pass
- return "unknown" # 'unknown' is default host name
-
-# ---
-
-def getAppName():
- """
- Get application name:
- 1. try APPNAME environment variable
- 2. if fails, return 'SALOME' as default application name
- """
- import os
- return os.getenv( "APPNAME", "SALOME" ) # 'SALOME' is default user name
-
-# ---
-
-def getPortNumber():
- """
- Get current naming server port number:
- 1. try NSPORT environment variable
- 1. if fails, try to parse config file defined by OMNIORB_CONFIG environment variable
- 2. if fails, return 2809 as default port number
- """
- import os
- try:
- return int( os.getenv( "NSPORT" ) )
- except:
- pass
- port = getPortFromORBcfg()
- if port is not None: return port
- return 2809 # '2809' is default port number
-
-# ---
-
-def getTmpDir():
- """
- Get directory to be used for the temporary files.
- """
- import os, sys
- if sys.platform == "win32":
- # for Windows: temporarily using home directory for tmp files;
- # to be replaced with TEMP environment variable later...
- dir = os.getenv("HOME")
- else:
- # for Linux: use /tmp/logs/{user} folder
- dir = os.path.join( '/tmp', 'logs', getUserName() )
- pass
- return dir
-
-# ---
-
-def generateFileName( dir, prefix = None, suffix = None, extension = None,
- unique = False, separator = "_", hidden = False, **kwargs ):
- """
- Generate file name by sepecified parameters. If necessary, file name
- can be generated to be unique.
-
- Parameters:
- - dir : directory path
- - prefix : file prefix (not added by default)
- - suffix : file suffix (not added by default)
- - extension : file extension (not added by default)
- - unique : if this parameter is True, the unique file name is generated:
- in this case, if the file with the generated name already exists
- in the <dir> directory, an integer suffix is added to the end of the
- file name. This parameter is False by default.
- - separator : separator of the words ('_' by default)
- - hidden : if this parameter is True, the file name is prepended by . (dot)
- symbol. This parameter is False by default.
-
- Other keyword parameters are:
- - with_username : 'add user name' flag/option:
- * boolean value can be passed to determine user name automatically
- * string value to be used as user name
- - with_hostname : 'add host name' flag/option:
- * boolean value can be passed to determine host name automatically
- * string value to be used as host name
- - with_port : 'add port number' flag/option:
- * boolean value can be passed to determine port number automatically
- * string value to be used as port number
- - with_app : 'add application name' flag/option:
- * boolean value can be passed to determine application name automatically
- * string value to be used as application name
- All <with_...> parameters are optional.
- """
- supported = [ 'with_username', 'with_hostname', 'with_port', 'with_app' ]
- from launchConfigureParser import verbose
- filename = []
- # separator
- if separator is None:
- separator = ""
- pass
- else:
- separator = str( separator )
- pass
- # prefix (if specified)
- if prefix is not None:
- filename.append( str( prefix ) )
- pass
- # additional keywords
- ### check unsupported parameters
- for kw in kwargs:
- if kw not in supported and verbose():
- print 'Warning! salome_utilitie.py: generateFileName(): parameter %s is not supported' % kw
- pass
- pass
- ### process supported keywords
- for kw in supported:
- if kw not in kwargs: continue
- ### user name
- if kw == 'with_username':
- try:
- # auto user name ?
- if _try_bool( kwargs[kw] ): filename.append( getUserName() )
- pass
- except:
- # user name given as parameter
- filename.append( kwargs[kw] )
- pass
- pass
- ### host name
- elif kw == 'with_hostname':
- try:
- # auto host name ?
- if _try_bool( kwargs[kw] ): filename.append( getShortHostName() )
- pass
- except:
- # host name given as parameter
- filename.append( kwargs[kw] )
- pass
- pass
- ### port number
- elif kw == 'with_port':
- try:
- # auto port number ?
- if _try_bool( kwargs[kw] ): filename.append( str( getPortNumber() ) )
- pass
- except:
- # port number given as parameter
- filename.append( str( kwargs[kw] ) )
- pass
- pass
- ### application name
- elif kw == 'with_app':
- try:
- # auto application name ?
- if _try_bool( kwargs[kw] ): filename.append( getAppName() )
- pass
- except:
- # application name given as parameter
- filename.append( kwargs[kw] )
- pass
- pass
- pass
- # suffix (if specified)
- if suffix is not None:
- filename.append( str( suffix ) )
- pass
- # raise an exception if file name is empty
- if not filename:
- raise Exception("Empty file name")
- #
- if extension is not None and extension.startswith("."): extension = extension[1:]
- #
- import os
- name = separator.join( filename )
- if hidden: name = "." + name # add dot for hidden files
- if extension: name = name + "." + str( extension ) # add extension if defined
- name = os.path.join( dir, name )
- if unique:
- # create unique file name
- index = 0
- while os.path.exists( name ):
- index = index + 1
- name = separator.join( filename ) + separator + str( index )
- if hidden: name = "." + name # add dot for hidden files
- if extension: name = name + "." + str( extension ) # add extension if defined
- name = os.path.join( dir, name )
- pass
- pass
- return name
--- /dev/null
+# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG
+# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# ---
+#
+# File : salome_utils.py
+# Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+#
+# ---
+
+"""
+Set of utility functions used by SALOME python scripts.
+"""
+
+#
+# Exported functions
+#
+__all__ = [
+ 'getORBcfgInfo',
+ 'getHostFromORBcfg',
+ 'getPortFromORBcfg',
+ 'getUserName',
+ 'getHostName',
+ 'getShortHostName',
+ 'getAppName',
+ 'getPortNumber',
+ 'getTmpDir',
+ 'generateFileName',
+ ]
+
+# ---
+
+def _try_bool( arg ):
+ """
+ Check if specified parameter represents boolean value and returns its value.
+ String values like 'True', 'TRUE', 'YES', 'Yes', 'y', 'NO', 'false', 'n', etc
+ are supported.
+ If <arg> does not represent a boolean, an exception is raised.
+ """
+ import types
+ if type( arg ) == types.BooleanType :
+ return arg
+ elif type( arg ) == types.StringType :
+ v = str( arg ).lower()
+ if v in [ "yes", "y", "true" ]: return True
+ elif v in [ "no", "n", "false" ]: return False
+ pass
+ raise Exception("Not boolean value")
+
+# ---
+
+def getORBcfgInfo():
+ """
+ Get omniORB current configuration.
+ Returns a list of three values: [ orb_version, host_name, port_number ].
+
+ The information is retrieved from the omniORB configuration file defined
+ by the OMNIORB_CONFIG environment variable.
+ If omniORB configuration file can not be accessed, a list of three empty
+ strings is returned.
+ """
+ import os, re
+ ret = [ "", "", "" ]
+ try:
+ f = open( os.getenv( "OMNIORB_CONFIG" ) )
+ lines = f.readlines()
+ f.close()
+ regvar = re.compile( "(ORB)?InitRef.*corbaname::(.*):(\d+)\s*$" )
+ for l in lines:
+ try:
+ m = regvar.match( l )
+ if m:
+ if m.group(1) is None:
+ ret[0] = "4"
+ else:
+ ret[0] = "3"
+ pass
+ ret[1] = m.group(2)
+ ret[2] = m.group(3)
+ break
+ pass
+ except:
+ pass
+ pass
+ pass
+ except:
+ pass
+ return ret
+
+# ---
+
+def getHostFromORBcfg():
+ """
+ Get current omniORB host.
+ """
+ return getORBcfgInfo()[1]
+# ---
+
+def getPortFromORBcfg():
+ """
+ Get current omniORB port.
+ """
+ return getORBcfgInfo()[2]
+
+# ---
+
+def getUserName():
+ """
+ Get user name:
+ 1. try USER environment variable
+ 2. if fails, return 'unknown' as default user name
+ """
+ import os
+ return os.getenv( "USER", "unknown" ) # 'unknown' is default user name
+
+# ---
+
+def getHostName():
+ """
+ Get host name:
+ 1. try socket python module gethostname() function
+ 2. if fails, try HOSTNAME environment variable
+ 3. if fails, try HOST environment variable
+ 4. if fails, return 'unknown' as default host name
+ """
+ import os
+ try:
+ import socket
+ host = socket.gethostname()
+ except:
+ host = None
+ pass
+ if not host: host = os.getenv("HOSTNAME")
+ if not host: host = os.getenv("HOST")
+ if not host: host = "unknown" # 'unknown' is default host name
+ return host
+
+# ---
+
+def getShortHostName():
+ """
+ Get short host name:
+ 1. try socket python module gethostname() function
+ 2. if fails, try HOSTNAME environment variable
+ 3. if fails, try HOST environment variable
+ 4. if fails, return 'unknown' as default host name
+ """
+ try:
+ return getHostName().split('.')[0]
+ except:
+ pass
+ return "unknown" # 'unknown' is default host name
+
+# ---
+
+def getAppName():
+ """
+ Get application name:
+ 1. try APPNAME environment variable
+ 2. if fails, return 'SALOME' as default application name
+ """
+ import os
+ return os.getenv( "APPNAME", "SALOME" ) # 'SALOME' is default user name
+
+# ---
+
+def getPortNumber():
+ """
+ Get current naming server port number:
+ 1. try NSPORT environment variable
+ 1. if fails, try to parse config file defined by OMNIORB_CONFIG environment variable
+ 2. if fails, return 2809 as default port number
+ """
+ import os
+ try:
+ return int( os.getenv( "NSPORT" ) )
+ except:
+ pass
+ port = getPortFromORBcfg()
+ if port is not None: return port
+ return 2809 # '2809' is default port number
+
+# ---
+
+def getTmpDir():
+ """
+ Get directory to be used for the temporary files.
+ """
+ import os, sys
+ if sys.platform == "win32":
+ # for Windows: temporarily using home directory for tmp files;
+ # to be replaced with TEMP environment variable later...
+ dir = os.getenv("HOME")
+ else:
+ # for Linux: use /tmp/logs/{user} folder
+ dir = os.path.join( '/tmp', 'logs', getUserName() )
+ pass
+ return dir
+
+# ---
+
+def generateFileName( dir, prefix = None, suffix = None, extension = None,
+ unique = False, separator = "_", hidden = False, **kwargs ):
+ """
+ Generate file name by sepecified parameters. If necessary, file name
+ can be generated to be unique.
+
+ Parameters:
+ - dir : directory path
+ - prefix : file prefix (not added by default)
+ - suffix : file suffix (not added by default)
+ - extension : file extension (not added by default)
+ - unique : if this parameter is True, the unique file name is generated:
+ in this case, if the file with the generated name already exists
+ in the <dir> directory, an integer suffix is added to the end of the
+ file name. This parameter is False by default.
+ - separator : separator of the words ('_' by default)
+ - hidden : if this parameter is True, the file name is prepended by . (dot)
+ symbol. This parameter is False by default.
+
+ Other keyword parameters are:
+ - with_username : 'add user name' flag/option:
+ * boolean value can be passed to determine user name automatically
+ * string value to be used as user name
+ - with_hostname : 'add host name' flag/option:
+ * boolean value can be passed to determine host name automatically
+ * string value to be used as host name
+ - with_port : 'add port number' flag/option:
+ * boolean value can be passed to determine port number automatically
+ * string value to be used as port number
+ - with_app : 'add application name' flag/option:
+ * boolean value can be passed to determine application name automatically
+ * string value to be used as application name
+ All <with_...> parameters are optional.
+ """
+ supported = [ 'with_username', 'with_hostname', 'with_port', 'with_app' ]
+ from launchConfigureParser import verbose
+ filename = []
+ # separator
+ if separator is None:
+ separator = ""
+ pass
+ else:
+ separator = str( separator )
+ pass
+ # prefix (if specified)
+ if prefix is not None:
+ filename.append( str( prefix ) )
+ pass
+ # additional keywords
+ ### check unsupported parameters
+ for kw in kwargs:
+ if kw not in supported and verbose():
+ print 'Warning! salome_utilitie.py: generateFileName(): parameter %s is not supported' % kw
+ pass
+ pass
+ ### process supported keywords
+ for kw in supported:
+ if kw not in kwargs: continue
+ ### user name
+ if kw == 'with_username':
+ try:
+ # auto user name ?
+ if _try_bool( kwargs[kw] ): filename.append( getUserName() )
+ pass
+ except:
+ # user name given as parameter
+ filename.append( kwargs[kw] )
+ pass
+ pass
+ ### host name
+ elif kw == 'with_hostname':
+ try:
+ # auto host name ?
+ if _try_bool( kwargs[kw] ): filename.append( getShortHostName() )
+ pass
+ except:
+ # host name given as parameter
+ filename.append( kwargs[kw] )
+ pass
+ pass
+ ### port number
+ elif kw == 'with_port':
+ try:
+ # auto port number ?
+ if _try_bool( kwargs[kw] ): filename.append( str( getPortNumber() ) )
+ pass
+ except:
+ # port number given as parameter
+ filename.append( str( kwargs[kw] ) )
+ pass
+ pass
+ ### application name
+ elif kw == 'with_app':
+ try:
+ # auto application name ?
+ if _try_bool( kwargs[kw] ): filename.append( getAppName() )
+ pass
+ except:
+ # application name given as parameter
+ filename.append( kwargs[kw] )
+ pass
+ pass
+ pass
+ # suffix (if specified)
+ if suffix is not None:
+ filename.append( str( suffix ) )
+ pass
+ # raise an exception if file name is empty
+ if not filename:
+ raise Exception("Empty file name")
+ #
+ if extension is not None and extension.startswith("."): extension = extension[1:]
+ #
+ import os
+ name = separator.join( filename )
+ if hidden: name = "." + name # add dot for hidden files
+ if extension: name = name + "." + str( extension ) # add extension if defined
+ name = os.path.join( dir, name )
+ if unique:
+ # create unique file name
+ index = 0
+ while os.path.exists( name ):
+ index = index + 1
+ name = separator.join( filename ) + separator + str( index )
+ if hidden: name = "." + name # add dot for hidden files
+ if extension: name = name + "." + str( extension ) # add extension if defined
+ name = os.path.join( dir, name )
+ pass
+ pass
+ return name
return
home_dir = os.path.expanduser(options.prefix)
+ #try to find python version of salome application and put it in versio
+ pys=[os.path.split(s)[1] for s in glob.glob(os.path.join(home_dir,get_lib_dir(),"python*.*"))]
+ if not pys :
+ versio=None
+ else:
+ versio=pys[0]
+
+ pys=[os.path.split(s)[1] for s in glob.glob(os.path.join(module_dir,get_lib_dir(),"python*.*"))]
+ #check if the module has a python version compatible with application version
+ if not pys :
+ pyversio=versio or py_version
+ elif versio is None:
+ pyversio=pys[0]
+ elif versio in pys:
+ pyversio=versio
+ else:
+ #incompatible python versions
+ print "incompatible python versions : application has version %s and module %s has not" % (versio,module_dir)
+ return
module_bin_dir=os.path.join(module_dir,'bin','salome')
+ module_idl_dir=os.path.join(module_dir,'idl','salome')
module_lib_dir=os.path.join(module_dir,get_lib_dir(),'salome')
- module_lib_py_dir=os.path.join(module_dir,get_lib_dir(),py_version,'site-packages','salome')
- module_lib_py_shared_dir=os.path.join(module_dir,get_lib_dir(),py_version,
+ module_lib_py_dir=os.path.join(module_dir,get_lib_dir(),pyversio,'site-packages','salome')
+ module_lib_py_shared_dir=os.path.join(module_dir,get_lib_dir(),pyversio,
'site-packages','salome','shared_modules')
module_share_dir=os.path.join(module_dir,'share','salome','resources')
module_doc_gui_dir=os.path.join(module_dir,'doc','salome','gui')
module_sharedoc_tui_dir=os.path.join(module_dir,'share','doc','salome','tui')
bin_dir=os.path.join(home_dir,'bin','salome')
+ idl_dir=os.path.join(home_dir,'idl','salome')
lib_dir=os.path.join(home_dir,'lib','salome')
- lib_py_dir=os.path.join(home_dir,'lib',py_version,'site-packages','salome')
- lib_py_shared_dir=os.path.join(home_dir,'lib',py_version,
+ lib_py_dir=os.path.join(home_dir,'lib',pyversio,'site-packages','salome')
+ lib_py_shared_dir=os.path.join(home_dir,'lib',pyversio,
'site-packages','salome','shared_modules')
share_dir=os.path.join(home_dir,'share','salome','resources')
doc_gui_dir=os.path.join(home_dir,'doc','salome','gui')
if options.clear:
rmtree(bin_dir)
+ rmtree(idl_dir)
rmtree(lib_dir)
rmtree(lib_py_dir)
rmtree(share_dir)
print module_bin_dir, " doesn't exist"
pass
+ #directory idl/salome : create it and link content
+ if os.path.exists(module_idl_dir):
+ mkdir(idl_dir)
+ for fn in os.listdir(module_idl_dir):
+ symlink(os.path.join(module_idl_dir, fn), os.path.join(idl_dir, fn))
+ else:
+ print module_idl_dir, " doesn't exist"
+
#directory lib/salome : create it and link content
if os.path.exists(module_lib_dir):
mkdir(lib_dir)
print module_lib_dir, " doesn't exist"
pass
- #directory lib/py_version/site-packages/salome : create it and link content
+ #directory lib/pyversio/site-packages/salome : create it and link content
if not os.path.exists(module_lib_py_dir):
print "Python directory %s does not exist" % module_lib_py_dir
else:
-rm -rf SALOMEconfig.h SALOMEconfig.h.in
SALOMEconfig.h.in : SALOMEconfig.ref.in
- cp -p $< $@;
+ cp -pf $< $@;
# test if SALOMEconfig.ref has changed (contents), at build time
SALOMEconfig.h: $(top_builddir)/salome_adm/unix/SALOMEconfig.ref
- @if ! [ -a $@ ]; then \
- echo cp -p $< $@; \
- cp -p $< $@; \
- fi; \
+ @if ! [ -a $@ ]; then \
+ echo cp -pf $< $@; \
+ cp -pf $< $@; \
+ fi; \
if ! cmp -s $< $@; then \
- echo cp -p $< $@; \
- cp -p $< $@; \
+ echo cp -pf $< $@; \
+ cp -pf $< $@; \
fi;
# The deprecated files are deprecated for the KERNEL but not for the
void HouseKeeping();
std::list<PROTECTED_DELETE*> PROTECTED_DELETE::_objList;
-#ifndef WNT
+#ifndef WIN32
pthread_mutex_t PROTECTED_DELETE::_listMutex;
#else
pthread_mutex_t PROTECTED_DELETE::_listMutex =
#ifndef _BASICGENERICDESTRUCTOR_HXX_
#define _BASICGENERICDESTRUCTOR_HXX_
-#ifdef WNT
- #if defined BASICS_EXPORTS
- #if defined WIN32
- #define BASICS_EXPORT __declspec( dllexport )
- #else
- #define BASICS_EXPORT
- #endif
- #else
- #if defined WIN32
- #define BASICS_EXPORT __declspec( dllimport )
- #else
- #define BASICS_EXPORT
- #endif
- #endif
-#else
- #define BASICS_EXPORT
-#endif
+#include "SALOME_Basics.hxx"
#include <list>
#include <algorithm>
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : Basics_DirUtils.cxx
+// Autor : Alexander A. BORODIN
+// Module : SALOME
+
+#include "Basics_DirUtils.hxx"
+
+#include <errno.h>
+#include <stdlib.h>
+
+#ifndef WIN32
+# include <sys/stat.h>
+# include <dirent.h>
+#else
+# include <windows.h>
+# include <time.h>
+#endif
+
+using namespace std;
+
+#ifdef WIN32
+# define _separator_ '\\'
+#else
+# define _separator_ '/'
+#endif
+
+namespace Kernel_Utils
+{
+ string GetTmpDirByEnv( const std::string& tmp_path_env )
+ {
+ string dir;
+ char* val = getenv( tmp_path_env.c_str() );
+ val ? dir = string( val ) : "";
+ return GetTmpDirByPath( dir );
+ }
+
+ string GetTmpDirByPath( const std::string& tmp_path )
+ {
+ string aTmpDir = tmp_path;
+ if ( aTmpDir == "" )
+ {
+#ifdef WIN32
+ char *Tmp_dir = getenv("TEMP");
+ if( Tmp_dir == NULL )
+ {
+ Tmp_dir = getenv("TMP");
+ if (Tmp_dir == NULL)
+ aTmpDir = string("C:\\");
+ else
+ aTmpDir = string(Tmp_dir);
+ }
+ else
+ aTmpDir = string(Tmp_dir);
+#else
+ aTmpDir = string("/tmp/");
+#endif
+ }
+
+ if(aTmpDir[aTmpDir.size()-1] != _separator_)
+ aTmpDir+=_separator_;
+
+ srand((unsigned int)time(NULL));
+ int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory
+ char buffer[127];
+ sprintf(buffer, "%d", aRND);
+ string aSubDir(buffer);
+ if(aSubDir.size() <= 1) aSubDir = string("123409876");
+
+ aTmpDir += aSubDir; //Get RND sub directory
+
+ string aDir = aTmpDir;
+
+ if(IsExists(aDir)) {
+ for(aRND = 0; IsExists(aDir); aRND++) {
+ sprintf(buffer, "%d", aRND);
+ aDir = aTmpDir+buffer; //Build a unique directory name
+ }
+ }
+
+ if(aDir[aDir.size()-1] != _separator_) aDir += _separator_;
+
+#ifdef WIN32
+ CreateDirectory(aDir.c_str(), NULL);
+#else
+ mkdir(aDir.c_str(), 0x1ff);
+#endif
+
+ return aDir;
+ }
+
+ //============================================================================
+ // function : GetTempDir
+ // purpose : Returns a temp directory to store created files like "/tmp/sub_dir/"
+ //============================================================================
+ string GetTmpDir()
+ {
+ return GetTmpDirByPath( "" );
+ }
+
+ //============================================================================
+ // function : GetTempFileName
+ // purpose : Returns the unique temporary file name without any extension /tmp/something/file for Unix or c:\something\file for WIN32
+ //============================================================================
+ string GetTmpFileName()
+ {
+ string tmpDir = GetTmpDir();
+ string aFilePath = "";
+ if(IsExists(tmpDir)) {
+ srand((unsigned int)time(NULL));
+ int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory
+ char buffer[127];
+ sprintf(buffer, "%d", aRND);
+ string aSubDir(buffer);
+ if(aSubDir.size() <= 1) aSubDir = string("123409876");
+
+ aFilePath = tmpDir;
+ for(aRND = 0; IsExists(aFilePath); aRND++) {
+ sprintf(buffer, "%d", aRND);
+ aFilePath = tmpDir+buffer; //Build a unique file name
+ }
+ }
+ return aFilePath;
+ }
+
+ //============================================================================
+ // function : IsExists
+ // purpose : Returns True(False) if the path (not)exists
+ //============================================================================
+ bool IsExists(const string& thePath)
+ {
+#ifdef WIN32
+ if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
+ if ( GetLastError () == ERROR_FILE_NOT_FOUND ) {
+ return false;
+ }
+ }
+#else
+ int status = access ( thePath.c_str() , F_OK );
+ if (status != 0) return false;
+#endif
+ return true;
+ }
+
+ //============================================================================
+ // function : GetDirByPath
+ // purpose : Returns directory by path and converts it to native system format
+ //============================================================================
+ string GetDirByPath(const string& thePath)
+ {
+ if (thePath.empty())
+ return "";
+ string path = thePath;
+ string::size_type length = path.length();
+
+ //detect all separators in Unix format
+ for ( int i = 0; i < length; i++ )
+ {
+ if( path[i] == '/' )
+ path[i] = '|';
+ }
+
+ //detect all separators in Windows format
+ for ( int i = 0; i < length; i++ )
+ {
+ if( path[i] == '\\' )
+ path[i] = '|';
+ }
+
+
+ string::size_type pos = path.rfind('|');
+ if ( pos == string::npos )
+ {
+#ifdef WIN32
+ //check for disk letter ( C: )
+ if ( path.length() == 2 && path[1] == ':' )
+ path += _separator_;
+#else
+ //not valid path
+ return "";
+#endif
+ }
+ else
+ {
+ //remove right subdirectory or filename from path
+ path = path.substr( 0, pos );
+ }
+
+ length = path.length();
+ for ( int i = 0; i < length; i++ )
+ {
+ if( path[i] == '|' )
+ path[i] = _separator_;
+ }
+ return path;
+ }
+
+ //============================================================================
+ // function : IsEmptyDir
+ // purpose : Returns True(False) if the path (not) empty
+ // Also returns False if the path is not valid
+ //============================================================================
+ bool IsEmptyDir(const string& thePath)
+ {
+ if ( thePath.empty() || !IsExists(thePath))
+ return false;
+
+ bool result = false;
+
+#ifdef WIN32
+ WIN32_FIND_DATA aFileData;
+ HANDLE hFile = FindFirstFile( thePath.c_str(), &aFileData );
+ if ( hFile == INVALID_HANDLE_VALUE )
+ {
+ //empty dir
+ result = true;
+ }
+ else
+ {
+ //close serching. path is not empty
+ FindClose( hFile );
+ }
+#else
+ DIR *dp;
+ struct dirent *dirp;
+ if((dp = opendir(thePath.c_str())) == NULL)
+ {
+ //Could not open directory
+ return false;
+ }
+ else
+ {
+ result = true; //empty if no file found
+ while ((dirp = readdir(dp)) != NULL && result )
+ {
+ string file_name(dirp->d_name);
+ result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false
+ }
+ closedir(dp);
+ }
+#endif
+ return result;
+ }
+}
--- /dev/null
+// SALOME Utils : general SALOME's definitions and tools
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : Basics_DirUtils.hxx
+// Autor : Alexander A. BORODIN
+// Module : SALOME
+
+#ifndef _Basics_DIRUTILS_HXX_
+#define _Basics_DIRUTILS_HXX_
+
+#include "SALOME_Basics.hxx"
+
+#include <string>
+
+namespace Kernel_Utils
+{
+ // Returns the unique temporary directory, that is defined in tmp_path_env if this variable is set
+ // otherwise return /tmp/something/ for Unix or c:\something\ for WIN32
+ BASICS_EXPORT std::string GetTmpDirByEnv( const std::string& tmp_path_env );
+
+ // Returns the unique temporary directory, that is defined in tmp_path if this variable is set
+ // otherwise return /tmp/something/ for Unix or c:\something\ for WIN32
+ BASICS_EXPORT std::string GetTmpDirByPath( const std::string& tmp_path );
+
+ // Returns the unique temporary directory in
+ // /tmp/something/ for Unix or c:\something\ for WIN32
+ BASICS_EXPORT std::string GetTmpDir();
+
+
+ // Returns the unique temporary file name without any extension
+ // /tmp/something/file for Unix or c:\something\file for WIN32
+ BASICS_EXPORT std::string GetTmpFileName();
+
+ // Returns True(False) if the path (not)exists
+ BASICS_EXPORT bool IsExists( const std::string& path );
+
+ // Returns directory by path and converts it to native system format
+ BASICS_EXPORT std::string GetDirByPath( const std::string& path );
+
+ // Returns True(False) if the path (not) empty
+ // Also returns False if the path is not valid
+ BASICS_EXPORT bool IsEmptyDir( const std::string& path );
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : Basics_Utils.cxx
+// Autor : Alexander A. BORODIN
+// Module : SALOME
+
+#include "Basics_Utils.hxx"
+#include <string.h>
+
+#ifndef WIN32
+#include <unistd.h>
+#include <sys/stat.h>
+#else
+#include <winsock2.h>
+#endif
+
+using namespace std;
+
+namespace Kernel_Utils
+{
+ string GetHostname()
+ {
+ int ls = 100, r = 1;
+ char *s;
+
+ while (ls < 10000 && r)
+ {
+ ls *= 2;
+ s = new char[ls];
+ r = gethostname(s, ls-1);
+ switch (r)
+ {
+ case 0:
+ break;
+ default:
+#ifdef EINVAL
+ case EINVAL:
+#endif
+#ifdef ENAMETOOLONG
+ case ENAMETOOLONG:
+#endif
+#ifdef WIN32
+ case WSAEFAULT:
+#endif
+ delete [] s;
+ continue;
+ }
+
+ }
+
+ if (r != 0)
+ {
+ s = new char[50];
+ strcpy(s, "localhost");
+ }
+
+ // remove all after '.'
+ char *aDot = (strchr(s,'.'));
+ if (aDot) aDot[0] = '\0';
+
+ string p = s;
+ delete [] s;
+ return p;
+ }
+
+}
--- /dev/null
+// SALOME Utils : general SALOME's definitions and tools
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : Basics_DirUtils.hxx
+// Autor : Alexander A. BORODIN
+// Module : SALOME
+
+#ifndef _Basics_UTILS_HXX_
+#define _Basics_UTILS_HXX_
+
+#include "SALOME_Basics.hxx"
+
+#include <string>
+
+namespace Kernel_Utils
+{
+ BASICS_EXPORT std::string GetHostname();
+}
+
+#endif //_Basics_UTILS_HXX_
include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-salomeinclude_HEADERS = BasicsGenericDestructor.hxx
+salomeinclude_HEADERS = \
+ SALOME_Basics.hxx \
+ BasicsGenericDestructor.hxx \
+ Basics_Utils.hxx \
+ Basics_DirUtils.hxx
lib_LTLIBRARIES = libSALOMEBasics.la
libSALOMEBasics_la_SOURCES = \
BasicsGenericDestructor.cxx \
- BasicsGenericDestructor.hxx
+ Basics_Utils.cxx \
+ Basics_DirUtils.cxx \
+ SALOME_Basics.hxx \
+ BasicsGenericDestructor.hxx \
+ Basics_Utils.hxx \
+ Basics_DirUtils.hxx
libSALOMEBasics_la_LDFLAGS = -no-undefined -version-info=0:0:0
libSALOMEBasics_la_CPPFLAGS = @CPPFLAGS@
--- /dev/null
+// SALOME Basics : general SALOME definitions and tools (C++ part - no CORBA)
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : SALOME_Basics.hxx
+// Author : Alexander A. BORODIN
+// Module : SALOME
+// $Header$
+
+#ifndef _SALOME_BASICS_HXX_
+#define _SALOME_BASICS_HXX_
+
+
+#ifdef WIN32
+# ifdef BASICS_EXPORTS
+# define BASICS_EXPORT __declspec( dllexport )
+# else
+# define BASICS_EXPORT __declspec( dllimport )
+# endif
+#else
+# define BASICS_EXPORT
+#endif
+
+#endif //_SALOME_BASICS_HXX_
#ifndef _APIINTERNALFAILUREEXCEPTION_H_
#define _APIINTERNALFAILUREEXCEPTION_H_
+#include "Batch_Defines.hxx"
#include "Batch_GenericException.hxx"
#include "Batch_GenericException.hxx"
namespace Batch {
- class APIInternalFailureException : public GenericException
+ class BATCH_EXPORT APIInternalFailureException : public GenericException
{
public:
// Constructeur
#include <iostream>
#include <sstream>
#include <string>
-#include <netdb.h>
+#ifdef WIN32
+# include<winsock2.h>
+#else
+# include <netdb.h>
+#endif
+
//#include "MEDMEM_STRING.hxx"
#include "Batch_Job.hxx"
#include "Batch_JobId.hxx"
#ifndef _BATCHMANAGER_H_
#define _BATCHMANAGER_H_
-#include <string.h>
-#include <stdlib.h>
-#include <limits.h>
+#include "Batch_Defines.hxx"
#include <string>
#include <map>
class JobInfo;
class FactBatchManager;
- class BatchManager
+ class BATCH_EXPORT BatchManager
{
public:
// Constructeur et destructeur
#ifndef _CATALOG_H_
#define _CATALOG_H_
+#include "Batch_Defines.hxx"
+
#include <string>
#include <map>
#include <pthread.h>
class FactBatchManager;
- class BatchManagerCatalog
+ class BATCH_EXPORT BatchManagerCatalog
{
public:
// Constructeur
#include <iostream>
#include <fstream>
#include <sstream>
+#include <string>
#include "Batch_BatchManager_LSF.hxx"
+using namespace std;
+
namespace Batch {
BatchManager_LSF::BatchManager_LSF(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host)
#ifndef _BATCHMANAGER_LSF_H_
#define _BATCHMANAGER_LSF_H_
+#include "Batch_Defines.hxx"
#include "Batch_Job.hxx"
#include "Batch_Job.hxx"
class JobInfo;
class FactBatchManager;
- class BatchManager_LSF : public BatchManager
+ class BATCH_EXPORT BatchManager_LSF : public BatchManager
{
public:
// Constructeur et destructeur
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
/*
- * BatchManager_Local.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail : mailto:ivan.dutka-malen@der.edf.fr
- * Date : Thu Nov 6 10:17:22 2003
- * Projet : Salome 2
- *
- */
+* BatchManager_Local.cxx :
+*
+* Auteur : Ivan DUTKA-MALEN - EDF R&D
+* Mail : mailto:ivan.dutka-malen@der.edf.fr
+* Date : Thu Nov 6 10:17:22 2003
+* Projet : Salome 2
+*
+*/
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
+#include <limits.h>
+
#include <sys/types.h>
-#include <sys/wait.h>
+#ifdef WIN32
+# include <direct.h>
+#else
+# include <sys/wait.h>
+# include <unistd.h>
+#endif
#include <ctime>
-#include <unistd.h>
#include <pthread.h>
#include <signal.h>
#include <errno.h>
#include "Batch_IOMutex.hxx"
#include "Batch_BatchManager_Local.hxx"
+using namespace std;
+
namespace Batch {
// Constructeur
- BatchManager_Local::BatchManager_Local(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host), _connect(0), _threads_mutex(), _threads(), _thread_id_id_association_mutex(), _thread_id_id_association_cond(), _thread_id_id_association()
+ BatchManager_Local::BatchManager_Local(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager(parent, host), _connect(0), _threads_mutex(), _threads(), _thread_id_id_association_mutex(), _thread_id_id_association_cond()
+#ifndef WIN32 //TODO: porting of following functionality
+ ,_thread_id_id_association()
+#endif
{
pthread_mutex_init(&_threads_mutex, NULL);
pthread_mutex_init(&_thread_id_id_association_mutex, NULL);
cancel(thread_id);
}
-
+
// Methode pour le controle des jobs : suspend un job en file d'attente
void BatchManager_Local::holdJob(const JobId & jobid)
{
if (_threads.find(id) != _threads.end())
_threads[id].command_queue.push(RELEASE);
pthread_mutex_unlock(&_threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- }
+ // @@@ --------> SECTION CRITIQUE <-------- @@@
+ }
// Methode pour le controle des jobs : modifie un job en file d'attente
pthread_t BatchManager_Local::submit(const Job_Local & job)
{
// L'id du thread a creer
- pthread_t thread_id = 0;
+ pthread_t thread_id =
+#ifdef WIN32
+ {0,0};
+#else
+ 0;
+#endif
// Les attributs du thread a sa creation
pthread_attr_t thread_attr;
// Creation du thread qui va executer la commande systeme qu'on lui passe
int rc = pthread_create(&thread_id,
- &thread_attr,
- &ThreadAdapter::run,
- static_cast<void *>(p_ta));
+ &thread_attr,
+ &ThreadAdapter::run,
+ static_cast<void *>(p_ta));
if (rc) {
}
// @@@ --------> SECTION CRITIQUE <-------- @@@
pthread_mutex_lock(&_thread_id_id_association_mutex);
+#ifndef WIN32 //TODO: porting of following functionality
while (_thread_id_id_association.find(thread_id) == _thread_id_id_association.end())
pthread_cond_wait(&_thread_id_id_association_cond, &_thread_id_id_association_mutex);
id = _thread_id_id_association[thread_id];
_thread_id_id_association.erase(thread_id);
-
+#endif
+
pthread_mutex_unlock(&_thread_id_id_association_mutex);
// @@@ --------> SECTION CRITIQUE <-------- @@@
// @@@ --------> SECTION CRITIQUE <-------- @@@
pthread_mutex_lock(&_thread_id_id_association_mutex);
+#ifndef WIN32 //TODO: porting of following functionality
if (_thread_id_id_association.find(thread_id) == _thread_id_id_association.end()) {
id = _thread_id_id_association[thread_id] = nextId();
pthread_cond_signal(&_thread_id_id_association_cond);
} else {
UNDER_LOCK( cerr << "ERROR : Pthread Inconstency. Two threads own the same thread_id." << endl );
}
+#endif
pthread_mutex_unlock(&_thread_id_id_association_mutex);
// @@@ --------> SECTION CRITIQUE <-------- @@@
// Constructeur de la classe ThreadAdapter
BatchManager_Local::ThreadAdapter::ThreadAdapter(BatchManager_Local & bm, const Job_Local & job) :
- _bm(bm), _job(job)
+ _bm(bm), _job(job)
{
// Nothing to do
}
// Methode d'execution du thread
void * BatchManager_Local::ThreadAdapter::run(void * arg)
{
+#ifndef WIN32 //TODO: porting of following functionality
// On bloque tous les signaux pour ce thread
sigset_t setmask;
sigfillset(&setmask);
pthread_sigmask(SIG_BLOCK, &setmask, NULL);
-
// On autorise la terminaison differee du thread
// (ces valeurs sont les valeurs par defaut mais on les force par precaution)
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
Parametre::const_iterator it;
// On initialise la variable workdir a la valeur du Current Working Directory
- char * cwd = new char [PATH_MAX];
+ char * cwd =
+#ifdef WIN32
+ _getcwd(NULL, 0);
+#else
+ new char [PATH_MAX];
getcwd(cwd, PATH_MAX);
+#endif
string workdir = cwd;
delete [] cwd;
Versatile::iterator Vit;
for(Vit=V.begin(); Vit!=V.end(); Vit++) {
- CoupleType cpt = *static_cast< CoupleType * >(*Vit);
- Couple cp = cpt;
- string local = cp.getLocal();
- string remote = cp.getRemote();
-
- string copy_cmd = p_ta->getBatchManager().copy_command("", local, executionhost, workdir + "/" + remote);
- UNDER_LOCK( cout << "Copying : " << copy_cmd << endl );
-
- if (system(copy_cmd.c_str()) ) {
- // Echec de la copie
- rc |= 1;
- } else {
- // On enregistre le fichier comme etant a detruire
- files_to_delete.push_back(workdir + "/" + remote);
- }
+ CoupleType cpt = *static_cast< CoupleType * >(*Vit);
+ Couple cp = cpt;
+ string local = cp.getLocal();
+ string remote = cp.getRemote();
+
+ string copy_cmd = p_ta->getBatchManager().copy_command("", local, executionhost, workdir + "/" + remote);
+ UNDER_LOCK( cout << "Copying : " << copy_cmd << endl );
+
+ if (system(copy_cmd.c_str()) ) {
+ // Echec de la copie
+ rc |= 1;
+ } else {
+ // On enregistre le fichier comme etant a detruire
+ files_to_delete.push_back(workdir + "/" + remote);
+ }
}
}
-
+#ifdef WIN32
+ //TODO
+ //Using CreateThread instead fork() POSIX function
+#else
// On forke/exec un nouveau process pour pouvoir controler le fils
// (plus finement qu'avec un appel system)
// int rc = system(commande.c_str());
} else { // fils
p_ta->fils();
}
-
+#endif
Versatile::iterator Vit;
for(Vit=V.begin(); Vit!=V.end(); Vit++) {
- CoupleType cpt = *static_cast< CoupleType * >(*Vit);
- Couple cp = cpt;
- string local = cp.getLocal();
- string remote = cp.getRemote();
-
- string copy_cmd = p_ta->getBatchManager().copy_command(executionhost, workdir + "/" + remote, "", local);
- UNDER_LOCK( cout << "Copying : " << copy_cmd << endl );
-
- if (system(copy_cmd.c_str()) ) {
- // Echec de la copie
- rc |= 1;
- } else {
- // On enregistre le fichier comme etant a detruire
- files_to_delete.push_back(workdir + "/" + remote);
- }
+ CoupleType cpt = *static_cast< CoupleType * >(*Vit);
+ Couple cp = cpt;
+ string local = cp.getLocal();
+ string remote = cp.getRemote();
+
+ string copy_cmd = p_ta->getBatchManager().copy_command(executionhost, workdir + "/" + remote, "", local);
+ UNDER_LOCK( cout << "Copying : " << copy_cmd << endl );
+
+ if (system(copy_cmd.c_str()) ) {
+ // Echec de la copie
+ rc |= 1;
+ } else {
+ // On enregistre le fichier comme etant a detruire
+ files_to_delete.push_back(workdir + "/" + remote);
+ }
}
}
if ( (rc == 0) || (child < 0) ) {
std::vector<string>::const_iterator it;
for(it=files_to_delete.begin(); it!=files_to_delete.end(); it++) {
- string remove_cmd = p_ta->getBatchManager().remove_command(executionhost, *it);
- UNDER_LOCK( cout << "Removing : " << remove_cmd << endl );
- system(remove_cmd.c_str());
+ string remove_cmd = p_ta->getBatchManager().remove_command(executionhost, *it);
+ UNDER_LOCK( cout << "Removing : " << remove_cmd << endl );
+ system(remove_cmd.c_str());
}
}
UNDER_LOCK( cout << "Father is leaving" << endl );
pthread_exit(NULL);
-
+#endif
return NULL;
}
void BatchManager_Local::ThreadAdapter::pere(pid_t child)
{
+#ifndef WIN32 //TODO: porting of following functionality
time_t child_starttime = time(NULL);
// On enregistre le fils dans la table des threads
int child_rc = 0;
pid_t child_wait_rc = waitpid(child, &child_rc, WNOHANG /* | WUNTRACED */);
if (child_wait_rc > 0) {
- if (WIFSTOPPED(child_rc)) {
- // NOTA : pour rentrer dans cette section, il faut que le flag WUNTRACED
- // soit positionne dans l'appel a waitpid ci-dessus. Ce flag est couramment
- // desactive car s'il est possible de detecter l'arret d'un process, il est
- // plus difficile de detecter sa reprise.
-
- // Le fils est simplement stoppe
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_bm._threads_mutex);
- _bm._threads[id].status = STOPPED;
- _bm._threads[id].param[STATE] = "Stopped";
- pthread_mutex_unlock(&_bm._threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- UNDER_LOCK( cout << "Father sees his child is STOPPED : " << child_wait_rc << endl );
-
- }
- else {
- // Le fils est termine, on sort de la boucle et du if englobant
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_bm._threads_mutex);
- _bm._threads[id].status = DONE;
- _bm._threads[id].param[STATE] = "Done";
- pthread_mutex_unlock(&_bm._threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- UNDER_LOCK( cout << "Father sees his child is DONE : " << child_wait_rc << " (child_rc=" << (WIFEXITED(child_rc) ? WEXITSTATUS(child_rc) : -1) << ")" << endl );
- break;
- }
+ if (WIFSTOPPED(child_rc)) {
+ // NOTA : pour rentrer dans cette section, il faut que le flag WUNTRACED
+ // soit positionne dans l'appel a waitpid ci-dessus. Ce flag est couramment
+ // desactive car s'il est possible de detecter l'arret d'un process, il est
+ // plus difficile de detecter sa reprise.
+
+ // Le fils est simplement stoppe
+ // @@@ --------> SECTION CRITIQUE <-------- @@@
+ pthread_mutex_lock(&_bm._threads_mutex);
+ _bm._threads[id].status = STOPPED;
+ _bm._threads[id].param[STATE] = "Stopped";
+ pthread_mutex_unlock(&_bm._threads_mutex);
+ // @@@ --------> SECTION CRITIQUE <-------- @@@
+ UNDER_LOCK( cout << "Father sees his child is STOPPED : " << child_wait_rc << endl );
+
+ }
+ else {
+ // Le fils est termine, on sort de la boucle et du if englobant
+ // @@@ --------> SECTION CRITIQUE <-------- @@@
+ pthread_mutex_lock(&_bm._threads_mutex);
+ _bm._threads[id].status = DONE;
+ _bm._threads[id].param[STATE] = "Done";
+ pthread_mutex_unlock(&_bm._threads_mutex);
+ // @@@ --------> SECTION CRITIQUE <-------- @@@
+ UNDER_LOCK( cout << "Father sees his child is DONE : " << child_wait_rc << " (child_rc=" << (WIFEXITED(child_rc) ? WEXITSTATUS(child_rc) : -1) << ")" << endl );
+ break;
+ }
}
else if (child_wait_rc == -1) {
- // Le fils a disparu ...
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_bm._threads_mutex);
- _bm._threads[id].status = DEAD;
- _bm._threads[id].param[STATE] = "Dead";
- pthread_mutex_unlock(&_bm._threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- UNDER_LOCK( cout << "Father sees his child is DEAD : " << child_wait_rc << " (Reason : " << strerror(errno) << ")" << endl );
- break;
+ // Le fils a disparu ...
+ // @@@ --------> SECTION CRITIQUE <-------- @@@
+ pthread_mutex_lock(&_bm._threads_mutex);
+ _bm._threads[id].status = DEAD;
+ _bm._threads[id].param[STATE] = "Dead";
+ pthread_mutex_unlock(&_bm._threads_mutex);
+ // @@@ --------> SECTION CRITIQUE <-------- @@@
+ UNDER_LOCK( cout << "Father sees his child is DEAD : " << child_wait_rc << " (Reason : " << strerror(errno) << ")" << endl );
+ break;
}
time_t child_currenttime = time(NULL);
time_t child_elapsedtime = child_currenttime - child_starttime;
if (param.find(MAXWALLTIME) != param.end()) {
- int maxwalltime = param[MAXWALLTIME];
- // cout << "child_starttime = " << child_starttime << endl
- // << "child_currenttime = " << child_currenttime << endl
- // << "child_elapsedtime = " << child_elapsedtime << endl
- // << "maxwalltime = " << maxwalltime << endl
- // << "int(maxwalltime * 1.1) = " << int(maxwalltime * 1.1) << endl;
- if (child_elapsedtime > int(maxwalltime * 1.1) ) { // On se donne 10% de marge avant le KILL
- UNDER_LOCK( cout << "Father is sending KILL command to the thread " << id << endl );
- // On introduit une commande dans la queue du thread
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_bm._threads_mutex);
- if (_bm._threads.find(id) != _bm._threads.end())
- _bm._threads[id].command_queue.push(KILL);
- pthread_mutex_unlock(&_bm._threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
-
-
- } else if (child_elapsedtime > maxwalltime ) {
- UNDER_LOCK( cout << "Father is sending TERM command to the thread " << id << endl );
- // On introduit une commande dans la queue du thread
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- pthread_mutex_lock(&_bm._threads_mutex);
- if (_bm._threads.find(id) != _bm._threads.end())
- _bm._threads[id].command_queue.push(TERM);
- pthread_mutex_unlock(&_bm._threads_mutex);
- // @@@ --------> SECTION CRITIQUE <-------- @@@
- }
+ int maxwalltime = param[MAXWALLTIME];
+ // cout << "child_starttime = " << child_starttime << endl
+ // << "child_currenttime = " << child_currenttime << endl
+ // << "child_elapsedtime = " << child_elapsedtime << endl
+ // << "maxwalltime = " << maxwalltime << endl
+ // << "int(maxwalltime * 1.1) = " << int(maxwalltime * 1.1) << endl;
+ if (child_elapsedtime > int(maxwalltime * 1.1) ) { // On se donne 10% de marge avant le KILL
+ UNDER_LOCK( cout << "Father is sending KILL command to the thread " << id << endl );
+ // On introduit une commande dans la queue du thread
+ // @@@ --------> SECTION CRITIQUE <-------- @@@
+ pthread_mutex_lock(&_bm._threads_mutex);
+ if (_bm._threads.find(id) != _bm._threads.end())
+ _bm._threads[id].command_queue.push(KILL);
+ pthread_mutex_unlock(&_bm._threads_mutex);
+ // @@@ --------> SECTION CRITIQUE <-------- @@@
+
+
+ } else if (child_elapsedtime > maxwalltime ) {
+ UNDER_LOCK( cout << "Father is sending TERM command to the thread " << id << endl );
+ // On introduit une commande dans la queue du thread
+ // @@@ --------> SECTION CRITIQUE <-------- @@@
+ pthread_mutex_lock(&_bm._threads_mutex);
+ if (_bm._threads.find(id) != _bm._threads.end())
+ _bm._threads[id].command_queue.push(TERM);
+ pthread_mutex_unlock(&_bm._threads_mutex);
+ // @@@ --------> SECTION CRITIQUE <-------- @@@
+ }
}
// @@@ --------> SECTION CRITIQUE <-------- @@@
pthread_mutex_lock(&_bm._threads_mutex);
if (_bm._threads.find(id) != _bm._threads.end()) {
- while (_bm._threads[id].command_queue.size() > 0) {
- Commande cmd = _bm._threads[id].command_queue.front();
- _bm._threads[id].command_queue.pop();
-
- switch (cmd) {
- case NOP:
- UNDER_LOCK( cout << "Father does nothing to his child" << endl );
- break;
-
- case HOLD:
- UNDER_LOCK( cout << "Father is sending SIGSTOP signal to his child" << endl );
- kill(child, SIGSTOP);
- break;
-
- case RELEASE:
- UNDER_LOCK( cout << "Father is sending SIGCONT signal to his child" << endl );
- kill(child, SIGCONT);
- break;
-
- case TERM:
- UNDER_LOCK( cout << "Father is sending SIGTERM signal to his child" << endl );
- kill(child, SIGTERM);
- break;
-
- case KILL:
- UNDER_LOCK( cout << "Father is sending SIGKILL signal to his child" << endl );
- kill(child, SIGKILL);
- break;
-
- case ALTER:
- break;
-
- default:
- break;
- }
- }
-
+ while (_bm._threads[id].command_queue.size() > 0) {
+ Commande cmd = _bm._threads[id].command_queue.front();
+ _bm._threads[id].command_queue.pop();
+
+ switch (cmd) {
+ case NOP:
+ UNDER_LOCK( cout << "Father does nothing to his child" << endl );
+ break;
+
+ case HOLD:
+ UNDER_LOCK( cout << "Father is sending SIGSTOP signal to his child" << endl );
+ kill(child, SIGSTOP);
+ break;
+
+ case RELEASE:
+ UNDER_LOCK( cout << "Father is sending SIGCONT signal to his child" << endl );
+ kill(child, SIGCONT);
+ break;
+
+ case TERM:
+ UNDER_LOCK( cout << "Father is sending SIGTERM signal to his child" << endl );
+ kill(child, SIGTERM);
+ break;
+
+ case KILL:
+ UNDER_LOCK( cout << "Father is sending SIGKILL signal to his child" << endl );
+ kill(child, SIGKILL);
+ break;
+
+ case ALTER:
+ break;
+
+ default:
+ break;
+ }
+ }
+
}
pthread_mutex_unlock(&_bm._threads_mutex);
// @@@ --------> SECTION CRITIQUE <-------- @@@
// On fait une petite pause pour ne pas surcharger inutilement le processeur
sleep(1);
-
+
}
+#endif
}
void BatchManager_Local::ThreadAdapter::fils()
{
+#ifndef WIN32 //TODO: porting of following functionality
Parametre param = _job.getParametre();
Parametre::iterator it;
try {
- // On se place dans le repertoire de travail
- if ( (it = param.find(WORKDIR)) != param.end() ) {
- string workdir = static_cast<string>( (*it).second );
- chdir(workdir.c_str());
- }
+ // On se place dans le repertoire de travail
+ if ( (it = param.find(WORKDIR)) != param.end() ) {
+ string workdir = static_cast<string>( (*it).second );
+ chdir(workdir.c_str());
+ }
- // EXECUTABLE is MANDATORY, if missing, we exit with failure notification
- char * execpath = NULL;
- if (param.find(EXECUTABLE) != param.end()) {
- string executable = _bm.exec_command(param);
- execpath = new char [executable.size() + 1];
- strncpy(execpath, executable.c_str(), executable.size() + 1);
- } else exit(1);
+ // EXECUTABLE is MANDATORY, if missing, we exit with failure notification
+ char * execpath = NULL;
+ if (param.find(EXECUTABLE) != param.end()) {
+ string executable = _bm.exec_command(param);
+ execpath = new char [executable.size() + 1];
+ strncpy(execpath, executable.c_str(), executable.size() + 1);
+ } else exit(1);
- string debug_command = execpath;
+ string debug_command = execpath;
- string name = (param.find(NAME) != param.end()) ? param[NAME] : param[EXECUTABLE];
+ string name = (param.find(NAME) != param.end()) ? param[NAME] : param[EXECUTABLE];
- char ** argv = NULL;
- if (param.find(ARGUMENTS) != param.end()) {
- Versatile V = param[ARGUMENTS];
+ char ** argv = NULL;
+ if (param.find(ARGUMENTS) != param.end()) {
+ Versatile V = param[ARGUMENTS];
- argv = new char * [V.size() + 2]; // 1 pour name et 1 pour le NULL terminal
+ argv = new char * [V.size() + 2]; // 1 pour name et 1 pour le NULL terminal
- argv[0] = new char [name.size() + 1];
- strncpy(argv[0], name.c_str(), name.size() + 1);
+ argv[0] = new char [name.size() + 1];
+ strncpy(argv[0], name.c_str(), name.size() + 1);
- debug_command += string(" # ") + argv[0];
+ debug_command += string(" # ") + argv[0];
- int i = 1;
- for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++, i++) {
- StringType argt = * static_cast<StringType *>(*it);
- string arg = argt;
- argv[i] = new char [arg.size() + 1];
- strncpy(argv[i], arg.c_str(), arg.size() + 1);
- debug_command += string(" # ") + argv[i];
+ int i = 1;
+ for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++, i++) {
+ StringType argt = * static_cast<StringType *>(*it);
+ string arg = argt;
+ argv[i] = new char [arg.size() + 1];
+ strncpy(argv[i], arg.c_str(), arg.size() + 1);
+ debug_command += string(" # ") + argv[i];
+ }
+
+ // assert (i == V.size() + 1)
+ argv[i] = NULL;
}
- // assert (i == V.size() + 1)
- argv[i] = NULL;
- }
+ UNDER_LOCK( cout << "*** debug_command = " << debug_command << endl );
- UNDER_LOCK( cout << "*** debug_command = " << debug_command << endl );
+ Environnement env = _job.getEnvironnement();
- Environnement env = _job.getEnvironnement();
+ char ** envp = NULL;
+ if(env.size() > 0) {
+ envp = new char * [env.size() + 1]; // 1 pour le NULL terminal
+ int i = 0;
+ for(Environnement::const_iterator it=env.begin(); it!=env.end(); it++, i++) {
+ const string & key = (*it).first;
+ const string & value = (*it).second;
+ ostringstream oss;
+ oss << key << "=" << value;
+ envp[i] = new char [oss.str().size() + 1];
+ strncpy(envp[i], oss.str().c_str(), oss.str().size() + 1);
+ }
- char ** envp = NULL;
- if(env.size() > 0) {
- envp = new char * [env.size() + 1]; // 1 pour le NULL terminal
- int i = 0;
- for(Environnement::const_iterator it=env.begin(); it!=env.end(); it++, i++) {
- const string & key = (*it).first;
- const string & value = (*it).second;
- ostringstream oss;
- oss << key << "=" << value;
- envp[i] = new char [oss.str().size() + 1];
- strncpy(envp[i], oss.str().c_str(), oss.str().size() + 1);
+ // assert (i == env.size())
+ envp[i] = NULL;
}
- // assert (i == env.size())
- envp[i] = NULL;
- }
+ // On positionne les limites systeme imposees au fils
+ if (param.find(MAXCPUTIME) != param.end()) {
+ int maxcputime = param[MAXCPUTIME];
+ struct rlimit limit;
+ limit.rlim_cur = maxcputime;
+ limit.rlim_max = int(maxcputime * 1.1);
+ setrlimit(RLIMIT_CPU, &limit);
+ }
- // On positionne les limites systeme imposees au fils
- if (param.find(MAXCPUTIME) != param.end()) {
- int maxcputime = param[MAXCPUTIME];
- struct rlimit limit;
- limit.rlim_cur = maxcputime;
- limit.rlim_max = int(maxcputime * 1.1);
- setrlimit(RLIMIT_CPU, &limit);
- }
+ if (param.find(MAXDISKSIZE) != param.end()) {
+ int maxdisksize = param[MAXDISKSIZE];
+ struct rlimit limit;
+ limit.rlim_cur = maxdisksize * 1024;
+ limit.rlim_max = int(maxdisksize * 1.1) * 1024;
+ setrlimit(RLIMIT_FSIZE, &limit);
+ }
- if (param.find(MAXDISKSIZE) != param.end()) {
- int maxdisksize = param[MAXDISKSIZE];
- struct rlimit limit;
- limit.rlim_cur = maxdisksize * 1024;
- limit.rlim_max = int(maxdisksize * 1.1) * 1024;
- setrlimit(RLIMIT_FSIZE, &limit);
- }
+ if (param.find(MAXRAMSIZE) != param.end()) {
+ int maxramsize = param[MAXRAMSIZE];
+ struct rlimit limit;
+ limit.rlim_cur = maxramsize * 1024;
+ limit.rlim_max = int(maxramsize * 1.1) * 1024;
+ setrlimit(RLIMIT_AS, &limit);
+ }
- if (param.find(MAXRAMSIZE) != param.end()) {
- int maxramsize = param[MAXRAMSIZE];
- struct rlimit limit;
- limit.rlim_cur = maxramsize * 1024;
- limit.rlim_max = int(maxramsize * 1.1) * 1024;
- setrlimit(RLIMIT_AS, &limit);
- }
+ // On cree une session pour le fils de facon a ce qu'il ne soit pas
+ // detruit lorsque le shell se termine (le shell ouvre une session et
+ // tue tous les process appartenant a la session en quittant)
+ setsid();
- // On cree une session pour le fils de facon a ce qu'il ne soit pas
- // detruit lorsque le shell se termine (le shell ouvre une session et
- // tue tous les process appartenant a la session en quittant)
- setsid();
+ // On ferme les descripteurs de fichiers standards
+ //close(STDIN_FILENO);
+ //close(STDOUT_FILENO);
+ //close(STDERR_FILENO);
- // On ferme les descripteurs de fichiers standards
- //close(STDIN_FILENO);
- //close(STDOUT_FILENO);
- //close(STDERR_FILENO);
+ // On execute la commande du fils
+ execve(execpath, argv, envp);
- // On execute la commande du fils
- execve(execpath, argv, envp);
+ // No need to deallocate since nothing happens after a successful exec
- // No need to deallocate since nothing happens after a successful exec
+ // Normalement on ne devrait jamais arriver ici
+ ofstream file_err("error.log");
+ UNDER_LOCK( file_err << "Echec de l'appel a execve" << endl );
- // Normalement on ne devrait jamais arriver ici
- ofstream file_err("error.log");
- UNDER_LOCK( file_err << "Echec de l'appel a execve" << endl );
-
} catch (GenericException & e) {
-
+
std::cerr << "Caught exception : " << e.type << " : " << e.message << std::endl;
}
exit(99);
-
+#endif
}
void BatchManager_Local::kill_child_on_exit(void * p_pid)
{
+#ifndef WIN32
+ //TODO: porting of following functionality
pid_t child = * static_cast<pid_t *>(p_pid);
// On tue le fils
// Nota : on pourrait aussi faire a la suite un kill(child, SIGKILL)
// mais cette option n'est pas implementee pour le moment, car il est
// preferable de laisser le process fils se terminer normalement et seul.
-
+#endif
}
void BatchManager_Local::delete_on_exit(void * arg)
#ifndef _BATCHMANAGER_LOCAL_H_
#define _BATCHMANAGER_LOCAL_H_
+#include "Batch_Defines.hxx"
#include <vector>
#include <map>
#include <queue>
-#include <deque>
#include <pthread.h>
#include "Batch_Job.hxx"
#include "Batch_JobId.hxx"
class FactBatchManager;
- class BatchManager_Local : public BatchManager
+ class BATCH_EXPORT BatchManager_Local : public BatchManager
{
private:
friend class ThreadAdapter;
struct Child {
pthread_t thread_id;
- queue<Commande, deque<Commande> > command_queue;
+ std::queue<Commande, std::deque<Commande> > command_queue;
pid_t pid;
int exit_code;
Status status;
protected:
int _connect; // Local connect id
pthread_mutex_t _threads_mutex;
- map<Id, Child > _threads;
+ std::map<Id, Child > _threads;
// Methode abstraite qui renvoie la commande de copie du fichier source en destination
- virtual string copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const = 0;
+ virtual std::string copy_command( const std::string & host_source,
+ const std::string & source,
+ const std::string & host_destination,
+ const std::string & destination) const = 0;
// Methode abstraite qui renvoie la commande a executer
- virtual string exec_command(Parametre & param) const = 0;
+ virtual std::string exec_command(Parametre & param) const = 0;
// Methode abstraite qui renvoie la commande d'effacement du fichier
- virtual string remove_command(const string & host_destination, const string & destination) const = 0;
+ virtual std::string remove_command( const std::string & host_destination,
+ const std::string & destination) const = 0;
private:
virtual pthread_t submit(const Job_Local & job);
Id registerThread_id(pthread_t thread_id);
pthread_mutex_t _thread_id_id_association_mutex;
pthread_cond_t _thread_id_id_association_cond;
- map<pthread_t, Id> _thread_id_id_association;
+#ifndef WIN32 //TODO: porting of following functionality
+ //reason: pthread_t on win32 is a struct of pointer and int members
+ std::map<pthread_t, Id> _thread_id_id_association;
+#endif
#ifdef SWIG
public:
#include <sstream>
#include <cstdlib>
#include <sys/types.h>
+#ifndef WIN32
#include <sys/wait.h>
-#include <ctime>
#include <unistd.h>
+#endif
+#include <ctime>
#include <pthread.h>
#include <signal.h>
#include <errno.h>
#error "RSH undefined. You must set RSH to a valid path to a rsh-like command."
#endif
+using namespace std;
+
namespace Batch {
#ifndef _BATCHMANAGER_LOCAL_RSH_H_
#define _BATCHMANAGER_LOCAL_RSH_H_
+#include "Batch_Defines.hxx"
#include <vector>
#include <map>
class FactBatchManager;
- class BatchManager_Local_RSH : public BatchManager_Local
+ class BATCH_EXPORT BatchManager_Local_RSH : public BatchManager_Local
{
public:
// Constructeur et destructeur
protected:
// Methode abstraite qui renvoie la commande de copie du fichier source en destination
- virtual string copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const;
+ virtual std::string copy_command( const std::string & host_source,
+ const std::string & source,
+ const std::string & host_destination,
+ const std::string & destination) const;
// Methode abstraite qui renvoie la commande a executer
- virtual string exec_command(Parametre & param) const;
+ virtual std::string exec_command(Parametre & param) const;
// Methode qui renvoie la commande d'effacement du fichier
- virtual string remove_command(const string & host_destination, const string & destination) const;
+ virtual std::string remove_command( const std::string & host_destination,
+ const std::string & destination) const;
};
#include <sstream>
#include <cstdlib>
#include <sys/types.h>
+#ifndef WIN32
#include <sys/wait.h>
+#endif
#include <ctime>
#include <unistd.h>
#include <pthread.h>
#error "SH undefined. You must set SH to a valid path to a sh-like command."
#endif
+using namespace std;
+
namespace Batch {
#ifndef _BATCHMANAGER_LOCAL_SH_H_
#define _BATCHMANAGER_LOCAL_SH_H_
+#include "Batch_Defines.hxx"
#include <vector>
#include <map>
class FactBatchManager;
- class BatchManager_Local_SH : public BatchManager_Local
+ class BATCH_EXPORT BatchManager_Local_SH : public BatchManager_Local
{
public:
// Constructeur et destructeur
protected:
// Methode qui renvoie la commande de copie du fichier source en destination
- virtual string copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const;
+ virtual std::string copy_command( const std::string & host_source,
+ const std::string & source,
+ const std::string & host_destination,
+ const std::string & destination) const;
// Methode qui renvoie la commande a executer
- virtual string exec_command(Parametre & param) const;
+ virtual std::string exec_command(Parametre & param) const;
// Methode qui renvoie la commande d'effacement du fichier
- virtual string remove_command(const string & host_destination, const string & destination) const;
+ virtual std::string remove_command( const std::string & host_destination,
+ const std::string & destination) const;
};
#include <sstream>
#include <cstdlib>
#include <sys/types.h>
+#ifndef WIN32
#include <sys/wait.h>
-#include <ctime>
#include <unistd.h>
+#endif
+#include <ctime>
+
#include <pthread.h>
#include <signal.h>
#include <errno.h>
#error "SSH undefined. You must set SSH to a valid path to a ssh-like command."
#endif
+using namespace std;
+
namespace Batch {
#ifndef _BATCHMANAGER_LOCAL_SSH_H_
#define _BATCHMANAGER_LOCAL_SSH_H_
+#include "Batch_Defines.hxx"
#include <vector>
#include <map>
class FactBatchManager;
- class BatchManager_Local_SSH : public BatchManager_Local
+ class BATCH_EXPORT BatchManager_Local_SSH : public BatchManager_Local
{
public:
// Constructeur et destructeur
protected:
// Methode abstraite qui renvoie la commande de copie du fichier source en destination
- virtual string copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const;
+ virtual std::string copy_command( const std::string & host_source,
+ const std::string & source,
+ const std::string & host_destination,
+ const std::string & destination) const;
// Methode abstraite qui renvoie la commande a executer
- virtual string exec_command(Parametre & param) const;
+ virtual std::string exec_command(Parametre & param) const;
// Methode qui renvoie la commande d'effacement du fichier
- virtual string remove_command(const string & host_destination, const string & destination) const;
+ virtual std::string remove_command( const std::string & host_destination,
+ const std::string & destination) const;
};
#ifndef _BATCHMANAGER_PBS_H_
#define _BATCHMANAGER_PBS_H_
+#include "Batch_Defines.hxx"
#include "Batch_Job.hxx"
#include "Batch_Job.hxx"
class JobInfo;
class FactBatchManager;
- class BatchManager_PBS : public BatchManager
+ class BATCH_EXPORT BatchManager_PBS : public BatchManager
{
public:
// Constructeur et destructeur
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
/*
- * BatchManager_eLSF.cxx : emulation of LSF client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail : mailto:bernard.secher@cea.fr
- * Date : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
+* BatchManager_eLSF.cxx : emulation of LSF client
+*
+* Auteur : Bernard SECHER - CEA DEN
+* Mail : mailto:bernard.secher@cea.fr
+* Date : Thu Apr 24 10:17:22 2008
+* Projet : PAL Salome
+*
+*/
+
+#include "Batch_BatchManager_eClient.hxx"
+#include "Basics_DirUtils.hxx"
#include <iostream>
#include <fstream>
#include <sstream>
#include <sys/stat.h>
-#include "Batch_BatchManager_eClient.hxx"
+#include <string.h>
+#include <stdlib.h>
+
+using namespace std;
+
namespace Batch {
copy_command = "scp ";
else
throw EmulationException("Unknown protocol : only rsh and ssh are known !");
-
+
// First step : creating batch tmp files directory
command = _protocol;
command += " ";
ex_mess += oss.str();
throw EmulationException(ex_mess.c_str());
}
-
+
// Third step : copy filesToExportList into
// batch tmp files directory
for(Vit=V.begin(); Vit!=V.end(); Vit++) {
command += inputFile.getLocal();
command += " ";
if(_username != ""){
- command += _username;
- command += "@";
+ command += _username;
+ command += "@";
}
command += _hostname;
command += ":";
cerr << command.c_str() << endl;
status = system(command.c_str());
if(status) {
- std::ostringstream oss;
- oss << status;
- std::string ex_mess("Error of connection on remote host ! status = ");
- ex_mess += oss.str();
- throw EmulationException(ex_mess.c_str());
+ std::ostringstream oss;
+ oss << status;
+ std::string ex_mess("Error of connection on remote host ! status = ");
+ ex_mess += oss.str();
+ throw EmulationException(ex_mess.c_str());
}
}
Parametre params = job.getParametre();
Versatile V = params[OUTFILE];
Versatile::iterator Vit;
-
+
for(Vit=V.begin(); Vit!=V.end(); Vit++) {
CoupleType cpt = *static_cast< CoupleType * >(*Vit);
Couple outputFile = cpt;
if( _protocol == "rsh" )
- command = "rcp ";
+ command = "rcp ";
else if( _protocol == "ssh" )
- command = "scp ";
+ command = "scp ";
else
- throw EmulationException("Unknown protocol");
+ throw EmulationException("Unknown protocol");
if (_username != ""){
- command += _username;
- command += "@";
+ command += _username;
+ command += "@";
}
command += _hostname;
command += ":";
status = system(command.c_str());
if(status)
{
- // Try to get what we can (logs files)
- // throw BatchException("Error of connection on remote host");
- std::string mess("Copy command failed ! status is :");
- ostringstream status_str;
- status_str << status;
- mess += status_str.str();
- cerr << mess << endl;
+ // Try to get what we can (logs files)
+ // throw BatchException("Error of connection on remote host");
+ std::string mess("Copy command failed ! status is :");
+ ostringstream status_str;
+ status_str << status;
+ mess += status_str.str();
+ cerr << mess << endl;
}
}
string BatchManager_eClient::BuildTemporaryFileName() const
{
//build more complex file name to support multiple salome session
- char *temp = new char[19];
- strcpy(temp, "/tmp/command");
- strcat(temp, "XXXXXX");
-#ifndef WNT
- mkstemp(temp);
+ string aFileName = Kernel_Utils::GetTmpFileName();
+#ifndef WIN32
+ aFileName += ".sh";
#else
- char aPID[80];
- itoa(getpid(), aPID, 10);
- strcat(temp, aPID);
+ aFileName += ".bat";
#endif
-
- string command(temp);
- delete [] temp;
- command += ".sh";
- return command;
+ return aFileName;
}
void BatchManager_eClient::RmTmpFile(std::string & TemporaryFileName)
{
+#ifdef WIN32
+ string command = "del /F ";
+#else
string command = "rm ";
+#endif
command += TemporaryFileName;
char *temp = strdup(command.c_str());
int lgthTemp = strlen(temp);
system(temp);
free(temp);
}
-
}
#ifndef _BATCHMANAGER_eClient_H_
#define _BATCHMANAGER_eClient_H_
+#include "Batch_Defines.hxx"
#include "MpiImpl.hxx"
#include "Batch_BatchManager.hxx"
+#include <string>
+
namespace Batch {
class Job;
- class EmulationException
+ class BATCH_EXPORT EmulationException
{
public:
const std::string msg;
EmulationException(const std::string m) : msg(m) {}
};
- class BatchManager_eClient : public BatchManager
+ class BATCH_EXPORT BatchManager_eClient : public BatchManager
{
public:
// Constructeur et destructeur
std::string BuildTemporaryFileName() const;
void RmTmpFile(std::string & TemporaryFileName);
- MpiImpl* FactoryMpiImpl(string mpiImpl) throw(EmulationException);
+ MpiImpl* FactoryMpiImpl(std::string mpiImpl) throw(EmulationException);
void exportInputFiles(const Job & job) throw(EmulationException);
private:
#include <fstream>
#include <sstream>
#include <sys/stat.h>
+#include <string.h>
+#include <stdlib.h>
+
#include "Batch_BatchManager_eLSF.hxx"
+#ifdef WIN32
+# include <time.h>
+# include <io.h>
+#endif
+
+using namespace std;
namespace Batch {
void BatchManager_eLSF::buildBatchScript(const Job & job) throw(EmulationException)
{
+#ifndef WIN32 //TODO: need for porting on Windows
int status;
Parametre params = job.getParametre();
const int nbproc = params[NBPROC];
tempOutputFile << _mpiImpl->halt();
tempOutputFile.flush();
tempOutputFile.close();
- chmod(TmpFileName.c_str(), 0x1ED);
+#ifdef WIN32
+ _chmod(
+#else
+ chmod(
+#endif
+ TmpFileName.c_str(), 0x1ED);
cerr << TmpFileName.c_str() << endl;
string command;
throw EmulationException("Error of connection on remote host");
RmTmpFile(TmpFileName);
+#endif
}
#ifndef _BATCHMANAGER_eLSF_H_
#define _BATCHMANAGER_eLSF_H_
+#include "Batch_Defines.hxx"
#include "Batch_JobId.hxx"
#include "Batch_JobInfo.hxx"
class JobInfo;
class FactBatchManager;
- class BatchManager_eLSF : public BatchManager_eClient
+ class BATCH_EXPORT BatchManager_eLSF : public BatchManager_eClient
{
public:
// Constructeur et destructeur
#include <fstream>
#include <sstream>
#include <sys/stat.h>
+#include <string.h>
+#include <stdlib.h>
+
#include "Batch_BatchManager_ePBS.hxx"
+#ifdef WIN32
+# include <time.h>
+# include <io.h>
+#endif
+
+using namespace std;
namespace Batch {
void BatchManager_ePBS::buildBatchScript(const Job & job) throw(EmulationException)
{
+#ifndef WIN32 //TODO: need for porting on Windows
int status;
Parametre params = job.getParametre();
const long nbproc = params[NBPROC];
tempOutputFile << _mpiImpl->halt();
tempOutputFile.flush();
tempOutputFile.close();
- chmod(TmpFileName.c_str(), 0x1ED);
+#ifdef WIN32
+ _chmod(
+#else
+ chmod(
+#endif
+ TmpFileName.c_str(), 0x1ED);
cerr << TmpFileName.c_str() << endl;
string command;
throw EmulationException("Error of connection on remote host");
RmTmpFile(TmpFileName);
-
+#endif
}
}
#ifndef _BATCHMANAGER_eLSF_H_
#define _BATCHMANAGER_eLSF_H_
+#include "Batch_Defines.hxx"
+
#include "Batch_JobId.hxx"
#include "Batch_JobInfo.hxx"
#include "Batch_JobInfo_ePBS.hxx"
class JobInfo;
class FactBatchManager;
- class BatchManager_ePBS : public BatchManager_eClient
+ class BATCH_EXPORT BatchManager_ePBS : public BatchManager_eClient
{
public:
// Constructeur et destructeur
#ifndef _BOOLTYPE_H_
#define _BOOLTYPE_H_
+#include "Batch_Defines.hxx"
+
#include <string>
#include "Batch_GenericType.hxx"
namespace Batch {
- class BoolType : public GenericType
+ class BATCH_EXPORT BoolType : public GenericType
{
public:
// Constructeur
#ifndef _CHARTYPE_H_
#define _CHARTYPE_H_
+#include "Batch_Defines.hxx"
+
#include <string>
#include "Batch_GenericType.hxx"
namespace Batch {
- class CharType : public GenericType
+ class BATCH_EXPORT CharType : public GenericType
{
public:
// Constructeur
#ifndef _CONNEXIONFAILUREEXCEPTION_H_
#define _CONNEXIONFAILUREEXCEPTION_H_
+#include "Batch_Defines.hxx"
+
#include "Batch_GenericException.hxx"
namespace Batch {
- class ConnexionFailureException : public GenericException
+ class BATCH_EXPORT ConnexionFailureException : public GenericException
{
public:
// Constructeur
#ifndef _COUPLE_H_
#define _COUPLE_H_
+#include "Batch_Defines.hxx"
+
#include <string>
namespace Batch {
- class Couple
+ class BATCH_EXPORT Couple
{
public:
// Constructeur standard
#ifndef _COUPLETYPE_H_
#define _COUPLETYPE_H_
+#include "Batch_Defines.hxx"
+
#include <string>
#include "Batch_GenericType.hxx"
#include "Batch_Couple.hxx"
namespace Batch {
- class CoupleType : public GenericType
+ class BATCH_EXPORT CoupleType : public GenericType
{
public:
// Constructeur
#ifndef _DATE_H_
#define _DATE_H_
+#include "Batch_Defines.hxx"
+
#include <string>
namespace Batch {
- class Date
+ class BATCH_EXPORT Date
{
public:
Date(const long l=0);
#ifndef _DATETYPE_H_
#define _DATETYPE_H_
+#include "Batch_Defines.hxx"
+
#include <string>
#include "Batch_GenericType.hxx"
#include "Batch_Date.hxx"
namespace Batch {
- class DateType : public GenericType
+ class BATCH_EXPORT DateType : public GenericType
{
public:
// Constructeur
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : Batch_Defines.hxx
+// Author : Alexander A. BORODIN
+// Module : SALOME
+
+#ifndef _BATCH_Defines_HXX_
+#define _BATCH_Defines_HXX_
+
+#ifdef WIN32
+# ifdef BATCH_EXPORTS
+# define BATCH_EXPORT __declspec( dllexport )
+# else
+# define BATCH_EXPORT __declspec( dllimport )
+# endif
+# define RM "rm"
+# define RCP "rpc"
+# define RSH "rsh"
+#else
+# define BATCH_EXPORT
+#endif
+
+#endif
#ifndef _ENVIRONNEMENT_H_
#define _ENVIRONNEMENT_H_
+#include "Batch_Defines.hxx"
+
#include <string>
#include <map>
FactBatchManager::FactBatchManager(const string & _t) : type(_t)
{
BatchManagerCatalog::addFactBatchManager(type.c_str(), this);
+ /*
+ #ifndef WIN32
+ Win32 limitation: it's impossible to create new thread of LocalTraceCollector
+ during initialization of static objects of DLL
+ Be careful with static objects of types inherited from FactBatchManager class
+ */
ostringstream msg;
msg << "FactBatchManager of type '" << type << "' inserted into catalog";
MESSAGE(msg.str().c_str());
+ //#endif
}
// Destructeur
#ifndef _FACTBATCHMANAGER_H_
#define _FACTBATCHMANAGER_H_
+#include "Batch_Defines.hxx"
+
#include <string>
#include <map>
class BatchManager;
- class FactBatchManager
+ class BATCH_EXPORT FactBatchManager
{
public:
// Constructeur et destructeur
#ifndef _FACTBATCHMANAGER_LSF_H_
#define _FACTBATCHMANAGER_LSF_H_
-using namespace std;
-#include <string>
-#include <map>
#include "Batch_FactBatchManager.hxx"
namespace Batch {
#ifndef _FACTBATCHMANAGER_LOCAL_H_
#define _FACTBATCHMANAGER_LOCAL_H_
-using namespace std;
-#include <string>
-#include <map>
#include "Batch_FactBatchManager.hxx"
namespace Batch {
//#include "utilities.h"
namespace Batch {
+
+ static FactBatchManager_Local_RSH* instanceOfFBM_eLSF()
+ {
+ static FactBatchManager_Local_RSH* sFBM_Local_RSH = 0;
+ if ( !sFBM_Local_RSH )
+ sFBM_Local_RSH = new FactBatchManager_Local_RSH();
- static FactBatchManager_Local_RSH sFBM_Local_RSH;
+ return sFBM_Local_RSH;
+ }
// Constructeur
FactBatchManager_Local_RSH::FactBatchManager_Local_RSH() : FactBatchManager("RSH")
#ifndef _FACTBATCHMANAGER_LOCAL_RSH_H_
#define _FACTBATCHMANAGER_LOCAL_RSH_H_
-using namespace std;
-#include <string>
-#include <map>
#include "Batch_FactBatchManager.hxx"
namespace Batch {
#ifndef _FACTBATCHMANAGER_LOCAL_SH_H_
#define _FACTBATCHMANAGER_LOCAL_SH_H_
-using namespace std;
-#include <string>
-#include <map>
#include "Batch_FactBatchManager.hxx"
namespace Batch {
#ifndef _FACTBATCHMANAGER_LOCAL_SSH_H_
#define _FACTBATCHMANAGER_LOCAL_SSH_H_
-using namespace std;
-#include <string>
-#include <map>
#include "Batch_FactBatchManager.hxx"
namespace Batch {
namespace Batch {
- static FactBatchManager_eLSF sFBM_eLSF;
+static FactBatchManager_eLSF* instanceOfFBM_eLSF()
+{
+ static FactBatchManager_eLSF* sFBM_eLSF = 0;
+ if ( !sFBM_eLSF )
+ sFBM_eLSF = new FactBatchManager_eLSF();
+
+ return sFBM_eLSF;
+}
+
// Constructeur
FactBatchManager_eLSF::FactBatchManager_eLSF() : FactBatchManager_eClient("eLSF")
#ifndef _FACTBATCHMANAGER_eLSF_H_
#define _FACTBATCHMANAGER_eLSF_H_
-using namespace std;
+#include "Batch_Defines.hxx"
+
#include <string>
#include <map>
#include "Batch_BatchManager_eClient.hxx"
class BatchManager_eLSF;
- class FactBatchManager_eLSF : public FactBatchManager_eClient
+ class BATCH_EXPORT FactBatchManager_eLSF : public FactBatchManager_eClient
{
public:
// Constructeur et destructeur
namespace Batch {
- static FactBatchManager_ePBS sFBM_ePBS;
+ static FactBatchManager_ePBS* instanceOfFBM_eLSF()
+ {
+ static FactBatchManager_ePBS* sFBM_ePBS = 0;
+ if ( !sFBM_ePBS )
+ sFBM_ePBS = new FactBatchManager_ePBS();
+
+ return sFBM_ePBS;
+ }
// Constructeur
FactBatchManager_ePBS::FactBatchManager_ePBS() : FactBatchManager_eClient("ePBS")
#ifndef _FACTBATCHMANAGER_ePBS_H_
#define _FACTBATCHMANAGER_ePBS_H_
-using namespace std;
+#include "Batch_Defines.hxx"
+
#include <string>
#include <map>
#include "Batch_BatchManager_eClient.hxx"
class BatchManager_ePBS;
- class FactBatchManager_ePBS : public FactBatchManager_eClient
+ class BATCH_EXPORT FactBatchManager_ePBS : public FactBatchManager_eClient
{
public:
// Constructeur et destructeur
#ifndef _GENERICEXCEPTION_H_
#define _GENERICEXCEPTION_H_
+#include "Batch_Defines.hxx"
+
#include <string>
namespace Batch {
- class GenericException
+ class BATCH_EXPORT GenericException
{
public:
const std::string type; // la nature de l'exception
#ifndef _GENERICTYPE_H_
#define _GENERICTYPE_H_
+#include "Batch_Defines.hxx"
+
#include <iostream>
#include <string>
namespace Batch {
- class GenericType
+ class BATCH_EXPORT GenericType
{
public:
// Constructeur et destructeur
#ifndef _INTTYPE_H_
#define _INTTYPE_H_
+#include "Batch_Defines.hxx"
+
#include <string>
#include "Batch_GenericType.hxx"
namespace Batch {
- class IntType : public GenericType
+ class BATCH_EXPORT IntType : public GenericType
{
public:
// Constructeur
#define _INVALIDARGUMENTEXCEPTION_H_
+#include "Batch_Defines.hxx"
+
#include "Batch_GenericException.hxx"
#include "Batch_GenericException.hxx"
namespace Batch {
- class InvalidArgumentException : public GenericException
+ class BATCH_EXPORT InvalidArgumentException : public GenericException
{
public:
// Constructeur
#ifndef _INVALIDKEYEXCEPTION_H_
#define _INVALIDKEYEXCEPTION_H_
+#include "Batch_Defines.hxx"
+
#include "Batch_GenericException.hxx"
#include "Batch_GenericException.hxx"
namespace Batch {
- class InvalidKeyException : public GenericException
+ class BATCH_EXPORT InvalidKeyException : public GenericException
{
public:
// Constructeur
#ifndef _JOB_H_
#define _JOB_H_
+#include "Batch_Defines.hxx"
+
#include "Batch_Parametre.hxx"
#include "Batch_Environnement.hxx"
namespace Batch {
- class Job
+ class BATCH_EXPORT Job
{
public:
// Constructeurs et destructeur
#define _JOBID_H_
+#include "Batch_Defines.hxx"
+
#include "Batch_JobInfo.hxx"
#include "Batch_BatchManager.hxx"
class BatchManager;
- class JobId
+ class BATCH_EXPORT JobId
{
friend class BatchManager;
//#include "MEDMEM_STRING.hxx"
#include "Batch_JobInfo.hxx"
+using namespace std;
+
namespace Batch {
// Destructeur
#ifndef _JOBINFO_H_
#define _JOBINFO_H_
-using namespace std;
+#include "Batch_Defines.hxx"
+
#include <iostream>
#include <string>
#include "Batch_Parametre.hxx"
namespace Batch {
- class JobInfo
+ class BATCH_EXPORT JobInfo
{
public:
// Constructeur standard et destructeur
JobInfo(const JobInfo & jinfo) : _param(jinfo._param), _env(jinfo._env) {};
// Operateur pour l'affichage sur un stream
- friend ostream & operator <<(ostream & os, const JobInfo & ji);
+ friend std::ostream & operator <<(std::ostream & os, const JobInfo & ji);
// Accesseurs
// _CS_gbo Ajout explicite du namespace pour les besoins de swig (mauvaise gestion
// Methodes pour l'interfacage avec Python (SWIG)
// TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- string __str__() const; // SWIG : affichage en Python
- string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+ std::string __str__() const; // SWIG : affichage en Python
+ std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
protected:
Parametre _param; // parametres du job
#include <cstdio>
#include <sstream>
+#include <string>
#include "Batch_Parametre.hxx"
#include "Batch_Environnement.hxx"
#include "Batch_RunTimeException.hxx"
#include "Batch_APIInternalFailureException.hxx"
#include "Batch_JobInfo_LSF.hxx"
+using namespace std;
+
namespace Batch {
// Methodes pour l'interfacage avec Python (SWIG)
// TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- string __str__() const; // SWIG : affichage en Python
- string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+ std::string __str__() const; // SWIG : affichage en Python
+ std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
protected:
bool _running; // etat du job en machine
private:
// Convertit une date HH:MM:SS en secondes
- long HMStoLong(const string &);
+ long HMStoLong(const std::string &);
};
#include "Batch_APIInternalFailureException.hxx"
#include "Batch_JobInfo_eLSF.hxx"
+using namespace std;
+
namespace Batch {
#ifndef _JOBINFO_LSF_H_
#define _JOBINFO_LSF_H_
-#include <string>
#include "Batch_RunTimeException.hxx"
#include "Batch_JobInfo.hxx"
+#include <string>
+
namespace Batch {
class JobInfo_eLSF : public JobInfo
// Methodes pour l'interfacage avec Python (SWIG)
// TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- string __str__() const; // SWIG : affichage en Python
- string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+ std::string __str__() const; // SWIG : affichage en Python
+ std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
protected:
bool _running; // etat du job en machine
private:
// Convertit une date HH:MM:SS en secondes
- long HMStoLong(const string &);
+ long HMStoLong(const std::string &);
};
#include "Batch_APIInternalFailureException.hxx"
#include "Batch_JobInfo_ePBS.hxx"
+using namespace std;
+
namespace Batch {
// Methodes pour l'interfacage avec Python (SWIG)
// TODO : supprimer ces methodes et transferer leur definitions dans SWIG
- string __str__() const; // SWIG : affichage en Python
- string __repr__() const { return __str__(); }; // SWIG : affichage en Python
+ std::string __str__() const; // SWIG : affichage en Python
+ std::string __repr__() const { return __str__(); }; // SWIG : affichage en Python
protected:
bool _running; // etat du job en machine
private:
// Convertit une date HH:MM:SS en secondes
- long HMStoLong(const string &);
+ long HMStoLong(const std::string &);
};
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <string.h>
+#include <string>
#include <vector>
#include "Batch_Job_LSF.hxx"
+using namespace std;
+
namespace Batch {
#include <lsf/lsf.h>
#include <lsf/lsbatch.h>
}
+#include <string>
#include "Batch_Job.hxx"
namespace Batch {
private:
struct submit * ParametreToSubmitStruct(const Parametre & P);
- char * string2char(const string &);
+ char * string2char(const std::string &);
};
}
#include <stdio.h>
#include <stdlib.h>
+#ifndef WIN32
#include <unistd.h>
+#endif
#include "Batch_Job_Local.hxx"
+using namespace std;
+
namespace Batch {
// Constructeur
#ifndef _LISTISFULLEXCEPTION_H_
#define _LISTISFULLEXCEPTION_H_
+#include "Batch_Defines.hxx"
+
#include "Batch_GenericException.hxx"
namespace Batch {
- class ListIsFullException : public GenericException
+ class BATCH_EXPORT ListIsFullException : public GenericException
{
public:
// Constructeur
#ifndef _LONGTYPE_H_
#define _LONGTYPE_H_
+#include "Batch_Defines.hxx"
+
#include <string>
#include "Batch_GenericType.hxx"
namespace Batch {
- class LongType : public GenericType
+ class BATCH_EXPORT LongType : public GenericType
{
public:
// Constructeur
#ifndef _MAPKEY_H_
#define _MAPKEY_H_
+#include "Batch_Defines.hxx"
+
#include <string>
// une classe privee pour les differents types
// ces types ne peuvent pas etre redefinis
- class MapKey : public std::string
+ class BATCH_EXPORT MapKey : public std::string
{
private:
friend class Parametre; // seule la classe Parametre peut creer des MapKey
#ifndef _NOTYETIMPLEMENTEDEXCEPTION_H_
#define _NOTYETIMPLEMENTEDEXCEPTION_H_
-
+#include "Batch_Defines.hxx"
#include "Batch_GenericException.hxx"
-using namespace std;
+
+#include <string>
namespace Batch {
- class NotYetImplementedException : public GenericException
+ class BATCH_EXPORT NotYetImplementedException : public GenericException
{
public:
// Constructeur
- NotYetImplementedException(string ch = "undefined") : GenericException("NotYetImplementedException", ch) {}
+ NotYetImplementedException(std::string ch = "undefined") : GenericException("NotYetImplementedException", ch) {}
};
}
*
*/
-#include <map>
#include "Batch_Versatile.hxx"
#include "Batch_InvalidKeyException.hxx"
#include "Batch_Parametre.hxx"
+using namespace std;
+
// Definition des membres constants statiques
// Definition des noms globaux pour les clefs en tant que references
// TODO : supprimer les declarations statiques des clefs de la map
#ifndef _PARAMETRE_H_
#define _PARAMETRE_H_
-using namespace std;
+#include "Batch_Defines.hxx"
+
#include <map>
#include <string>
#include "Batch_InvalidKeyException.hxx"
#include "Batch_Versatile.hxx"
-
// Ces macros permettent de simplifier l'ajout de nouvelles
// clefs dans la map Parametre
// TODO : remplacer ce mecanisme statique par la lecture
// TODO : d'une descrption dans un fichier exterieur (genre XML)
-#define def_extern_MapKey(mk) extern const string & mk;
-#define def_static_MapKey(mk) const string Batch::Parametre::mk(#mk); \
- const string & mk = Batch::Parametre::mk;
+#define def_extern_MapKey(mk) extern BATCH_EXPORT const std::string & mk;
+#define def_static_MapKey(mk) const std::string Batch::Parametre::mk(#mk); \
+ const std::string & mk = Batch::Parametre::mk;
namespace Batch {
- class Parametre : public map< string, Versatile >
+ class BATCH_EXPORT Parametre : public std::map< std::string, Versatile >
{
public:
// Constructeur standard
Parametre(const Parametre & PM);
// Operateur de recherche dans la map
- Versatile & operator [] (const string &);
- const Versatile & operator [] (const string &) const;
+ Versatile & operator [] (const std::string &);
+ const Versatile & operator [] (const std::string &) const;
// Operateur d'affectation
Parametre & operator =(const Parametre & PM);
// Declarations statique des clefs de la map
// TODO : supprimer les declarations statiques des clefs de la map
- static const string ACCOUNT;
- static const string ARGUMENTS;
- static const string CHECKPOINT;
- static const string CKPTINTERVAL;
- static const string CREATIONTIME;
- static const string EGROUP;
- static const string ELIGIBLETIME;
- static const string ENDTIME;
- static const string EUSER;
- static const string EXECUTABLE;
- static const string EXECUTIONHOST;
- static const string EXITCODE;
- static const string HOLD;
- static const string ID;
- static const string INFILE;
- static const string MAIL;
- static const string MAXCPUTIME;
- static const string MAXDISKSIZE;
- static const string MAXRAMSIZE;
- static const string MAXWALLTIME;
- static const string MODIFICATIONTIME;
- static const string NAME;
- static const string NBPROC;
- static const string OUTFILE;
- static const string PID;
- static const string QUEUE;
- static const string QUEUEDTIME;
- static const string SERVER;
- static const string STARTTIME;
- static const string STATE;
- static const string TEXT;
- static const string TMPDIR;
- static const string USEDCPUTIME;
- static const string USEDDISKSIZE;
- static const string USEDRAMSIZE;
- static const string USEDWALLTIME;
- static const string USER;
- static const string WORKDIR;
- static const string HOMEDIR;
+ static const std::string ACCOUNT;
+ static const std::string ARGUMENTS;
+ static const std::string CHECKPOINT;
+ static const std::string CKPTINTERVAL;
+ static const std::string CREATIONTIME;
+ static const std::string EGROUP;
+ static const std::string ELIGIBLETIME;
+ static const std::string ENDTIME;
+ static const std::string EUSER;
+ static const std::string EXECUTABLE;
+ static const std::string EXECUTIONHOST;
+ static const std::string EXITCODE;
+ static const std::string HOLD;
+ static const std::string ID;
+ static const std::string INFILE;
+ static const std::string MAIL;
+ static const std::string MAXCPUTIME;
+ static const std::string MAXDISKSIZE;
+ static const std::string MAXRAMSIZE;
+ static const std::string MAXWALLTIME;
+ static const std::string MODIFICATIONTIME;
+ static const std::string NAME;
+ static const std::string NBPROC;
+ static const std::string OUTFILE;
+ static const std::string PID;
+ static const std::string QUEUE;
+ static const std::string QUEUEDTIME;
+ static const std::string SERVER;
+ static const std::string STARTTIME;
+ static const std::string STATE;
+ static const std::string TEXT;
+ static const std::string TMPDIR;
+ static const std::string USEDCPUTIME;
+ static const std::string USEDDISKSIZE;
+ static const std::string USEDRAMSIZE;
+ static const std::string USEDWALLTIME;
+ static const std::string USER;
+ static const std::string WORKDIR;
+ static const std::string HOMEDIR;
protected:
- map< string, TypeParam > TypeMap; // map interne servant a controler le type de la valeur associee a chaque clef
+ std::map< std::string, TypeParam > TypeMap; // map interne servant a controler le type de la valeur associee a chaque clef
private:
#include "Batch_PyVersatile.hxx"
#include <string>
+using namespace std;
+
namespace Batch {
// Constructeur a partir d'un objet Versatile
#define _PYVERSATILE_H_
+#include "Batch_Defines.hxx"
+
#include <Python.h>
#include "Batch_Versatile.hxx"
#include "Batch_TypeMismatchException.hxx"
#include "Batch_ListIsFullException.hxx"
#include "Batch_InvalidArgumentException.hxx"
-using namespace std;
namespace Batch {
- class PyVersatile : public Versatile
+ class BATCH_EXPORT PyVersatile : public Versatile
{
public:
// Constructeur a partir d'un objet Versatile
#ifndef _RUNTIMEEXCEPTION_H_
#define _RUNTIMEEXCEPTION_H_
+#include "Batch_Defines.hxx"
+
#include "Batch_GenericException.hxx"
namespace Batch {
- class RunTimeException : public GenericException
+ class BATCH_EXPORT RunTimeException : public GenericException
{
public:
// Constructeur
#ifndef _STRINGTYPE_H_
#define _STRINGTYPE_H_
+#include "Batch_Defines.hxx"
+
#include <string>
#include "Batch_GenericType.hxx"
namespace Batch {
- class StringType : public GenericType
+ class BATCH_EXPORT StringType : public GenericType
{
public:
// Constructeur
#ifndef _TYPEMISMATCHEXCEPTION_H_
#define _TYPEMISMATCHEXCEPTION_H_
+#include "Batch_Defines.hxx"
+
#include "Batch_GenericException.hxx"
namespace Batch {
- class TypeMismatchException : public GenericException
+ class BATCH_EXPORT TypeMismatchException : public GenericException
{
public:
// Constructeur
#ifndef _VERSATILE_H_
#define _VERSATILE_H_
+#include "Batch_Defines.hxx"
+
#include <iostream>
#include <list>
#include <string>
int maxelem; // le nombre d'elements autorises
} TypeParam;
- class Versatile : public std::list< GenericType * >
+ class BATCH_EXPORT Versatile : public std::list< GenericType * >
{
public:
// Constructeur standard et destructeur
Batch_BatchManager_ePBS.hxx \
Batch_FactBatchManager_ePBS.hxx \
Batch_JobInfo_ePBS.hxx \
- MpiImpl.hxx
+ MpiImpl.hxx \
+ Batch_Defines.hxx
LIB_SRC = \
${PYTHON_INCLUDES} \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
- -I$(top_builddir)/salome_adm/unix
+ -I$(top_builddir)/salome_adm/unix
LIB_LIBADD = \
../SALOMELocalTrace/libSALOMELocalTrace.la \
#ifndef _BL_MPIIMPL_H_
#define _BL_MPIIMPL_H_
+#include "Batch_Defines.hxx"
#include <string>
-class MpiImplException
+class BATCH_EXPORT MpiImplException
{
public:
const std::string msg;
MpiImplException(const std::string m) : msg(m) {}
};
-class MpiImpl
+class BATCH_EXPORT MpiImpl
{
public:
// Constructeur et destructeur
};
-class MpiImpl_LAM : public MpiImpl
+class BATCH_EXPORT MpiImpl_LAM : public MpiImpl
{
public:
// Constructeur et destructeur
};
-class MpiImpl_MPICH1 : public MpiImpl
+class BATCH_EXPORT MpiImpl_MPICH1 : public MpiImpl
{
public:
// Constructeur et destructeur
};
-class MpiImpl_MPICH2 : public MpiImpl
+class BATCH_EXPORT MpiImpl_MPICH2 : public MpiImpl
{
public:
// Constructeur et destructeur
};
-class MpiImpl_OPENMPI : public MpiImpl
+class BATCH_EXPORT MpiImpl_OPENMPI : public MpiImpl
{
public:
// Constructeur et destructeur
};
-class MpiImpl_SLURM : public MpiImpl
+class BATCH_EXPORT MpiImpl_SLURM : public MpiImpl
{
public:
// Constructeur et destructeur
/* Le nom du module Python tel qu'il est importe */
%module libBatch_Swig
+/* generate docstrings with types */
+%feature("autodoc", "1");
+
/* Inclusion des conversions de type */
%include libBatch_Swig_typemap.i
%include libBatch_Swig_exception.i
%{
+#include "Batch_Defines.hxx"
#include "Batch_Job.hxx"
#include "Batch_JobId.hxx"
#include "Batch_JobInfo.hxx"
%}
/* Les classes exportees en Python */
+%include Batch_Defines.hxx
%include Batch_Job.hxx
%include Batch_JobId.hxx
%include Batch_JobInfo.hxx
}
}
+%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) Batch::Parametre
+{
+ $1 = PyDict_Check($input)? 1 : 0;
+}
# // construction d'un dictionnaire Python a partir d'un objet Parametre C++
%typemap(out) Batch::Parametre
}
}
+%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) Batch::Environnement
+{
+ $1 = PyDict_Check($input)? 1 : 0;
+}
# // construction d'un dictionnaire Python a partir d'un objet Environnement C++
%typemap(out) Batch::Environnement
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SALOMEMultiComm.hxx"
-#ifndef WNT
-using namespace std;
-#endif
SALOMEMultiComm::SALOMEMultiComm():_type(SALOME::CORBA_)
{
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SALOME_Comm_i.hxx"
-#ifndef WNT
+#ifndef WIN32
#include <rpc/xdr.h>
#endif
#include "omniORB4/poa.h"
#include "SenderFactory.hxx"
using namespace std;
-#ifndef WNT
+#ifndef WIN32
CORBA::ORB_var &getGlobalORB(){
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
CORBA::ORB_var &orb = init(0,0);
~SALOME_CorbaLongCSender_i();
CORBA::ULong getSize();
SALOME::vectorOfLong* sendPart(CORBA::ULong offset, CORBA::ULong length);
-#ifndef WNT
+#ifndef WIN32
SALOME::CorbaLongCSender_ptr _this();
#endif
};
/*! Type the component of the array*/
SALOME::TypeOfDataTransmitted _type;
public:
- SALOME_MPISender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
+ SALOME_MPISender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool owntabToSend=false);
~SALOME_MPISender_i();
SALOME::MPISender::param* getParam();
void send();
public SALOME_MPISender_i
{
public:
- SALOME_MPISenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+ SALOME_MPISenderDouble_i(const double *tabToSend,long lgrTabToSend,bool oWNTabToSend=false);
};
class COMMUNICATION_EXPORT SALOME_MPISenderInt_i : public POA_SALOME::MPISenderInt,
public SALOME_MPISender_i
{
public:
- SALOME_MPISenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+ SALOME_MPISenderInt_i(const int *tabToSend,long lgrTabToSend,bool owntabToSend=false);
};
#endif
/*! Type the component of the array*/
SALOME::TypeOfDataTransmitted _type;
public:
- SALOME_SocketSender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool ownTabToSend=false);
+ SALOME_SocketSender_i(const void *tabToSend,long lgrTabToSend,int sizeOf,bool owntabToSend=false);
~SALOME_SocketSender_i();
SALOME::SocketSender::param* getParam();
void send();
public SALOME_SocketSender_i
{
public:
- SALOME_SocketSenderDouble_i(const double *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+ SALOME_SocketSenderDouble_i(const double *tabToSend,long lgrTabToSend,bool owntabToSend=false);
};
class COMMUNICATION_EXPORT SALOME_SocketSenderInt_i : public POA_SALOME::SocketSenderInt,
public SALOME_SocketSender_i
{
public:
- SALOME_SocketSenderInt_i(const int *tabToSend,long lgrTabToSend,bool ownTabToSend=false);
+ SALOME_SocketSenderInt_i(const int *tabToSend,long lgrTabToSend,bool owntabToSend=false);
};
#endif
#ifndef _SALOME_COMMIUNICATION_HXX_
#define _SALOME_COMMIUNICATION_HXX_
-#ifdef WNT
- #if defined COMMUNICATION_EXPORTS
- #if defined WIN32
- #define COMMUNICATION_EXPORT __declspec( dllexport )
- #else
- #define COMMUNICATION_EXPORT
- #endif
- #else
- #if defined WIN32
- #define COMMUNICATION_EXPORT __declspec( dllimport )
- #else
- #define COMMUNICATION_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef COMMUNICATION_EXPORTS
+# define COMMUNICATION_EXPORT __declspec( dllexport )
+# else
+# define COMMUNICATION_EXPORT __declspec( dllimport )
+# endif
#else
- #define COMMUNICATION_EXPORT
+# define COMMUNICATION_EXPORT
#endif
#endif
//
%module libSALOME_Comm
+%feature("autodoc", "1");
+
%{
#include "ReceiverFactory.hxx"
#include "MatrixClient.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_Container_i.hxx"
#include "RegistryConnexion.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <dlfcn.h>
#endif
#include <cstdlib>
#include "utilities.h"
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
* \param instanceName unique instance name for this object (see Container_i)
* \param interfaceName component class name
* \param notif use of notification
+ * \param regist (true or false) use of registry (default true)
*/
//=============================================================================
Engines::Container_ptr container,
const char *instanceName,
const char *interfaceName,
- bool notif) :
+ bool notif,
+ bool regist) :
_instanceName(instanceName),
_interfaceName(interfaceName),
_myConnexionToRegistry(0),
_contId = 0;
}
const CORBA::String_var ior = _orb->object_to_string(_container);
- _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str());
+ if(regist)
+ _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str());
_notifSupplier = new NOTIFICATION_Supplier(instanceName, notif);
}
void Engines_Component_i::ping()
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE("Engines_Component_i::ping() pid "<< getpid() << " threadid "
<< pthread_self());
#else
MESSAGE("Engines_Component_i::destroy()");
//SCRUTE(pd_refCount);
- delete _notifSupplier;
- _notifSupplier = 0;
-
- delete _myConnexionToRegistry;
+ if(_myConnexionToRegistry)delete _myConnexionToRegistry;
_myConnexionToRegistry = 0 ;
+ if(_notifSupplier)delete _notifSupplier;
+ _notifSupplier = 0;
if(_id)
delete(_id) ;
//SCRUTE(pd_refCount);
// MESSAGE("Engines_Component_i::Kill_i() pthread_t "<< pthread_self()
// << " pid " << getpid() << " instanceName "
// << _instanceName.c_str() << " interface " << _interfaceName.c_str()
-// << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+// << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
// << dec << " _ThreadId " << _ThreadId << " this " << hex << this
// << dec ) ;
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
{
RetVal = Killer( _ThreadId , SIGUSR2 ) ;
bool Engines_Component_i::Stop_impl()
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE("Engines_Component_i::Stop_i() pthread_t "<< pthread_self()
<< " pid " << getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#else
MESSAGE("Engines_Component_i::Stop_i() pthread_t "<< pthread_self().p
<< " pid " << _getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#endif
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
{
RetVal = Killer( _ThreadId , 0 ) ;
bool Engines_Component_i::Suspend_impl()
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE("Engines_Component_i::Suspend_i() pthread_t "<< pthread_self()
<< " pid " << getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#else
MESSAGE("Engines_Component_i::Suspend_i() pthread_t "<< pthread_self().p
<< " pid " << _getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#endif
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
#else
if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
}
else
{
-#ifndef WNT
+#ifndef WIN32
RetVal = Killer( _ThreadId ,SIGINT ) ;
#else
RetVal = Killer( *_ThreadId ,SIGINT ) ;
bool Engines_Component_i::Resume_impl()
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE("Engines_Component_i::Resume_i() pthread_t "<< pthread_self()
<< " pid " << getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#else
MESSAGE("Engines_Component_i::Resume_i() pthread_t "<< pthread_self().p
<< " pid " << _getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#endif
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
#else
if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
{
if ( _ThreadId > 0 )
{
-#ifndef WNT
+#ifndef WIN32
if ( pthread_self() != _ThreadId )
#else
if ( pthread_self().p != _ThreadId->p )
{
// Get Cpu in the appropriate thread with that object !...
theEngines_Component = this ;
-#ifndef WNT
+#ifndef WIN32
Killer( _ThreadId ,SIGUSR1 ) ;
#else
Killer( *_ThreadId ,SIGUSR11 ) ;
void Engines_Component_i::beginService(const char *serviceName)
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE(pthread_self() << "Send BeginService notification for " <<serviceName
<< endl << "Component instance : " << _instanceName << endl << endl);
#else
MESSAGE(pthread_self().p << "Send BeginService notification for " <<serviceName
<< endl << "Component instance : " << _instanceName << endl << endl);
#endif
-#ifndef WNT
+#ifndef WIN32
_ThreadId = pthread_self() ;
#else
_ThreadId = new pthread_t;
if ( !_CanceledThread )
_ThreadCpuUsed = CpuUsed_impl() ;
-#ifndef WNT
+#ifndef WIN32
MESSAGE(pthread_self() << " Send EndService notification for " << serviceName
<< endl << " Component instance : " << _instanceName << " StartUsed "
<< _StartUsed << " _ThreadCpuUsed "<< _ThreadCpuUsed << endl <<endl);
bool Engines_Component_i::Killer( pthread_t ThreadId , int signum )
{
-#ifndef WNT
+#ifndef WIN32
if ( ThreadId )
#else
if ( ThreadId.p )
}
else
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
<< " pthread_canceled") ;
#else
}
else
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
<< " pthread_killed(" << signum << ")") ;
#else
long Engines_Component_i::CpuUsed()
{
long cpu = 0 ;
-#ifndef WNT
+#ifndef WIN32
struct rusage usage ;
if ( _ThreadId || _Executed )
{
#include <string.h>
#include <stdio.h>
#include <time.h>
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#include <dlfcn.h>
#include <unistd.h>
#else
#include <signal.h>
#include <process.h>
+#include <direct.h>
int SIGUSR1 = 1000;
#endif
#include "utilities.h"
#include <SALOMEconfig.h>
-//#ifndef WNT
#include CORBA_SERVER_HEADER(SALOME_Component)
#include CORBA_SERVER_HEADER(SALOME_Exception)
-//#else
-//#include <SALOME_Component.hh>
-//#endif
#include <pthread.h> // must be before Python.h !
#include "SALOME_Container_i.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_FileTransfer_i.hxx"
#include "Salome_file_i.hxx"
#include "SALOME_NamingService.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include <Python.h>
#include "Container_init_python.hxx"
// Other Containers are started via start_impl of FactoryServer
extern "C" {void ActSigIntHandler() ; }
-#ifndef WNT
- extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; }
+#ifndef WIN32
+extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; }
#else
- extern "C" {void SigIntHandler( int ) ; }
+extern "C" {void SigIntHandler( int ) ; }
+#endif
+
+#ifdef WIN32
+# define separator '\\'
+#else
+# define separator '/'
#endif
//=============================================================================
/*!
- * Default constructor, not for use
- */
+* Default constructor, not for use
+*/
//=============================================================================
Engines_Container_i::Engines_Container_i () :
- _numInstance(0)
+_numInstance(0)
{
}
//=============================================================================
/*!
- * Construtor to use
- */
+* Construtor to use
+*/
//=============================================================================
Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb,
bool activAndRegist,
bool isServantAloneInProcess
) :
- _numInstance(0),_isServantAloneInProcess(isServantAloneInProcess)
+_numInstance(0),_isServantAloneInProcess(isServantAloneInProcess)
{
_pid = (long)getpid();
_argc = argc ;
_argv = argv ;
- string hostname = GetHostname();
-#ifndef WNT
+ string hostname = Kernel_Utils::GetHostname();
+#ifndef WIN32
MESSAGE(hostname << " " << getpid() <<
- " Engines_Container_i starting argc " <<
- _argc << " Thread " << pthread_self() ) ;
+ " Engines_Container_i starting argc " <<
+ _argc << " Thread " << pthread_self() ) ;
#else
MESSAGE(hostname << " " << _getpid() <<
- " Engines_Container_i starting argc " << _argc<< " Thread " << pthread_self().p ) ;
+ " Engines_Container_i starting argc " << _argc<< " Thread " << pthread_self().p ) ;
#endif
int i = 0 ;
while ( _argv[ i ] )
- {
- MESSAGE(" argv" << i << " " << _argv[ i ]) ;
- i++ ;
- }
+ {
+ MESSAGE(" argv" << i << " " << _argv[ i ]) ;
+ i++ ;
+ }
if ( argc < 2 )
- {
- INFOS("SALOME_Container usage : SALOME_Container ServerName");
- ASSERT(0) ;
- }
+ {
+ INFOS("SALOME_Container usage : SALOME_Container ServerName");
+ ASSERT(0) ;
+ }
SCRUTE(argv[1]);
_isSupervContainer = false;
if (strcmp(argv[1],"SuperVisionContainer") == 0) _isSupervContainer = true;
if (_isSupervContainer)
- {
- _ArgC = argc ;
- _ArgV = argv ;
- }
+ {
+ _ArgC = argc ;
+ _ArgV = argv ;
+ }
_orb = CORBA::ORB::_duplicate(orb) ;
_poa = PortableServer::POA::_duplicate(poa) ;
-
+
// Pour les containers paralleles: il ne faut pas enregistrer et activer
// le container generique, mais le container specialise
if(activAndRegist)
+ {
+ _id = _poa->activate_object(this);
+ _NS = new SALOME_NamingService();
+ _NS->init_orb( _orb ) ;
+ CORBA::Object_var obj=_poa->id_to_reference(*_id);
+ Engines::Container_var pCont
+ = Engines::Container::_narrow(obj);
+ _remove_ref();
+
+ _containerName = _NS->BuildContainerNameForNS(containerName,
+ hostname.c_str());
+ SCRUTE(_containerName);
+ _NS->Register(pCont, _containerName.c_str());
+ MESSAGE("Engines_Container_i::Engines_Container_i : Container name "
+ << _containerName);
+
+ // Python:
+ // import SALOME_Container
+ // pycont = SALOME_Container.SALOME_Container_i(containerIORStr)
+
+ CORBA::String_var sior = _orb->object_to_string(pCont);
+ string myCommand="pyCont = SALOME_Container.SALOME_Container_i('";
+ myCommand += _containerName + "','";
+ myCommand += sior;
+ myCommand += "')\n";
+ SCRUTE(myCommand);
+
+ if (!_isSupervContainer)
{
- _id = _poa->activate_object(this);
- _NS = new SALOME_NamingService();
- _NS->init_orb( _orb ) ;
- CORBA::Object_var obj=_poa->id_to_reference(*_id);
- Engines::Container_var pCont
- = Engines::Container::_narrow(obj);
- _remove_ref();
-
- _containerName = _NS->BuildContainerNameForNS(containerName,
- hostname.c_str());
- SCRUTE(_containerName);
- _NS->Register(pCont, _containerName.c_str());
- MESSAGE("Engines_Container_i::Engines_Container_i : Container name "
- << _containerName);
-
- // Python:
- // import SALOME_Container
- // pycont = SALOME_Container.SALOME_Container_i(containerIORStr)
-
- CORBA::String_var sior = _orb->object_to_string(pCont);
- string myCommand="pyCont = SALOME_Container.SALOME_Container_i('";
- myCommand += _containerName + "','";
- myCommand += sior;
- myCommand += "')\n";
- SCRUTE(myCommand);
-
- if (!_isSupervContainer)
- {
-#ifdef WNT
+#ifdef WIN32
- PyEval_AcquireLock();
- PyThreadState *myTstate = PyThreadState_New(KERNEL_PYTHON::_interp);
- PyThreadState *myoldTstate = PyThreadState_Swap(myTstate);
+ PyEval_AcquireLock();
+ PyThreadState *myTstate = PyThreadState_New(KERNEL_PYTHON::_interp);
+ PyThreadState *myoldTstate = PyThreadState_Swap(myTstate);
#else
- Py_ACQUIRE_NEW_THREAD;
+ Py_ACQUIRE_NEW_THREAD;
#endif
-#ifdef WNT
- // mpv: this is temporary solution: there is a unregular crash if not
- //Sleep(2000);
- //
- // first element is the path to Registry.dll, but it's wrong
- PyRun_SimpleString("import sys\n");
- PyRun_SimpleString("sys.path = sys.path[1:]\n");
+#ifdef WIN32
+ // mpv: this is temporary solution: there is a unregular crash if not
+ //Sleep(2000);
+ //
+ // first element is the path to Registry.dll, but it's wrong
+ PyRun_SimpleString("import sys\n");
+ PyRun_SimpleString("sys.path = sys.path[1:]\n");
#endif
- PyRun_SimpleString("import SALOME_Container\n");
- PyRun_SimpleString((char*)myCommand.c_str());
- Py_RELEASE_NEW_THREAD;
- }
-
- fileTransfer_i* aFileTransfer = new fileTransfer_i();
- CORBA::Object_var obref=aFileTransfer->_this();
- _fileTransfer = Engines::fileTransfer::_narrow(obref);
- aFileTransfer->_remove_ref();
+ PyRun_SimpleString("import SALOME_Container\n");
+ PyRun_SimpleString((char*)myCommand.c_str());
+ Py_RELEASE_NEW_THREAD;
}
+
+ fileTransfer_i* aFileTransfer = new fileTransfer_i();
+ CORBA::Object_var obref=aFileTransfer->_this();
+ _fileTransfer = Engines::fileTransfer::_narrow(obref);
+ aFileTransfer->_remove_ref();
+ }
}
//=============================================================================
/*!
- * Destructor
- */
+* Destructor
+*/
//=============================================================================
Engines_Container_i::~Engines_Container_i()
//=============================================================================
/*!
- * CORBA attribute: Container name (see constructor)
- */
+* CORBA attribute: Container name (see constructor)
+*/
//=============================================================================
char* Engines_Container_i::name()
{
- return CORBA::string_dup(_containerName.c_str()) ;
+ return CORBA::string_dup(_containerName.c_str()) ;
}
//=============================================================================
/*!
- * CORBA attribute: Container working directory
- */
+* CORBA attribute: Container working directory
+*/
//=============================================================================
char* Engines_Container_i::workingdir()
//=============================================================================
/*!
- * CORBA attribute: Container log file name
- */
+* CORBA attribute: Container log file name
+*/
//=============================================================================
char* Engines_Container_i::logfilename()
//=============================================================================
/*!
- * CORBA method: Get the hostName of the Container (without domain extensions)
- */
+* CORBA method: Get the hostName of the Container (without domain extensions)
+*/
//=============================================================================
char* Engines_Container_i::getHostName()
{
- string s = GetHostname();
+ string s = Kernel_Utils::GetHostname();
// MESSAGE("Engines_Container_i::getHostName " << s);
return CORBA::string_dup(s.c_str()) ;
}
//=============================================================================
/*!
- * CORBA method: Get the PID (process identification) of the Container
- */
+* CORBA method: Get the PID (process identification) of the Container
+*/
//=============================================================================
CORBA::Long Engines_Container_i::getPID()
//=============================================================================
/*!
- * CORBA method: check if servant is still alive
- */
+* CORBA method: check if servant is still alive
+*/
//=============================================================================
void Engines_Container_i::ping()
//=============================================================================
/*!
- * CORBA method, oneway: Server shutdown.
- * - Container name removed from naming service,
- * - servant deactivation,
- * - orb shutdown if no other servants in the process
- */
+* CORBA method, oneway: Server shutdown.
+* - Container name removed from naming service,
+* - servant deactivation,
+* - orb shutdown if no other servants in the process
+*/
//=============================================================================
void Engines_Container_i::Shutdown()
MESSAGE("Engines_Container_i::Shutdown()");
/* For each component contained in this container
- * tell it to self-destroy
- */
+ * tell it to self-destroy
+ */
std::map<std::string, Engines::Component_var>::iterator itm;
for (itm = _listInstances_map.begin(); itm != _listInstances_map.end(); itm++)
- itm->second->destroy();
+ {
+ try
+ {
+ itm->second->destroy();
+ }
+ catch(const CORBA::Exception& e)
+ {
+ // ignore this entry and continue
+ }
+ catch(...)
+ {
+ // ignore this entry and continue
+ }
+ }
_NS->Destroy_FullDirectory(_containerName.c_str());
_NS->Destroy_Name(_containerName.c_str());
//_remove_ref();
//_poa->deactivate_object(*_id);
if(_isServantAloneInProcess)
- {
- MESSAGE("Effective Shutdown of container Begins...");
- if(!CORBA::is_nil(_orb))
- _orb->shutdown(0);
- }
+ {
+ MESSAGE("Effective Shutdown of container Begins...");
+ if(!CORBA::is_nil(_orb))
+ _orb->shutdown(0);
+ }
}
/* int checkifexecutable(const char *filename)
- *
- * Return non-zero if the name is an executable file, and
- * zero if it is not executable, or if it does not exist.
- */
+*
+* Return non-zero if the name is an executable file, and
+* zero if it is not executable, or if it does not exist.
+*/
-int checkifexecutable(const char *filename)
+int checkifexecutable(const string& filename)
{
- int result;
- struct stat statinfo;
-
- result = stat(filename, &statinfo);
- if (result < 0) return 0;
- if (!S_ISREG(statinfo.st_mode)) return 0;
-
- if (statinfo.st_uid == geteuid()) return statinfo.st_mode & S_IXUSR;
- if (statinfo.st_gid == getegid()) return statinfo.st_mode & S_IXGRP;
- return statinfo.st_mode & S_IXOTH;
+ int result;
+ struct stat statinfo;
+
+ result = stat(filename.c_str(), &statinfo);
+ if (result < 0) return 0;
+ if (!S_ISREG(statinfo.st_mode)) return 0;
+
+#ifdef WIN32
+ return 1;
+#else
+ if (statinfo.st_uid == geteuid()) return statinfo.st_mode & S_IXUSR;
+ if (statinfo.st_gid == getegid()) return statinfo.st_mode & S_IXGRP;
+ return statinfo.st_mode & S_IXOTH;
+#endif
}
/* int findpathof(char *pth, const char *exe)
- *
- * Find executable by searching the PATH environment variable.
- *
- * const char *exe - executable name to search for.
- * char *pth - the path found is stored here, space
- * needs to be available.
- *
- * If a path is found, returns non-zero, and the path is stored
- * in pth. If exe is not found returns 0, with pth undefined.
- */
-
-int findpathof(char *pth, const char *exe)
+*
+* Find executable by searching the PATH environment variable.
+*
+* const char *exe - executable name to search for.
+* char *pth - the path found is stored here, space
+* needs to be available.
+*
+* If a path is found, returns non-zero, and the path is stored
+* in pth. If exe is not found returns 0, with pth undefined.
+*/
+
+int findpathof(string& pth, const string& exe)
{
- char *searchpath;
- char *beg, *end;
- int stop, found;
- int len;
-
- if (strchr(exe, '/') != NULL) {
- if (realpath(exe, pth) == NULL) return 0;
- return checkifexecutable(pth);
- }
-
- searchpath = getenv("PATH");
- if (searchpath == NULL) return 0;
- if (strlen(searchpath) <= 0) return 0;
-
- beg = searchpath;
- stop = 0; found = 0;
- do {
- end = strchr(beg, ':');
- if (end == NULL) {
- stop = 1;
- strncpy(pth, beg, PATH_MAX);
- len = strlen(pth);
- } else {
- strncpy(pth, beg, end - beg);
- pth[end - beg] = '\0';
- len = end - beg;
- }
- if (pth[len - 1] != '/') strncat(pth, "/", 1);
- strncat(pth, exe, PATH_MAX - len);
- found = checkifexecutable(pth);
- if (!stop) beg = end + 1;
- } while (!stop && !found);
-
- return found;
+ string path( getenv("PATH") );
+ if ( path.size() == 0 )
+ return 0;
+
+ char path_spr =
+#ifdef WIN32
+ ';';
+#else
+ ':';
+#endif
+
+ char dir_spr =
+#ifdef WIN32
+ '\\';
+#else
+ '/';
+#endif
+
+ int offset = 0;
+ int stop = 0;
+ int found = 0;
+ while(!stop && !found)
+ {
+ int pos = path.find( path_spr, offset );
+ if (pos == string::npos)
+ stop = 1;
+
+ pth = path.substr( offset, pos - offset );
+ if ( pth.size() > 0 )
+ {
+ if( pth[pth.size()-1] != dir_spr )
+ pth += dir_spr;
+ pth += exe;
+ found = checkifexecutable(pth.c_str());
+ }
+ offset = pos+1;
+ }
+
+
+/* char *searchpath;
+ char *beg, *end;
+ int stop, found;
+ int len;
+
+ if (strchr(exe, separator) != NULL) {
+#ifndef WIN32
+ if (realpath(exe, pth) == NULL) return 0;
+#endif
+ return checkifexecutable(pth);
+ }
+
+ searchpath = getenv("PATH");
+ if (searchpath == NULL) return 0;
+ if (strlen(searchpath) <= 0) return 0;
+
+ string env_path(searchpath);
+
+ beg = searchpath;
+ stop = 0; found = 0;
+ do {
+ end = strchr(beg, ':');
+ if (end == NULL) {
+ stop = 1;
+ strncpy(pth, beg, PATH_MAX);
+ len = strlen(pth);
+ } else {
+ strncpy(pth, beg, end - beg);
+ pth[end - beg] = '\0';
+ len = end - beg;
+ }
+ if (pth[len - 1] != '/') strncat(pth, "/", 1);
+ strncat(pth, exe, PATH_MAX - len);
+ found = checkifexecutable(pth);
+ if (!stop) beg = end + 1;
+ } while (!stop && !found);
+*/
+ return found;
}
//=============================================================================
/*!
- * CORBA method: load a new component class (Python or C++ implementation)
- * \param componentName like COMPONENT
- * try to make a Python import of COMPONENT,
- * then a lib open of libCOMPONENTEngine.so
- * \return true if dlopen successfull or already done, false otherwise
- */
+* CORBA method: load a new component class (Python or C++ implementation)
+* \param componentName like COMPONENT
+* try to make a Python import of COMPONENT,
+* then a lib open of libCOMPONENTEngine.so
+* \return true if dlopen successfull or already done, false otherwise
+*/
//=============================================================================
bool
// --- try dlopen C++ component
-#ifndef WNT
+#ifndef WIN32
string impl_name = string ("lib") + aCompName + string("Engine.so");
#else
string impl_name = aCompName + string("Engine.dll");
#endif
SCRUTE(impl_name);
-
+
_numInstanceMutex.lock(); // lock to be alone
// (see decInstanceCnt, finalize_removal))
if (_toRemove_map.count(impl_name) != 0) _toRemove_map.erase(impl_name);
if (_library_map.count(impl_name) != 0)
- {
- MESSAGE("Library " << impl_name << " already loaded");
- _numInstanceMutex.unlock();
- return true;
- }
-
-#ifndef WNT
+ {
+ MESSAGE("Library " << impl_name << " already loaded");
+ _numInstanceMutex.unlock();
+ return true;
+ }
+
+#ifndef WIN32
void* handle;
handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
#else
if ( handle )
{
- _library_map[impl_name] = handle;
- _numInstanceMutex.unlock();
- return true;
+ _library_map[impl_name] = handle;
+ _numInstanceMutex.unlock();
+ return true;
}
_numInstanceMutex.unlock();
INFOS("try import Python component "<<componentName);
if (_isSupervContainer)
- {
- INFOS("Supervision Container does not support Python Component Engines");
- return false;
- }
+ {
+ INFOS("Supervision Container does not support Python Component Engines");
+ return false;
+ }
if (_library_map.count(aCompName) != 0)
- {
- return true; // Python Component, already imported
- }
+ {
+ return true; // Python Component, already imported
+ }
else
+ {
+ Py_ACQUIRE_NEW_THREAD;
+ PyObject *mainmod = PyImport_AddModule("__main__");
+ PyObject *globals = PyModule_GetDict(mainmod);
+ PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
+ PyObject *result = PyObject_CallMethod(pyCont,
+ (char*)"import_component",
+ (char*)"s",componentName);
+ int ret= PyInt_AsLong(result);
+ Py_XDECREF(result);
+ SCRUTE(ret);
+ Py_RELEASE_NEW_THREAD;
+
+ if (ret) // import possible: Python component
{
- Py_ACQUIRE_NEW_THREAD;
- PyObject *mainmod = PyImport_AddModule("__main__");
- PyObject *globals = PyModule_GetDict(mainmod);
- PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
- PyObject *result = PyObject_CallMethod(pyCont,
- (char*)"import_component",
- (char*)"s",componentName);
- int ret= PyInt_AsLong(result);
- Py_XDECREF(result);
- SCRUTE(ret);
- Py_RELEASE_NEW_THREAD;
-
- if (ret) // import possible: Python component
- {
- _numInstanceMutex.lock() ; // lock to be alone (stl container write)
- _library_map[aCompName] = (void *)pyCont; // any non O value OK
- _numInstanceMutex.unlock() ;
- MESSAGE("import Python: "<<aCompName<<" OK");
- return true;
- }
+ _numInstanceMutex.lock() ; // lock to be alone (stl container write)
+ _library_map[aCompName] = (void *)pyCont; // any non O value OK
+ _numInstanceMutex.unlock() ;
+ MESSAGE("import Python: "<<aCompName<<" OK");
+ return true;
}
+ }
// Try to find an executable
std::string executable=aCompName+".exe";
- char path[PATH_MAX+1];
- if (findpathof(path, executable.c_str()))
+ string path;
+ if (findpathof(path, executable))
return true;
INFOS( "Impossible to load component: " << componentName );
//=============================================================================
/*!
- * CORBA method: Creates a new servant instance of a component.
- * The servant registers itself to naming service and Registry.
- * \param genericRegisterName Name of the component instance to register
- * in Registry & Name Service (without _inst_n suffix)
- * \param studyId 0 for multiStudy instance,
- * study Id (>0) otherwise
- * \return a loaded component
- */
+* CORBA method: Creates a new servant instance of a component.
+* The servant registers itself to naming service and Registry.
+* \param genericRegisterName Name of the component instance to register
+* in Registry & Name Service (without _inst_n suffix)
+* \param studyId 0 for multiStudy instance,
+* study Id (>0) otherwise
+* \return a loaded component
+*/
//=============================================================================
Engines::Component_ptr
CORBA::Long studyId)
{
if (studyId < 0)
- {
- INFOS("studyId must be > 0 for mono study instance, =0 for multiStudy");
- return Engines::Component::_nil() ;
- }
+ {
+ INFOS("studyId must be > 0 for mono study instance, =0 for multiStudy");
+ return Engines::Component::_nil() ;
+ }
Engines::Component_var iobject = Engines::Component::_nil() ;
string aCompName = genericRegisterName;
if (_library_map.count(aCompName) != 0) // Python component
+ {
+ if (_isSupervContainer)
{
- if (_isSupervContainer)
- {
- INFOS("Supervision Container does not support Python Component Engines");
- return Engines::Component::_nil();
- }
- _numInstanceMutex.lock() ; // lock on the instance number
- _numInstance++ ;
- int numInstance = _numInstance ;
- _numInstanceMutex.unlock() ;
-
- char aNumI[12];
- sprintf( aNumI , "%d" , numInstance ) ;
- string instanceName = aCompName + "_inst_" + aNumI ;
- string component_registerName =
- _containerName + "/" + instanceName;
-
- Py_ACQUIRE_NEW_THREAD;
- PyObject *mainmod = PyImport_AddModule("__main__");
- PyObject *globals = PyModule_GetDict(mainmod);
- PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
- PyObject *result = PyObject_CallMethod(pyCont,
- (char*)"create_component_instance",
- (char*)"ssl",
- aCompName.c_str(),
- instanceName.c_str(),
- studyId);
- string iors = PyString_AsString(result);
- Py_DECREF(result);
- SCRUTE(iors);
- Py_RELEASE_NEW_THREAD;
-
- if( iors!="" )
- {
- CORBA::Object_var obj = _orb->string_to_object(iors.c_str());
- iobject = Engines::Component::_narrow( obj ) ;
- _listInstances_map[instanceName] = iobject;
- }
- return iobject._retn();
+ INFOS("Supervision Container does not support Python Component Engines");
+ return Engines::Component::_nil();
+ }
+ _numInstanceMutex.lock() ; // lock on the instance number
+ _numInstance++ ;
+ int numInstance = _numInstance ;
+ _numInstanceMutex.unlock() ;
+
+ char aNumI[12];
+ sprintf( aNumI , "%d" , numInstance ) ;
+ string instanceName = aCompName + "_inst_" + aNumI ;
+ string component_registerName =
+ _containerName + "/" + instanceName;
+
+ Py_ACQUIRE_NEW_THREAD;
+ PyObject *mainmod = PyImport_AddModule("__main__");
+ PyObject *globals = PyModule_GetDict(mainmod);
+ PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
+ PyObject *result = PyObject_CallMethod(pyCont,
+ (char*)"create_component_instance",
+ (char*)"ssl",
+ aCompName.c_str(),
+ instanceName.c_str(),
+ studyId);
+ string iors = PyString_AsString(result);
+ Py_DECREF(result);
+ SCRUTE(iors);
+ Py_RELEASE_NEW_THREAD;
+
+ if( iors!="" )
+ {
+ CORBA::Object_var obj = _orb->string_to_object(iors.c_str());
+ iobject = Engines::Component::_narrow( obj ) ;
+ _listInstances_map[instanceName] = iobject;
}
-
+ return iobject._retn();
+ }
+
//--- try C++
-#ifndef WNT
+#ifndef WIN32
string impl_name = string ("lib") + genericRegisterName +string("Engine.so");
#else
string impl_name = genericRegisterName +string("Engine.dll");
#endif
if (_library_map.count(impl_name) != 0) // C++ component
- {
- void* handle = _library_map[impl_name];
- iobject = createInstance(genericRegisterName,
- handle,
- studyId);
- return iobject._retn();
- }
+ {
+ void* handle = _library_map[impl_name];
+ iobject = createInstance(genericRegisterName,
+ handle,
+ studyId);
+ return iobject._retn();
+ }
// If it's not a Python or a C++ component try to launch a standalone component
// in a sub directory
//check if an entry exist in naming service
CORBA::Object_var nsobj = _NS->Resolve(component_registerName.c_str());
if ( !CORBA::is_nil(nsobj) )
- {
- // unregister the registered component
- _NS->Destroy_Name(component_registerName.c_str());
- //kill or shutdown it ???
- }
+ {
+ // unregister the registered component
+ _NS->Destroy_Name(component_registerName.c_str());
+ //kill or shutdown it ???
+ }
// first arg container ior string
// second arg container name
int status=system(command.c_str());
if (status == -1)
- {
- MESSAGE("SALOME_Container::create_component_instance system failed " << "(system command status -1)");
- return Engines::Component::_nil();
- }
+ {
+ MESSAGE("SALOME_Container::create_component_instance system failed " << "(system command status -1)");
+ return Engines::Component::_nil();
+ }
+#ifndef WIN32
else if (WEXITSTATUS(status) == 217)
- {
- MESSAGE("SALOME_Container::create_component_instance system failed " << "(system command status 217)");
- return Engines::Component::_nil();
- }
+ {
+ MESSAGE("SALOME_Container::create_component_instance system failed " << "(system command status 217)");
+ return Engines::Component::_nil();
+ }
+#endif
else
+ {
+ int count=20;
+ CORBA::Object_var obj = CORBA::Object::_nil() ;
+ while ( CORBA::is_nil(obj) && count )
{
- int count=20;
- CORBA::Object_var obj = CORBA::Object::_nil() ;
- while ( CORBA::is_nil(obj) && count )
- {
-#ifndef WNT
- sleep( 1 ) ;
+#ifndef WIN32
+ sleep( 1 ) ;
#else
- Sleep(1000);
+ Sleep(1000);
#endif
- count-- ;
- MESSAGE( count << ". Waiting for component " << genericRegisterName);
- obj = _NS->Resolve(component_registerName.c_str());
- }
+ count-- ;
+ MESSAGE( count << ". Waiting for component " << genericRegisterName);
+ obj = _NS->Resolve(component_registerName.c_str());
+ }
- if(CORBA::is_nil(obj))
- {
- MESSAGE("SALOME_Container::create_component_instance failed");
- return Engines::Component::_nil();
- }
- else
- {
- MESSAGE("SALOME_Container::create_component_instance successful");
- iobject=Engines::Component::_narrow(obj);
- _listInstances_map[instanceName] = iobject;
- return iobject._retn();
- }
+ if(CORBA::is_nil(obj))
+ {
+ MESSAGE("SALOME_Container::create_component_instance failed");
+ return Engines::Component::_nil();
}
+ else
+ {
+ MESSAGE("SALOME_Container::create_component_instance successful");
+ iobject=Engines::Component::_narrow(obj);
+ _listInstances_map[instanceName] = iobject;
+ return iobject._retn();
+ }
+ }
}
//=============================================================================
/*!
- * CORBA method: Finds a servant instance of a component
- * \param registeredName Name of the component in Registry or Name Service,
- * without instance suffix number
- * \param studyId 0 if instance is not associated to a study,
- * >0 otherwise (== study id)
- * \return the first instance found with same studyId
- */
+* CORBA method: Finds a servant instance of a component
+* \param registeredName Name of the component in Registry or Name Service,
+* without instance suffix number
+* \param studyId 0 if instance is not associated to a study,
+* >0 otherwise (== study id)
+* \return the first instance found with same studyId
+*/
//=============================================================================
Engines::Component_ptr
Engines_Container_i::find_component_instance( const char* registeredName,
- CORBA::Long studyId)
+ CORBA::Long studyId)
{
Engines::Component_var anEngine = Engines::Component::_nil();
map<string,Engines::Component_var>::iterator itm =_listInstances_map.begin();
while (itm != _listInstances_map.end())
+ {
+ string instance = (*itm).first;
+ SCRUTE(instance);
+ if (instance.find(registeredName) == 0)
{
- string instance = (*itm).first;
- SCRUTE(instance);
- if (instance.find(registeredName) == 0)
- {
- anEngine = (*itm).second;
- if (studyId == anEngine->getStudyId())
- {
- return anEngine._retn();
- }
- }
- itm++;
+ anEngine = (*itm).second;
+ if (studyId == anEngine->getStudyId())
+ {
+ return anEngine._retn();
+ }
}
+ itm++;
+ }
return anEngine._retn();
}
//=============================================================================
/*!
- * CORBA method: find or create an instance of the component (servant),
- * load a new component class (dynamic library) if required,
- * ---- FOR COMPATIBILITY WITH 2.2 ----
- * ---- USE ONLY FOR MULTISTUDY INSTANCES ! --------
- * The servant registers itself to naming service and Registry.
- * \param genericRegisterName Name of the component to register
- * in Registry & Name Service
- * \param componentName Name of the constructed library of the component
- * \return a loaded component
- */
+* CORBA method: find or create an instance of the component (servant),
+* load a new component class (dynamic library) if required,
+* ---- FOR COMPATIBILITY WITH 2.2 ----
+* ---- USE ONLY FOR MULTISTUDY INSTANCES ! --------
+* The servant registers itself to naming service and Registry.
+* \param genericRegisterName Name of the component to register
+* in Registry & Name Service
+* \param componentName Name of the constructed library of the component
+* \return a loaded component
+*/
//=============================================================================
Engines::Component_ptr
Engines_Container_i::load_impl( const char* genericRegisterName,
- const char* componentName )
+ const char* componentName )
{
string impl_name = string ("lib") + genericRegisterName +string("Engine.so");
Engines::Component_var iobject = Engines::Component::_nil() ;
iobject = find_or_create_instance(genericRegisterName, impl_name);
return iobject._retn();
}
-
+
//=============================================================================
/*!
- * CORBA method: Stops the component servant, and deletes all related objects
- * \param component_i Component to be removed
- */
+* CORBA method: Stops the component servant, and deletes all related objects
+* \param component_i Component to be removed
+*/
//=============================================================================
void Engines_Container_i::remove_impl(Engines::Component_ptr component_i)
//=============================================================================
/*!
- * CORBA method: Discharges unused libraries from the container.
- */
+* CORBA method: Discharges unused libraries from the container.
+*/
//=============================================================================
void Engines_Container_i::finalize_removal()
{
MESSAGE("finalize unload : dlclose");
_numInstanceMutex.lock(); // lock to be alone
- // (see decInstanceCnt, load_component_Library)
+ // (see decInstanceCnt, load_component_Library)
map<string, void *>::iterator ith;
for (ith = _toRemove_map.begin(); ith != _toRemove_map.end(); ith++)
+ {
+ void *handle = (*ith).second;
+ string impl_name= (*ith).first;
+ if (handle)
{
- void *handle = (*ith).second;
- string impl_name= (*ith).first;
- if (handle)
- {
- SCRUTE(handle);
- SCRUTE(impl_name);
-// dlclose(handle); // SALOME unstable after ...
-// _library_map.erase(impl_name);
- }
+ SCRUTE(handle);
+ SCRUTE(impl_name);
+ // dlclose(handle); // SALOME unstable after ...
+ // _library_map.erase(impl_name);
}
+ }
_toRemove_map.clear();
_numInstanceMutex.unlock();
}
//=============================================================================
/*!
- * CORBA method: Kill the container process with exit(0).
- * To remove : never returns !
- */
+* CORBA method: Kill the container process with exit(0).
+* To remove : never returns !
+*/
//=============================================================================
bool Engines_Container_i::Kill_impl()
{
MESSAGE("Engines_Container_i::Kill() pid "<< getpid() << " containerName "
- << _containerName.c_str() << " machineName "
- << GetHostname().c_str());
+ << _containerName.c_str() << " machineName "
+ << Kernel_Utils::GetHostname().c_str());
INFOS("===============================================================");
INFOS("= REMOVE calls to Kill_impl in C++ container =");
INFOS("===============================================================");
//=============================================================================
/*!
- * CORBA method: get or create a fileRef object associated to a local file
- * (a file on the computer on which runs the container server), which stores
- * a list of (machine, localFileName) corresponding to copies already done.
- *
- * \param origFileName absolute path for a local file to copy on other
- * computers
- * \return a fileRef object associated to the file.
- */
+* CORBA method: get or create a fileRef object associated to a local file
+* (a file on the computer on which runs the container server), which stores
+* a list of (machine, localFileName) corresponding to copies already done.
+*
+* \param origFileName absolute path for a local file to copy on other
+* computers
+* \return a fileRef object associated to the file.
+*/
//=============================================================================
Engines::fileRef_ptr
Engines::fileRef_var theFileRef = Engines::fileRef::_nil();
if (origName[0] != '/')
- {
- INFOS("path of file to copy must be an absolute path begining with '/'");
- return Engines::fileRef::_nil();
- }
+ {
+ INFOS("path of file to copy must be an absolute path begining with '/'");
+ return Engines::fileRef::_nil();
+ }
if (CORBA::is_nil(_fileRef_map[origName]))
- {
- CORBA::Object_var obj=_poa->id_to_reference(*_id);
- Engines::Container_var pCont = Engines::Container::_narrow(obj);
- fileRef_i* aFileRef = new fileRef_i(pCont, origFileName);
- theFileRef = Engines::fileRef::_narrow(aFileRef->_this());
- _numInstanceMutex.lock() ; // lock to be alone (stl container write)
- _fileRef_map[origName] = theFileRef;
- _numInstanceMutex.unlock() ;
- }
-
+ {
+ CORBA::Object_var obj=_poa->id_to_reference(*_id);
+ Engines::Container_var pCont = Engines::Container::_narrow(obj);
+ fileRef_i* aFileRef = new fileRef_i(pCont, origFileName);
+ theFileRef = Engines::fileRef::_narrow(aFileRef->_this());
+ _numInstanceMutex.lock() ; // lock to be alone (stl container write)
+ _fileRef_map[origName] = theFileRef;
+ _numInstanceMutex.unlock() ;
+ }
+
theFileRef = Engines::fileRef::_duplicate(_fileRef_map[origName]);
ASSERT(! CORBA::is_nil(theFileRef));
return theFileRef._retn();
//=============================================================================
/*!
- * CORBA method:
- * \return a reference to the fileTransfer object
- */
+* CORBA method:
+* \return a reference to the fileTransfer object
+*/
//=============================================================================
Engines::fileTransfer_ptr
{
string origName(origFileName);
if (CORBA::is_nil(_Salome_file_map[origName]))
+ {
+ Salome_file_i* aSalome_file = new Salome_file_i();
+ aSalome_file->setContainer(Engines::Container::_duplicate(this->_this()));
+ try
{
- Salome_file_i* aSalome_file = new Salome_file_i();
- aSalome_file->setContainer(Engines::Container::_duplicate(this->_this()));
- try
- {
- aSalome_file->setLocalFile(origFileName);
- aSalome_file->recvFiles();
- }
- catch (const SALOME::SALOME_Exception& e)
- {
- return Engines::Salome_file::_nil();
- }
-
- Engines::Salome_file_var theSalome_file = Engines::Salome_file::_nil();
- theSalome_file = Engines::Salome_file::_narrow(aSalome_file->_this());
- _numInstanceMutex.lock() ; // lock to be alone (stl container write)
- _Salome_file_map[origName] = theSalome_file;
- _numInstanceMutex.unlock() ;
+ aSalome_file->setLocalFile(origFileName);
+ aSalome_file->recvFiles();
+ }
+ catch (const SALOME::SALOME_Exception& e)
+ {
+ return Engines::Salome_file::_nil();
}
-
+
+ Engines::Salome_file_var theSalome_file = Engines::Salome_file::_nil();
+ theSalome_file = Engines::Salome_file::_narrow(aSalome_file->_this());
+ _numInstanceMutex.lock() ; // lock to be alone (stl container write)
+ _Salome_file_map[origName] = theSalome_file;
+ _numInstanceMutex.unlock() ;
+ }
+
Engines::Salome_file_ptr theSalome_file =
Engines::Salome_file::_duplicate(_Salome_file_map[origName]);
ASSERT(!CORBA::is_nil(theSalome_file));
}
//=============================================================================
/*!
- * C++ method: Finds an already existing servant instance of a component, or
- * create an instance.
- * ---- USE ONLY FOR MULTISTUDY INSTANCES ! --------
- * \param genericRegisterName Name of the component instance to register
- * in Registry & Name Service,
- * (without _inst_n suffix, like "COMPONENT")
- * \param componentLibraryName like "libCOMPONENTEngine.so"
- * \return a loaded component
- *
- * example with names:
- * aGenRegisterName = COMPONENT (= first argument)
- * impl_name = libCOMPONENTEngine.so (= second argument)
- * _containerName = /Containers/cli76ce/FactoryServer
- * factoryName = COMPONENTEngine_factory
- * component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT
- *
- * instanceName = COMPONENT_inst_1
- * component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1
- */
+* C++ method: Finds an already existing servant instance of a component, or
+* create an instance.
+* ---- USE ONLY FOR MULTISTUDY INSTANCES ! --------
+* \param genericRegisterName Name of the component instance to register
+* in Registry & Name Service,
+* (without _inst_n suffix, like "COMPONENT")
+* \param componentLibraryName like "libCOMPONENTEngine.so"
+* \return a loaded component
+*
+* example with names:
+* aGenRegisterName = COMPONENT (= first argument)
+* impl_name = libCOMPONENTEngine.so (= second argument)
+* _containerName = /Containers/cli76ce/FactoryServer
+* factoryName = COMPONENTEngine_factory
+* component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT
+*
+* instanceName = COMPONENT_inst_1
+* component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1
+*/
//=============================================================================
Engines::Component_ptr
string aGenRegisterName = genericRegisterName;
string impl_name = componentLibraryName;
if (_library_map.count(impl_name) == 0)
- {
- INFOS("shared library " << impl_name <<" must be loaded before creating instance");
- return Engines::Component::_nil() ;
- }
+ {
+ INFOS("shared library " << impl_name <<" must be loaded before creating instance");
+ return Engines::Component::_nil() ;
+ }
else
- {
- // --- find a registered instance in naming service, or create
+ {
+ // --- find a registered instance in naming service, or create
- void* handle = _library_map[impl_name];
- string component_registerBase =
- _containerName + "/" + aGenRegisterName;
- Engines::Component_var iobject = Engines::Component::_nil() ;
- try
+ void* handle = _library_map[impl_name];
+ string component_registerBase =
+ _containerName + "/" + aGenRegisterName;
+ Engines::Component_var iobject = Engines::Component::_nil() ;
+ try
+ {
+ CORBA::Object_var obj =
+ _NS->ResolveFirst( component_registerBase.c_str());
+ if ( CORBA::is_nil( obj ) )
+ {
+ iobject = createInstance(genericRegisterName,
+ handle,
+ 0); // force multiStudy instance here !
+ }
+ else
+ {
+ iobject = Engines::Component::_narrow( obj ) ;
+ Engines_Component_i *servant =
+ dynamic_cast<Engines_Component_i*>
+ (_poa->reference_to_servant(iobject));
+ ASSERT(servant)
+ int studyId = servant->getStudyId();
+ ASSERT (studyId >= 0);
+ if (studyId == 0) // multiStudy instance, OK
{
- CORBA::Object_var obj =
- _NS->ResolveFirst( component_registerBase.c_str());
- if ( CORBA::is_nil( obj ) )
- {
- iobject = createInstance(genericRegisterName,
- handle,
- 0); // force multiStudy instance here !
- }
- else
- {
- iobject = Engines::Component::_narrow( obj ) ;
- Engines_Component_i *servant =
- dynamic_cast<Engines_Component_i*>
- (_poa->reference_to_servant(iobject));
- ASSERT(servant)
- int studyId = servant->getStudyId();
- ASSERT (studyId >= 0);
- if (studyId == 0) // multiStudy instance, OK
- {
- // No ReBind !
- MESSAGE(component_registerBase.c_str()<<" already bound");
- }
- else // monoStudy instance: NOK
- {
- iobject = Engines::Component::_nil();
- INFOS("load_impl & find_component_instance methods "
- << "NOT SUITABLE for mono study components");
- }
- }
+ // No ReBind !
+ MESSAGE(component_registerBase.c_str()<<" already bound");
}
- catch (...)
+ else // monoStudy instance: NOK
{
- INFOS( "Container_i::load_impl catched" ) ;
+ iobject = Engines::Component::_nil();
+ INFOS("load_impl & find_component_instance methods "
+ << "NOT SUITABLE for mono study components");
}
- return iobject._retn();
+ }
+ }
+ catch (...)
+ {
+ INFOS( "Container_i::load_impl catched" ) ;
}
+ return iobject._retn();
+ }
}
//=============================================================================
/*!
- * C++ method: create a servant instance of a component.
- * \param genericRegisterName Name of the component instance to register
- * in Registry & Name Service,
- * (without _inst_n suffix, like "COMPONENT")
- * \param handle loaded library handle
- * \param studyId 0 for multiStudy instance,
- * study Id (>0) otherwise
- * \return a loaded component
- *
- * example with names:
- * aGenRegisterName = COMPONENT (= first argument)
- * _containerName = /Containers/cli76ce/FactoryServer
- * factoryName = COMPONENTEngine_factory
- * component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT
- * instanceName = COMPONENT_inst_1
- * component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1
- */
+* C++ method: create a servant instance of a component.
+* \param genericRegisterName Name of the component instance to register
+* in Registry & Name Service,
+* (without _inst_n suffix, like "COMPONENT")
+* \param handle loaded library handle
+* \param studyId 0 for multiStudy instance,
+* study Id (>0) otherwise
+* \return a loaded component
+*
+* example with names:
+* aGenRegisterName = COMPONENT (= first argument)
+* _containerName = /Containers/cli76ce/FactoryServer
+* factoryName = COMPONENTEngine_factory
+* component_registerBase = /Containers/cli76ce/FactoryServer/COMPONENT
+* instanceName = COMPONENT_inst_1
+* component_registerName = /Containers/cli76ce/FactoryServer/COMPONENT_inst_1
+*/
//=============================================================================
Engines::Component_ptr
typedef PortableServer::ObjectId * (*FACTORY_FUNCTION)
(CORBA::ORB_ptr,
- PortableServer::POA_ptr,
- PortableServer::ObjectId *,
- const char *,
- const char *) ;
+ PortableServer::POA_ptr,
+ PortableServer::ObjectId *,
+ const char *,
+ const char *) ;
-#ifndef WNT
+#ifndef WIN32
FACTORY_FUNCTION Component_factory = (FACTORY_FUNCTION)dlsym( handle, factory_name.c_str() );
#else
FACTORY_FUNCTION Component_factory = (FACTORY_FUNCTION)GetProcAddress( (HINSTANCE)handle, factory_name.c_str() );
if ( !Component_factory )
{
- INFOS( "Can't resolve symbol: " + factory_name );
-#ifndef WNT
- SCRUTE( dlerror() );
+ INFOS( "Can't resolve symbol: " + factory_name );
+#ifndef WIN32
+ SCRUTE( dlerror() );
#endif
- return Engines::Component::_nil() ;
+ return Engines::Component::_nil() ;
}
// --- create instance
Engines::Component_var iobject = Engines::Component::_nil() ;
try
- {
- _numInstanceMutex.lock() ; // lock on the instance number
- _numInstance++ ;
- int numInstance = _numInstance ;
- _numInstanceMutex.unlock() ;
-
- char aNumI[12];
- sprintf( aNumI , "%d" , numInstance ) ;
- string instanceName = aGenRegisterName + "_inst_" + aNumI ;
- string component_registerName =
- _containerName + "/" + instanceName;
-
- // --- Instanciate required CORBA object
-
- PortableServer::ObjectId *id ; //not owner, do not delete (nore use var)
- id = (Component_factory) ( _orb, _poa, _id, instanceName.c_str(),
- aGenRegisterName.c_str() ) ;
- if (id == NULL)
- return iobject._retn();
-
- // --- get reference & servant from id
-
- CORBA::Object_var obj = _poa->id_to_reference(*id);
- iobject = Engines::Component::_narrow( obj ) ;
+ {
+ _numInstanceMutex.lock() ; // lock on the instance number
+ _numInstance++ ;
+ int numInstance = _numInstance ;
+ _numInstanceMutex.unlock() ;
+
+ char aNumI[12];
+ sprintf( aNumI , "%d" , numInstance ) ;
+ string instanceName = aGenRegisterName + "_inst_" + aNumI ;
+ string component_registerName =
+ _containerName + "/" + instanceName;
+
+ // --- Instanciate required CORBA object
+
+ PortableServer::ObjectId *id ; //not owner, do not delete (nore use var)
+ id = (Component_factory) ( _orb, _poa, _id, instanceName.c_str(),
+ aGenRegisterName.c_str() ) ;
+ if (id == NULL)
+ return iobject._retn();
- Engines_Component_i *servant =
- dynamic_cast<Engines_Component_i*>(_poa->reference_to_servant(iobject));
- ASSERT(servant);
- //SCRUTE(servant->pd_refCount);
- servant->_remove_ref(); // compensate previous id_to_reference
- //SCRUTE(servant->pd_refCount);
- _numInstanceMutex.lock() ; // lock to be alone (stl container write)
- _listInstances_map[instanceName] = iobject;
- _cntInstances_map[aGenRegisterName] += 1;
- _numInstanceMutex.unlock() ;
- SCRUTE(aGenRegisterName);
- SCRUTE(_cntInstances_map[aGenRegisterName]);
- //SCRUTE(servant->pd_refCount);
+ // --- get reference & servant from id
+
+ CORBA::Object_var obj = _poa->id_to_reference(*id);
+ iobject = Engines::Component::_narrow( obj ) ;
+
+ Engines_Component_i *servant =
+ dynamic_cast<Engines_Component_i*>(_poa->reference_to_servant(iobject));
+ ASSERT(servant);
+ //SCRUTE(servant->pd_refCount);
+ servant->_remove_ref(); // compensate previous id_to_reference
+ //SCRUTE(servant->pd_refCount);
+ _numInstanceMutex.lock() ; // lock to be alone (stl container write)
+ _listInstances_map[instanceName] = iobject;
+ _cntInstances_map[aGenRegisterName] += 1;
+ _numInstanceMutex.unlock() ;
+ SCRUTE(aGenRegisterName);
+ SCRUTE(_cntInstances_map[aGenRegisterName]);
+ //SCRUTE(servant->pd_refCount);
#if defined(_DEBUG_) || defined(_DEBUG)
- bool ret_studyId = servant->setStudyId(studyId);
- ASSERT(ret_studyId);
+ bool ret_studyId = servant->setStudyId(studyId);
+ ASSERT(ret_studyId);
#else
- servant->setStudyId(studyId);
+ servant->setStudyId(studyId);
#endif
- // --- register the engine under the name
- // containerName(.dir)/instanceName(.object)
+ // --- register the engine under the name
+ // containerName(.dir)/instanceName(.object)
- _NS->Register( iobject , component_registerName.c_str() ) ;
- MESSAGE( component_registerName.c_str() << " bound" ) ;
- }
+ _NS->Register( iobject , component_registerName.c_str() ) ;
+ MESSAGE( component_registerName.c_str() << " bound" ) ;
+ }
catch (...)
- {
- INFOS( "Container_i::createInstance exception catched" ) ;
- }
+ {
+ INFOS( "Container_i::createInstance exception catched" ) ;
+ }
return iobject._retn();
}
//=============================================================================
/*!
- *
- */
+*
+*/
//=============================================================================
void Engines_Container_i::decInstanceCnt(string genericRegisterName)
MESSAGE("Engines_Container_i::decInstanceCnt " << aGenRegisterName);
ASSERT(_cntInstances_map[aGenRegisterName] > 0);
_numInstanceMutex.lock(); // lock to be alone
- // (see finalize_removal, load_component_Library)
+ // (see finalize_removal, load_component_Library)
_cntInstances_map[aGenRegisterName] -= 1;
SCRUTE(_cntInstances_map[aGenRegisterName]);
if (_cntInstances_map[aGenRegisterName] == 0)
- {
- string impl_name =
- Engines_Component_i::GetDynLibraryName(aGenRegisterName.c_str());
- SCRUTE(impl_name);
- void* handle = _library_map[impl_name];
- ASSERT(handle);
- _toRemove_map[impl_name] = handle;
- }
+ {
+ string impl_name =
+ Engines_Component_i::GetDynLibraryName(aGenRegisterName.c_str());
+ SCRUTE(impl_name);
+ void* handle = _library_map[impl_name];
+ ASSERT(handle);
+ _toRemove_map[impl_name] = handle;
+ }
_numInstanceMutex.unlock();
}
//=============================================================================
/*!
- * Retrieves only with container naming convention if it is a python container
- */
+* Retrieves only with container naming convention if it is a python container
+*/
//=============================================================================
bool Engines_Container_i::isPythonContainer(const char* ContainerName)
//=============================================================================
/*!
- *
- */
+*
+*/
//=============================================================================
void ActSigIntHandler()
{
-#ifndef WNT
+#ifndef WIN32
struct sigaction SigIntAct ;
SigIntAct.sa_sigaction = &SigIntHandler ;
SigIntAct.sa_flags = SA_SIGINFO ;
#endif
-// DEBUG 03.02.2005 : the first parameter of sigaction is not a mask of signals
-// (SIGINT | SIGUSR1) :
-// it must be only one signal ===> one call for SIGINT
-// and an other one for SIGUSR1
+ // DEBUG 03.02.2005 : the first parameter of sigaction is not a mask of signals
+ // (SIGINT | SIGUSR1) :
+ // it must be only one signal ===> one call for SIGINT
+ // and an other one for SIGUSR1
-#ifndef WNT
+#ifndef WIN32
if ( sigaction( SIGINT , &SigIntAct, NULL ) )
- {
- perror("SALOME_Container main ") ;
- exit(0) ;
- }
+ {
+ perror("SALOME_Container main ") ;
+ exit(0) ;
+ }
if ( sigaction( SIGUSR1 , &SigIntAct, NULL ) )
- {
- perror("SALOME_Container main ") ;
- exit(0) ;
- }
+ {
+ perror("SALOME_Container main ") ;
+ exit(0) ;
+ }
if ( sigaction( SIGUSR2 , &SigIntAct, NULL ) )
- {
- perror("SALOME_Container main ") ;
- exit(0) ;
- }
+ {
+ perror("SALOME_Container main ") ;
+ exit(0) ;
+ }
//PAL9042 JR : during the execution of a Signal Handler (and of methods called through Signal Handlers)
// use of streams (and so on) should never be used because :
void SetCpuUsed() ;
void CallCancelThread() ;
-#ifndef WNT
+#ifndef WIN32
void SigIntHandler(int what ,
siginfo_t * siginfo ,
void * toto )
// << " si_pid " << siginfo->si_pid) ;
if ( _Sleeping )
+ {
+ _Sleeping = false ;
+ // MESSAGE("SigIntHandler END sleeping.") ;
+ return ;
+ }
+ else
+ {
+ ActSigIntHandler() ;
+ if ( siginfo->si_signo == SIGUSR1 )
{
- _Sleeping = false ;
- // MESSAGE("SigIntHandler END sleeping.") ;
- return ;
+ SetCpuUsed() ;
}
- else
+ else if ( siginfo->si_signo == SIGUSR2 )
{
- ActSigIntHandler() ;
- if ( siginfo->si_signo == SIGUSR1 )
- {
- SetCpuUsed() ;
- }
- else if ( siginfo->si_signo == SIGUSR2 )
- {
- CallCancelThread() ;
- }
- else
- {
- _Sleeping = true ;
- // MESSAGE("SigIntHandler BEGIN sleeping.") ;
- int count = 0 ;
- while( _Sleeping )
- {
- sleep( 1 ) ;
- count += 1 ;
- }
- // MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
- }
- return ;
+ CallCancelThread() ;
}
+ else
+ {
+ _Sleeping = true ;
+ // MESSAGE("SigIntHandler BEGIN sleeping.") ;
+ int count = 0 ;
+ while( _Sleeping )
+ {
+ sleep( 1 ) ;
+ count += 1 ;
+ }
+ // MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
+ }
+ return ;
+ }
}
-#else // Case WNT
+#else // Case WIN32
void SigIntHandler( int what )
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE( pthread_self() << "SigIntHandler what " << what << endl );
#else
MESSAGE( "SigIntHandler what " << what << endl );
#endif
if ( _Sleeping )
+ {
+ _Sleeping = false ;
+ MESSAGE("SigIntHandler END sleeping.") ;
+ return ;
+ }
+ else
+ {
+ ActSigIntHandler() ;
+ if ( what == SIGUSR1 )
{
- _Sleeping = false ;
- MESSAGE("SigIntHandler END sleeping.") ;
- return ;
+ SetCpuUsed() ;
}
- else
+ else
{
- ActSigIntHandler() ;
- if ( what == SIGUSR1 )
- {
- SetCpuUsed() ;
- }
- else
- {
- _Sleeping = true ;
- MESSAGE("SigIntHandler BEGIN sleeping.") ;
- int count = 0 ;
- while( _Sleeping )
- {
- Sleep( 1000 ) ;
- count += 1 ;
- }
- MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
- }
- return ;
+ _Sleeping = true ;
+ MESSAGE("SigIntHandler BEGIN sleeping.") ;
+ int count = 0 ;
+ while( _Sleeping )
+ {
+ Sleep( 1000 ) ;
+ count += 1 ;
+ }
+ MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
}
+ return ;
+ }
}
#endif
// $Header$
#include <time.h>
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#endif
struct CONTAINER_EXPORT KERNEL_PYTHON
{
-#ifdef WNT
+#ifdef WIN32
static PyThreadState *get_gtstate() { return KERNEL_PYTHON::_gtstate; }
static PyObject *getsalome_shared_modules_module() { return KERNEL_PYTHON::salome_shared_modules_module; }
static PyInterpreterState *get_interp() { return KERNEL_PYTHON::_interp; }
../Basics/libSALOMEBasics.la \
../HDFPersist/libSalomeHDFPersist.la \
../Batch/libSalomeBatch.la \
- $(top_builddir)/idl/libSalomeIDLKernel.la\
+ $(top_builddir)/idl/libSalomeIDLKernel.la \
@MPI_LIBS@ \
@CORBA_LIBS@ \
$(PYTHON_LIBS)
SALOME_Container_LDADD = \
libSalomeContainer.la \
+ ../Basics/libSALOMEBasics.la \
$(HDF5_LIBS) \
$(MPI_LIBS) \
$(CORBA_LIBS) \
TestSalome_file_LDADD =\
libSalomeContainer.la \
+ ../Basics/libSALOMEBasics.la \
$(HDF5_LIBS) \
$(MPI_LIBS) \
$(CORBA_LIBS) \
#include <iostream>
#include <signal.h>
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <sys/types.h>
Engines::Container_ptr container,
const char *instanceName,
const char *interfaceName,
- bool notif = false);
- // Consructeur pour composant parallele: ne pas faire appel au registry
+ bool notif = false,
+ bool regist=true);
+ // Constructor for parallel component : don't call registry
Engines_Component_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId,
std::string _nodeName ;
private:
-#ifndef WNT
+#ifndef WIN32
pthread_t _ThreadId ;
#else
pthread_t* _ThreadId ;
#include <string>
#include <stdio.h>
#include <time.h>
-#ifndef WNT
+#ifndef WIN32
# include <sys/time.h>
# include <dlfcn.h>
#endif
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
#include <stdexcept>
#include <signal.h>
#include <sys/types.h>
-#include <sys/wait.h>
+#ifndef WIN32
+# include <sys/wait.h>
+#endif
+#ifndef WIN32
typedef void (*sighandler_t)(int);
sighandler_t setsig(int sig, sighandler_t handler)
{
return SIG_ERR;
return ocontext.sa_handler;
}
+#endif //WIN32
void AttachDebugger()
{
+#ifndef WIN32
if(getenv ("DEBUGGER"))
{
std::stringstream exec;
system(exec.str().c_str());
while(1);
}
+#endif
}
void Handler(int theSigId)
MPI_Init(&argc,&argv);
#endif
+#ifndef WIN32
if(getenv ("DEBUGGER"))
{
setsig(SIGSEGV,&Handler);
set_terminate(&terminateHandler);
set_unexpected(&unexpectedHandler);
}
+#endif
// Initialise the ORB.
//SRN: BugID: IPAL9541, it's necessary to set a size of one message to be at least 100Mb
PortableServer::POAManager_var pman = root_poa->the_POAManager();
// add new container to the kill list
-#ifndef WNT
+#ifndef WIN32
stringstream aCommand ;
aCommand << "addToKillList.py " << getpid() << " SALOME_Container" << ends ;
system(aCommand.str().c_str());
#ifndef _SALOME_Container_HXX_
#define _SALOME_Container_HXX_
-#ifdef WNT
- #if defined CONTAINER_EXPORTS
- #if defined WIN32
- #define CONTAINER_EXPORT __declspec( dllexport )
- #else
- #define CONTAINER_EXPORT
- #endif
- #else
- #if defined WIN32
- #define CONTAINER_EXPORT __declspec( dllimport )
- #else
- #define CONTAINER_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef CONTAINER_EXPORTS
+# define CONTAINER_EXPORT __declspec( dllexport )
+# else
+# define CONTAINER_EXPORT __declspec( dllimport )
+# endif
#else
- #define CONTAINER_EXPORT
+# define CONTAINER_EXPORT
#endif
#endif
MESSAGE( "SALOME_Container_i::import_component" )
ret=0
try:
- print "try import ",componentName
+ if verbose(): print "try import ",componentName
__import__(componentName)
- print "import ",componentName," successful"
+ if verbose(): print "import ",componentName," successful"
ret=1
except:
- import traceback
- traceback.print_exc()
- print "import ",componentName," not possible"
+ if verbose():
+ import traceback
+ traceback.print_exc()
+ print "import ",componentName," not possible"
return ret
#-------------------------------------------------------------------------
#include "SALOME_ContainerManager.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_ModuleCatalog.hh"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
+#include "Basics_DirUtils.hxx"
#include <sys/types.h>
#include <sys/stat.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <vector>
if( isOK ){
vector<string> vec = _NS->list_directory_recurs();
list<string> lstCont;
- for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++){
- SCRUTE((*iter));
- CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
- Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont)){
- lstCont.push_back((*iter));
+ for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++)
+ {
+ SCRUTE((*iter));
+ CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+ try
+ {
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont))
+ lstCont.push_back((*iter));
+ }
+ catch(const CORBA::Exception& e)
+ {
+ // ignore this entry and continue
+ }
}
- }
MESSAGE("Container list: ");
for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){
SCRUTE((*iter));
possibleComputers.length());
vector<string> lm;
- for(int i=0;i<possibleComputers.length();i++)
+ for(unsigned int i=0;i<possibleComputers.length();i++)
lm.push_back(string(possibleComputers[i]));
string theMachine;
//If the machine name is localhost use the real name
if(theMachine == "localhost")
- theMachine=GetHostname();
+ theMachine=Kernel_Utils::GetHostname();
MESSAGE("try to launch it on " << theMachine);
"no possible computer");
return Engines::Container::_nil();
}
- else if(theMachine==GetHostname())
+ else if(theMachine==Kernel_Utils::GetHostname())
command = BuildCommandToLaunchLocalContainer(params,id,container_exe);
else
command = BuildCommandToLaunchRemoteContainer(theMachine,params,id,container_exe);
- RmTmpFile();
+ // RmTmpFile(); Too early! May be this function has not been used for a long time...
//check if an entry exists in Naming service
if(params.isMPI)
CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
if ( !CORBA::is_nil(obj) )
{
- // shutdown the registered container if it exists
- Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont))
+ try
{
- try
- {
- cont->Shutdown();
- }
- catch(CORBA::Exception&)
- {
- INFOS("CORBA::Exception ignored.");
- }
+ // shutdown the registered container if it exists
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont))
+ cont->Shutdown();
+ }
+ catch(CORBA::Exception&)
+ {
+ INFOS("CORBA::Exception ignored.");
}
}
// launch container with a system call
int status=system(command.c_str());
+
+ RmTmpFile(); // command file can be removed here
+
if (status == -1){
MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " <<
"(system command status -1)");
int count=TIME_OUT_TO_LAUNCH_CONT;
MESSAGE("count = "<<count);
while ( CORBA::is_nil(ret) && count ){
-#ifndef WNT
+#ifndef WIN32
sleep( 1 ) ;
#else
Sleep(1000);
else
{
logFilename=":"+logFilename;
- logFilename="@"+GetHostname()+logFilename;
+ logFilename="@"+Kernel_Utils::GetHostname()+logFilename;
logFilename=getenv( "USER" )+logFilename;
ret->logfilename(logFilename.c_str());
}
if (CORBA::is_nil (Catalog))
return Engines::Container::_nil();
// Loop through component list
- for(int i=0;i<componentList.length();i++)
+ for(unsigned int i=0;i<componentList.length();i++)
{
const char* compoi = componentList[i];
SALOME_ModuleCatalog::Acomponent_var compoInfo = Catalog->GetComponent(compoi);
else {
INFOS("[FindOrStartParallelContainer] on machine : " << theMachine);
string command;
- if(theMachine == GetHostname()) {
+ if(theMachine == Kernel_Utils::GetHostname()) {
// Step 3 : starting parallel container proxy
params.hostname = CORBA::string_dup(theMachine.c_str());
Engines::MachineParameters params_proxy(params);
for (int i = 0; i < params.nb_component_nodes; i++) {
char buffer [5];
-#ifndef WNT
+#ifndef WIN32
snprintf(buffer,5,"%d",i);
#else
_snprintf(buffer,5,"%d",i);
obj = _NS->Resolve(containerNameInNS.c_str());
while (CORBA::is_nil(obj) && count) {
INFOS("[FindOrStartParallelContainer] CONNECTION FAILED !!!!!!!!!!!!!!!!!!!!!!!!");
-#ifndef WNT
+#ifndef WIN32
sleep(1) ;
#else
Sleep(1000);
INFOS("[LaunchParallelContainer] Waiting for Parallel Container proxy on " << theMachine);
while (CORBA::is_nil(obj) && count) {
-#ifndef WNT
+#ifndef WIN32
sleep(1) ;
#else
Sleep(1000);
// Name of the node
char buffer [5];
-#ifndef WNT
+#ifndef WIN32
snprintf(buffer,5,"%d",i);
#else
_snprintf(buffer,5,"%d",i);
containerNameInNS = _NS->BuildContainerNameForNS((char*) name_cont.c_str(),theMachine.c_str());
cerr << "[LaunchContainer] Waiting for Parllel Container node " << containerNameInNS << " on " << theMachine << endl;
while (CORBA::is_nil(obj) && count) {
-#ifndef WNT
+#ifndef WIN32
sleep(1) ;
#else
Sleep(1000);
SALOME_ContainerManager::BuildCommandToLaunchLocalContainer
(const Engines::MachineParameters& params, const long id,const std::string& container_exe)
{
- _TmpFileName = "";
+ _TmpFileName = BuildTemporaryFileName();
string command;
int nbproc = 0;
- char idc[3*sizeof(long)];
+ //char idc[3*sizeof(long)];
+
+ ofstream command_file( _TmpFileName.c_str() );
if (params.isMPI)
{
- command = "mpirun -np ";
+ //command = "mpirun -np ";
+ command_file << "mpirun -np ";
if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
nbproc = 1;
else
nbproc = params.nb_node * params.nb_proc_per_node;
- std::ostringstream o;
+ //std::ostringstream o;
- o << nbproc << " ";
+ //o << nbproc << " ";
+ command_file << nbproc << " ";
- command += o.str();
+ //command += o.str();
#ifdef WITHLAM
- command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
+ //command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
+ command_file << "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
#endif
if (isPythonContainer(params.container_name))
- command += "pyMPI SALOME_ContainerPy.py ";
+ //command += "pyMPI SALOME_ContainerPy.py ";
+ command_file << "pyMPI SALOME_ContainerPy.py ";
else
- command += "SALOME_MPIContainer ";
+ //command += "SALOME_MPIContainer ";
+ command_file << "SALOME_MPIContainer ";
}
else
{
- command="";
+ //command="";
std::string wdir=params.workingdir.in();
if(wdir != "")
{
if(wdir == "$TEMPDIR")
{
// a new temporary directory is requested
- char dir[]="/tmp/salomeXXXXXX";
- char* mdir=mkdtemp(dir);
- if(mdir==NULL)
- std::cerr << "Problem in mkdtemp " << dir << " " << mdir << std::endl;
- else
- command="cd "+std::string(dir)+";";
+ string dir = Kernel_Utils::GetTmpDir();
+#ifdef WIN32
+ //command += "cd /d "+ dir +";";
+ command_file << "cd /d " << dir << endl;
+#else
+ //command = "cd "+ dir +";";
+ command_file << "cd " << dir << ";";
+#endif
+
}
else
{
// a permanent directory is requested use it or create it
- command="mkdir -p " + wdir + " && cd " + wdir + ";";
+#ifdef WIN32
+ //command="mkdir " + wdir;
+ command_file << "mkdir " + wdir << endl;
+ command_file << "cd /D " + wdir << endl;
+#else
+ //command="mkdir -p " + wdir + " && cd " + wdir + ";";
+ command_file << "mkdir -p " << wdir << " && cd " << wdir + ";";
+#endif
}
}
if (isPythonContainer(params.container_name))
- command += "SALOME_ContainerPy.py ";
+ //command += "SALOME_ContainerPy.py ";
+ command_file << "SALOME_ContainerPy.py ";
else
- command += container_exe + " ";
+ //command += container_exe + " ";
+ command_file << container_exe + " ";
+
}
- command += _NS->ContainerName(params);
+
+ /*command += _NS->ContainerName(params);
command += " -id ";
sprintf(idc,"%ld",id);
command += idc;
- command += " -";
- AddOmninamesParams(command);
+ command += " -";
+ AddOmninamesParams(command);*/
+
+ command_file << _NS->ContainerName(params);
+ command_file << " -id " << id << " -";
+ AddOmninamesParams(command_file);
+ command_file.close();
+
+#ifndef WIN32
+ chmod(_TmpFileName.c_str(), 0x1ED);
+#endif
+ command = _TmpFileName;
- MESSAGE("Command is ... " << command);
+ MESSAGE("Command is file ... " << command);
return command;
}
void SALOME_ContainerManager::RmTmpFile()
{
- if (_TmpFileName != "")
+ int lenght = _TmpFileName.size();
+ if ( lenght > 0)
{
-#ifndef WNT
- string command = "rm ";
-#else
+#ifdef WIN32
string command = "del /F ";
+#else
+ string command = "rm ";
+#endif
+ if ( lenght > 4 )
+ command += _TmpFileName.substr(0, lenght - 3 );
+ else
+ command += _TmpFileName;
+ command += '*';
+ system(command.c_str());
+ //if dir is empty - remove it
+ string tmp_dir = Kernel_Utils::GetDirByPath( _TmpFileName );
+ if ( Kernel_Utils::IsEmptyDir( tmp_dir ) )
+ {
+#ifdef WIN32
+ command = "del /F " + tmp_dir;
+#else
+ command = "rmdir " + tmp_dir;
#endif
- command += _TmpFileName;
- char *temp = strdup(command.c_str());
- int lgthTemp = strlen(temp);
- temp[lgthTemp - 3] = '*';
- temp[lgthTemp - 2] = '\0';
- system(temp);
- free(temp);
+ system(command.c_str());
+ }
}
}
string SALOME_ContainerManager::BuildTemporaryFileName() const
{
//build more complex file name to support multiple salome session
- char *temp = new char[19];
- strcpy(temp, "/tmp/command");
- strcat(temp, "XXXXXX");
-#ifndef WNT
-
- mkstemp(temp);
+ string aFileName = Kernel_Utils::GetTmpFileName();
+#ifndef WIN32
+ aFileName += ".sh";
#else
-
- char aPID[80];
- itoa(getpid(), aPID, 10);
- strcat(temp, aPID);
+ aFileName += ".bat";
#endif
-
- string command(temp);
- delete [] temp;
- command += ".sh";
- return command;
+ return aFileName;
}
tempOutputFile << " &" << endl;
tempOutputFile.flush();
tempOutputFile.close();
+#ifndef WIN32
chmod(_TmpFileName.c_str(), 0x1ED);
+#endif
// --- Build command
command += " > /tmp/";
command += _NS->ContainerName(rtn);
command += "_";
- command += GetHostname();
+ command += Kernel_Utils::GetHostname();
command += "_";
command += getenv( "USER" ) ;
command += ".log 2>&1 &" ;
if verbose(): print "import ",componentName," successful"
ret=1
except:
- import traceback
- traceback.print_exc()
- print "import ",componentName," not possible"
+ if verbose():
+ import traceback
+ traceback.print_exc()
+ print "import ",componentName," not possible"
return ret
#-------------------------------------------------------------------------
#include <iostream>
#include <signal.h>
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <sys/types.h>
#include "SALOME_FileRef_i.hxx"
#include "utilities.h"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include <string>
using namespace std;
MESSAGE("fileRef_i::fileRef_i "<< origFileName);
_container = Engines::Container::_duplicate(container);
_origFileName = origFileName;
- _machine = GetHostname();
+ _machine = Kernel_Utils::GetHostname();
#if defined(_DEBUG_) || defined(_DEBUG)
int OK = addRef(_machine.c_str(), _origFileName.c_str());
SCRUTE(OK);
#include "Salome_file_i.hxx"
#include "utilities.h"
#include <stdlib.h>
-#include <unistd.h>
#include "HDFOI.hxx"
-#include <stdlib.h>
+#ifndef WIN32
+# include <unistd.h>
+# define _getcwd getcwd
+# define _open open
+#else
+# include <direct.h>
+# include <io.h>
+# include <windows.h>
+#endif
+
//=============================================================================
/*!
Salome_file_i::Salome_file_i()
{
_fileId = 0;
+#ifndef WIN32
_path_max = 1 + pathconf("/", _PC_PATH_MAX);
+#else
+ _path_max = 32768;
+ //from MSDN:
+ //Note The C Runtime supports path lengths up to 32768 characters in length, but it is up to the operating system, specifically the file system, to support these longer paths. The sum of the fields should not exceed _MAX_PATH for full backwards compatibility with Windows 98 FAT32 file systems. Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows Server 2003 NTFS file system supports paths up to 32768 characters in length, but only when using the Unicode APIs. When using long path names, prefix the path with the characters \\?\ and use the Unicode versions of the C Runtime functions.
+ //currently #define _MAX_PATH 260
+#endif
_state.name = CORBA::string_dup("");
_state.hdf5_file_name = CORBA::string_dup("");
_state.number_of_files = 0;
if (mode == "all") {
// Changing path, is now current directory
- char CurrentPath[_path_max];
- getcwd(CurrentPath, _path_max);
- path = CurrentPath;
-
+ path = getcwd(NULL, _path_max);
+
std::string group_name("GROUP");
group_name += file_name;
hdf_group = new HDFgroup(group_name.c_str(),hdf_file);
}
else
{
- file_name = comp_file_name;
- char CurrentPath[_path_max];
- getcwd(CurrentPath, _path_max);
- path = CurrentPath;
+ file_name = comp_file_name;
+ path = getcwd(NULL, _path_max);;
}
// Test if this file is already added
else
{
file_name = comp_file_name;
- char CurrentPath[_path_max];
- getcwd(CurrentPath, _path_max);
- path = CurrentPath;
+ path = getcwd(NULL, _path_max);;
}
// Test if this file is already added
};
-# if defined(WNT) && !defined(HAVE_NO_DLL)
+# if defined(WIN32) && !defined(HAVE_NO_DLL)
# ifndef Standard_EXPORT
# define Standard_EXPORT __declspec( dllexport )
# define Standard_IMPORTC extern "C" __declspec( dllimport )
# endif /* Standard_IMPORT */
-# else /* WNT */
+# else /* WIN32 */
# ifndef Standard_EXPORT
# define Standard_EXPORT
# define Standard_IMPORTC extern "C"
# endif /* Standard_IMPORT */
-# endif /* WNT */
+# endif /* WIN32 */
# ifndef __Standard_API
-//# ifdef WNT
-# if !defined(WNT)
+//# ifdef WIN32
+# if !defined(WIN32)
# define __Standard_API Standard_EXPORT
# define __Standard_APIEXTERN Standard_EXPORTEXTERN
# else
# endif // __Standard_DLL
//# else
//# define __Standard_API
-//# endif // WNT
+//# endif // WIN32
# endif // __Standard_API
#include <iostream>
#include "DF_Container.hxx"
#include "DF_ChildIterator.hxx"
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
void GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds)
{
-#ifdef WNT
+#ifdef WIN32
SYSTEMTIME st;
GetLocalTime ( &st );
string GetUserName()
{
-#ifdef WNT
+#ifdef WIN32
char* pBuff = new char[UNLEN + 1];
DWORD dwSize = UNLEN + 1;
string retVal;
path = thePath+"/";
}
-#ifdef WNT //Check if the only disk letter is given as path
+#ifdef WIN32 //Check if the only disk letter is given as path
if(path.size() == 2 && path[1] == ":") path +='\\';
#endif
bool Exists(const string thePath)
{
-#ifdef WNT
+#ifdef WIN32
if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
if ( GetLastError () != ERROR_FILE_NOT_FOUND ) {
return false;
#include "ConnectionManager_i.hxx"
#include "SALOME_NamingService.hxx"
+#ifdef WIN32
+# include <process.h>
+#endif
+
ConnectionManager_i::ConnectionManager_i(CORBA::ORB_ptr orb) {
_orb = CORBA::ORB::_duplicate(orb) ;
SALOME_NamingService * ns = new SALOME_NamingService(orb);
CORBA::Long
ConnectionManager_i::getPID()
{
- return (CORBA::Long)getpid();
+ return
+#ifndef WIN32
+ (CORBA::Long)getpid();
+#else
+ (CORBA::Long)_getpid();
+#endif
}
#ifndef _DSC_Basic_HXX_
#define _DSC_Basic_HXX_
-#ifdef WNT
- #if defined DSC_BASIC_EXPORTS
- #if defined WIN32
- #define DSC_BASIC_EXPORT __declspec( dllexport )
- #else
- #define DSC_BASIC_EXPORT
- #endif
- #else
- #if defined WIN32
- #define DSC_BASIC_EXPORT __declspec( dllimport )
- #else
- #define DSC_BASIC_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef DSC_BASIC_EXPORTS
+# define DSC_BASIC_EXPORT __declspec( dllexport )
+# else
+# define DSC_BASIC_EXPORT __declspec( dllimport )
+# endif
#else
- #define DSC_BASIC_EXPORT
+# define DSC_BASIC_EXPORT
#endif
#endif
Engines::Container_ptr container,
const char *instanceName,
const char *interfaceName,
- bool notif) : Engines_Component_i(orb, poa, container, instanceName, interfaceName)
+ bool notif,
+ bool regist) :
+ Engines_Component_i(orb, poa, container, instanceName, interfaceName,notif,regist)
{
#ifdef _DEBUG_
std::cerr << "--Engines_DSC_i: MARK 1 --" << instanceName << "----" << std::endl;
Engines::Container_ptr container,
const char *instanceName,
const char *interfaceName,
- bool notif = false);
+ bool notif = false,
+ bool regist = true );
virtual ~Engines_DSC_i();
#include "basic_port_factory.hxx"
+using namespace std;
+
basic_port_factory::basic_port_factory() {}
basic_port_factory::~basic_port_factory() {}
#include "data_short_port_provides.hxx"
#include "data_short_port_uses.hxx"
-using namespace std;
-
/*! \class basic_port_factory
* \brief This class is an example of factory for DSC_User ports.
*
* \param type the basic port's type.
* \return a pointer of the provides port.
*/
- virtual provides_port * create_data_servant(string type);
+ virtual provides_port * create_data_servant(std::string type);
/*!
* This method creates a uses port of Basic ports.
* \param type the basic port's type.
* \return a pointer of the uses port.
*/
- virtual uses_port * create_data_proxy(string type);
+ virtual uses_port * create_data_proxy(std::string type);
};
#endif
#include "utilities.h"
-#ifndef WNT
+#ifndef WIN32
extern "C"
{
#endif
#include <string.h>
-#ifndef WNT
+#ifndef WIN32
}
#endif
const char *instanceName,
const char *interfaceName,
bool notif) :
- Superv_Component_i(orb, poa,contain, instanceName, interfaceName)
+ Superv_Component_i(orb, poa,contain, instanceName, interfaceName,false,false)
{
}
double & ti,
double const & tf,
long & i,
- const string & nomVar,
+ const std::string & nomVar,
size_t bufferLength,
size_t & nRead,
T1 * &data )
// T1 est le type de données
template <typename T1 > static void
ecp_lecture ( Superv_Component_i & component,
- int const & dependencyType,
- double & ti,
- double const & tf,
- long & i,
- const string & nomVar,
- size_t bufferLength,
- size_t & nRead,
- T1 * &data )
+ int const & dependencyType,
+ double & ti,
+ double const & tf,
+ long & i,
+ const std::string & nomVar,
+ size_t bufferLength,
+ size_t & nRead,
+ T1 * &data )
{
ecp_lecture<T1,T1> (component,dependencyType,ti,tf,
i,nomVar,bufferLength,nRead,data);
// T2 : PortType
template <typename T1, typename T2> static void
ecp_ecriture ( Superv_Component_i & component,
- int const & dependencyType,
- double const & t,
- long const & i,
- const string & nomVar,
- size_t bufferLength,
- T1 const & data )
+ int const & dependencyType,
+ double const & t,
+ long const & i,
+ const std::string & nomVar,
+ size_t bufferLength,
+ T1 const & data )
{
assert(&component);
#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecriture), Valeur de corbaData : " << std::endl;
for (int i = 0; i < corbaData->length(); ++i)
- cout << "-------- CalciumInterface(ecriture), corbaData[" << i << "] = " << (*corbaData)[i] << endl;
+ std::cout << "-------- CalciumInterface(ecriture), corbaData[" << i << "] = " << (*corbaData)[i] << std::endl;
#endif
// if ( !IsSameType<T1,InnerType>::value ) delete corbaData;
int const & dependencyType,
double const & t,
long const & i,
- const string & nomVar,
+ const std::string & nomVar,
size_t bufferLength,
T1 const & data ) {
ecp_ecriture<T1,T1> (component,dependencyType,t,i,nomVar,bufferLength,data);
#include "calcium_port_factory.hxx"
+using namespace std;
+
calcium_port_factory::calcium_port_factory() {}
calcium_port_factory::~calcium_port_factory() {}
#include "calcium_logical_port_uses.hxx"
#include "calcium_complex_port_uses.hxx"
-using namespace std;
-
class calcium_port_factory :
public port_factory
{
calcium_port_factory();
virtual ~calcium_port_factory();
- virtual provides_port * create_data_servant(string type);
- virtual uses_port * create_data_proxy(string type);
+ virtual provides_port * create_data_servant(std::string type);
+ virtual uses_port * create_data_proxy(std::string type);
};
#endif
#include <iostream>
// Pour l'utilisation de "vector" de la STL
-using namespace std;
-
// Classe filtre_elementaire
//
// Implémente une structure de donnée décrivant un filtre élémentaire
// Données de configuration de filtrage et conversion:
// une table de filtres élémentaires
// avec leurs données de conversion associées éventuelles
- vector<conversion_elementaire> config;
+ std::vector<conversion_elementaire> config;
public:
// Constructeur: juste une allocation mémoire initiale
// réclamer la mémoire utilisée par tous les éléments du vecteur config
~filtre_conversion()
{
- vector<conversion_elementaire>::iterator i;
+ std::vector<conversion_elementaire>::iterator i;
for (i = this->config.begin(); i != this->config.end(); i ++)
{
delete (*i).p_convers;
}
// applique_filtre_conversion: Opération du filtre et de la conversion
- template <typename T > T applique_filtre_conversion (T valeur_initiale, vector<T>& liste_conversions) const;
+ template <typename T > T applique_filtre_conversion (T valeur_initiale, std::vector<T>& liste_conversions) const;
};
// si cette longueur est 0, c'est que la valeur initiale ne passe pas le filtre
//
template <typename T>
-T filtre_conversion::applique_filtre_conversion (T valeur_initiale, vector<T>& liste_conversions) const
+T filtre_conversion::applique_filtre_conversion (T valeur_initiale, std::vector<T>& liste_conversions) const
{
// Part d'une liste vierge
liste_conversions.clear();
// et cherche pour chacun d'eux si la valeur initiale est présente parmi les valeurs filtrées
// Pour tous les éléments de configuration du filtrage/conversion
- vector<conversion_elementaire>::const_iterator i;
+ std::vector<conversion_elementaire>::const_iterator i;
for (i = config.begin(); i != config.end(); i ++)
{
std::cout << "----Cst ---- InternalDataIdContainer(const DataId & dataId..) " << dataId <<std::endl;
policy.filtre_convert_TIME.applique_filtre_conversion(dataId.first, _lTime);
int c=0;
- for(vector<CORBA::Long>::iterator i=_lTime.begin();i!=_lTime.end();++i)
+ for(std::vector<CORBA::Long>::iterator i=_lTime.begin();i!=_lTime.end();++i)
std::cout << "_lTime["<< c++ << "] : " << *i << std::endl;
policy.filtre_convert_TAG.applique_filtre_conversion(dataId.second, _lTag);
c=0;
- for(vector<CORBA::Long>::iterator i=_lTag.begin();i!=_lTag.end();++i)
+ for(std::vector<CORBA::Long>::iterator i=_lTag.begin();i!=_lTag.end();++i)
std::cout << "_lTag["<< c++ << "] : " << *i << std::endl;
}
#include "palm_port_factory.hxx"
+using namespace std;
+
palm_port_factory::palm_port_factory() {
}
#include "palm_data_short_port_provides.hxx"
#include "palm_data_seq_short_port_provides.hxx"
-using namespace std;
-
class palm_port_factory :
public port_factory
{
palm_port_factory();
virtual ~palm_port_factory();
- virtual provides_port * create_data_servant(string type);
- virtual uses_port * create_data_proxy(string type);
+ virtual provides_port * create_data_servant(std::string type);
+ virtual uses_port * create_data_proxy(std::string type);
};
#endif
Engines::Container_ptr container,
const char *instanceName,
const char *interfaceName,
- bool notif) : Engines_DSC_i(orb, poa, container, instanceName, interfaceName)
+ bool notif,
+ bool regist) :
+ Engines_DSC_i(orb, poa, container, instanceName, interfaceName,notif,regist)
{
#ifdef _DEBUG_
std::cerr << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl;
#include "DSC_Exception.hxx"
-using namespace std;
-
/*! \class Superv_Component_i
* \brief This class implements DSC_User component.
*
Engines::Container_ptr container,
const char *instanceName,
const char *interfaceName,
- bool notif = false);
+ bool notif = false,
+ bool regist = true );
virtual ~Superv_Component_i();
// Exceptions declarations.
MESSAGE("GenericObj_i::GenericObj_i() - this = "<<this<<
"; CORBA::is_nil(thePOA) = "<<CORBA::is_nil(thePOA));
if(CORBA::is_nil(thePOA))
-#ifndef WNT
+#ifndef WIN32
myPOA = PortableServer::ServantBase::_default_POA();
#else
myPOA = ServantBase::_default_POA();
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SALOME_GenericObj)
-#if defined GENERICOBJ_EXPORTS
-#if defined WIN32
-#define GENERICOBJ_EXPORT __declspec( dllexport )
+#ifdef WIN32
+# ifdef GENERICOBJ_EXPORTS
+# define GENERICOBJ_EXPORT __declspec( dllexport )
+# else
+# define GENERICOBJ_EXPORT __declspec( dllimport )
+# endif
#else
-#define GENERICOBJ_EXPORT
-#endif
-#else
-#if defined WNT
-#define GENERICOBJ_EXPORT __declspec( dllimport )
-#else
-#define GENERICOBJ_EXPORT
-#endif
+# define GENERICOBJ_EXPORT
#endif
namespace SALOME{
#include <stdio.h>
#include <string>
-#ifdef WNT
+#ifdef WIN32
#include <io.h>
#include <time.h>
+#include <windows.h>
+#define dir_separator '\\'
+#else
+#define dir_separator '/'
#endif
using namespace std;
char *Tmp_dir = getenv("SALOME_TMP_DIR");
if(Tmp_dir != NULL) {
aTmpDir = string(Tmp_dir);
-#ifdef WIN32
+ if(aTmpDir[aTmpDir.size()-1] != dir_separator) aTmpDir+=dir_separator;
+/*#ifdef WIN32
if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\';
#else
if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/';
-#endif
+#endif*/
}
else {
#ifdef WIN32
aTmpDir += aSubDir; //Get RND sub directory
+ if(aTmpDir[aTmpDir.size()-1] != dir_separator) aTmpDir+=dir_separator;
+/*
#ifdef WIN32
if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\';
#else
if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/';
#endif
+ */
string aDir = aTmpDir;
aDir = aTmpDir+buffer; //Build a unique directory name
}
-#ifdef WNT
+#ifdef WIN32
+ //fuction CreateDirectory create only final directory, but not intermediate
+ CreateDirectory(aTmpDir.c_str(), NULL);
CreateDirectory(aDir.c_str(), NULL);
#else
mkdir(aDir.c_str(), 0x1ff);
#endif
- return aDir;
+ return aDir + dir_separator;
}
char* makeName(char* name)
bool Exists(const string thePath)
{
-#ifdef WNT
+#ifdef WIN32
if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
if ( GetLastError () != ERROR_FILE_NOT_FOUND ) {
return false;
void Move(const string& fName, const string& fNameDst)
{
-#ifdef WNT
+#ifdef WIN32
MoveFileEx (fName.c_str(), fNameDst.c_str(),MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED);
#else
rename(fName.c_str(), fNameDst.c_str());
#include "HDFexport.hxx"
-class HDF_EXPORT HDFascii
+class HDFPERSIST_EXPORT HDFascii
{
public:
#ifdef PCLINUX
if((H5Tget_class(type_id) == H5T_INTEGER) && (H5Tget_size(type_id) == 4)) {
isI32BE = 1; /* See HDFattrCreate */
- if (H5Tconvert(H5T_NATIVE_INT,H5T_STD_I32BE,1,(void *)val,NULL,NULL) < 0)
+ if (H5Tconvert(H5T_NATIVE_INT,H5T_STD_I32BE,1,(void *)val,NULL,(hid_t)NULL) < 0)
return -1;
}
#endif
#ifdef PCLINUX
- if (isI32BE && (H5Tconvert(H5T_STD_I32BE,H5T_NATIVE_INT,1,(void *)val,NULL,NULL) < 0))
+ if (isI32BE && (H5Tconvert(H5T_STD_I32BE,H5T_NATIVE_INT,1,(void *)val,NULL,(hid_t)NULL) < 0))
return -1;
#endif
#include "HDFinternalObject.hxx"
#include "HDFcontainerObject.hxx"
-class HDFattribute : public HDFobject
+class HDFPERSIST_EXPORT HDFattribute : public HDFobject
{
private :
HDFinternalObject *_father;
#include "HDFinternalObject.hxx"
#include "HDFexport.hxx"
-class HDF_EXPORT HDFcontainerObject : public HDFinternalObject
+class HDFPERSIST_EXPORT HDFcontainerObject : public HDFinternalObject
{
private :
HDFinternalObject *_firstson;
#include "HDFconvert.hxx"
using namespace std;
-#ifdef WNT
+#ifdef WIN32
#include <io.h>
#include <windows.h>
#endif
perror("HDFConvert::FromAscii");
return -1;
};
-#elif defined WNT
+#elif defined WIN32
#define SHMEMSIZE 4096
extern "C"
{
#include "HDFtypes.h"
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#include <sys/mman.h>
#else
#include <sys/stat.h>
#include <fcntl.h>
}
+#include "HDFexport.hxx"
#include "HDFcontainerObject.hxx"
#include "HDFdataset.hxx"
#include "HDFfile.hxx"
#include <string>
-class HDFConvert
+class HDFPERSIST_EXPORT HDFConvert
{
private:
#include "HDFcontainerObject.hxx"
#include "HDFexport.hxx"
-class HDF_EXPORT HDFdataset : public HDFinternalObject
+class HDFPERSIST_EXPORT HDFdataset : public HDFinternalObject
{
private :
HDFcontainerObject *_father;
#ifndef __HDFexception_H__
#define __HDFexception_H__
+#include "HDFexport.hxx"
+
/* Exception */
#include <iostream>
-class HDFexception
+class HDFPERSIST_EXPORT HDFexception
{
public :
HDFexception(const char *message) {
#include "HDFinternalObject.hxx"
#include "HDFcontainerObject.hxx"
-class HDFexplorer {
+class HDFPERSIST_EXPORT HDFexplorer {
private :
int _size;
HDFcontainerObject *_container;
#ifndef _HDF_export_HXX_
#define _HDF_export_HXX_
-#ifdef WNT
- #if defined WIN32
- #define HDF_EXPORT __declspec( dllimport )
- #else
- #define HDF_EXPORT
- #endif
+#ifdef WIN32
+# ifdef HDFPERSIST_EXPORTS
+# define HDFPERSIST_EXPORT __declspec( dllexport )
+# else
+# define HDFPERSIST_EXPORT __declspec( dllimport )
+# endif
#else
- #define HDF_EXPORT
+# define HDFPERSIST_EXPORT
#endif
#endif
extern "C"
{
#include "hdfi.h"
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <io.h>
#include "HDFcontainerObject.hxx"
#include "HDFexport.hxx"
-class HDF_EXPORT HDFfile : public HDFcontainerObject
+class HDFPERSIST_EXPORT HDFfile : public HDFcontainerObject
{
private :
hdf_access_mode _access_mode;
#include "HDFcontainerObject.hxx"
#include "HDFexport.hxx"
-class HDF_EXPORT HDFgroup : public HDFcontainerObject
+class HDFPERSIST_EXPORT HDFgroup : public HDFcontainerObject
{
private :
HDFcontainerObject *_father;
#include "hdfi.h"
}
#include "HDFinternalObject.hxx"
-#ifndef WNT
-using namespace std;
-#endif
HDFinternalObject::HDFinternalObject(const char *name)
: HDFobject(name)
#include "HDFobject.hxx"
#include "HDFexport.hxx"
-class HDF_EXPORT HDFinternalObject : public HDFobject
+class HDFPERSIST_EXPORT HDFinternalObject : public HDFobject
{
private :
HDFinternalObject *_previousbrother;
extern "C"
{
#include "hdfi.h"
-#include <string.h>
}
+
+#include <string>
//#include "utilities.h"
using namespace std;
{
#include "HDFtypes.h"
}
-#include <HDFexport.hxx>
+#include "HDFexport.hxx"
-class HDF_EXPORT HDFobject {
+class HDFPERSIST_EXPORT HDFobject {
protected :
char *_name;
hdf_idt _id;
myStudyName = myStudy._get_Name()
myStudyId = myStudy._get_StudyId()
-print myStudyId
+#print myStudyId
#include "BatchTest.hxx"
+#include "Batch_Date.hxx"
+#include "MpiImpl.hxx"
+#include "utilities.h"
+
+#include <sys/stat.h>
+#include <iostream>
+#include <fstream>
+#ifdef WIN32
+# include <io.h>
+#endif
BatchTest::BatchTest(const Engines::MachineParameters& batch_descr)
{
_batch_descr = batch_descr;
}
i++ ;
}
-
+
// Creating test temporary file
_test_filename = "/tmp/";
_test_filename += _date + "_test_cluster_file_";
<< "--- Application : " << result_appli << std::endl
);
- if (result_connection == "OK" and
- result_filecopy == "OK" and
- result_getresult == "OK" and
- result_jobsubmit_simple == "OK" and
- result_jobsubmit_mpi == "OK" and
+ if (result_connection == "OK" &&
+ result_filecopy == "OK" &&
+ result_getresult == "OK" &&
+ result_jobsubmit_simple == "OK" &&
+ result_jobsubmit_mpi == "OK" &&
result_appli == "OK")
rtn = true;
result += "username is empty !";
return result;
}
- if( protocol != "rsh" and protocol != "ssh")
+ if( protocol != "rsh" && protocol != "ssh")
{
result += "protocol unknown ! (" + protocol + ")";
return result;
if(status == 153 || status == 256*153 )
stop = true;
+#ifdef WIN32
+ Sleep(1);
+#else
sleep(1);
+#endif
}
// Build command for getting results
<< "echo HELLO MPI\n";
file_script.flush();
file_script.close();
- chmod(_test_file_script.c_str(), 0x1ED);
+#ifdef WIN32
+ _chmod
+#else
+ chmod
+#endif
+ (_test_file_script.c_str(), 0x1ED);
std::string _test_file_mpi = _test_filename + "_mpi";
std::ofstream file_mpi;
if(status == 153 || status == 256*153 )
stop = true;
+#ifdef WIN32
+ Sleep(1);
+#else
sleep(1);
+#endif
}
// Build command for getting results
return result;
}
result = "OK";
- return result;
+ return result;
}
std::string
#ifndef __BatchTest_HXX__
#define __BatchTest_HXX__
-#include <sys/stat.h>
-#include <iostream>
-#include <fstream>
+#include "SALOME_Launcher_defs.hxx"
#include <SALOMEconfig.h>
-#include "utilities.h"
#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
-#include "Batch_Date.hxx"
-#include "MpiImpl.hxx"
+#include <string>
-class BatchTest
+class SALOMELAUNCHER_EXPORT BatchTest
{
public:
BatchTest(const Engines::MachineParameters& batch_descr);
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
+#include "Launcher.hxx"
+
#include "Batch_Date.hxx"
#include "Batch_FactBatchManager_eLSF.hxx"
#include "Batch_FactBatchManager_ePBS.hxx"
-#include "Launcher.hxx"
-#include "utilities.h"
+#include "Batch_BatchManager_eClient.hxx"
+
#include <iostream>
#include <sstream>
#include <sys/stat.h>
+#ifdef WIN32
+# include <time.h>
+#endif
+
using namespace std;
//=============================================================================
Launcher_cpp::Launcher_cpp()
{
- MESSAGE ( "Launcher_cpp constructor" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "Launcher_cpp constructor" << endl;
+#endif
}
//=============================================================================
Launcher_cpp::~Launcher_cpp()
{
- MESSAGE ( "Launcher_cpp destructor" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "Launcher_cpp destructor" << endl;
+#endif
std::map < string, Batch::BatchManager_eClient * >::const_iterator it1;
for(it1=_batchmap.begin();it1!=_batchmap.end();it1++)
delete it1->second;
const batchParams& batch_params,
const machineParams& params) throw(LauncherException)
{
- MESSAGE ( "BEGIN OF Launcher_cpp::submitSalomeJob" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "BEGIN OF Launcher_cpp::submitSalomeJob" << endl;
+#endif
long jobId;
vector<string> aMachineList;
ParserResourcesType p = _ResManager->GetResourcesList(aMachineList[0]);
string clustername(p.Alias);
- MESSAGE ( "Choose cluster: " << clustername );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "Choose cluster: " << clustername << endl;
+#endif
// search batch manager for that cluster in map or instanciate one
map < string, Batch::BatchManager_eClient * >::const_iterator it = _batchmap.find(clustername);
istringstream iss(jid.getReference());
iss >> jobId;
- _jobmap[ pair<string,long>(clustername,jobId) ] = job;
+ _jobmap[ pair<string,long>(clustername,jobId) ] = job;
}
catch(const Batch::EmulationException &ex){
throw LauncherException(ex.msg.c_str());
mpi = "indif";
break;
}
- MESSAGE ( "Instanciation of batch manager" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "Instanciation of batch manager" << endl;
+#endif
switch( params.Batch ){
case pbs:
- MESSAGE ( "Instantiation of PBS batch manager" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "Instantiation of PBS batch manager" << endl;
+#endif
fact = new Batch::FactBatchManager_ePBS;
break;
case lsf:
- MESSAGE ( "Instantiation of LSF batch manager" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "Instantiation of LSF batch manager" << endl;
+#endif
fact = new Batch::FactBatchManager_eLSF;
break;
default:
- MESSAGE ( "BATCH = " << params.Batch );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "BATCH = " << params.Batch << endl;
+#endif
throw LauncherException("no batchmanager for that cluster");
}
return (*fact)(hostname.c_str(),protocol.c_str(),mpi.c_str());
string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const string dirForTmpFiles, const ParserResourcesType& params)
{
+#ifndef WIN32 //TODO: need for porting on Windows
int idx = dirForTmpFiles.find("Batch/");
std::string filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length());
tempOutputFile.flush();
tempOutputFile.close();
chmod(TmpFileName.c_str(), 0x1ED);
- MESSAGE ( TmpFileName.c_str() );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << TmpFileName.c_str() << endl;
+#endif
delete mpiImpl;
return TmpFileName;
+#else
+ return "";
+#endif
}
bool Launcher_cpp::check(const batchParams& batch_params)
{
bool rtn = true;
- MESSAGE ( "Job parameters are :" );
- MESSAGE ( "Directory : $HOME/Batch/$date" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "Job parameters are :" << endl;
+ cerr << "Directory : $HOME/Batch/$date" << endl;
+#endif
// check expected_during_time (check the format)
std::string edt_info = batch_params.expected_during_time;
else {
edt_info = "No value given";
}
- MESSAGE ( "Expected during time : " << edt_info );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "Expected during time : " << edt_info << endl;;
+#endif
// check memory (check the format)
std::string mem_info;
rtn = false;
}
std::string end_mem_value = mem_value.substr(mem_value.length()-2);
- if (end_mem_value != "gb" and end_mem_value != "mb") {
+ if (end_mem_value != "gb" && end_mem_value != "mb") {
mem_info = "Error on definition, type is bad ! " + mem_value;
rtn = false;
}
else {
mem_info = "No value given";
}
- MESSAGE ( "Memory : " << mem_info );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "Memory : " << mem_info << endl;
+#endif
// check nb_proc
std::string nb_proc_info;
else {
nb_proc_info = nb_proc_value.str();
}
- MESSAGE ( "Nb of processors : " << nb_proc_info );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "Nb of processors : " << nb_proc_info << endl;
+#endif
return rtn;
}
command += p.Alias;
command += " 'echo $HOME' > ";
command += filelogtemp;
- MESSAGE ( command.c_str() );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ std::cerr << command.c_str() << std::endl;
+#endif
int status = system(command.c_str());
if(status)
throw LauncherException("Error of launching home command on remote host");
#ifndef __LAUNCHER_HXX__
#define __LAUNCHER_HXX__
-#include "Batch_BatchManager_eClient.hxx"
+#ifdef WIN32
+# ifdef LAUNCHER_EXPORTS
+# define LAUNCHER_EXPORT __declspec(dllexport)
+# else
+# define LAUNCHER_EXPORT __declspec(dllimport)
+# endif
+#else
+# define LAUNCHER_EXPORT
+#endif
+
+#include <SALOME_ResourcesCatalog_Parser.hxx>
#include "ResourcesManager.hxx"
#include <string>
+#include <vector>
+
+class MpiImpl;
+
+namespace Batch{
+ class BatchManager_eClient;
+ class Job;
+}
struct batchParams{
std::string batch_directory;
unsigned long nb_proc;
};
-class LauncherException
+class LAUNCHER_EXPORT LauncherException
{
public:
const std::string msg;
LauncherException(const std::string m) : msg(m) {}
};
-class Launcher_cpp
+class LAUNCHER_EXPORT Launcher_cpp
{
public:
protected:
- std::string buildSalomeCouplingScript(const string fileToExecute, const string dirForTmpFiles, const ParserResourcesType& params);
+ std::string buildSalomeCouplingScript(const std::string fileToExecute, const std::string dirForTmpFiles, const ParserResourcesType& params);
MpiImpl *FactoryMpiImpl(MpiImplType mpiImpl) throw(LauncherException);
Batch::BatchManager_eClient *FactoryBatchManager( const ParserResourcesType& params ) throw(LauncherException);
std::string getTmpDirForBatchFiles();
salomeinclude_HEADERS = \
BatchTest.hxx \
SALOME_Launcher.hxx \
+ SALOME_Launcher_defs.hxx \
Launcher.hxx
# Scripts to be installed
SALOME_LauncherServer_LDADD =\
libSalomeLauncher.la \
+ ../Basics/libSALOMEBasics.la \
$(MPI_LIBS) \
$(CORBA_LIBS) \
$(LIBXML_LIBS) \
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SALOME_Launcher.hxx"
+#include "BatchTest.hxx"
#include "OpUtil.hxx"
-#include <sys/types.h>
-#ifndef WNT
-#include <unistd.h>
+#include "SALOME_ContainerManager.hxx"
+#include "Utils_CorbaException.hxx"
+
+#ifdef WIN32
+# include <process.h>
+#else
+# include <unistd.h>
#endif
+#include <sys/types.h>
#include <vector>
-#include "Utils_CorbaException.hxx"
using namespace std;
//=============================================================================
CORBA::Long SALOME_Launcher::getPID()
{
- return (CORBA::Long)getpid();
+ return
+#ifndef WIN32
+ (CORBA::Long)getpid();
+#else
+ (CORBA::Long)_getpid();
+#endif
+
}
//=============================================================================
const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]);
string clustername(p->alias);
INFOS("Choose cluster" << clustername);
+
BatchTest t(*p);
if (t.test())
{
p.mem_mb = params.mem_mb;
try{
- status = _l.querySalomeJob(jobId,p);
+ status = _l.querySalomeJob(jobId,p);
}
catch(const LauncherException &ex){
INFOS("Caught exception.");
#ifndef __SALOME_LAUNCHER_HXX__
#define __SALOME_LAUNCHER_HXX__
+#include "SALOME_Launcher_defs.hxx"
+
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
-#include "SALOME_ContainerManager.hxx"
-#include "BatchTest.hxx"
#include "Launcher.hxx"
#include <string>
class SALOME_NamingService;
+class SALOME_ContainerManager;
+class SALOME_ResourcesManager;
-#if defined LAUNCHER_EXPORTS
-#if defined WIN32
-#define LAUNCHER_EXPORT __declspec( dllexport )
-#else
-#define LAUNCHER_EXPORT
-#endif
-#else
-#if defined WNT
-#define LAUNCHER_EXPORT __declspec( dllimport )
-#else
-#define LAUNCHER_EXPORT
-#endif
-#endif
-
-class LAUNCHER_EXPORT SALOME_Launcher:
+class SALOMELAUNCHER_EXPORT SALOME_Launcher:
public POA_Engines::SalomeLauncher,
public PortableServer::RefCountServantBase
{
const Engines::BatchParameters& batch_params,
const Engines::MachineParameters& params);
- char* querySalomeJob( const CORBA::Long jobId, const Engines::MachineParameters& params);
- void deleteSalomeJob( const CORBA::Long jobId, const Engines::MachineParameters& params);
- void getResultSalomeJob( const char * directory, const CORBA::Long jobId, const Engines::MachineParameters& params );
+ char* querySalomeJob( CORBA::Long jobId, const Engines::MachineParameters& params);
+ void deleteSalomeJob( CORBA::Long jobId, const Engines::MachineParameters& params);
+ void getResultSalomeJob( const char * directory, CORBA::Long jobId, const Engines::MachineParameters& params );
CORBA::Boolean testBatch(const Engines::MachineParameters& params);
void AttachDebugger()
{
+#ifndef WIN32
if(getenv ("DEBUGGER"))
{
std::stringstream exec;
exec << "$DEBUGGER SALOME_LauncherServer " << getpid() << "&";
- std::cerr << exec.str() << std::endl;
+ MESSAGE ( exec.str() );
system(exec.str().c_str());
while(1);
}
+#endif
}
void terminateHandler(void)
{
- std::cerr << "Terminate: not managed exception !" << std::endl;
+ MESSAGE ( "Terminate: not managed exception !" );
AttachDebugger();
}
void unexpectedHandler(void)
{
- std::cerr << "Unexpected: unexpected exception !" << std::endl;
+ MESSAGE ( "Unexpected: unexpected exception !" );
AttachDebugger();
}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef __SALOME_LAUNCHER_DEFS_HXX__
+#define __SALOME_LAUNCHER_DEFS_HXX__
+
+#ifdef WIN32
+# ifdef SALOMELAUNCHER_EXPORTS
+# define SALOMELAUNCHER_EXPORT __declspec(dllexport)
+# else
+# define SALOMELAUNCHER_EXPORT __declspec(dllimport)
+# endif
+#else
+# define SALOMELAUNCHER_EXPORT
+#endif
+
+#endif //__SALOME_LAUNCHER_DEFS_HXX__
#include "SALOME_FileTransferCORBA.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "utilities.h"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
using namespace std;
container = _theFileRef->getContainer();
ASSERT(! CORBA::is_nil(container));
- string myMachine = GetHostname();
+ string myMachine = Kernel_Utils::GetHostname();
string localCopy = _theFileRef->getRef(myMachine.c_str());
if (localCopy.empty()) // no existing copy available
#include <string>
-#ifdef WNT
+#ifdef WIN32
# if defined LIFECYCLECORBA_EXPORTS
# define LIFECYCLECORBA_EXPORT __declspec( dllexport )
# else
#include <iomanip>
#include <time.h>
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#endif
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include "utilities.h"
#include <ServiceUnreachable.hxx>
#include "SALOME_LifeCycleCORBA.hxx"
-#ifndef WNT
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
#include CORBA_CLIENT_HEADER(SALOME_Session)
#include CORBA_CLIENT_HEADER(DSC_Engines)
#include CORBA_CLIENT_HEADER(SALOME_Registry)
#include CORBA_CLIENT_HEADER(SALOMEDS)
-#else
-#include "SALOME_ModuleCatalog.hh"
-#include "SALOME_Session.hh"
-#include "DSC_Engines.hh"
-#include "SALOME_Registry.hh"
-#include "SALOMEDS.hh"
-#endif
+
#include "SALOME_ContainerManager.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
{
// containerName doesn't contain "/" => Local container
params->container_name=CORBA::string_dup(stContainer);
- params->hostname=CORBA::string_dup(GetHostname().c_str());
+ params->hostname=CORBA::string_dup(Kernel_Utils::GetHostname().c_str());
}
else
{
}
}
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
// 1) SalomeLauncher
CORBA::Object_var objSL = _NS->Resolve("/SalomeLauncher");
#define _SALOME_LIFECYCLECORBA_HXX_
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <string>
#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
#include CORBA_CLIENT_HEADER(SALOME_Component)
#include <iostream>
-using namespace std;
-#ifdef WNT
+
+#ifdef WIN32
# if defined LIFECYCLECORBA_EXPORTS
# define LIFECYCLECORBA_EXPORT __declspec( dllexport )
# else
#include "SALOME_FileTransferCORBA.hxx"
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include <iostream>
#include <fstream>
// --- get a local container (with a name based on local hostname),
// load an engine, check that the CORBA object is not null
- string containerName = GetHostname();
+ string containerName = Kernel_Utils::GetHostname();
containerName += "/theContainer";
DEVTRACE("containerName = " << containerName);
Engines::Component_var mycompo =
_LCC.FindOrLoad_Component(containerName.c_str(),"SalomeTestComponent");
CPPUNIT_ASSERT(!CORBA::is_nil(mycompo1));
- containerName = GetHostname();
+ containerName = Kernel_Utils::GetHostname();
containerName += "/aContainer";
DEVTRACE("containerName = " << containerName);
Engines::Component_var mycompo2 =
Engines::MachineParameters params;
_LCC.preSet(params);
- string hostname=GetHostname();
+ string hostname=Kernel_Utils::GetHostname();
params.hostname=hostname.c_str();
Engines::Component_var mycompo =
_LCC.FindOrLoad_Component(params,"SalomeTestComponent");
Engines::Container_var c1 = m1->GetContainerRef();
CPPUNIT_ASSERT(!CORBA::is_nil(c1));
string hostname1 = c1->getHostName();
- CPPUNIT_ASSERT_EQUAL(hostname1, GetHostname());
+ CPPUNIT_ASSERT_EQUAL(hostname1, Kernel_Utils::GetHostname());
}
Engines::Container_var c1 = m1->GetContainerRef();
CPPUNIT_ASSERT(!CORBA::is_nil(c1));
string hostname1 = c1->getHostName();
- CPPUNIT_ASSERT_EQUAL(hostname1, GetHostname());
+ CPPUNIT_ASSERT_EQUAL(hostname1, Kernel_Utils::GetHostname());
string cname1 = c1->name();
CPPUNIT_ASSERT(cname1.find(containerName) != string::npos);
}
SALOME_LifeCycleCORBA _LCC(&_NS);
string origFileName = getenv("KERNEL_ROOT_DIR");
origFileName += "/lib/salome/libSalomeLifeCycleCORBA.so.0.0.0";
- SALOME_FileTransferCORBA transfer( GetHostname(),
+ SALOME_FileTransferCORBA transfer( Kernel_Utils::GetHostname(),
origFileName);
string local = transfer.getLocalFile();
CPPUNIT_ASSERT(!local.empty());
resourcesManager->GetFittingResources(params,clist);
CPPUNIT_ASSERT(hostList->length() > 1);
- string localHost = GetHostname();
+ string localHost = Kernel_Utils::GetHostname();
string remoteHost;
for (unsigned int i=0; i < hostList->length(); i++)
{
// $Header$
#include <iostream>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <SALOMEconfig.h>
-#ifndef WNT
#include CORBA_CLIENT_HEADER(SALOME_Component)
#include CORBA_CLIENT_HEADER(SALOME_TestComponent)
-#else
-#include <SALOME_Component.hh>
-#include <SALOME_TestComponent.hh>
-#endif
#include "SALOME_NamingService.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "SALOME_FileTransferCORBA.hxx"
#include "utilities.h"
-#include <OpUtil.hxx>
+#include <Basics_Utils.hxx>
using namespace std;
// --- yet another container, with hostname,
// load an engine, and invoque methods on that engine
- string containerName4 = GetHostname();
+ string containerName4 = Kernel_Utils::GetHostname();
containerName4 += "/titiPy";
Engines::Component_var mycompo4 =
_LCC.FindOrLoad_Component(containerName4.c_str(),"SALOME_TestComponentPy");
// --- try a local file transfer
string origFileName = "/home/prascle/petitfichier";
- SALOME_FileTransferCORBA transfer( GetHostname(),
+ SALOME_FileTransferCORBA transfer( Kernel_Utils::GetHostname(),
origFileName);
string local = transfer.getLocalFile();
SCRUTE(local);
%module libSALOME_LifeCycleCORBA
+%feature("autodoc", "1");
+
%include <std_except.i>
$result = PyString_FromString($1.c_str());
}
-%typemap(typecheck) const Engines::MachineParameters &,
- Engines::MachineParameters const &
+%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) Engines::MachineParameters const &
+{
+ $1 = PyDict_Check($input)? 1 : 0;
+}
+%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) const Engines::MachineParameters &
{
- $1 = PyDict_Check($input);
+ $1 = PyDict_Check($input)? 1 : 0;
}
%typemap(typecheck) std::string,
# include <unistd.h>
#endif
-#ifdef WNT
+#ifdef WIN32
#include <omnithread/pthread_nt.h>
#endif
#define SALOME_Logger_Server_include
#include <SALOMEconfig.h>
-
#include <fstream>
+
#ifdef WNT
#include <iosfwd>
#endif
#include <omnithread.h>
#include "Logger.hh"
-#ifdef WNT
+#ifdef WIN32
# if defined LOGGER_EXPORTS
# define LOGGER_EXPORT __declspec( dllexport )
# else
for (i = 1; i <= NumberOfTries; i++)
{
-#ifndef WNT
+#ifndef WIN32
if (i != 1) nanosleep(&ts_req, &ts_rem);
#else
if (i != 1) Sleep(TIMESleep / 1000000);
#include <iostream>
using namespace std;
-#ifdef WNT
+#ifdef WIN32
#include <omnithread/pthread_nt.h>
#endif
// searchin for naming service for 0.25*40=10 seconds
for (i = 1; i <= NumberOfTries; i++) {
-#ifndef WNT
+#ifndef WIN32
if (i != 1) nanosleep(&ts_req,&ts_rem);
#else
if (i != 1) Sleep(TIMESleep / 1000000);
name[0].id=CORBA::string_dup("Logger");
for(i = 1; i <= NumberOfTries; i++){
-#ifndef WNT
+#ifndef WIN32
if (i != 1) nanosleep(&ts_req, &ts_rem);
#else
if (i != 1) Sleep(TIMESleep / 1000000);
#include "Logger.hh"
//these declarations for files don't using OCC includes (for example HDF)
-# ifdef WNT
+# ifdef WIN32
# ifndef Standard_EXPORT
# define Standard_EXPORT __declspec( dllexport )
# define Standard_IMPORTC extern "C" __declspec( dllimport )
# endif /* Standard_IMPORT */
-# else /* WNT */
+# else /* WIN32 */
# ifndef Standard_EXPORT
# define Standard_EXPORT
# define Standard_IMPORTC extern "C"
# endif /* Standard_IMPORT */
-# endif /* WNT */
+# endif /* WIN32 */
class SALOME_Trace : public std::ostrstream
{
CORBA::Object_var obj=_poa->id_to_reference(*_id);
Engines::Container_var pCont = Engines::Container::_narrow(obj);
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
_containerName = _NS->BuildContainerNameForNS(containerName,hostname.c_str());
SCRUTE(_containerName);
_NS->Register(pCont, _containerName.c_str());
SUBDIRS += $(SUBDIR_CORBA)
endif
-#if MPI_IS_OK
-# SUBDIRS += $(SUBDIR_MPI)
-#endif
+if MPI_IS_OK
+ SUBDIRS += $(SUBDIR_MPI)
+endif
if CPPUNIT_IS_OK
if CORBA_GEN
if WITH_PACO_PARALLEL
SUBDIRS += $(SUBDIR_PARALLEL)
endif
+
+EXTRA_DIST = win32pm
#ifndef _SALOME_ModuleCatalog_HXX_
#define _SALOME_ModuleCatalog_HXX_
-#ifdef WNT
- #if defined MODULECATALOG_EXPORTS
- #if defined WIN32
- #define MODULECATALOG_EXPORT __declspec( dllexport )
- #else
- #define MODULECATALOG_EXPORT
- #endif
- #else
- #if defined WIN32
- #define MODULECATALOG_EXPORT __declspec( dllimport )
- #else
- #define MODULECATALOG_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef MODULECATALOG_EXPORTS
+# define MODULECATALOG_EXPORT __declspec( dllexport )
+# else
+# define MODULECATALOG_EXPORT __declspec( dllimport )
+# endif
#else
#define MODULECATALOG_EXPORT
#endif
_length = S_in.ServiceoutParameter.length();
S_out.ServiceoutParameter.length(_length);
-#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
-#else
- for (ind2 = 0; ind2 < _length ; ind2 ++)
-#endif
duplicate(S_out.ServiceoutParameter[ind2],
S_in.ServiceoutParameter[ind2]);
_length = S_in.ServiceinDataStreamParameter.length();
S_out.ServiceinDataStreamParameter.length(_length);
-#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
-#else
- for (ind2 = 0; ind2 < _length ; ind2 ++)
-#endif
duplicate(S_out.ServiceinDataStreamParameter[ind2],
S_in.ServiceinDataStreamParameter[ind2]);
if(MYDEBUG) SCRUTE(_length);
S_out.ServiceoutDataStreamParameter.length(_length);
-#ifndef WNT
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
-#else
- for (ind2 = 0; ind2 < _length ; ind2 ++)
-#endif
duplicate(S_out.ServiceoutDataStreamParameter[ind2],
S_in.ServiceoutDataStreamParameter[ind2]);
}
MESSAGE("Get Typed Component list (SUPERV Type)");
list_typed_composants
= Catalogue->GetTypedComponentList(SALOME_ModuleCatalog::SUPERV);
-#ifndef WNT
for (unsigned int ind = 0; ind < list_typed_composants->length();ind++)
-#else
- for (ind = 0; ind < list_typed_composants->length();ind++)
-#endif
MESSAGE("Component SUPERV list : " << list_typed_composants[ind]);
// Get list of couple (component name, component icone)
SALOME_ModuleCatalog::ListOfIAPP_Affich_var list_composants_icone
= Catalogue->GetComponentIconeList();
-#ifndef WNT
for (unsigned int ind = 0; ind < list_composants_icone->length();ind++)
-#else
- for (ind = 0; ind < list_composants_icone->length();ind++)
-#endif
{
MESSAGE("Component name: " << list_composants_icone[ind].modulename);
MESSAGE("Component icone: " << list_composants_icone[ind].moduleicone);
for (int i = 1; i<=NumberOfTries; i++)
{
if (i!=1)
-#ifndef WNT
+#ifndef WIN32
a=nanosleep(&ts_req,&ts_rem);
#else
Sleep(TIMESleep/1000000);
for(int j=1; j<=NumberOfTries; j++)
{
if (j!=1)
-#ifndef WNT
+#ifndef WIN32
a=nanosleep(&ts_req, &ts_rem);
#else
Sleep(TIMESleep/1000000);
#include "SALOME_ModuleCatalog_Acomponent_impl.hxx"
#include <fstream>
#include <map>
+#include "utilities.h"
-using namespace std;
+#ifdef WIN32
+# include <process.h>
+#endif
-#include "utilities.h"
+using namespace std;
#ifdef _DEBUG_
static int MYDEBUG = 0;
list<string> dirList;
-#ifdef WNT
+#ifdef WIN32
dirList = splitStringToList(_general_path, SEPARATOR);
#else
//check for new format
// The components in the general catalog are taken only if they're
// not defined in the personal catalog
-#ifndef WNT
+#ifndef WIN32
for(unsigned int ind=0; ind < _general_module_list.size();ind++){
#else
for(ind=0; ind < _general_module_list.size();ind++){
// The components in the general catalog are taken only if they're
// not defined in the personal catalog
-#ifndef WNT
+#ifndef WIN32
for(unsigned int ind=0; ind < _general_module_list.size();ind++){
#else
for(ind=0; ind < _general_module_list.size();ind++){
// The components in the general catalog are taken only if they're
// not defined in the personal catalog
-#ifndef WNT
+#ifndef WIN32
for (unsigned int ind=0; ind < _general_module_list.size();ind++)
#else
for (ind=0; ind < _general_module_list.size();ind++)
CORBA::Long SALOME_ModuleCatalogImpl::getPID()
{
- return (CORBA::Long)getpid();
+ return
+#ifndef WIN32
+ (CORBA::Long)getpid();
+#else
+ (CORBA::Long)_getpid();
+#endif
}
void SALOME_ModuleCatalogImpl::ShutdownWithExit()
_length = S_parser.outParameters.size();
S_corba.ServiceoutParameter.length(_length);
-#ifndef WNT
+#ifndef WIN32
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
#else
for (ind2 = 0; ind2 < _length ; ind2 ++)
_length = S_parser.inDataStreamParameters.size();
S_corba.ServiceinDataStreamParameter.length(_length);
-#ifndef WNT
+#ifndef WIN32
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
#else
for (ind2 = 0; ind2 < _length ; ind2 ++)
// if(MYDEBUG) SCRUTE(_length);
S_corba.ServiceoutDataStreamParameter.length(_length);
-#ifndef WNT
+#ifndef WIN32
for (unsigned int ind2 = 0; ind2 < _length ; ind2 ++)
#else
for (ind2 = 0; ind2 < _length ; ind2 ++)
}
// Parse if a computer name is twice in the list of computers
-#ifndef WNT
for (unsigned int ind = 0; ind < _machine_list.size(); ind++)
-#else
- for (ind = 0; ind < _machine_list.size(); ind++)
-#endif
{
for (unsigned int ind1 = ind+1 ; ind1 < _machine_list.size(); ind1++)
{
self.parent = None
self.childs = []
self.comments = []
+ self.attrs={}
def addChild(self, tree):
if tree is not None:
d = depth
if self.name != '':
s = string.ljust('', 4*depth)
- s += '<' + self.name + '>'
+ s += '<' + self.name
+ for k,v in self.attrs.items():
+ s += ' ' + k + '="' + v + '"'
+ s += '>'
if self.content != '':
s += self.content
else:
L_merge.addChild(i_ext)
self.replaceChild(L_merge)
+
+ def setAttrib(self, name,value):
+ self.attrs[name]=value
parser.parse(filename)
else:
t = self.addNamedChild('begin-catalog')
+ t.addNamedChild('type-list')
t.addNamedChild('component-list')
n = self.getChild('begin-catalog')
return
if n.getChild('path-prefix-list') is None:
n.insertFirstNamedChild('path-prefix-list')
+ if n.getChild('type-list') is None:
+ p=n.childs.index(n.getChild('path-prefix-list'))
+ n.childs.insert(p+1,Tree('type-list'))
if n.getChild('component-list') is None:
n.addNamedChild('component-list')
e = p.addChild(parameter(mode='in'))
elif name == 'outParameter':
e = p.addChild(parameter(mode='out'))
+ elif name == 'sequence':
+ e = p.addChild(SeqType(attrs["name"],attrs["content"]))
+ elif name == 'objref':
+ e = p.addChild(ObjType(attrs["name"]))
+ elif name == 'struct':
+ e = p.addChild(StructType(attrs["name"]))
+ elif name == 'type':
+ e = p.addChild(Type(attrs["name"],attrs["kind"]))
+ elif name == 'member':
+ e = p.addChild(Member(attrs["name"],attrs["type"]))
else:
e = p.addNamedChild(name)
self.list.append(e)
print ' replace component', i_ext.getChild('component-name').content
i_int.merge(i_ext)
-
-
+ def mergeType(self, type):
+ L_int = self.getNode('type-list')
+ if L_int is None:
+ error("Catalog.mergeType : 'type-list' is not found")
+ return
+ for t in L_int.childs:
+ if t.attrs["name"] == type.attrs["name"]:
+ t.merge(type)
+ return
+
+ L_int.addChild(type)
+
+class Member(Tree):
+ def __init__(self, name,type):
+ Tree.__init__(self, 'member')
+ self.setAttrib("name",name)
+ self.setAttrib("type",type)
+
+class Type(Tree):
+ def __init__(self, name,kind):
+ Tree.__init__(self, 'type')
+ self.setAttrib("name",name)
+ self.setAttrib("kind",kind)
+
+ def merge(self,t):
+ self.setAttrib("kind",t.attrs["kind"])
+
+class SeqType(Tree):
+ def __init__(self, name,content):
+ Tree.__init__(self, 'sequence')
+ self.setAttrib("name",name)
+ self.setAttrib("content",content)
+
+ def merge(self,t):
+ self.setAttrib("content",t.attrs["content"])
+
+class StructType(Tree):
+ def __init__(self, name):
+ Tree.__init__(self, 'struct')
+ self.setAttrib("name",name)
+
+ def merge(self,t):
+ #remove childs and replace by t childs
+ self.childs=[]
+ for c in t.childs:
+ self.childs.append(c)
+
+class ObjType(Tree):
+ def __init__(self, name):
+ Tree.__init__(self, 'objref')
+ self.setAttrib("name",name)
+
+ def merge(self,t):
+ RepoId=t.attrs.get("id")
+ if RepoId:
+ self.setAttrib("id",RepoId)
+ #remove childs and replace by t childs
+ self.childs=[]
+ for c in t.childs:
+ self.childs.append(c)
# IDL file reader
def __init__(self, catalog):
self.catalog = catalog
self.EngineType = 0
+ self.currentScope=None
def visitAST(self, node):
for n in node.declarations():
- n.accept(self)
+ if n.mainFile():
+ n.accept(self)
def visitModule(self, node):
+ self.currentScope=node
for n in node.definitions():
n.accept(self)
def visitInterface(self, node):
-
if node.mainFile():
self.EngineType = 0
for i in node.inherits():
s = i.scopedName();
- if ((s[0] == "Engines") & (s[1] == "Component")):
+ if s[0] == "Engines":
+ if s[1] == "Component":
self.EngineType = 1; break
+ if s[1] == "Superv_Component":
+ self.EngineType = 2; break
- Comp = Component(node.identifier())
+ if self.EngineType:
+ #This interface is a SALOME component
+ Comp = Component(node.identifier())
- self.currentInterface = Comp.createInterface(node.identifier())
+ self.currentInterface = Comp.createInterface(node.identifier())
- for c in node.callables():
+ for c in node.callables():
if isinstance(c, idlast.Operation):
c.accept(self)
- for c in node.declarations():
+ for c in node.declarations():
if isinstance(c, idlast.Struct):
c.accept(self)
- for i in node.comments():
+ for i in node.comments():
self.currentInterface.comments.append(str(i))
- self.currentInterface.processDataStreams()
+ if self.EngineType == 2:
+ self.currentInterface.processDataStreams()
- if (self.EngineType):
- global nb_components
- nb_components = nb_components + 1
- self.catalog.mergeComponent(Comp)
+ global nb_components
+ nb_components = nb_components + 1
+ self.catalog.mergeComponent(Comp)
+
+ else:
+ #This interface is not a component : use it as a DataType
+ t=ObjType("/".join(node.scopedName()))
+ for i in node.inherits():
+ t.addNamedChild("base","/".join(i.scopedName()))
+ self.catalog.mergeType(t)
self.EngineType = 0
def visitDeclaredType(self, type):
- self.currentType = type.name()
+ name=type.name()
+ scoped_name="/".join(type.scopedName())
+ self.currentType = scoped_name
def visitBaseType(self, type):
self.currentType = ttsMap[type.kind()]
self.currentService.createOutParameter \
(node.identifier(), self.currentType)
+ def visitSequenceType(self,type):
+ type.seqType().accept(self)
+ if type.bound() == 0:
+ self.contentType=self.currentType
+ self.currentType = "sequence"
+ else:
+ self.currentType = None
+
+ def visitTypedef(self, node):
+ if node.constrType():
+ node.aliasType().decl().accept(self)
+
+ node.aliasType().accept(self)
+ type = self.currentType
+ if not type:
+ return
+ decll = []
+ for d in node.declarators():
+ d.accept(self)
+ if self.__result_declarator:
+ decll.append(self.__result_declarator)
+ if type == "sequence":
+ #it's a sequence type
+ for name in decll:
+ scoped_name="/".join(self.currentScope.scopedName()+[name])
+ self.catalog.mergeType(SeqType(scoped_name,self.contentType))
+ #else:
+ #it's an alias
+ # for name in decll:
+ # scoped_name="/".join(self.currentScope.scopedName()+[name])
+ # self.catalog.mergeType(Type(scoped_name,type))
+
+ def visitStruct(self, node):
+ t=StructType("/".join(node.scopedName()))
+ for m in node.members():
+ if m.constrType():
+ m.memberType().decl().accept(self)
+
+ m.memberType().accept(self)
+ type = self.currentType
+ for d in m.declarators():
+ d.accept(self)
+ t.addChild(Member(self.__result_declarator,type))
+
+ self.catalog.mergeType(t)
+
+ def visitDeclarator(self, node):
+ if node.sizes():
+ self.__result_declarator =None
+ else:
+ self.__result_declarator =node.identifier()
+
#--------------------------------------------------
# parse idl and store xml file
#--------------------------------------------------
export ROOT_SRCDIR
ROOT_BUILDDIR=@ROOT_BUILDDIR@
export ROOT_BUILDDIR
-SRCDIR=${ROOT_SRCDIR}/SALOME/src/ModuleGenerator
+SRCDIR=${ROOT_SRCDIR}/src/ModuleGenerator
export SRCDIR
${SRCDIR}/tests/test$1.sh
--- /dev/null
+// Copyright (C) 2005 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : AddComponent.idl
+// Author : Jean Rahuel
+
+#ifndef _ADDCOMPONENT_IDL
+#define _ADDCOMPONENT_IDL
+
+#include "SALOME_Component.idl"
+
+module SuperVisionTest {
+
+ interface Adder ;
+
+ interface AddComponent : Engines::Component {
+ double Add( in double x , in double y , out double z ) ;
+ double AddWithoutSleep( in double x , in double y , out double z ) ;
+ void Setx( in double x ) ;
+ void Sety( in double y ) ;
+ double Addxy() ;
+ double AddyTox( in double y ) ;
+ long Sigma( in long n ) ;
+ double LastResult() ;
+
+ Adder Addition() ;
+ boolean AdditionObjRef1( out Adder anAdder ) ;
+ void AdditionObjRef2( out boolean FuncValue , out Adder anAdder ) ;
+ boolean AdditionObjRefs( in AddComponent AddComponent1 ,
+ in AddComponent Adder2 ,
+ in AddComponent Adder3 ,
+ out AddComponent RetAddComponent1 ,
+ out AddComponent RetAdder2 ,
+ out AddComponent RetAdder3 ) ;
+ };
+
+ interface Adder : Engines::Component {
+ double Add( in double x , in double y , out double z ) ;
+ double AddWithoutSleep( in double x , in double y , out double z ) ;
+ double AddAndCompare( in double x , in double y , in Adder anOtherAdder,
+ out double z ) ;
+ void SetLastResult( in double z ) ;
+ void LastResult( out double z ) ;
+ Engines::Component LccAddComponent( in string aContainer ,
+ in string aComponentName ) ;
+ };
+
+} ;
+
+#endif
--- /dev/null
+// Copyright (C) 2005 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : SubComponent.idl
+// Author : Jean Rahuel
+
+#ifndef _SUBCOMPONENT_IDL
+#define _SUBCOMPONENT_IDL
+
+#include "SALOME_Component.idl"
+
+module SuperVisionTest {
+
+ interface SubComponent : Engines::Component {
+ void Sub( in double x , in double y , out double z ) ;
+ } ;
+};
+
+
+#endif
\rm -f my_catalog.xml*
-${ROOT_BUILDDIR}/bin/runIDLparser \
+sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \
+ -I${ROOT_SRCDIR}/idl \
-Wbcatalog=my_catalog.xml \
- ${ROOT_SRCDIR}/idl/AddComponent.idl
+ ${SRCDIR}/tests/AddComponent.idl
# File : test1b.sh
# Module : SALOME
-echo "test6:
+echo "test1b:
test derivation Engine::Component
"
--> creation d'un nouveau catalogue avec un composant
"
-${ROOT_BUILDDIR}/bin/runIDLparser \
- -Wbcatalog=my_catalog.xml \
+sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \
+ -I${ROOT_SRCDIR}/idl \
+ -Wbcatalog=my_catalog.xml \
${SRCDIR}/tests/TrucComponent.idl
--> creation d'un nouveau catalogue avec un composant
"
-${ROOT_BUILDDIR}/bin/runIDLparser \
+sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \
+ -I${ROOT_SRCDIR}/idl \
-Wbcatalog=my_catalog.xml \
- ${ROOT_SRCDIR}/idl/AddComponent.idl
+ ${SRCDIR}/tests/AddComponent.idl
echo "
--> ajout d'un nouveau composant dans le catalogue
"
-${ROOT_BUILDDIR}/bin/runIDLparser \
+sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \
+ -I${ROOT_SRCDIR}/idl \
-Wbcatalog=my_catalog.xml \
- ${ROOT_SRCDIR}/idl/SubComponent.idl
+ ${SRCDIR}/tests/SubComponent.idl
echo "
--> remplacement du premier composant dans le catalogue
"
-${ROOT_BUILDDIR}/bin/runIDLparser \
+sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \
+ -I${ROOT_SRCDIR}/idl \
-Wbcatalog=my_catalog.xml \
- ${ROOT_SRCDIR}/idl/AddComponent.idl
+ ${SRCDIR}/tests/AddComponent.idl
--> creation d'un nouveau catalogue avec un composant
"
-${ROOT_BUILDDIR}/bin/runIDLparser \
- -Wbcatalog=my_catalog.xml \
- ${ROOT_SRCDIR}/idl/AddComponent.idl
+sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \
+ -I${ROOT_SRCDIR}/idl \
+ -Wbcatalog=my_catalog.xml \
+ ${SRCDIR}/tests/AddComponent.idl
+
echo "
--> remplacement du composant dans le catalogue (meme idl)
"
-${ROOT_BUILDDIR}/bin/runIDLparser \
- -Wbcatalog=my_catalog.xml \
- ${ROOT_SRCDIR}/idl/AddComponent.idl
+sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \
+ -I${ROOT_SRCDIR}/idl \
+ -Wbcatalog=my_catalog.xml \
+ ${SRCDIR}/tests/AddComponent.idl
--> creation d'un nouveau catalogue avec un composant
"
-${ROOT_BUILDDIR}/bin/runIDLparser \
- -Wbcatalog=my_catalog.xml \
- ${ROOT_SRCDIR}/idl/AddComponent.idl
+sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \
+ -I${ROOT_SRCDIR}/idl \
+ -Wbcatalog=my_catalog.xml \
+ ${SRCDIR}/tests/AddComponent.idl
mv my_catalog.xml C1
--> remplacement du composant dans le catalogue (autre idl)
"
-${ROOT_BUILDDIR}/bin/runIDLparser \
- -Wbcatalog=my_catalog.xml \
- ${SRCDIR}/tests/Truc2Component.idl
+sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \
+ -I${ROOT_SRCDIR}/idl \
+ -Wbcatalog=my_catalog.xml \
+ ${SRCDIR}/tests/Truc2Component.idl
# File : test5.sh
# Module : SALOME
-echo "test4:
+echo "test5:
creation d'un catalogue avec tous les idl de Salome
(au 29/3/2002)
echo
echo " processing " `basename $i`
echo
- ${ROOT_BUILDDIR}/bin/runIDLparser \
- -Wbcatalog=my_catalog.xml $i
+ sh ${ROOT_BUILDDIR}/bin/runIDLparser -p ${SRCDIR} \
+ -I${ROOT_SRCDIR}/idl \
+ -Wbcatalog=my_catalog.xml $i
done
%module libNOTIFICATION
+%feature("autodoc", "1");
%{
//#define __declspec(a)
#ifndef _SALOME_NOTIFICATION_SWIG_HXX_
#define _SALOME_NOTIFICATION_SWIG_HXX_
-#ifdef WNT
- #if defined NOTIFICATION_SWIG_EXPORTS
- #if defined WIN32
- #define NOTIFICATION_SWIG_EXPORT __declspec( dllexport )
- #else
- #define NOTIFICATION_SWIG_EXPORT
- #endif
- #else
- #if defined WIN32
- #define NOTIFICATION_SWIG_EXPORT __declspec( dllimport )
- #else
- #define NOTIFICATION_SWIG_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef NOTIFICATION_SWIG_EXPORTS
+# define NOTIFICATION_SWIG_EXPORT __declspec( dllexport )
+# else
+# define NOTIFICATION_SWIG_EXPORT __declspec( dllimport )
+# endif
#else
- #define NOTIFICATION_SWIG_EXPORT
+# define NOTIFICATION_SWIG_EXPORT
#endif
#endif
salomeinclude_HEADERS =\
SALOME_NamingService.hxx \
ServiceUnreachable.hxx \
- NamingService_WaitForServerReadiness.hxx
+ NamingService_WaitForServerReadiness.hxx \
+ SALOME_NamingService_defs.hxx
# Scripts to be exported
dist_salomescript_DATA =\
break; // server found, no more try to do
}
MESSAGE("Server "<< serverName <<" not yet ready, waiting...");
-#ifndef WNT
+#ifndef WIN32
nanosleep(&ts_req,&ts_rem); // wait before retry
#else
Sleep(TIMESleep/1000000);
catch( ServiceUnreachable& )
{
MESSAGE("CORBA::COMM_FAILURE: Naming Service not yet ready, waiting...");
-#ifndef WNT
+#ifndef WIN32
nanosleep(&ts_req,&ts_rem); // wait before retry
#else
Sleep(TIMESleep/1000000);
#include "Utils_Mutex.hxx"
#include "ServiceUnreachable.hxx"
-#if defined NAMINGSERVICE_EXPORTS
-#if defined WIN32
-#define NAMINGSERVICE_EXPORT __declspec( dllexport )
-#else
-#define NAMINGSERVICE_EXPORT
-#endif
-#else
-#if defined WNT
-#define NAMINGSERVICE_EXPORT __declspec( dllimport )
-#else
-#define NAMINGSERVICE_EXPORT
-#endif
-#endif
+#include "SALOME_NamingService_defs.hxx"
class NAMINGSERVICE_EXPORT SALOME_NamingService
{
--- /dev/null
+// SALOME NamingService : wrapping NamingService services
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : SALOME_NamingService_defs.hxx
+// Author : Alexander A. BORODIN
+// Module : SALOME
+// $Header$
+
+#ifndef SALOME_NAMINGSERVICE_DEFS_HXX
+#define SALOME_NAMINGSERVICE_DEFS_HXX
+
+#ifdef WIN32
+# ifdef NAMINGSERVICE_EXPORTS
+# define NAMINGSERVICE_EXPORT __declspec( dllexport )
+# else
+# define NAMINGSERVICE_EXPORT __declspec( dllimport )
+# endif
+#else
+# define NAMINGSERVICE_EXPORT
+#endif
+
+#endif //SALOME_NAMINGSERVICE_DEFS_HXX
#if !defined ( SERVICEUNREACHABLE_H )
#define SERVICEUNREACHABLE_H
-#if defined NAMINGSERVICE_EXPORTS
-#if defined WNT
-#define NAMINGSERVICE_EXPORT __declspec( dllexport )
-#else
-#define NAMINGSERVICE_EXPORT
-#endif
-#else
-#if defined WNT
-#define NAMINGSERVICE_EXPORT __declspec( dllimport )
-#else
-#define NAMINGSERVICE_EXPORT
-#endif
-#endif
-
+#include "SALOME_NamingService_defs.hxx"
#include "Utils_SALOME_Exception.hxx"
//! exception class for NamingService : ServiceUnreachable
#ifndef _SALOME_NOTIFICATION_HXX_
#define _SALOME_NOTIFICATION_HXX_
-#ifdef WNT
- #if defined NOTIFICATION_EXPORTS
- #if defined WIN32
- #define NOTIFICATION_EXPORT __declspec( dllexport )
- #else
- #define NOTIFICATION_EXPORT
- #endif
- #else
- #if defined WIN32
- #define NOTIFICATION_EXPORT __declspec( dllimport )
- #else
- #define NOTIFICATION_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef NOTIFICATION_EXPORTS
+# define NOTIFICATION_EXPORT __declspec( dllexport )
+# else
+# define NOTIFICATION_EXPORT __declspec( dllimport )
+# endif
#else
- #define NOTIFICATION_EXPORT
+# define NOTIFICATION_EXPORT
#endif
#endif
#include "OpUtil.hxx"
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <dlfcn.h>
#endif
#include <cstdlib>
#include "utilities.h"
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
// << dec ) ;
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
{
RetVal = Killer( _ThreadId , 0 ) ;
MESSAGE("Engines_Parallel_Component_i::Stop_i() pthread_t "<< pthread_self()
<< " pid " << getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
{
RetVal = Killer( _ThreadId , 0 ) ;
MESSAGE("Engines_Parallel_Component_i::Suspend_i() pthread_t "<< pthread_self()
<< " pid " << getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
#else
if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
}
else
{
-#ifndef WNT
+#ifndef WIN32
RetVal = Killer( _ThreadId ,SIGINT ) ;
#else
RetVal = Killer( *_ThreadId ,SIGINT ) ;
MESSAGE("Engines_Parallel_Component_i::Resume_i() pthread_t "<< pthread_self()
<< " pid " << getpid() << " instanceName "
<< _instanceName.c_str() << " interface " << _interfaceName.c_str()
- << " machineName " << GetHostname().c_str()<< " _id " << hex << _id
+ << " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
bool RetVal = false ;
-#ifndef WNT
+#ifndef WIN32
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
#else
if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
{
if ( _ThreadId > 0 )
{
-#ifndef WNT
+#ifndef WIN32
if ( pthread_self() != _ThreadId )
#else
if ( pthread_self().p != _ThreadId->p )
{
// Get Cpu in the appropriate thread with that object !...
theEngines_Component = this ;
-#ifndef WNT
+#ifndef WIN32
Killer( _ThreadId ,SIGUSR1 ) ;
#else
Killer( *_ThreadId ,SIGUSR11 ) ;
{
MESSAGE(pthread_self() << "Send BeginService notification for " <<serviceName
<< endl << "Component instance : " << _instanceName << endl << endl);
-#ifndef WNT
+#ifndef WIN32
_ThreadId = pthread_self() ;
#else
_ThreadId = new pthread_t;
bool Engines_Parallel_Component_i::Killer( pthread_t ThreadId , int signum )
{
-#ifndef WNT
+#ifndef WIN32
if ( ThreadId )
#else
if ( ThreadId.p )
long Engines_Parallel_Component_i::CpuUsed()
{
long cpu = 0 ;
-#ifndef WNT
+#ifndef WIN32
struct rusage usage ;
if ( _ThreadId || _Executed )
{
#include <iostream>
#include <signal.h>
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <sys/types.h>
class Engines_Parallel_Container_i;
-#if defined CONTAINER_EXPORTS
-#if defined WIN32
-#define CONTAINER_EXPORT __declspec( dllexport )
+#ifdef WIN32
+# ifdef CONTAINER_EXPORTS
+# define CONTAINER_EXPORT __declspec( dllexport )
+# else
+# define CONTAINER_EXPORT __declspec( dllimport )
+# endif
#else
-#define CONTAINER_EXPORT
-#endif
-#else
-#if defined WNT
-#define CONTAINER_EXPORT __declspec( dllimport )
-#else
-#define CONTAINER_EXPORT
-#endif
+# define CONTAINER_EXPORT
#endif
class CONTAINER_EXPORT Engines_Parallel_Component_i:
char * _proxy;
private:
-#ifndef WNT
+#ifndef WIN32
pthread_t _ThreadId ;
#else
pthread_t* _ThreadId ;
#include <string>
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = root_poa->the_POAManager();
-#ifndef WNT
+#ifndef WIN32
// add this container to the kill list
char aCommand[100];
sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerNode", getpid());
obj = root_poa->id_to_reference(*_id);
// In the NamingService
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
int myid = 0;
char buffer [5];
snprintf(buffer, 5, "%d", myid);
#include <string>
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = root_poa->the_POAManager();
-#ifndef WNT
+#ifndef WIN32
// add this container to the kill list
char aCommand[100];
sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerNodeMpi", getpid());
obj = root_poa->id_to_reference(*_id);
// In the NamingService
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
int myid;
MPI_Comm_rank(MPI_COMM_WORLD, &myid);
#include <string>
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = root_poa->the_POAManager();
-#ifndef WNT
+#ifndef WIN32
// add this container to the kill list
char aCommand[100];
sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxyDummy", getpid());
obj = root_poa->id_to_reference(_id);
// In the NamingService
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
Engines::Container_var pCont = Engines::Container::_narrow(obj);
string _containerName = ns->BuildContainerNameForNS(containerName.c_str(),
hostname.c_str());
#include <string>
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
PortableServer::POAManager_var pman = root_poa->the_POAManager();
-#ifndef WNT
+#ifndef WIN32
// add this container to the kill list
char aCommand[100];
sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxyMpi", getpid());
obj = root_poa->id_to_reference(_id);
// in the NamingService
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
Engines::Container_var pCont = Engines::Container::_narrow(obj);
string _containerName = ns->BuildContainerNameForNS(containerName.c_str(),
hostname.c_str());
// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
#include <SALOMEconfig.h>
-#ifndef WNT
+#ifndef WIN32
#else
#include <SALOME_Component.hxx>
#endif
#include "OpUtil.hxx"
#include <string.h>
#include <stdio.h>
-#ifndef WNT
+#ifndef WIN32
#include <dlfcn.h>
#include <unistd.h>
#else
-#include "../../adm/win32/SALOME_WNT.hxx"
+#include "../../adm/win32/SALOME_WIN32.hxx"
#include <signal.h>
#include <process.h>
int SIGUSR1 = 1000;
// Other Containers are started via start_impl of FactoryServer
extern "C" {void ActSigIntHandler() ; }
-#ifndef WNT
+#ifndef WIN32
extern "C" {void SigIntHandler(int, siginfo_t *, void *) ; }
#else
extern "C" {void SigIntHandler( int ) ; }
_argc = argc ;
_argv = argv ;
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
_orb = CORBA::ORB::_duplicate(orb) ;
_poa = PortableServer::POA::_duplicate(poa) ;
char* Engines_Parallel_Container_i::getHostName()
{
- string s = GetHostname();
+ string s = Kernel_Utils::GetHostname();
MESSAGE("Engines_Parallel_Container_i::getHostName " << s);
return CORBA::string_dup(s.c_str()) ;
}
string aCompName = componentName;
// --- try dlopen C++ component
-#ifndef WNT
+#ifndef WIN32
string impl_name = string ("lib") + aCompName + string("Engine.so");
#else
string impl_name = aCompName + string("Engine.dll");
}
void* handle;
-#ifndef WNT
+#ifndef WIN32
handle = dlopen( impl_name.c_str() , RTLD_LAZY ) ;
#else
handle = dlopen( impl_name.c_str() , 0 ) ;
}
//--- try C++
-#ifndef WNT
+#ifndef WIN32
string impl_name = string ("lib") + aCompName +string("Engine.so");
#else
string impl_name = aCompName +string("Engine.dll");
{
MESSAGE("Engines_Parallel_Container_i::Kill() pid "<< getpid() << " containerName "
<< _containerName.c_str() << " machineName "
- << GetHostname().c_str());
+ << Kernel_Utils::GetHostname().c_str());
INFOS("===============================================================");
INFOS("= REMOVE calls to Kill_impl in C++ container =");
INFOS("===============================================================");
string instanceName = aGenRegisterName + "_inst_" + aNumI ;
string component_registerName = _containerName + "/" + instanceName;
- string hostname = GetHostname();
+ string hostname = Kernel_Utils::GetHostname();
CORBA::Object_var temp = _NS->Resolve(component_registerName.c_str());
Engines::Component_var obj_proxy = Engines::Component::_narrow(temp);
void ActSigIntHandler()
{
-#ifndef WNT
+#ifndef WIN32
struct sigaction SigIntAct ;
SigIntAct.sa_sigaction = &SigIntHandler ;
SigIntAct.sa_flags = SA_SIGINFO ;
// (SIGINT | SIGUSR1) :
// it must be only one signal ===> one call for SIGINT
// and an other one for SIGUSR1
-#ifndef WNT
+#ifndef WIN32
if ( sigaction( SIGINT , &SigIntAct, NULL ) ) {
perror("SALOME_Container main ") ;
exit(0) ;
void SetCpuUsed() ;
-#ifndef WNT
+#ifndef WIN32
void SigIntHandler(int what , siginfo_t * siginfo ,
void * toto ) {
//PAL9042 JR : during the execution of a Signal Handler (and of methods called through Signal Handlers)
return ;
}
}
-#else // Case WNT
+#else // Case WIN32
void SigIntHandler( int what ) {
MESSAGE( pthread_self() << "SigIntHandler what " << what << endl );
if ( _Sleeping ) {
#include <iostream>
#include <signal.h>
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include <sys/types.h>
class SALOME_NamingService;
-
-#if defined CONTAINER_EXPORTS
-#if defined WIN32
-#define CONTAINER_EXPORT __declspec( dllexport )
-#else
-#define CONTAINER_EXPORT
-#endif
+#ifdef WIN32
+# ifdef CONTAINER_EXPORTS
+# define CONTAINER_EXPORT __declspec( dllexport )
+# else
+# define CONTAINER_EXPORT __declspec( dllimport )
+# endif
#else
-#if defined WNT
-#define CONTAINER_EXPORT __declspec( dllimport )
-#else
-#define CONTAINER_EXPORT
-#endif
+# define CONTAINER_EXPORT
#endif
class CONTAINER_EXPORT Engines_Parallel_Container_i:
_VarComponents->remove( _Id ) ;
}
_Id = 0 ;
-#ifndef WNT
+#ifndef WIN32
delete [] _Ior;
#else
delete [] (char*) _Ior;
# include <time.h>
}
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <process.h>
_Compteur = -1 ;
if ( _SessionName )
{
-#ifndef WNT
+#ifndef WIN32
delete [] _SessionName ;
#else
delete [] (char*)_SessionName ;
return (CORBA::ULong)_Compteur ;
}
-#ifndef WNT
+#ifndef WIN32
void RegistryService::remove( const CORBA::ULong id)
#else
void RegistryService::remove( CORBA::ULong id)
}
-#ifndef WNT
+#ifndef WIN32
void RegistryService::hello( const CORBA::ULong id )
#else
void RegistryService::hello( CORBA::ULong id )
}
void RegistryService::ping()
{
-#ifndef WNT
+#ifndef WIN32
MESSAGE(" RegistryService::ping() pid "<< getpid());
#else
MESSAGE(" RegistryService::ping() pid "<< _getpid());
CORBA::Long getPID();
virtual CORBA::ULong add (const Registry::Infos & infos);
virtual CORBA::ULong size ( void );
-#ifndef WNT
+#ifndef WIN32
virtual void remove( const CORBA::ULong id );
virtual void hello( const CORBA::ULong id );
#else
#ifndef _SALOME_Registry_HXX_
#define _SALOME_Registry_HXX_
-#ifdef WNT
- #if defined REGISTRY_EXPORTS
- #if defined WIN32
- #define REGISTRY_EXPORT __declspec( dllexport )
- #else
- #define REGISTRY_EXPORT
- #endif
- #else
- #if defined WIN32
- #define REGISTRY_EXPORT __declspec( dllimport )
- #else
- #define REGISTRY_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef REGISTRY_EXPORTS
+# define REGISTRY_EXPORT __declspec( dllexport )
+# else
+# define REGISTRY_EXPORT __declspec( dllimport )
+# endif
#else
- #define REGISTRY_EXPORT
+# define REGISTRY_EXPORT
#endif
#endif
for (int i = 1; i<=NumberOfTries; i++)
{
if (i!=1)
-#ifndef WNT
+#ifndef WIN32
a=nanosleep(&ts_req,&ts_rem);
#else
Sleep(TIMESleep/1000000);
for(int j=1; j<=NumberOfTries; j++)
{
if (j!=1)
-#ifndef WNT
+#ifndef WIN32
a=nanosleep(&ts_req, &ts_rem);
#else
Sleep(TIMESleep/1000000);
SALOME_ResourcesManager.hxx \
SALOME_ResourcesCatalog_Handler.hxx \
SALOME_LoadRateManager.hxx \
- ResourcesManager.hxx
+ ResourcesManager.hxx \
+ ResourcesManager_Defs.hxx
#
# ===============================================================
COMMON_LIBS =\
../NamingService/libSalomeNS.la \
../Utils/libOpUtil.la \
+ ../Basics/libSALOMEBasics.la \
$(top_builddir)/idl/libSalomeIDLKernel.la \
@LIBXML_LIBS@
libResourcesManager_la_CPPFLAGS =\
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
+ -I$(srcdir)/../Utils \
@LIBXML_INCLUDES@
libResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0
libResourcesManager_la_LIBADD =\
+ ../Utils/libOpUtil.la \
@LIBXML_LIBS@
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "ResourcesManager.hxx"
+#include <Basics_Utils.hxx>
#include <fstream>
#include <iostream>
#include <sstream>
#include <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
#include <libxml/parser.h>
-#include "utilities.h"
+#include <algorithm>
#define MAX_SIZE_FOR_HOSTNAME 256;
ResourcesManager_cpp(const char *xmlFilePath) :
_path_resources(xmlFilePath)
{
- MESSAGE ( "ResourcesManager_cpp constructor" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "ResourcesManager_cpp constructor" << endl;
+#endif
}
//=============================================================================
ResourcesManager_cpp::ResourcesManager_cpp()
{
- MESSAGE ( "ResourcesManager_cpp constructor" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "ResourcesManager_cpp constructor" << endl;
+#endif
_isAppliSalomeDefined = (getenv("APPLI") != 0);
if (_isAppliSalomeDefined)
}
ParseXmlFile();
- MESSAGE ( "ResourcesManager_cpp constructor end" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "ResourcesManager_cpp constructor end";
+#endif
}
//=============================================================================
ResourcesManager_cpp::~ResourcesManager_cpp()
{
- MESSAGE ( "ResourcesManager_cpp destructor" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "ResourcesManager_cpp destructor" << endl;
+#endif
}
//=============================================================================
ResourcesManager_cpp::GetFittingResources(const machineParams& params,
const std::vector<std::string>& componentList) throw(ResourcesException)
{
+//#if defined(_DEBUG_) || defined(_DEBUG)
// cerr << "ResourcesManager_cpp::GetFittingResources" << endl;
+//#endif
vector <std::string> vec;
ParseXmlFile();
const char *hostname = params.hostname.c_str();
- MESSAGE ( "GetFittingResources " << hostname << " " << GetHostname().c_str() );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "GetFittingResources " << hostname << " " << Kernel_Utils::GetHostname().c_str() << endl;
+#endif
if (hostname[0] != '\0'){
- // cerr << "ResourcesManager_cpp::GetFittingResources : hostname specified" << endl;
+//#if defined(_DEBUG_) || defined(_DEBUG)
+// cerr << "ResourcesManager_cpp::GetFittingResources : hostname specified" << endl;
+//#endif
if ( strcmp(hostname, "localhost") == 0 ||
- strcmp(hostname, GetHostname().c_str()) == 0 )
+ strcmp(hostname, Kernel_Utils::GetHostname().c_str()) == 0 )
{
- // cerr << "ResourcesManager_cpp::GetFittingResources : localhost" << endl;
- vec.push_back(GetHostname().c_str());
- // cerr << "ResourcesManager_cpp::GetFittingResources : " << vec.size() << endl;
+//#if defined(_DEBUG_) || defined(_DEBUG)
+// cerr << "ResourcesManager_cpp::GetFittingResources : localhost" << endl;
+//#endif
+ vec.push_back(Kernel_Utils::GetHostname().c_str());
+//#if defined(_DEBUG_) || defined(_DEBUG)
+// cerr << "ResourcesManager_cpp::GetFittingResources : " << vec.size() << endl;
+//#endif
}
else if (_resourcesList.find(hostname) != _resourcesList.end())
if( (*iter).second.DataForSort._nbOfNodes > 1 ){
if( strncmp(hostname,(*iter).first.c_str(),strlen(hostname)) == 0 ){
vec.push_back((*iter).first.c_str());
- //cerr << "SALOME_ResourcesManager_cpp::GetFittingResources vector["
- // << cpt << "] = " << (*iter).first.c_str() << endl ;
+//#if defined(_DEBUG_) || defined(_DEBUG)
+// cerr << "SALOME_ResourcesManager_cpp::GetFittingResources vector["
+// << cpt << "] = " << (*iter).first.c_str() << endl ;
+//#endif
cpt++;
}
}
}
if(cpt==0){
// --- user specified an unknown hostame so notify him.
- MESSAGE ( "ResourcesManager_cpp::GetFittingResources : SALOME_Exception" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "ResourcesManager_cpp::GetFittingResources : SALOME_Exception" << endl;
+#endif
throw ResourcesException("unknown host");
}
}
if (aFile == NULL)
{
- INFOS ( "Error opening file !" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "Error opening file !" << endl;
+#endif
return;
}
handler->PrepareDocToXmlFile(aDoc);
delete handler;
+#if defined(_DEBUG_) || defined(_DEBUG)
int isOk = xmlSaveFile(aFilePath, aDoc);
-
- if (!isOk)
- INFOS ( "Error while XML file saving." );
+ if (!isOk) cerr << "Error while XML file saving." << endl;
+#else
+ xmlSaveFile(aFilePath, aDoc);
+#endif
// Free the document
xmlFreeDoc(aDoc);
fclose(aFile);
- INFOS ( "WRITING DONE!" );
+#if defined(_DEBUG_) || defined(_DEBUG)
+ cerr << "WRITING DONE!" << endl;
+#endif
}
//=============================================================================
if (aDoc != NULL)
handler->ProcessXmlDocument(aDoc);
+#if defined(_DEBUG_) || defined(_DEBUG)
else
- INFOS ( "ResourcesManager_cpp: could not parse file "<< aFilePath );
+ cerr << "ResourcesManager_cpp: could not parse file "<< aFilePath << endl;
+#endif
// Free the document
xmlFreeDoc(aDoc);
fclose(aFile);
}
+#if defined(_DEBUG_) || defined(_DEBUG)
else
- INFOS ( "ResourcesManager_cpp: file "<<aFilePath<<" is not readable." );
+ cerr << "ResourcesManager_cpp: file "<<aFilePath<<" is not readable." << endl;
+#endif
delete handler;
bool erasedHost = false;
if( mapOfModulesOfCurrentHost.size() > 0 ){
- for(int i=0;i<componentList.size();i++){
+ for(unsigned int i=0;i<componentList.size();i++){
const char* compoi = componentList[i].c_str();
vector<string>::const_iterator itt = find(mapOfModulesOfCurrentHost.begin(),
mapOfModulesOfCurrentHost.end(),
else
return _resourcesBatchList[machine];
}
-
-std::string ResourcesManager_cpp::GetHostname()
-{
- int ls = 100, r = 1;
- char *s;
-
- while (ls < 10000 && r) {
- ls *= 2;
- s = new char[ls];
- r = gethostname(s, ls-1);
- switch (r)
- {
- case 0:
- break;
- default:
-#ifdef EINVAL
- case EINVAL:
-#endif
-#ifdef ENAMETOOLONG
- case ENAMETOOLONG:
-#endif
- delete [] s;
- continue;
- }
- }
-
- if (r != 0) {
- s = new char[50];
- strcpy(s, "localhost");
- }
-
- // remove all after '.'
- char *aDot = (strchr(s,'.'));
- if (aDot) aDot[0] = '\0';
-
- string p = s;
- delete [] s;
- return p;
-}
-
#ifndef __RESOURCESMANAGER_HXX__
#define __RESOURCESMANAGER_HXX__
+#include "ResourcesManager_Defs.hxx"
+
#include <string>
#include <fstream>
#include <vector>
unsigned int mem_mb;
};
-class ResourcesException
+class RESOURCESMANAGER_EXPORT ResourcesException
{
public:
const std::string msg;
ResourcesException(const std::string m) : msg(m) {}
};
-class ResourcesManager_cpp
+class RESOURCESMANAGER_EXPORT ResourcesManager_cpp
{
public:
SALOME_LoadRateManager _dynamicResourcesSelecter;
//! different behaviour if $APPLI exists (SALOME Application)
- bool _isAppliSalomeDefined;
-
- std::string GetHostname();
+ bool _isAppliSalomeDefined;
};
#endif // __RESOURCESMANAGER_HXX__
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef __RESOURCESMANAGER_DEFS_HXX__
+#define __RESOURCESMANAGER_DEFS_HXX__
+
+#ifdef WIN32
+# ifdef RESOURCESMANAGER_EXPORTS
+# define RESOURCESMANAGER_EXPORT __declspec( dllexport )
+# else
+# define RESOURCESMANAGER_EXPORT __declspec( dllimport )
+# endif
+#else
+# define RESOURCESMANAGER_EXPORT
+#endif
+
+#endif // __RESOURCESMANAGER_DEFS_HXX__
#ifndef __SALOME_LOADRATEMANAGER_HXX__
#define __SALOME_LOADRATEMANAGER_HXX__
+#include "ResourcesManager_Defs.hxx"
#include <string>
#include "SALOME_ResourcesCatalog_Parser.hxx"
-#if defined RESOURCESMANAGER_EXPORTS
-#if defined WIN32
-#define RESOURCESMANAGER_EXPORT __declspec( dllexport )
-#else
-#define RESOURCESMANAGER_EXPORT
-#endif
-#else
-#if defined WNT
-#define RESOURCESMANAGER_EXPORT __declspec( dllimport )
-#else
-#define RESOURCESMANAGER_EXPORT
-#endif
-#endif
-
class RESOURCESMANAGER_EXPORT SALOME_LoadRateManager
{
//$Header$
#include "SALOME_ResourcesCatalog_Handler.hxx"
+#include "Basics_Utils.hxx"
#include <iostream>
#include <map>
_resource.HostName = nodeName ;
_resources_list[nodeName] = _resource;
}
- }
- else
- _resources_list[_resource.HostName] = _resource;
- }
- else
- _resources_batch_list[_resource.HostName] = _resource;
- }
+ }
+ else
+ {
+ _resources_list[_resource.HostName] = _resource;
+ if(_resource.HostName == "localhost")
+ _resources_list[Kernel_Utils::GetHostname()] = _resource;
+ }
+ }
+ else
+ _resources_batch_list[_resource.HostName] = _resource;
+ }
aCurNode = aCurNode->next;
}
#ifndef SALOME_RESOURCES_CATALOG_HANDLER
#define SALOME_RESOURCES_CATALOG_HANDLER
+
+#include "ResourcesManager_Defs.hxx"
+
#include "SALOME_ResourcesCatalog_Parser.hxx"
#include <string>
#include <libxml/parser.h>
-class SALOME_ResourcesCatalog_Handler
+class RESOURCESMANAGER_EXPORT SALOME_ResourcesCatalog_Handler
{
public :
#ifndef SALOME_RESOURCES_CATALOG_PARSER
#define SALOME_RESOURCES_CATALOG_PARSER
+#include "ResourcesManager_Defs.hxx"
+
#include <string>
#include <vector>
#include <map>
enum MpiImplType {indif, lam, mpich1, mpich2, openmpi, slurm};
-class ResourceDataToSort
+class RESOURCESMANAGER_EXPORT ResourceDataToSort
{
public:
unsigned int GetNumberOfPoints() const;
};
-struct ParserResourcesType
+struct RESOURCESMANAGER_EXPORT ParserResourcesType
{
ResourceDataToSort DataForSort;
std::string HostName;
#include "OpUtil.hxx"
#include <stdlib.h>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#else
#include <io.h>
p.mem_mb = params.mem_mb;
vector<string> cl;
- for(int i=0;i<componentList.length();i++)
+ for(unsigned int i=0;i<componentList.length();i++)
cl.push_back(string(componentList[i]));
Engines::MachineList *ret=new Engines::MachineList;
try{
vector <std::string> vec = _rm.GetFittingResources(p,cl);
ret->length(vec.size());
- for(int i=0;i<vec.size();i++)
+ for(unsigned int i=0;i<vec.size();i++)
(*ret)[i] = (vec[i]).c_str();
}
catch(const ResourcesException &ex){
SALOME_ResourcesManager::FindFirst(const Engines::MachineList& listOfMachines)
{
vector<string> ml;
- for(int i=0;i<listOfMachines.length();i++)
+ for(unsigned int i=0;i<listOfMachines.length();i++)
ml.push_back(string(listOfMachines[i]));
return CORBA::string_dup(_rm.FindFirst(ml).c_str());
p_ptr->username = CORBA::string_dup(resource.UserName.c_str());
p_ptr->applipath = CORBA::string_dup(resource.AppliPath.c_str());
p_ptr->modList.length(resource.ModulesList.size());
- for(int i=0;i<resource.ModulesList.size();i++)
+ for(unsigned int i=0;i<resource.ModulesList.size();i++)
p_ptr->modList[i] = CORBA::string_dup(resource.ModulesList[i].c_str());
p_ptr->OS = CORBA::string_dup(resource.OS.c_str());
p_ptr->mem_mb = resource.DataForSort._memInMB;
p_ptr->cpu_clock = resource.DataForSort._CPUFreqMHz;
p_ptr->nb_proc_per_node = resource.DataForSort._nbOfProcPerNode;
p_ptr->nb_node = resource.DataForSort._nbOfNodes;
+
if( resource.mpi == indif )
p_ptr->mpiImpl = "indif";
else if( resource.mpi == lam )
p_ptr->mpiImpl = "openmpi";
else if( resource.mpi == slurm )
p_ptr->mpiImpl = "slurm";
+
+ p_ptr->isMPI=false;
+ if(resource.mpi != indif )
+ p_ptr->isMPI=true;
+
if( resource.Batch == pbs )
p_ptr->batch = "pbs";
else if( resource.Batch == lsf )
p_ptr->batch = "lsf";
+ p_ptr->nb_component_nodes=1;
+
return p_ptr;
}
#include <vector>
#include "ResourcesManager.hxx"
-#if defined RESOURCESMANAGER_EXPORTS
-#if defined WIN32
-#define RESOURCESMANAGER_EXPORT __declspec( dllexport )
-#else
-#define RESOURCESMANAGER_EXPORT
-#endif
-#else
-#if defined WNT
-#define RESOURCESMANAGER_EXPORT __declspec( dllimport )
+
+#ifdef WIN32
+# ifdef SALOMERESOURCESMANAGER_EXPORTS
+# define SALOMERESOURCESMANAGER_EXPORT __declspec( dllexport )
+# else
+# define SALOMERESOURCESMANAGER_EXPORT __declspec( dllimport )
+# endif
#else
-#define RESOURCESMANAGER_EXPORT
-#endif
+# define SALOMERESOURCESMANAGER_EXPORT
#endif
// --- WARNING ---
// Only one thread should use the SALOME_ResourcesManager class in a SALOME
// session.
-class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager:
+class SALOMERESOURCESMANAGER_EXPORT SALOME_ResourcesManager:
public POA_Engines::ResourcesManager,
public PortableServer::RefCountServantBase
{
SALOMEDS_Server_SOURCES = SALOMEDS_Server.cxx
SALOMEDS_Server_CPPFLAGS = $(COMMON_CPPFLAGS)
SALOMEDS_Server_LDADD = libSalomeDS.la \
- $(HDF5_LIBS) $(CORBA_LIBS)
+ ../Basics/libSALOMEBasics.la \
+ $(HDF5_LIBS) \
+ $(CORBA_LIBS)
SALOMEDS_Client_SOURCES = SALOMEDS_Client.cxx
SALOMEDS_Client_CPPFLAGS = $(COMMON_CPPFLAGS)
SALOMEDS_Client_LDADD = libSalomeDS.la \
- $(HDF5_LIBS) $(CORBA_LIBS)
+ ../Basics/libSALOMEBasics.la \
+ $(HDF5_LIBS) \
+ $(CORBA_LIBS)
// Module : SALOME
// $Header$
-#ifdef WNT
-#include <SALOMEDS.hxx>
-#include <SALOMEDS_StudyManager.hxx>
-#include <SALOMEDS_Study.hxx>
-#include <SALOMEDS_SObject.hxx>
-#include <SALOMEDS_StudyBuilder.hxx>
-#include <SALOMEDS_SComponent.hxx>
-#include <SALOMEDSClient.hxx>
-#include <SALOMEDSClient_IParameters.hxx>
-#include <SALOMEDS_IParameters.hxx>
-#include <SALOMEDS_StudyManager_i.hxx>
-#else
#include "SALOMEDS.hxx"
#include "SALOMEDS_StudyManager.hxx"
#include "SALOMEDS_Study.hxx"
#include "SALOMEDSClient_IParameters.hxx"
#include "SALOMEDS_IParameters.hxx"
#include "SALOMEDS_StudyManager_i.hxx"
-#endif
#include "SALOMEDS_Defines.hxx"
SALOMEDS::Locker lock;
aName = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetCreatorName();
}
-#ifndef WNT
+#ifndef WIN32
else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName();
#else
else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserNameA();
SALOMEDS::Locker lock;
SALOMEDS_AttributeTreeNode_i* aFather;
aFather = new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetFather(), _orb);
-#ifndef WNT
+#ifndef WIN32
return aFather->POA_SALOMEDS::AttributeTreeNode::_this();
#else
return aFather->AttributeTreeNode::_this();
SALOMEDS::Locker lock;
SALOMEDS_AttributeTreeNode_i* aPrevious;
aPrevious=new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetPrevious(), _orb);
-#ifndef WNT
+#ifndef WIN32
return aPrevious->POA_SALOMEDS::AttributeTreeNode::_this();
#else
return aPrevious->AttributeTreeNode::_this();
SALOMEDS::Locker lock;
SALOMEDS_AttributeTreeNode_i* aNext;
aNext = new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetNext(), _orb);
-#ifndef WNT
+#ifndef WIN32
return aNext->POA_SALOMEDS::AttributeTreeNode::_this();
#else
return aNext->AttributeTreeNode::_this();
SALOMEDS::Locker lock;
SALOMEDS_AttributeTreeNode_i* aFirst;
aFirst = new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetFirst(), _orb);
-#ifndef WNT
+#ifndef WIN32
return aFirst->POA_SALOMEDS::AttributeTreeNode::_this();
#else
return aFirst->AttributeTreeNode::_this();
#ifndef _SALOMEDS_Defines_HXX_
#define _SALOMEDS_Defines_HXX_
-#ifdef WNT
- #if defined SALOMEDS_EXPORTS
- #if defined WIN32
- #define SALOMEDS_EXPORT __declspec( dllexport )
- #else
- #define SALOMEDS_EXPORT
- #endif
- #else
- #if defined WIN32
- #define SALOMEDS_EXPORT __declspec( dllimport )
- #else
- #define SALOMEDS_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef SALOMEDS_EXPORTS
+# define SALOMEDS_EXPORT __declspec( dllexport )
+# else
+# define SALOMEDS_EXPORT __declspec( dllimport )
+# endif
#else
- #define SALOMEDS_EXPORT
+# define SALOMEDS_EXPORT
#endif
#endif
#include "SALOMEDS_ClientAttributes.hxx"
#include "SALOMEDS.hxx"
+#include "Basics_Utils.hxx"
+
#ifdef WIN32
#include <process.h>
#else
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
using namespace std;
SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDSImpl_GenericAttribute* theGA)
long pid = (long)getpid();
#endif
- CORBA::LongLong addr = theGA->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ CORBA::LongLong addr = theGA->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
if(_isLocal) {
_local_impl = reinterpret_cast<SALOMEDSImpl_GenericAttribute*>(addr);
_corba_impl = SALOMEDS::GenericAttribute::_nil();
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_Study.hxx"
#include "Utils_ExceptHandlers.hxx"
+#include "Basics_Utils.hxx"
#include <map>
#ifdef WIN32
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
using namespace std;
UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection);
{
SALOMEDS::Locker lock;
if (_impl) {
- return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetType(_impl));
+ string type = SALOMEDSImpl_GenericAttribute::Impl_GetType(_impl);
+ return CORBA::string_dup(type.c_str());
}
return (char*)"";
{
SALOMEDS::Locker lock;
if (_impl) {
- return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetClassType(_impl));
+ string class_type = SALOMEDSImpl_GenericAttribute::Impl_GetClassType(_impl);
+ return CORBA::string_dup(class_type.c_str());
}
return (char*)"";
#else
long pid = (long)getpid();
#endif
- isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
+ isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0;
return reinterpret_cast<CORBA::LongLong>(_impl);
}
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
+#include "Basics_Utils.hxx"
+
+#include "utilities.h"
+
#ifdef WIN32
#include <windows.h>
#include <process.h>
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-#include "utilities.h"
+
using namespace std;
#endif
CORBA::LongLong addr = // mpv: fix for IPAL13534: for 64-bit platforms use 8-bytes long for pointer storage
- theSObject->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ theSObject->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
if(_isLocal) {
_local_impl = reinterpret_cast<SALOMEDSImpl_SObject*>(addr);
#include "SALOMEDSImpl_SComponent.hxx"
#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDSImpl_AttributeIOR.hxx"
+#include "Basics_Utils.hxx"
#include <map>
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
using namespace std;
SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const SALOMEDSImpl_SObject& theImpl, CORBA::ORB_ptr theORB)
#else
long pid = (long)getpid();
#endif
- isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
+ isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0;
return reinterpret_cast<CORBA::LongLong>(_impl);
}
for (int i = 1; i<=NumberOfTries; i++)
{
if (i!=1)
-#ifndef WNT
+#ifndef WIN32
a=nanosleep(&ts_req,&ts_rem);
#else
Sleep(TIMESleep/1000000);
for(int j=1; j<=NumberOfTries; j++)
{
if (j!=1)
-#ifndef WNT
+#ifndef WIN32
a=nanosleep(&ts_req, &ts_rem);
#else
Sleep(TIMESleep/1000000);
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
+#include "Basics_Utils.hxx"
+
#ifdef WIN32
#include <process.h>
#else
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
using namespace std;
SALOMEDS_Study::SALOMEDS_Study(SALOMEDSImpl_Study* theStudy)
long pid = (long)getpid();
#endif
- long addr = theStudy->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ long addr = theStudy->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
if(_isLocal) {
_local_impl = reinterpret_cast<SALOMEDSImpl_Study*>(addr);
_corba_impl = SALOMEDS::Study::_duplicate(theStudy);
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
+#include "Basics_Utils.hxx"
+
#ifdef WIN32
#include <process.h>
#else
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
using namespace std;
SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb);
long pid = (long)getpid();
#endif
- CORBA::LongLong addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ CORBA::LongLong addr = theManager->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
if(_isLocal) {
_local_impl = reinterpret_cast<SALOMEDSImpl_StudyManager*>(addr);
_corba_impl = SALOMEDS::StudyManager::_duplicate(theManager);
long pid = (long)getpid();
#endif
- CORBA::LongLong addr = theManager->GetLocalImpl(GetHostname().c_str(), pid, _isLocal);
+ CORBA::LongLong addr = theManager->GetLocalImpl(Kernel_Utils::GetHostname().c_str(), pid, _isLocal);
if(_isLocal) {
_local_impl = reinterpret_cast<SALOMEDSImpl_StudyManager*>(addr);
_corba_impl = SALOMEDS::StudyManager::_duplicate(theManager);
#include "SALOMEDSImpl_AttributeIOR.hxx"
#include "Utils_CorbaException.hxx"
+#include "Utils_ExceptHandlers.hxx"
+#include "Basics_Utils.hxx"
+#include "SALOME_GenericObj_i.hh"
#include <strstream>
#include <vector>
#include <map>
-using namespace std;
#ifdef WIN32
#include <process.h>
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
-#include "SALOME_GenericObj_i.hh"
-
-#include "Utils_ExceptHandlers.hxx"
+using namespace std;
UNEXPECT_CATCH(SalomeException,SALOME::SALOME_Exception);
UNEXPECT_CATCH(LockProtection, SALOMEDS::StudyBuilder::LockProtection);
SALOMEDSImpl_Study* aStudyImpl = _impl->Open(string(aUrl));
+ if ( !aStudyImpl )
+ THROW_SALOME_CORBA_EXCEPTION("Impossible to Open study from file", SALOME::BAD_PARAM)
+
MESSAGE("Open : Creating the CORBA servant holding it... ");
// Temporary aStudyUrl in place of study name
#else
long pid = (long)getpid();
#endif
- isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
+ isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0;
return reinterpret_cast<CORBA::LongLong>(_impl);
}
// std C++ headers
#include <iostream>
-#ifndef WNT
+#ifndef WIN32
#include <unistd.h>
#endif
#include "DF_Label.hxx"
#include "DF_Attribute.hxx"
+#include "Basics_Utils.hxx"
+
#ifdef WIN32
#include <process.h>
#else
#include <unistd.h>
#endif
-#include "OpUtil.hxx"
-
using namespace std;
//============================================================================
* Purpose :
*/
//============================================================================
-#ifndef WNT
+#ifndef WIN32
void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long /*theUndoLimit*/)
#else
void SALOMEDS_Study_i::RemovePostponed(CORBA::Long /*theUndoLimit*/)
* Purpose :
*/
//============================================================================
-#ifndef WNT
+#ifndef WIN32
void SALOMEDS_Study_i::UndoPostponed(const CORBA::Long theWay)
#else
void SALOMEDS_Study_i::UndoPostponed(CORBA::Long theWay)
#else
long pid = (long)getpid();
#endif
- isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
+ isLocal = (strcmp(theHostname, Kernel_Utils::GetHostname().c_str()) == 0 && pid == thePID)?1:0;
return reinterpret_cast<CORBA::LongLong>(_impl);
}
virtual void AddCreatedPostponed(const char* theIOR);
-#ifndef WNT
+#ifndef WIN32
virtual void RemovePostponed(const CORBA::Long theUndoLimit); // removes postponed IORs of old transaction
// if theUndoLimit==0, removes all
virtual void UndoPostponed(const CORBA::Long theWay); // theWay = 1: resurrect objects,
dist_TestSALOMEDS_SOURCES = TestSALOMEDS.cxx
TestSALOMEDS_CPPFLAGS = $(COMMON_CPPFLAGS)
TestSALOMEDS_LDADD = libSALOMEDSTest.la \
+ $(RPATH)/Basics/libSALOMEBasics.la \
$(CORBA_LIBS)
#include "utilities.h"
#include "Utils_SINGLETON.hxx"
#include "Utils_ORB_INIT.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include "SALOME_NamingService.hxx"
#include "NamingService_WaitForServerReadiness.hxx"
#include "SALOMEDS_StudyManager_i.hxx"
+using namespace std;
+
// ============================================================================
/*!
* Main program source for Unit Tests with cppunit package does not depend
sleep(15);
- string host; // = GetHostname();
+ string host; // = Kernel_Utils::GetHostname();
char* wait_Superv = getenv("SALOMEDS_UNITTESTS_WAIT_SUPERVISOR");
- if(wait_Superv) host = GetHostname();
+ if(wait_Superv) host = Kernel_Utils::GetHostname();
SALOME_NamingService NS(orb);
if(host.empty())
SALOMEDSImpl_Study.hxx \
SALOMEDSImpl_StudyManager.hxx \
SALOMEDSImpl_ChildNodeIterator.hxx \
+ SALOMEDSImpl_Defines.hxx \
SALOMEDSImpl_IParameters.hxx \
SALOMEDSImpl_TMPFile.hxx
SALOMEDSImpl_Callback.hxx \
SALOMEDSImpl_ChildIterator.hxx \
SALOMEDSImpl_ChildNodeIterator.hxx \
+ SALOMEDSImpl_Defines.hxx \
SALOMEDSImpl_Driver.hxx \
SALOMEDSImpl_GenericAttribute.hxx \
SALOMEDSImpl_SComponent.hxx \
#include "SALOMEDSImpl_AttributeComment.hxx"
-#ifndef WNT
using namespace std;
-#endif
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const std::string& SALOMEDSImpl_AttributeComment::GetID ()
+const string& SALOMEDSImpl_AttributeComment::GetID ()
{
- static std::string CommentID ("7AF2F7CC-1CA2-4476-BE95-8ACC996BC7B9");
+ static string CommentID ("7AF2F7CC-1CA2-4476-BE95-8ACC996BC7B9");
return CommentID;
}
SALOMEDSImpl_AttributeComment* SALOMEDSImpl_AttributeComment::Set (const DF_Label& L,
- const std::string& Val)
+ const string& Val)
{
SALOMEDSImpl_AttributeComment* A = NULL;
if (!(A=(SALOMEDSImpl_AttributeComment*)L.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) {
//function : ID
//purpose :
//=======================================================================
-const std::string& SALOMEDSImpl_AttributeComment::ID () const { return GetID(); }
+const string& SALOMEDSImpl_AttributeComment::ID () const { return GetID(); }
//=======================================================================
//function : NewEmpty
#ifndef _SALOMEDSImpl_AttributeComment_HeaderFile
#define _SALOMEDSImpl_AttributeComment_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
-#include "SALOMEDSImpl_GenericAttribute.hxx"
#include <string>
-class SALOMEDSImpl_AttributeComment : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeComment :
+ public SALOMEDSImpl_GenericAttribute
{
private:
- std::string myString;
+ std::string myString;
public:
-Standard_EXPORT static const std::string& GetID() ;
+ static const std::string& GetID() ;
-Standard_EXPORT SALOMEDSImpl_AttributeComment() :SALOMEDSImpl_GenericAttribute("AttributeComment") {}
+ SALOMEDSImpl_AttributeComment() :SALOMEDSImpl_GenericAttribute("AttributeComment") {}
-Standard_EXPORT static SALOMEDSImpl_AttributeComment* Set(const DF_Label& L, const std::string& Val);
-Standard_EXPORT void SetValue (const std::string& S);
-Standard_EXPORT std::string Value() const { return myString; }
+ static SALOMEDSImpl_AttributeComment* Set(const DF_Label& L, const std::string& Val);
+ void SetValue (const std::string& S);
+ std::string Value() const { return myString; }
-Standard_EXPORT virtual std::string Save() { return myString; }
-Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
+ virtual std::string Save() { return myString; }
+ virtual void Load(const std::string& theValue) { myString = theValue; }
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeComment() {}
+ ~SALOMEDSImpl_AttributeComment() {}
};
#include "SALOMEDSImpl_AttributeDrawable.hxx"
-#ifndef WNT
using namespace std;
-#endif
//=======================================================================
//function : GetID
#ifndef _SALOMEDSImpl_AttributeDrawable_HeaderFile
#define _SALOMEDSImpl_AttributeDrawable_HeaderFile
+#include "SALOMEDSImpl_GenericAttribute.hxx"
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
-#include <string>
#include "DF_Label.hxx"
-#include "SALOMEDSImpl_GenericAttribute.hxx"
-
-class SALOMEDSImpl_AttributeDrawable : public SALOMEDSImpl_GenericAttribute
+#include <string>
+
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeDrawable :
+ public SALOMEDSImpl_GenericAttribute
{
private:
-int myValue;
+ int myValue;
public:
-Standard_EXPORT virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
-Standard_EXPORT virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; }
-
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeDrawable* Set(const DF_Label& label,const int value) ;
-
-Standard_EXPORT void SetDrawable(const int theValue);
-Standard_EXPORT int IsDrawable() const { return myValue; }
-Standard_EXPORT SALOMEDSImpl_AttributeDrawable();
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeDrawable() {}
+ virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
+ virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeDrawable* Set(const DF_Label& label,const int value) ;
+
+ void SetDrawable(const int theValue);
+ int IsDrawable() const { return myValue; }
+ SALOMEDSImpl_AttributeDrawable();
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeDrawable() {}
};
#include "SALOMEDSImpl_AttributeExpandable.hxx"
-#ifndef WNT
using namespace std;
-#endif
//=======================================================================
//function : GetID
#ifndef _SALOMEDSImpl_AttributeExpandable_HeaderFile
#define _SALOMEDSImpl_AttributeExpandable_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
-#include <string>
-#include "SALOMEDSImpl_GenericAttribute.hxx"
+#include <string>
-class SALOMEDSImpl_AttributeExpandable : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeExpandable :
+ public SALOMEDSImpl_GenericAttribute
{
private:
-int myValue;
+ int myValue;
public:
-Standard_EXPORT virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
-Standard_EXPORT virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; }
-
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeExpandable* Set(const DF_Label& label,const int value) ;
-Standard_EXPORT SALOMEDSImpl_AttributeExpandable();
-Standard_EXPORT void SetExpandable(const int value);
-Standard_EXPORT int IsExpandable() const { return myValue; }
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeExpandable() {}
+ virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
+ virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeExpandable* Set(const DF_Label& label,const int value) ;
+ SALOMEDSImpl_AttributeExpandable();
+ void SetExpandable(const int value);
+ int IsExpandable() const { return myValue; }
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeExpandable() {}
};
#ifndef _SALOMEDSImpl_AttributeExternalFileDef_HeaderFile
#define _SALOMEDSImpl_AttributeExternalFileDef_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <string>
-#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeExternalFileDef : public SALOMEDSImpl_GenericAttribute
+
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeExternalFileDef :
+ public SALOMEDSImpl_GenericAttribute
{
private:
- std::string myString;
+ std::string myString;
public:
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeExternalFileDef* Set(const DF_Label& label,
- const std::string& Name);
-Standard_EXPORT SALOMEDSImpl_AttributeExternalFileDef();
-Standard_EXPORT void SetValue(const std::string& value);
-Standard_EXPORT std::string Value() const { return myString; }
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeExternalFileDef() {}
-
-Standard_EXPORT virtual std::string Save() { return myString; }
-Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeExternalFileDef* Set(const DF_Label& label,
+ const std::string& Name);
+ SALOMEDSImpl_AttributeExternalFileDef();
+ void SetValue(const std::string& value);
+ std::string Value() const { return myString; }
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeExternalFileDef() {}
+
+ virtual std::string Save() { return myString; }
+ virtual void Load(const std::string& theValue) { myString = theValue; }
};
#ifndef _SALOMEDSImpl_AttributeFileType_HeaderFile
#define _SALOMEDSImpl_AttributeFileType_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <string>
-#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeFileType : public SALOMEDSImpl_GenericAttribute
+
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeFileType :
+ public SALOMEDSImpl_GenericAttribute
{
private:
- std::string myString;
+ std::string myString;
public:
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeFileType* Set(const DF_Label& label,
- const std::string& Name) ;
-Standard_EXPORT SALOMEDSImpl_AttributeFileType();
-Standard_EXPORT void SetValue(const std::string& value);
-Standard_EXPORT std::string Value() const { return myString; }
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeFileType() {}
-
-Standard_EXPORT virtual std::string Save() { return myString; }
-Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeFileType* Set(const DF_Label& label,
+ const std::string& Name) ;
+ SALOMEDSImpl_AttributeFileType();
+ void SetValue(const std::string& value);
+ std::string Value() const { return myString; }
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeFileType() {}
+
+ virtual std::string Save() { return myString; }
+ virtual void Load(const std::string& theValue) { myString = theValue; }
};
#ifndef SALOMEDSImpl_AttributeFlags_HeaderFile
#define SALOMEDSImpl_AttributeFlags_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
-#include "SALOMEDSImpl_GenericAttribute.hxx"
+
/*
- Class : SALOMEDSImpl_AttributeFlags
- Description : This class is intended for storing different object attributes that
- have only two states (0 and 1).
+Class : SALOMEDSImpl_AttributeFlags
+Description : This class is intended for storing different object attributes that
+have only two states (0 and 1).
*/
-#ifndef WNT
-class Standard_EXPORT SALOMEDSImpl_AttributeFlags : public SALOMEDSImpl_GenericAttribute
-#else
-class SALOMEDSImpl_AttributeFlags : public SALOMEDSImpl_GenericAttribute
-#endif
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeFlags :
+ public SALOMEDSImpl_GenericAttribute
{
private:
-int myValue;
+ int myValue;
public:
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeFlags* Set(const DF_Label&, const int theValue );
-
- SALOMEDSImpl_AttributeFlags();
-Standard_EXPORT virtual ~SALOMEDSImpl_AttributeFlags();
-
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore( DF_Attribute* with );
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste( DF_Attribute* into);
-Standard_EXPORT void Set( const int );
-Standard_EXPORT int Get() const;
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeFlags* Set(const DF_Label&, const int theValue );
+
+ SALOMEDSImpl_AttributeFlags();
+ virtual ~SALOMEDSImpl_AttributeFlags();
+
+ const std::string& ID() const;
+ void Restore( DF_Attribute* with );
+ DF_Attribute* NewEmpty() const;
+ void Paste( DF_Attribute* into);
+ void Set( const int );
+ int Get() const;
};
#ifndef SALOMEDSImpl_AttributeGraphic_HeaderFile
#define SALOMEDSImpl_AttributeGraphic_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
-#include "SALOMEDSImpl_GenericAttribute.hxx"
-
#include <map>
/*
- Class : SALOMEDSImpl_AttributeGraphic
- Description : This class is intended for storing information about
- graphic representation of objects in dirrent views
+Class : SALOMEDSImpl_AttributeGraphic
+Description : This class is intended for storing information about
+graphic representation of objects in dirrent views
*/
-#ifndef WNT
-class Standard_EXPORT SALOMEDSImpl_AttributeGraphic : public SALOMEDSImpl_GenericAttribute
-#else
-class SALOMEDSImpl_AttributeGraphic : public SALOMEDSImpl_GenericAttribute
-#endif
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeGraphic :
+ public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT SALOMEDSImpl_AttributeGraphic();
-Standard_EXPORT ~SALOMEDSImpl_AttributeGraphic();
-
-Standard_EXPORT static const std::string& GetID() ;
+ SALOMEDSImpl_AttributeGraphic();
+ ~SALOMEDSImpl_AttributeGraphic();
+
+ static const std::string& GetID() ;
+
+ void SetVisibility( const int, const bool );
+ bool GetVisibility( const int );
+ const std::string& ID() const;
+ void Restore( DF_Attribute* theWith );
+ DF_Attribute* NewEmpty() const;
+ void Paste( DF_Attribute* theInto);
-Standard_EXPORT void SetVisibility( const int, const bool );
-Standard_EXPORT bool GetVisibility( const int );
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore( DF_Attribute* theWith );
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste( DF_Attribute* theInto);
+ void SetVisibility( const std::map<int, int>& );
-Standard_EXPORT void SetVisibility( const std::map<int, int>& );
+ const std::map<int, int>& GetVisibility();
-Standard_EXPORT const std::map<int, int>& GetVisibility();
-
private:
std::map<int, int> myVisibility;
#include "SALOMEDSImpl_AttributeIOR.hxx"
#include "SALOMEDSImpl_Study.hxx"
-#ifndef WNT
using namespace std;
-#endif
//=======================================================================
//function : GetID
#ifndef _SALOMEDSImpl_AttributeIOR_HeaderFile
#define _SALOMEDSImpl_AttributeIOR_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include <string>
#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeIOR : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeIOR :
+ public SALOMEDSImpl_GenericAttribute
{
private:
- std::string myString;
+ std::string myString;
public:
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeIOR* Set(const DF_Label& label,
- const std::string& IOR);
-Standard_EXPORT SALOMEDSImpl_AttributeIOR();
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void SetValue(const std::string& theValue);
-Standard_EXPORT std::string Value() const ;
-Standard_EXPORT void Restore(DF_Attribute* with);
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeIOR() {}
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeIOR* Set(const DF_Label& label,
+ const std::string& IOR);
+ SALOMEDSImpl_AttributeIOR();
+ const std::string& ID() const;
+ void SetValue(const std::string& theValue);
+ std::string Value() const ;
+ void Restore(DF_Attribute* with);
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeIOR() {}
};
#include "SALOMEDSImpl_AttributeInteger.hxx"
-#ifndef WNT
-using namespace std;
-#endif
-
#include <stdlib.h>
+using namespace std;
//=======================================================================
//function : GetID
#ifndef _SALOMEDSImpl_AttributeInteger_HeaderFile
#define _SALOMEDSImpl_AttributeInteger_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include <string>
#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeInteger : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeInteger : public SALOMEDSImpl_GenericAttribute
{
private:
-int myValue;
+ int myValue;
public:
-Standard_EXPORT static const std::string& GetID() ;
-
-Standard_EXPORT SALOMEDSImpl_AttributeInteger():SALOMEDSImpl_GenericAttribute("AttributeInteger") {}
-Standard_EXPORT static SALOMEDSImpl_AttributeInteger* Set (const DF_Label& L, int Val);
-Standard_EXPORT void SetValue(const int theVal);
-Standard_EXPORT int Value() const;
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string& theValue);
-
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeInteger() {}
+ static const std::string& GetID() ;
+
+ SALOMEDSImpl_AttributeInteger():SALOMEDSImpl_GenericAttribute("AttributeInteger") {}
+ static SALOMEDSImpl_AttributeInteger* Set (const DF_Label& L, int Val);
+ void SetValue(const int theVal);
+ int Value() const;
+ virtual std::string Save();
+ virtual void Load(const std::string& theValue);
+
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeInteger() {}
};
#ifndef _SALOMEDSImpl_AttributeLocalID_HeaderFile
#define _SALOMEDSImpl_AttributeLocalID_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include <string>
#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeLocalID : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeLocalID :
+ public SALOMEDSImpl_GenericAttribute
{
private:
-int myValue;
+ int myValue;
public:
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string& theValue);
-
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeLocalID* Set(const DF_Label& label,const int value) ;
-Standard_EXPORT void SetValue(const int value);
-Standard_EXPORT int Value() const { return myValue; }
-Standard_EXPORT SALOMEDSImpl_AttributeLocalID();
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute*);
-Standard_EXPORT ~SALOMEDSImpl_AttributeLocalID() {}
+ virtual std::string Save();
+ virtual void Load(const std::string& theValue);
+
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeLocalID* Set(const DF_Label& label,const int value) ;
+ void SetValue(const int value);
+ int Value() const { return myValue; }
+ SALOMEDSImpl_AttributeLocalID();
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute*);
+ ~SALOMEDSImpl_AttributeLocalID() {}
};
#ifndef _SALOMEDSImpl_AttributeName_HeaderFile
#define _SALOMEDSImpl_AttributeName_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include <string>
#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeName : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeName :
+ public SALOMEDSImpl_GenericAttribute
{
private:
- std::string myString;
+ std::string myString;
public:
-Standard_EXPORT static const std::string& GetID() ;
+ static const std::string& GetID() ;
-Standard_EXPORT SALOMEDSImpl_AttributeName():SALOMEDSImpl_GenericAttribute("AttributeName") {}
-Standard_EXPORT static SALOMEDSImpl_AttributeName* Set (const DF_Label& L, const std::string& Val);
-Standard_EXPORT void SetValue(const std::string& theVal);
-Standard_EXPORT std::string Value() const { return myString; }
+ SALOMEDSImpl_AttributeName():SALOMEDSImpl_GenericAttribute("AttributeName") {}
+ static SALOMEDSImpl_AttributeName* Set (const DF_Label& L, const std::string& Val);
+ void SetValue(const std::string& theVal);
+ std::string Value() const { return myString; }
-Standard_EXPORT virtual std::string Save() { return myString; }
-Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
+ virtual std::string Save() { return myString; }
+ virtual void Load(const std::string& theValue) { myString = theValue; }
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeName() {}
+ ~SALOMEDSImpl_AttributeName() {}
};
#ifndef _SALOMEDSImpl_AttributeOpened_HeaderFile
#define _SALOMEDSImpl_AttributeOpened_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include <string>
#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeOpened : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeOpened :
+ public SALOMEDSImpl_GenericAttribute
{
private:
-int myValue;
+ int myValue;
public:
-Standard_EXPORT virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
-Standard_EXPORT virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; }
-
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeOpened* Set(const DF_Label& label,const int value) ;
-Standard_EXPORT SALOMEDSImpl_AttributeOpened();
-Standard_EXPORT void SetOpened(const int value);
-Standard_EXPORT int IsOpened() const { return myValue; }
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeOpened() {}
+ virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
+ virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeOpened* Set(const DF_Label& label,const int value) ;
+ SALOMEDSImpl_AttributeOpened();
+ void SetOpened(const int value);
+ int IsOpened() const { return myValue; }
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeOpened() {}
};
#ifndef _SALOMEDSImpl_AttributeParameter_HeaderFile
#define _SALOMEDSImpl_AttributeParameter_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
enum Parameter_Types {PT_INTEGER, PT_REAL, PT_BOOLEAN, PT_STRING, PT_REALARRAY, PT_INTARRAY, PT_STRARRAY};
/*!
- Class: SALOMEDSImpl_AttributeParameter
- Description : AttributeParameter is a universal container of basic types
+Class: SALOMEDSImpl_AttributeParameter
+Description : AttributeParameter is a universal container of basic types
*/
-class SALOMEDSImpl_AttributeParameter : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeParameter :
+ public SALOMEDSImpl_GenericAttribute
{
private:
-
+
std::map<std::string, int> _ints;
std::map<std::string, double> _reals;
std::map<std::string, std::string> _strings;
std::map< std::string, std::vector<std::string> > _strarrays;
public:
- Standard_EXPORT static const std::string& GetID() ;
-
- Standard_EXPORT SALOMEDSImpl_AttributeParameter():SALOMEDSImpl_GenericAttribute("AttributeParameter") {}
- Standard_EXPORT static SALOMEDSImpl_AttributeParameter* Set (const DF_Label& L);
-
-
- Standard_EXPORT void SetInt(const std::string& theID, const int& theValue);
- Standard_EXPORT int GetInt(const std::string& theID);
-
- Standard_EXPORT void SetReal(const std::string& theID, const double& theValue);
- Standard_EXPORT double GetReal(const std::string& theID);
-
- Standard_EXPORT void SetString(const std::string& theID, const std::string& theValue);
- Standard_EXPORT std::string GetString(const std::string& theID);
-
- Standard_EXPORT void SetBool(const std::string& theID, const bool& theValue);
- Standard_EXPORT bool GetBool(const std::string& theID);
-
- Standard_EXPORT void SetRealArray(const std::string& theID, const std::vector<double>& theArray);
- Standard_EXPORT std::vector<double> GetRealArray(const std::string& theID);
-
- Standard_EXPORT void SetIntArray(const std::string& theID, const std::vector<int>& theArray);
- Standard_EXPORT std::vector<int> GetIntArray(const std::string& theID);
-
- Standard_EXPORT void SetStrArray(const std::string& theID, const std::vector<std::string>& theArray);
- Standard_EXPORT std::vector<std::string> GetStrArray(const std::string& theID);
- Standard_EXPORT bool IsSet(const std::string& theID, const Parameter_Types theType);
+ static const std::string& GetID() ;
- Standard_EXPORT bool RemoveID(const std::string& theID, const Parameter_Types theType);
-
- Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetFather();
- Standard_EXPORT bool HasFather();
- Standard_EXPORT bool IsRoot();
-
- Standard_EXPORT std::vector<std::string> GetIDs(const Parameter_Types theType);
-
- Standard_EXPORT void Clear();
-
- Standard_EXPORT virtual std::string Save();
- Standard_EXPORT virtual void Load(const std::string& theValue);
-
- Standard_EXPORT const std::string& ID() const;
- Standard_EXPORT void Restore(DF_Attribute* with) ;
- Standard_EXPORT DF_Attribute* NewEmpty() const;
- Standard_EXPORT void Paste(DF_Attribute* into);
-
- Standard_EXPORT ~SALOMEDSImpl_AttributeParameter() {}
-
+ SALOMEDSImpl_AttributeParameter():SALOMEDSImpl_GenericAttribute("AttributeParameter") {}
+ static SALOMEDSImpl_AttributeParameter* Set (const DF_Label& L);
+
+ void SetInt(const std::string& theID, const int& theValue);
+ int GetInt(const std::string& theID);
+
+ void SetReal(const std::string& theID, const double& theValue);
+ double GetReal(const std::string& theID);
+
+ void SetString(const std::string& theID, const std::string& theValue);
+ std::string GetString(const std::string& theID);
+
+ void SetBool(const std::string& theID, const bool& theValue);
+ bool GetBool(const std::string& theID);
+
+ void SetRealArray(const std::string& theID, const std::vector<double>& theArray);
+ std::vector<double> GetRealArray(const std::string& theID);
+
+ void SetIntArray(const std::string& theID, const std::vector<int>& theArray);
+ std::vector<int> GetIntArray(const std::string& theID);
+
+ void SetStrArray(const std::string& theID, const std::vector<std::string>& theArray);
+ std::vector<std::string> GetStrArray(const std::string& theID);
+
+ bool IsSet(const std::string& theID, const Parameter_Types theType);
+
+ bool RemoveID(const std::string& theID, const Parameter_Types theType);
+
+ SALOMEDSImpl_AttributeParameter* GetFather();
+ bool HasFather();
+ bool IsRoot();
+
+ std::vector<std::string> GetIDs(const Parameter_Types theType);
+
+ void Clear();
+
+ virtual std::string Save();
+ virtual void Load(const std::string& theValue);
+
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+
+ ~SALOMEDSImpl_AttributeParameter() {}
};
#endif
#ifndef _SALOMEDSImpl_AttributePersistentRef_HeaderFile
#define _SALOMEDSImpl_AttributePersistentRef_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include <string>
#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributePersistentRef : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributePersistentRef :
+ public SALOMEDSImpl_GenericAttribute
{
private:
- std::string myString;
+ std::string myString;
public:
-Standard_EXPORT virtual std::string Save() { return myString; }
-Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributePersistentRef* Set(const DF_Label& label,
- const std::string& value) ;
-Standard_EXPORT SALOMEDSImpl_AttributePersistentRef();
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void SetValue(const std::string& value);
-Standard_EXPORT std::string Value() const { return myString; }
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributePersistentRef() {}
+ virtual std::string Save() { return myString; }
+ virtual void Load(const std::string& theValue) { myString = theValue; }
+
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributePersistentRef* Set(const DF_Label& label,
+ const std::string& value) ;
+ SALOMEDSImpl_AttributePersistentRef();
+ const std::string& ID() const;
+ void SetValue(const std::string& value);
+ std::string Value() const { return myString; }
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributePersistentRef() {}
};
#ifndef _SALOMEDSImpl_AttributePixMap_HeaderFile
#define _SALOMEDSImpl_AttributePixMap_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include <string>
#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributePixMap : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributePixMap :
+ public SALOMEDSImpl_GenericAttribute
{
private:
- std::string myString;
+ std::string myString;
public:
-Standard_EXPORT virtual std::string Save() { return myString; }
-Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributePixMap* Set(const DF_Label& label,
- const std::string& string) ;
-Standard_EXPORT SALOMEDSImpl_AttributePixMap();
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void SetPixMap(const std::string& value);
-Standard_EXPORT std::string GetPixMap() const { return myString; }
-Standard_EXPORT bool HasPixMap() const { return (myString != "None"); }
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributePixMap() {}
+ virtual std::string Save() { return myString; }
+ virtual void Load(const std::string& theValue) { myString = theValue; }
+
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributePixMap* Set(const DF_Label& label,
+ const std::string& string) ;
+ SALOMEDSImpl_AttributePixMap();
+ const std::string& ID() const;
+ void SetPixMap(const std::string& value);
+ std::string GetPixMap() const { return myString; }
+ bool HasPixMap() const { return (myString != "None"); }
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributePixMap() {}
};
#ifndef _SALOMEDSImpl_AttributePythonObject_HeaderFile
#define _SALOMEDSImpl_AttributePythonObject_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <string>
#undef GetObject
#endif
-class SALOMEDSImpl_AttributePythonObject : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributePythonObject :
+ public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string&);
-
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributePythonObject* Set(const DF_Label& label) ;
-Standard_EXPORT SALOMEDSImpl_AttributePythonObject();
-Standard_EXPORT void SetObject(const std::string& theSequence, const bool theScript) ;
-Standard_EXPORT std::string GetObject() const;
-Standard_EXPORT bool IsScript() const;
-Standard_EXPORT int GetLength() const;
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributePythonObject() {}
+ virtual std::string Save();
+ virtual void Load(const std::string&);
+
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributePythonObject* Set(const DF_Label& label) ;
+ SALOMEDSImpl_AttributePythonObject();
+ void SetObject(const std::string& theSequence, const bool theScript) ;
+ std::string GetObject() const;
+ bool IsScript() const;
+ int GetLength() const;
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributePythonObject() {}
private:
-std::string mySequence;
-bool myIsScript;
+ std::string mySequence;
+ bool myIsScript;
};
#ifndef _SALOMEDSImpl_AttributeReal_HeaderFile
#define _SALOMEDSImpl_AttributeReal_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include <string>
#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeReal : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeReal :
+ public SALOMEDSImpl_GenericAttribute
{
private:
double myValue;
public:
-Standard_EXPORT static const std::string& GetID() ;
+ static const std::string& GetID() ;
-Standard_EXPORT SALOMEDSImpl_AttributeReal():SALOMEDSImpl_GenericAttribute("AttributeReal") {}
-Standard_EXPORT static SALOMEDSImpl_AttributeReal* Set (const DF_Label& L, const double& Val);
-Standard_EXPORT void SetValue(const double& theVal);
-Standard_EXPORT double Value() const { return myValue; }
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string& theValue);
+ SALOMEDSImpl_AttributeReal():SALOMEDSImpl_GenericAttribute("AttributeReal") {}
+ static SALOMEDSImpl_AttributeReal* Set (const DF_Label& L, const double& Val);
+ void SetValue(const double& theVal);
+ double Value() const { return myValue; }
+ virtual std::string Save();
+ virtual void Load(const std::string& theValue);
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeReal() {}
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeReal() {}
};
#ifndef _SALOMEDSImpl_AttributeReference_HeaderFile
#define _SALOMEDSImpl_AttributeReference_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeReference : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeReference :
+ public SALOMEDSImpl_GenericAttribute
{
private:
- DF_Label myLabel;
+ DF_Label myLabel;
public:
-Standard_EXPORT static const std::string& GetID() ;
+ static const std::string& GetID() ;
-Standard_EXPORT SALOMEDSImpl_AttributeReference():SALOMEDSImpl_GenericAttribute("AttributeReference") {}
-Standard_EXPORT static SALOMEDSImpl_AttributeReference* Set(const DF_Label& theLabel, const DF_Label& theRefLabel);
-Standard_EXPORT void Set(const DF_Label& theLabel);
-Standard_EXPORT DF_Label Get() const { return myLabel; }
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string& theValue);
+ SALOMEDSImpl_AttributeReference():SALOMEDSImpl_GenericAttribute("AttributeReference") {}
+ static SALOMEDSImpl_AttributeReference* Set(const DF_Label& theLabel, const DF_Label& theRefLabel);
+ void Set(const DF_Label& theLabel);
+ DF_Label Get() const { return myLabel; }
+ virtual std::string Save();
+ virtual void Load(const std::string& theValue);
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeReference() {}
+ ~SALOMEDSImpl_AttributeReference() {}
};
#endif
#ifndef _SALOMEDSImpl_AttributeSelectable_HeaderFile
#define _SALOMEDSImpl_AttributeSelectable_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeSelectable : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeSelectable :
+ public SALOMEDSImpl_GenericAttribute
{
private:
-int myValue;
+ int myValue;
public:
-Standard_EXPORT virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
-Standard_EXPORT virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; }
-
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeSelectable* Set(const DF_Label& label,const int value) ;
-Standard_EXPORT SALOMEDSImpl_AttributeSelectable();
-Standard_EXPORT void SetSelectable(const int value);
-Standard_EXPORT int IsSelectable() const { return myValue; }
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeSelectable() {}
+ virtual std::string Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
+ virtual void Load(const std::string& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeSelectable* Set(const DF_Label& label,const int value) ;
+ SALOMEDSImpl_AttributeSelectable();
+ void SetSelectable(const int value);
+ int IsSelectable() const { return myValue; }
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeSelectable() {}
};
#ifndef _SALOMEDSImpl_AttributeSequenceOfInteger_HeaderFile
#define _SALOMEDSImpl_AttributeSequenceOfInteger_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <vector>
#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeSequenceOfInteger : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeSequenceOfInteger :
+ public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string&);
-
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeSequenceOfInteger* Set(const DF_Label& label) ;
-Standard_EXPORT SALOMEDSImpl_AttributeSequenceOfInteger();
-Standard_EXPORT void Assign(const std::vector<int>& other) ;
-Standard_EXPORT void ChangeValue(const int Index,const int Value) ;
-Standard_EXPORT void Add(const int value) ;
-Standard_EXPORT int Value(const int Index) ;
-Standard_EXPORT void Remove(const int Index) ;
-Standard_EXPORT int Length() ;
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeSequenceOfInteger() {}
-Standard_EXPORT const std::vector<int>& Array() { return myValue; }
+ virtual std::string Save();
+ virtual void Load(const std::string&);
+
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeSequenceOfInteger* Set(const DF_Label& label) ;
+ SALOMEDSImpl_AttributeSequenceOfInteger();
+ void Assign(const std::vector<int>& other) ;
+ void ChangeValue(const int Index,const int Value) ;
+ void Add(const int value) ;
+ int Value(const int Index) ;
+ void Remove(const int Index) ;
+ int Length() ;
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeSequenceOfInteger() {}
+ const std::vector<int>& Array() { return myValue; }
private:
-std::vector<int> myValue;
+ std::vector<int> myValue;
};
#endif
#ifndef _SALOMEDSImpl_AttributeSequenceOfReal_HeaderFile
#define _SALOMEDSImpl_AttributeSequenceOfReal_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeSequenceOfReal : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeSequenceOfReal :
+ public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string&);
-
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeSequenceOfReal* Set(const DF_Label& label) ;
-Standard_EXPORT SALOMEDSImpl_AttributeSequenceOfReal();
-Standard_EXPORT void Assign(const std::vector<double>& other) ;
-Standard_EXPORT void ChangeValue(const int Index,const double& Value) ;
-Standard_EXPORT void Add(const double& Value) ;
-Standard_EXPORT double Value(const int Index) ;
-Standard_EXPORT void Remove(const int Index) ;
-Standard_EXPORT int Length() ;
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeSequenceOfReal() {}
-Standard_EXPORT const std::vector<double>& Array() { return myValue; }
+ virtual std::string Save();
+ virtual void Load(const std::string&);
+
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeSequenceOfReal* Set(const DF_Label& label) ;
+ SALOMEDSImpl_AttributeSequenceOfReal();
+ void Assign(const std::vector<double>& other) ;
+ void ChangeValue(const int Index,const double& Value) ;
+ void Add(const double& Value) ;
+ double Value(const int Index) ;
+ void Remove(const int Index) ;
+ int Length() ;
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeSequenceOfReal() {}
+ const std::vector<double>& Array() { return myValue; }
private:
-std::vector<double> myValue;
+ std::vector<double> myValue;
};
#include "SALOMEDSImpl_AttributeString.hxx"
-#ifndef WNT
using namespace std;
-#endif
//=======================================================================
//function : GetID
#ifndef _SALOMEDSImpl_AttributeStudyProperties_HeaderFile
#define _SALOMEDSImpl_AttributeStudyProperties_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <string>
#include <vector>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeStudyProperties : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeStudyProperties : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT SALOMEDSImpl_AttributeStudyProperties();
-Standard_EXPORT ~SALOMEDSImpl_AttributeStudyProperties() {}
+ SALOMEDSImpl_AttributeStudyProperties();
+ ~SALOMEDSImpl_AttributeStudyProperties() {}
-Standard_EXPORT static const std::string& GetID();
-Standard_EXPORT const std::string& ID() const;
+ static const std::string& GetID();
+ const std::string& ID() const;
-Standard_EXPORT static SALOMEDSImpl_AttributeStudyProperties* Set(const DF_Label& label);
+ static SALOMEDSImpl_AttributeStudyProperties* Set(const DF_Label& label);
-Standard_EXPORT void Init();
+ void Init();
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string&);
+ virtual std::string Save();
+ virtual void Load(const std::string&);
-Standard_EXPORT void SetModification(const std::string& theUserName,
- const int theMinute,
- const int theHour,
- const int theDay,
- const int theMonth,
- const int theYear);
-Standard_EXPORT void GetModifications(std::vector<std::string>& theUserNames,
- std::vector<int>& theMinutes,
- std::vector<int>& theHours,
- std::vector<int>& theDays,
- std::vector<int>& theMonths,
- std::vector<int>& theYears) const;
+ void SetModification(const std::string& theUserName,
+ const int theMinute,
+ const int theHour,
+ const int theDay,
+ const int theMonth,
+ const int theYear);
+ void GetModifications(std::vector<std::string>& theUserNames,
+ std::vector<int>& theMinutes,
+ std::vector<int>& theHours,
+ std::vector<int>& theDays,
+ std::vector<int>& theMonths,
+ std::vector<int>& theYears) const;
-Standard_EXPORT std::string GetCreatorName() const;
-Standard_EXPORT bool GetCreationDate(int& theMinute,
- int& theHour,
- int& theDay,
- int& theMonth,
- int& theYear) const;
+ std::string GetCreatorName() const;
+ bool GetCreationDate(int& theMinute,
+ int& theHour,
+ int& theDay,
+ int& theMonth,
+ int& theYear) const;
-Standard_EXPORT void ChangeCreatorName(const std::string& theUserName);
+ void ChangeCreatorName(const std::string& theUserName);
-Standard_EXPORT void SetCreationMode(const int theMode);
-Standard_EXPORT int GetCreationMode() const;
+ void SetCreationMode(const int theMode);
+ int GetCreationMode() const;
-Standard_EXPORT void SetModified(const int theModified);
-Standard_EXPORT bool IsModified() const;
-Standard_EXPORT int GetModified() const;
+ void SetModified(const int theModified);
+ bool IsModified() const;
+ int GetModified() const;
-Standard_EXPORT void SetLocked(const bool theLocked);
-Standard_EXPORT bool IsLocked() const;
-Standard_EXPORT bool IsLockChanged(const bool theErase);
+ void SetLocked(const bool theLocked);
+ bool IsLocked() const;
+ bool IsLockChanged(const bool theErase);
-Standard_EXPORT void Restore(DF_Attribute* with);
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
+ void Restore(DF_Attribute* with);
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
private:
-std::vector<std::string> myUserName;
-std::vector<int> myMinute;
-std::vector<int> myHour;
-std::vector<int> myDay;
-std::vector<int> myMonth;
-std::vector<int> myYear;
-int myMode;
-int myModified;
-bool myLocked;
-bool myLockChanged;
+ std::vector<std::string> myUserName;
+ std::vector<int> myMinute;
+ std::vector<int> myHour;
+ std::vector<int> myDay;
+ std::vector<int> myMonth;
+ std::vector<int> myYear;
+ int myMode;
+ int myModified;
+ bool myLocked;
+ bool myLockChanged;
};
#ifndef _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile
#define _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include <map>
-class SALOMEDSImpl_AttributeTableOfInteger : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTableOfInteger :
+ public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string&);
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeTableOfInteger* Set(const DF_Label& label) ;
-Standard_EXPORT SALOMEDSImpl_AttributeTableOfInteger();
-Standard_EXPORT void SetNbColumns(const int theNbColumns);
-Standard_EXPORT void SetTitle(const std::string& theTitle) ;
-Standard_EXPORT std::string GetTitle() const;
-Standard_EXPORT void SetRowData(const int theRow,const std::vector<int>& theData) ;
-Standard_EXPORT std::vector<int> GetRowData(const int theRow) ;
-Standard_EXPORT void SetRowTitle(const int theRow,const std::string& theTitle) ;
-Standard_EXPORT void SetRowUnit(const int theRow,const std::string& theUnit) ;
-Standard_EXPORT std::string GetRowUnit(const int theRow) const;
-Standard_EXPORT void SetRowUnits(const std::vector<std::string>& theUnits) ;
-Standard_EXPORT std::vector<std::string> GetRowUnits();
-Standard_EXPORT void SetRowTitles(const std::vector<std::string>& theTitles) ;
-Standard_EXPORT std::vector<std::string> GetRowTitles();
-Standard_EXPORT std::string GetRowTitle(const int theRow) const;
-Standard_EXPORT void SetColumnData(const int theColumn,const std::vector<int>& theData) ;
-Standard_EXPORT std::vector<int> GetColumnData(const int theColumn) ;
-Standard_EXPORT void SetColumnTitle(const int theColumn,const std::string& theTitle) ;
-Standard_EXPORT std::string GetColumnTitle(const int theColumn) const;
-Standard_EXPORT void SetColumnTitles(const std::vector<std::string>& theTitles);
-Standard_EXPORT std::vector<std::string> GetColumnTitles();
-Standard_EXPORT int GetNbRows() const;
-Standard_EXPORT int GetNbColumns() const;
+ virtual std::string Save();
+ virtual void Load(const std::string&);
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeTableOfInteger* Set(const DF_Label& label) ;
+ SALOMEDSImpl_AttributeTableOfInteger();
+ void SetNbColumns(const int theNbColumns);
+ void SetTitle(const std::string& theTitle) ;
+ std::string GetTitle() const;
+ void SetRowData(const int theRow,const std::vector<int>& theData) ;
+ std::vector<int> GetRowData(const int theRow) ;
+ void SetRowTitle(const int theRow,const std::string& theTitle) ;
+ void SetRowUnit(const int theRow,const std::string& theUnit) ;
+ std::string GetRowUnit(const int theRow) const;
+ void SetRowUnits(const std::vector<std::string>& theUnits) ;
+ std::vector<std::string> GetRowUnits();
+ void SetRowTitles(const std::vector<std::string>& theTitles) ;
+ std::vector<std::string> GetRowTitles();
+ std::string GetRowTitle(const int theRow) const;
+ void SetColumnData(const int theColumn,const std::vector<int>& theData) ;
+ std::vector<int> GetColumnData(const int theColumn) ;
+ void SetColumnTitle(const int theColumn,const std::string& theTitle) ;
+ std::string GetColumnTitle(const int theColumn) const;
+ void SetColumnTitles(const std::vector<std::string>& theTitles);
+ std::vector<std::string> GetColumnTitles();
+ int GetNbRows() const;
+ int GetNbColumns() const;
-Standard_EXPORT void PutValue(const int theValue,const int theRow,const int theColumn) ;
-Standard_EXPORT bool HasValue(const int theRow,const int theColumn) ;
-Standard_EXPORT int GetValue(const int theRow,const int theColumn) ;
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
+ void PutValue(const int theValue,const int theRow,const int theColumn) ;
+ bool HasValue(const int theRow,const int theColumn) ;
+ int GetValue(const int theRow,const int theColumn) ;
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
-Standard_EXPORT std::vector<int> GetSetRowIndices(const int theRow);
-Standard_EXPORT std::vector<int> GetSetColumnIndices(const int theColumn);
+ std::vector<int> GetSetRowIndices(const int theRow);
+ std::vector<int> GetSetColumnIndices(const int theColumn);
-Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfInteger() {}
+ ~SALOMEDSImpl_AttributeTableOfInteger() {}
private:
-std::map<int, int> myTable;
-std::string myTitle;
-std::vector<std::string> myRows;
-std::vector<std::string> myCols;
-int myNbRows;
-int myNbColumns;
+ std::map<int, int> myTable;
+ std::string myTitle;
+ std::vector<std::string> myRows;
+ std::vector<std::string> myCols;
+ int myNbRows;
+ int myNbColumns;
};
#ifndef _SALOMEDSImpl_AttributeTableOfReal_HeaderFile
#define _SALOMEDSImpl_AttributeTableOfReal_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include <vector>
#include <map>
-class SALOMEDSImpl_AttributeTableOfReal : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTableOfReal :
+ public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string&);
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeTableOfReal* Set(const DF_Label& label) ;
-Standard_EXPORT SALOMEDSImpl_AttributeTableOfReal();
-Standard_EXPORT void SetNbColumns(const int theNbColumns);
-Standard_EXPORT void SetTitle(const std::string& theTitle) ;
-Standard_EXPORT std::string GetTitle() const;
-Standard_EXPORT void SetRowData(const int theRow,const std::vector<double>& theData) ;
-Standard_EXPORT std::vector<double> GetRowData(const int theRow) ;
-Standard_EXPORT void SetRowTitle(const int theRow,const std::string& theTitle) ;
-Standard_EXPORT void SetRowUnit(const int theRow,const std::string& theUnit) ;
-Standard_EXPORT std::string GetRowUnit(const int theRow) const;
-Standard_EXPORT void SetRowUnits(const std::vector<std::string>& theUnits) ;
-Standard_EXPORT std::vector<std::string> GetRowUnits();
-Standard_EXPORT void SetRowTitles(const std::vector<std::string>& theTitles) ;
-Standard_EXPORT std::vector<std::string> GetRowTitles();
-Standard_EXPORT std::string GetRowTitle(const int theRow) const;
-Standard_EXPORT void SetColumnData(const int theColumn,const std::vector<double>& theData) ;
-Standard_EXPORT std::vector<double> GetColumnData(const int theColumn) ;
-Standard_EXPORT void SetColumnTitle(const int theColumn,const std::string& theTitle) ;
-Standard_EXPORT void SetColumnTitles(const std::vector<std::string>& theTitles);
-Standard_EXPORT std::vector<std::string> GetColumnTitles();
-Standard_EXPORT std::string GetColumnTitle(const int theColumn) const;
-Standard_EXPORT int GetNbRows() const;
-Standard_EXPORT int GetNbColumns() const;
+ virtual std::string Save();
+ virtual void Load(const std::string&);
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeTableOfReal* Set(const DF_Label& label) ;
+ SALOMEDSImpl_AttributeTableOfReal();
+ void SetNbColumns(const int theNbColumns);
+ void SetTitle(const std::string& theTitle) ;
+ std::string GetTitle() const;
+ void SetRowData(const int theRow,const std::vector<double>& theData) ;
+ std::vector<double> GetRowData(const int theRow) ;
+ void SetRowTitle(const int theRow,const std::string& theTitle) ;
+ void SetRowUnit(const int theRow,const std::string& theUnit) ;
+ std::string GetRowUnit(const int theRow) const;
+ void SetRowUnits(const std::vector<std::string>& theUnits) ;
+ std::vector<std::string> GetRowUnits();
+ void SetRowTitles(const std::vector<std::string>& theTitles) ;
+ std::vector<std::string> GetRowTitles();
+ std::string GetRowTitle(const int theRow) const;
+ void SetColumnData(const int theColumn,const std::vector<double>& theData) ;
+ std::vector<double> GetColumnData(const int theColumn) ;
+ void SetColumnTitle(const int theColumn,const std::string& theTitle) ;
+ void SetColumnTitles(const std::vector<std::string>& theTitles);
+ std::vector<std::string> GetColumnTitles();
+ std::string GetColumnTitle(const int theColumn) const;
+ int GetNbRows() const;
+ int GetNbColumns() const;
-Standard_EXPORT void PutValue(const double& theValue,const int theRow,const int theColumn) ;
-Standard_EXPORT bool HasValue(const int theRow,const int theColumn) ;
-Standard_EXPORT double GetValue(const int theRow,const int theColumn) ;
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
+ void PutValue(const double& theValue,const int theRow,const int theColumn) ;
+ bool HasValue(const int theRow,const int theColumn) ;
+ double GetValue(const int theRow,const int theColumn) ;
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
-Standard_EXPORT std::vector<int> GetSetRowIndices(const int theRow);
-Standard_EXPORT std::vector<int> GetSetColumnIndices(const int theColumn);
+ std::vector<int> GetSetRowIndices(const int theRow);
+ std::vector<int> GetSetColumnIndices(const int theColumn);
-Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfReal() {}
+ ~SALOMEDSImpl_AttributeTableOfReal() {}
private:
-std::map<int, double> myTable;
-std::string myTitle;
-std::vector<std::string> myRows;
-std::vector<std::string> myCols;
-int myNbRows;
-int myNbColumns;
+ std::map<int, double> myTable;
+ std::string myTitle;
+ std::vector<std::string> myRows;
+ std::vector<std::string> myCols;
+ int myNbRows;
+ int myNbColumns;
};
#ifndef _SALOMEDSImpl_AttributeTableOfString_HeaderFile
#define _SALOMEDSImpl_AttributeTableOfString_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Label.hxx"
#include "DF_Attribute.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include <vector>
#include <map>
-class SALOMEDSImpl_AttributeTableOfString : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTableOfString :
+ public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string&);
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeTableOfString* Set(const DF_Label& label) ;
-Standard_EXPORT SALOMEDSImpl_AttributeTableOfString();
-Standard_EXPORT void SetNbColumns(const int theNbColumns);
-Standard_EXPORT void SetTitle(const std::string& theTitle) ;
-Standard_EXPORT std::string GetTitle() const;
-Standard_EXPORT void SetRowData(const int theRow,const std::vector<std::string>& theData) ;
-Standard_EXPORT std::vector<std::string> GetRowData(const int theRow) ;
-Standard_EXPORT void SetRowTitle(const int theRow,const std::string& theTitle) ;
-Standard_EXPORT void SetRowUnit(const int theRow,const std::string& theUnit) ;
-Standard_EXPORT std::string GetRowUnit(const int theRow) const;
-Standard_EXPORT void SetRowUnits(const std::vector<std::string>& theUnits) ;
-Standard_EXPORT std::vector<std::string> GetRowUnits();
-Standard_EXPORT void SetRowTitles(const std::vector<std::string>& theTitles) ;
-Standard_EXPORT std::vector<std::string> GetRowTitles();
-Standard_EXPORT std::string GetRowTitle(const int theRow) const;
-Standard_EXPORT void SetColumnData(const int theColumn,const std::vector<std::string>& theData) ;
-Standard_EXPORT std::vector<std::string> GetColumnData(const int theColumn) ;
-Standard_EXPORT void SetColumnTitle(const int theColumn,const std::string& theTitle) ;
-Standard_EXPORT std::string GetColumnTitle(const int theColumn) const;
-Standard_EXPORT void SetColumnTitles(const std::vector<std::string>& theTitles);
-Standard_EXPORT std::vector<std::string> GetColumnTitles();
-Standard_EXPORT int GetNbRows() const;
-Standard_EXPORT int GetNbColumns() const;
+ virtual std::string Save();
+ virtual void Load(const std::string&);
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeTableOfString* Set(const DF_Label& label) ;
+ SALOMEDSImpl_AttributeTableOfString();
+ void SetNbColumns(const int theNbColumns);
+ void SetTitle(const std::string& theTitle) ;
+ std::string GetTitle() const;
+ void SetRowData(const int theRow,const std::vector<std::string>& theData) ;
+ std::vector<std::string> GetRowData(const int theRow) ;
+ void SetRowTitle(const int theRow,const std::string& theTitle) ;
+ void SetRowUnit(const int theRow,const std::string& theUnit) ;
+ std::string GetRowUnit(const int theRow) const;
+ void SetRowUnits(const std::vector<std::string>& theUnits) ;
+ std::vector<std::string> GetRowUnits();
+ void SetRowTitles(const std::vector<std::string>& theTitles) ;
+ std::vector<std::string> GetRowTitles();
+ std::string GetRowTitle(const int theRow) const;
+ void SetColumnData(const int theColumn,const std::vector<std::string>& theData) ;
+ std::vector<std::string> GetColumnData(const int theColumn) ;
+ void SetColumnTitle(const int theColumn,const std::string& theTitle) ;
+ std::string GetColumnTitle(const int theColumn) const;
+ void SetColumnTitles(const std::vector<std::string>& theTitles);
+ std::vector<std::string> GetColumnTitles();
+ int GetNbRows() const;
+ int GetNbColumns() const;
-Standard_EXPORT void PutValue(const std::string& theValue,const int theRow,const int theColumn) ;
-Standard_EXPORT bool HasValue(const int theRow,const int theColumn) ;
-Standard_EXPORT std::string GetValue(const int theRow,const int theColumn) ;
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
+ void PutValue(const std::string& theValue,const int theRow,const int theColumn) ;
+ bool HasValue(const int theRow,const int theColumn) ;
+ std::string GetValue(const int theRow,const int theColumn) ;
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
-Standard_EXPORT std::vector<int> GetSetRowIndices(const int theRow);
-Standard_EXPORT std::vector<int> GetSetColumnIndices(const int theColumn);
+ std::vector<int> GetSetRowIndices(const int theRow);
+ std::vector<int> GetSetColumnIndices(const int theColumn);
-Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfString() {}
+ ~SALOMEDSImpl_AttributeTableOfString() {}
private:
-std::map<int, std::string> myTable;
-std::string myTitle;
-std::vector<std::string> myRows;
-std::vector<std::string> myCols;
-int myNbRows;
-int myNbColumns;
+ std::map<int, std::string> myTable;
+ std::string myTitle;
+ std::vector<std::string> myRows;
+ std::vector<std::string> myCols;
+ int myNbRows;
+ int myNbColumns;
};
#ifndef _SALOMEDSImpl_AttributeTarget_HeaderFile
#define _SALOMEDSImpl_AttributeTarget_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "SALOMEDSImpl_SObject.hxx"
-class SALOMEDSImpl_AttributeTarget : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTarget :
+ public SALOMEDSImpl_GenericAttribute
{
private:
-std::string myRelation;
-std::vector<DF_Attribute*> myVariables;
+ std::string myRelation;
+ std::vector<DF_Attribute*> myVariables;
public:
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT static SALOMEDSImpl_AttributeTarget* Set(const DF_Label& label) ;
-Standard_EXPORT SALOMEDSImpl_AttributeTarget();
-Standard_EXPORT void Add(const SALOMEDSImpl_SObject& theSO);
-Standard_EXPORT std::vector<SALOMEDSImpl_SObject> Get();
-Standard_EXPORT void Remove(const SALOMEDSImpl_SObject& theSO);
-Standard_EXPORT std::string GetRelation() { return myRelation; }
-Standard_EXPORT void SetRelation(const std::string& theRelation);
-Standard_EXPORT std::vector<DF_Attribute*>& GetVariables() { return myVariables; }
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeTarget() {}
+ static const std::string& GetID() ;
+ static SALOMEDSImpl_AttributeTarget* Set(const DF_Label& label) ;
+ SALOMEDSImpl_AttributeTarget();
+ void Add(const SALOMEDSImpl_SObject& theSO);
+ std::vector<SALOMEDSImpl_SObject> Get();
+ void Remove(const SALOMEDSImpl_SObject& theSO);
+ std::string GetRelation() { return myRelation; }
+ void SetRelation(const std::string& theRelation);
+ std::vector<DF_Attribute*>& GetVariables() { return myVariables; }
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeTarget() {}
};
#ifndef _SALOMEDSImpl_AttributeTextColor_HeaderFile
#define _SALOMEDSImpl_AttributeTextColor_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <string>
#include <vector>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeTextColor : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTextColor :
+ public SALOMEDSImpl_GenericAttribute
{
private:
std::vector<double> myValue;
public:
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string&);
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT SALOMEDSImpl_AttributeTextColor();
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void SetTextColor(const double& R, const double& G, const double& B);
-Standard_EXPORT std::vector<double> TextColor();
-Standard_EXPORT void ChangeArray(const std::vector<double>& newArray);
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste( DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeTextColor() {}
+ virtual std::string Save();
+ virtual void Load(const std::string&);
+ static const std::string& GetID() ;
+ SALOMEDSImpl_AttributeTextColor();
+ const std::string& ID() const;
+ void SetTextColor(const double& R, const double& G, const double& B);
+ std::vector<double> TextColor();
+ void ChangeArray(const std::vector<double>& newArray);
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste( DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeTextColor() {}
};
#ifndef _SALOMEDSImpl_AttributeTextHighlightColor_HeaderFile
#define _SALOMEDSImpl_AttributeTextHighlightColor_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeTextHighlightColor : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTextHighlightColor :
+ public SALOMEDSImpl_GenericAttribute
{
private:
std::vector<double> myValue;
public:
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string&);
-Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT SALOMEDSImpl_AttributeTextHighlightColor();
-Standard_EXPORT void SetTextHighlightColor(const double& R, const double& G, const double& B);
-Standard_EXPORT std::vector<double> TextHighlightColor();
-Standard_EXPORT void ChangeArray(const std::vector<double>& newArray);
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeTextHighlightColor() {}
+ virtual std::string Save();
+ virtual void Load(const std::string&);
+ static const std::string& GetID() ;
+ SALOMEDSImpl_AttributeTextHighlightColor();
+ void SetTextHighlightColor(const double& R, const double& G, const double& B);
+ std::vector<double> TextHighlightColor();
+ void ChangeArray(const std::vector<double>& newArray);
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeTextHighlightColor() {}
};
#endif
#ifndef _SALOMEDSImpl_AttributeTreeNode_HeaderFile
#define _SALOMEDSImpl_AttributeTreeNode_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeTreeNode : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTreeNode :
+ public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT const static std::string& GetDefaultTreeID();
-Standard_EXPORT static SALOMEDSImpl_AttributeTreeNode* Set(const DF_Label& L, const std::string& ID);
-
-Standard_EXPORT SALOMEDSImpl_AttributeTreeNode();
-Standard_EXPORT void SetFather(const SALOMEDSImpl_AttributeTreeNode* value);
-Standard_EXPORT void SetPrevious(const SALOMEDSImpl_AttributeTreeNode* value);
-Standard_EXPORT void SetNext(const SALOMEDSImpl_AttributeTreeNode* value);
-Standard_EXPORT void SetFirst(const SALOMEDSImpl_AttributeTreeNode* value);
-Standard_EXPORT void SetTreeID(const std::string& value);
-
-Standard_EXPORT bool Append(SALOMEDSImpl_AttributeTreeNode* value);
-Standard_EXPORT bool Prepend(SALOMEDSImpl_AttributeTreeNode* value);
-Standard_EXPORT bool Remove();
-Standard_EXPORT bool InsertBefore(SALOMEDSImpl_AttributeTreeNode* value);
-Standard_EXPORT bool InsertAfter(SALOMEDSImpl_AttributeTreeNode* value);
-
-Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetFather() const { return myFather; }
-Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetPrevious() const { return myPrevious; }
-Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetNext() const { return myNext; }
-Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* GetFirst() const { return myFirst; }
-
-Standard_EXPORT bool HasFather() { return (myFather); }
-Standard_EXPORT bool HasPrevious() { return (myPrevious); }
-Standard_EXPORT bool HasNext() {return (myNext); }
-Standard_EXPORT bool HasFirst() { return (myFirst); }
-Standard_EXPORT const std::string& GetTreeID() { return ID(); }
-Standard_EXPORT int Depth() const;
-Standard_EXPORT bool IsRoot() const ;
-Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* Root() const;
-Standard_EXPORT bool IsAscendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const;
-Standard_EXPORT bool IsDescendant(const SALOMEDSImpl_AttributeTreeNode* value) const;
-Standard_EXPORT bool IsFather(const SALOMEDSImpl_AttributeTreeNode* value) const;
-Standard_EXPORT bool IsChild(const SALOMEDSImpl_AttributeTreeNode* value) const;
-
-Standard_EXPORT virtual std::string Save();
-Standard_EXPORT virtual void Load(const std::string&);
-Standard_EXPORT virtual std::string Type();
-
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT ~SALOMEDSImpl_AttributeTreeNode() {;}
-
-Standard_EXPORT virtual void AfterAddition();
-Standard_EXPORT virtual void BeforeForget();
+ const static std::string& GetDefaultTreeID();
+ static SALOMEDSImpl_AttributeTreeNode* Set(const DF_Label& L, const std::string& ID);
+
+ SALOMEDSImpl_AttributeTreeNode();
+ void SetFather(const SALOMEDSImpl_AttributeTreeNode* value);
+ void SetPrevious(const SALOMEDSImpl_AttributeTreeNode* value);
+ void SetNext(const SALOMEDSImpl_AttributeTreeNode* value);
+ void SetFirst(const SALOMEDSImpl_AttributeTreeNode* value);
+ void SetTreeID(const std::string& value);
+
+ bool Append(SALOMEDSImpl_AttributeTreeNode* value);
+ bool Prepend(SALOMEDSImpl_AttributeTreeNode* value);
+ bool Remove();
+ bool InsertBefore(SALOMEDSImpl_AttributeTreeNode* value);
+ bool InsertAfter(SALOMEDSImpl_AttributeTreeNode* value);
+
+ SALOMEDSImpl_AttributeTreeNode* GetFather() const { return myFather; }
+ SALOMEDSImpl_AttributeTreeNode* GetPrevious() const { return myPrevious; }
+ SALOMEDSImpl_AttributeTreeNode* GetNext() const { return myNext; }
+ SALOMEDSImpl_AttributeTreeNode* GetFirst() const { return myFirst; }
+
+ bool HasFather() { return (myFather); }
+ bool HasPrevious() { return (myPrevious); }
+ bool HasNext() {return (myNext); }
+ bool HasFirst() { return (myFirst); }
+ const std::string& GetTreeID() { return ID(); }
+ int Depth() const;
+ bool IsRoot() const ;
+ SALOMEDSImpl_AttributeTreeNode* Root() const;
+ bool IsAscendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const;
+ bool IsDescendant(const SALOMEDSImpl_AttributeTreeNode* value) const;
+ bool IsFather(const SALOMEDSImpl_AttributeTreeNode* value) const;
+ bool IsChild(const SALOMEDSImpl_AttributeTreeNode* value) const;
+
+ virtual std::string Save();
+ virtual void Load(const std::string&);
+ virtual std::string Type();
+
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ void Paste(DF_Attribute* into);
+ DF_Attribute* NewEmpty() const;
+ ~SALOMEDSImpl_AttributeTreeNode() {;}
+
+ virtual void AfterAddition();
+ virtual void BeforeForget();
private:
-std::string myTreeID;
-SALOMEDSImpl_AttributeTreeNode* myFather;
-SALOMEDSImpl_AttributeTreeNode* myPrevious;
-SALOMEDSImpl_AttributeTreeNode* myNext;
-SALOMEDSImpl_AttributeTreeNode* myFirst;
+ std::string myTreeID;
+ SALOMEDSImpl_AttributeTreeNode* myFather;
+ SALOMEDSImpl_AttributeTreeNode* myPrevious;
+ SALOMEDSImpl_AttributeTreeNode* myNext;
+ SALOMEDSImpl_AttributeTreeNode* myFirst;
-friend class SALOMEDSImpl_ChildNodeIterator;
+ friend class SALOMEDSImpl_ChildNodeIterator;
};
#ifndef _SALOMEDSImpl_AttributeUserID_HeaderFile
#define _SALOMEDSImpl_AttributeUserID_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class SALOMEDSImpl_AttributeUserID : public SALOMEDSImpl_GenericAttribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeUserID :
+ public SALOMEDSImpl_GenericAttribute
{
private:
-std::string myID;
+ std::string myID;
public:
-SALOMEDSImpl_AttributeUserID():SALOMEDSImpl_GenericAttribute("AttributeUserID") {}
-static SALOMEDSImpl_AttributeUserID* Set (const DF_Label& L, const std::string& ID);
-static const std::string& DefaultID()
-{
- static std::string SALOMEDSImpl_DefaultUserAttributeID ("FFFFFFFF-D9CD-11d6-945D-1050DA506788");
- return SALOMEDSImpl_DefaultUserAttributeID;
-}
-
-Standard_EXPORT const std::string& Value() const { return ID(); }
-Standard_EXPORT void SetValue(const std::string& value);
-
-Standard_EXPORT virtual std::string Type();
-
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore(DF_Attribute* with) ;
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste(DF_Attribute* into);
-Standard_EXPORT ~SALOMEDSImpl_AttributeUserID() {}
+ SALOMEDSImpl_AttributeUserID():SALOMEDSImpl_GenericAttribute("AttributeUserID") {}
+ static SALOMEDSImpl_AttributeUserID* Set (const DF_Label& L, const std::string& ID);
+ static const std::string& DefaultID()
+ {
+ static std::string SALOMEDSImpl_DefaultUserAttributeID ("FFFFFFFF-D9CD-11d6-945D-1050DA506788");
+ return SALOMEDSImpl_DefaultUserAttributeID;
+ }
+
+ const std::string& Value() const { return ID(); }
+ void SetValue(const std::string& value);
+
+ virtual std::string Type();
+
+ const std::string& ID() const;
+ void Restore(DF_Attribute* with) ;
+ DF_Attribute* NewEmpty() const;
+ void Paste(DF_Attribute* into);
+ ~SALOMEDSImpl_AttributeUserID() {}
};
#ifndef __SALOMEDSIMPL_ATTRIBUTES__H__
#define __SALOMEDSIMPL_ATTRIBUTES__H__
-#ifdef WNT
-# ifdef SALOMEDSIMPL_EXPORTS
-# define SALOMEDSIMPL_EXPORT __declspec( dllexport )
-# else
-# define SALOMEDSIMPL_EXPORT __declspec( dllimport )
-# endif
-#else
-# define SALOMEDSIMPL_EXPORT
-#endif
+#include "SALOMEDSImpl_Defines.hxx"
#include <iostream>
class SALOMEDSIMPL_EXPORT LockProtection
#ifndef __SALOMEDSIMPL_CALLBACK_H__
#define __SALOMEDSIMPL_CALLBACK_H__
-
+#include "SALOMEDSImpl_Defines.hxx"
#include "SALOMEDSImpl_UseCaseBuilder.hxx"
-class SALOMEDSImpl_Callback
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_Callback
{
private:
SALOMEDSImpl_UseCaseBuilder* _builder;
public:
- SALOMEDSImpl_Callback(SALOMEDSImpl_UseCaseBuilder* builder)
- {
- _builder = builder;
- }
+ SALOMEDSImpl_Callback(SALOMEDSImpl_UseCaseBuilder* builder)
+ {
+ _builder = builder;
+ }
- virtual void OnAddSObject(const SALOMEDSImpl_SObject& theObject)
- {
- if(_builder != NULL && theObject) _builder->Append(theObject);
- }
+ virtual void OnAddSObject(const SALOMEDSImpl_SObject& theObject)
+ {
+ if(_builder != NULL && theObject) _builder->Append(theObject);
+ }
- virtual void OnRemoveSObject(const SALOMEDSImpl_SObject& theObject)
- {
- if(_builder != NULL && theObject) _builder->Remove(theObject);
- }
+ virtual void OnRemoveSObject(const SALOMEDSImpl_SObject& theObject)
+ {
+ if(_builder != NULL && theObject) _builder->Remove(theObject);
+ }
};
#ifndef __SALOMEDSImpl_CHILDITERATOR_H__
#define __SALOMEDSImpl_CHILDITERATOR_H__
-
+#include "SALOMEDSImpl_Defines.hxx"
#include "SALOMEDSImpl_SObject.hxx"
#include "DF_ChildIterator.hxx"
#include "DF_Label.hxx"
-class SALOMEDSImpl_ChildIterator
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_ChildIterator
{
private:
DF_ChildIterator _it;
public:
- Standard_EXPORT SALOMEDSImpl_ChildIterator() {}
- Standard_EXPORT SALOMEDSImpl_ChildIterator(const SALOMEDSImpl_SObject& theSO);
- Standard_EXPORT SALOMEDSImpl_ChildIterator(const DF_Label& theLabel);
- Standard_EXPORT ~SALOMEDSImpl_ChildIterator() {};
-
- Standard_EXPORT virtual void Init();
- Standard_EXPORT virtual void Init(const DF_Label& theLabel);
- Standard_EXPORT virtual void InitEx(bool theAllLevels);
- Standard_EXPORT virtual void InitEx(const DF_Label& theLabel, bool theAllLevels);
- Standard_EXPORT virtual bool More();
- Standard_EXPORT virtual void Next();
- Standard_EXPORT virtual SALOMEDSImpl_SObject Value();
- Standard_EXPORT virtual DF_Label Label();
-
- Standard_EXPORT SALOMEDSImpl_ChildIterator* GetPersistentCopy() const;
+ SALOMEDSImpl_ChildIterator() {}
+ SALOMEDSImpl_ChildIterator(const SALOMEDSImpl_SObject& theSO);
+ SALOMEDSImpl_ChildIterator(const DF_Label& theLabel);
+ ~SALOMEDSImpl_ChildIterator() {};
+
+ virtual void Init();
+ virtual void Init(const DF_Label& theLabel);
+ virtual void InitEx(bool theAllLevels);
+ virtual void InitEx(const DF_Label& theLabel, bool theAllLevels);
+ virtual bool More();
+ virtual void Next();
+ virtual SALOMEDSImpl_SObject Value();
+ virtual DF_Label Label();
+
+ SALOMEDSImpl_ChildIterator* GetPersistentCopy() const;
};
#endif
#ifndef _SALOMEDSImpl_ChildNodeIterator_HeaderFile
#define _SALOMEDSImpl_ChildNodeIterator_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "SALOMEDSImpl_AttributeTreeNode.hxx"
-class SALOMEDSImpl_ChildNodeIterator
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_ChildNodeIterator
{
public:
-Standard_EXPORT SALOMEDSImpl_ChildNodeIterator();
-Standard_EXPORT SALOMEDSImpl_ChildNodeIterator(const SALOMEDSImpl_AttributeTreeNode* aTreeNode,
- const bool allLevels = false);
-Standard_EXPORT void Initialize(const SALOMEDSImpl_AttributeTreeNode* aTreeNode,
- const bool allLevels = false) ;
-Standard_EXPORT bool More() const { return (myNode); }
-Standard_EXPORT void Next() ;
-Standard_EXPORT void NextBrother() ;
-Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* Value() const { return myNode; }
+ SALOMEDSImpl_ChildNodeIterator();
+ SALOMEDSImpl_ChildNodeIterator(const SALOMEDSImpl_AttributeTreeNode* aTreeNode,
+ const bool allLevels = false);
+ void Initialize(const SALOMEDSImpl_AttributeTreeNode* aTreeNode,
+ const bool allLevels = false) ;
+ bool More() const { return (myNode); }
+ void Next() ;
+ void NextBrother() ;
+ SALOMEDSImpl_AttributeTreeNode* Value() const { return myNode; }
private:
-SALOMEDSImpl_AttributeTreeNode* myNode;
-int myFirstLevel;
+ SALOMEDSImpl_AttributeTreeNode* myNode;
+ int myFirstLevel;
};
--- /dev/null
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : SALOMEDSImpl_Defines.hxx
+// Author : Alexander A. BORODIN
+// Module : KERNEL
+
+#ifndef _SALOMEDSImpl_Defines_HXX_
+#define _SALOMEDSImpl_Defines_HXX_
+
+#ifdef WIN32
+# if defined SALOMEDSIMPL_EXPORTS
+# define SALOMEDSIMPL_EXPORT __declspec( dllexport )
+# else
+# define SALOMEDSIMPL_EXPORT __declspec( dllimport )
+# endif
+#else
+# define SALOMEDSIMPL_EXPORT
+#endif
+
+#endif
#ifndef __SALOMEDSIMPL_DRIVER_H__
#define __SALOMEDSIMPL_DRIVER_H__
+#include "SALOMEDSImpl_Defines.hxx"
#include <string>
-#include <SALOMEDSImpl_SComponent.hxx>
-#include <SALOMEDSImpl_SObject.hxx>
-#include <SALOMEDSImpl_TMPFile.hxx>
+#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
+#include "SALOMEDSImpl_TMPFile.hxx"
-class SALOMEDSImpl_Driver
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_Driver
{
public:
virtual std::string GetIOR() = 0;
virtual SALOMEDSImpl_TMPFile* Save(const SALOMEDSImpl_SComponent& theComponent,
- const std::string& theURL,
- long& theStreamLength,
- bool isMultiFile) = 0;
+ const std::string& theURL,
+ long& theStreamLength,
+ bool isMultiFile) = 0;
virtual SALOMEDSImpl_TMPFile* SaveASCII(const SALOMEDSImpl_SComponent& theComponent,
- const std::string& theURL,
- long& theStreamLength,
- bool isMultiFile) = 0;
-
+ const std::string& theURL,
+ long& theStreamLength,
+ bool isMultiFile) = 0;
+
virtual bool Load(const SALOMEDSImpl_SComponent& theComponent,
- const unsigned char* theStream,
- const long theStreamLength,
- const std::string& theURL,
- bool isMultiFile) = 0;
+ const unsigned char* theStream,
+ const long theStreamLength,
+ const std::string& theURL,
+ bool isMultiFile) = 0;
virtual bool LoadASCII(const SALOMEDSImpl_SComponent& theComponent,
- const unsigned char* theStream,
- const long theStreamLength,
- const std::string& theURL,
- bool isMultiFile) = 0;
+ const unsigned char* theStream,
+ const long theStreamLength,
+ const std::string& theURL,
+ bool isMultiFile) = 0;
virtual void Close(const SALOMEDSImpl_SComponent& theComponent) = 0;
-
+
virtual std::string ComponentDataType() = 0;
virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject,
- const std::string& IORString,
- bool isMultiFile,
- bool isASCII) = 0;
+ const std::string& IORString,
+ bool isMultiFile,
+ bool isASCII) = 0;
virtual std::string LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theSObject,
- const std::string& aLocalPersistentID,
- bool isMultiFile,
- bool isASCII) = 0;
+ const std::string& aLocalPersistentID,
+ bool isMultiFile,
+ bool isASCII) = 0;
virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject) = 0;
virtual SALOMEDSImpl_TMPFile* CopyFrom(const SALOMEDSImpl_SObject& theObject,
- int& theObjectID,
- long& theStreamLength) = 0;
-
+ int& theObjectID,
+ long& theStreamLength) = 0;
+
virtual bool CanPaste(const std::string& theComponentName, int theObjectID) = 0;
virtual std::string PasteInto(const unsigned char* theStream,
- const long theStreamLength,
- int theObjectID,
- const SALOMEDSImpl_SObject& theObject) = 0;
+ const long theStreamLength,
+ int theObjectID,
+ const SALOMEDSImpl_SObject& theObject) = 0;
virtual SALOMEDSImpl_TMPFile* DumpPython(SALOMEDSImpl_Study* theStudy,
- bool isPublished,
- bool& isValidScript,
- long& theStreamLength) = 0;
+ bool isPublished,
+ bool& isValidScript,
+ long& theStreamLength) = 0;
};
class SALOMEDSImpl_DriverFactory
{
public:
-
+
virtual SALOMEDSImpl_Driver* GetDriverByType(const std::string& theComponentType) = 0;
virtual SALOMEDSImpl_Driver* GetDriverByIOR(const std::string& theIOR) = 0;
using namespace std;
-char* SALOMEDSImpl_GenericAttribute::Impl_GetType(DF_Attribute* theAttr)
+string SALOMEDSImpl_GenericAttribute::Impl_GetType(DF_Attribute* theAttr)
{
SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
- return (char*)ga->Type().c_str();
+ if (ga)
+ return ga->Type();
+
+ return "";
}
-char* SALOMEDSImpl_GenericAttribute::Impl_GetClassType(DF_Attribute* theAttr)
+string SALOMEDSImpl_GenericAttribute::Impl_GetClassType(DF_Attribute* theAttr)
{
SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
- return (char*)ga->GetClassType().c_str();
+ if (ga)
+ return ga->GetClassType();
+
+ return "";
}
void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(DF_Attribute* theAttr)
#ifndef _GENERICIMPL_ATTRIBUTE_HXX_
#define _GENERICIMPL_ATTRIBUTE_HXX_
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Label.hxx"
#include "DF_Attribute.hxx"
#include <string>
#include "SALOMEDSImpl_SObject.hxx"
-class SALOMEDSImpl_GenericAttribute: public DF_Attribute
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_GenericAttribute:
+ public DF_Attribute
{
protected:
public:
-Standard_EXPORT SALOMEDSImpl_GenericAttribute(const std::string& theType)
-:_type(theType)
-{}
+ SALOMEDSImpl_GenericAttribute(const std::string& theType)
+ :_type(theType)
+ {}
-Standard_EXPORT virtual std::string Type();
-Standard_EXPORT virtual void CheckLocked();
-Standard_EXPORT std::string GetClassType() { return _type; }
-Standard_EXPORT SALOMEDSImpl_SObject GetSObject();
-Standard_EXPORT void SetModifyFlag();
+ virtual std::string Type();
+ virtual void CheckLocked();
+ std::string GetClassType() { return _type; }
+ SALOMEDSImpl_SObject GetSObject();
+ void SetModifyFlag();
-Standard_EXPORT static char* Impl_GetType(DF_Attribute* theAttr);
-Standard_EXPORT static char* Impl_GetClassType(DF_Attribute* theAttr);
-Standard_EXPORT static void Impl_CheckLocked(DF_Attribute* theAttr);
+ static std::string Impl_GetType(DF_Attribute* theAttr);
+ static std::string Impl_GetClassType(DF_Attribute* theAttr);
+ static void Impl_CheckLocked(DF_Attribute* theAttr);
};
#ifndef SALOMEDSImpl_IParameters_H
#define SALOMEDSImpl_IParameters_H
+#include "SALOMEDSImpl_Defines.hxx"
#include <string>
#include <vector>
#include <map>
#include "SALOMEDSImpl_Study.hxx"
/*!
- Class which an interface to store the parameters of the objects
+Class which an interface to store the parameters of the objects
*/
-class Standard_EXPORT SALOMEDSImpl_IParameters
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_IParameters
{
public:
SALOMEDSImpl_IParameters(SALOMEDSImpl_AttributeParameter* ap);
virtual ~SALOMEDSImpl_IParameters();
/*!
- Appends a string value to a named list.
- Returns a number of the added value.
- Note: the name of the list MUST be unique
- */
+ Appends a string value to a named list.
+ Returns a number of the added value.
+ Note: the name of the list MUST be unique
+ */
virtual int append(const std::string& listName, const std::string& value);
/*!
- Returns a number elements in the list
- */
+ Returns a number elements in the list
+ */
virtual int nbValues(const std::string& listName);
/*!
- Returns a list of values in the list
- */
+ Returns a list of values in the list
+ */
virtual std::vector<std::string> getValues(const std::string& listName);
/*!
- Returns a value with given %index, where %index is in range [0:nbValues-1]
- */
+ Returns a value with given %index, where %index is in range [0:nbValues-1]
+ */
virtual std::string getValue(const std::string& listName, int index);
/*!
- Returns a list all entries lists
- */
+ Returns a list all entries lists
+ */
virtual std::vector<std::string> getLists();
/*!
- Sets a new named parameter value for the given entry
- */
+ Sets a new named parameter value for the given entry
+ */
virtual void setParameter(const std::string& entry, const std::string& parameterName, const std::string& value);
/*!
- Gets a named parameter value for the given entry
- */
+ Gets a named parameter value for the given entry
+ */
virtual std::string getParameter(const std::string& entry, const std::string& parameterName);
/*!
- Returns all parameter names of the given entry
- */
+ Returns all parameter names of the given entry
+ */
virtual std::vector<std::string> getAllParameterNames(const std::string& entry);
/*!
- Returns all parameter values of the given entry
- */
+ Returns all parameter values of the given entry
+ */
virtual std::vector<std::string> getAllParameterValues(const std::string& entry);
/*!
- Returns a number of parameters of the given entry
- */
+ Returns a number of parameters of the given entry
+ */
virtual int getNbParameters(const std::string& entry);
/*!
- Returns a list all entries
- */
+ Returns a list all entries
+ */
virtual std::vector<std::string> getEntries();
/*!
- Sets a global named property value
- */
+ Sets a global named property value
+ */
virtual void setProperty(const std::string& name, const std::string& value);
/*!
- Gets a value of global named property
- */
+ Gets a value of global named property
+ */
virtual std::string getProperty(const std::string& name);
/*!
- Returns a list all properties
- */
+ Returns a list all properties
+ */
virtual std::vector<std::string> getProperties();
/*!
- Returns decoded entry that is an absolute entry
- */
+ Returns decoded entry that is an absolute entry
+ */
virtual std::string decodeEntry(const std::string& entry);
/*!
- Returns whether there is the dumping visual parameters
- */
+ Returns whether there is the dumping visual parameters
+ */
static bool isDumpPython(SALOMEDSImpl_Study* study, const std::string& theID = "");
/*!
- Returns an ID of the last save point
+ Returns an ID of the last save point
*/
static int getLastSavePoint(SALOMEDSImpl_Study* study, const std::string& theID = "");
/*!
- Returns a Python script for the study, which sets up visual parameters
+ Returns a Python script for the study, which sets up visual parameters
*/
static std::string getStudyScript(SALOMEDSImpl_Study* study, int savePoint, const std::string& theID = "");
/*!
- Returns a default Python script that set ups visual parameters for the given module
- shift is a string that contain spaces to make valid Python script indentaion
+ Returns a default Python script that set ups visual parameters for the given module
+ shift is a string that contain spaces to make valid Python script indentaion
*/
static std::string getDefaultScript(SALOMEDSImpl_Study* study,
- const std::string& moduleName,
- const std::string& shift,
- const std::string& theID = "");
+ const std::string& moduleName,
+ const std::string& shift,
+ const std::string& theID = "");
/*!
- Returns a default name of the component where the visula parameters are stored.
+ Returns a default name of the component where the visula parameters are stored.
*/
static std::string getDefaultVisualComponent();
#define __SALOMEDSIMPL_SCOMPONENT_H__
//SALOMEDSImpl headers
+#include "SALOMEDSImpl_Defines.hxx"
#include "SALOMEDSImpl_SObject.hxx"
// std C++ headers
#include <iostream>
#include <string>
-// Cascade headers
#include "DF_Label.hxx"
#include "SALOMEDSImpl_SObject.hxx"
#include <stdio.h>
-class SALOMEDSImpl_SComponent : public virtual SALOMEDSImpl_SObject
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_SComponent :
+ public virtual SALOMEDSImpl_SObject
{
public:
-
- Standard_EXPORT SALOMEDSImpl_SComponent();
- Standard_EXPORT SALOMEDSImpl_SComponent(const SALOMEDSImpl_SComponent& theSCO);
- Standard_EXPORT SALOMEDSImpl_SComponent(const DF_Label& lab);
-
- Standard_EXPORT ~SALOMEDSImpl_SComponent();
-
- Standard_EXPORT virtual std::string ComponentDataType();
- Standard_EXPORT virtual bool ComponentIOR(std::string& theID);
-
- Standard_EXPORT static bool IsA(const DF_Label& theLabel);
-
- Standard_EXPORT SALOMEDSImpl_SComponent* GetPersistentCopy() const;
+
+ SALOMEDSImpl_SComponent();
+ SALOMEDSImpl_SComponent(const SALOMEDSImpl_SComponent& theSCO);
+ SALOMEDSImpl_SComponent(const DF_Label& lab);
+
+ ~SALOMEDSImpl_SComponent();
+
+ virtual std::string ComponentDataType();
+ virtual bool ComponentIOR(std::string& theID);
+
+ static bool IsA(const DF_Label& theLabel);
+
+ SALOMEDSImpl_SComponent* GetPersistentCopy() const;
};
#endif
//SALOMEDSImpl headers
+#include "SALOMEDSImpl_Defines.hxx"
#include "SALOMEDSImpl_SComponent.hxx"
-// Cascade headers
#include "DF_ChildIterator.hxx"
#include "DF_Label.hxx"
#include "DF_Document.hxx"
#include <stdio.h>
-class Standard_EXPORT SALOMEDSImpl_SComponentIterator
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_SComponentIterator
{
private:
DF_Label _lab;
public:
-
+
SALOMEDSImpl_SComponentIterator(const SALOMEDSImpl_SComponentIterator& theIterator)
{
_it = theIterator._it;
}
SALOMEDSImpl_SComponentIterator() {};
-
+
SALOMEDSImpl_SComponentIterator(DF_Document* theDocument);
-
+
~SALOMEDSImpl_SComponentIterator() {};
-
+
virtual void Init();
virtual bool More();
virtual void Next();
#ifndef __SALOMEDSIMPL_SOBJECT_H__
#define __SALOMEDSIMPL_SOBJECT_H__
+#include "SALOMEDSImpl_Defines.hxx"
+
#include "DF_Label.hxx"
#include "DF_Attribute.hxx"
#include <string>
class SALOMEDSImpl_SComponent;
class SALOMEDSImpl_Study;
-class SALOMEDSImpl_SObject
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_SObject
{
protected:
DF_Label _lab;
std::string _type;
public:
-
- Standard_EXPORT SALOMEDSImpl_SObject();
- Standard_EXPORT SALOMEDSImpl_SObject(const DF_Label& theLabel);
- Standard_EXPORT SALOMEDSImpl_SObject(const SALOMEDSImpl_SObject& theSObject);
- Standard_EXPORT virtual ~SALOMEDSImpl_SObject();
-
- Standard_EXPORT virtual std::string GetID() const;
- Standard_EXPORT virtual SALOMEDSImpl_SComponent GetFatherComponent() const;
- Standard_EXPORT virtual SALOMEDSImpl_SObject GetFather() const ;
- Standard_EXPORT virtual bool FindAttribute(DF_Attribute*& theAttribute, const std::string& theTypeOfAttribute) const;
- Standard_EXPORT virtual bool ReferencedObject(SALOMEDSImpl_SObject& theObject) const ;
- Standard_EXPORT virtual bool FindSubObject(int theTag, SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudy() const;
- Standard_EXPORT virtual std::string Name() const { return _name; }
- Standard_EXPORT virtual void Name(const std::string& theName) { _name = theName; }
- Standard_EXPORT virtual std::vector<DF_Attribute*> GetAllAttributes() const;
+ SALOMEDSImpl_SObject();
+ SALOMEDSImpl_SObject(const DF_Label& theLabel);
+ SALOMEDSImpl_SObject(const SALOMEDSImpl_SObject& theSObject);
+ virtual ~SALOMEDSImpl_SObject();
+
+ virtual std::string GetID() const;
+ virtual SALOMEDSImpl_SComponent GetFatherComponent() const;
+ virtual SALOMEDSImpl_SObject GetFather() const ;
+ virtual bool FindAttribute(DF_Attribute*& theAttribute, const std::string& theTypeOfAttribute) const;
+ virtual bool ReferencedObject(SALOMEDSImpl_SObject& theObject) const ;
+ virtual bool FindSubObject(int theTag, SALOMEDSImpl_SObject& theObject);
+
+ virtual SALOMEDSImpl_Study* GetStudy() const;
+ virtual std::string Name() const { return _name; }
+ virtual void Name(const std::string& theName) { _name = theName; }
+ virtual std::vector<DF_Attribute*> GetAllAttributes() const;
+
+ virtual std::string GetName() const ;
+ virtual std::string GetComment() const;
+ virtual std::string GetIOR() const;
+
+ virtual int Tag() const { return _lab.Tag(); }
+ virtual int Depth() const { return _lab.Depth(); }
- Standard_EXPORT virtual std::string GetName() const ;
- Standard_EXPORT virtual std::string GetComment() const;
- Standard_EXPORT virtual std::string GetIOR() const;
+ virtual DF_Label GetLabel() const { return _lab; }
- Standard_EXPORT virtual int Tag() const { return _lab.Tag(); }
- Standard_EXPORT virtual int Depth() const { return _lab.Depth(); }
+ bool IsNull() const { return _lab.IsNull(); }
- Standard_EXPORT virtual DF_Label GetLabel() const { return _lab; }
+ bool IsComponent() const;
- Standard_EXPORT bool IsNull() const { return _lab.IsNull(); }
+ operator SALOMEDSImpl_SComponent() const;
- Standard_EXPORT bool IsComponent() const;
+ operator bool () const { return !IsNull(); }
- Standard_EXPORT operator SALOMEDSImpl_SComponent() const;
+ SALOMEDSImpl_SObject* GetPersistentCopy() const;
- Standard_EXPORT operator bool () const { return !IsNull(); }
-
- Standard_EXPORT SALOMEDSImpl_SObject* GetPersistentCopy() const;
+ static std::string GetGUID(const std::string& theTypeOfAttribute);
- Standard_EXPORT static std::string GetGUID(const std::string& theTypeOfAttribute);
-
};
#endif
#include <vector>
#include <map>
-// Cascade headers
#include "DF_Document.hxx"
#include "DF_Label.hxx"
#include <stdio.h>
//SALOMEDSImpl headers
+#include "SALOMEDSImpl_Defines.hxx"
#include "SALOMEDSImpl_SComponentIterator.hxx"
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_StudyBuilder.hxx"
class SALOMEDSImpl_GenericAttribute;
-class SALOMEDSImpl_Study
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_Study
{
private:
std::string _name;
std::map<std::string, SALOMEDSImpl_SObject> _mapOfSO;
std::map<std::string, SALOMEDSImpl_SComponent> _mapOfSCO;
std::map<std::string, DF_Label> myIORLabels;
-
+
SALOMEDSImpl_SObject _FindObject(const SALOMEDSImpl_SObject& SO,
- const std::string& anObjectName,
- bool& _find);
-
+ const std::string& anObjectName,
+ bool& _find);
+
SALOMEDSImpl_SObject _FindObjectIOR(const SALOMEDSImpl_SObject& SO,
- const std::string& anObjectIOR,
- bool& _find);
+ const std::string& anObjectIOR,
+ bool& _find);
public:
- Standard_EXPORT static SALOMEDSImpl_Study* GetStudy(const DF_Label& theLabel);
- Standard_EXPORT static SALOMEDSImpl_SObject SObject(const DF_Label& theLabel);
- Standard_EXPORT static SALOMEDSImpl_SComponent SComponent(const DF_Label& theLabel);
- Standard_EXPORT static void IORUpdated(const SALOMEDSImpl_AttributeIOR* theAttribute);
+ static SALOMEDSImpl_Study* GetStudy(const DF_Label& theLabel);
+ static SALOMEDSImpl_SObject SObject(const DF_Label& theLabel);
+ static SALOMEDSImpl_SComponent SComponent(const DF_Label& theLabel);
+ static void IORUpdated(const SALOMEDSImpl_AttributeIOR* theAttribute);
- //! standard constructor
- Standard_EXPORT SALOMEDSImpl_Study(const DF_Document*, const std::string& study_name);
+ //! standard constructor
+ SALOMEDSImpl_Study(const DF_Document*, const std::string& study_name);
//! standard destructor
- Standard_EXPORT virtual ~SALOMEDSImpl_Study();
+ virtual ~SALOMEDSImpl_Study();
//! method to Get persistent reference of study (idem URL())
- Standard_EXPORT virtual std::string GetPersistentReference();
+ virtual std::string GetPersistentReference();
//! method to Get transient reference of study
- Standard_EXPORT virtual std::string GetTransientReference();
+ virtual std::string GetTransientReference();
- Standard_EXPORT virtual void SetTransientReference(const std::string& theIOR);
+ virtual void SetTransientReference(const std::string& theIOR);
//! method to detect if a study is empty
- Standard_EXPORT virtual bool IsEmpty();
+ virtual bool IsEmpty();
//! method to Find a Component with ComponentDataType = aComponentName
- Standard_EXPORT virtual SALOMEDSImpl_SComponent FindComponent (const std::string& aComponentName);
+ virtual SALOMEDSImpl_SComponent FindComponent (const std::string& aComponentName);
//! method to Find a Component Find a Component from it's ID
- Standard_EXPORT virtual SALOMEDSImpl_SComponent FindComponentID(const std::string& aComponentID);
+ virtual SALOMEDSImpl_SComponent FindComponentID(const std::string& aComponentID);
//! method to Find an Object with SALOMEDSImpl::Name = anObjectName
- Standard_EXPORT virtual SALOMEDSImpl_SObject FindObject(const std::string& anObjectName);
+ virtual SALOMEDSImpl_SObject FindObject(const std::string& anObjectName);
//! method to Find Object(s) with SALOMEDSImpl::Name=anObjectName in a component with ComponentDataType = aComponentName
- Standard_EXPORT virtual std::vector<SALOMEDSImpl_SObject> FindObjectByName( const std::string& anObjectName,
+ virtual std::vector<SALOMEDSImpl_SObject> FindObjectByName( const std::string& anObjectName,
const std::string& aComponentName ) ;
//! method to Find an Object with ID = anObjectID
- Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectID(const std::string& anObjectID);
-
+ virtual SALOMEDSImpl_SObject FindObjectID(const std::string& anObjectID);
+
//! method to Create an Object with ID = anObjectID
- Standard_EXPORT virtual SALOMEDSImpl_SObject CreateObjectID(const std::string& anObjectID);
+ virtual SALOMEDSImpl_SObject CreateObjectID(const std::string& anObjectID);
//! method to Find an Object with ID = anObjectIOR
- Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectIOR(const std::string& anObjectIOR);
+ virtual SALOMEDSImpl_SObject FindObjectIOR(const std::string& anObjectIOR);
//! method to Find an Object by its path
- Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectByPath(const std::string& thePath);
+ virtual SALOMEDSImpl_SObject FindObjectByPath(const std::string& thePath);
//! method to get a path of SObject
- Standard_EXPORT virtual std::string GetObjectPath(const SALOMEDSImpl_SObject& theObject);
+ virtual std::string GetObjectPath(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT std::string GetObjectPathByIOR(const std::string& theIOR);
+ std::string GetObjectPathByIOR(const std::string& theIOR);
//! method to set a context: root ('/') is UserData component
- Standard_EXPORT virtual bool SetContext(const std::string& thePath);
+ virtual bool SetContext(const std::string& thePath);
//! method to get a context
- Standard_EXPORT virtual std::string GetContext();
+ virtual std::string GetContext();
//! method to get all object names in the given context (or in the current context, if 'theContext' is empty)
- Standard_EXPORT virtual std::vector<std::string> GetObjectNames(const std::string& theContext);
+ virtual std::vector<std::string> GetObjectNames(const std::string& theContext);
//! method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
- Standard_EXPORT virtual std::vector<std::string> GetDirectoryNames(const std::string& theContext);
+ virtual std::vector<std::string> GetDirectoryNames(const std::string& theContext);
//! method to get all file names in the given context (or in the current context, if 'theContext' is empty)
- Standard_EXPORT virtual std::vector<std::string> GetFileNames(const std::string& theContext);
+ virtual std::vector<std::string> GetFileNames(const std::string& theContext);
//! method to get all components names
- Standard_EXPORT virtual std::vector<std::string> GetComponentNames(const std::string& theContext);
+ virtual std::vector<std::string> GetComponentNames(const std::string& theContext);
//! method to Create a ChildIterator from an SObject
- Standard_EXPORT virtual SALOMEDSImpl_ChildIterator NewChildIterator(const SALOMEDSImpl_SObject& aSO);
+ virtual SALOMEDSImpl_ChildIterator NewChildIterator(const SALOMEDSImpl_SObject& aSO);
//! method to Create a SComponentIterator
- Standard_EXPORT virtual SALOMEDSImpl_SComponentIterator NewComponentIterator();
+ virtual SALOMEDSImpl_SComponentIterator NewComponentIterator();
//! method to Create a StudyBuilder
- Standard_EXPORT virtual SALOMEDSImpl_StudyBuilder* NewBuilder();
+ virtual SALOMEDSImpl_StudyBuilder* NewBuilder();
//! method to get study name
- Standard_EXPORT virtual std::string Name();
+ virtual std::string Name();
//! method to set study name
- Standard_EXPORT virtual void Name(const std::string& name);
-
+ virtual void Name(const std::string& name);
+
//! method to get if study has been saved
- Standard_EXPORT virtual bool IsSaved();
+ virtual bool IsSaved();
//! method to set if study has been saved
- Standard_EXPORT virtual void IsSaved(bool save);
+ virtual void IsSaved(bool save);
//! method to Detect if a Study has been modified since it has been saved
- Standard_EXPORT virtual bool IsModified();
-
+ virtual bool IsModified();
+
//! method to get URL of the study (idem GetPersistentReference)
- Standard_EXPORT virtual std::string URL();
+ virtual std::string URL();
//! method to set URL of the study
- Standard_EXPORT virtual void URL(const std::string& url);
-
- Standard_EXPORT virtual bool IsLocked();
-
- Standard_EXPORT virtual int StudyId();
-
- Standard_EXPORT virtual void StudyId(int id);
+ virtual void URL(const std::string& url);
- Standard_EXPORT virtual void UpdateIORLabelMap(const std::string& anIOR, const std::string& aLabel);
+ virtual bool IsLocked();
- Standard_EXPORT virtual std::vector<SALOMEDSImpl_SObject> FindDependances(const SALOMEDSImpl_SObject& anObject);
-
- Standard_EXPORT virtual SALOMEDSImpl_AttributeStudyProperties* GetProperties();
-
- Standard_EXPORT virtual std::string GetLastModificationDate();
-
- Standard_EXPORT virtual std::vector<std::string> GetModificationsDate();
-
- Standard_EXPORT virtual SALOMEDSImpl_UseCaseBuilder* GetUseCaseBuilder();
+ virtual int StudyId();
- Standard_EXPORT virtual void Close();
-
- Standard_EXPORT void EnableUseCaseAutoFilling(bool isEnabled);
-
- Standard_EXPORT virtual std::string GetErrorCode() { return _errorCode; }
- Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
-
- Standard_EXPORT virtual SALOMEDSImpl_SComponent GetSComponent(const std::string& theEntry);
- Standard_EXPORT virtual SALOMEDSImpl_SComponent GetSComponent(const DF_Label& theLabel);
- Standard_EXPORT virtual SALOMEDSImpl_SObject GetSObject(const std::string& theEntry);
- Standard_EXPORT virtual SALOMEDSImpl_SObject GetSObject(const DF_Label& theEntryLabel);
- Standard_EXPORT virtual DF_Attribute* GetAttribute(const std::string& theEntry,
+ virtual void StudyId(int id);
+
+ virtual void UpdateIORLabelMap(const std::string& anIOR, const std::string& aLabel);
+
+ virtual std::vector<SALOMEDSImpl_SObject> FindDependances(const SALOMEDSImpl_SObject& anObject);
+
+ virtual SALOMEDSImpl_AttributeStudyProperties* GetProperties();
+
+ virtual std::string GetLastModificationDate();
+
+ virtual std::vector<std::string> GetModificationsDate();
+
+ virtual SALOMEDSImpl_UseCaseBuilder* GetUseCaseBuilder();
+
+ virtual void Close();
+
+ void EnableUseCaseAutoFilling(bool isEnabled);
+
+ virtual std::string GetErrorCode() { return _errorCode; }
+ virtual bool IsError() { return _errorCode != ""; }
+
+ virtual SALOMEDSImpl_SComponent GetSComponent(const std::string& theEntry);
+ virtual SALOMEDSImpl_SComponent GetSComponent(const DF_Label& theLabel);
+ virtual SALOMEDSImpl_SObject GetSObject(const std::string& theEntry);
+ virtual SALOMEDSImpl_SObject GetSObject(const DF_Label& theEntryLabel);
+ virtual DF_Attribute* GetAttribute(const std::string& theEntry,
const std::string& theType);
- Standard_EXPORT virtual bool HasCurrentContext() { return !_current.IsNull(); }
+ virtual bool HasCurrentContext() { return !_current.IsNull(); }
- Standard_EXPORT virtual bool DumpStudy(const std::string& thePath,
+ virtual bool DumpStudy(const std::string& thePath,
const std::string& theBaseName,
bool isPublished,
SALOMEDSImpl_DriverFactory* theFactory);
- Standard_EXPORT static std::string GetDumpStudyComment(const char* theComponentName = 0);
-
- Standard_EXPORT virtual DF_Document* GetDocument() { return _doc; }
+ static std::string GetDumpStudyComment(const char* theComponentName = 0);
+
+ virtual DF_Document* GetDocument() { return _doc; }
//The method dump creates a txt file that contain a dump of the study, for debug use
- Standard_EXPORT void dump(const std::string& theFileName);
+ void dump(const std::string& theFileName);
//This method marks the study as being modified
- Standard_EXPORT void Modify();
+ void Modify();
- Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetCommonParameters(const char* theID, int theSavePoint);
+ SALOMEDSImpl_AttributeParameter* GetCommonParameters(const char* theID, int theSavePoint);
- Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetModuleParameters(const char* theID,
+ SALOMEDSImpl_AttributeParameter* GetModuleParameters(const char* theID,
const char* theModuleName,
int theSavePoint);
//Locks the study, theLockerID is identificator of the of the one who locked the study for ex. IOR
- Standard_EXPORT void SetStudyLock(const char* theLockerID);
+ void SetStudyLock(const char* theLockerID);
//Returns True if the study is locked
- Standard_EXPORT bool IsStudyLocked();
+ bool IsStudyLocked();
//Unlocks the study
- Standard_EXPORT void UnLockStudy(const char* theLockerID);
+ void UnLockStudy(const char* theLockerID);
//Returns an ID of the study locker
- Standard_EXPORT std::vector<std::string> GetLockerID();
+ std::vector<std::string> GetLockerID();
//Returns a callback
- Standard_EXPORT SALOMEDSImpl_Callback* GetCallback() { return _cb; }
+ SALOMEDSImpl_Callback* GetCallback() { return _cb; }
//Returns a list of IOR's stored in the study
- Standard_EXPORT std::vector<std::string> GetIORs();
-
+ std::vector<std::string> GetIORs();
-friend class SALOMEDSImpl_StudyManager;
-friend class SALOMEDSImpl_GenericAttribute;
+ friend class SALOMEDSImpl_StudyManager;
+ friend class SALOMEDSImpl_GenericAttribute;
};
#endif
#ifndef __SALOMEDSImpl_STUDYBUILDER_H__
#define __SALOMEDSImpl_STUDYBUILDER_H__
+#include "SALOMEDSImpl_Defines.hxx"
// std C++ headers
#include <iostream>
#include <string>
#include <vector>
-
+
#include "SALOMEDSImpl_Callback.hxx"
#include "SALOMEDSImpl_Driver.hxx"
class SALOMEDSImpl_Study;
-class SALOMEDSImpl_StudyBuilder
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_StudyBuilder
{
private:
DF_Document* _doc;
std::string _errorCode;
public:
-
- Standard_EXPORT SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner);
- Standard_EXPORT ~SALOMEDSImpl_StudyBuilder();
+ SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner);
+
+ ~SALOMEDSImpl_StudyBuilder();
+
+ virtual SALOMEDSImpl_SComponent NewComponent(const std::string& ComponentDataType);
- Standard_EXPORT virtual SALOMEDSImpl_SComponent NewComponent(const std::string& ComponentDataType);
+ virtual bool DefineComponentInstance (const SALOMEDSImpl_SComponent&, const std::string& ComponentIOR);
- Standard_EXPORT virtual bool DefineComponentInstance (const SALOMEDSImpl_SComponent&, const std::string& ComponentIOR);
-
- Standard_EXPORT virtual bool RemoveComponent(const SALOMEDSImpl_SComponent& aComponent);
+ virtual bool RemoveComponent(const SALOMEDSImpl_SComponent& aComponent);
- Standard_EXPORT virtual SALOMEDSImpl_SObject NewObject(const SALOMEDSImpl_SObject& theFatherObject);
+ virtual SALOMEDSImpl_SObject NewObject(const SALOMEDSImpl_SObject& theFatherObject);
- Standard_EXPORT virtual SALOMEDSImpl_SObject NewObjectToTag(const SALOMEDSImpl_SObject& theFatherObject,
- const int theTag);
+ virtual SALOMEDSImpl_SObject NewObjectToTag(const SALOMEDSImpl_SObject& theFatherObject,
+ const int theTag);
//! The methods adds a new subdirectory, the path can be absolute or relative (then the current context is used)
- Standard_EXPORT virtual bool AddDirectory(const std::string& thePath);
+ virtual bool AddDirectory(const std::string& thePath);
- Standard_EXPORT virtual bool LoadWith(const SALOMEDSImpl_SComponent& sco, SALOMEDSImpl_Driver* Engine);
- Standard_EXPORT virtual bool Load(const SALOMEDSImpl_SObject& sco);
+ virtual bool LoadWith(const SALOMEDSImpl_SComponent& sco, SALOMEDSImpl_Driver* Engine);
+ virtual bool Load(const SALOMEDSImpl_SObject& sco);
- Standard_EXPORT virtual bool RemoveObject(const SALOMEDSImpl_SObject& anObject);
- Standard_EXPORT virtual bool RemoveObjectWithChildren(const SALOMEDSImpl_SObject& anObject);
+ virtual bool RemoveObject(const SALOMEDSImpl_SObject& anObject);
+ virtual bool RemoveObjectWithChildren(const SALOMEDSImpl_SObject& anObject);
- Standard_EXPORT virtual DF_Attribute* FindOrCreateAttribute(const SALOMEDSImpl_SObject& anObject,
- const std::string& aTypeOfAttribute);
- Standard_EXPORT virtual bool FindAttribute(const SALOMEDSImpl_SObject& anObject,
- DF_Attribute*& anAttribute,
- const std::string& aTypeOfAttribute);
+ virtual DF_Attribute* FindOrCreateAttribute(const SALOMEDSImpl_SObject& anObject,
+ const std::string& aTypeOfAttribute);
+ virtual bool FindAttribute(const SALOMEDSImpl_SObject& anObject,
+ DF_Attribute*& anAttribute,
+ const std::string& aTypeOfAttribute);
- Standard_EXPORT virtual bool RemoveAttribute(const SALOMEDSImpl_SObject& anObject, const std::string& aTypeOfAttribute);
+ virtual bool RemoveAttribute(const SALOMEDSImpl_SObject& anObject, const std::string& aTypeOfAttribute);
- Standard_EXPORT virtual bool Addreference(const SALOMEDSImpl_SObject& me,
- const SALOMEDSImpl_SObject& thereferencedObject);
+ virtual bool Addreference(const SALOMEDSImpl_SObject& me,
+ const SALOMEDSImpl_SObject& thereferencedObject);
- Standard_EXPORT virtual bool RemoveReference(const SALOMEDSImpl_SObject& me);
+ virtual bool RemoveReference(const SALOMEDSImpl_SObject& me);
- Standard_EXPORT virtual bool SetGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID);
- Standard_EXPORT virtual bool IsGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID);
+ virtual bool SetGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID);
+ virtual bool IsGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID);
- Standard_EXPORT virtual void NewCommand();
- Standard_EXPORT virtual void CommitCommand();
- Standard_EXPORT virtual bool HasOpenCommand();
- Standard_EXPORT virtual void AbortCommand();
- Standard_EXPORT virtual void Undo();
- Standard_EXPORT virtual void Redo();
- Standard_EXPORT bool GetAvailableUndos();
- Standard_EXPORT bool GetAvailableRedos();
- Standard_EXPORT bool IsSaved();
- Standard_EXPORT bool IsModified();
- Standard_EXPORT virtual int UndoLimit();
- Standard_EXPORT virtual void UndoLimit(const int);
+ virtual void NewCommand();
+ virtual void CommitCommand();
+ virtual bool HasOpenCommand();
+ virtual void AbortCommand();
+ virtual void Undo();
+ virtual void Redo();
+ bool GetAvailableUndos();
+ bool GetAvailableRedos();
+ bool IsSaved();
+ bool IsModified();
+ virtual int UndoLimit();
+ virtual void UndoLimit(const int);
- Standard_EXPORT void CheckLocked();
+ void CheckLocked();
- Standard_EXPORT virtual SALOMEDSImpl_Callback* SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback);
- Standard_EXPORT virtual SALOMEDSImpl_Callback* SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback);
+ virtual SALOMEDSImpl_Callback* SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback);
+ virtual SALOMEDSImpl_Callback* SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback);
- Standard_EXPORT virtual bool SetName(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
+ virtual bool SetName(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
- Standard_EXPORT virtual bool SetComment(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
+ virtual bool SetComment(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
- Standard_EXPORT virtual bool SetIOR(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
+ virtual bool SetIOR(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
- Standard_EXPORT virtual std::string GetErrorCode() { return _errorCode; }
- Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
+ virtual std::string GetErrorCode() { return _errorCode; }
+ virtual bool IsError() { return _errorCode != ""; }
- Standard_EXPORT virtual SALOMEDSImpl_Study* GetOwner() { return _study; }
+ virtual SALOMEDSImpl_Study* GetOwner() { return _study; }
};
#endif
#ifndef SALOMEDSImpl_StudyHandle_HeaderFile
#define SALOMEDSImpl_StudyHandle_HeaderFile
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_Attribute.hxx"
#include "DF_Label.hxx"
/*
- Class : SALOMEDSImpl_StudyHandle
- Description : PRIVATE: This class is intended for storing of the study handle
+Class : SALOMEDSImpl_StudyHandle
+Description : PRIVATE: This class is intended for storing of the study handle
*/
#include "SALOMEDSImpl_Study.hxx"
-#ifndef WNT
-class Standard_EXPORT SALOMEDSImpl_StudyHandle : public DF_Attribute
-#else
-class SALOMEDSImpl_StudyHandle : public DF_Attribute
-#endif
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_StudyHandle :
+ public DF_Attribute
{
public:
-Standard_EXPORT SALOMEDSImpl_StudyHandle();
-Standard_EXPORT ~SALOMEDSImpl_StudyHandle() {; }
-
-Standard_EXPORT static SALOMEDSImpl_StudyHandle* Set(const DF_Label& theLabel, SALOMEDSImpl_Study* theStudy);
-Standard_EXPORT static const std::string& GetID() ;
-
-Standard_EXPORT void Set(SALOMEDSImpl_Study* theStudy) { myHandle = theStudy; }
-Standard_EXPORT SALOMEDSImpl_Study* Get() { return myHandle; }
-Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT void Restore( DF_Attribute* theWith );
-Standard_EXPORT DF_Attribute* NewEmpty() const;
-Standard_EXPORT void Paste( DF_Attribute* theInto);
-
+ SALOMEDSImpl_StudyHandle();
+ ~SALOMEDSImpl_StudyHandle() {; }
+
+ static SALOMEDSImpl_StudyHandle* Set(const DF_Label& theLabel, SALOMEDSImpl_Study* theStudy);
+ static const std::string& GetID() ;
+
+ void Set(SALOMEDSImpl_Study* theStudy) { myHandle = theStudy; }
+ SALOMEDSImpl_Study* Get() { return myHandle; }
+ const std::string& ID() const;
+ void Restore( DF_Attribute* theWith );
+ DF_Attribute* NewEmpty() const;
+ void Paste( DF_Attribute* theInto);
+
private:
SALOMEDSImpl_Study* myHandle;
}
catch (HDFexception)
{
-//#ifndef WNT
-// char eStr[strlen(aUrl.ToCString())+17];
-//#else
- char *eStr;
- eStr = new char[strlen(aUrl.c_str())+17];
-//#endif
- sprintf(eStr,"Can't open file %s",aUrl.c_str());
-//#ifdef WNT
- delete [] eStr;
-//#endif
- _errorCode = string(eStr);
- return NULL;
+ char *eStr;
+ eStr = new char[strlen(aUrl.c_str())+17];
+ sprintf(eStr,"Can't open file %s",aUrl.c_str());
+ delete [] eStr;
+ _errorCode = string(eStr);
+ return NULL;
}
// Temporary aStudyUrl in place of study name
}
catch (HDFexception)
{
-//#ifndef WNT
-// char eStr[strlen(aUrl.ToCString())+17];
-//#else
- char *eStr = new char [strlen(aUrl.c_str())+17];
-//#endif
+ char *eStr = new char [strlen(aUrl.c_str())+17];
sprintf(eStr,"Can't open file %s", aUrl.c_str());
_errorCode = string(eStr);
return NULL;
HDFdataset *hdf_dataset =0;
hdf_size size[1];
hdf_int32 name_len = 0;
- char *component_name = 0;
+ string component_name;
if(!aStudy) {
_errorCode = "Study is null";
hdf_sco_group2->CreateOnDisk();
SaveAttributes(SC, hdf_sco_group2);
// ComponentDataType treatment
- component_name = (char*)SC.ComponentDataType().c_str();
- name_len = (hdf_int32)strlen(component_name);
+ component_name = SC.ComponentDataType();
+ name_len = (hdf_int32)component_name.length();
size[0] = name_len +1 ;
hdf_dataset = new HDFdataset("COMPONENTDATATYPE",hdf_sco_group2,HDF_STRING,size,1);
hdf_dataset->CreateOnDisk();
- hdf_dataset->WriteOnDisk(component_name);
+ hdf_dataset->WriteOnDisk((char*)component_name.c_str());
hdf_dataset->CloseOnDisk();
hdf_dataset=0; //will be deleted by hdf_sco_group destructor
Impl_SaveObject(SC, hdf_sco_group2);
//-----------------------------------------------------------------------
//5 - Write the Study Properties
//-----------------------------------------------------------------------
- name_len = (hdf_int32) aStudy->Name().size();
+ string study_name = aStudy->Name();
+ name_len = (hdf_int32) study_name.size();
size[0] = name_len +1 ;
hdf_dataset = new HDFdataset("STUDY_NAME",hdf_group_study_structure,HDF_STRING,size,1);
hdf_dataset->CreateOnDisk();
- char* studid = (char*)aStudy->Name().c_str();
- hdf_dataset->WriteOnDisk(studid);
+ hdf_dataset->WriteOnDisk((char*)study_name.c_str());
hdf_dataset->CloseOnDisk();
hdf_dataset=0; // will be deleted by hdf_group_study_structure destructor
SALOMEDSImpl_SObject SO = SALOMEDSImpl_Study::SObject(itchild.Value());
- char* scoid = (char*) SO.GetID().c_str();
- hdf_group_sobject = new HDFgroup(scoid, hdf_group_datatype);
+ string scoid = SO.GetID();
+ hdf_group_sobject = new HDFgroup(scoid.c_str(), hdf_group_datatype);
hdf_group_sobject->CreateOnDisk();
SaveAttributes(SO, hdf_group_sobject);
Impl_SaveObject(SO, hdf_group_sobject);
#ifndef __SALOMEDSImpl_STUDYMANAGER_I_H__
#define __SALOMEDSImpl_STUDYMANAGER_I_H__
+#include "SALOMEDSImpl_Defines.hxx"
+
// std C++ headers
#include <strstream>
#include <string>
class HDFgroup;
-class SALOMEDSImpl_StudyManager
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_StudyManager
{
private:
public:
//! standard constructor
- Standard_EXPORT SALOMEDSImpl_StudyManager();
+ SALOMEDSImpl_StudyManager();
//! standard destructor
- Standard_EXPORT virtual ~SALOMEDSImpl_StudyManager();
+ virtual ~SALOMEDSImpl_StudyManager();
//! method to Create a New Study of name study_name
- Standard_EXPORT virtual SALOMEDSImpl_Study* NewStudy(const std::string& study_name);
+ virtual SALOMEDSImpl_Study* NewStudy(const std::string& study_name);
//! method to Open a Study from it's persistent reference
- Standard_EXPORT virtual SALOMEDSImpl_Study* Open(const std::string& aStudyUrl);
+ virtual SALOMEDSImpl_Study* Open(const std::string& aStudyUrl);
//! method to close a Study
- Standard_EXPORT virtual void Close(SALOMEDSImpl_Study* aStudy);
+ virtual void Close(SALOMEDSImpl_Study* aStudy);
//! method to save a Study
- Standard_EXPORT virtual bool Save(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
+ virtual bool Save(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
- Standard_EXPORT virtual bool SaveASCII(SALOMEDSImpl_Study* aStudy,
- SALOMEDSImpl_DriverFactory* aFactory,
- bool theMultiFile);
+ virtual bool SaveASCII(SALOMEDSImpl_Study* aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile);
//! method to save a Study to the persistent reference aUrl
- Standard_EXPORT virtual bool SaveAs(const std::string& aUrl,
- SALOMEDSImpl_Study* aStudy,
- SALOMEDSImpl_DriverFactory* aFactory,
- bool theMultiFile);
+ virtual bool SaveAs(const std::string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile);
- Standard_EXPORT virtual bool SaveAsASCII(const std::string& aUrl,
- SALOMEDSImpl_Study* aStudy,
- SALOMEDSImpl_DriverFactory* aFactory,
- bool theMultiFile);
+ virtual bool SaveAsASCII(const std::string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile);
//! method to Get name list of open studies in the session
- Standard_EXPORT virtual std::vector<SALOMEDSImpl_Study*> GetOpenStudies();
+ virtual std::vector<SALOMEDSImpl_Study*> GetOpenStudies();
//! method to get a Study from it's name
- Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudyByName(const std::string& aStudyName) ;
+ virtual SALOMEDSImpl_Study* GetStudyByName(const std::string& aStudyName) ;
//! method to get a Study from it's ID
- Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudyByID(int aStudyID) ;
-
-
- Standard_EXPORT DF_Document* GetDocumentOfStudy(SALOMEDSImpl_Study* theStudy);
-
- Standard_EXPORT DF_Document* GetClipboard() { return _clipboard; }
-
- Standard_EXPORT bool CopyLabel(SALOMEDSImpl_Study* theSourceStudy,
- SALOMEDSImpl_Driver* theEngine,
- const int theSourceStartDepth,
- const DF_Label& theSource,
- const DF_Label& theDestinationMain);
-
- Standard_EXPORT DF_Label PasteLabel(SALOMEDSImpl_Study* theDestinationStudy,
- SALOMEDSImpl_Driver* theEngine,
- const DF_Label& theSource,
- const DF_Label& theDestinationStart,
- const int theCopiedStudyID,
- const bool isFirstElement);
-
- Standard_EXPORT virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
- Standard_EXPORT virtual bool Copy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
- Standard_EXPORT virtual bool CanPaste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
- Standard_EXPORT virtual SALOMEDSImpl_SObject Paste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
+ virtual SALOMEDSImpl_Study* GetStudyByID(int aStudyID) ;
+
+
+ DF_Document* GetDocumentOfStudy(SALOMEDSImpl_Study* theStudy);
+
+ DF_Document* GetClipboard() { return _clipboard; }
+
+ bool CopyLabel(SALOMEDSImpl_Study* theSourceStudy,
+ SALOMEDSImpl_Driver* theEngine,
+ const int theSourceStartDepth,
+ const DF_Label& theSource,
+ const DF_Label& theDestinationMain);
+
+ DF_Label PasteLabel(SALOMEDSImpl_Study* theDestinationStudy,
+ SALOMEDSImpl_Driver* theEngine,
+ const DF_Label& theSource,
+ const DF_Label& theDestinationStart,
+ const int theCopiedStudyID,
+ const bool isFirstElement);
+
+ virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
+ virtual bool Copy(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
+ virtual bool CanPaste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
+ virtual SALOMEDSImpl_SObject Paste(const SALOMEDSImpl_SObject& theObject, SALOMEDSImpl_Driver* Engine);
// _SaveAs private function called by Save and SaveAs
- Standard_EXPORT virtual bool Impl_SaveAs(const std::string& aUrl,
- SALOMEDSImpl_Study* aStudy,
- SALOMEDSImpl_DriverFactory* aFactory,
- bool theMultiFile,
- bool theASCII);
+ virtual bool Impl_SaveAs(const std::string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile,
+ bool theASCII);
// _SaveObject private function called by _SaveAs
- Standard_EXPORT virtual bool Impl_SaveObject(const SALOMEDSImpl_SObject& SC, HDFgroup *hdf_group_datatype);
+ virtual bool Impl_SaveObject(const SALOMEDSImpl_SObject& SC, HDFgroup *hdf_group_datatype);
// _SubstituteSlash function called by Open and GetStudyByName
- Standard_EXPORT virtual std::string Impl_SubstituteSlash(const std::string& aUrl);
+ virtual std::string Impl_SubstituteSlash(const std::string& aUrl);
- Standard_EXPORT virtual bool Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, HDFgroup *hdf_group);
+ virtual bool Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, HDFgroup *hdf_group);
- Standard_EXPORT std::string GetErrorCode() { return _errorCode; }
- Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
+ std::string GetErrorCode() { return _errorCode; }
+ virtual bool IsError() { return _errorCode != ""; }
};
#ifndef __SALOMEDSIMPL_TMPFILE_H__
#define __SALOMEDSIMPL_TMPFILE_H__
+#include "SALOMEDSImpl_Defines.hxx"
#include "DF_definitions.hxx"
-struct SALOMEDSImpl_TMPFile
+struct SALOMEDSIMPL_EXPORT SALOMEDSImpl_TMPFile
{
typedef unsigned char TOctet;
//typedef unsigned int size_t;
- Standard_EXPORT virtual size_t Size() = 0;
+ virtual size_t Size() = 0;
- Standard_EXPORT virtual TOctet* Data();
+ virtual TOctet* Data();
- Standard_EXPORT virtual TOctet& Get(size_t) = 0;
+ virtual TOctet& Get(size_t) = 0;
};
// Project : SALOME
// Module : SALOMEDSImpl
-#include "SALOMEDSImpl_Tool.hxx"
-
#include <stdio.h>
#include <iostream>
#include <fstream>
+#include <stdlib.h>
+#include "SALOMEDSImpl_Tool.hxx"
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
#else
#include <time.h>
#include <lmcons.h>
+//#include <winbase.h>
+#include <windows.h>
#endif
-#include <stdlib.h>
-
using namespace std;
bool Exists(const string thePath)
{
-#ifdef WNT
+#ifdef WIN32
if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
if ( GetLastError () != ERROR_FILE_NOT_FOUND ) {
return false;
#endif
-#ifdef WNT
+#ifdef WIN32
CreateDirectory(aDir.c_str(), NULL);
#else
mkdir(aDir.c_str(), 0x1ff);
aFile += theFiles[i-1];
if(!Exists(aFile)) continue;
-#ifdef WNT
+#ifdef WIN32
DeleteFile(aFile.c_str());
#else
unlink(aFile.c_str());
if(IsDirDeleted) {
if(Exists(aDirName)) {
-#ifdef WNT
- RemoveDirectory(aDireName.c_str());
+#ifdef WIN32
+ RemoveDirectory(aDirName.c_str());
#else
rmdir(aDirName.c_str());
#endif
path = thePath+"/";
}
-#ifdef WNT //Check if the only disk letter is given as path
- if(path.size() == 2 && path[1] == ":") path +='\\';
+#ifdef WIN32 //Check if the only disk letter is given as path
+ if(path.size() == 2 && path[1] == ':') path +='\\';
#endif
for(int i = 0, len = path.size(); i<len; i++)
void SALOMEDSImpl_Tool::GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds)
{
-#ifdef WNT
+#ifdef WIN32
SYSTEMTIME st;
GetLocalTime ( &st );
#endif
}
+//Warning undef of Ascii Winwows define
+#ifdef WIN32
+# undef GetUserName
+#endif
string SALOMEDSImpl_Tool::GetUserName()
{
-#ifdef WNT
+#ifdef WIN32
char* pBuff = new char[UNLEN + 1];
DWORD dwSize = UNLEN + 1;
string retVal;
- GetUserName ( pBuff, &dwSize );
+ ::GetUserNameA( pBuff, &dwSize );
string theTmpUserName(pBuff,(int)dwSize -1 );
retVal = theTmpUserName;
delete [] pBuff;
#ifndef __SALOMEDSIMPL_TOOL_H__
#define __SALOMEDSIMPL_TOOL_H__
+#include "SALOMEDSImpl_Defines.hxx"
+
#include <string>
#include <vector>
#include "DF_Label.hxx"
#include <string.h>
-class SALOMEDSImpl_Tool
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_Tool
{
public:
// Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
- // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
+ // otherwise return /tmp/something/ for Unix or c:\something\ for WIN32
static std::string GetTmpDir();
#ifndef __SALOMEDSIMPL_USECaseBuilder_H__
#define __SALOMEDSIMPL_USECaseBuilder_H__
+#include "SALOMEDSImpl_Defines.hxx"
+
#include <string>
#include "DF_Document.hxx"
#include "SALOMEDSImpl_AttributeTreeNode.hxx"
#include "SALOMEDSImpl_UseCaseIterator.hxx"
-class SALOMEDSImpl_UseCaseBuilder
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_UseCaseBuilder
{
private:
public:
//! standard constructor
- Standard_EXPORT SALOMEDSImpl_UseCaseBuilder(DF_Document* theDocument);
-
+ SALOMEDSImpl_UseCaseBuilder(DF_Document* theDocument);
+
//! standard destructor
- Standard_EXPORT ~SALOMEDSImpl_UseCaseBuilder();
-
- Standard_EXPORT virtual bool Append(const SALOMEDSImpl_SObject& theObject);
+ ~SALOMEDSImpl_UseCaseBuilder();
+
+ virtual bool Append(const SALOMEDSImpl_SObject& theObject);
+
+ virtual bool Remove(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool Remove(const SALOMEDSImpl_SObject& theObject);
+ virtual bool AppendTo(const SALOMEDSImpl_SObject& theFather, const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool AppendTo(const SALOMEDSImpl_SObject& theFather, const SALOMEDSImpl_SObject& theObject);
+ virtual bool InsertBefore(const SALOMEDSImpl_SObject& theFirst, const SALOMEDSImpl_SObject& theNext);
- Standard_EXPORT virtual bool InsertBefore(const SALOMEDSImpl_SObject& theFirst, const SALOMEDSImpl_SObject& theNext);
+ virtual bool SetCurrentObject(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool SetCurrentObject(const SALOMEDSImpl_SObject& theObject);
-
- Standard_EXPORT virtual bool SetRootCurrent();
+ virtual bool SetRootCurrent();
- Standard_EXPORT virtual bool HasChildren(const SALOMEDSImpl_SObject& theObject);
+ virtual bool HasChildren(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool IsUseCase(const SALOMEDSImpl_SObject& theObject);
+ virtual bool IsUseCase(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool SetName(const std::string& theName);
+ virtual bool SetName(const std::string& theName);
- Standard_EXPORT virtual SALOMEDSImpl_SObject GetCurrentObject();
+ virtual SALOMEDSImpl_SObject GetCurrentObject();
- Standard_EXPORT virtual std::string GetName();
+ virtual std::string GetName();
- Standard_EXPORT virtual SALOMEDSImpl_SObject AddUseCase(const std::string& theName);
+ virtual SALOMEDSImpl_SObject AddUseCase(const std::string& theName);
- Standard_EXPORT virtual SALOMEDSImpl_UseCaseIterator GetUseCaseIterator(const SALOMEDSImpl_SObject& anObject);
+ virtual SALOMEDSImpl_UseCaseIterator GetUseCaseIterator(const SALOMEDSImpl_SObject& anObject);
- Standard_EXPORT SALOMEDSImpl_SObject GetSObject(const std::string& theEntry);
+ SALOMEDSImpl_SObject GetSObject(const std::string& theEntry);
};
#endif
#ifndef __SALOMEDSIMPL_USECASEITERATOR_H__
#define __SALOMEDSIMPL_USECASEITERATOR_H__
+#include "SALOMEDSImpl_Defines.hxx"
+
#include "SALOMEDSImpl_SObject.hxx"
#include "DF_ChildIterator.hxx"
#include "SALOMEDSImpl_ChildNodeIterator.hxx"
#include <string>
-class Standard_EXPORT SALOMEDSImpl_UseCaseIterator
+class SALOMEDSIMPL_EXPORT SALOMEDSImpl_UseCaseIterator
{
private:
//! standard constructor
SALOMEDSImpl_UseCaseIterator(const DF_Label& theLabel,
- const std::string& theGUID,
- const bool allLevels);
-
+ const std::string& theGUID,
+ const bool allLevels);
+
//! standard destructor
~SALOMEDSImpl_UseCaseIterator();
-
+
virtual void Init(bool);
virtual bool More();
virtual void Next();
// Class attributes initialisation, for class method BaseTraceCollector::run
BaseTraceCollector* BaseTraceCollector::_singleton = 0;
-#ifndef WNT
+#ifndef WIN32
pthread_mutex_t BaseTraceCollector::_singletonMutex;
#else
pthread_mutex_t BaseTraceCollector::_singletonMutex =
myTraceBuffer->retrieve(myTrace);
if (myTrace.traceType == ABORT_MESS)
{
-#ifndef WNT
+#ifndef WIN32
traceFile << "INTERRUPTION from thread " << myTrace.threadId
<< " : " << myTrace.trace;
#else
#endif
traceFile.close();
cout << flush ;
-#ifndef WNT
+#ifndef WIN32
cerr << "INTERRUPTION from thread " << myTrace.threadId
<< " : " << myTrace.trace;
#else
}
else
{
-#ifndef WNT
+#ifndef WIN32
traceFile << "th. " << myTrace.threadId
<< " " << myTrace.trace;
#else
#include <cassert>
#include <string.h>
-#ifndef WNT
+#ifndef WIN32
#include <dlfcn.h>
#else
#include <windows.h>
// Class static attributes initialisation
LocalTraceBufferPool* LocalTraceBufferPool::_singleton = 0;
-//#ifndef WNT
+//#ifndef WIN32
//pthread_mutex_t LocalTraceBufferPool::_singletonMutex;
//#else
pthread_mutex_t LocalTraceBufferPool::_singletonMutex =
}
else // --- try a dynamic library
{
-#ifndef WNT
+#ifndef WIN32
void* handle;
string impl_name = string ("lib") + traceKind
+ string("TraceCollector.so");
if ( handle )
{
typedef BaseTraceCollector * (*FACTORY_FUNCTION) (void);
-#ifndef WNT
+#ifndef WIN32
FACTORY_FUNCTION TraceCollectorFactory =
(FACTORY_FUNCTION) dlsym(handle, "SingletonInstance");
#else
if ( !TraceCollectorFactory )
{
cerr << "Can't resolve symbol: SingletonInstance" <<endl;
-#ifndef WNT
+#ifndef WIN32
cerr << "dlerror: " << dlerror() << endl;
#endif
exit( 1 );
if (myTrace.traceType == ABORT_MESS)
{
cout << flush ;
-#ifndef WNT
+#ifndef WIN32
cerr << "INTERRUPTION from thread " << myTrace.threadId
<< " : " << myTrace.trace;
#else
else
{
cout << flush ;
-#ifndef WNT
+#ifndef WIN32
cerr << "th. " << myTrace.threadId << " " << myTrace.trace;
#else
cerr << "th. " << (void*)(&myTrace.threadId)
#ifndef _SALOME_LOCALTRACE_HXX_
#define _SALOME_LOCALTRACE_HXX_
-#ifdef WNT
- #if defined SALOMELOCALTRACE_EXPORTS
- #if defined WIN32
- #define SALOMELOCALTRACE_EXPORT __declspec( dllexport )
- #else
- #define SALOMELOCALTRACE_EXPORT
- #endif
- #else
- #if defined WIN32
- #define SALOMELOCALTRACE_EXPORT __declspec( dllimport )
- #else
- #define SALOMELOCALTRACE_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef SALOMELOCALTRACE_EXPORTS
+# define SALOMELOCALTRACE_EXPORT __declspec( dllexport )
+# else
+# define SALOMELOCALTRACE_EXPORT __declspec( dllimport )
+# endif
#else
- #define SALOMELOCALTRACE_EXPORT
+# define SALOMELOCALTRACE_EXPORT
#endif
#endif
#define INFOS(msg) {MESS_BEGIN("- Trace ") << msg << MESS_END}
#define PYSCRIPT(msg) {MESS_INIT("---PYSCRIPT--- ") << msg << MESS_END}
#define INTERRUPTION(msg) {MESS_BEGIN("- INTERRUPTION: ")<< msg << MESS_ABORT}
-#ifdef WNT
+
+#ifdef WIN32
#define IMMEDIATE_ABORT(code) {std::cout <<std::flush; \
std::cerr << "- ABORT " << __FILE__ << " [" <<__LINE__<< "] : " << flush; \
std::cerr << "ABORT return code= "<< code << std::endl; \
if (myTrace.traceType == ABORT_MESS)
{
stringstream abortMessage("");
-#ifndef WNT
+#ifndef WIN32
abortMessage << "INTERRUPTION from thread "
<< myTrace.threadId << " : " << myTrace.trace;
#else
else
{
stringstream aMessage("");
-#ifndef WNT
+#ifndef WIN32
aMessage << "th. " << myTrace.threadId
#else
aMessage << "th. " << (void*)&myTrace.threadId
//! See LocalTraceCollector instead of SALOMETraceCollector,
//! for usage without CORBA
-#if defined WNT
-# if defined SALOMETRACECOLLECTOR_EXPORTS
+#ifdef WIN32
+# ifdef SALOMETRACECOLLECTOR_EXPORTS
# define SALOMETRACECOLLECTOR_EXPORT __declspec( dllexport )
# else
# define SALOMETRACECOLLECTOR_EXPORT
#include <iostream>
#include <ctime>
-#ifdef WNT
+#ifdef WIN32
#include <omnithread/pthread_nt.h>
#endif
cout << "Caught exception: Naming Service can't found Logger";
}
}
-#ifndef WNT
+#ifndef WIN32
nanosleep(&ts_req,&ts_rem);
#else
Sleep(TIMESleep / 1000000);
#include "SALOMEDS_Tool.hxx"
#include "utilities.h"
+#include "Basics_DirUtils.hxx"
-#ifndef WNT
+#ifndef WIN32
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <iostream>
-#include <fstream>
#include <pwd.h>
#include <unistd.h>
#else
#include <lmcons.h>
#endif
+#include <iostream>
+#include <fstream>
#include <stdlib.h>
#include <SALOMEconfig.h>
bool Exists(const string thePath)
{
-#ifdef WNT
+#ifdef WIN32
if ( GetFileAttributes ( thePath.c_str() ) == 0xFFFFFFFF ) {
- if ( GetLastError () != ERROR_FILE_NOT_FOUND ) {
+ if ( GetLastError () == ERROR_FILE_NOT_FOUND ) {
return false;
}
}
//============================================================================
std::string SALOMEDS_Tool::GetTmpDir()
{
+ return Kernel_Utils::GetTmpDirByEnv("SALOME_TMP_DIR");
//Find a temporary directory to store a file
- string aTmpDir = "";
+ /*string aTmpDir = "";
char *Tmp_dir = getenv("SALOME_TMP_DIR");
if(Tmp_dir != NULL) {
#endif
-#ifdef WNT
+#ifdef WIN32
CreateDirectory(aDir.c_str(), NULL);
#else
mkdir(aDir.c_str(), 0x1ff);
#endif
- return aDir;
+ return aDir;*/
}
//============================================================================
aFile += theFiles[i-1];
if(!Exists(aFile)) continue;
-#ifdef WNT
+#ifdef WIN32
DeleteFile(aFile.c_str());
#else
unlink(aFile.c_str());
if(IsDirDeleted) {
if(Exists(aDirName)) {
-#ifdef WNT
- RemoveDirectory(aDireName.c_str());
+#ifdef WIN32
+ RemoveDirectory(aDirName.c_str());
#else
rmdir(aDirName.c_str());
#endif
if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
string aFullPath = aTmpDir + const_cast<char*>(theFiles[i].in());
if(!Exists(aFullPath)) continue;
-#ifdef WNT
+#ifdef WIN32
ifstream aFile(aFullPath.c_str(), ios::binary);
#else
ifstream aFile(aFullPath.c_str());
if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
string aFullPath = aTmpDir + const_cast<char*>(theFiles[i].in());
if(!Exists(aFullPath)) continue;
-#ifdef WNT
+#ifdef WIN32
aFile = new ifstream(aFullPath.c_str(), ios::binary);
#else
aFile = new ifstream(aFullPath.c_str());
aCurrentPos += 8;
string aFullPath = aTmpDir + aFileName;
-#ifdef WNT
+#ifdef WIN32
ofstream aFile(aFullPath.c_str(), ios::binary);
#else
ofstream aFile(aFullPath.c_str());
path = thePath+"/";
}
-#ifdef WNT //Check if the only disk letter is given as path
- if(path.size() == 2 && path[1] == ":") path +='\\';
+#ifdef WIN32 //Check if the only disk letter is given as path
+ if(path.size() == 2 && path[1] == ':') path +='\\';
#endif
for(int i = 0, len = path.size(); i<len; i++)
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SALOMEDS)
-#ifdef WNT
- #if defined TOOLSDS_EXPORTS
- #if defined WIN32
- #define TOOLSDS_EXPORT __declspec( dllexport )
- #else
- #define TOOLSDS_EXPORT
- #endif
- #else
- #if defined WIN32
- #define TOOLSDS_EXPORT __declspec( dllimport )
- #else
- #define TOOLSDS_EXPORT
- #endif
- #endif
+#ifdef WIN32
+# ifdef TOOLSDS_EXPORTS
+# define TOOLSDS_EXPORT __declspec( dllexport )
+# else
+# define TOOLSDS_EXPORT __declspec( dllimport )
+# endif
#else
- #define TOOLSDS_EXPORT
+# define TOOLSDS_EXPORT
#endif
class TOOLSDS_EXPORT SALOMEDS_Tool
public:
// Returns the unique temporary directory, that is defined in SALOME_TMP_DIR if this variable is set
- // otherwise return /tmp/something/ for Unix or c:\something\ for WNT
+ // otherwise return /tmp/something/ for Unix or c:\something\ for WIN32
static std::string GetTmpDir();
TestContainer_SOURCES = TestContainer.cxx
TestContainer_CPPFLAGS = $(COMMON_CPPFLAGS)
TestContainer_LDADD = libSalomeTestComponentEngine.la \
+ ../Basics/libSALOMEBasics.la \
$(CORBA_LIBS)
TestLogger_SOURCES = TestLogger.cxx
TestLogger_CPPFLAGS = $(COMMON_CPPFLAGS)
TestLogger_LDADD = libSalomeTestComponentEngine.la \
+ ../Basics/libSALOMEBasics.la \
$(CORBA_LIBS)
// Module : SALOME
// $Header$
-#ifndef WNT
+#ifndef WIN32
# define private protected
#endif
#include "utilities.h"
#include "SALOME_NamingService.hxx"
#include "NamingService_WaitForServerReadiness.hxx"
-#include "OpUtil.hxx"
+#include "Basics_Utils.hxx"
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
#include "Utils_SALOME_Exception.hxx"
{
SALOME_NamingService _NS(orb) ;
string containerName = "/Containers/" ;
- string hostName = GetHostname();
+ string hostName = Kernel_Utils::GetHostname();
containerName += hostName + "/FactoryServer";
NamingService_WaitForServerReadiness(&_NS,containerName);
// Use Name Service to find container
SALOME_NamingService NS(orb) ;
string containerName = "/Containers/" ;
- string hostName = GetHostname();
+ string hostName = Kernel_Utils::GetHostname();
containerName += hostName + "/MPIFactoryServer_" + argv[2];
string dirn(getenv("KERNEL_ROOT_DIR"));
# Libraries targets
lib_LTLIBRARIES = libOpUtil.la
libOpUtil_la_SOURCES =\
- OpUtil.cxx Utils_Timer.cxx duplicate.cxx \
+ Utils_Timer.cxx \
+ duplicate.cxx \
Utils_CommException.cxx \
Utils_SALOME_Exception.cxx \
Utils_Identity.cxx Utils_ORB_INIT.cxx \
#ifndef _OPUTIL_HXX
#define _OPUTIL_HXX
-#include <SALOME_Utils.hxx>
+#include "SALOME_Utils.hxx"
-#include <string>
-
-UTILS_EXPORT std::string GetHostname();
UTILS_EXPORT const char *duplicate(const char * const);
#endif
#ifndef _SALOME_UTILS_HXX_
#define _SALOME_UTILS_HXX_
-#ifdef WNT
+#ifdef WIN32
# if defined UTILS_EXPORTS
# define UTILS_EXPORT __declspec( dllexport )
# else
#ifndef Utils_ExceptHandlers_HeaderFile
#define Utils_ExceptHandlers_HeaderFile
-#include <SALOME_Utils.hxx>
+#include "SALOME_Utils.hxx"
#include <stdexcept>
class UTILS_EXPORT Unexpect { //save / retrieve unexpected exceptions treatment
PVF old;
public :
-#ifndef WNT
+#ifndef WIN32
Unexpect( PVF f )
{ old = std::set_unexpected(f); }
~Unexpect() { std::set_unexpected(old); }
PVF old;
public :
-#ifndef WNT
+#ifndef WIN32
Terminate( PVF f )
{ old = std::set_terminate(f); }
~Terminate() { std::set_terminate(old); }
{
# include <string.h>
-#ifndef WNT /* unix functionality */
+#ifndef WIN32 /* unix functionality */
# include <pwd.h>
#endif
}
-#ifndef WNT /* unix functionality */
+#ifndef WIN32 /* unix functionality */
# include <arpa/inet.h>
# include <netinet/in.h>
#define getcwd _getcwd
#define getpid _getpid
-#endif /* WNT */
+#endif /* WIN32 */
Identity::Identity( const char *name ): _name(duplicate(name)),\
{
return _name ;
}
-#ifndef WNT
+#ifndef WIN32
const pid_t& Identity::pid(void) const
#else
const DWORD& Identity::pid(void) const
return _pid ;
}
-#ifndef WNT
+#ifndef WIN32
const struct utsname &Identity::hostid(void) const
#else
const char* const Identity::hostid(void) const
return _hostid ;
}
-#ifndef WNT
+#ifndef WIN32
const uid_t& Identity::uid(void) const
#else
const PSID& Identity::uid(void) const
const char* Identity::host_char( void ) const
{
-#ifndef WNT
+#ifndef WIN32
return _hostid.nodename;
#else
return _hostid;
os << '\t' << "Numero de PID : " << monid._pid << std::endl;
os << '\t' << "Uid utilisateur : " << monid._uid << std::endl;
os << '\t' << "nom utilisateur : " << monid._pwname << std::endl;
-#ifndef WNT
+#ifndef WIN32
os << '\t' << "Nom de machine : " << monid._hostid.nodename << std::endl;
#else
os << '\t' << "Nom de machine : " << monid._hostid << std::endl;
{
# include <stdlib.h>
# include <time.h>
-#ifndef WNT
+#ifndef WIN32
# include <unistd.h>
# include <sys/utsname.h>
#else
const char* const _name ;
const char* const _adip; // Internet address
-#ifndef WNT
+#ifndef WIN32
const struct utsname _hostid;
const pid_t _pid ;
const uid_t _uid ;
~Identity();
friend std::ostream & operator<< ( std::ostream& os , const Identity& monid );
-#ifndef WNT
+#ifndef WIN32
const pid_t& pid(void) const;
const struct utsname& hostid(void) const;
const uid_t& uid(void) const;
{
pthread_mutex_lock( &myHelperMutex );
-#ifndef WNT
+#ifndef WIN32
if ( myCount > 0 && myThread == pthread_self() ) {
#else
if ( myCount > 0 && myThread.p == pthread_self().p ) {
{
pthread_mutex_lock( &myHelperMutex );
-#ifndef WNT
+#ifndef WIN32
if ( myThread == pthread_self() ) {
#else
if ( myThread.p == pthread_self().p ) {
#include "Utils_SALOME_Exception.hxx"
#include "utilities.h"
-#ifndef WNT
+#ifndef WIN32
extern "C"
{
#endif
#include <math.h>
#include <stdio.h>
#include <string.h>
-#ifndef WNT
+#ifndef WIN32
}
#endif
//swig tool on Linux doesn't pass defines from header SALOME_Utils.hxx
//therefore (temporary solution) defines are placed below
-#ifdef WNT
-# if defined UTILS_EXPORTS
+#ifdef WIN32
+# ifdef UTILS_EXPORTS
# define UTILS_EXPORT __declspec( dllexport )
# else
# define UTILS_EXPORT __declspec( dllimport )
#include "utilities.h"
-#ifndef WNT
+#ifndef WIN32
static struct timezone *tz=(struct timezone*) malloc(sizeof(struct timezone));
#else
//timezone *tz=_timezone;
#endif
Utils_Timer::Utils_Timer() {
-#ifndef WNT
+#ifndef WIN32
RefToInitialTMS = new tms;
RefToCurrentTMS = new tms;
void Utils_Timer::Start() {
if (Stopped) {
Stopped = 0;
-#ifndef WNT
+#ifndef WIN32
times(RefToInitialTMS);
gettimeofday(RefToInitialTimeB,tz);
#else
void Utils_Timer::Stop() {
if (!Stopped) {
-#ifndef WNT
+#ifndef WIN32
times(RefToCurrentTMS);
int diffr_user = RefToCurrentTMS->tms_utime - RefToInitialTMS->tms_utime;
int diffr_sys = RefToCurrentTMS->tms_stime - RefToInitialTMS->tms_stime;
void Utils_Timer::ShowAbsolute(){
#if defined(_DEBUG_) || defined(_DEBUG)
-#ifndef WNT
+#ifndef WIN32
unsigned long Absolute_user = (unsigned long) ((timeval*)RefToCurrentTimeB)->tv_sec ;
#else
unsigned long Absolute_user = *RefToCurrentTimeB;
#include <stdlib.h>
#include <time.h>
-#ifndef WNT
+#ifndef WIN32
# include <sys/times.h>
# include <sys/time.h>
# include <unistd.h>
double Cumul_user;
double Cumul_sys;
bool Stopped;
-#ifndef WNT
+#ifndef WIN32
tms *RefToCurrentTMS, *RefToInitialTMS;
timeval *RefToCurrentTimeB, *RefToInitialTimeB;
#else
--- /dev/null
+from distutils.core import setup, Extension
+
+module1 = Extension('win32pm',
+ libraries = ['kernel32'],
+ sources = ['win32pm.c'])
+
+setup (name = 'win32pm',
+ version = '1.0',
+ description = 'Win32 process managment package',
+ ext_modules = [module1])
--- /dev/null
+#include <Python.h>
+#include <windows.h>
+
+static PyObject * win32pm_spawnhandle( PyObject *self, PyObject *args )
+{
+ char *argv;
+ char *flags;
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+ DWORD dwProcessFlags = CREATE_NEW_CONSOLE;
+ /* Default value as in Python sources:
+ CREATE_NEW_CONSOLE has been known to
+ cause random failures on win9x. Specifically a
+ dialog:
+ "Your program accessed mem currently in use at xxx"
+ and a hopeful warning about the stability of your
+ system.
+ Cost is Ctrl+C wont kill children, but anyone
+ who cares can have a go!
+ */
+
+ if (!PyArg_ParseTuple(args, "s|s", &argv, &flags))
+ return NULL;
+ if ( flags && !strcmp( flags, "-nc" ) ) // no console
+ dwProcessFlags = 0;
+
+ ZeroMemory( &si, sizeof(si) );
+ si.cb = sizeof(si);
+ ZeroMemory( &pi, sizeof(pi) );
+
+ if ( !CreateProcess( NULL, argv,
+ NULL, // Process handle not inheritable.
+ NULL, // Thread handle not inheritable.
+ TRUE,
+ dwProcessFlags, // Creation flags.
+ NULL, // Use parent's environment block.
+ NULL, // Use parent's starting directory.
+ &si, // Pointer to STARTUPINFO structure.
+ &pi ) ) // Pointer to PROCESS_INFORMATION structure.
+ return NULL;
+ return Py_BuildValue("i", pi.hProcess);
+}
+
+static PyObject * win32pm_spawnpid( PyObject *self, PyObject *args )
+{
+ char* argv;
+ char *flags;
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+ DWORD dwProcessFlags = CREATE_NEW_CONSOLE;
+ /* Default value as in Python sources:
+ CREATE_NEW_CONSOLE has been known to
+ cause random failures on win9x. Specifically a
+ dialog:
+ "Your program accessed mem currently in use at xxx"
+ and a hopeful warning about the stability of your
+ system.
+ Cost is Ctrl+C wont kill children, but anyone
+ who cares can have a go!
+ */
+
+ if (!PyArg_ParseTuple(args, "s|s", &argv, &flags))
+ return NULL;
+ if ( flags && !strcmp( flags, "-nc" ) ) // no console
+ dwProcessFlags = 0;
+
+ ZeroMemory( &si, sizeof(si) );
+ si.cb = sizeof(si);
+ ZeroMemory( &pi, sizeof(pi) );
+
+ if ( !CreateProcess( NULL, argv,
+ NULL, // Process handle not inheritable.
+ NULL, // Thread handle not inheritable.
+ TRUE,
+ dwProcessFlags, // Creation flags.
+ NULL, // Use parent's environment block.
+ NULL, // Use parent's starting directory.
+ &si, // Pointer to STARTUPINFO structure.
+ &pi ) ) // Pointer to PROCESS_INFORMATION structure.
+ return NULL;
+ return Py_BuildValue("i", pi.dwProcessId);
+}
+
+static PyObject * win32pm_handle( PyObject *self, PyObject *args )
+{
+ int argv1 = 0;
+ int argv2 = 0;
+ HANDLE ph = 0;
+ int pid = 0;
+ if (!PyArg_ParseTuple(args, "i|i", &argv1, &argv2))
+ return NULL;
+ ph = OpenProcess( 1, (BOOL)argv2, argv1 );
+ return Py_BuildValue("i", (int)ph );
+}
+
+static PyObject * win32pm_killpid( PyObject *self, PyObject *args )
+{
+ int pid = 0;
+ int exitCode = 0;
+ HANDLE ph = 0;
+ BOOL stat = 0;
+ if (!PyArg_ParseTuple(args, "i|i", &pid, &exitCode))
+ return NULL;
+ ph = OpenProcess( 1, 0, pid );
+ stat = TerminateProcess( ph, exitCode );
+ return Py_BuildValue("i", (int)stat );
+}
+
+static PyObject * win32pm_killhandle( PyObject *self, PyObject *args )
+{
+ int phId = 0;
+ int exitCode = 0;
+ BOOL stat = 0;
+ if (!PyArg_ParseTuple(args, "i|i", &phId, &exitCode))
+ return NULL;
+
+ stat = TerminateProcess( (void*)phId, exitCode );
+ return Py_BuildValue("i", (int)stat );
+}
+
+static PyMethodDef win32pmMethods[] = {
+ {"spawnhandle", win32pm_spawnhandle, METH_VARARGS,
+ "Creates new process. Returns windows handle of new process."},
+ {"spawnpid", win32pm_spawnpid, METH_VARARGS,
+ "Creates new process. Returns PID of new process."},
+ {"handle", win32pm_handle, METH_VARARGS,
+ "Returns windows handle of indicated process PID."},
+ {"killpid", win32pm_killpid, METH_VARARGS,
+ "Terminate process by PID."},
+ {"killhandle", win32pm_killhandle, METH_VARARGS,
+ "Terminate process by windows process handle."},
+ {NULL, NULL, 0, NULL} /* Sentinel */
+};
+
+PyMODINIT_FUNC
+initwin32pm(void)
+{
+ Py_InitModule("win32pm", win32pmMethods);
+}