setenv.py \
launchSalome.py \
nameserver.py \
- server.py
-
+ server.py \
+ waitNS.sh \
+ waitNS.py \
+ waitContainers.py \
+ shutdownSalome.py
EXTRA_DIST = appliskel
my_host=""
if os.environ.has_key("OMNIORB_CONFIG"):
file = open(os.environ["OMNIORB_CONFIG"], "r")
- s = file.read()
+ s = file.readline()
while len(s):
l = string.split(s, ":")
if string.split(l[0], " ")[0] == "ORBInitRef" or \
my_host = l[len(l)-2]
break;
pass
- s = file.read()
+ s = file.readline()
pass
pass
if info=='host':
if verbose(): print process_id
for pid, cmd in process_id.items():
#print "see process %s : %s"% (pid, cmd[0])
- if pid == command_pid:
- already_in=1
+ if pid == command_pid:
+ already_in=1
pass
pass
pass
command=(command.split(" "))[0]
if already_in == 0:
try:
- process_ids.append({command_pid: [command]})
- fpid=open(filedict,'w')
+ process_ids.append({command_pid: [command]})
+ fpid=open(filedict,'w')
pickle.dump(process_ids, fpid)
- fpid.close()
+ fpid.close()
except:
- print "addToKillList: can not add command %s to the kill list"% filedict
- pass
- pass
+ print "addToKillList: can not add command %s to the kill list"% filedict
+ pass
+ pass
pass
def killList():
f.write(module)
f.write(',')
pass
- f.write(_config["guimodules"][-1])
+ if len(_config["guimodules"]) > 0:
+ f.write(_config["guimodules"][-1])
f.write('"/>')
command="""
<parameter name="pyModules" value=""/>
echo $currentPort
# --- kill current salome session
-
+${KERNEL_ROOT_DIR}/bin/salome/shutdownSalome.py
${KERNEL_ROOT_DIR}/bin/salome/killSalomeWithPort.py $currentPort
# --- delete config files
# by arguments to this command)
if [ $# -ne 0 ] ; then
- ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
else
${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py
shift 2
-${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/sh --rcfile $HOME/$APPLI/.bashrc -c "$*"
+# suppress --rcfile option because of problem on Mandriva2006 - B Secher mai 2007
+#${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/sh --rcfile $HOME/$APPLI/.bashrc -c "$*"
+${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/sh -c "$*"
#import runSalome
argv = sys.argv[1:]
+sys.argv = argv[1:]
#sys.argv = [sys.argv[0]]
#if len(argv) > 3:
# sys.argv += argv[3:]
-if len(argv) > 2:
- sys.argv = argv[2:]
-
-args, modules_list, modules_root_dir = setenv.get_config()
+#if len(argv) > 2:
+# sys.argv = argv[2:]
+
+#args, modules_list, modules_root_dir = setenv.get_config()
#runSalome.set_env(args, modules_list, modules_root_dir)
setenv.main();
killMyPort(mo.groups()[0])
pass
- cmd = "pid=`ps -fea | grep '"+os.getenv('USER')+"' | grep 'ghs3d' | grep 'f /tmp/GHS3D_' | grep -v 'grep' | awk '{print $2}'` ; echo $pid > /tmp/logs/"+os.getenv('USER')+"/_"+"Pid_ghs3d.log"
- a = os.system(cmd)
- try:
- fpidomniNames=open('/tmp/logs/'+os.getenv('USER')+"/_"+"Pid_ghs3d.log")
- prc = fpidomniNames.read()
- fpidomniNames.close()
- if prc != None :
- for field in prc.split(" ") :
- field = field.strip()
- if field != None and len(field) != 0:
- os.system('kill -9 '+field)
- except:
+ if not sys.platform == 'win32':
+ cmd = "pid=`ps -fea | grep '"+os.getenv('USER')+"' | grep 'ghs3d' | grep 'f /tmp/GHS3D_' | grep -v 'grep' | awk '{print $2}'` ; echo $pid > /tmp/logs/"+os.getenv('USER')+"/_"+"Pid_ghs3d.log"
+ a = os.system(cmd)
+ try:
+ fpidomniNames=open('/tmp/logs/'+os.getenv('USER')+"/_"+"Pid_ghs3d.log")
+ prc = fpidomniNames.read()
+ fpidomniNames.close()
+ if prc != None :
+ for field in prc.split(" ") :
+ field = field.strip()
+ if field != None and len(field) != 0:
+ os.system('kill -9 '+field)
+ except:
+ pass
pass
- pass
if __name__ == "__main__":
killAllPorts()
if pidfield != "egrep" :
if sys.platform == "win32":
import win32pm
- print 'stop process '+pidfield+' : omniNames'
+ print 'stop process '+pidfield+' : omniNames'
win32pm.killpid(int(pidfield),0)
else:
- if verbose(): print 'stop process '+pidfield+' : omniNames'
+ if verbose(): print 'stop process '+pidfield+' : omniNames'
os.system('kill -9 '+pidfield)
pidfield = field
except:
while pid != "" and len(a.split(" ")) < 2:
a = commands.getoutput("pid=`ps -eo pid,command | egrep \"[0-9] omniNames -start "+str(port)+"\" | sed -e \"s%[^0-9]*\([0-9]*\) .*%\\1%g\"`; kill -9 $pid")
pid = commands.getoutput("ps -eo pid,command | egrep \"[0-9] omniNames -start "+str(port)+"\" | sed -e \"s%[^0-9]*\([0-9]*\) .*%\\1%g\"")
- print pid
+ print pid
pass
interp_nam = "interp"
except_nam = "noexcepthandler"
terminal_nam = "terminal"
+pinter_nam = "pinter"
+batch_nam = "batch"
# values in XML configuration file giving specific module parameters (<module_name> section)
# which are stored in opts with key <module_name>_<parameter> (eg SMESH_plugins)
salomeappname = "SalomeApp"
script_nam = "pyscript"
+# possible choices for the "embedded" and "standalone" parameters
+embedded_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "SalomeAppEngine" ]
+standalone_choices = [ "registry", "study", "moduleCatalog", "cppContainer", "pyContainer", "supervContainer"]
+
# values of boolean type (must be '0' or '1').
# xml_parser.boolValue() is used for correct setting
-boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam )
+boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam, pinter_nam )
intKeys = ( interp_nam, )
# values of list type
_verbose = level
return
+# --
+
+def process_containers_params( standalone, embedded ):
+ # 1. filter inappropriate containers names
+ if standalone is not None:
+ standalone = filter( lambda x: x in standalone_choices, standalone )
+ if embedded is not None:
+ embedded = filter( lambda x: x in embedded_choices, embedded )
+
+ # 2. remove containers appearing in 'standalone' parameter from the 'embedded'
+ # parameter --> i.e. 'standalone' parameter has higher priority
+ if standalone is not None and embedded is not None:
+ embedded = filter( lambda x: x not in standalone, embedded )
+
+ # 3. return corrected parameters values
+ return standalone, embedded
+
# -----------------------------------------------------------------------------
###
parser = xml.sax.make_parser()
parser.setContentHandler(self)
parser.parse(fileName)
+ standalone, embedded = process_containers_params( self.opts.get( standalone_nam ),
+ self.opts.get( embedded_nam ) )
+ if standalone is not None:
+ self.opts[ standalone_nam ] = standalone
+ if embedded is not None:
+ self.opts[ embedded_nam ] = embedded
pass
def boolValue( self, str ):
if nam in boolKeys:
self.opts[key] = self.boolValue( val ) # assign boolean value: 0 or 1
elif nam in intKeys:
- self.opts[key] = self.intValue( val ) # assign integer value
+ self.opts[key] = self.intValue( val ) # assign integer value
elif nam in listKeys:
- self.opts[key] = val.split( ',' ) # assign list value: []
+ self.opts[key] = filter( lambda a: a.strip(), re.split( "[:;,]", val ) ) # assign list value: []
else:
- self.opts[key] = val;
+ self.opts[key] = val
pass
pass
boolean_choices = booleans.keys()
+def check_embedded(option, opt, value, parser):
+ from optparse import OptionValueError
+ assert value is not None
+ if parser.values.embedded:
+ embedded = filter( lambda a: a.strip(), re.split( "[:;,]", parser.values.embedded ) )
+ else:
+ embedded = []
+ if parser.values.standalone:
+ standalone = filter( lambda a: a.strip(), re.split( "[:;,]", parser.values.standalone ) )
+ else:
+ standalone = []
+ vals = filter( lambda a: a.strip(), re.split( "[:;,]", value ) )
+ for v in vals:
+ if v not in embedded_choices:
+ raise OptionValueError( "option %s: invalid choice: %r (choose from %s)" % ( opt, v, ", ".join( map( repr, embedded_choices ) ) ) )
+ if v not in embedded:
+ embedded.append( v )
+ if v in standalone:
+ del standalone[ standalone.index( v ) ]
+ pass
+ parser.values.embedded = ",".join( embedded )
+ parser.values.standalone = ",".join( standalone )
+ pass
+
+def check_standalone(option, opt, value, parser):
+ from optparse import OptionValueError
+ assert value is not None
+ if parser.values.embedded:
+ embedded = filter( lambda a: a.strip(), re.split( "[:;,]", parser.values.embedded ) )
+ else:
+ embedded = []
+ if parser.values.standalone:
+ standalone = filter( lambda a: a.strip(), re.split( "[:;,]", parser.values.standalone ) )
+ else:
+ standalone = []
+ vals = filter( lambda a: a.strip(), re.split( "[:;,]", value ) )
+ for v in vals:
+ if v not in standalone_choices:
+ raise OptionValueError( "option %s: invalid choice: %r (choose from %s)" % ( opt, v, ", ".join( map( repr, standalone_choices ) ) ) )
+ if v not in standalone:
+ standalone.append( v )
+ if v in embedded:
+ del embedded[ embedded.index( v ) ]
+ pass
+ parser.values.embedded = ",".join( embedded )
+ parser.values.standalone = ",".join( standalone )
+ pass
+
def store_boolean (option, opt, value, parser, *args):
if isinstance(value, types.StringType):
try:
dest="gui",
help=help_str)
+ help_str = "Launch in Batch Mode. (Without GUI on batch machine)"
+ o_b = optparse.Option("-b",
+ "--batch",
+ action="store_true",
+ dest="batch",
+ help=help_str)
+
help_str = "Launch in GUI mode [default]."
o_g = optparse.Option("-g",
"--gui",
# Embedded servers. Default: Like in configuration files.
help_str = "CORBA servers to be launched in the Session embedded mode. "
- help_str += "Valid values for <serverN>: registry, study, moduleCatalog, "
- help_str += "cppContainer [by default the value from the configuration files is used]"
+ help_str += "Valid values for <serverN>: %s " % ", ".join( embedded_choices )
+ help_str += "[by default the value from the configuration files is used]"
o_e = optparse.Option("-e",
"--embedded",
metavar="<server1,server2,...>",
type="string",
- action="append",
+ action="callback",
dest="embedded",
+ callback=check_embedded,
help=help_str)
# Standalone servers. Default: Like in configuration files.
help_str = "CORBA servers to be launched in the standalone mode (as separate processes). "
- help_str += "Valid values for <serverN>: registry, study, moduleCatalog, "
- help_str += "cppContainer, pyContainer, [by default the value from the configuration files is used]"
+ help_str += "Valid values for <serverN>: %s " % ", ".join( standalone_choices )
+ help_str += "[by default the value from the configuration files is used]"
o_s = optparse.Option("-s",
"--standalone",
metavar="<server1,server2,...>",
type="string",
- action="append",
+ action="callback",
dest="standalone",
+ callback=check_standalone,
help=help_str)
# Kill with port. Default: False.
dest="save_config", default=True,
help=help_str)
+ # Launch with interactive python console. Default: False.
+ help_str = "Launch with interactive python console."
+ o_pi = optparse.Option("--pinter",
+ action="store_true",
+ dest="pinter",
+ help=help_str)
+
# All options
opt_list = [o_t,o_g, # GUI/Terminal
o_d,o_o, # Desktop
+ o_b, # Batch
o_l,o_f, # Use logger or log-file
o_u, # Execute python scripts
o_r, # Configuration XML file
o_z, # Splash
o_c, # Catch exceptions
o_a, # Print free port and exit
- o_n] # --nosave-config
+ o_n, # --nosave-config
+ o_pi] # Interactive python console
+
#std_options = ["gui", "desktop", "log_file", "py_scripts", "resources",
# "xterm", "modules", "embedded", "standalone",
# Options: gui, desktop, log_file, py_scripts, resources,
# xterm, modules, embedded, standalone,
# portkill, killall, interp, splash,
- # catch_exceptions
+ # catch_exceptions, pinter
# GUI/Terminal, Desktop, Splash, STUDY_HDF
args["session_gui"] = False
+ args[batch_nam] = False
args["study_hdf"] = None
if cmd_opts.gui is not None:
args[gui_nam] = cmd_opts.gui
+ if cmd_opts.batch is not None:
+ args[batch_nam] = True
if args[gui_nam]:
args["session_gui"] = True
if cmd_opts.desktop is not None:
# Embedded
if cmd_opts.embedded is not None:
- args[embedded_nam] = []
- listlist = cmd_opts.embedded
- for listi in listlist:
- args[embedded_nam] += re.split( "[:;,]", listi)
+ args[embedded_nam] = filter( lambda a: a.strip(), re.split( "[:;,]", cmd_opts.embedded ) )
# Standalone
if cmd_opts.standalone is not None:
- args[standalone_nam] = []
- listlist = cmd_opts.standalone
- standalone = []
- for listi in listlist:
- standalone += re.split( "[:;,]", listi)
- for serv in standalone:
- if args[embedded_nam].count(serv) <= 0:
- args[standalone_nam].append(serv)
+ args[standalone_nam] = filter( lambda a: a.strip(), re.split( "[:;,]", cmd_opts.standalone ) )
+
+ # Normalize the '--standalone' and '--embedded' parameters
+ standalone, embedded = process_containers_params( args.get( standalone_nam ),
+ args.get( embedded_nam ) )
+ if standalone is not None:
+ args[ standalone_nam ] = standalone
+ if embedded is not None:
+ args[ embedded_nam ] = embedded
# Kill
if cmd_opts.portkill is not None: args[portkill_nam] = cmd_opts.portkill
if cmd_opts.save_config is not None:
args['save_config'] = cmd_opts.save_config
+ # Interactive python console
+ if cmd_opts.pinter is not None:
+ args[pinter_nam] = cmd_opts.pinter
+
####################################################
# Add <theAdditionalOptions> values to args
for add_opt in theAdditionalOptions:
os.environ["BaseDir"]=os.environ["HOME"]
else:
os.environ["BaseDir"]="/tmp"
-
- try:
- os.mkdir(os.environ["BaseDir"] + "/logs")
+
+ try:
+ os.mkdir(os.environ["BaseDir"] + "/logs")
os.chmod(os.environ["BaseDir"] + "/logs", 0777)
- except:
- #print "Can't create " + os.environ["BaseDir"] + "/logs"
- pass
-
- upath = os.environ["BaseDir"] + "/logs/";
- if sys.platform == "win32":
- upath += os.environ["Username"];
- else:
- upath += os.environ["USER"];
-
- try:
- os.mkdir(upath)
- except:
- #print "Can't create " + upath
- pass
-
- #os.system("touch " + upath + "/dummy")
- for fname in os.listdir(upath):
- try:
- os.remove(upath + "/" + fname)
- except:
- pass
- #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log")
-
- print "Name Service... "
- #hname=os.environ["HOST"] #commands.getoutput("hostname")
+ except:
+ #print "Can't create " + os.environ["BaseDir"] + "/logs"
+ pass
+
+ upath = os.environ["BaseDir"] + "/logs/";
if sys.platform == "win32":
- hname=getShortHostName();
+ upath += os.environ["Username"];
else:
- hname = socket.gethostname();
-
- print "hname=",hname
-
- f=open(os.environ["OMNIORB_CONFIG"])
- ss=re.findall("NameService=corbaname::" + hname + ":\d+", f.read())
- print "ss = ", ss
- f.close()
+ upath += os.environ["USER"];
+
+ try:
+ os.mkdir(upath)
+ except:
+ #print "Can't create " + upath
+ pass
+
+ #os.system("touch " + upath + "/dummy")
+ for fname in os.listdir(upath):
+ try:
+ os.remove(upath + "/" + fname)
+ except:
+ pass
+ #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log")
+
+ print "Name Service... ",
+ #hname=os.environ["HOST"] #commands.getoutput("hostname")
+ if sys.platform == "win32":
+ hname=getShortHostName();
+ else:
+ hname = socket.gethostname();
+ #print "hname=",hname
+
+ f=open(os.environ["OMNIORB_CONFIG"])
+ ss=re.findall("NameService=corbaname::" + hname + ":\d+", f.read())
+ print "ss = ", ss,
+ f.close()
sl=ss[0]
ll = sl.split(':')
aPort = ll[-1]
#aPort=(ss.join().split(':'))[2];
- #aPort=re.findall("\d+", ss[0])[0]
-
- #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/"
- #print "sed command = ", aSedCommand
- #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"])
- print "port=", aPort
- if sys.platform == "win32":
- #print "start omniNames -start " + aPort + " -logdir " + upath
+ #aPort=re.findall("\d+", ss[0])[0]
+
+ #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/"
+ #print "sed command = ", aSedCommand
+ #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"])
+ #print "port=", aPort
+ if sys.platform == "win32":
+ #print "start omniNames -start " + aPort + " -logdir " + upath
self.CMD=['omniNames -start ' , aPort , ' -logdir ' , '\"' + upath + '\"']
- #os.system("start omniNames -start " + aPort + " -logdir " + upath)
- else:
+ #os.system("start omniNames -start " + aPort + " -logdir " + upath)
+ else:
#self.CMD=['omniNames -start ' , aPort , ' -logdir ' , upath , ' &']
self.CMD=['omniNames','-start' , aPort, '-logdir' , upath ]
- #os.system("omniNames -start " + aPort + " -logdir " + upath + " &")
+ #os.system("omniNames -start " + aPort + " -logdir " + upath + " &")
- print "ok"
- print "to list contexts and objects bound int the context with the specified name : showNS "
+ print "... ok"
+ print "to list contexts and objects bound into the context with the specified name : showNS "
def initArgs(self):
self.CMD=['xterm', '-e']+ env_ld_library_path + ['python']
self.initNSArgs()
-
# In LifeCycleCORBA, FactoryServer is started with rsh on the requested
# computer if this Container does not exist. Default is localhost.
# Others Containers are started with start_impl method of FactoryServer Container.
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
+#
import sys,os,time
import string
from nameserver import *
# Initialise the ORB
self.orb=CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
# Initialise the Naming Service
- print "Obtain a reference to the root naming context"
- print args
self.initNS(args)
# --------------------------------------------------------------------------
def initNS(self,args):
- print "Obtain a reference to the root naming context"
# Obtain a reference to the root naming context
obj = self.orb.resolve_initial_references("NameService")
try:
return
except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
self.rootContext = None
- print "Lancement du Naming Service",
+ print "Launch Naming Service++",
# On lance le Naming Server (doit etre dans le PATH)
NamingServer(args).run()
print "Searching %s in Naming Service " % theName,
while(1):
try:
- aPid, aStatus = os.waitpid(thePID,os.WNOHANG)
- except Exception, exc:
- raise "Impossible de trouver %s" % theName
+ os.kill(thePID,0)
+ except:
+ raise "Process %d for %s not found" % (thePID,theName)
aCount += 1
anObj = self.Resolve(theName)
if anObj:
from Utils_Identity import getShortHostName
if sys.platform == "win32":
- # temporarily using home directory for Namning Service logs
- # to be replaced with TEMP later...
- os.environ["BaseDir"]=os.environ["HOME"]
+ # temporarily using home directory for Namning Service logs
+ # to be replaced with TEMP later...
+ os.environ["BaseDir"]=os.environ["HOME"]
else:
- os.environ["BaseDir"]="/tmp"
+ os.environ["BaseDir"]="/tmp"
os.environ["Username"]=os.environ["USER"]
# clear log files
def startOmni():
- try:
- os.mkdir(os.environ["BaseDir"] + "/logs")
- os.chmod(os.environ["BaseDir"] + "/logs", 0777)
- except:
- #print "Can't create " + os.environ["BaseDir"] + "/logs"
- pass
-
- upath = os.environ["BaseDir"] + "/logs/" + os.environ["Username"]
-
- try:
- os.mkdir(upath)
- except:
- #print "Can't create " + upath
- pass
-
- #os.system("touch " + upath + "/dummy")
- for fname in os.listdir(upath):
- try:
- os.remove(upath + "/" + fname)
- except:
- pass
- #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log")
-
- print "Name Service... "
- #hname=os.environ["HOST"] #commands.getoutput("hostname")
- if sys.platform == "win32":
+ try:
+ os.mkdir(os.environ["BaseDir"] + "/logs")
+ os.chmod(os.environ["BaseDir"] + "/logs", 0777)
+ except:
+ #print "Can't create " + os.environ["BaseDir"] + "/logs"
+ pass
+
+ upath = os.environ["BaseDir"] + "/logs/" + os.environ["Username"]
+
+ try:
+ os.mkdir(upath)
+ except:
+ #print "Can't create " + upath
+ pass
+
+ #os.system("touch " + upath + "/dummy")
+ for fname in os.listdir(upath):
+ try:
+ os.remove(upath + "/" + fname)
+ except:
+ pass
+ #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log")
+
+ print "Name Service... "
+ #hname=os.environ["HOST"] #commands.getoutput("hostname")
+ if sys.platform == "win32":
hname=getShortHostName()
- else:
- hname=socket.gethostname()
-
- print "hname=",hname
-
- f=open(os.environ["OMNIORB_CONFIG"])
- ss=re.findall("NameService=corbaname::" + hname + ":\d+", f.read())
- print "ss = ", ss
- f.close()
- aPort=re.findall("\d+", ss[0])[0]
-
- #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/"
- #print "sed command = ", aSedCommand
- #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"])
- global process_id
- print "port=", aPort
- if sys.platform == "win32":
+ else:
+ hname=socket.gethostname()
+
+ print "hname=",hname
+
+ f=open(os.environ["OMNIORB_CONFIG"])
+ ss=re.findall("NameService=corbaname::" + hname + ":\d+", f.read())
+ print "ss = ", ss
+ f.close()
+ aPort=re.findall("\d+", ss[0])[0]
+
+ #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/"
+ #print "sed command = ", aSedCommand
+ #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"])
+ global process_id
+ print "port=", aPort
+ if sys.platform == "win32":
#import win32pm
#command = ['omniNames -start ' , aPort , ' -logdir ' , '\"' + upath + '\"']
#os.system("start omniNames -start " + aPort + " -logdir " + "\"" + upath + "\"" )
#print command
pid = win32pm.spawnpid( string.join(command, " "), -nc )
process_id[pid]=command
- else:
- os.system("omniNames -start " + aPort + " -logdir " + upath + " &")
+ else:
+ os.system("omniNames -start " + aPort + " -logdir " + upath + " &")
- print "ok"
- print "to list contexts and objects bound int the context with the specified name : showNS "
+ print "ok"
+ print "to list contexts and objects bound into the context with the specified name : showNS "
# In LifeCycleCORBA, FactoryServer is started with rsh on the requested
# computer if this Container does not exist. Default is localhost.
#!/bin/bash
-if [ $# -ne 0 ] ; then
- ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
-else
- python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py
-fi
+${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
# -----------------------------------------------------------------------------
# examples:
#!/bin/csh -f
-runSalome --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --containers=cpp,python --killall
+runSalome --gui --modules=GEOM,SMESH,VISU,SUPERV,MED --killall
if [[ "$*" = "-nothing" ]]; then
echo "port:$NSPORT"
elif [ $# -ne 0 ] ; then
- python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
+ python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
else
python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py
fi
global process_id
command = self.CMD
print "INTERPSERVER::command = ", command
- if sys.platform == "win32":
+ if sys.platform == "win32":
import win32pm
pid = win32pm.spawnpid( string.join(command, " "),'-nc' )
- else:
+ else:
pid = os.spawnvp(os.P_NOWAIT, command[0], command)
process_id[pid]=self.CMD
self.PID = pid
def __init__(self,args):
self.args=args
self.initArgs()
- #if sys.platform == "win32":
- # self.SCMD1=[os.environ["KERNEL_ROOT_DIR"] + "/win32/" + os.environ["BIN_ENV"] + "/" + 'SALOME_ModuleCatalog_Server' + ".exe",'-common']
- #else:
+ #if sys.platform == "win32":
+ # self.SCMD1=[os.environ["KERNEL_ROOT_DIR"] + "/win32/" + os.environ["BIN_ENV"] + "/" + 'SALOME_ModuleCatalog_Server' + ".exe",'-common']
+ #else:
self.SCMD1=['SALOME_ModuleCatalog_Server','-common']
self.SCMD2=[]
home_dir=os.getenv('HOME')
def __init__(self,args):
self.args=args
self.initArgs()
- if sys.platform == "win32":
+ if sys.platform == "win32":
self.CMD=[os.environ["PYTHONBIN"], '\"'+os.environ["KERNEL_ROOT_DIR"] + '/bin/salome/SALOME_ContainerPy.py'+'\"','FactoryServerPy']
- else:
+ else:
self.CMD=['SALOME_ContainerPy.py','FactoryServerPy']
# ---
def __init__(self,args):
self.args=args
self.initArgs()
-# if sys.platform == "win32":
+ # if sys.platform == "win32":
# self.CMD=[os.environ["KERNEL_ROOT_DIR"] + "/win32/" + os.environ["BIN_ENV"] + "/" + 'SALOME_Container' + ".exe",'SuperVisionContainer']
-# else:
+# else:
self.CMD=['SALOME_Container','SuperVisionContainer']
# ---
def __init__(self,args):
self.args = args.copy()
# Bug 11512 (Problems with runSalome --xterm on Mandrake and Debian Sarge)
- self.args['xterm']=0
+ #self.args['xterm']=0
#
self.initArgs()
self.SCMD1=['SALOME_Session_Server']
-
self.SCMD2=[]
if 'registry' in self.args['embedded']:
self.SCMD1+=['--with','Registry',
# ---
-class ContainerManagerServer(Server):
+class LauncherServer(Server):
def __init__(self,args):
self.args=args
self.initArgs()
- self.SCMD1=['SALOME_ContainerManagerServer']
+ self.SCMD1=['SALOME_LauncherServer']
self.SCMD2=[]
if args["gui"] :
if 'registry' in self.args['embedded']:
clt.waitNSPID("/myStudyManager",myServer.PID)
#
- # Lancement ContainerManagerServer
+ # Lancement LauncherServer
#
- myCmServer = ContainerManagerServer(args)
+ myCmServer = LauncherServer(args)
myCmServer.setpath(modules_list,modules_root_dir)
myCmServer.run()
# attente de la disponibilite du Container C++ local dans le Naming Service
#
- if ('cppContainer' in args['standalone']) | (args["gui"] == 0):
+ if ('cppContainer' in args['standalone']) | (args["gui"] == 0) :
myServer=ContainerCPPServer(args)
myServer.run()
if sys.platform == "win32":
print "i=",i
anInterp=InterpServer(args)
anInterp.run()
-
+
+ # set PYTHONINSPECT variable
+ if args['pinter']:
+ os.environ["PYTHONINSPECT"]="1"
+
return clt
# -----------------------------------------------------------------------------
traceback.print_exc()
print
print
- print "--- erreur au lancement Salome ---"
+ print "--- Error during Salome launch ---"
#print process_id
i = 0
while i < len( toimport ) :
if toimport[ i ] == 'killall':
+ clt.showNS()
killAllPorts()
import sys
sys.exit(0)
limit=limit+10
while 1:
import os
- status = os.system("netstat -ltn | grep -E :%s > /dev/null 2>&1"%(NSPORT))
- if status:
+ import re
+ from os import getpid
+ from os import system
+
+ if sys.platform == "win32":
+ tmp_file = os.getenv('TEMP');
+ else:
+ tmp_file = '/tmp/'
+ tmp_file += 'hostname_%s'%(getpid())
+
+# status = os.system("netstat -ltn | grep -E :%s > /dev/null 2>&1"%(NSPORT))
+
+ system( "netstat -a -n > %s" % tmp_file );
+
+ f = open( tmp_file, 'r' );
+ lines = f.readlines();
+ f.close();
+
+ pattern = "tcp.*:([0-9]+).*:.*listen";
+ regObj = re.compile( pattern, re.IGNORECASE );
+
+ status = 1;
+ for item in lines:
+ m = regObj.search( item )
+ if m:
+ try:
+ p = int( m.group(1) )
+ if p == NSPORT:
+ status = 0;
+ break;
+ except:
+ pass
+ pass
+
+ if status == 1:
print "%s - OK"%(NSPORT)
#
- from os import getpid
- if sys.platform == "win32":
- tmp_file = os.getenv('TEMP');
- else:
- tmp_file = '/tmp/'
- tmp_file += 'hostname_%s'%(getpid())
- #tmp_file = '/tmp/hostname_%s'%(getpid())
- from os import system
system('hostname > %s'%(tmp_file))
f = open(tmp_file)
myhost = f.read()
myhost = myhost[:-1]
f.close()
- system('rm -f %s'%(tmp_file))
+
+ os.remove( tmp_file );
+
#
home = os.environ['HOME']
appli=os.environ.get("APPLI")
f = open(os.environ['OMNIORB_CONFIG'], "w")
import CORBA
if CORBA.ORB_ID == "omniORB4":
+ initref += "\ngiopMaxMsgSize = 2097152000 # 2 GBytes";
+ initref += "\ntraceLevel = 0 # critical errors only";
f.write("InitRef = %s\n"%(initref))
else:
+ initref += "\nORBgiopMaxMsgSize = 2097152000 # 2 GBytes";
+ initref += "\nORBtraceLevel = 0 # critical errors only";
f.write("ORBInitRef %s\n"%(initref))
pass
f.close()
#
if save_config:
from os import system
- system('ln -sf %s %s/.omniORB_last.cfg'%(os.environ['OMNIORB_CONFIG'], home))
+ if sys.platform == "win32":
+ import shutil
+ shutil.copyfile( os.environ['OMNIORB_CONFIG'], "%s/.omniORB_last.cfg"%( home ) )
+ else:
+ system('ln -s -f %s %s/.omniORB_last.cfg'%(os.environ['OMNIORB_CONFIG'], home))
pass
#
break
def main():
"""Salome launch as a main application"""
import sys
+ print "runSalome running on ",os.getenv('HOSTNAME')
args, modules_list, modules_root_dir = setenv.get_config()
kill_salome(args)
save_config = True
def initArgs(self):
self.PID=None
self.CMD=[]
- self.ARGS=[]
+ self.ARGS=[]
if self.args['xterm']:
self.ARGS=['xterm', '-iconic', '-sb', '-sl', '500', '-hold']
+ os.getenv("LD_LIBRARY_PATH")]
myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path
command = myargs + self.CMD
- print "command = ", command
- if sys.platform == "win32":
+ #print "command = ", command
+ if sys.platform == "win32":
import win32pm
#cmd_str = "\"" + string.join(command, " ") + "\""
#print cmd_str
#pid = win32pm.spawnpid( cmd_str )
pid = win32pm.spawnpid( string.join(command, " "), '-nc' )
#pid = win32pm.spawnpid( string.join(command, " ") )
- else:
- pid = os.spawnvp(os.P_NOWAIT, command[0], command)
+ else:
+ #pid = os.spawnvp(os.P_NOWAIT, command[0], command)
+ pid=self.daemonize(command)
process_id[pid]=self.CMD
self.PID = pid
+ return pid
+
+ def daemonize(self,args):
+ # to daemonize a process need to do the UNIX double-fork magic
+ # see Stevens, "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177)
+ # and UNIX Programming FAQ 1.7 How do I get my program to act like a daemon?
+ # http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16
+ #open a pipe
+ c2pread, c2pwrite = os.pipe()
+ #do first fork
+ pid=os.fork()
+ if pid > 0:
+ #first parent
+ os.close(c2pwrite)
+ #receive real pid from child
+ data=os.read(c2pread,24) #read 24 bytes
+ os.waitpid(pid,0) #remove zombie
+ os.close(c2pread)
+ # return : first parent
+ return int(data)
+
+ #first child
+ # decouple from parent environment
+ os.setsid()
+ os.close(c2pread)
+
+ # do second fork : second child not a session leader
+ try:
+ pid = os.fork()
+ if pid > 0:
+ #send real pid to parent
+ os.write(c2pwrite,"%d" % pid)
+ os.close(c2pwrite)
+ # exit from second parent
+ os._exit(0)
+ except OSError, e:
+ print >>sys.stderr, "fork #2 failed: %d (%s)" % (e.errno, e.strerror)
+ os.write(c2pwrite,"-1")
+ os.close(c2pwrite)
+ sys.exit(1)
+
+ #I am a daemon
+ os.close(0) #close stdin
+ os.open("/dev/null", os.O_RDWR) # redirect standard input (0) to /dev/null
+ try:
+ os.execvp(args[0], args)
+ except OSError, e:
+ print >>sys.stderr, "(%s) launch failed: %d (%s)" % (args[0],e.errno, e.strerror)
+ os._exit(127)
def add_path(directory, variable_name):
"""Function helper to add environment variables"""
if sys.platform == "win32":
- splitsym = ";"
+ splitsym = ";"
else:
- splitsym = ":"
+ splitsym = ":"
if not os.environ.has_key(variable_name):
os.environ[variable_name] = ""
pass
__lib__dir__ = "lib64"
else:
__lib__dir__ = "lib"
- return get_lib_dir()
+ return __lib__dir__
# -----------------------------------------------------------------------------
to_remove_list=[]
for module in modules_list :
- module_variable=module.upper()+"_ROOT_DIR"
+ module_variable=module+"_ROOT_DIR"
if not os.environ.has_key(module_variable):
print "*******************************************************"
print "*"
modules_list.remove("GUI")
pass
- if "SUPERV" in modules_list and not 'superv' in args['standalone']:
- args['standalone'].append("superv")
+ if "SUPERV" in modules_list and not 'supervContainer' in args['standalone']:
+ args['standalone'].append("supervContainer")
pass
return args, modules_list, modules_root_dir
python_version="python%d.%d" % sys.version_info[0:2]
modules_root_dir_list = []
+ if os.getenv('SALOME_BATCH') == None:
+ os.putenv('SALOME_BATCH','0')
if args["gui"] :
modules_list = modules_list[:] + ["GUI"]
modules_list = modules_list[:] + ["KERNEL"]
"PYTHONPATH")
- if sys.platform == "win32":
- add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir),
- "PATH")
+ if sys.platform == "win32":
+ add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir),
+ "PATH")
else:
add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir),
"LD_LIBRARY_PATH")
#if os.getenv("GUI_ROOT_DIR"):
#if not os.getenv("SalomeAppConfig"): os.environ["SalomeAppConfig"] = os.getenv("GUI_ROOT_DIR") + "/share/salome/resources/gui"
- # set CSF_PluginDefaults variable only if it is not customized
- # by the user
- if not os.getenv("CSF_PluginDefaults"):
- os.environ["CSF_PluginDefaults"] \
- = os.path.join(modules_root_dir["KERNEL"],"share",
- salome_subdir,"resources","kernel")
os.environ["CSF_SALOMEDS_ResourcesDefaults"] \
= os.path.join(modules_root_dir["KERNEL"],"share",
salome_subdir,"resources","kernel")
if "GEOM" in modules_list:
- if verbose(): print "GEOM OCAF Resources"
+ if verbose(): print "GEOM OCAF Resources"
+
+ # set CSF_PluginDefaults variable only if it is not customized
+ # by the user
+
+ if not os.getenv("CSF_PluginDefaults"):
+ os.environ["CSF_PluginDefaults"] \
+ = os.path.join(modules_root_dir["GEOM"],"share",
+ salome_subdir,"resources","geom")
os.environ["CSF_GEOMDS_ResourcesDefaults"] \
= os.path.join(modules_root_dir["GEOM"],"share",
salome_subdir,"resources","geom")
--- /dev/null
+#!/usr/bin/env python
+import orbmodule
+import Engines
+import Registry
+import SALOME
+import SALOMEDS
+import SALOME_ModuleCatalog
+clt=orbmodule.client()
+obj = clt.Resolve('Kernel/Session')
+if obj != None:
+ ses = obj._narrow(SALOME.Session)
+ ses.StopSession()
+obj = clt.Resolve('SalomeLauncher')
+if obj != None:
+ cm = obj._narrow(Engines.SalomeLauncher)
+ cm.Shutdown()
+obj = clt.Resolve('Kernel/ModulCatalog')
+if obj != None:
+ mc = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog)
+ mc.shutdown()
+obj = clt.Resolve('Registry')
+if obj != None:
+ reg = obj._narrow(Registry.Components)
+ reg.Shutdown()
+obj = clt.Resolve('myStudyManager')
+if obj != None:
+ sm = obj._narrow(SALOMEDS.StudyManager)
+ sm.Shutdown()
__lib__dir__ = "lib64"
else:
__lib__dir__ = "lib"
- return get_lib_dir()
+ return __lib__dir__
# -----------------------------------------------------------------------------
module_doc_tui_dir=os.path.join(module_dir,'doc','salome','tui')
module_doc_dir=os.path.join(module_dir,'doc','salome')
module_sharedoc_dir=os.path.join(module_dir,'share','doc','salome')
-
- if not os.path.exists(module_lib_py_dir):
- print "Python directory %s does not exist" % module_lib_py_dir
- return
+ module_sharedoc_gui_dir=os.path.join(module_dir,'share','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')
lib_dir=os.path.join(home_dir,'lib','salome')
doc_tui_dir=os.path.join(home_dir,'doc','salome','tui')
doc_dir=os.path.join(home_dir,'doc','salome')
sharedoc_dir=os.path.join(home_dir,'share','doc','salome')
+ sharedoc_gui_dir=os.path.join(home_dir,'share','doc','salome','gui')
+ sharedoc_tui_dir=os.path.join(home_dir,'share','doc','salome','tui')
verbose = options.verbose
pass
#directory lib/py_version/site-packages/salome : create it and link content
- mkdir(lib_py_shared_dir)
- for fn in os.listdir(module_lib_py_dir):
- if fn == "shared_modules": continue
- symlink(os.path.join(module_lib_py_dir, fn), os.path.join(lib_py_dir, fn))
- pass
- if os.path.exists(module_lib_py_shared_dir):
- for fn in os.listdir(module_lib_py_shared_dir):
- symlink(os.path.join(module_lib_py_shared_dir, fn), os.path.join(lib_py_shared_dir, fn))
- pass
- pass
+ if not os.path.exists(module_lib_py_dir):
+ print "Python directory %s does not exist" % module_lib_py_dir
else:
- print module_lib_py_shared_dir, " doesn't exist"
- pass
+ mkdir(lib_py_shared_dir)
+ for fn in os.listdir(module_lib_py_dir):
+ if fn == "shared_modules": continue
+ symlink(os.path.join(module_lib_py_dir, fn), os.path.join(lib_py_dir, fn))
+ pass
+ if os.path.exists(module_lib_py_shared_dir):
+ for fn in os.listdir(module_lib_py_shared_dir):
+ symlink(os.path.join(module_lib_py_shared_dir, fn), os.path.join(lib_py_shared_dir, fn))
+ pass
+ pass
+ else:
+ print module_lib_py_shared_dir, " doesn't exist"
+ pass
#directory share/doc/salome (KERNEL doc) : create it and link content
if os.path.exists(module_sharedoc_dir):
mkdir(sharedoc_dir)
for fn in os.listdir(module_sharedoc_dir):
+ if fn == 'gui':continue
+ if fn == 'tui':continue
symlink(os.path.join(module_sharedoc_dir, fn), os.path.join(sharedoc_dir, fn))
pass
pass
- pass
+ #directory share/doc/salome/gui : create it and link content
+ if os.path.exists(module_sharedoc_gui_dir):
+ mkdir(sharedoc_gui_dir)
+ for fn in os.listdir(module_sharedoc_gui_dir):
+ symlink(os.path.join(module_sharedoc_gui_dir, fn), os.path.join(sharedoc_gui_dir, fn))
+ pass
+ pass
+
+ #directory share/doc/salome/tui : create it and link content
+ if os.path.exists(module_sharedoc_tui_dir):
+ mkdir(sharedoc_tui_dir)
+ for fn in os.listdir(module_sharedoc_tui_dir):
+ symlink(os.path.join(module_sharedoc_tui_dir, fn), os.path.join(sharedoc_tui_dir, fn))
+ pass
+ pass
#directory share/salome/resources : create it and link content
- mkdir(share_dir)
- for fn in os.listdir(module_share_dir):
- symlink(os.path.join(module_share_dir, fn), os.path.join(share_dir, fn))
+ if os.path.exists(module_share_dir):
+ mkdir(share_dir)
+ for fn in os.listdir(module_share_dir):
+ symlink(os.path.join(module_share_dir, fn), os.path.join(share_dir, fn))
+ pass
+ pass
+ else:
+ print "resources directory %s does not exist" % module_share_dir
+ pass
#html files in doc/salome directory
if os.path.exists(module_doc_dir):
--- /dev/null
+#!/usr/bin/env python
+import sys
+import time
+import orbmodule
+import CosNaming
+clt = orbmodule.client()
+clt.waitNS("/ContainerManager")
+obj = clt.orb.resolve_initial_references("NameService")
+rootContext = obj._narrow(CosNaming.NamingContext)
+cname = []
+cname.append(CosNaming.NameComponent('Containers', 'dir'))
+
+while(1):
+ try:
+ ccontext = rootContext.resolve(cname)
+ break
+ except CosNaming.NamingContext.NotFound, ex:
+ time.sleep(1)
+ except CosNaming.NamingContext.InvalidName, ex:
+ time.sleep(1)
+ except CosNaming.NamingContext.CannotProceed, ex:
+ time.sleep(1)
+ except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
+ time.sleep(1)
+
+def waitContainer(mycont):
+ while(1):
+ bl,bi=ccontext.list(0)
+ if bi is not None:
+ ok,b=bi.next_one()
+ while(ok):
+ for s in b.binding_name :
+ if s.kind == "dir":
+ obj=ccontext.resolve([s])
+ scontext = obj._narrow(CosNaming.NamingContext)
+ bll,bii=scontext.list(0)
+ if bii is not None:
+ ok,bb=bii.next_one()
+ while(ok):
+ for s in bb.binding_name :
+ if s.id == mycont:
+ print s.id
+ return
+ ok,bb=bii.next_one()
+ ok,b=bi.next_one()
+ sys.stdout.write('+')
+ sys.stdout.flush()
+ time.sleep(1)
+
+for cont in sys.argv:
+ if cont != sys.argv[0]:
+ waitContainer(cont)
+
--- /dev/null
+#!/usr/bin/env python
+import orbmodule
+clt=orbmodule.client()
+clt.waitNS("/Kernel/ModulCatalog")
--- /dev/null
+#! /bin/sh
+status=1
+while [ $status -ne 0 ]; do
+ ls $HOME/$APPLI/.omniORB_last.cfg >& /dev/null
+ status=$?
+ sleep 1
+ echo -n "#"
+done
+./runSession waitNS.py
\ No newline at end of file
cd $libdir
# Files created by libtoolize
rm -f config.guess config.sub ltmain.sh
+rm -f mdate-sh texinfo.tex
# Files created by automake
rm -rf install-sh missing compile depcomp py-compile
cd $here
find salome_adm -name Makefile.in | xargs rm -f
find src -name Makefile.in | xargs rm -f
rm -f Makefile.in
+# Other files
+cd doc/salome
+rm -f Batch.info stamp-vti version.texi
echo ---------------------------------------------
echo
# production.m4
-AC_ENABLE_DEBUG(yes)
-AC_DISABLE_PRODUCTION
+AC_ENABLE_DEBUG(no)
+AC_ENABLE_PRODUCTION(no)
echo
echo ---------------------------------------------
CHECK_HDF5
-echo
-echo ---------------------------------------------
-echo Testing OpenCascade
-echo ---------------------------------------------
-echo
-
-CHECK_CAS
-
# ----------------------------------------------------------------------------
# --- test corba
echo
echo ---------------------------------------------
-echo Testing QT
+echo BOOST Library
echo ---------------------------------------------
echo
-# Qt must be kept because kernel makes use of qxml and some other
-# non-graphical stuff.
-CHECK_QT
+
+CHECK_BOOST
echo
echo ---------------------------------------------
-echo BOOST Library
+echo Testing libxml2
echo ---------------------------------------------
echo
-CHECK_BOOST
+CHECK_LIBXML
fi
# --- end test corba
# --------------------------------------
if test x$corba_gen = xtrue; then
- basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok occ_ok"
+ basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok"
else
- basic_mandatory_products="cc_ok threads_ok hdf5_ok occ_ok"
+ basic_mandatory_products="cc_ok threads_ok hdf5_ok"
fi
echo --- General mandatory products - Light configuration:
check_fatal_error $basic_mandatory_products
echo
-corba_mandatory_products="omniORB_ok qt_ok boost_ok"
+corba_mandatory_products="omniORB_ok boost_ok libxml_ok"
if test x$corba_gen = xtrue; then
echo --- CORBA mandatory products - default configuration:
summary $corba_mandatory_products
./src/Basics/Test/Makefile \
./src/Batch/Makefile \
./src/Batch_SWIG/Makefile \
- ./src/CASCatch/Makefile \
./src/Communication/Makefile \
./src/Communication_SWIG/Makefile \
./src/Container/Makefile \
./src/ParallelContainer/Makefile \
+ ./src/DF/Makefile \
./src/DSC/Makefile \
./src/DSC/DSC_Basic/Makefile \
./src/DSC/DSC_User/Makefile \
./src/DSC/DSC_User/Datastream/Palm/Makefile \
./src/DSC/DSC_User/Datastream/Calcium/Makefile \
./src/DSC/ParallelDSC/Makefile \
+ ./src/DSC/DSC_Python/Makefile \
./src/GenericObj/Makefile \
./src/HDFPersist/Makefile \
./src/KERNEL_PY/Makefile \
+ ./src/Launcher/Makefile \
./src/LifeCycleCORBA/Makefile \
./src/LifeCycleCORBA/Test/Makefile \
./src/LifeCycleCORBA_SWIG/Makefile \
doc_DATA =
if RST2HTML_IS_OK
- doc_DATA += \
- index.html \
- UnitTests.html \
- SALOME_Application.html \
- INSTALL.html \
- kernel_resources.html \
- KERNEL_Services.html
+# doc_DATA += \
+# index.html \
+# UnitTests.html \
+# SALOME_Application.html \
+# INSTALL.html \
+# kernel_resources.html \
+# KERNEL_Services.html
endif
EXTRA_DIST=$(doc_DATA)
(cd salome && $(MAKE) $(AM_MAKEFLAGS) usr_docs)
dev_docs:
- (cd salome && $(MAKE) $(AM_MAKEFLAGS) dev_docs)
\ No newline at end of file
+ (cd salome && $(MAKE) $(AM_MAKEFLAGS) dev_docs)
install-data-local: html usr_docs
cp -rp $(top_builddir)/doc/salome/Batch.html $(docdir)
+
+EXTRA_DIST= main.dox install.dox \
+ kernel_resources.dox kernel_services.dox \
+ salome_application.dox unittests.dox \
+ salome_file.dox batch.dox
--- /dev/null
+/*!
+
+\page batch_page Batch
+
+<a href="Batch.html/index.html"> Batch documentation </a>
+
+*/
+
+
+
--- /dev/null
+/*!
+ \page INSTALL Installation instructions
+
+<b>NOT UP TO DATE %SALOME 4</b>
+<b>WORK in PROGRESS, INCOMPLETE DOCUMENT</b>
+
+You'll find here generic instructions for installing the SALOME2 platform.
+
+\section Summary
+
+<ol>
+<li> \ref S1_install </li>
+<li> \ref S2_install </li>
+<li> \ref S3_install </li>
+<li> \ref S4_install </li>
+<li> \ref S5_install </li>
+<li> \ref S6_install </li>
+<li> \ref S7_install </li>
+<li> \ref S8_install </li>
+</ol>
+
+\section S1_install Quick Overview
+
+First of all, you have to check (or install if needed) the dependant
+software programs on your system. These programs are:
+
+- common development tools as gcc, automake, autoconf and libtools.
+- third party softwares used in SALOME building or runtime process
+ (python, OCC, VTK, ...)
+
+Further details can be found in sections [2] and [3].
+
+If the dependencies are installed on your system, then you have to set
+your shell environment to get access to the software components
+(cf. [4]. "Preparing the shell environment").
+
+The next step is to install the KERNEL (cf. [5] "Installing KERNEL"):
+
+\code
+$ mkdir <kernel_build>
+$ mkdir <kernel_install>
+$ cd <kernel_src>
+$ ./build_configure
+$ cd <kernel_build>
+$ <kernel_src>/configure --prefix=<kernel_install>
+$ make
+$ make install
+\endcode
+
+Then, the %SALOME components GEOM, MED, VISU, ... can be installed
+with a similar procedure (cf. [6]).
+
+Eventually, the platform ccodean be run by executing the shell script
+runSalome (cf. [7]). Here, somme additionnal variables have to be set
+to describe the %SALOME runtime configuration (<COMPONENT>_ROOT_DIR,
+OMNIORB_CONFIG)
+
+The following provides you with specific instructions for each step.
+
+
+\section S2_install System configuration
+
+%SALOME is compiled and tested on differents platforms with native packages:
+- Debian sarge
+- Mandrake 10.1
+- ...
+
+If you have another platform, we suggest the following configuration
+for building process:
+
+- gcc-3.3.x or 3.4.x
+- automake-1.7 or more (only aclocal is used)
+- autoconf-2.59
+- libtool-1.5.6
+
+remarks:
+
+- This is the minimum level of automake, autoconf and libtool, if you need
+ to compile all the third party softwares (included OpenCascade 5.2.x).
+
+\section S3_install Third-party dependencies
+
+The %SALOME platform relies on a set of third-party softwares. The
+current version depends on the following list
+(versions given here are from Debian Sarge, except OpenCascade, VTK and MED,
+which are not Debian packages):
+
+- CAS-5.2.4 OpenCascade (try binaries,a source patch is needed)
+- VTK-4.2.6 VTK 3D-viewer
+- PyQt-3.13 Python-Qt Wrapper
+- Python-2.3.5 Python interpreter
+- SWIG-1.3.24 SWIG library
+- boost-1_32_0 C++ library (only include templates are used)
+- hdf5-1.6.2 Files Database library
+- med-2.2.2 MED Data Format support for file records
+- omniORB-4.0.5 ORB used in %SALOME
+- qt-x11-free-3.3.3 Qt library
+- qwt-4.2 Graph components for Qt
+- sip4-4.1.1 langage binding software
+
+And, in order to build the documentation:
+
+- doxygen-1.4.2
+- graphviz-2.2.1
+
+
+Additionnal software may be installed for optional features:
+
+- netgen4.3 + patch
+- tix8.1.4
+- openpbs-2.3.16
+- lsf-???
+
+<b>To Do</b>
+
+- Instructions for installing these software programs can be found in a
+ special note doc/configuration_examples/install-prerequis.
+- Installation shell scripts are also provided.
+ These scripts have to be adapted to your own configuration.
+
+- See doc/configuration_examples/*
+
+In the following, we assume that all the third-party softwares are
+installed in the same root directory, named <salomeroot>/prerequis.
+Then, your file system should probably look like::
+
+\code
+<salomeroot>/prerequis/Python-2.2.2
+<salomeroot>/prerequis/omniORB-3.0.5
+<salomeroot>/prerequis/qt-x11-free-3.0.5
+...
+\endcode
+
+\section S4_install Preparing the shell environment
+
+Some variables have to be set to get acces to third-party software
+components (include files, executable, library, ...) during building
+process and runtime.
+
+The shell file prerequis.sh, embedded in the KERNEL source package,
+provides a template for setting those variables. In this example, all the
+softwares are supposed to be installed in the same root directory,
+named here INSTALLROOT.
+
+Copy the prerequis.sh in a working directory and adjust the settings
+to your own configuration. To get the shell prepared, just
+execute the following command in the building shell:
+
+\code
+$ source prerequis.sh
+\endcode
+
+(we assume here a ksh or bash mode)
+
+
+\section S5_install Installing the KERNEL component
+
+We use here the notation <kernel_src> to specify the source directory
+of the KERNEL component. The shell environment is supposed to have
+been set (cf. 4).
+
+Installing the KERNEL from a source package needs three directories:
+
+- the source directory, denoted here by <kernel_src>.
+
+- the build directory, denoted by <kernel_build> in the following. This
+ directory can't be the same directory as <kernel_src>.
+
+- the install directory, denoted by <kernel_install> in the following. This
+ directory can't be the same directory as <kernel_src> or
+ <kernel_build>.
+
+The installing process is:
+
+<b>STEP 1:</b>
+ preparing directories
+
+ create the <kernel_build> and the <kernel_install> directories:
+
+ \code
+$ mkdir <kernel_build>
+$ mkdir <kernel_install>
+\endcode
+
+<b>STEP 2:</b>
+ build configure script
+
+ go to <kernel_src> directory and generate the "configure" script:
+
+ \code
+$ cd <kernel_src>
+$ ./build_configure
+ \endcode
+
+ If it doesn't work, check your system automake tools as specified in
+ section [2].
+
+<b>STEP 3:</b>
+ configure the building process
+ go to the build directory and execute the configuration process::
+
+ \code
+$ cd <kernel_build>
+$ <kernel_src>/configure --prefix=<kernel_install>
+ \endcode
+
+ Note that <kernel_install> must be an absolute path.
+
+ When the configure process is complete, check the status of
+ third-party softwares detection. You should have a status like::
+
+ \code
+ ---------------------------------------------
+ Summary
+ ---------------------------------------------
+ Configure
+ cc : yes
+ boost : yes
+ lex_yacc : yes
+ python : yes
+ swig : yes
+ threads : yes
+ OpenGL : yes
+ qt : yes
+ vtk : yes
+ hdf5 : yes
+ med2 : yes
+ omniORB : yes
+ occ : yes
+ sip : yes
+ pyqt : yes
+ qwt : yes
+ doxygen : yes
+ graphviz : no
+ openpbs : no
+ lsf : no
+ Default ORB : omniORB
+ ----------------------------------------------
+ \endcode
+
+If a software get a status "no", then it's not "seen" in the system:
+
+- the software is not installed, or
+- the shell environment is not set correctly.
+
+In this example, the software programs graphviz, openpbs and lsf are not
+installed (optional for most usages).
+
+
+<b>STEP 4 :</b>
+ Building the binary files
+
+ Execute make in the <kernel_build> directory::
+
+ \code
+$ make
+ \endcode
+
+<b>STEP 5:</b>
+ Installing binary files, scripts and documentation
+
+ Execute install target in the <kernel_build> directory::
+
+ \code
+$ make install
+ \endcode
+
+\section S6_install Installing the SALOME components
+
+TInstalling a component <COMPONENT> is done by following the same
+instructions as given for the KERNEL, replacing KERNEL by
+<COMPONENT> (build_configure, configure, make, make install).
+
+You just have to be aware of the dependencies between components:
+
+- MED depends on KERNEL
+- GEOM depends on KERNEL
+- SMESH depends on KERNEL, MED, GEOM
+- VISU depends on KERNEL, MED
+- SUPERV depends on KERNEL
+
+For example, installing the component SMESH needs the previous
+installation of the KERNEL component, and then the GEOM and MED components.
+
+The building process uses the variables <COMPONENT>_ROOT_DIR to
+localize the dependant components. The variables must be set to the
+install path directory of the components <COMPONENT> (ex:
+KERNEL_ROOT_DIR=<kernel_install>).
+
+In the above example, the three variables KERNEL_ROOT_DIR,
+GEOM_ROOT_DIR and MED_ROOT_DIR have to be set before configuring the
+building process of the SMESH component (STEP 3).
+
+
+\section S7_install Runtime
+
+See SALOME_Application to define your own configuration of %SALOME and run it
+on one or several computers. This is the recommended way of configuration.
+
+The following explains the general principles.
+
+To run the %SALOME platform, the procedure is:
+
+- set the shell environment to get acces to third-party softwares:
+
+\code
+$ source prerequis.sh
+\endcode
+
+- define the %SALOME configuration by setting the whole set of
+ variables <COMPONENT>_ROOT_DIR. Here, you just have to set the
+ kernel and the components you need::
+
+ \code
+$ export KERNEL_ROOT_DIR=<kernel_install>
+$ export MED_ROOT_DIR=<med_install>
+$ ...
+ \endcode
+
+- define the CORBA configuration file by setting the variable
+ OMNIORB_CONFIG. This variable must be set to a writable file
+ path. The file may be arbitrary chosen and doesn't need to exist
+ before running. We suggest::
+
+ \code
+$ export OMNIORB_CONFIG=$HOME/.omniORB.cfg
+ \endcode
+
+- run the %SALOME platform by executing the script runSalome:
+
+ \code
+$KERNEL_ROOT_DIR/bin/salome/runSalome
+ \endcode
+
+\section S8_install Suggestions and advices
+
+For convenience or customization, we suggest the following organisation:
+
+- chose and create a root directory for the %SALOME platform, say
+ <salomeroot>.
+
+- install the third-party softwares in a sub-directory "prerequis"
+
+- install the %SALOME components in a sub-directory "SALOME2"
+
+- make personnal copies of the files prerequis.sh and runSalome in
+ <salomeroot>:
+
+ \code
+$ cp <kernel_src>/prerequis.sh <rundir>/.
+$ cp <kernel_install>/bin/salome/runSalome <rundir>/.
+ \endcode
+
+ Edit the file prerequis.sh and adjust it to your own configuration.
+
+- define the SALOME2 configuration
+
+ This step consists in setting the KERNEL_ROOT_DIR, the whole set of
+ variables <COMPONENT>_ROOT_DIR you need, and the OMNIORB_CONFIG
+ variable.
+
+ We suggest to create a shell file envSalome.sh containing those
+ settings. Then the configuration consists in loading envSalome.sh in
+ the runtime shell:
+
+\code
+$ source envSalome.sh
+\endcode
+
+- When installed with this file organisation, running %SALOME is done
+ with the following shell commands::
+
+ \code
+ $ source <salomeroot>/prerequis.sh
+ $ source <salomeroot>/envSalome.sh
+ $ ./runSalome
+ \endcode
+*/
--- /dev/null
+/*!
+
+\page kernel_resources SALOME Kernel resources for developer
+
+<b>WORK in PROGRESS, INCOMPLETE DOCUMENT</b>
+
+
+\section S1_kernel_res Abstract
+
+This document describes the development environment for
+C++ and Python. Makefiles generation and usage are
+introduced in another document: "using the %SALOME
+configuration and building system environment".
+Development environment is intended here as: trace and
+debug macros usage; %SALOME exceptions usage, in C++ and
+Python; user CORBA exceptions usage, in C++ and Python,
+with and without Graphical User Interface; some general
+purpose services such as singleton, used for CORBA
+connection and disconnection.
+
+\section S2_kernel_res Trace and debug Utilities
+
+During the development process, an execution log is
+useful to identify problems. This log contains
+messages, variables values, source files names and line
+numbers. It is recommended to verify assertions on
+variables values and if necessary, to stop the
+execution at debug time, in order to validate all parts
+of code.
+
+<ol>
+<li>
+<b>Two modes: debug and release</b>
+
+The goal of debug mode is to check as many features as
+possible during the early stages of the development
+process. The purpose of the utilities provided in
+%SALOME is to help the developer to add detailed traces
+and check variables values, without writing a lot of code.
+
+When the code is assumed to be valid, the release mode
+optimizes execution, in terms of speed, memory, and
+display only user level messages.
+
+But, some informations must always be displayed in both
+modes: especially messages concerning environment or
+internal errors, with version identification. When an
+end user is confronted to such a message, he may refer
+to a configuration documentation or send the message to
+the people in charge of %SALOME installation, or to the
+development team, following the kind of error.
+</li>
+<li>
+<b>C++ Macros for trace and debug</b>
+
+%SALOME provides C++ macros for trace and debug. These
+macros are in:
+
+\code
+KERNEL_SRC/src/SALOMELocalTrace/utilities.h
+\endcode
+
+This file must be included in C++ source. Some
+macros are activated only in debug mode, others are
+always activated. To activate the debug mode, ``_DEBUG_``
+must be defined, which is the case when %SALOME
+Makefiles are generated from configure, without
+options. When ``_DEBUG_`` is undefined (release mode:
+``configure --disable-debug --enable-production``), the
+debug mode macros are defined empty (they do nothing).
+So, when switching from debug to release, it is
+possible (and recommended) to let the macro calls
+unchanged in the source.
+
+All the macros generate trace messages, stored in a
+circular buffer pool. %A separate %thread reads the
+messages in the buffer pool, and, depending on options
+given at %SALOME start, writes the messages on the
+standard output, a file, or send them via CORBA, in
+case of a multi machine configuration.
+
+Three informations are systematically added in front of
+the information displayed:
+
+- the %thread number from which the message come from;
+
+- the name of the source file in which the macros is set;
+
+- the line number of the source file at which the macro
+ is set.
+
+<ol>
+<li>
+<b>Macros defined in debug and release modes</b>
+\n
+<b>INFOS_COMPILATION</b>
+
+ The C++ macro INFOS_COMPILATION writes on the trace
+ buffer pool informations about the compiling process:
+
+ - the name of the compiler : g++, KCC, CC, pgCC;
+
+ - the date and the time of the compiling processing process.
+
+ This macro INFOS_COMPILATION does not have any
+ argument. Moreover, it is defined in both compiling
+ mode : _DEBUG_ and _RELEASE_.
+
+ Example:
+
+ \code
+#include "utilities.h"
+int main(int argc , char **argv)
+{
+ INFOS_COMPILATION;
+ ...
+}
+INFOS(str)
+ \endcode
+\n
+<b>INFOS</b>
+
+ In both compiling mode _DEBUG_ and _RELEASE_, The C++
+ macro INFOS writes on the trace buffer pool %the string
+ which has been passed in argument by the user.
+
+ Example:
+
+ \code
+#include "utilities.h"
+int main(int argc , char **argv)
+{
+ ...
+ INFOS("NORMAL END OF THE PROCESS");
+ return 0;
+}
+ \endcode
+
+ Displays:
+
+ \code
+main.cxx [5] : NORMAL END OF THE PROCESS
+ \endcode
+\n
+<b>INTERRUPTION(str)</b>
+
+ In both compiling mode _DEBUG_ and _RELEASE_, The C++
+ macro INTERRUPTION writes on the trace buffer pool the
+ %string, with a special ABORT type. When the %thread in
+ charge of collecting messages finds this message, it
+ terminates the application, after message treatment.
+
+<b>IMMEDIATE_ABORT(str)</b>
+
+ In both compiling mode _DEBUG_ and _RELEASE_, The C++
+ macro IMMEDIATE_ABORT writes the message str immediately on
+ standard error and exits the application. Remaining
+ messages not treated by the message collector %thread
+ are lost.
+
+</li>
+<li>
+<b>Macros defined only in debug mode</b>
+\n
+<b>MESSAGE(str)</b>
+
+ In _DEBUG_ compiling mode only, the C++ macro MESSAGE
+ writes on the trace buffer pool the %string which has
+ been passed in argument by the user. In _RELEASE_
+ compiling mode, this macro is blank.
+
+ Example:
+
+ \code
+#include "utilities.h"
+#include <string>
+
+using namespace std;
+
+int main(int argc , char **argv)
+{
+ ...
+ const char *str = "Salome";
+ MESSAGE(str);
+ ... const string st;
+ st = "Aster";
+ MESSAGE(c_str(st+" and CASTEM"));
+ return 0;
+}
+
+ \endcode
+
+ Displays:
+
+ \code
+- Trace main.cxx [8] : Salome
+- Trace main.cxx [12] : Aster and CASTEM
+ \endcode
+
+\n
+<b>BEGIN_OF(func_name)</b>
+
+ In _DEBUG_ compiling mode, The C++ macro BEGIN_OF
+ appends the %string "Begin of " to the one passed in
+ argument by the user and displays the result on the
+ trace buffer pool. In _RELEASE_ compiling mode, this
+ macro is blank.
+
+ Example:
+
+ \code
+#include "utilities.h"
+int main(int argc , char **argv)
+{
+ BEGIN_OF(argv[0]);
+ return 0;
+}
+ \endcode
+
+ Displays:
+
+ \code
+ - Trace main.cxx [3] : Begin of a.out
+ \endcode
+\n
+<b>END_OF(func_name)</b>
+
+ In _DEBUG_ compiling mode, The C++ macro END_OF appends
+ the %string "Normal end of " to the one passed in
+ argument by the user and displays the result on the
+ trace buffer pool. In _RELEASE_ compiling mode, this
+ macro is blank.
+
+ Example:
+
+ \code
+#include "utilities.h"
+int main(int argc , char **argv)
+{
+ END_OF(argv[0]);
+ return 0;
+}
+ \endcode
+
+ Displays:
+
+ \code
+- Trace main.cxx [4] : Normal end of a.out
+ \endcode
+\n
+<b>SCRUTE(var)</b>
+
+ In _DEBUG_ compiling mode, The C++ macro SCRUTE
+ displays its argument which is an application variable
+ followed by the value of the variable. In _RELEASE_
+ compiling mode, this macro is blank.
+
+ Example:
+
+ \code
+#include "utilities.h"
+int main(int argc , char **argv)
+{
+ const int i=999;
+ if( i > 0 ) SCRUTE(i) ; i=i+1;
+ return 0;
+}
+ \endcode
+
+ Displays:
+
+ \code
+- Trace main.cxx [5] : i=999
+ \endcode
+\n
+<b>ASSERT(condition)</b>
+
+ In _DEBUG_ compiling mode only, The C++ macro ASSERT
+ checks the expression passed in argument to be not
+ NULL. If it is NULL the condition is written with the
+ macro INTERRUPTION (see above). The process exits after
+ trace of this last message. In _RELEASE_ compiling
+ mode, this macro is blank. N.B. : if ASSERT is already
+ defined, this macro is ignored.
+
+ Example:
+
+ \code
+#include "utilities.h"
+...
+const char *ptrS = fonc();
+ASSERT(ptrS!=NULL);
+cout << strlen(ptrS);
+float table[10];
+int k;
+...
+ASSERT(k<10);
+cout << table[k];
+ \endcode
+
+</li>
+</ol>
+</li>
+</ol>
+
+\section S3_kernel_res Exceptions
+
+<ol>
+<li>
+<b>C++ exceptions: class SALOME_Exception</b>
+
+<ol>
+<li>
+<b>definition</b>
+
+The class SALOME_Exception provides a generic method to
+send a message, with optional source file name and line
+number. This class is intended to serve as a base class
+for all kinds of exceptions %SALOME code. All the
+exceptions derived from SALOME_Exception could be
+handled in a single catch, in which the message
+associated to the exception is displayed, or sent to a
+log file.
+
+The class SALOME_Exception inherits its behavior from
+the STL class exception.
+</li>
+<li>
+<b>usage</b>
+
+The header %SALOME/src/utils/utils_SALOME_Exception.hxx
+must be included in the C++ source, when raised or trapped:
+
+\code
+#include "utils_SALOME_Exception.hxx"
+\endcode
+
+The SALOME_Exception constructor is:
+
+\code
+SALOME_Exception( const char *text,
+ const char *fileName=0,
+ const unsigned int lineNumber=0 );
+\endcode
+
+The exception is raised like this:
+
+\code
+throw SALOME_Exception("my pertinent message");
+\endcode
+
+or like this:
+
+\code
+throw SALOME_Exception(LOCALIZED("my pertinent message"));
+\endcode
+
+where LOCALIZED is a macro provided with
+``utils_SALOME_Exception.hxx`` which gives file name and
+line number.
+
+The exception is handled like this:
+
+\code
+ try
+{
+ ...
+}
+catch (const SALOME_Exception &ex)
+{
+ cerr << ex.what() <<endl;
+}
+\endcode
+
+The what() method overrides the one defined in the STL
+exception class.
+</li>
+</ol>
+</li>
+<li>
+<b>CORBA exceptions</b>
+
+<ol>
+<li>
+<b>definition</b>
+
+The idl SALOME_Exception provides a generic CORBA
+exception for %SALOME, with an attribute that gives an
+exception type,a message, plus optional source file
+name and line number.
+
+This idl is intended to serve for all user CORBA
+exceptions raised in %SALOME code, as IDL specification
+does not support exception inheritance. So, all the
+user CORBA exceptions from %SALOME could be handled in a
+single catch.
+
+The exception types defined in idl are:
+
+ - COMM CORBA communication problem,
+
+ - BAD_PARAM Bad User parameters,
+
+ - INTERNAL_ERROR application level problem (often irrecoverable).
+
+CORBA system and user exceptions already defined in the
+packages used within %SALOME, such as OmniORB
+exceptions, must be handled separately.
+
+</li>
+<li>
+<b>usage</b>
+<ol>
+<li>
+<b>CORBA servant, C++</b>
+
+ The CORBA Server header for SALOME_Exception and a
+ macro to throw the exception are provided with the
+ header ``KERNEL_SRC/src/Utils/Utils_CorbaException.hxx``:
+
+ \code
+#include "Utils_CorbaException.hxx"
+ \endcode
+
+ The exception is raised with a macro which appends file
+ name and line number:
+
+ \code
+if (myStudyName.size() == 0)
+ THROW_SALOME_CORBA_EXCEPTION("No Study Name given",
+ SALOME::BAD_PARAM);
+ \endcode
+
+</li>
+<li>
+<b>CORBA Client, GUI Qt C++</b>
+
+ <b>NO MORE AVAILABLE in %SALOME 3.x</b>
+
+ The CORBA Client header for SALOME_Exception and a Qt
+ function header that displays a message box are
+ provided in:
+
+ ``KERNEL_SRC/src/SALOMEGUI/SALOMEGUI_QtCatchCorbaException.hxx``
+
+ \code
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+ \endcode
+
+ %A typical exchange with a CORBA Servant will be:
+
+ \code
+try
+{
+ ... // one ore more CORBA calls
+}
+
+catch (const SALOME::SALOME_Exception & S_ex)
+{
+ QtCatchCorbaException(S_ex);
+}
+ \endcode
+
+</li>
+<li>
+<b>CORBA Client, C++, without GUI</b>
+
+ Nothing specific has been provided to the developer
+ yet. See the idl or the Qt function
+ SALOMEGUI_QtCatchCorbaException.hxx to see how to get
+ the information given by the exception %object.
+
+</li>
+</ol>
+</li>
+</ol>
+</ol>
+
+\section S4_kernel_res Miscellaneous tools
+
+<ol>
+<li>
+<b>Singleton</b>
+<ol>
+<li>
+<b>Definition</b>
+
+%A singleton is an application data which is created and
+deleted only once at the end of the application
+process. The C++ compiler allows the user to create a
+static singleton data before the first executable
+statement. They are deleted after the last statement execution.
+
+The ``SINGLETON_`` template class deals with dynamic
+singleton. It is useful for functor objects. For
+example, an %object that connects the application to a
+system at creation and disconnects the application at deletion.
+
+</li>
+<li>
+<b>Usage</b>
+
+To create a single instance of a POINT %object:
+
+\code
+# include "Utils_SINGLETON.hxx"
+...
+POINT *ptrPoint=SINGLETON_<POINT>::Instance() ;
+assert(ptrPoint!=NULL) ;
+\endcode
+
+No need to delete ptrPoint. Deletion is achieved
+automatically at exit. If the user tries to create more
+than one singleton by using the class method
+SINGLETON_<TYPE>::Instance(), the pointer is returned
+with the same value even if this is done in different
+functions (threads ?):
+
+\code
+POINT *p1=SINGLETON_<POINT>::Instance() ;
+...
+POINT *p2=SINGLETON_<POINT>::Instance() ;
+
+assert(p1==p2)
+\endcode
+
+</li>
+<li>
+<b>Design description</b>
+
+Here are the principles features of the singleton
+design:
+
+- the user creates an %object of class TYPE by using the
+ class method ``SINGLETON_<TYPE>::Instance()`` which
+ returns a pointer to the single %object ;
+
+- to create an %object, ``SINGLETON_<TYPE>::Instance()``
+ uses the default constructor of class TYPE ;
+
+- at the same time, this class method creates a
+ destructor %object which is added to the generic list
+ of destructor objects to be executed at the end of
+ the application (atexit) ;
+
+- at the end of the application process all the
+ deletions are performed by the ``Nettoyage()`` C function
+ which executes the destruction objects end then
+ deletes the destructions objects themselves ;
+
+- the ``Nettoyage()`` C function using ``atexit()`` C function
+ is embedded in a static single %object ``ATEXIT_()``.
+
+</li>
+</ol>
+</li>
+</ol>
+
+*/
--- /dev/null
+/*!
+ \page KERNEL_Services KERNEL Services for end user (Python interface)
+
+<b>WORK in PROGRESS, INCOMPLETE DOCUMENT</b>
+
+In a %SALOME application, distributed components, servers and clients use
+the CORBA middleware for comunication. CORBA interfaces are defined via idl
+files. All the different CORBA interfaces are available for users in Python,
+see CORBA interfaces below.
+
+For some general purpose services, CORBA interfaces have been encapsulated
+in order to provide a simple interface (encapsulation is generally done in
+C++ classes, and a Python SWIG interface is also generated from C++, to
+ensure a consistent behavior between C++ modules and Python modules or user
+script).
+
+\section S1_kernel_ser General purpose services
+
+<ol>
+<li>
+<b>%SALOME services access from a Python shell</b>
+
+See \ref SALOME_Application for detailed instructions to launch a Python
+interpreter with full acces to the %SALOME environment and services.
+
+You can use the embedded Python interpreter in Grahic User Interface, or an
+external interpreter, with:
+
+\code
+./runSession
+python
+\endcode
+
+In either cases, %SALOME services access is done with:
+
+\code
+import salome
+salome.salome_init()
+\endcode
+
+In the embedded interpreter, it is already done, but there is no problem to
+do it several times, so it is preferable to add these instructions
+systematically in your scripts, to allow them to work in all configurations.
+
+</li>
+<li>
+<b>Container and component instanciation</b>
+
+See LifeCycleCORBA for the C++ interface (Python interface obtained with SWIG
+is very similar).
+
+In the following example, a test component provided in KERNEL is launched
+in the local container, "FactoryServer", created when %SALOME starts:
+
+\code
+import salome
+salome.salome_init()
+
+import LifeCycleCORBA
+lcc = LifeCycleCORBA.LifeCycleCORBA()
+obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent")
+
+import Engines
+comp=obj._narrow(Engines.TestComponent)
+
+comp.Coucou(1)
+\endcode
+
+The answer is something like:
+
+\code
+'TestComponent_i : L = 1'
+\endcode
+
+The _narrow() instruction is not always mandatory in Python, but sometimes
+useful to be sure you have got the right type of %object. Here, Testcomponent
+interface is defined in CORBA module Engines. With this example, it works also
+without the _narrow() instruction:
+
+\code
+ obj.Coucou(1)
+\endcode
+
+In the next example, a component instance is created in a specific Container
+defined by it's computer hostname and it's name. Here we use the local
+computer. Note that in Utils_Identity, getShortHostName() gives the short
+hostname of the computer, without domain suffixes, which is used in %SALOME.
+The container process is created here if it does not exists, and a new
+component instance is created:
+
+\code
+import salome
+salome.salome_init()
+import LifeCycleCORBA
+lcc = LifeCycleCORBA.LifeCycleCORBA()
+
+import Utils_Identity
+host = Utils_Identity.getShortHostName()
+
+import Engines
+params={}
+params['hostname']=host
+params['container_name']='myContainer'
+comp=lcc.LoadComponent(params,'SalomeTestComponent')
+comp.Coucou(1)
+\endcode
+
+If you want to get a list of containers and component instances, client %object
+from orbmodule provides a list:
+
+\code
+import orbmodule
+clt=orbmodule.client()
+clt.showNS()
+\endcode
+
+The list looks like:
+
+\code
+Logger.
+ContainerManager.object
+Containers.dir
+ cli70ac.dir
+ FactoryServerPy.object
+ SuperVisionContainer.object
+ FactoryServer.object
+ FactoryServer.dir
+ SalomeTestComponent_inst_1.object
+ myContainer.object
+ myContainer.dir
+ SalomeTestComponent_inst_1.object
+ SalomeTestComponent_inst_2.object
+Registry.object
+Kernel.dir
+ ModulCatalog.object
+ Session.object
+Study.dir
+ Study2.object
+ extStudy_1.object
+ extStudy_2.object
+ extStudy_3.object
+myStudyManager.object
+SalomeAppEngine.object
+\endcode
+
+</li>
+<li>
+<b>File transfer service</b>
+
+See SALOME_FileTransferCORBA for the C++ interface (Python interface obtained with
+SWIG is very similar).
+
+The following example shows how to tranfer a file from a remote host to the
+client computer. Remote hostname is 'cli76cc', we would like to copy
+'tkcvs_8_0_3.tar.gz' from remote to local computer. %A full pathname is
+required. %A container is created on remote computer if it does not exist,
+to handle the file transfer:
+
+\code
+import salome
+salome.salome_init()
+
+import LifeCycleCORBA
+remotefile="/home/prascle/tkcvs_8_0_3.tar.gz"
+aFileTransfer=LifeCycleCORBA.SALOME_FileTransferCORBA('cli76cc',remotefile)
+localFile=aFileTransfer.getLocalFile()
+\endcode
+
+</li>
+<li>
+<b>CORBA Naming service access</b>
+
+See SALOME_NamingService for the C++ interface. The Python interface
+SALOME_NamingServicePy is not yet derived from the C++ interface and offers
+only the most useful functions.
+
+</li>
+<li>
+<b>Batch services</b>
+
+See \ref batch_page documentation (in french only).
+
+</li>
+</ol>
+
+\section S2_kernel_ser All IDL Interfaces
+
+<ol>
+<li>
+<b>Containers and component life cycle, File transfer service</b>
+
+- Engines : engines CORBA module.
+- Engines::Component : generic component interface. All %SALOME components inherit this interface.
+- Engines::Container : host for C++ and Python components components instances
+- Engines::fileTransfer : agent for file transfer created by a container copy a local file to a distent client
+- Engines::fileRef : reference to a file, used by a container for file transfers
+- Engines::ContainerManager : unique instance, in charge of container creation on remote computers
+- Engines::MPIContainer : an exemple of parallel implementation for containers and components
+- Engines::MPIObject
+
+</li>
+<li>
+<b>Study management</b>
+
+- SALOMEDS : SALOMEDS CORBA module
+- SALOMEDS.idl
+- SALOMEDS_Attributes.idl
+
+</li>
+<li>
+<b>High speed transfer, object life cycle, exceptions, GUI interface...</b>
+
+- SALOME : %SALOME CORBA module
+- SALOME_Comm.idl
+- SALOME_GenericObj.idl
+- SALOME_Exception
+- SALOME_Session.idl
+
+</li>
+<li>
+<b>Miscelleanous</b>
+
+- SALOME_ModuleCatalog
+- SALOME_RessourcesCatalog
+- SALOME_Registry.idl
+- Logger.idl
+
+<b>Other idl for test purposes</b>
+\n
+- nstest.idl
+- SALOME_TestComponent.idl
+- SALOME_TestModuleCatalog.idl
+- SALOME_TestMPIComponent.idl
+- TestNotif.idl
+
+*/
--- /dev/null
+/*! \mainpage SALOME KERNEL Reference Documentation
+ \image html kernel_about_4.png
+
+ \section S1_main Introduction
+
+ Welcome to the %SALOME KERNEL documentation !
+
+ Following your kind of usage of %SALOME, you will find some specific
+ introductory documentation, listed below.
+
+ \section S2_main End user
+
+<ol>
+ <li>
+ <b>How to configure a %SALOME application</b>
+ \n The end user may have to configure his own %SALOME application by selection of a
+ subset of availables %SALOME modules. He also may want to install his
+ application on several computers.
+ See \subpage SALOME_Application to define your own configuration of %SALOME and run it
+ on one or several computers. This is the recommended way of configuration.
+ </li>
+ <li>
+ <b>How to launch %SALOME in a %SALOME application</b>
+ \n See \ref SALOME_Application.
+ </li>
+ <li>
+ <b>How to use KERNEL services in Python scripts</b>
+ \n The %SALOME KERNEL offers a list of services available in Python. See \subpage KERNEL_Services.
+ </li>
+</ol>
+
+ \section S3_main Application Integrator
+
+ Applications integrators are in charge of configuration and installation of
+ specific %SALOME applications over a local network. Application Integrators
+ built %SALOME modules binaries from sources tarballs.
+
+<ol>
+ <li>
+ <b>How to install %SALOME</b>
+ \n See \subpage INSTALL for general information on required configuration and
+ prerequisites, compilation procedure, setting environment principles.
+ </li>
+ <li>
+ <b>How to configure a %SALOME application</b>
+ \n See \ref SALOME_Application to define your own configuration of %SALOME and run it
+ on one or several computers. This is the recommended way of configuration.
+ </li>
+</ol>
+
+ \section S4_main Module maintainer
+
+ Module maintainers are in charge of the development and debug of the %SALOME
+ modules. Each %SALOME module is stored in a CVS base. CVS bases are organised
+ in separate branches for developments and debug. All official or development
+ releases are identified by a CVS tag.
+
+<ol>
+ <li>
+ <b>Source code structuration and Unit Tests</b>
+ \n See \subpage UnitTests for general information on code directories structure,
+ unit tests associated to the different kind of classes, and how to run
+ the unit tests.
+ </li>
+ <li>
+ <b>Some development utilities</b>
+ \n See \subpage kernel_resources for information on basic utilities for C++ and Python
+ development, like trace and debug, exceptions, singleton.
+ </li>
+</ol>
+
+ \section S5_main SALOME programming model
+
+ You will find in the next pages informations about
+ specific points of %SALOME Kernel :
+
+ - \subpage dsc_page : DSC documentation page.
+ - \subpage salome_file_page : Salome_file documentation page.
+ - \subpage batch_page : BATCH documentation page.
+
+*/
+
--- /dev/null
+/*!
+ \page SALOME_Application SALOME Application Concept
+
+ <b>Configuration for one or more computers</b>
+
+
+<b> **WORK in PROGRESS, INCOMPLETE DOCUMENT** </b>
+
+The following explains how to configure your own application with your list of
+modules, how to define and run this application on one or more computers.
+
+\section S1_sal_appl General principles
+
+%A %SALOME application is defined by a set of modules (GEOM, SMESH, ASTER...).
+
+%A %SALOME User can define several %SALOME Applications. These applications are
+runnable from the same user account. These applications may share the same
+KERNEL and modules. Thus, the application configuration is independant of
+KERNEL and must not be put in KERNEL_ROOT_DIR.
+
+Furthermore, prerequisites may not be the same on all the applications.
+
+%A %SALOME Session can run on a several computers.
+
+Binary modules and prerequisites are installed on the different computers.
+There is no need to have all the modules on each computer (the minimum is
+KERNEL).
+
+There is no need of standardization or centralised information on the details
+of configuration on each computer (PATH, LD_LIBRARY_PATH, environment
+variables) provided the application modules are version - compatible. Details
+of configuration stay private to the computer, and are held by scripts on each
+computer.
+
+There is no hierarchy between the computers (for example only one master
+computer used to launch application).
+
+The %SALOME user has an account on all the computers. Access between
+account@computer is via rsh or ssh and must be configured for use without
+password (key exchange for ssh). Account may be different on each
+computer.
+
+\section S2_sal_appl Application Directory
+
+There is two ways for creation of an application directory
+
+<ol>
+ <li>
+ <b>First way - references to different module directories</b>
+
+The script createAppli.sh in ${KERNEL_ROOT_DIR}/bin/SALOME creates an
+application directory with the given path in parameter. ${APPLI} is a path
+relative to ${HOME}.
+
+The directory is only a skeleton, the user has to edit several files to
+configure his own application. These files are described after, the list is:
+
+- env.d/atFirst.sh
+- env.d/envProducts.sh
+- env.d/envSALOME.sh
+- CatalogResources.xml
+- SALOMEApp.xml
+
+ </li>
+ <li>
+ <b>Second and easiest way - one single virtual install directory</b>
+
+The user must create a %SALOME application configuration file by modifying a
+copy of ${KERNEL_ROOT_DIR}/bin/SALOME/config_appli.xml.
+The file describes the list of %SALOME modules used in the application, with
+their respective installation path. The configuration file also defines the
+path of an existing script which sets the %SALOME prerequisites,
+and optionnaly, the path of samples directory (SAMPLES_SRC).
+The following command::
+
+\code
+python <KERNEL_ROOT_DIR>/bin/SALOME/appli_gen.py --prefix=<install directory> --config=<configuration file>
+\endcode
+
+creates a virtual installation of %SALOME in the application directory ${APPLI}
+(bin, lib, doc, share...), with, for each file (executable, script, data,
+library, resources...), symbolic links to the actual file.
+
+Providing an existing an existing script for %SALOME prerequisites (the same one
+used for modules compilation, or given with the modules installation), the
+installation works without further modification for a single computer (unless
+some modules needs a special environment not defined in the above script).
+For a distributed application (several computers), one must copy and adapt
+CatalogResources.xml from ${KERNEL_ROOT_DIR}/bin/SALOME/appliskel (see below).
+ </li>
+</ol>
+
+\section S3_sal_appl General rules
+
+Directory ${APPLI} must be created on each computer of the application.
+The easiest way is to use the same relative path (to ${HOME}) on each computer.
+(Sometimes it is not possible to use the same path everywhere, for instance
+when ${HOME} is shared with NFS, so it is possible to define different path
+following the computers).
+
+The ${APPLI} directory contains scripts for environment and runs. Environment
+scripts must be configured (by the user) on each computer. All the environment
+scripts are in the ${APPLI}/env.d directory.
+
+The script ${APPLI}/envd sources **all** the files (\*.sh) in ${APPLI}/env.d
+in alphanumeric order (after edition, think to remove backup files). the envd
+script is used by run scripts.
+
+<ol>
+ <li>
+<b>env.d scripts</b>
+
+With the first way of installation, each user **must define** his own
+configuration for these scripts, following the above rules.
+With the virtual installation (second way, above), env.d
+scripts are built automatically.
+
+ **The following is only an example proposed by createAppli.sh, (first way of installation) not working as it is**.
+
+- atFirst.sh
+ Sets the computer configuration not directly related to %SALOME,
+ like useful tools, default PATH.
+
+- envProducts.sh
+ Sets the %SALOME prerequisites.
+
+- envSALOME.sh
+ Sets all the MODULE_ROOT_DIR that can be used in the %SALOME application.
+
+ SALOMEAppConfig is also defined by:
+
+\code
+export SALOMEAppConfig=${HOME}/${APPLI}
+\endcode
+
+ where SALOMEAppConfig designates the directory containing SALOMEApp.xml.
+ Note that ${APPLI} is already defined by the calling scripts when
+ env.d/envSALOME.sh is sourced.
+ </li>
+ <li>
+<b>User run scripts</b>
+
+The %SALOME user can use 4 scripts:
+
+- runAppli
+ Launches a %SALOME Session
+ (similar to ${KERNEL_ROOT_DIR}/bin/SALOME/runSALOME but with a different
+ name to avoid confusions).
+
+- runSession
+ Launches a shell script in the %SALOME application environment, with access
+ to the current (last launched) %SALOME session (naming service), if any.
+ Without arguments, the script is interactive. With arguments, the script
+ executes the command in the %SALOME application environment.
+
+- runConsole
+ Gives a python console connected to the current %SALOME Session.
+ It is also possible to use runSession, then python.
+
+- runTests
+ Similar to runSession, used for unit testing. runSession tries to use an
+ already existing naming service definition from a running session (hostname
+ and port number), runTests defines a new configuration for naming service
+ (new port number).
+ </li>
+ <li>
+<b>%SALOME internal run scripts</b>
+
+- envd
+ Sets %SALOME application environment, envd is sourced by other scripts.
+
+For remote calls, %SALOME uses one script.
+
+- runRemote.sh
+ This script is mainly used to launch containers. The first 2 arguments
+ define the hostname and port userd for naming service, the remaining
+ arguments define the command to execute.
+ </li>
+ <li>
+<b>Other configuration files</b>
+
+- SALOMEApp.xml
+ This file is similar to the default given
+ in ${GUI_ROOT_DIR}/share/SALOME/resources/gui
+
+
+- CatalogRessources.xml
+ This files describes all the computers the application can use. The given
+ example is minimal and suppose ${APPLI} is the same relative path
+ to ${HOME}, on all the computers. %A different directory can be set on a
+ particular computer with a line:
+
+\code
+appliPath="my/specific/path/on/this/computer"
+\endcode
+
+ </li>
+</ol>
+
+\section S4_sal_appl Examples of use
+
+<ol>
+ <li>
+<b>Launch a %SALOME session with a GUI interface</b>
+
+Launch is done with a command like::
+
+\code
+./runAppli --logger
+\endcode
+
+The --logger option means here : collect all the traces from the all the
+distributed process, via CORBA, in a single file : logger.log.
+
+There are a lot of options, a complete list is given by::
+
+\code
+./runAppli --help
+\endcode
+
+Note that, without argument, runAppli is a non interactive Python application,
+and, with arguments, runAppli is an interactive Python interpreter.
+
+Several options are already defined by default in SALOMEApp.xml files. Optional
+arguments given in the command override the SALOMEApp.xml configuration.
+
+Several sessions can run simultaneously, each session use a different port for
+CORBA naming service, so the sessions are totally separated from each other.
+
+When the GUI is closed, the different %SALOME servers are still running.
+ </li>
+ <li>
+<b>Close a %SALOME session, kill all the servers</b>
+
+Inside the interactive python interpreter you get when you use runAppli
+with arguments, you can kill all the servers of your session with::
+
+\code
+>>> killLocalPort()
+\endcode
+
+or the servers of all the sessions with::
+
+\code
+>>> killAllPorts()
+\endcode
+
+If you have no active Python interpreter connected to your session, you can
+kill all the %SALOME servers of **all the sessions** on a given computer::
+
+\code
+./runSession killSALOME.py
+\endcode
+
+Remember! it's the same idea in *Windows (R) operating system* (Microsoft and Windows are either registered trademarks or trademarks of
+ Microsoft Corporation in the United States and/or other countries) :
+use the start menu to stop...
+
+When you use only one session at a time, you don't need more.
+
+To kill a given session (when several session are running), one needs
+the naming service port number::
+
+\code
+./runSession killSALOMEWithPort 2810
+\endcode
+
+Note that the port number of the last launched session can be found on Linux,
+in the prompt, within a runSession shell (see below).
+
+It is also possible to get the Naming Service host and port number of
+the last launched session with::
+
+\code
+./runSession NSparam.py
+\endcode
+
+ </li>
+ <li>
+<b>Launch a %SALOME session without GUI interface</b>
+
+This is used to launch a %SALOME Python script without GUI
+(no GUI %server = SALOME_session_server)
+
+Example of script (test_session_geom.py):
+
+\code
+import SALOME_session
+SALOME_session.startSession(modules=["GEOM"])
+import GEOM_usinggeom
+raw_input("Press a key and the servers will be killed ...")
+\endcode
+
+This script is run in a non interactive way with::
+
+\code
+./runSession python test_session_geom.py
+\endcode
+
+All the process are automatically killed when Python is closed
+(with SALOME_session delete).
+ </li>
+ <li>
+<b>Add an external Python interpretor to a running session</b>
+
+It's often easier to develop and try Python scripts outside the GUI embedded
+Python interpreter. Imagine, for instance, you are writing a script involving
+geometry and mesh modules.
+first, launch a %SALOME session with gui, then, on another terminal::
+
+\code
+./runSession
+python
+\endcode
+
+Import %SALOME module. SALOME_init() without arguments creates a new study
+in the running session (note: SALOME_init(n) attachs to a running session whose
+studyId is n)::
+
+\code
+import SALOME
+SALOME.SALOME_init()
+\endcode
+
+An example of script given with SMESH::
+
+\code
+import ex01_cube2build
+\endcode
+
+It is possible to connect the GUI interface to the study created in the above
+script with the file/connect menu, then browse study and display objects.
+Further modifications on study can be done either with GUI or external script
+(use refresh popup in GUI %object browser to see study modifications generated
+by the external script). **AVOID modifications with GUI when a Python script
+is running**. Not all the modules are protected against concurrent actions...
+ </li>
+ <li>
+<b>Different uses of the runSession shell interpreter</b>
+
+runSession invoked without arguments gives an interactive shell with the full
+environment of %SALOME (PATH, LD_LIBRARY_PATH, PYTHONPATH, other variables).
+If there are running sessions of the same %SALOME application, runSession
+connects to the last launched session (i.e. gets the naming service references
+of the session: hostname and port)
+
+On Linux, the shell prompt (bash) gives information on naming service
+references, hostname and port::
+
+\code
+[NS=cli76cc:2811]prascle@cli76cc:~/SALOME2/Run/Virtual$
+\endcode
+
+If there is no running session, prompt looks like::
+
+\code
+[NS=:]prascle@cli76cc:~/SALOME2/Run/Virtual$
+\endcode
+
+runSession is useful to launch any script or program which needs the complete
+%SALOME environment, with or without a session already running.
+For instance, to launch the ddd debugger interface on the gui %server, first
+launch a %SALOME session with gui, then, on another terminal::
+
+\code
+./runSession ddd
+\endcode
+
+Then attach to the running SALOME_Session_Server process.
+ </li>
+</ol>
+
+*/
--- /dev/null
+/*!
+
+\page salome_file_page Salome_file
+
+This page introduces the Salome_file feature. Salome_file is based on the
+SALOME_FileTransfer. It extends it to enable a higher model for managing files into
+%SALOME applications.
+
+\section S1_Salome_file Principles
+
+Salome_file is a CORBA %object. It's role is to managed many system files. When a Salome_file
+is created, no files are managed. Then, files are added using Salome_file interface. %A file is represented
+by a <b>name</b> and a <b>path</b>.
+
+There is two different cases when a file is added :
+
+- <b>Local file</b> : the file added exists or it will be created by the user with the path and the name used in
+its registration.
+- <b>Distributed file</b> : the file added exists into a distributed localization.
+
+To be able to get a distributed file, the Salome_file has to be connected with an another Salome_file that
+managed this file. This distributed Salome_file could be located into a distributed resource.
+
+\section S2_Salome_file Simple example
+
+This section shows a simple example of the use of Salome_file. The objective is to create
+two Salome_file; one is managing a local file, the other is managing a distributed file.
+Then, these Salome_files are connected to enable the copy of the real file gbetween the two Salome_files.
+
+Firstly, two Salome_files are created :
+
+\code
+#include "Salome_file_i.hxx"
+
+int main (int argc, char * argv[])
+{
+ Salome_file_i file_source;
+ Salome_file_i file_dest;
+
+\endcode
+
+Secondly, the real files are registered into the Salome_files.
+
+\code
+ file_source.setLocalFile("/bin/cat");
+ file_dest.setDistributedFile("/tmp/cat_copy");
+\endcode
+
+Thirdly, we connect the destination file with the source file :
+
+\code
+ file_dest.connect(file_source);
+\endcode
+
+Finally, the file is sended using Salome_file interface.
+
+\code
+ file_dest.recvFiles();
+ // Status check
+ state = file_dest.getSalome_fileState();
+ print_state(state); // You have to implement this function.
+};
+\endcode
+
+\section S3_Salome_file Advanced example
+
+This advanced example illustrates a part of the Salome_file API dedicated
+for situations where multiple files are managed.
+
+This is the situation :
+
+\code
+
+#include "Salome_file_i.hxx"
+
+int main (int argc, char * argv[])
+{
+ Salome_file_i file_source_a;
+ Salome_file_i file_source_b;
+ Salome_file_i file_dest;
+
+ file_source_a.setLocalFile("/bin/cat");
+ file_source_a.setLocalFile("/bin/ls");
+
+ file_source_b.setLocalFile("/bin/echo");
+ file_source_b.setLocalFile("/bin/cp");
+
+ file_dest.setDistributedFile("/tmp/cat_copy");
+ file_dest.setDistributedFile("/tmp/echo_copy");
+\endcode
+
+There is two problems in this case.
+
+The first problem is in the <b>file_dest</b> Salome_file, there is two files. If
+the method connect is used, the Salome_file cannot know if the reference is for <b>cat_copy</b> or
+<b>echo_copy</b>. Indeed <b>echo_copy</b> could be provided by another Salome_file that for <b>cat_copy</b>.
+
+The second problem comes from the two files of <b>file_source_a</b> Salome_file. Indeed when connect is used,
+there is no information about the choice of the source file into the source Salome_file. For
+<b>cat_copy</b>, did the used want <b>cat</b> or <b>echo</b> ?
+
+To avoid these cases, Salome_file API provides advanced methods :
+
+\code
+ file_dest.connectDistributedFile("cat_copy", file_source_a);
+ file_dest.setDistributedSourceFile("cat_copy", "cat");
+
+ file_dest.connectDistributedFile("cat_echo", file_source_b);
+ file_dest.setDistributedSourceFile("cat_echo", "echo");
+
+ file_dest.recvFiles();
+ // Status check
+ state = file_dest.getSalome_fileState();
+ print_state(state); // You have to implement this function.
+};
+\endcode
+
+\section S3_Salome_file Using Salome_file into %SALOME services
+
+Currently you can't use Salome_file into YACS schema. In the next version of %SALOME,
+files ports will be available to connect output files to input files.
+
+*/
GENERATE_DEPRECATEDLIST= NO
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 25
-SHOW_USED_FILES = NO
-SHOW_DIRECTORIES = NO
+SHOW_USED_FILES = YES
+SHOW_DIRECTORIES = YES
FILE_VERSION_FILTER =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = \
+ @top_srcdir@/doc/salome \
@top_srcdir@/bin \
@top_srcdir@/idl \
@top_srcdir@/src/Container \
@top_srcdir@/src/Notification \
@top_srcdir@/src/Utils \
@top_srcdir@/src/DSC
-FILE_PATTERNS = *.idl *.hxx *.cxx python_extension_must_be_here
+FILE_PATTERNS = *.dox *.idl *.hxx *.cxx python_extension_must_be_here
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
IMAGE_PATH = sources/
INPUT_FILTER =
FILTER_PATTERNS =
-FILTER_SOURCE_FILES = YES
+FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
-INLINE_SOURCES = NO
+SOURCE_BROWSER = YES
+INLINE_SOURCES = YES
STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = NO
+REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
HTML_FILE_EXTENSION = .html
HTML_HEADER = sources/myheader.html
HTML_FOOTER = sources/footer.html
-HTML_STYLESHEET = sources/doxygen.css
+HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
TOC_EXPAND = YES
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
-GENERATE_TREEVIEW = NO
+GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
-<DIV class="div-footer">
-</tr>
-<hr>
-<table cellspacing="2" align="center" bgcolor="#808080" frame="void">
- <tbody align="center" valign="center" bgcolor="#D3D3D3">
- <tr>
- <td> <a href="../../index.html" target = _top>General KERNEL Documentation</a> </td>
- <td> <a href="../../KERNEL_Services.html" target = _top>End User KERNEL Services</a> </td>
- </tr>
- </tbody>
-</table>
-<br>
-Generated on $datetime for $projectname by <A href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></A> $doxygenversion</DIV>
-</BODY>
-</HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+</head>
+<body>
+<hr style="width: 100%; height: 2px;">
+<div style="text-align: center;">Copyright © 2003-2007 CEA, EDF<br>
+</div>
+</body>
+</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
- <title>Main Page</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css">
-<link href="tabs.css" rel="stylesheet" type="text/css">
+ <title>$title</title>
+ <link href="tabs.css" rel="stylesheet" type="text/css">
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
-<body>
-
-<table cellspacing="2" align="center" bgcolor="#FFFFFF" frame="void">
- <tbody align="center" valign="center" bgcolor="#FFFFFF">
- <tr>
- <td> <a href="../../index.html" target = _top>General KERNEL Documentation</a> </td>
- <td> <a href="../../KERNEL_Services.html" target = _top>End User KERNEL Services</a> </td>
- </tr>
- </tbody>
-</table>
-<br>
<hr>
-</body>
-</html>
+<center>
+SALOME documentation central
+</center>
+<hr>
fi; \
$(DOXYGEN) ./doxyuser1; \
cd ..;
- $(INSTALL) -d $(docdir)/tui/KERNEL;
- cp -fr KERNEL $(docdir)/tui
- cp -fr $(srcdir)/KERNEL/sources/static/*.* $(docdir)/tui/KERNEL;
- cp -fr $(srcdir)/KERNEL/sources/ $(docdir)/tui/KERNEL;
- cp -fr $(srcdir)/KERNEL/HTML/ $(docdir)/tui/KERNEL;
- cp -f $(srcdir)/pythfilter.py $(docdir)/tui/KERNEL;
- cp -fr $(srcdir)/KERNEL/exemple/ $(docdir)/tui/KERNEL;
+# $(INSTALL) -d $(docdir)/tui/KERNEL;
+ cp -fr $(srcdir)/KERNEL/sources/static/*.* $(docdir);
+ cp -fr $(srcdir)/KERNEL/sources/ $(docdir);
+ cp -fr KERNEL/[a-f]*.* $(docdir)
+ cp -fr KERNEL/[g-l]*.* $(docdir)
+ cp -fr KERNEL/[m-z]*.* $(docdir)
+ cp -fr $(srcdir)/KERNEL/HTML/ $(docdir);
+ cp -f $(srcdir)/pythfilter.py $(docdir);
+ cp -fr $(srcdir)/KERNEL/exemple/ $(docdir);
+# cp -fr $(srcdir)/KERNEL/sources/static/*.* $(docdir)/tui/KERNEL;
+# cp -fr $(srcdir)/KERNEL/sources/ $(docdir)/tui/KERNEL;
+# cp -fr KERNEL $(docdir)/tui
+# cp -fr $(srcdir)/KERNEL/HTML/ $(docdir)/tui/KERNEL;
+# cp -f $(srcdir)/pythfilter.py $(docdir)/tui/KERNEL;
+# cp -fr $(srcdir)/KERNEL/exemple/ $(docdir)/tui/KERNEL;
dev_docs:
cp -fr $(srcdir)/KERNEL/* ./INPUT; \
--- /dev/null
+/*!
+
+\page UnitTests Source code structuration and Unit Tests
+
+<b>WORK in PROGRESS, INCOMPLETE DOCUMENT</b>
+
+You will find here general information on code directories structure,
+unit tests associated to the different kind of classes, and how to run
+the unit tests.
+
+\section S1_unit SALOME KERNEL source code structuration
+
+<ol>
+<li> <b>General structure of KERNEL_SRC</b>
+
+- KERNEL_SRC :
+ Some README files and configuration tools for build
+
+- KERNEL_SRC/adm_local :
+ Part of the configuration files, other modules have a directory with the
+ same name. Not used in KERNEL.
+
+- KERNEL_SRC/bin :
+ Python and shell scripts used at run time.
+ Kit to install a %SALOME Application.
+
+- KERNEL_SRC/doc :
+ Kit for KERNEL end user documentation production:
+ public interfaces, Python, CORBA.
+ Integrator and Developper documentation.
+
+- KERNEL_SRC/idl :
+ All CORBA interfaces from KERNEL are regrouped here.
+
+- KERNEL_SRC/resources :
+ Configuration files for servers (examples).
+ Interfaces definitions for KERNEL test components.
+
+- KERNEL_SRC/salome_adm :
+ Configuration files used by autotools (M4 macros & co.)
+
+- KERNEL_SRC/src :
+ The source code (C++ and Python)
+
+</li>
+<li>
+<b>Directory src: C++ and Python source code</b>
+
+<ol>
+<li>
+<b>Basic services non related to CORBA</b>
+
+- Basics
+ %A set of general purpose C++ services, not related to CORBA.
+ Some general purpose services that are in Utils directory (CORBA related),
+ are progressivley moved here, as they are not related to CORBA.
+
+
+- SALOMELocalTrace
+ %A multithread trace system that allows message tracing on standard error
+ or a file.
+
+- CASCatch
+ Exceptions and signal handler.
+
+- HDFPersist
+ %A C++ interface to HDF.
+
+</li>
+
+<li>
+<b>Basic CORBA services</b>
+
+- Logger :
+ %A CORBA %server that collects the trace messages from differents CORBA
+ process.
+
+- SALOMETraceCollector :
+ %A multithread trace system derived from SALOMELocalTrace, that sends messages
+ to Logger %server via CORBA.
+
+- Utils :
+ %A set of general purpose services related to CORBA, such as basic CORBA
+ exception system. See also Basics directory above.
+
+- NamingService :
+ C++ and Python interfaces to name, store and retrieve CORBA objects
+
+- GenericObj :
+ %A generic CORBA interface for CORBA objects, to count distributed references,
+ and to allow destruction by client.
+
+</li>
+<li>
+<b>Miscellaneous CORBA servers</b>
+
+- %Registry :
+ Implements SALOME_registry.idl.
+ Provides a CORBA %server library and a separate %server program.
+
+- ModuleCatalog :
+ Implements SALOME_moduleCatalog.idl.
+ Provide a CORBA %server library and separate %server and client programs.
+
+- ModuleGenerator :
+ Tool to generate a module catalog from CORBA idl
+
+- ResourcesManager :
+ library included in container %server
+
+- Notification :
+ library included in differents servers (container)
+
+- NOTIFICATION_SWIG
+
+</li>
+
+<li>
+<b>CORBA Containers for %SALOME Modules</b>
+
+- Container
+
+- TestContainer
+
+- LifeCycleCORBA
+
+- LifeCycleCORBA_SWIG
+
+</li>
+
+<li>
+<b>STUDY %server and related interfaces and tools</b>
+
+- SALOMEDSClient
+
+- TOOLSDS
+
+- SALOMEDSImpl
+
+- SALOMEDS
+
+</li>
+<li>
+<b>Python interface to %SALOME</b>
+
+- KERNEL_PY
+
+</li>
+<li>
+<b>Efficient CORBA transfer services</b>
+
+- Communication
+
+- Communication_SWIG
+
+</li>
+<li>
+<b>%A Parallel container with MPI</b>
+
+- MPIContainer
+
+- TestMPIContainer
+
+</li>
+<li>
+<b>Batch interface library</b>
+
+- Batch
+
+- Batch_SWIG
+
+</li>
+<li>
+<b>Unit tests</b>
+
+- UnitTests
+
+</li>
+</ol>
+</li>
+</ol>
+
+\section S2_unit Tools and principles used for Unit testing
+
+<b>**TO BE COMPLETED**</b>
+
+Unit Testing rely on cppunit package for C++ testing, and on unittest module
+for Python. See these products for general principles of unit testing.
+
+The cppunit package is optional. When the prerequisite is detected, the unit
+tests are compiled.
+
+Unit Tests sources are in directories Test under the src/directories
+containing the classes to test.
+
+Test are ordered following the order of directories given above.
+
+Tests can be run as a whole, or for a particular directory. In this case, only
+a partial test is run (the classes to test, and the classes used, i.e. the
+preceding test directories).
+
+
+Today, only some tests are written as an example. There are not yet python
+scripts in KERNEL_SRC, but it's a matter of days, there are working scripts
+to test LifeCycleCORBA_SWIG interface.
+
+*/
\exception Engines::ConnectionManager::BadId
*/
void disconnect(in connectionId id,
- in Engines::DSC::Message message) raises(Engines::ConnectionManager::BadId);
+ in Engines::DSC::Message message) raises(Engines::ConnectionManager::BadId,
+ Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortReference);
+ /*!
+ Shutdown the ConnectionManager process.
+ */
+ oneway void ShutdownWithExit();
+
+ /*!
+ Returns the PID of the connection manager
+ */
+ long getPID();
};
/*--------------------------------------------------------------------------------------------*/
This interface defines the operations needed to add a paco++ port
into a parallel DSC component.
*/
- interface Parallel_DSC : Engines::DSC {
+ interface Parallel_DSC : Engines::Superv_Component, Engines::Parallel_Component {
/*!
This operation gives the proxy node of a paco++ port to all the nodes.
void set_paco_proxy(in Object ref,
in string provides_port_name,
in Ports::PortProperties port_prop);
-
- /*!
- The SUPERV module call this method before starting the service. Thus the service
- can add is dynamics ports before is started.
-
- \param service_name service's name.
- \return true if the service is correctly initialised.
- */
- boolean init_service(in string service_name);
- };
+ };
};
#endif
<Name>set_paco_proxy</Name>
<Type>distributed</Type>
</Method>
+ </Interface>
+ <Interface>
+ <Name>Superv_Component</Name>
<Method>
<Name>init_service</Name>
<Type>distributed</Type>
include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-# To avoid problems with parallel compilation.
-MAKEFLAGS = -j1
-
AM_CXXFLAGS = -fPIC
BASEIDL_FILES = \
Calcium_PortsSK.cc \
Palm_PortsSK.cc
-DYNIDL_SOURCES=\
- Calcium_PortsDynSK.cc
+DYNIDL_SOURCES = \
+ SALOME_PortsDynSK.cc Calcium_PortsDynSK.cc SALOME_ContainerManagerDynSK.cc \
+ SALOME_CommDynSK.cc SALOME_RegistryDynSK.cc SALOME_ModuleCatalogDynSK.cc \
+ SALOMEDSDynSK.cc SALOME_SessionDynSK.cc SALOME_RessourcesCatalogDynSK.cc \
+ DSC_EnginesDynSK.cc SALOME_ComponentDynSK.cc SALOME_GenericObjDynSK.cc \
+ Palm_PortsDynSK.cc SALOME_ExceptionDynSK.cc SALOMEDS_AttributesDynSK.cc \
+ LoggerDynSK.cc
MPIIDL_SOURCES = \
SALOME_MPIObjectSK.cc \
IDL_SOURCES += $(DYNIDL_SOURCES)
+$(DYNIDL_SOURCES) : $(IDL_SOURCES)
+
# also install all generated headers to use result library from another modules
salomeinclude_DATA= $(STATIDL_SOURCES:%SK.cc=%.hh)
if WITH_PACO_PARALLEL
-PAR = SALOME_ComponentPaCO.h SALOME_ComponentPaCO.cc \
+PAR = SALOME_ExceptionPaCO.h SALOME_ExceptionPaCO.cc \
+ SALOME_ComponentPaCO.h SALOME_ComponentPaCO.cc \
SALOME_PortsPaCO.h SALOME_PortsPaCO.cc \
DSC_EnginesPaCO.h DSC_EnginesPaCO.cc
PAR_LIB = libSalomeParallelIDLKernel.la
-IDL_PACO = SALOME_ComponentPaCO.idl SALOME_PortsPaCO.idl DSC_EnginesPaCO.idl
+IDL_PACO = SALOME_ExceptionPaCO.idl SALOME_ComponentPaCO.idl SALOME_PortsPaCO.idl DSC_EnginesPaCO.idl
GEN_PACO = SALOME_ComponentPaCO_Engines_Container_server.cc \
SALOME_ComponentPaCO_Engines_Container_client.cc \
SALOME_ComponentPaCO_Engines_Component_server.cc \
SALOME_ComponentPaCO_Engines_Component_client.cc \
+ SALOME_ComponentPaCO_Engines_Parallel_Component_server.cc \
+ SALOME_ComponentPaCO_Engines_Parallel_Component_client.cc \
+ SALOME_ComponentPaCO_Engines_fileTransfer_server.cc \
+ SALOME_ComponentPaCO_Engines_fileTransfer_client.cc \
+ SALOME_ComponentPaCO_Engines_Salome_file_server.cc \
+ SALOME_ComponentPaCO_Engines_Salome_file_client.cc \
+ SALOME_ComponentPaCO_Engines_Parallel_Salome_file_server.cc \
+ SALOME_ComponentPaCO_Engines_Parallel_Salome_file_client.cc \
SALOME_PortsPaCO_Ports_Port_server.cc \
SALOME_PortsPaCO_Ports_Port_client.cc \
DSC_EnginesPaCO_Engines_DSC_server.cc \
DSC_EnginesPaCO_Engines_DSC_client.cc \
+ DSC_EnginesPaCO_Engines_Superv_Component_server.cc \
+ DSC_EnginesPaCO_Engines_Superv_Component_client.cc \
DSC_EnginesPaCO_Engines_Parallel_DSC_server.cc \
DSC_EnginesPaCO_Engines_Parallel_DSC_client.cc
SALOME_ComponentPaCO_Engines_Container_client.h \
SALOME_ComponentPaCO_Engines_Component_server.h \
SALOME_ComponentPaCO_Engines_Component_client.h \
+ SALOME_ComponentPaCO_Engines_Parallel_Component_server.h \
+ SALOME_ComponentPaCO_Engines_Parallel_Component_client.h \
+ SALOME_ComponentPaCO_Engines_fileTransfer_server.h \
+ SALOME_ComponentPaCO_Engines_fileTransfer_client.h \
+ SALOME_ComponentPaCO_Engines_Salome_file_server.h \
+ SALOME_ComponentPaCO_Engines_Salome_file_client.h \
+ SALOME_ComponentPaCO_Engines_Parallel_Salome_file_server.h \
+ SALOME_ComponentPaCO_Engines_Parallel_Salome_file_client.h \
+ SALOME_ExceptionPaCO.h \
SALOME_ComponentPaCO.h \
+ SALOME_Exception.h \
SALOME_Component.h \
SALOME_PortsPaCO_Ports_Port_server.h \
SALOME_PortsPaCO_Ports_Port_client.h \
SALOME_Ports.h \
DSC_EnginesPaCO_Engines_DSC_server.h \
DSC_EnginesPaCO_Engines_DSC_client.h \
+ DSC_EnginesPaCO_Engines_Superv_Component_server.h \
+ DSC_EnginesPaCO_Engines_Superv_Component_client.h \
DSC_EnginesPaCO_Engines_Parallel_DSC_server.h \
DSC_EnginesPaCO_Engines_Parallel_DSC_client.h \
DSC_EnginesPaCO.h \
DSC_Engines.h
-XML = SALOME_Component.xml DSC_Engines.xml SALOME_Ports.xml
+XML = SALOME_Exception.xml SALOME_Component.xml DSC_Engines.xml SALOME_Ports.xml
endif
idldir = $(prefix)/idl/salome
BUILT_SOURCES = $(IDL_SOURCES) $(PAR)
+SALOME_ExceptionPaCO.h SALOME_ExceptionPaCO.cc : SALOME_Exception.idl SALOME_Exception.xml
SALOME_ComponentPaCO.h SALOME_ComponentPaCO.cc : SALOME_Component.idl SALOME_Component.xml
SALOME_PortsPaCO.h SALOME_PortsPaCO.cc : SALOME_Ports.idl SALOME_Ports.xml
DSC_EnginesPaCO.h DSC_EnginesPaCO.cc : DSC_Engines.idl DSC_Engines.xml
// Author : Yves FRICAUD
// $Header$
-/*! \mainpage
- \image html Application-About1.jpg
-*/
-
/*!
\file SALOMEDS.idl This file contains a set of interfaces used for creation, managment
and modification of the %Study
Returns True if the %study has been modified and not saved.
*/
boolean IsModified();
+
+/*!
+ Marks the %study as being modified and not saved.
+*/
+ void Modified();
+
/*!
Determines the file where the %study has been saved
*/
*/
void ping();
+ void Shutdown();
+
+/*!
+ Returns the PID of the server
+*/
+ long getPID();
+
+/*!
+ Shutdown the StudyManager process.
+*/
+ oneway void ShutdownWithExit();
+
/*! \brief Creation of a new study
Creates a new study with a definite name.
#ifndef _SALOME_COMPONENT_IDL_
#define _SALOME_COMPONENT_IDL_
+#include "SALOME_Exception.idl"
+
/*! \brief
This is a package of interfaces used for connecting new components to %SALOME
application. It also contains a set of interfaces used for management of %MED
interface Component ;
interface fileRef ;
interface fileTransfer ;
+ interface Salome_file;
/*! \brief Interface of the %Container.
This interface defines the process of loading and registration
*/
fileRef createFileRef(in string origFileName);
+ /*!
+ returns a Salome_file object if origFileName exists and is readable
+ else returns null object.
+
+ \param origFileName name of the file to be managed (can contain the path).
+
+ \return Salome_file CORBA reference.
+ */
+ Salome_file createSalome_file(in string origFileName);
+
/*!
returns a fileTransfer object used to copy files from the container
machine to the clients machines. Only one fileTransfer instance is
};
-
-
/*! \brief Interface of the %component.
This interface is used for interaction between the %container and the
%component and between the components inside the container.
*/
TMPFile DumpPython(in Object theStudy,
in boolean isPublished,
- out boolean isValidScript);
+ out boolean isValidScript);
+
+
+ /*!
+ Returns a CORBA Ref of a input Salome_file managed by a service.
+
+ \param service_name service's name.
+ \param file_name name of the requested file.
+
+ \return CORBA Ref of the requested file.
+
+ \exception contains informations of what if the component cannot
+ sends the file's reference.
+ */
+ Engines::Salome_file getInputFileToService(in string service_name,
+ in string Salome_file_name) raises(SALOME::SALOME_Exception);
+
+ /*!
+ This method is used before the activation of the service. It calls
+ recvFiles() on all the input Salome_file files of the service.
+
+ Before each recvFiles(), it uses the callback method named configureSalome_file.
+ This method allows the user to configure the files managed by the Salome_file.
+
+ By default, there is no files managed when a Salome_file is created,
+ but the supervisor set some files managed by the Salome_file from the information contained
+ into the schema file.
+
+ \param service_name service's name.
+
+ \exception contains informations about files that are not in a good state.
+ */
+ void checkInputFilesToService(in string service_name) raises(SALOME::SALOME_Exception);
+
+ /*!
+ This method adds a input Salome_file to a service of the component.
+
+ \param service_name service's name.
+ \param Salome_file_name name of the Salome_file
+
+ \return a reference of the Salome_file
+
+ \exception raises an exception if there is already
+ a Salome_file with this name for the service.
+ */
+ Engines::Salome_file setInputFileToService(in string service_name,
+ in string Salome_file_name) raises(SALOME::SALOME_Exception);
+
+ /*!
+ Returns a CORBA Ref of a output Salome_file managed by a service.
+
+ \param service_name service's name.
+ \param file_name name of the requested file.
+
+ \return CORBA Ref of the requested file.
+
+ \exception contains informations of what if the component cannot
+ sends the file's reference.
+ */
+ Engines::Salome_file getOutputFileToService(in string service_name,
+ in string Salome_file_name) raises(SALOME::SALOME_Exception);
+
+ /*!
+ This method is used at the end of the service. It calls
+ recvFiles() on all the output Salome_file files of the service.
+
+ Before each recvFiles(), it uses the callback method named configureSalome_file.
+ This method allows the user to configure the files managed by the Salome_file.
+
+ By default, there is no files managed when a Salome_file is created,
+ but the supervisor set some files managed by the Salome_file from the information contained
+ into the schema file.
+
+ \param service_name service's name.
+
+ \exception contains informations about files that are not in a good state.
+ */
+ void checkOutputFilesToService(in string service_name) raises(SALOME::SALOME_Exception);
+ /*!
+ This method adds an output Salome_file to a service of the component.
+
+ \param service_name service's name.
+ \param Salome_file_name name of the Salome_file
+
+ \return a reference of the Salome_file
+
+ \exception raises an exception if there is already
+ a Salome_file with this name for the service.
+ */
+ Engines::Salome_file setOutputFileToService(in string service_name,
+ in string Salome_file_name) raises(SALOME::SALOME_Exception);
} ;
+ interface Parallel_Component : Engines::Component {
+ void send_parallel_proxy_object(in Object proxy_ref);
+ };
+
/*!
A block of binary data used for file transfer. The maximum size of the
block is defined on server side.
fileBlock getBlock(in long fileId);
};
- /*! \brief Interface of fileTransfer.
+ /*!
+ This is a file managed by a Salome_file. It contains file's name, path and status.
+ The status is : "present" or "notpresent".
+ */
+ struct file {
+ string file_name;
+ string path;
+ string type;
+ string source_file_name;
+ string status;
+ long node;
+ Engines::Container container;
+ };
+
+ /*!
+ A sequence of Engines::file.
+ */
+ typedef sequence<Engines::file> files;
+
+
+ /*!
+ It is the state of a Salome_file. It contains the Salome_file's name, the name
+ of the hdf5 file where it can be saved, the number of files managed and the information
+ if all the files are received.
+ */
+ struct SfState {
+ string name;
+ string hdf5_file_name;
+ long number_of_files;
+ boolean files_ok;
+ };
+
+ /*! \brief Interface of a Salome_file managed
+ This file is independent of a Salome module. It can managed one or more
+ real files. It's useful for parallel files. Currently Salome_file cannot manage
+ two files that have the same name but not the same path.
+ */
+ interface Salome_file : Engines::fileTransfer
+ {
+ /*!
+ Load a Salome_file from a hdf5 file.
+
+ \param hdf5_file name (with path) of the hdf5_file.
+
+ \exception contains informations of errors if the loading doesn't succeed.
+ */
+ void load(in string hdf5_file) raises (SALOME::SALOME_Exception);
+
+ /*!
+ Save a Salome_file into a hdf5_file.
+
+ \param hdf5_file name (with path) of the hdf5_file.
+
+ \exception contains informations of errors if the save doesn't succeed.
+
+ */
+ void save(in string hdf5_file) raises (SALOME::SALOME_Exception);
+
+ /*!
+ Save a Salome_file into a hdf5_file. All files that are managed
+ are saved into the hdf5_file
+
+ \param hdf5_file name (with path) of the hdf5_file.
+
+ \exception contains informations of errors if the save doesn't succeed.
+
+ */
+ void save_all(in string hdf5_file) raises (SALOME::SALOME_Exception);
+
+/**************/
+
+ /*!
+ Add a Local file to the Salome_file.
+
+ \param file_name name of the file with the path.
+
+ \exception raised if the file is already added into the Salome_file.
+ */
+ void setLocalFile(in string comp_file_name) raises (SALOME::SALOME_Exception);
+
+ /*!
+ Add a Distributed file to the Salome_file.
+
+ \param comp_file_name name of the file with the path.
+
+ \exception raised if the file is already added into the Salome_file.
+ */
+ void setDistributedFile(in string comp_file_name) raises (SALOME::SALOME_Exception);
+
+ /*!
+ Connect a Salome_file with another Salome_file.
+ It works only if the Salome_file managed only one file
+
+ \param source_Salome_file Salome_file that managed the distributed version of the file.
+
+ \exception raised if there is more or less than one file.
+ */
+ void connect(in Engines::Salome_file source_Salome_file) raises (SALOME::SALOME_Exception);
+
+ /*!
+ Connect the managed file file_name to a Salome_file.
+
+ \param file_name name of the file without the path.
+ \param source_Salome_file Salome_file that managed the distributed version of the file.
+
+ \exception raised if the file doesn't exist.
+ */
+ void connectDistributedFile(in string file_name,
+ in Engines::Salome_file source_Salome_file) raises (SALOME::SALOME_Exception);
+
+ /*!
+ Connect the file_name with a Distributed file_name.
+
+ \param file_name name of the file without the path.
+ \param source_file_name It's the name of the file managed by the distributed source Salome_file.
+
+ \exception raised if the file doesn't exist.
+ */
+ void setDistributedSourceFile(in string file_name,
+ in string source_file_name) raises (SALOME::SALOME_Exception);
+
+/**************/
+
+ /*!
+ Get all the distributed files managed by the Salome_file and
+ check all the local files.
+
+ \exception raised if some of the files are not ok.
+ */
+ void recvFiles() raises (SALOME::SALOME_Exception) ;
+
+/**************/
+
+ /*!
+ Remove a file of the Salome_file.
+
+ \param file_name name of the file.
+
+ \exception raised if the file doesn't exist.
+ */
+ void removeFile(in string file_name) raises (SALOME::SALOME_Exception);
+
+ /*!
+ Remove all the files of the Salome_file.
+ */
+ void removeFiles();
+
+/**************/
+
+ /*!
+ Get the list of the files managed by the Salome_file.
+ The list can be empty.
+ */
+ Engines::files getFilesInfos();
+
+ /*!
+ Get a file managed by the Salome_file.
+
+ \param file_name the name of the file.
+
+ \return CORBA file reference.
+
+ \exception raised if the file doesn't exist.
+ */
+ Engines::file getFileInfos(in string file_name) raises (SALOME::SALOME_Exception);
+
+ /*!
+ Return the state of the Salome_file.
+ */
+ Engines::SfState getSalome_fileState();
+
+
+ /*!
+ Set the container where files are.
+
+ \param container container CORBA's reference.
+ */
+ void setContainer(in Engines::Container container);
+ };
+
+ /*! \brief Interface of fileRef.
The fileTransfer and fileRef interfaces provide a file transfer service
between different computers.
string getRef(in string machine);
};
-} ;
+ /*! \brief Interface of a Parallel_Salome_file
+ This interface is used by parallel components and containers.
+ It adds methods to enable to choose on which node of the parallel component the file has to
+ be received.
+ */
+ interface Parallel_Salome_file : Engines::Salome_file {
+
+ /*!
+ Set a number of node for the file. Default is the node 0.
+
+ \param file_name name of the file.
+ \param node_nbr node number where the file is.
+
+ \exception raised if the file doesn't exist.
+ */
+ void setFileNode(in string file_name, in long node_nbr) raises (SALOME::SALOME_Exception);
+
+ /*!
+ Get the number of the node that actually managed the file.
+
+ \param file_name name of managed file.
+
+ \return node number of the file
+
+ \exception raised if the file doesn't exist.
+ */
+ long getFileNode(in string file_name) raises (SALOME::SALOME_Exception);
+
+ /*!
+ This method update the state of file for the Parallel_Salome_file.
+
+ \param new_file the new state of file.
+ */
+ Engines::Container updateFile(in Engines::file new_file);
+
+ /*!
+ This method is used by the parallel implementation of recvFiles.
+
+ \exception raised if the file cannot be ok.
+ */
+ void recvFiles_node() raises (SALOME::SALOME_Exception);
+
+ };
+};
#endif
<Interface>
<Name>Component</Name>
<Method>
- <Name>ping</Name>
+ <Name>setInputFileToService</Name>
+ <Type>distributed</Type>
+ </Method>
+ <Method>
+ <Name>setOutputFileToService</Name>
<Type>distributed</Type>
</Method>
</Interface>
+ <Interface>
+ <Name>Parallel_Component</Name>
+ <Method>
+ <Name>send_parallel_proxy_object</Name>
+ <Type>distributed</Type>
+ </Method>
+ </Interface>
+ <Interface>
+ <Name>Salome_file</Name>
+ </Interface>
+ <Interface>
+ <Name>Parallel_Salome_file</Name>
+ </Interface>
</Module>
</GridCCM_Interface_description>
{
/*!
- Type to describe properties of wanted resource.
+ Type to transmit list of machines.
+*/
+ typedef sequence<string> MachineList;
+ typedef sequence<string> CompoList;
+ typedef sequence<string> FilesList;
+ typedef sequence<string> ModulesList;
+
+/*!
+ Type to describe properties of resource.
*/
struct MachineParameters
{
string container_name;
string hostname;
+ string alias;
+ string protocol;
+ string username;
+ string applipath;
+ ModulesList modList;
string OS;
long mem_mb;
long cpu_clock;
long nb_proc_per_node;
long nb_node;
boolean isMPI;
+ string mpiImpl;
+ string batch;
// PaCO specific informations
string parallelLib;
long nb_component_nodes;
};
-/*!
- Type to transmit list of machines.
-*/
- typedef sequence<string> MachineList;
-
/*!
exception thrown if a computer is not found in the catalog
*/
enum policy {P_FIRST,P_CYCL,P_BEST};
typedef policy ResPolicy;
+/*! \brief Interface of the %salomelauncher
+ This interface is used for interaction with the unique instance
+ of SalomeLauncher
+*/
+ interface SalomeLauncher
+ {
+ long submitSalomeJob( in string fileToExecute,
+ in FilesList filesToExport,
+ in FilesList filesToImport,
+ in long NumberOfProcessors,
+ in MachineParameters params ) raises (SALOME::SALOME_Exception);
+ string querySalomeJob( in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception);
+ void deleteSalomeJob( in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception);
+ void getResultSalomeJob( in string directory, in long jobId, in MachineParameters params ) raises (SALOME::SALOME_Exception);
+
+ void Shutdown();
+
+ long getPID();
+
+ } ;
+
/*! \brief Interface of the %containerManager
This interface is used for interaction with the unique instance
of ContainerManager
in MachineList possibleComputers);
Container StartContainer( in MachineParameters params,
- in ResPolicy policy);
+ in ResPolicy policy,
+ in CompoList componentList );
+
+ Container GiveContainer( in MachineParameters params,
+ in ResPolicy policy,
+ in CompoList componentList );
+
+ void ShutdownContainers();
+ } ;
+
+/*! \brief Interface of the %resourcesManager
+ This interface is used for interaction with the unique instance
+ of ResourcesManager
+*/
+ interface ResourcesManager
+ {
string FindFirst(in MachineList possibleComputers);
MachineList GetFittingResources( in MachineParameters params,
- in string componentName )
+ in CompoList componentList )
raises (SALOME::SALOME_Exception);
- void Shutdown();
+ MachineParameters GetMachineParameters( in string hostname );
- void ShutdownContainers();
} ;
};
--- /dev/null
+<?xml version="1.0"?>
+<!--
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : SALOME_Exception.xml
+// Author : Andre RIBES, EDF
+-->
+<GridCCM_Interface_description
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:noNamespaceSchemaLocation='$PACOPATH/IDL2Tool/interface.xsd'
+>
+
+
+</GridCCM_Interface_description>
typedef sequence<ServicesParameter> ListOfServicesParameter;
typedef sequence<ServicesDataStreamParameter> ListOfServicesDataStreamParameter;
+ typedef sequence<string> ListOfString;
+ enum TypeKind
+ {
+ NONE ,
+ Dble ,
+ Int ,
+ Str ,
+ Bool ,
+ Objref ,
+ Seq ,
+ Array ,
+ Struc
+ };
+ struct MemberDefinition
+ {
+ string name; /*! Name of the member */
+ string type; /*! Type of the member */
+ };
+ typedef sequence<MemberDefinition> ListOfMemberDefinition;
+/*!
+ * Struct to get the definition of types used in Salome catalogs
+ */
+ struct TypeDefinition
+ {
+ string name; /*! Name of the type */
+ TypeKind kind; /*! Kind of the type.*/
+ string id; /*! id (if needed) */
+ string content; /*! Content type (if needed) */
+ ListOfString bases; /*! Content type (if needed) */
+ ListOfMemberDefinition members; /*! Members types (if needed) */
+ };
+
+ typedef sequence<TypeDefinition> ListOfTypeDefinition;
+
/*!
This struct contains fields completely defining each service.
*/
/*!
Description of a component
*/
- struct Component
+ struct ComponentDef
{
ComponentType type;
string name;
{
void ping();
+/*!
+ Returns the PID of the server
+*/
+ long getPID();
+
+/*!
+ Shutdown the ModuleCatalog process.
+*/
+ oneway void ShutdownWithExit();
+
+/*!
+ * Get the types of the catalog
+ */
+ ListOfTypeDefinition GetTypes();
+
/*!
Gets a list of names of computers of the catalog
*/
/*!
Gets the description of a component of the catalog.
*/
- Component GetComponentInfo(in string componentName) raises(NotFound);
+ ComponentDef GetComponentInfo(in string componentName) raises(NotFound);
/*!
Reads a xml file and imports new components from this file.
interface Components
{
void ping();
+ long getPID();
unsigned long add ( in Infos lesInfos ) ;
void remove ( in unsigned long id ) ;
unsigned long size() ;
AllInfos history () ;
oneway void end() ;
oneway void hello( in unsigned long id ) ;
+ void Shutdown();
} ;
} ;
Determines whether the server has already been loaded or not.
*/
void ping();
+/*!
+ Returns the PID of the server
+*/
+ long getPID();
/*!
Get Active study ID
*/
<!DOCTYPE ResourcesCatalog>
<resources>
-<machine hostname="is111790" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" protocol="r" mode="i" nbOfNodes="1" nbOfProcPerNode="1" preReqFilePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL/salome.sh" >
-<modules modulePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL" moduleName="KERNEL" />
-<modules modulePath="/export/home/LGLS/Products/MED_@VERSION@" moduleName="MED" />
-<modules modulePath="/export/home/LGLS/Products/GEOM_@VERSION@" moduleName="GEOM" />
-<modules modulePath="/export/home/LGLS/Products/SMESH_@VERSION@" moduleName="SMESH" />
-<modules modulePath="/export/home/LGLS/Products/SUPERV_@VERSION@" moduleName="SUPERV" />
-<modules modulePath="/export/home/LGLS/Products/VISU_@VERSION@" moduleName="VISU" />
-<modules modulePath="/home/secher/SALOME2_INSTALL/MYCOMPO_INSTALL" moduleName="MYCOMPO" />
-<modules modulePath="/home/secher/SALOME2_INSTALL/MYMPICOMPO_INSTALL" moduleName="MYMPICOMPO" />
+<machine hostname="is111918" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" protocol="r" mode="i" nbOfNodes="1" nbOfProcPerNode="1" preReqFilePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/env_products.sh" >
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/KERNEL_3.2.6" moduleName="KERNEL" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/MED_3.2.6" moduleName="MED" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/GEOM_3.2.6" moduleName="GEOM" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/SMESH_3.2.6" moduleName="SMESH" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/SUPERV_3.2.6" moduleName="SUPERV" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/VISU_3.2.6" moduleName="VISU" />
</machine>
-<machine hostname="is111915" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" protocol="r" mode="i" nbOfNodes="1" nbOfProcPerNode="1" preReqFilePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL/salome.sh" >
-<modules modulePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL" moduleName="KERNEL" />
-<modules modulePath="/export/home/LGLS/Products/MED_@VERSION@" moduleName="MED" />
-<modules modulePath="/export/home/LGLS/Products/GEOM_@VERSION@" moduleName="GEOM" />
-<modules modulePath="/export/home/LGLS/Products/SMESH_@VERSION@" moduleName="SMESH" />
-<modules modulePath="/export/home/LGLS/Products/SUPERV_@VERSION@" moduleName="SUPERV" />
-<modules modulePath="/export/home/LGLS/Products/VISU_@VERSION@" moduleName="VISU" />
-<modules modulePath="/home/secher/SALOME2_INSTALL/MYCOMPO_INSTALL" moduleName="MYCOMPO" />
-<modules modulePath="/home/secher/SALOME2_INSTALL/MYMPICOMPO_INSTALL" moduleName="MYMPICOMPO" />
+<machine hostname="is102430" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" protocol="r" mode="i" nbOfNodes="1" nbOfProcPerNode="1" preReqFilePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/env_products.sh" >
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/KERNEL_3.2.6" moduleName="KERNEL" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/MED_3.2.6" moduleName="MED" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/GEOM_3.2.6" moduleName="GEOM" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/SMESH_3.2.6" moduleName="SMESH" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/SUPERV_3.2.6" moduleName="SUPERV" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/VISU_3.2.6" moduleName="VISU" />
</machine>
-<machine hostname="is111918" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" protocol="r" mode="i" nbOfNodes="1" nbOfProcPerNode="1" preReqFilePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL/salome.sh" >
-<modules modulePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL" moduleName="KERNEL" />
-<modules modulePath="/export/home/LGLS/Products/MED_@VERSION@" moduleName="MED" />
-<modules modulePath="/export/home/LGLS/Products/GEOM_@VERSION@" moduleName="GEOM" />
-<modules modulePath="/export/home/LGLS/Products/SMESH_@VERSION@" moduleName="SMESH" />
-<modules modulePath="/export/home/LGLS/Products/SUPERV_@VERSION@" moduleName="SUPERV" />
-<modules modulePath="/export/home/LGLS/Products/VISU_@VERSION@" moduleName="VISU" />
-<modules modulePath="/home/secher/SALOME2_INSTALL/MYCOMPO_INSTALL" moduleName="MYCOMPO" />
-<modules modulePath="/home/secher/SALOME2_INSTALL/MYMPICOMPO_INSTALL" moduleName="MYMPICOMPO" />
+<machine hostname="is125604" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" protocol="r" mode="i" nbOfNodes="1" nbOfProcPerNode="1" preReqFilePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/env_products.sh" >
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/KERNEL_3.2.6" moduleName="KERNEL" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/MED_3.2.6" moduleName="MED" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/GEOM_3.2.6" moduleName="GEOM" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/SMESH_3.2.6" moduleName="SMESH" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/SUPERV_3.2.6" moduleName="SUPERV" />
+<modules modulePath="/data/tmplgls/rahuel/YACS/Salome_3.2.6pre4/VISU_3.2.6" moduleName="VISU" />
</machine>
-<machine hostname="is111996" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" protocol="r" mode="i" nbOfNodes="1" nbOfProcPerNode="1" preReqFilePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL/salome.sh" >
-<modules modulePath="/home/secher/SALOME2_INSTALL/KERNEL_INSTALL" moduleName="KERNEL" />
-<modules modulePath="/export/home/LGLS/Products/MED_@VERSION@" moduleName="MED" />
-<modules modulePath="/export/home/LGLS/Products/GEOM_@VERSION@" moduleName="GEOM" />
-<modules modulePath="/export/home/LGLS/Products/SMESH_@VERSION@" moduleName="SMESH" />
-<modules modulePath="/export/home/LGLS/Products/SUPERV_@VERSION@" moduleName="SUPERV" />
-<modules modulePath="/export/home/LGLS/Products/VISU_@VERSION@" moduleName="VISU" />
-<modules modulePath="/home/secher/SALOME2_INSTALL/MYCOMPO_INSTALL" moduleName="MYCOMPO" />
-<modules modulePath="/home/secher/SALOME2_INSTALL/MYMPICOMPO_INSTALL" moduleName="MYMPICOMPO" />
+<machine hostname="tantal" alias="tantale.ccc.cea.fr" OS="LINUX" CPUFreqMHz="2992" memInMB="1024" protocol="s" mode="b" nbOfNodes="236" nbOfProcPerNode="4" appliPath="/workdir/rahuel/YACS/Salome_3.2.6pre4/env_products.sh" >
+<modules modulePath="/workdir/rahuel/YACS/Salome_3.2.6pre4/KERNEL_install" moduleName="KERNEL" />
+<modules modulePath="/workdir/rahuel/YACS/Salome_3.2.6pre4/MED_3.2.6" moduleName="MED" />
+<modules modulePath="/workdir/rahuel/YACS/Salome_3.2.6pre4/GEOM_3.2.6" moduleName="GEOM" />
+<modules modulePath="/workdir/rahuel/YACS/Salome_3.2.6pre4/SMESH_3.2.6" moduleName="SMESH" />
+<modules modulePath="/workdir/rahuel/YACS/Salome_3.2.6pre4/NETGENPLUGIN_3.2.6" moduleName="NETGENPLUGIN" />
+<modules modulePath="/workdir/rahuel/YACS/Salome_3.2.6pre4/NETGENPLUGIN_3.2.6" moduleName="NETGENPLUGIN" />
+<modules modulePath="/workdir/rahuel/YACS/Salome_3.2.6pre4/YACS_install" moduleName="YACS" />
+<modules modulePath="/workdir/rahuel/YACS/Salome_3.2.6pre4/SRHEOLEFCPP_install" moduleName="SRHEOLEFCPP" />
+<modules modulePath="/workdir/rahuel/YACS/Salome_3.2.6pre4/SRHEOLEF_install" moduleName="SRHEOLEF" />
</machine>
</resources>
<path-prefix-list>
</path-prefix-list>
+<!-- Commonly used types -->
+<type-list>
+ <type name="double" kind="double"/>
+ <type name="float" kind="double"/>
+ <type name="int" kind="int"/>
+ <type name="short" kind="int"/>
+ <type name="long" kind="int"/>
+ <type name="string" kind="string"/>
+ <type name="char" kind="string"/>
+ <type name="bool" kind="bool"/>
+ <type name="boolean" kind="bool"/>
+ <sequence name="dblevec" content="double"/>
+ <sequence name="intvec" content="int"/>
+ <sequence name="stringvec" content="string"/>
+ <sequence name="boolvec" content="bool"/>
+ <objref name="CALCIUM_integer" id="IDL:Ports/Calcium_Ports/Calcium_Integer_Port:1.0"/>
+ <objref name="CALCIUM_real" id="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"/>
+ <objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
+ <objref name="CALCIUM_string" id="IDL:Ports/Calcium_Ports/Calcium_String_Port:1.0"/>
+ <objref name="CALCIUM_boolean" id="IDL:Ports/Calcium_Ports/Calcium_Logical_Port:1.0"/>
+ <objref name="Study" id="IDL:SALOMEDS/Study:1.0"/>
+ <objref name="SObject" id="IDL:SALOMEDS/SObject:1.0"/>
+</type-list>
+
<!-- Component list -->
<component-list>
<component>
# ===============================================================
#
-DEPRECATED_FILES=\
- DEPRECATED/Plugin
+DEPRECATED_FILES=
dist_salomeres_DATA=\
CatalogResources.xml \
check_lam.m4 \
check_lsf.m4 \
check_mpi.m4 \
+check_openmpi.m4 \
check_mpich.m4 \
check_omniorb.m4 \
check_opengl.m4 \
check_openpbs.m4 \
-check_qt.m4 \
check_sockets.m4 \
check_swig.m4 \
check_withihm.m4 \
production.m4 \
pyembed.m4 \
python.m4 \
+check_libxml.m4
+
+dist_salome4depr_DATA=\
$(DEPRECATED_FILES)
BOOST_LIBS="-L${BOOSTDIR}/lib${LIB_LOCATION_SUFFIX}"
fi
+if test "x${BOOSTDIR}" = "x/usr" ; then
+ BOOST_CPPFLAGS=""
+ BOOST_LIBS=""
+fi
+
boost_ok=no
boost_headers_ok=no
boost_binaries_ok=no
AC_LANG_CPLUSPLUS
CPPFLAGS_old=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$CPPUNIT_INCLUDES"
- CPPFLAGS="$CPPFLAGS $QT_INCLUDES"
-
+
AC_CHECK_HEADER(cppunit/extensions/HelperMacros.h,cppunit_ok=yes,cppunit_ok=no)
CPPFLAGS=$CPPFLAGS_old
DOXYGEN_WITH_PYTHON=yes
DOXYGEN_WITH_STL=yes
;;
- [1-9].[5-9]*)
+ [[1-9]].[[5-9]]*)
DOXYGEN_WITH_PYTHON=yes
DOXYGEN_WITH_STL=yes
;;
--- /dev/null
+AC_DEFUN([CHECK_LIBXML],[
+
+AC_CHECKING(for libxml library)
+
+AC_SUBST(LIBXML_INCLUDES)
+AC_SUBST(LIBXML_LIBS)
+
+LIBXML_INCLUDES=""
+LIBXML_LIBS=""
+
+libxml_ok=no
+
+LOCAL_INCLUDES=""
+LOCAL_LIBS=""
+
+if test "x$LIBXML_DIR" != "x"
+then
+ LOCAL_INCLUDES="-I$LIBXML_DIR/include/libxml2"
+ LOCAL_LIBS="-L$LIBXML_DIR/lib -lxml2"
+else
+ LOCAL_INCLUDES="-I/usr/include/libxml2"
+ LOCAL_LIBS="-lxml2"
+fi
+
+dnl libxml2 headers
+
+CPPFLAGS_old="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
+AC_CHECK_HEADER(libxml/parser.h,libxml_ok="yes",libxml_ok="no")
+CPPFLAGS="$CPPFLAGS_old"
+
+if test "x$libxml_ok" = "xyes"
+then
+
+dnl libxml2 library
+
+ LIBS_old=$LIBS
+ LIBS="$LIBS $LOCAL_LIBS"
+ AC_CHECK_LIB(xml2,xmlInitParser,libxml_ok="yes",libxml_ok="no",)
+ LIBS=$LIBS_old
+fi
+
+if test "x$libxml_ok" = "xyes"
+then
+ LIBXML_INCLUDES="$LOCAL_INCLUDES"
+ LIBXML_LIBS="$LOCAL_LIBS"
+fi
+
+AC_MSG_RESULT(for libxml: $libxml_ok)
+
+])dnl
+dnl
+
AC_REQUIRE([AC_PROG_CC])dnl
+AC_ARG_WITH(mpi_lib,
+ [AC_HELP_STRING([--with-mpi_lib=DIR],[directory path of MPICH lib installation])],
+ MPILIBREQUESTED="$withval")
+
AC_ARG_WITH(mpi,
[AC_HELP_STRING([--with-mpi=DIR],[root directory path of MPICH installation])],
MPIREQUESTED="yes",MPIREQUESTED="no")
fi
fi
+ if test x"$MPILIBREQUESTED" != x; then
+ MPI_LIBS="-L$MPILIBREQUESTED"
+ fi
+
CPPFLAGS_old="$CPPFLAGS"
CPPFLAGS="$MPI_INCLUDES $CPPFLAGS"
AC_CHECK_HEADER(mpi.h,WITHMPI="yes",WITHMPI="no")
if test "$WITHMPI" = "yes";then
mpi_ok=yes
- MPI_LIBS="$MPI_LIBS -lmpi"
+ MPI_LIBS="$MPI_LIBS -lmpi -lmpio -lmpiCC"
else
mpi_ok=no
fi
fi
+ if test "$WITHLAM" = no; then
+dnl
+dnl ---------------------------------------------
+dnl testing OPENMPI
+dnl ---------------------------------------------
+dnl
+
+ CHECK_OPENMPI
+
+ fi
+
fi
if test x$WITHMPI2 = xyes; then
OMNIORB_CXXFLAGS="-DOMNIORB_VERSION=$OMNIORB_VERSION"
case $build_cpu in
sparc*)
- AC_DEFINE(__sparc__)
+ # AC_DEFINE(__sparc__)
OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__sparc__"
;;
*86*)
- AC_DEFINE(__x86__)
+ # AC_DEFINE(__x86__)
OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__x86__"
;;
esac
case $build_os in
osf*)
- AC_DEFINE(__osf1__)
+ # AC_DEFINE(__osf1__)
__OSVERSION__=5
- AC_DEFINE(__OSVERSION__)
+ AC_DEFINE([__OSVERSION__], [5], [Description])
OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__osf1__"
;;
solaris*)
- AC_DEFINE(__sunos__)
+ # AC_DEFINE(__sunos__)
__OSVERSION__=5
- AC_DEFINE(__OSVERSION__)
+ AC_DEFINE([__OSVERSION__], [5], [Description])
OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__sunos__"
;;
linux*)
- AC_DEFINE(__linux__)
+ # AC_DEFINE(__linux__)
__OSVERSION__=2
- AC_DEFINE(__OSVERSION__)
+ AC_DEFINE([__OSVERSION__], [2], [Description])
OMNIORB_CXXFLAGS="$OMNIORB_CXXFLAGS -D__linux__"
;;
esac
then
OMNIORB_IDLCXXFLAGS="-Wba -nf -I${OMNIORB_ROOT}/idl"
- OMNIORB_IDLPYFLAGS_1='-bpythonbe -p ${top_srcdir}/salome_adm/unix'
+ OMNIORB_IDLPYFLAGS_1='-bpython -p ${top_srcdir}/salome_adm/unix'
OMNIORB_IDLPYFLAGS_2=" -I${OMNIORB_ROOT}/idl"
OMNIORB_IDLPYFLAGS=${OMNIORB_IDLPYFLAGS_1}${OMNIORB_IDLPYFLAGS_2}
AC_SUBST(OMNIORB_IDL_TIE_H)
AC_SUBST(OMNIORB_IDL_TIE_CXX)
- AC_DEFINE(OMNIORB)
+ AC_DEFINE([OMNIORB], [], [Description])
CORBA_HAVE_POA=1
- AC_DEFINE(CORBA_HAVE_POA)
+ AC_DEFINE([CORBA_HAVE_POA], [], [Description])
CORBA_ORB_INIT_HAVE_3_ARGS=1
- AC_DEFINE(CORBA_ORB_INIT_HAVE_3_ARGS)
+ AC_DEFINE([CORBA_ORB_INIT_HAVE_3_ARGS], [], [Description])
CORBA_ORB_INIT_THIRD_ARG='"omniORB"'
- AC_DEFINE(CORBA_ORB_INIT_THIRD_ARG, "omniORB")
+ AC_DEFINE([CORBA_ORB_INIT_THIRD_ARG], [], [omniORB])
fi
--- /dev/null
+dnl Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+dnl
+dnl
+dnl
+
+AC_DEFUN([CHECK_OPENMPI],[
+AC_ARG_WITH(openmpi,
+ AC_HELP_STRING([--with-openmpi=DIR],[root directory path of openmpi installation]),
+ WITHOPENMPI="yes",WITHOPENMPI="no")
+
+MPI_INCLUDES=""
+MPI_LIBS=""
+mpi_ok=no
+
+if test "$WITHOPENMPI" = yes; then
+
+ OPENMPI_HOME=$withval
+
+ if test "$OPENMPI_HOME"; then
+ MPI_INCLUDES=`$OPENMPI_HOME/bin/mpicxx --showme:compile`
+ MPI_LIBS=`$OPENMPI_HOME/bin/mpicxx --showme:link`
+ fi
+
+ CPPFLAGS_old="$CPPFLAGS"
+ CPPFLAGS="$MPI_INCLUDES $CPPFLAGS"
+ AC_CHECK_HEADER(mpi.h,WITHOPENMPI="yes",WITHOPENMPI="no")
+ CPPFLAGS="$CPPFLAGS_old"
+
+ AC_MSG_CHECKING(for openmpi)
+ if test "$WITHOPENMPI" = "yes";then
+ mpi_ok=yes
+ AC_MSG_RESULT(yes)
+ else
+ mpi_ok=no
+ AC_MSG_RESULT(no)
+ fi
+fi
+])dnl
+
AC_MSG_RESULT($swig_ok)
fi
+numpydir=`$PYTHON -c "import numpy;print numpy.get_include()" 2>/dev/null`
+if test -d "$numpydir"; then
+ SWIG_FLAGS="$SWIG_FLAGS -DWITH_NUMPY"
+ PYTHON_INCLUDES="$PYTHON_INCLUDES -I$numpydir"
+ AC_DEFINE([WITH_NUMPY], [], [Python has numpy extension])
+fi
+
AC_SUBST(SWIG_FLAGS)
AC_SUBST(SWIG)
+++ /dev/null
-#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2004-12-17.09
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
-#
-#
-# FSF changes to this file are in the public domain.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-chmodcmd="$chmodprog 0755"
-chowncmd=
-chgrpcmd=
-stripcmd=
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=
-dst=
-dir_arg=
-dstarg=
-no_target_directory=
-
-usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
- or: $0 [OPTION]... SRCFILES... DIRECTORY
- or: $0 [OPTION]... -t DIRECTORY SRCFILES...
- or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
--c (ignored)
--d create directories instead of installing files.
--g GROUP $chgrpprog installed files to GROUP.
--m MODE $chmodprog installed files to MODE.
--o USER $chownprog installed files to USER.
--s $stripprog installed files.
--t DIRECTORY install into DIRECTORY.
--T report an error if DSTFILE is a directory.
---help display this help and exit.
---version display version info and exit.
-
-Environment variables override the default commands:
- CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
-"
-
-while test -n "$1"; do
- case $1 in
- -c) shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- --help) echo "$usage"; exit 0;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t) dstarg=$2
- shift
- shift
- continue;;
-
- -T) no_target_directory=true
- shift
- continue;;
-
- --version) echo "$0 $scriptversion"; exit 0;;
-
- *) # When -d is used, all remaining arguments are directories to create.
- # When -t is used, the destination is already specified.
- test -n "$dir_arg$dstarg" && break
- # Otherwise, the last argument is the destination. Remove it from $@.
- for arg
- do
- if test -n "$dstarg"; then
- # $@ is not empty: it contains at least $arg.
- set fnord "$@" "$dstarg"
- shift # fnord
- fi
- shift # arg
- dstarg=$arg
- done
- break;;
- esac
-done
-
-if test -z "$1"; then
- if test -z "$dir_arg"; then
- echo "$0: no input file specified." >&2
- exit 1
- fi
- # It's OK to call `install-sh -d' without argument.
- # This can happen when creating conditional directories.
- exit 0
-fi
-
-for src
-do
- # Protect names starting with `-'.
- case $src in
- -*) src=./$src ;;
- esac
-
- if test -n "$dir_arg"; then
- dst=$src
- src=
-
- if test -d "$dst"; then
- mkdircmd=:
- chmodcmd=
- else
- mkdircmd=$mkdirprog
- fi
- else
- # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
- # might cause directories to be created, which would be especially bad
- # if $src (and thus $dsttmp) contains '*'.
- if test ! -f "$src" && test ! -d "$src"; then
- echo "$0: $src does not exist." >&2
- exit 1
- fi
-
- if test -z "$dstarg"; then
- echo "$0: no destination specified." >&2
- exit 1
- fi
-
- dst=$dstarg
- # Protect names starting with `-'.
- case $dst in
- -*) dst=./$dst ;;
- esac
-
- # If destination is a directory, append the input filename; won't work
- # if double slashes aren't ignored.
- if test -d "$dst"; then
- if test -n "$no_target_directory"; then
- echo "$0: $dstarg: Is a directory" >&2
- exit 1
- fi
- dst=$dst/`basename "$src"`
- fi
- fi
-
- # This sed command emulates the dirname command.
- dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
-
- # Make sure that the destination directory exists.
-
- # Skip lots of stat calls in the usual case.
- if test ! -d "$dstdir"; then
- defaultIFS='
- '
- IFS="${IFS-$defaultIFS}"
-
- oIFS=$IFS
- # Some sh's can't handle IFS=/ for some reason.
- IFS='%'
- set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
- shift
- IFS=$oIFS
-
- pathcomp=
-
- while test $# -ne 0 ; do
- pathcomp=$pathcomp$1
- shift
- if test ! -d "$pathcomp"; then
- $mkdirprog "$pathcomp"
- # mkdir can fail with a `File exist' error in case several
- # install-sh are creating the directory concurrently. This
- # is OK.
- test -d "$pathcomp" || exit
- fi
- pathcomp=$pathcomp/
- done
- fi
-
- if test -n "$dir_arg"; then
- $doit $mkdircmd "$dst" \
- && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
- && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
- && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
- && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
-
- else
- dstfile=`basename "$dst"`
-
- # Make a couple of temp file names in the proper directory.
- dsttmp=$dstdir/_inst.$$_
- rmtmp=$dstdir/_rm.$$_
-
- # Trap to clean up those temp files at exit.
- trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
- trap '(exit $?); exit' 1 2 13 15
-
- # Copy the file name to the temp name.
- $doit $cpprog "$src" "$dsttmp" &&
-
- # and set any options; do chmod last to preserve setuid bits.
- #
- # If any of these fail, we abort the whole thing. If we want to
- # ignore errors from any of these, just make sure not to ignore
- # errors from the above "$doit $cpprog $src $dsttmp" command.
- #
- { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
- && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
- && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
- && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
-
- # Now rename the file to the real destination.
- { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
- || {
- # The rename failed, perhaps because mv can't rename something else
- # to itself, or perhaps because mv is so ancient that it does not
- # support -f.
-
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- if test -f "$dstdir/$dstfile"; then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
- || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
- || {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit 1
- }
- else
- :
- fi
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
- }
- }
- fi || { (exit 1); exit 1; }
-done
-
-# The final little trick to "correctly" pass the exit status to the exit trap.
-{
- (exit 0); exit 0
-}
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
+++ /dev/null
-# ltmain.sh - Provide generalized library-building support services.
-# NOTE: Changing this file will not affect anything until you rerun configure.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
-# Free Software Foundation, Inc.
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program 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
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-basename="s,^.*/,,g"
-
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
-
-# define SED for historic ltconfig's generated by Libtool 1.3
-test -z "$SED" && SED=sed
-
-# The name of this program:
-progname=`echo "$progpath" | $SED $basename`
-modename="$progname"
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=1.5.6
-TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)"
-
-
-# Check that we have a working $echo.
-if test "X$1" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
-elif test "X$1" = X--fallback-echo; then
- # Avoid inline document here, it may be left over
- :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
- # Yippee, $echo works!
- :
-else
- # Restart under the correct shell, and then maybe $echo will work.
- exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
- # used as fallback echo
- shift
- cat <<EOF
-$*
-EOF
- exit $EXIT_SUCCESS
-fi
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-rm="rm -f"
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-# test EBCDIC or ASCII
-case `echo A|tr A '\301'` in
- A) # EBCDIC based system
- SP2NL="tr '\100' '\n'"
- NL2SP="tr '\r\n' '\100\100'"
- ;;
- *) # Assume ASCII based system
- SP2NL="tr '\040' '\012'"
- NL2SP="tr '\015\012' '\040\040'"
- ;;
-esac
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-# We save the old values to restore during execute mode.
-if test "${LC_ALL+set}" = set; then
- save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
-fi
-if test "${LANG+set}" = set; then
- save_LANG="$LANG"; LANG=C; export LANG
-fi
-
-# Make sure IFS has a sensible default
-: ${IFS="
-"}
-
-if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
- $echo "$modename: not configured to build any kind of library" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit $EXIT_FAILURE
-fi
-
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show="$echo"
-show_help=
-execute_dlfiles=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-
-#####################################
-# Shell function definitions:
-# This seems to be the best place for them
-
-# func_win32_libid arg
-# return the library type of file 'arg'
-#
-# Need a lot of goo to handle *both* DLLs and import libs
-# Has to be a shell function in order to 'eat' the argument
-# that is supplied when $file_magic_command is called.
-func_win32_libid () {
- win32_libid_type="unknown"
- win32_fileres=`file -L $1 2>/dev/null`
- case $win32_fileres in
- *ar\ archive\ import\ library*) # definitely import
- win32_libid_type="x86 archive import"
- ;;
- *ar\ archive*) # could be an import, or static
- if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
- $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
- win32_nmres=`eval $NM -f posix -A $1 | \
- sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
- if test "X$win32_nmres" = "Ximport" ; then
- win32_libid_type="x86 archive import"
- else
- win32_libid_type="x86 archive static"
- fi
- fi
- ;;
- *DLL*)
- win32_libid_type="x86 DLL"
- ;;
- *executable*) # but shell scripts are "executable" too...
- case $win32_fileres in
- *MS\ Windows\ PE\ Intel*)
- win32_libid_type="x86 DLL"
- ;;
- esac
- ;;
- esac
- $echo $win32_libid_type
-}
-
-
-# func_infer_tag arg
-# Infer tagged configuration to use if any are available and
-# if one wasn't chosen via the "--tag" command line option.
-# Only attempt this if the compiler in the base compile
-# command doesn't match the default compiler.
-# arg is usually of the form 'gcc ...'
-func_infer_tag () {
- if test -n "$available_tags" && test -z "$tagname"; then
- CC_quoted=
- for arg in $CC; do
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- CC_quoted="$CC_quoted $arg"
- done
- case $@ in
- # Blanks in the command may have been stripped by the calling shell,
- # but not from the CC environment variable when configure was run.
- " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
- # Blanks at the start of $base_compile will cause this to fail
- # if we don't check for them as well.
- *)
- for z in $available_tags; do
- if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
- # Evaluate the configuration.
- eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
- CC_quoted=
- for arg in $CC; do
- # Double-quote args containing other shell metacharacters.
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- CC_quoted="$CC_quoted $arg"
- done
- case "$@ " in
- " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
- # The compiler in the base compile command matches
- # the one in the tagged configuration.
- # Assume this is the tagged configuration we want.
- tagname=$z
- break
- ;;
- esac
- fi
- done
- # If $tagname still isn't set, then no tagged configuration
- # was found and let the user know that the "--tag" command
- # line option must be used.
- if test -z "$tagname"; then
- $echo "$modename: unable to infer tagged configuration"
- $echo "$modename: specify a tag with \`--tag'" 1>&2
- exit $EXIT_FAILURE
-# else
-# $echo "$modename: using $tagname tagged configuration"
- fi
- ;;
- esac
- fi
-}
-# End of Shell function definitions
-#####################################
-
-# Darwin sucks
-#eval std_shrext=\"$shrext_cmds\"
-
-# And fixing for Darwin sucks for everybody else
-if test -z "$shrext_cmds" && test -n "$shrext"; then
- eval shrext_cmds=\"$shrext\"
-fi
-eval std_shrext=\"$shrext_cmds\"
-
-# This value is evaluated to 32768, so place it here as a compatilibity hack
-# because older libtool.m4 didn't define this variable
-test -z "$max_cmd_len" && max_cmd_len=32768
-
-# Parse our command line options once, thoroughly.
-while test "$#" -gt 0
-do
- arg="$1"
- shift
-
- case $arg in
- -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case $prev in
- execute_dlfiles)
- execute_dlfiles="$execute_dlfiles $arg"
- ;;
- tag)
- tagname="$arg"
- preserve_args="${preserve_args}=$arg"
-
- # Check whether tagname contains only valid characters
- case $tagname in
- *[!-_A-Za-z0-9,/]*)
- $echo "$progname: invalid tag name: $tagname" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- case $tagname in
- CC)
- # Don't test for the "default" C tag, as we know, it's there, but
- # not specially marked.
- ;;
- *)
- if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
- taglist="$taglist $tagname"
- # Evaluate the configuration.
- eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
- else
- $echo "$progname: ignoring unknown tag $tagname" 1>&2
- fi
- ;;
- esac
- ;;
- *)
- eval "$prev=\$arg"
- ;;
- esac
-
- prev=
- prevopt=
- continue
- fi
-
- # Have we seen a non-optional argument yet?
- case $arg in
- --help)
- show_help=yes
- ;;
-
- --version)
- $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
- $echo
- $echo "Copyright (C) 2003 Free Software Foundation, Inc."
- $echo "This is free software; see the source for copying conditions. There is NO"
- $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
- exit $EXIT_SUCCESS
- ;;
-
- --config)
- ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
- # Now print the configurations for the tags.
- for tagname in $taglist; do
- ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
- done
- exit $EXIT_SUCCESS
- ;;
-
- --debug)
- $echo "$progname: enabling shell trace mode"
- set -x
- preserve_args="$preserve_args $arg"
- ;;
-
- --dry-run | -n)
- run=:
- ;;
-
- --features)
- $echo "host: $host"
- if test "$build_libtool_libs" = yes; then
- $echo "enable shared libraries"
- else
- $echo "disable shared libraries"
- fi
- if test "$build_old_libs" = yes; then
- $echo "enable static libraries"
- else
- $echo "disable static libraries"
- fi
- exit $EXIT_SUCCESS
- ;;
-
- --finish) mode="finish" ;;
-
- --mode) prevopt="--mode" prev=mode ;;
- --mode=*) mode="$optarg" ;;
-
- --preserve-dup-deps) duplicate_deps="yes" ;;
-
- --quiet | --silent)
- show=:
- preserve_args="$preserve_args $arg"
- ;;
-
- --tag) prevopt="--tag" prev=tag ;;
- --tag=*)
- set tag "$optarg" ${1+"$@"}
- shift
- prev=tag
- preserve_args="$preserve_args --tag"
- ;;
-
- -dlopen)
- prevopt="-dlopen"
- prev=execute_dlfiles
- ;;
-
- -*)
- $echo "$modename: unrecognized option \`$arg'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
-
- *)
- nonopt="$arg"
- break
- ;;
- esac
-done
-
-if test -n "$prevopt"; then
- $echo "$modename: option \`$prevopt' requires an argument" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
-fi
-
-# If this variable is set in any of the actions, the command in it
-# will be execed at the end. This prevents here-documents from being
-# left over by shells.
-exec_cmd=
-
-if test -z "$show_help"; then
-
- # Infer the operation mode.
- if test -z "$mode"; then
- $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
- $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
- case $nonopt in
- *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
- mode=link
- for arg
- do
- case $arg in
- -c)
- mode=compile
- break
- ;;
- esac
- done
- ;;
- *db | *dbx | *strace | *truss)
- mode=execute
- ;;
- *install*|cp|mv)
- mode=install
- ;;
- *rm)
- mode=uninstall
- ;;
- *)
- # If we have no mode, but dlfiles were specified, then do execute mode.
- test -n "$execute_dlfiles" && mode=execute
-
- # Just use the default operation mode.
- if test -z "$mode"; then
- if test -n "$nonopt"; then
- $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
- else
- $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
- fi
- fi
- ;;
- esac
- fi
-
- # Only execute mode is allowed to have -dlopen flags.
- if test -n "$execute_dlfiles" && test "$mode" != execute; then
- $echo "$modename: unrecognized option \`-dlopen'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Change the help message to a mode-specific one.
- generic_help="$help"
- help="Try \`$modename --help --mode=$mode' for more information."
-
- # These modes are in order of execution frequency so that they run quickly.
- case $mode in
- # libtool compile mode
- compile)
- modename="$modename: compile"
- # Get the compilation command and the source file.
- base_compile=
- srcfile="$nonopt" # always keep a non-empty value in "srcfile"
- suppress_opt=yes
- suppress_output=
- arg_mode=normal
- libobj=
- later=
-
- for arg
- do
- case "$arg_mode" in
- arg )
- # do not "continue". Instead, add this to base_compile
- lastarg="$arg"
- arg_mode=normal
- ;;
-
- target )
- libobj="$arg"
- arg_mode=normal
- continue
- ;;
-
- normal )
- # Accept any command-line options.
- case $arg in
- -o)
- if test -n "$libobj" ; then
- $echo "$modename: you cannot specify \`-o' more than once" 1>&2
- exit $EXIT_FAILURE
- fi
- arg_mode=target
- continue
- ;;
-
- -static | -prefer-pic | -prefer-non-pic)
- later="$later $arg"
- continue
- ;;
-
- -no-suppress)
- suppress_opt=no
- continue
- ;;
-
- -Xcompiler)
- arg_mode=arg # the next one goes into the "base_compile" arg list
- continue # The current "srcfile" will either be retained or
- ;; # replaced later. I would guess that would be a bug.
-
- -Wc,*)
- args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
- lastarg=
- save_ifs="$IFS"; IFS=','
- for arg in $args; do
- IFS="$save_ifs"
-
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- lastarg="$lastarg $arg"
- done
- IFS="$save_ifs"
- lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
-
- # Add the arguments to base_compile.
- base_compile="$base_compile $lastarg"
- continue
- ;;
-
- * )
- # Accept the current argument as the source file.
- # The previous "srcfile" becomes the current argument.
- #
- lastarg="$srcfile"
- srcfile="$arg"
- ;;
- esac # case $arg
- ;;
- esac # case $arg_mode
-
- # Aesthetically quote the previous argument.
- lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
-
- case $lastarg in
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- lastarg="\"$lastarg\""
- ;;
- esac
-
- base_compile="$base_compile $lastarg"
- done # for arg
-
- case $arg_mode in
- arg)
- $echo "$modename: you must specify an argument for -Xcompile"
- exit $EXIT_FAILURE
- ;;
- target)
- $echo "$modename: you must specify a target with \`-o'" 1>&2
- exit $EXIT_FAILURE
- ;;
- *)
- # Get the name of the library object.
- [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
- ;;
- esac
-
- # Recognize several different file suffixes.
- # If the user specifies -o file.o, it is replaced with file.lo
- xform='[cCFSifmso]'
- case $libobj in
- *.ada) xform=ada ;;
- *.adb) xform=adb ;;
- *.ads) xform=ads ;;
- *.asm) xform=asm ;;
- *.c++) xform=c++ ;;
- *.cc) xform=cc ;;
- *.ii) xform=ii ;;
- *.class) xform=class ;;
- *.cpp) xform=cpp ;;
- *.cxx) xform=cxx ;;
- *.f90) xform=f90 ;;
- *.for) xform=for ;;
- *.java) xform=java ;;
- esac
-
- libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
-
- case $libobj in
- *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
- *)
- $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- func_infer_tag $base_compile
-
- for arg in $later; do
- case $arg in
- -static)
- build_old_libs=yes
- continue
- ;;
-
- -prefer-pic)
- pic_mode=yes
- continue
- ;;
-
- -prefer-non-pic)
- pic_mode=no
- continue
- ;;
- esac
- done
-
- objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
- xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$obj"; then
- xdir=
- else
- xdir=$xdir/
- fi
- lobj=${xdir}$objdir/$objname
-
- if test -z "$base_compile"; then
- $echo "$modename: you must specify a compilation command" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Delete any leftover library objects.
- if test "$build_old_libs" = yes; then
- removelist="$obj $lobj $libobj ${libobj}T"
- else
- removelist="$lobj $libobj ${libobj}T"
- fi
-
- $run $rm $removelist
- trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
-
- # On Cygwin there's no "real" PIC flag so we must build both object types
- case $host_os in
- cygwin* | mingw* | pw32* | os2*)
- pic_mode=default
- ;;
- esac
- if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
- # non-PIC code in shared libraries is not supported
- pic_mode=default
- fi
-
- # Calculate the filename of the output object if compiler does
- # not support -o with -c
- if test "$compiler_c_o" = no; then
- output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
- lockfile="$output_obj.lock"
- removelist="$removelist $output_obj $lockfile"
- trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
- else
- output_obj=
- need_locks=no
- lockfile=
- fi
-
- # Lock this critical section if it is needed
- # We use this script file to make the link, it avoids creating a new file
- if test "$need_locks" = yes; then
- until $run ln "$progpath" "$lockfile" 2>/dev/null; do
- $show "Waiting for $lockfile to be removed"
- sleep 2
- done
- elif test "$need_locks" = warn; then
- if test -f "$lockfile"; then
- $echo "\
-*** ERROR, $lockfile exists and contains:
-`cat $lockfile 2>/dev/null`
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
- $echo $srcfile > "$lockfile"
- fi
-
- if test -n "$fix_srcfile_path"; then
- eval srcfile=\"$fix_srcfile_path\"
- fi
-
- $run $rm "$libobj" "${libobj}T"
-
- # Create a libtool object file (analogous to a ".la" file),
- # but don't create it if we're doing a dry run.
- test -z "$run" && cat > ${libobj}T <<EOF
-# $libobj - a libtool object file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-EOF
-
- # Only build a PIC object if we are building libtool libraries.
- if test "$build_libtool_libs" = yes; then
- # Without this assignment, base_compile gets emptied.
- fbsd_hideous_sh_bug=$base_compile
-
- if test "$pic_mode" != no; then
- command="$base_compile $srcfile $pic_flag"
- else
- # Don't build PIC code
- command="$base_compile $srcfile"
- fi
-
- if test ! -d "${xdir}$objdir"; then
- $show "$mkdir ${xdir}$objdir"
- $run $mkdir ${xdir}$objdir
- status=$?
- if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
- exit $status
- fi
- fi
-
- if test -z "$output_obj"; then
- # Place PIC objects in $objdir
- command="$command -o $lobj"
- fi
-
- $run $rm "$lobj" "$output_obj"
-
- $show "$command"
- if $run eval "$command"; then :
- else
- test -n "$output_obj" && $run $rm $removelist
- exit $EXIT_FAILURE
- fi
-
- if test "$need_locks" = warn &&
- test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
-
- # Just move the object if needed, then go on to compile the next one
- if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
- $show "$mv $output_obj $lobj"
- if $run $mv $output_obj $lobj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # Append the name of the PIC object to the libtool object file.
- test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object='$objdir/$objname'
-
-EOF
-
- # Allow error messages only from the first compilation.
- if test "$suppress_opt" = yes; then
- suppress_output=' >/dev/null 2>&1'
- fi
- else
- # No PIC object so indicate it doesn't exist in the libtool
- # object file.
- test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object=none
-
-EOF
- fi
-
- # Only build a position-dependent object if we build old libraries.
- if test "$build_old_libs" = yes; then
- if test "$pic_mode" != yes; then
- # Don't build PIC code
- command="$base_compile $srcfile"
- else
- command="$base_compile $srcfile $pic_flag"
- fi
- if test "$compiler_c_o" = yes; then
- command="$command -o $obj"
- fi
-
- # Suppress compiler output if we already did a PIC compilation.
- command="$command$suppress_output"
- $run $rm "$obj" "$output_obj"
- $show "$command"
- if $run eval "$command"; then :
- else
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
-
- if test "$need_locks" = warn &&
- test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
-
- # Just move the object if needed
- if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
- $show "$mv $output_obj $obj"
- if $run $mv $output_obj $obj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # Append the name of the non-PIC object the libtool object file.
- # Only append if the libtool object file exists.
- test -z "$run" && cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object='$objname'
-
-EOF
- else
- # Append the name of the non-PIC object the libtool object file.
- # Only append if the libtool object file exists.
- test -z "$run" && cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object=none
-
-EOF
- fi
-
- $run $mv "${libobj}T" "${libobj}"
-
- # Unlock the critical section if it was locked
- if test "$need_locks" != no; then
- $run $rm "$lockfile"
- fi
-
- exit $EXIT_SUCCESS
- ;;
-
- # libtool link mode
- link | relink)
- modename="$modename: link"
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- # It is impossible to link a dll without this setting, and
- # we shouldn't force the makefile maintainer to figure out
- # which system we are compiling for in order to pass an extra
- # flag for every libtool invocation.
- # allow_undefined=no
-
- # FIXME: Unfortunately, there are problems with the above when trying
- # to make a dll which has undefined symbols, in which case not
- # even a static library is built. For now, we need to specify
- # -no-undefined on the libtool link line when we can be certain
- # that all symbols are satisfied, otherwise we get a static library.
- allow_undefined=yes
- ;;
- *)
- allow_undefined=yes
- ;;
- esac
- libtool_args="$nonopt"
- base_compile="$nonopt $@"
- compile_command="$nonopt"
- finalize_command="$nonopt"
-
- compile_rpath=
- finalize_rpath=
- compile_shlibpath=
- finalize_shlibpath=
- convenience=
- old_convenience=
- deplibs=
- old_deplibs=
- compiler_flags=
- linker_flags=
- dllsearchpath=
- lib_search_path=`pwd`
- inst_prefix_dir=
-
- avoid_version=no
- dlfiles=
- dlprefiles=
- dlself=no
- export_dynamic=no
- export_symbols=
- export_symbols_regex=
- generated=
- libobjs=
- ltlibs=
- module=no
- no_install=no
- objs=
- non_pic_objects=
- precious_files_regex=
- prefer_static_libs=no
- preload=no
- prev=
- prevarg=
- release=
- rpath=
- xrpath=
- perm_rpath=
- temp_rpath=
- thread_safe=no
- vinfo=
- vinfo_number=no
-
- func_infer_tag $base_compile
-
- # We need to know -static, to get the right output filenames.
- for arg
- do
- case $arg in
- -all-static | -static)
- if test "X$arg" = "X-all-static"; then
- if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
- $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
- fi
- if test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- else
- if test -z "$pic_flag" && test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- fi
- build_libtool_libs=no
- build_old_libs=yes
- prefer_static_libs=yes
- break
- ;;
- esac
- done
-
- # See if our shared archives depend on static archives.
- test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
- # Go through the arguments, transforming them on the way.
- while test "$#" -gt 0; do
- arg="$1"
- shift
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
- ;;
- *) qarg=$arg ;;
- esac
- libtool_args="$libtool_args $qarg"
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case $prev in
- output)
- compile_command="$compile_command @OUTPUT@"
- finalize_command="$finalize_command @OUTPUT@"
- ;;
- esac
-
- case $prev in
- dlfiles|dlprefiles)
- if test "$preload" = no; then
- # Add the symbol object into the linking commands.
- compile_command="$compile_command @SYMFILE@"
- finalize_command="$finalize_command @SYMFILE@"
- preload=yes
- fi
- case $arg in
- *.la | *.lo) ;; # We handle these cases below.
- force)
- if test "$dlself" = no; then
- dlself=needless
- export_dynamic=yes
- fi
- prev=
- continue
- ;;
- self)
- if test "$prev" = dlprefiles; then
- dlself=yes
- elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
- dlself=yes
- else
- dlself=needless
- export_dynamic=yes
- fi
- prev=
- continue
- ;;
- *)
- if test "$prev" = dlfiles; then
- dlfiles="$dlfiles $arg"
- else
- dlprefiles="$dlprefiles $arg"
- fi
- prev=
- continue
- ;;
- esac
- ;;
- expsyms)
- export_symbols="$arg"
- if test ! -f "$arg"; then
- $echo "$modename: symbol file \`$arg' does not exist"
- exit $EXIT_FAILURE
- fi
- prev=
- continue
- ;;
- expsyms_regex)
- export_symbols_regex="$arg"
- prev=
- continue
- ;;
- inst_prefix)
- inst_prefix_dir="$arg"
- prev=
- continue
- ;;
- precious_regex)
- precious_files_regex="$arg"
- prev=
- continue
- ;;
- release)
- release="-$arg"
- prev=
- continue
- ;;
- objectlist)
- if test -f "$arg"; then
- save_arg=$arg
- moreargs=
- for fil in `cat $save_arg`
- do
-# moreargs="$moreargs $fil"
- arg=$fil
- # A libtool-controlled object.
-
- # Check to see that this really is a libtool object.
- if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- pic_object=
- non_pic_object=
-
- # Read the .lo file
- # If there is no directory component, then add one.
- case $arg in
- */* | *\\*) . $arg ;;
- *) . ./$arg ;;
- esac
-
- if test -z "$pic_object" || \
- test -z "$non_pic_object" ||
- test "$pic_object" = none && \
- test "$non_pic_object" = none; then
- $echo "$modename: cannot find name of object for \`$arg'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Extract subdirectory from the argument.
- xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$arg"; then
- xdir=
- else
- xdir="$xdir/"
- fi
-
- if test "$pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- pic_object="$xdir$pic_object"
-
- if test "$prev" = dlfiles; then
- if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- dlfiles="$dlfiles $pic_object"
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- # CHECK ME: I think I busted this. -Ossama
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles $pic_object"
- prev=
- fi
-
- # A PIC object.
- libobjs="$libobjs $pic_object"
- arg="$pic_object"
- fi
-
- # Non-PIC object.
- if test "$non_pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- non_pic_object="$xdir$non_pic_object"
-
- # A standard non-PIC object
- non_pic_objects="$non_pic_objects $non_pic_object"
- if test -z "$pic_object" || test "$pic_object" = none ; then
- arg="$non_pic_object"
- fi
- fi
- else
- # Only an error if not doing a dry-run.
- if test -z "$run"; then
- $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
- exit $EXIT_FAILURE
- else
- # Dry-run case.
-
- # Extract subdirectory from the argument.
- xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$arg"; then
- xdir=
- else
- xdir="$xdir/"
- fi
-
- pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
- non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
- libobjs="$libobjs $pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
- fi
- fi
- done
- else
- $echo "$modename: link input file \`$save_arg' does not exist"
- exit $EXIT_FAILURE
- fi
- arg=$save_arg
- prev=
- continue
- ;;
- rpath | xrpath)
- # We need an absolute path.
- case $arg in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- if test "$prev" = rpath; then
- case "$rpath " in
- *" $arg "*) ;;
- *) rpath="$rpath $arg" ;;
- esac
- else
- case "$xrpath " in
- *" $arg "*) ;;
- *) xrpath="$xrpath $arg" ;;
- esac
- fi
- prev=
- continue
- ;;
- xcompiler)
- compiler_flags="$compiler_flags $qarg"
- prev=
- compile_command="$compile_command $qarg"
- finalize_command="$finalize_command $qarg"
- continue
- ;;
- xlinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $wl$qarg"
- prev=
- compile_command="$compile_command $wl$qarg"
- finalize_command="$finalize_command $wl$qarg"
- continue
- ;;
- xcclinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $qarg"
- prev=
- compile_command="$compile_command $qarg"
- finalize_command="$finalize_command $qarg"
- continue
- ;;
- shrext)
- shrext_cmds="$arg"
- prev=
- continue
- ;;
- *)
- eval "$prev=\"\$arg\""
- prev=
- continue
- ;;
- esac
- fi # test -n "$prev"
-
- prevarg="$arg"
-
- case $arg in
- -all-static)
- if test -n "$link_static_flag"; then
- compile_command="$compile_command $link_static_flag"
- finalize_command="$finalize_command $link_static_flag"
- fi
- continue
- ;;
-
- -allow-undefined)
- # FIXME: remove this flag sometime in the future.
- $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
- continue
- ;;
-
- -avoid-version)
- avoid_version=yes
- continue
- ;;
-
- -dlopen)
- prev=dlfiles
- continue
- ;;
-
- -dlpreopen)
- prev=dlprefiles
- continue
- ;;
-
- -export-dynamic)
- export_dynamic=yes
- continue
- ;;
-
- -export-symbols | -export-symbols-regex)
- if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- $echo "$modename: more than one -exported-symbols argument is not allowed"
- exit $EXIT_FAILURE
- fi
- if test "X$arg" = "X-export-symbols"; then
- prev=expsyms
- else
- prev=expsyms_regex
- fi
- continue
- ;;
-
- -inst-prefix-dir)
- prev=inst_prefix
- continue
- ;;
-
- # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
- # so, if we see these flags be careful not to treat them like -L
- -L[A-Z][A-Z]*:*)
- case $with_gcc/$host in
- no/*-*-irix* | /*-*-irix*)
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- ;;
- esac
- continue
- ;;
-
- -L*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
- exit $EXIT_FAILURE
- fi
- dir="$absdir"
- ;;
- esac
- case "$deplibs " in
- *" -L$dir "*) ;;
- *)
- deplibs="$deplibs -L$dir"
- lib_search_path="$lib_search_path $dir"
- ;;
- esac
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- case :$dllsearchpath: in
- *":$dir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$dir";;
- esac
- ;;
- esac
- continue
- ;;
-
- -l*)
- if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
- case $host in
- *-*-cygwin* | *-*-pw32* | *-*-beos*)
- # These systems don't actually have a C or math library (as such)
- continue
- ;;
- *-*-mingw* | *-*-os2*)
- # These systems don't actually have a C library (as such)
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-openbsd* | *-*-freebsd*)
- # Do not include libc due to us having libc/libc_r.
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-rhapsody* | *-*-darwin1.[012])
- # Rhapsody C and math libraries are in the System framework
- deplibs="$deplibs -framework System"
- continue
- esac
- elif test "X$arg" = "X-lc_r"; then
- case $host in
- *-*-openbsd* | *-*-freebsd*)
- # Do not include libc_r directly, use -pthread flag.
- continue
- ;;
- esac
- fi
- deplibs="$deplibs $arg"
- continue
- ;;
-
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
- deplibs="$deplibs $arg"
- continue
- ;;
-
- -module)
- module=yes
- continue
- ;;
-
- # gcc -m* arguments should be passed to the linker via $compiler_flags
- # in order to pass architecture information to the linker
- # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
- # but this is not reliable with gcc because gcc may use -mfoo to
- # select a different linker, different libraries, etc, while
- # -Wl,-mfoo simply passes -mfoo to the linker.
- -m*)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- if test "$with_gcc" = "yes" ; then
- compiler_flags="$compiler_flags $arg"
- fi
- continue
- ;;
-
- -shrext)
- prev=shrext
- continue
- ;;
-
- -no-fast-install)
- fast_install=no
- continue
- ;;
-
- -no-install)
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- # The PATH hackery in wrapper scripts is required on Windows
- # in order for the loader to find any dlls it needs.
- $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
- $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
- fast_install=no
- ;;
- *) no_install=yes ;;
- esac
- continue
- ;;
-
- -no-undefined)
- allow_undefined=no
- continue
- ;;
-
- -objectlist)
- prev=objectlist
- continue
- ;;
-
- -o) prev=output ;;
-
- -precious-files-regex)
- prev=precious_regex
- continue
- ;;
-
- -release)
- prev=release
- continue
- ;;
-
- -rpath)
- prev=rpath
- continue
- ;;
-
- -R)
- prev=xrpath
- continue
- ;;
-
- -R*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- continue
- ;;
-
- -static)
- # The effects of -static are defined in a previous loop.
- # We used to do the same as -all-static on platforms that
- # didn't have a PIC flag, but the assumption that the effects
- # would be equivalent was wrong. It would break on at least
- # Digital Unix and AIX.
- continue
- ;;
-
- -thread-safe)
- thread_safe=yes
- continue
- ;;
-
- -version-info)
- prev=vinfo
- continue
- ;;
- -version-number)
- prev=vinfo
- vinfo_number=yes
- continue
- ;;
-
- -Wc,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
- arg=
- save_ifs="$IFS"; IFS=','
- for flag in $args; do
- IFS="$save_ifs"
- case $flag in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- flag="\"$flag\""
- ;;
- esac
- arg="$arg $wl$flag"
- compiler_flags="$compiler_flags $flag"
- done
- IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
- ;;
-
- -Wl,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
- arg=
- save_ifs="$IFS"; IFS=','
- for flag in $args; do
- IFS="$save_ifs"
- case $flag in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- flag="\"$flag\""
- ;;
- esac
- arg="$arg $wl$flag"
- compiler_flags="$compiler_flags $wl$flag"
- linker_flags="$linker_flags $flag"
- done
- IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
- ;;
-
- -Xcompiler)
- prev=xcompiler
- continue
- ;;
-
- -Xlinker)
- prev=xlinker
- continue
- ;;
-
- -XCClinker)
- prev=xcclinker
- continue
- ;;
-
- # Some other compiler flag.
- -* | +*)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- ;;
-
- *.$objext)
- # A standard object.
- objs="$objs $arg"
- ;;
-
- *.lo)
- # A libtool-controlled object.
-
- # Check to see that this really is a libtool object.
- if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- pic_object=
- non_pic_object=
-
- # Read the .lo file
- # If there is no directory component, then add one.
- case $arg in
- */* | *\\*) . $arg ;;
- *) . ./$arg ;;
- esac
-
- if test -z "$pic_object" || \
- test -z "$non_pic_object" ||
- test "$pic_object" = none && \
- test "$non_pic_object" = none; then
- $echo "$modename: cannot find name of object for \`$arg'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Extract subdirectory from the argument.
- xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$arg"; then
- xdir=
- else
- xdir="$xdir/"
- fi
-
- if test "$pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- pic_object="$xdir$pic_object"
-
- if test "$prev" = dlfiles; then
- if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- dlfiles="$dlfiles $pic_object"
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- # CHECK ME: I think I busted this. -Ossama
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles $pic_object"
- prev=
- fi
-
- # A PIC object.
- libobjs="$libobjs $pic_object"
- arg="$pic_object"
- fi
-
- # Non-PIC object.
- if test "$non_pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- non_pic_object="$xdir$non_pic_object"
-
- # A standard non-PIC object
- non_pic_objects="$non_pic_objects $non_pic_object"
- if test -z "$pic_object" || test "$pic_object" = none ; then
- arg="$non_pic_object"
- fi
- fi
- else
- # Only an error if not doing a dry-run.
- if test -z "$run"; then
- $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
- exit $EXIT_FAILURE
- else
- # Dry-run case.
-
- # Extract subdirectory from the argument.
- xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$arg"; then
- xdir=
- else
- xdir="$xdir/"
- fi
-
- pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
- non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
- libobjs="$libobjs $pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
- fi
- fi
- ;;
-
- *.$libext)
- # An archive.
- deplibs="$deplibs $arg"
- old_deplibs="$old_deplibs $arg"
- continue
- ;;
-
- *.la)
- # A libtool-controlled library.
-
- if test "$prev" = dlfiles; then
- # This library was specified with -dlopen.
- dlfiles="$dlfiles $arg"
- prev=
- elif test "$prev" = dlprefiles; then
- # The library was specified with -dlpreopen.
- dlprefiles="$dlprefiles $arg"
- prev=
- else
- deplibs="$deplibs $arg"
- fi
- continue
- ;;
-
- # Some other compiler argument.
- *)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- ;;
- esac # arg
-
- # Now actually substitute the argument into the commands.
- if test -n "$arg"; then
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- fi
- done # argument parsing loop
-
- if test -n "$prev"; then
- $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
- eval arg=\"$export_dynamic_flag_spec\"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- fi
-
- oldlibs=
- # calculate the name of the file, without its directory
- outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
- libobjs_save="$libobjs"
-
- if test -n "$shlibpath_var"; then
- # get the directories listed in $shlibpath_var
- eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
- else
- shlib_search_path=
- fi
- eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
- eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-
- output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$output_objdir" = "X$output"; then
- output_objdir="$objdir"
- else
- output_objdir="$output_objdir/$objdir"
- fi
- # Create the object directory.
- if test ! -d "$output_objdir"; then
- $show "$mkdir $output_objdir"
- $run $mkdir $output_objdir
- status=$?
- if test "$status" -ne 0 && test ! -d "$output_objdir"; then
- exit $status
- fi
- fi
-
- # Determine the type of output
- case $output in
- "")
- $echo "$modename: you must specify an output file" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
- *.$libext) linkmode=oldlib ;;
- *.lo | *.$objext) linkmode=obj ;;
- *.la) linkmode=lib ;;
- *) linkmode=prog ;; # Anything else should be a program.
- esac
-
- case $host in
- *cygwin* | *mingw* | *pw32*)
- # don't eliminate duplications in $postdeps and $predeps
- duplicate_compiler_generated_deps=yes
- ;;
- *)
- duplicate_compiler_generated_deps=$duplicate_deps
- ;;
- esac
- specialdeplibs=
-
- libs=
- # Find all interdependent deplibs by searching for libraries
- # that are linked more than once (e.g. -la -lb -la)
- for deplib in $deplibs; do
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- libs="$libs $deplib"
- done
-
- if test "$linkmode" = lib; then
- libs="$predeps $libs $compiler_lib_search_path $postdeps"
-
- # Compute libraries that are listed more than once in $predeps
- # $postdeps and mark them as special (i.e., whose duplicates are
- # not to be eliminated).
- pre_post_deps=
- if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
- for pre_post_dep in $predeps $postdeps; do
- case "$pre_post_deps " in
- *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
- esac
- pre_post_deps="$pre_post_deps $pre_post_dep"
- done
- fi
- pre_post_deps=
- fi
-
- deplibs=
- newdependency_libs=
- newlib_search_path=
- need_relink=no # whether we're linking any uninstalled libtool libraries
- notinst_deplibs= # not-installed libtool libraries
- notinst_path= # paths that contain not-installed libtool libraries
- case $linkmode in
- lib)
- passes="conv link"
- for file in $dlfiles $dlprefiles; do
- case $file in
- *.la) ;;
- *)
- $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- done
- ;;
- prog)
- compile_deplibs=
- finalize_deplibs=
- alldeplibs=no
- newdlfiles=
- newdlprefiles=
- passes="conv scan dlopen dlpreopen link"
- ;;
- *) passes="conv"
- ;;
- esac
- for pass in $passes; do
- if test "$linkmode,$pass" = "lib,link" ||
- test "$linkmode,$pass" = "prog,scan"; then
- libs="$deplibs"
- deplibs=
- fi
- if test "$linkmode" = prog; then
- case $pass in
- dlopen) libs="$dlfiles" ;;
- dlpreopen) libs="$dlprefiles" ;;
- link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
- esac
- fi
- if test "$pass" = dlopen; then
- # Collect dlpreopened libraries
- save_deplibs="$deplibs"
- deplibs=
- fi
- for deplib in $libs; do
- lib=
- found=no
- case $deplib in
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- fi
- continue
- ;;
- -l*)
- if test "$linkmode" != lib && test "$linkmode" != prog; then
- $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
- continue
- fi
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
- for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
- for search_ext in .la $std_shrext .so .a; do
- # Search the libtool library
- lib="$searchdir/lib${name}${search_ext}"
- if test -f "$lib"; then
- if test "$search_ext" = ".la"; then
- found=yes
- else
- found=no
- fi
- break 2
- fi
- done
- done
- if test "$found" != yes; then
- # deplib doesn't seem to be a libtool library
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
- fi
- continue
- else # deplib is a libtool library
- # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
- # We need to do some special things here, and not later.
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $deplib "*)
- if (${SED} -e '2q' $lib |
- grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- library_names=
- old_library=
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
- for l in $old_library $library_names; do
- ll="$l"
- done
- if test "X$ll" = "X$old_library" ; then # only static version available
- found=no
- ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$ladir" = "X$lib" && ladir="."
- lib=$ladir/$old_library
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
- fi
- continue
- fi
- fi
- ;;
- *) ;;
- esac
- fi
- fi
- ;; # -l
- -L*)
- case $linkmode in
- lib)
- deplibs="$deplib $deplibs"
- test "$pass" = conv && continue
- newdependency_libs="$deplib $newdependency_libs"
- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
- ;;
- prog)
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- if test "$pass" = scan; then
- deplibs="$deplib $deplibs"
- else
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- fi
- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
- ;;
- *)
- $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
- ;;
- esac # linkmode
- continue
- ;; # -L
- -R*)
- if test "$pass" = link; then
- dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
- # Make sure the xrpath contains only unique directories.
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- fi
- deplibs="$deplib $deplibs"
- continue
- ;;
- *.la) lib="$deplib" ;;
- *.$libext)
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- case $linkmode in
- lib)
- if test "$deplibs_check_method" != pass_all; then
- $echo
- $echo "*** Warning: Trying to link with static lib archive $deplib."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have"
- $echo "*** because the file extensions .$libext of this argument makes me believe"
- $echo "*** that it is just a static archive that I should not used here."
- else
- $echo
- $echo "*** Warning: Linking the shared library $output against the"
- $echo "*** static library $deplib is not portable!"
- deplibs="$deplib $deplibs"
- fi
- continue
- ;;
- prog)
- if test "$pass" != link; then
- deplibs="$deplib $deplibs"
- else
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- fi
- continue
- ;;
- esac # linkmode
- ;; # *.$libext
- *.lo | *.$objext)
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- elif test "$linkmode" = prog; then
- if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
- # If there is no dlopen support or we're linking statically,
- # we need to preload.
- newdlprefiles="$newdlprefiles $deplib"
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- newdlfiles="$newdlfiles $deplib"
- fi
- fi
- continue
- ;;
- %DEPLIBS%)
- alldeplibs=yes
- continue
- ;;
- esac # case $deplib
- if test "$found" = yes || test -f "$lib"; then :
- else
- $echo "$modename: cannot find the library \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
-
- ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$ladir" = "X$lib" && ladir="."
-
- dlname=
- dlopen=
- dlpreopen=
- libdir=
- library_names=
- old_library=
- # If the library was installed with an old release of libtool,
- # it will not redefine variables installed, or shouldnotlink
- installed=yes
- shouldnotlink=no
-
- # Read the .la file
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
-
- if test "$linkmode,$pass" = "lib,link" ||
- test "$linkmode,$pass" = "prog,scan" ||
- { test "$linkmode" != prog && test "$linkmode" != lib; }; then
- test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
- test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
- fi
-
- if test "$pass" = conv; then
- # Only check for convenience libraries
- deplibs="$lib $deplibs"
- if test -z "$libdir"; then
- if test -z "$old_library"; then
- $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
- # It is a libtool convenience library, so add in its objects.
- convenience="$convenience $ladir/$objdir/$old_library"
- old_convenience="$old_convenience $ladir/$objdir/$old_library"
- tmp_libs=
- for deplib in $dependency_libs; do
- deplibs="$deplib $deplibs"
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
- elif test "$linkmode" != prog && test "$linkmode" != lib; then
- $echo "$modename: \`$lib' is not a convenience library" 1>&2
- exit $EXIT_FAILURE
- fi
- continue
- fi # $pass = conv
-
-
- # Get the name of the library we link against.
- linklib=
- for l in $old_library $library_names; do
- linklib="$l"
- done
- if test -z "$linklib"; then
- $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # This library was specified with -dlopen.
- if test "$pass" = dlopen; then
- if test -z "$libdir"; then
- $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
- if test -z "$dlname" ||
- test "$dlopen_support" != yes ||
- test "$build_libtool_libs" = no; then
- # If there is no dlname, no dlopen support or we're linking
- # statically, we need to preload. We also need to preload any
- # dependent libraries so libltdl's deplib preloader doesn't
- # bomb out in the load deplibs phase.
- dlprefiles="$dlprefiles $lib $dependency_libs"
- else
- newdlfiles="$newdlfiles $lib"
- fi
- continue
- fi # $pass = dlopen
-
- # We need an absolute path.
- case $ladir in
- [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
- *)
- abs_ladir=`cd "$ladir" && pwd`
- if test -z "$abs_ladir"; then
- $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
- $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
- abs_ladir="$ladir"
- fi
- ;;
- esac
- laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
-
- # Find the relevant object directory and library name.
- if test "X$installed" = Xyes; then
- if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
- $echo "$modename: warning: library \`$lib' was moved." 1>&2
- dir="$ladir"
- absdir="$abs_ladir"
- libdir="$abs_ladir"
- else
- dir="$libdir"
- absdir="$libdir"
- fi
- else
- dir="$ladir/$objdir"
- absdir="$abs_ladir/$objdir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
- fi # $installed = yes
- name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
-
- # This library was specified with -dlpreopen.
- if test "$pass" = dlpreopen; then
- if test -z "$libdir"; then
- $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
- # Prefer using a static library (so that no silly _DYNAMIC symbols
- # are required to link).
- if test -n "$old_library"; then
- newdlprefiles="$newdlprefiles $dir/$old_library"
- # Otherwise, use the dlname, so that lt_dlopen finds it.
- elif test -n "$dlname"; then
- newdlprefiles="$newdlprefiles $dir/$dlname"
- else
- newdlprefiles="$newdlprefiles $dir/$linklib"
- fi
- fi # $pass = dlpreopen
-
- if test -z "$libdir"; then
- # Link the convenience library
- if test "$linkmode" = lib; then
- deplibs="$dir/$old_library $deplibs"
- elif test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$dir/$old_library $compile_deplibs"
- finalize_deplibs="$dir/$old_library $finalize_deplibs"
- else
- deplibs="$lib $deplibs" # used for prog,scan pass
- fi
- continue
- fi
-
-
- if test "$linkmode" = prog && test "$pass" != link; then
- newlib_search_path="$newlib_search_path $ladir"
- deplibs="$lib $deplibs"
-
- linkalldeplibs=no
- if test "$link_all_deplibs" != no || test -z "$library_names" ||
- test "$build_libtool_libs" = no; then
- linkalldeplibs=yes
- fi
-
- tmp_libs=
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
- esac
- # Need to link against all dependency_libs?
- if test "$linkalldeplibs" = yes; then
- deplibs="$deplib $deplibs"
- else
- # Need to hardcode shared library paths
- # or/and link against static libraries
- newdependency_libs="$deplib $newdependency_libs"
- fi
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done # for deplib
- continue
- fi # $linkmode = prog...
-
- if test "$linkmode,$pass" = "prog,link"; then
- if test -n "$library_names" &&
- { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
- # We need to hardcode the library path
- if test -n "$shlibpath_var"; then
- # Make sure the rpath contains only unique directories.
- case "$temp_rpath " in
- *" $dir "*) ;;
- *" $absdir "*) ;;
- *) temp_rpath="$temp_rpath $dir" ;;
- esac
- fi
-
- # Hardcode the library path.
- # Skip directories that are in the system default run-time
- # search path.
- case " $sys_lib_dlsearch_path " in
- *" $absdir "*) ;;
- *)
- case "$compile_rpath " in
- *" $absdir "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
- fi # $linkmode,$pass = prog,link...
-
- if test "$alldeplibs" = yes &&
- { test "$deplibs_check_method" = pass_all ||
- { test "$build_libtool_libs" = yes &&
- test -n "$library_names"; }; }; then
- # We only need to search for static libraries
- continue
- fi
- fi
-
- link_static=no # Whether the deplib will be linked statically
- if test -n "$library_names" &&
- { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
- if test "$installed" = no; then
- notinst_deplibs="$notinst_deplibs $lib"
- need_relink=yes
- fi
- # This is a shared library
-
- # Warn about portability, can't link against -module's on
- # some systems (darwin)
- if test "$shouldnotlink" = yes && test "$pass" = link ; then
- $echo
- if test "$linkmode" = prog; then
- $echo "*** Warning: Linking the executable $output against the loadable module"
- else
- $echo "*** Warning: Linking the shared library $output against the loadable module"
- fi
- $echo "*** $linklib is not portable!"
- fi
- if test "$linkmode" = lib &&
- test "$hardcode_into_libs" = yes; then
- # Hardcode the library path.
- # Skip directories that are in the system default run-time
- # search path.
- case " $sys_lib_dlsearch_path " in
- *" $absdir "*) ;;
- *)
- case "$compile_rpath " in
- *" $absdir "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
- fi
-
- if test -n "$old_archive_from_expsyms_cmds"; then
- # figure out the soname
- set dummy $library_names
- realname="$2"
- shift; shift
- libname=`eval \\$echo \"$libname_spec\"`
- # use dlname if we got it. it's perfectly good, no?
- if test -n "$dlname"; then
- soname="$dlname"
- elif test -n "$soname_spec"; then
- # bleh windows
- case $host in
- *cygwin* | mingw*)
- major=`expr $current - $age`
- versuffix="-$major"
- ;;
- esac
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
-
- # Make a new name for the extract_expsyms_cmds to use
- soroot="$soname"
- soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
- newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
-
- # If the library has no export list, then create one now
- if test -f "$output_objdir/$soname-def"; then :
- else
- $show "extracting exported symbol list from \`$soname'"
- save_ifs="$IFS"; IFS='~'
- cmds=$extract_expsyms_cmds
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Create $newlib
- if test -f "$output_objdir/$newlib"; then :; else
- $show "generating import library for \`$soname'"
- save_ifs="$IFS"; IFS='~'
- cmds=$old_archive_from_expsyms_cmds
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
- # make sure the library variables are pointing to the new library
- dir=$output_objdir
- linklib=$newlib
- fi # test -n "$old_archive_from_expsyms_cmds"
-
- if test "$linkmode" = prog || test "$mode" != relink; then
- add_shlibpath=
- add_dir=
- add=
- lib_linked=yes
- case $hardcode_action in
- immediate | unsupported)
- if test "$hardcode_direct" = no; then
- add="$dir/$linklib"
- case $host in
- *-*-sco3.2v5* ) add_dir="-L$dir" ;;
- *-*-darwin* )
- # if the lib is a module then we can not link against
- # it, someone is ignoring the new warnings I added
- if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
- $echo "** Warning, lib $linklib is a module, not a shared library"
- if test -z "$old_library" ; then
- $echo
- $echo "** And there doesn't seem to be a static archive available"
- $echo "** The link will probably fail, sorry"
- else
- add="$dir/$old_library"
- fi
- fi
- esac
- elif test "$hardcode_minus_L" = no; then
- case $host in
- *-*-sunos*) add_shlibpath="$dir" ;;
- esac
- add_dir="-L$dir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = no; then
- add_shlibpath="$dir"
- add="-l$name"
- else
- lib_linked=no
- fi
- ;;
- relink)
- if test "$hardcode_direct" = yes; then
- add="$dir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$dir"
- # Try looking first in the location we're being installed to.
- if test -n "$inst_prefix_dir"; then
- case "$libdir" in
- [\\/]*)
- add_dir="$add_dir -L$inst_prefix_dir$libdir"
- ;;
- esac
- fi
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- add_shlibpath="$dir"
- add="-l$name"
- else
- lib_linked=no
- fi
- ;;
- *) lib_linked=no ;;
- esac
-
- if test "$lib_linked" != yes; then
- $echo "$modename: configuration error: unsupported hardcode properties"
- exit $EXIT_FAILURE
- fi
-
- if test -n "$add_shlibpath"; then
- case :$compile_shlibpath: in
- *":$add_shlibpath:"*) ;;
- *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
- esac
- fi
- if test "$linkmode" = prog; then
- test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
- test -n "$add" && compile_deplibs="$add $compile_deplibs"
- else
- test -n "$add_dir" && deplibs="$add_dir $deplibs"
- test -n "$add" && deplibs="$add $deplibs"
- if test "$hardcode_direct" != yes && \
- test "$hardcode_minus_L" != yes && \
- test "$hardcode_shlibpath_var" = yes; then
- case :$finalize_shlibpath: in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- fi
- fi
- fi
-
- if test "$linkmode" = prog || test "$mode" = relink; then
- add_shlibpath=
- add_dir=
- add=
- # Finalize command for both is simple: just hardcode it.
- if test "$hardcode_direct" = yes; then
- add="$libdir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$libdir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- case :$finalize_shlibpath: in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- add="-l$name"
- elif test "$hardcode_automatic" = yes; then
- if test -n "$inst_prefix_dir" &&
- test -f "$inst_prefix_dir$libdir/$linklib" ; then
- add="$inst_prefix_dir$libdir/$linklib"
- else
- add="$libdir/$linklib"
- fi
- else
- # We cannot seem to hardcode it, guess we'll fake it.
- add_dir="-L$libdir"
- # Try looking first in the location we're being installed to.
- if test -n "$inst_prefix_dir"; then
- case "$libdir" in
- [\\/]*)
- add_dir="$add_dir -L$inst_prefix_dir$libdir"
- ;;
- esac
- fi
- add="-l$name"
- fi
-
- if test "$linkmode" = prog; then
- test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
- test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
- else
- test -n "$add_dir" && deplibs="$add_dir $deplibs"
- test -n "$add" && deplibs="$add $deplibs"
- fi
- fi
- elif test "$linkmode" = prog; then
- # Here we assume that one of hardcode_direct or hardcode_minus_L
- # is not unsupported. This is valid on all known static and
- # shared platforms.
- if test "$hardcode_direct" != unsupported; then
- test -n "$old_library" && linklib="$old_library"
- compile_deplibs="$dir/$linklib $compile_deplibs"
- finalize_deplibs="$dir/$linklib $finalize_deplibs"
- else
- compile_deplibs="-l$name -L$dir $compile_deplibs"
- finalize_deplibs="-l$name -L$dir $finalize_deplibs"
- fi
- elif test "$build_libtool_libs" = yes; then
- # Not a shared library
- if test "$deplibs_check_method" != pass_all; then
- # We're trying link a shared library against a static one
- # but the system doesn't support it.
-
- # Just print a warning and add the library to dependency_libs so
- # that the program can be linked against the static library.
- $echo
- $echo "*** Warning: This system can not link to static lib archive $lib."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have."
- if test "$module" = yes; then
- $echo "*** But as you try to build a module library, libtool will still create "
- $echo "*** a static module, that should work as long as the dlopening application"
- $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
- if test -z "$global_symbol_pipe"; then
- $echo
- $echo "*** However, this would only work if libtool was able to extract symbol"
- $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- $echo "*** not find such a program. So, this module is probably useless."
- $echo "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- fi
- else
- convenience="$convenience $dir/$old_library"
- old_convenience="$old_convenience $dir/$old_library"
- deplibs="$dir/$old_library $deplibs"
- link_static=yes
- fi
- fi # link shared/static library?
-
- if test "$linkmode" = lib; then
- if test -n "$dependency_libs" &&
- { test "$hardcode_into_libs" != yes ||
- test "$build_old_libs" = yes ||
- test "$link_static" = yes; }; then
- # Extract -R from dependency_libs
- temp_deplibs=
- for libdir in $dependency_libs; do
- case $libdir in
- -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
- case " $xrpath " in
- *" $temp_xrpath "*) ;;
- *) xrpath="$xrpath $temp_xrpath";;
- esac;;
- *) temp_deplibs="$temp_deplibs $libdir";;
- esac
- done
- dependency_libs="$temp_deplibs"
- fi
-
- newlib_search_path="$newlib_search_path $absdir"
- # Link against this library
- test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
- # ... and its dependency_libs
- tmp_libs=
- for deplib in $dependency_libs; do
- newdependency_libs="$deplib $newdependency_libs"
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
-
- if test "$link_all_deplibs" != no; then
- # Add the search paths of all dependency libraries
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) path="$deplib" ;;
- *.la)
- dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$deplib" && dir="."
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
- absdir="$dir"
- fi
- ;;
- esac
- if grep "^installed=no" $deplib > /dev/null; then
- path="$absdir/$objdir"
- else
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- if test -z "$libdir"; then
- $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
- if test "$absdir" != "$libdir"; then
- $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
- fi
- path="$absdir"
- fi
- depdepl=
- case $host in
- *-*-darwin*)
- # we do not want to link against static libs,
- # but need to link against shared
- eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
- if test -n "$deplibrary_names" ; then
- for tmp in $deplibrary_names ; do
- depdepl=$tmp
- done
- if test -f "$path/$depdepl" ; then
- depdepl="$path/$depdepl"
- fi
- # do not add paths which are already there
- case " $newlib_search_path " in
- *" $path "*) ;;
- *) newlib_search_path="$newlib_search_path $path";;
- esac
- fi
- path=""
- ;;
- *)
- path="-L$path"
- ;;
- esac
- ;;
- -l*)
- case $host in
- *-*-darwin*)
- # Again, we only want to link against shared libraries
- eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
- for tmp in $newlib_search_path ; do
- if test -f "$tmp/lib$tmp_libs.dylib" ; then
- eval depdepl="$tmp/lib$tmp_libs.dylib"
- break
- fi
- done
- path=""
- ;;
- *) continue ;;
- esac
- ;;
- *) continue ;;
- esac
- case " $deplibs " in
- *" $depdepl "*) ;;
- *) deplibs="$depdepl $deplibs" ;;
- esac
- case " $deplibs " in
- *" $path "*) ;;
- *) deplibs="$deplibs $path" ;;
- esac
- done
- fi # link_all_deplibs != no
- fi # linkmode = lib
- done # for deplib in $libs
- dependency_libs="$newdependency_libs"
- if test "$pass" = dlpreopen; then
- # Link the dlpreopened libraries before other libraries
- for deplib in $save_deplibs; do
- deplibs="$deplib $deplibs"
- done
- fi
- if test "$pass" != dlopen; then
- if test "$pass" != conv; then
- # Make sure lib_search_path contains only unique directories.
- lib_search_path=
- for dir in $newlib_search_path; do
- case "$lib_search_path " in
- *" $dir "*) ;;
- *) lib_search_path="$lib_search_path $dir" ;;
- esac
- done
- newlib_search_path=
- fi
-
- if test "$linkmode,$pass" != "prog,link"; then
- vars="deplibs"
- else
- vars="compile_deplibs finalize_deplibs"
- fi
- for var in $vars dependency_libs; do
- # Add libraries to $var in reverse order
- eval tmp_libs=\"\$$var\"
- new_libs=
- for deplib in $tmp_libs; do
- # FIXME: Pedantically, this is the right thing to do, so
- # that some nasty dependency loop isn't accidentally
- # broken:
- #new_libs="$deplib $new_libs"
- # Pragmatically, this seems to cause very few problems in
- # practice:
- case $deplib in
- -L*) new_libs="$deplib $new_libs" ;;
- -R*) ;;
- *)
- # And here is the reason: when a library appears more
- # than once as an explicit dependence of a library, or
- # is implicitly linked in more than once by the
- # compiler, it is considered special, and multiple
- # occurrences thereof are not removed. Compare this
- # with having the same library being listed as a
- # dependency of multiple other libraries: in this case,
- # we know (pedantically, we assume) the library does not
- # need to be listed more than once, so we keep only the
- # last copy. This is not always right, but it is rare
- # enough that we require users that really mean to play
- # such unportable linking tricks to link the library
- # using -Wl,-lname, so that libtool does not consider it
- # for duplicate removal.
- case " $specialdeplibs " in
- *" $deplib "*) new_libs="$deplib $new_libs" ;;
- *)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$deplib $new_libs" ;;
- esac
- ;;
- esac
- ;;
- esac
- done
- tmp_libs=
- for deplib in $new_libs; do
- case $deplib in
- -L*)
- case " $tmp_libs " in
- *" $deplib "*) ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- done
- eval $var=\"$tmp_libs\"
- done # for var
- fi
- # Last step: remove runtime libs from dependency_libs
- # (they stay in deplibs)
- tmp_libs=
- for i in $dependency_libs ; do
- case " $predeps $postdeps $compiler_lib_search_path " in
- *" $i "*)
- i=""
- ;;
- esac
- if test -n "$i" ; then
- tmp_libs="$tmp_libs $i"
- fi
- done
- dependency_libs=$tmp_libs
- done # for pass
- if test "$linkmode" = prog; then
- dlfiles="$newdlfiles"
- dlprefiles="$newdlprefiles"
- fi
-
- case $linkmode in
- oldlib)
- if test -n "$deplibs"; then
- $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
- fi
-
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
- fi
-
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
- fi
-
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
- fi
-
- if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
- fi
-
- # Now set the variables for building old libraries.
- build_libtool_libs=no
- oldlibs="$output"
- objs="$objs$old_deplibs"
- ;;
-
- lib)
- # Make sure we only generate libraries of the form `libNAME.la'.
- case $outputname in
- lib*)
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
- eval shared_ext=\"$shrext_cmds\"
- eval libname=\"$libname_spec\"
- ;;
- *)
- if test "$module" = no; then
- $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
- if test "$need_lib_prefix" != no; then
- # Add the "lib" prefix for modules if required
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
- eval shared_ext=\"$shrext_cmds\"
- eval libname=\"$libname_spec\"
- else
- libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
- fi
- ;;
- esac
-
- if test -n "$objs"; then
- if test "$deplibs_check_method" != pass_all; then
- $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
- exit $EXIT_FAILURE
- else
- $echo
- $echo "*** Warning: Linking the shared library $output against the non-libtool"
- $echo "*** objects $objs is not portable!"
- libobjs="$libobjs $objs"
- fi
- fi
-
- if test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
- fi
-
- set dummy $rpath
- if test "$#" -gt 2; then
- $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
- fi
- install_libdir="$2"
-
- oldlibs=
- if test -z "$rpath"; then
- if test "$build_libtool_libs" = yes; then
- # Building a libtool convenience library.
- # Some compilers have problems with a `.al' extension so
- # convenience libraries should have the same extension an
- # archive normally would.
- oldlibs="$output_objdir/$libname.$libext $oldlibs"
- build_libtool_libs=convenience
- build_old_libs=yes
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
- fi
- else
-
- # Parse the version information argument.
- save_ifs="$IFS"; IFS=':'
- set dummy $vinfo 0 0 0
- IFS="$save_ifs"
-
- if test -n "$8"; then
- $echo "$modename: too many parameters to \`-version-info'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # convert absolute version numbers to libtool ages
- # this retains compatibility with .la files and attempts
- # to make the code below a bit more comprehensible
-
- case $vinfo_number in
- yes)
- number_major="$2"
- number_minor="$3"
- number_revision="$4"
- #
- # There are really only two kinds -- those that
- # use the current revision as the major version
- # and those that subtract age and use age as
- # a minor version. But, then there is irix
- # which has an extra 1 added just for fun
- #
- case $version_type in
- darwin|linux|osf|windows)
- current=`expr $number_major + $number_minor`
- age="$number_minor"
- revision="$number_revision"
- ;;
- freebsd-aout|freebsd-elf|sunos)
- current="$number_major"
- revision="$number_minor"
- age="0"
- ;;
- irix|nonstopux)
- current=`expr $number_major + $number_minor - 1`
- age="$number_minor"
- revision="$number_minor"
- ;;
- esac
- ;;
- no)
- current="$2"
- revision="$3"
- age="$4"
- ;;
- esac
-
- # Check that each of the things are valid numbers.
- case $current in
- [0-9]*) ;;
- *)
- $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- case $revision in
- [0-9]*) ;;
- *)
- $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- case $age in
- [0-9]*) ;;
- *)
- $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- if test "$age" -gt "$current"; then
- $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Calculate the version variables.
- major=
- versuffix=
- verstring=
- case $version_type in
- none) ;;
-
- darwin)
- # Like Linux, but with the current version available in
- # verstring for coding it into the library header
- major=.`expr $current - $age`
- versuffix="$major.$age.$revision"
- # Darwin ld doesn't like 0 for these options...
- minor_current=`expr $current + 1`
- verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
- ;;
-
- freebsd-aout)
- major=".$current"
- versuffix=".$current.$revision";
- ;;
-
- freebsd-elf)
- major=".$current"
- versuffix=".$current";
- ;;
-
- irix | nonstopux)
- major=`expr $current - $age + 1`
-
- case $version_type in
- nonstopux) verstring_prefix=nonstopux ;;
- *) verstring_prefix=sgi ;;
- esac
- verstring="$verstring_prefix$major.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$revision
- while test "$loop" -ne 0; do
- iface=`expr $revision - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring_prefix$major.$iface:$verstring"
- done
-
- # Before this point, $major must not contain `.'.
- major=.$major
- versuffix="$major.$revision"
- ;;
-
- linux)
- major=.`expr $current - $age`
- versuffix="$major.$age.$revision"
- ;;
-
- osf)
- major=.`expr $current - $age`
- versuffix=".$current.$age.$revision"
- verstring="$current.$age.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$age
- while test "$loop" -ne 0; do
- iface=`expr $current - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring:${iface}.0"
- done
-
- # Make executables depend on our current version.
- verstring="$verstring:${current}.0"
- ;;
-
- sunos)
- major=".$current"
- versuffix=".$current.$revision"
- ;;
-
- windows)
- # Use '-' rather than '.', since we only want one
- # extension on DOS 8.3 filesystems.
- major=`expr $current - $age`
- versuffix="-$major"
- ;;
-
- *)
- $echo "$modename: unknown library version type \`$version_type'" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- # Clear the version info if we defaulted, and they specified a release.
- if test -z "$vinfo" && test -n "$release"; then
- major=
- case $version_type in
- darwin)
- # we can't check for "0.0" in archive_cmds due to quoting
- # problems, so we reset it completely
- verstring=
- ;;
- *)
- verstring="0.0"
- ;;
- esac
- if test "$need_version" = no; then
- versuffix=
- else
- versuffix=".0.0"
- fi
- fi
-
- # Remove version info from name if versioning should be avoided
- if test "$avoid_version" = yes && test "$need_version" = no; then
- major=
- versuffix=
- verstring=""
- fi
-
- # Check to see if the archive will have undefined symbols.
- if test "$allow_undefined" = yes; then
- if test "$allow_undefined_flag" = unsupported; then
- $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
- build_libtool_libs=no
- build_old_libs=yes
- fi
- else
- # Don't allow undefined symbols.
- allow_undefined_flag="$no_undefined_flag"
- fi
- fi
-
- if test "$mode" != relink; then
- # Remove our outputs, but don't remove object files since they
- # may have been created when compiling PIC objects.
- removelist=
- tempremovelist=`$echo "$output_objdir/*"`
- for p in $tempremovelist; do
- case $p in
- *.$objext)
- ;;
- $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
- if test "X$precious_files_regex" != "X"; then
- if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
- then
- continue
- fi
- fi
- removelist="$removelist $p"
- ;;
- *) ;;
- esac
- done
- if test -n "$removelist"; then
- $show "${rm}r $removelist"
- $run ${rm}r $removelist
- fi
- fi
-
- # Now set the variables for building old libraries.
- if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
- oldlibs="$oldlibs $output_objdir/$libname.$libext"
-
- # Transform .lo files to .o files.
- oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
- fi
-
- # Eliminate all temporary directories.
- for path in $notinst_path; do
- lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
- deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
- dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
- done
-
- if test -n "$xrpath"; then
- # If the user specified any rpath flags, then add them.
- temp_xrpath=
- for libdir in $xrpath; do
- temp_xrpath="$temp_xrpath -R$libdir"
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
- dependency_libs="$temp_xrpath $dependency_libs"
- fi
- fi
-
- # Make sure dlfiles contains only unique files that won't be dlpreopened
- old_dlfiles="$dlfiles"
- dlfiles=
- for lib in $old_dlfiles; do
- case " $dlprefiles $dlfiles " in
- *" $lib "*) ;;
- *) dlfiles="$dlfiles $lib" ;;
- esac
- done
-
- # Make sure dlprefiles contains only unique files
- old_dlprefiles="$dlprefiles"
- dlprefiles=
- for lib in $old_dlprefiles; do
- case "$dlprefiles " in
- *" $lib "*) ;;
- *) dlprefiles="$dlprefiles $lib" ;;
- esac
- done
-
- if test "$build_libtool_libs" = yes; then
- if test -n "$rpath"; then
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
- # these systems don't actually have a c library (as such)!
- ;;
- *-*-rhapsody* | *-*-darwin1.[012])
- # Rhapsody C library is in the System framework
- deplibs="$deplibs -framework System"
- ;;
- *-*-netbsd*)
- # Don't link with libc until the a.out ld.so is fixed.
- ;;
- *-*-openbsd* | *-*-freebsd*)
- # Do not include libc due to us having libc/libc_r.
- test "X$arg" = "X-lc" && continue
- ;;
- *)
- # Add libc to deplibs on all other systems if necessary.
- if test "$build_libtool_need_lc" = "yes"; then
- deplibs="$deplibs -lc"
- fi
- ;;
- esac
- fi
-
- # Transform deplibs into only deplibs that can be linked in shared.
- name_save=$name
- libname_save=$libname
- release_save=$release
- versuffix_save=$versuffix
- major_save=$major
- # I'm not sure if I'm treating the release correctly. I think
- # release should show up in the -l (ie -lgmp5) so we don't want to
- # add it in twice. Is that correct?
- release=""
- versuffix=""
- major=""
- newdeplibs=
- droppeddeps=no
- case $deplibs_check_method in
- pass_all)
- # Don't check for shared/static. Everything works.
- # This might be a little naive. We might want to check
- # whether the library exists or not. But this is on
- # osf3 & osf4 and I'm not really sure... Just
- # implementing what was already the behavior.
- newdeplibs=$deplibs
- ;;
- test_compile)
- # This code stresses the "libraries are programs" paradigm to its
- # limits. Maybe even breaks it. We compile a program, linking it
- # against the deplibs as a proxy for the library. Then we can check
- # whether they linked in statically or dynamically with ldd.
- $rm conftest.c
- cat > conftest.c <<EOF
- int main() { return 0; }
-EOF
- $rm conftest
- $LTCC -o conftest conftest.c $deplibs
- if test "$?" -eq 0 ; then
- ldd_output=`ldd conftest`
- for i in $deplibs; do
- name="`expr $i : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test "$name" != "" && test "$name" -ne "0"; then
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $i "*)
- newdeplibs="$newdeplibs $i"
- i=""
- ;;
- esac
- fi
- if test -n "$i" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- deplib_matches=`eval \\$echo \"$library_names_spec\"`
- set dummy $deplib_matches
- deplib_match=$2
- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- newdeplibs="$newdeplibs $i"
- else
- droppeddeps=yes
- $echo
- $echo "*** Warning: dynamic linker does not accept needed library $i."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which I believe you do not have"
- $echo "*** because a test_compile did reveal that the linker did not use it for"
- $echo "*** its dynamic dependency list that programs get resolved with at runtime."
- fi
- fi
- else
- newdeplibs="$newdeplibs $i"
- fi
- done
- else
- # Error occurred in the first compile. Let's try to salvage
- # the situation: Compile a separate program for each library.
- for i in $deplibs; do
- name="`expr $i : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test "$name" != "" && test "$name" != "0"; then
- $rm conftest
- $LTCC -o conftest conftest.c $i
- # Did it work?
- if test "$?" -eq 0 ; then
- ldd_output=`ldd conftest`
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $i "*)
- newdeplibs="$newdeplibs $i"
- i=""
- ;;
- esac
- fi
- if test -n "$i" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- deplib_matches=`eval \\$echo \"$library_names_spec\"`
- set dummy $deplib_matches
- deplib_match=$2
- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- newdeplibs="$newdeplibs $i"
- else
- droppeddeps=yes
- $echo
- $echo "*** Warning: dynamic linker does not accept needed library $i."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have"
- $echo "*** because a test_compile did reveal that the linker did not use this one"
- $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
- fi
- fi
- else
- droppeddeps=yes
- $echo
- $echo "*** Warning! Library $i is needed by this library but I was not able to"
- $echo "*** make it link in! You will probably need to install it or some"
- $echo "*** library that it depends on before this library will be fully"
- $echo "*** functional. Installing it before continuing would be even better."
- fi
- else
- newdeplibs="$newdeplibs $i"
- fi
- done
- fi
- ;;
- file_magic*)
- set dummy $deplibs_check_method
- file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- for a_deplib in $deplibs; do
- name="`expr $a_deplib : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test "$name" != "" && test "$name" != "0"; then
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $a_deplib "*)
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- ;;
- esac
- fi
- if test -n "$a_deplib" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
- for potent_lib in $potential_libs; do
- # Follow soft links.
- if ls -lLd "$potent_lib" 2>/dev/null \
- | grep " -> " >/dev/null; then
- continue
- fi
- # The statement above tries to avoid entering an
- # endless loop below, in case of cyclic links.
- # We might still enter an endless loop, since a link
- # loop can be closed while we follow links,
- # but so what?
- potlib="$potent_lib"
- while test -h "$potlib" 2>/dev/null; do
- potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
- case $potliblink in
- [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
- *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
- esac
- done
- if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
- | ${SED} 10q \
- | $EGREP "$file_magic_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- fi
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- $echo
- $echo "*** Warning: linker path does not have real file for library $a_deplib."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have"
- $echo "*** because I did check the linker path looking for a file starting"
- if test -z "$potlib" ; then
- $echo "*** with $libname but no candidates were found. (...for file magic test)"
- else
- $echo "*** with $libname and none of the candidates passed a file format test"
- $echo "*** using a file magic. Last file checked: $potlib"
- fi
- fi
- else
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- fi
- done # Gone through all deplibs.
- ;;
- match_pattern*)
- set dummy $deplibs_check_method
- match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- for a_deplib in $deplibs; do
- name="`expr $a_deplib : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test -n "$name" && test "$name" != "0"; then
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $a_deplib "*)
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- ;;
- esac
- fi
- if test -n "$a_deplib" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
- for potent_lib in $potential_libs; do
- potlib="$potent_lib" # see symlink-check above in file_magic test
- if eval $echo \"$potent_lib\" 2>/dev/null \
- | ${SED} 10q \
- | $EGREP "$match_pattern_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- fi
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- $echo
- $echo "*** Warning: linker path does not have real file for library $a_deplib."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have"
- $echo "*** because I did check the linker path looking for a file starting"
- if test -z "$potlib" ; then
- $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
- else
- $echo "*** with $libname and none of the candidates passed a file format test"
- $echo "*** using a regex pattern. Last file checked: $potlib"
- fi
- fi
- else
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- fi
- done # Gone through all deplibs.
- ;;
- none | unknown | *)
- newdeplibs=""
- tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
- -e 's/ -[LR][^ ]*//g'`
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- for i in $predeps $postdeps ; do
- # can't use Xsed below, because $i might contain '/'
- tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
- done
- fi
- if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
- | grep . >/dev/null; then
- $echo
- if test "X$deplibs_check_method" = "Xnone"; then
- $echo "*** Warning: inter-library dependencies are not supported in this platform."
- else
- $echo "*** Warning: inter-library dependencies are not known to be supported."
- fi
- $echo "*** All declared inter-library dependencies are being dropped."
- droppeddeps=yes
- fi
- ;;
- esac
- versuffix=$versuffix_save
- major=$major_save
- release=$release_save
- libname=$libname_save
- name=$name_save
-
- case $host in
- *-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library is the System framework
- newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
- ;;
- esac
-
- if test "$droppeddeps" = yes; then
- if test "$module" = yes; then
- $echo
- $echo "*** Warning: libtool could not satisfy all declared inter-library"
- $echo "*** dependencies of module $libname. Therefore, libtool will create"
- $echo "*** a static module, that should work as long as the dlopening"
- $echo "*** application is linked with the -dlopen flag."
- if test -z "$global_symbol_pipe"; then
- $echo
- $echo "*** However, this would only work if libtool was able to extract symbol"
- $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- $echo "*** not find such a program. So, this module is probably useless."
- $echo "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- else
- $echo "*** The inter-library dependencies that have been dropped here will be"
- $echo "*** automatically added whenever a program is linked with this library"
- $echo "*** or is declared to -dlopen it."
-
- if test "$allow_undefined" = no; then
- $echo
- $echo "*** Since this library must not contain undefined symbols,"
- $echo "*** because either the platform does not support them or"
- $echo "*** it was explicitly requested with -no-undefined,"
- $echo "*** libtool will only create a static version of it."
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- fi
- fi
- fi
- # Done checking deplibs!
- deplibs=$newdeplibs
- fi
-
- # All the library-specific variables (install_libdir is set above).
- library_names=
- old_library=
- dlname=
-
- # Test again, we may have decided not to build it any more
- if test "$build_libtool_libs" = yes; then
- if test "$hardcode_into_libs" = yes; then
- # Hardcode the library paths
- hardcode_libdirs=
- dep_rpath=
- rpath="$finalize_rpath"
- test "$mode" != relink && rpath="$compile_rpath$rpath"
- for libdir in $rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- dep_rpath="$dep_rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- if test -n "$hardcode_libdir_flag_spec_ld"; then
- eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
- else
- eval dep_rpath=\"$hardcode_libdir_flag_spec\"
- fi
- fi
- if test -n "$runpath_var" && test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
- fi
- test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
- fi
-
- shlibpath="$finalize_shlibpath"
- test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
- if test -n "$shlibpath"; then
- eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
- fi
-
- # Get the real and link names of the library.
- eval shared_ext=\"$shrext_cmds\"
- eval library_names=\"$library_names_spec\"
- set dummy $library_names
- realname="$2"
- shift; shift
-
- if test -n "$soname_spec"; then
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
- if test -z "$dlname"; then
- dlname=$soname
- fi
-
- lib="$output_objdir/$realname"
- for link
- do
- linknames="$linknames $link"
- done
-
- # Use standard objects if they are pic
- test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
- $show "generating symbol list for \`$libname.la'"
- export_symbols="$output_objdir/$libname.exp"
- $run $rm $export_symbols
- cmds=$export_symbols_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- if len=`expr "X$cmd" : ".*"` &&
- test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- $show "$cmd"
- $run eval "$cmd" || exit $?
- skipped_export=false
- else
- # The command line is too long to execute in one step.
- $show "using reloadable object file for export list..."
- skipped_export=:
- fi
- done
- IFS="$save_ifs"
- if test -n "$export_symbols_regex"; then
- $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
- $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
- $show "$mv \"${export_symbols}T\" \"$export_symbols\""
- $run eval '$mv "${export_symbols}T" "$export_symbols"'
- fi
- fi
- fi
-
- if test -n "$export_symbols" && test -n "$include_expsyms"; then
- $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
- fi
-
- tmp_deplibs=
- inst_prefix_arg=
- for test_deplib in $deplibs; do
- case " $convenience " in
- *" $test_deplib "*) ;;
- *)
- if test -n "$inst_prefix_dir" && (echo "$test_deplib" | grep -- "$inst_prefix_dir" >/dev/null); then
- inst_prefix_arg="$test_deplib"
- else
- tmp_deplibs="$tmp_deplibs $test_deplib"
- fi
- ;;
- esac
- done
- deplibs="$tmp_deplibs"
- if test -n "$inst_prefix_arg"; then
- deplibs="$inst_prefix_arg $deplibs"
- fi
-
- if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec"; then
- save_libobjs=$libobjs
- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- else
- gentop="$output_objdir/${outputname}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- status=$?
- if test "$status" -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
- generated="$generated $gentop"
-
- for xlib in $convenience; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "$mkdir $xdir"
- $run $mkdir "$xdir"
- status=$?
- if test "$status" -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- # We will extract separately just the conflicting names and we will no
- # longer touch any unique names. It is faster to leave these extract
- # automatically by $AR in one run.
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
- if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
- do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
- do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
- done
- $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
- done
- done
- fi
-
- libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
- done
- fi
- fi
-
- if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
- eval flag=\"$thread_safe_flag_spec\"
- linker_flags="$linker_flags $flag"
- fi
-
- # Make a backup of the uninstalled library when relinking
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
- fi
-
- # Do each of the archive commands.
- if test "$module" = yes && test -n "$module_cmds" ; then
- if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
- eval test_cmds=\"$module_expsym_cmds\"
- cmds=$module_expsym_cmds
- else
- eval test_cmds=\"$module_cmds\"
- cmds=$module_cmds
- fi
- else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval test_cmds=\"$archive_expsym_cmds\"
- cmds=$archive_expsym_cmds
- else
- eval test_cmds=\"$archive_cmds\"
- cmds=$archive_cmds
- fi
- fi
-
- if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
- test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- :
- else
- # The command line is too long to link in one step, link piecewise.
- $echo "creating reloadable object files..."
-
- # Save the value of $output and $libobjs because we want to
- # use them later. If we have whole_archive_flag_spec, we
- # want to use save_libobjs as it was before
- # whole_archive_flag_spec was expanded, because we can't
- # assume the linker understands whole_archive_flag_spec.
- # This may have to be revisited, in case too many
- # convenience libraries get linked in and end up exceeding
- # the spec.
- if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
- save_libobjs=$libobjs
- fi
- save_output=$output
-
- # Clear the reloadable object creation command queue and
- # initialize k to one.
- test_cmds=
- concat_cmds=
- objlist=
- delfiles=
- last_robj=
- k=1
- output=$output_objdir/$save_output-${k}.$objext
- # Loop over the list of objects to be linked.
- for obj in $save_libobjs
- do
- eval test_cmds=\"$reload_cmds $objlist $last_robj\"
- if test "X$objlist" = X ||
- { len=`expr "X$test_cmds" : ".*"` &&
- test "$len" -le "$max_cmd_len"; }; then
- objlist="$objlist $obj"
- else
- # The command $test_cmds is almost too long, add a
- # command to the queue.
- if test "$k" -eq 1 ; then
- # The first file doesn't have a previous command to add.
- eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
- else
- # All subsequent reloadable object files will link in
- # the last one created.
- eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
- fi
- last_robj=$output_objdir/$save_output-${k}.$objext
- k=`expr $k + 1`
- output=$output_objdir/$save_output-${k}.$objext
- objlist=$obj
- len=1
- fi
- done
- # Handle the remaining objects by creating one last
- # reloadable object file. All subsequent reloadable object
- # files will link in the last one created.
- test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
-
- if ${skipped_export-false}; then
- $show "generating symbol list for \`$libname.la'"
- export_symbols="$output_objdir/$libname.exp"
- $run $rm $export_symbols
- libobjs=$output
- # Append the command to create the export file.
- eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
- fi
-
- # Set up a command to remove the reloadale object files
- # after they are used.
- i=0
- while test "$i" -lt "$k"
- do
- i=`expr $i + 1`
- delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
- done
-
- $echo "creating a temporary reloadable object file: $output"
-
- # Loop through the commands generated above and execute them.
- save_ifs="$IFS"; IFS='~'
- for cmd in $concat_cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- libobjs=$output
- # Restore the value of output.
- output=$save_output
-
- if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- fi
- # Expand the library linking commands again to reset the
- # value of $libobjs for piecewise linking.
-
- # Do each of the archive commands.
- if test "$module" = yes && test -n "$module_cmds" ; then
- if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
- cmds=$module_expsym_cmds
- else
- cmds=$module_cmds
- fi
- else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- cmds=$archive_expsym_cmds
- else
- cmds=$archive_cmds
- fi
- fi
-
- # Append the command to remove the reloadable object files
- # to the just-reset $cmds.
- eval cmds=\"\$cmds~\$rm $delfiles\"
- fi
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
- exit $EXIT_SUCCESS
- fi
-
- # Create links to the real library.
- for linkname in $linknames; do
- if test "$realname" != "$linkname"; then
- $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
- fi
- done
-
- # If -module or -export-dynamic was specified, set the dlname.
- if test "$module" = yes || test "$export_dynamic" = yes; then
- # On all known operating systems, these are identical.
- dlname="$soname"
- fi
- fi
- ;;
-
- obj)
- if test -n "$deplibs"; then
- $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
- fi
-
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
- fi
-
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
- fi
-
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
- fi
-
- case $output in
- *.lo)
- if test -n "$objs$old_deplibs"; then
- $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
- exit $EXIT_FAILURE
- fi
- libobj="$output"
- obj=`$echo "X$output" | $Xsed -e "$lo2o"`
- ;;
- *)
- libobj=
- obj="$output"
- ;;
- esac
-
- # Delete the old objects.
- $run $rm $obj $libobj
-
- # Objects from convenience libraries. This assumes
- # single-version convenience libraries. Whenever we create
- # different ones for PIC/non-PIC, this we'll have to duplicate
- # the extraction.
- reload_conv_objs=
- gentop=
- # reload_cmds runs $LD directly, so let us get rid of
- # -Wl from whole_archive_flag_spec
- wl=
-
- if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec"; then
- eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
- else
- gentop="$output_objdir/${obj}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- status=$?
- if test "$status" -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
- generated="$generated $gentop"
-
- for xlib in $convenience; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "$mkdir $xdir"
- $run $mkdir "$xdir"
- status=$?
- if test "$status" -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- # We will extract separately just the conflicting names and we will no
- # longer touch any unique names. It is faster to leave these extract
- # automatically by $AR in one run.
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
- if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
- do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
- do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
- done
- $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
- done
- done
- fi
-
- reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
- done
- fi
- fi
-
- # Create the old-style object.
- reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
-
- output="$obj"
- cmds=$reload_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Exit if we aren't doing a library object file.
- if test -z "$libobj"; then
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- exit $EXIT_SUCCESS
- fi
-
- if test "$build_libtool_libs" != yes; then
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- # Create an invalid libtool object if no PIC, so that we don't
- # accidentally link it into a program.
- # $show "echo timestamp > $libobj"
- # $run eval "echo timestamp > $libobj" || exit $?
- exit $EXIT_SUCCESS
- fi
-
- if test -n "$pic_flag" || test "$pic_mode" != default; then
- # Only do commands if we really have different PIC objects.
- reload_objs="$libobjs $reload_conv_objs"
- output="$libobj"
- cmds=$reload_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- exit $EXIT_SUCCESS
- ;;
-
- prog)
- case $host in
- *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
- esac
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
- fi
-
- if test "$preload" = yes; then
- if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
- test "$dlopen_self_static" = unknown; then
- $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
- fi
- fi
-
- case $host in
- *-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library is the System framework
- compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
- finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
- ;;
- esac
-
- case $host in
- *darwin*)
- # Don't allow lazy linking, it breaks C++ global constructors
- if test "$tagname" = CXX ; then
- compile_command="$compile_command ${wl}-bind_at_load"
- finalize_command="$finalize_command ${wl}-bind_at_load"
- fi
- ;;
- esac
-
- compile_command="$compile_command $compile_deplibs"
- finalize_command="$finalize_command $finalize_deplibs"
-
- if test -n "$rpath$xrpath"; then
- # If the user specified any rpath flags, then add them.
- for libdir in $rpath $xrpath; do
- # This is the magic to use -rpath.
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- fi
-
- # Now hardcode the library paths
- rpath=
- hardcode_libdirs=
- for libdir in $compile_rpath $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- case :$dllsearchpath: in
- *":$libdir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$libdir";;
- esac
- ;;
- esac
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- compile_rpath="$rpath"
-
- rpath=
- hardcode_libdirs=
- for libdir in $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$finalize_perm_rpath " in
- *" $libdir "*) ;;
- *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- finalize_rpath="$rpath"
-
- if test -n "$libobjs" && test "$build_old_libs" = yes; then
- # Transform all the library objects into standard objects.
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- fi
-
- dlsyms=
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- if test -n "$NM" && test -n "$global_symbol_pipe"; then
- dlsyms="${outputname}S.c"
- else
- $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
- fi
- fi
-
- if test -n "$dlsyms"; then
- case $dlsyms in
- "") ;;
- *.c)
- # Discover the nlist of each of the dlfiles.
- nlist="$output_objdir/${outputname}.nm"
-
- $show "$rm $nlist ${nlist}S ${nlist}T"
- $run $rm "$nlist" "${nlist}S" "${nlist}T"
-
- # Parse the name list into a source file.
- $show "creating $output_objdir/$dlsyms"
-
- test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
-/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
-/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-/* Prevent the only kind of declaration conflicts we can make. */
-#define lt_preloaded_symbols some_other_symbol
-
-/* External symbol declarations for the compiler. */\
-"
-
- if test "$dlself" = yes; then
- $show "generating symbol list for \`$output'"
-
- test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
-
- # Add our own program objects to the symbol list.
- progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- for arg in $progfiles; do
- $show "extracting global C symbols from \`$arg'"
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -n "$exclude_expsyms"; then
- $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
- $run eval '$mv "$nlist"T "$nlist"'
- fi
-
- if test -n "$export_symbols_regex"; then
- $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
- $run eval '$mv "$nlist"T "$nlist"'
- fi
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- export_symbols="$output_objdir/$output.exp"
- $run $rm $export_symbols
- $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
- else
- $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
- $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
- $run eval 'mv "$nlist"T "$nlist"'
- fi
- fi
-
- for arg in $dlprefiles; do
- $show "extracting global C symbols from \`$arg'"
- name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
- $run eval '$echo ": $name " >> "$nlist"'
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -z "$run"; then
- # Make sure we have at least an empty file.
- test -f "$nlist" || : > "$nlist"
-
- if test -n "$exclude_expsyms"; then
- $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
- $mv "$nlist"T "$nlist"
- fi
-
- # Try sorting and uniquifying the output.
- if grep -v "^: " < "$nlist" |
- if sort -k 3 </dev/null >/dev/null 2>&1; then
- sort -k 3
- else
- sort +2
- fi |
- uniq > "$nlist"S; then
- :
- else
- grep -v "^: " < "$nlist" > "$nlist"S
- fi
-
- if test -f "$nlist"S; then
- eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
- else
- $echo '/* NONE */' >> "$output_objdir/$dlsyms"
- fi
-
- $echo >> "$output_objdir/$dlsyms" "\
-
-#undef lt_preloaded_symbols
-
-#if defined (__STDC__) && __STDC__
-# define lt_ptr void *
-#else
-# define lt_ptr char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-const struct {
- const char *name;
- lt_ptr address;
-}
-lt_preloaded_symbols[] =
-{\
-"
-
- eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
-
- $echo >> "$output_objdir/$dlsyms" "\
- {0, (lt_ptr) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
- return lt_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
- fi
-
- pic_flag_for_symtable=
- case $host in
- # compiling the symbol table file with pic_flag works around
- # a FreeBSD bug that causes programs to crash when -lm is
- # linked before any other PIC object. But we must not use
- # pic_flag when linking with -static. The problem exists in
- # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
- *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
- case "$compile_command " in
- *" -static "*) ;;
- *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
- esac;;
- *-*-hpux*)
- case "$compile_command " in
- *" -static "*) ;;
- *) pic_flag_for_symtable=" $pic_flag";;
- esac
- esac
-
- # Now compile the dynamic symbol file.
- $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
- $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
-
- # Clean up the generated files.
- $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
- $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
-
- # Transform the symbol file into the correct name.
- compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
- ;;
- *)
- $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- else
- # We keep going just in case the user didn't refer to
- # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
- # really was required.
-
- # Nullify the symbol file.
- compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
- fi
-
- if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
- # Replace the output file specification.
- compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
- link_command="$compile_command$compile_rpath"
-
- # We have no uninstalled library dependencies, so finalize right now.
- $show "$link_command"
- $run eval "$link_command"
- status=$?
-
- # Delete the generated files.
- if test -n "$dlsyms"; then
- $show "$rm $output_objdir/${outputname}S.${objext}"
- $run $rm "$output_objdir/${outputname}S.${objext}"
- fi
-
- exit $status
- fi
-
- if test -n "$shlibpath_var"; then
- # We should set the shlibpath_var
- rpath=
- for dir in $temp_rpath; do
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*)
- # Absolute path.
- rpath="$rpath$dir:"
- ;;
- *)
- # Relative path: add a thisdir entry.
- rpath="$rpath\$thisdir/$dir:"
- ;;
- esac
- done
- temp_rpath="$rpath"
- fi
-
- if test -n "$compile_shlibpath$finalize_shlibpath"; then
- compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
- fi
- if test -n "$finalize_shlibpath"; then
- finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
- fi
-
- compile_var=
- finalize_var=
- if test -n "$runpath_var"; then
- if test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- if test -n "$finalize_perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $finalize_perm_rpath; do
- rpath="$rpath$dir:"
- done
- finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- fi
-
- if test "$no_install" = yes; then
- # We don't need to create a wrapper script.
- link_command="$compile_var$compile_command$compile_rpath"
- # Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
- # Delete the old output file.
- $run $rm $output
- # Link the executable and exit
- $show "$link_command"
- $run eval "$link_command" || exit $?
- exit $EXIT_SUCCESS
- fi
-
- if test "$hardcode_action" = relink; then
- # Fast installation is not supported
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
-
- $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
- $echo "$modename: \`$output' will be relinked during installation" 1>&2
- else
- if test "$fast_install" != no; then
- link_command="$finalize_var$compile_command$finalize_rpath"
- if test "$fast_install" = yes; then
- relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
- else
- # fast_install is set to needless
- relink_command=
- fi
- else
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
- fi
- fi
-
- # Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-
- # Delete the old output files.
- $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
-
- $show "$link_command"
- $run eval "$link_command" || exit $?
-
- # Now create the wrapper script.
- $show "creating $output"
-
- # Quote the relink command for shipping.
- if test -n "$relink_command"; then
- # Preserve any variables that may affect compiler behavior
- for var in $variables_saved_for_relink; do
- if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
- elif eval var_value=\$$var; test -z "$var_value"; then
- relink_command="$var=; export $var; $relink_command"
- else
- var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
- fi
- done
- relink_command="(cd `pwd`; $relink_command)"
- relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Quote $echo for shipping.
- if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
- case $progpath in
- [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
- *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
- esac
- qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
- else
- qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Only actually do things if our run command is non-null.
- if test -z "$run"; then
- # win32 will think the script is a binary if it has
- # a .exe suffix, so we strip it off here.
- case $output in
- *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
- esac
- # test for cygwin because mv fails w/o .exe extensions
- case $host in
- *cygwin*)
- exeext=.exe
- outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
- *) exeext= ;;
- esac
- case $host in
- *cygwin* | *mingw* )
- cwrappersource=`$echo ${objdir}/lt-${output}.c`
- cwrapper=`$echo ${output}.exe`
- $rm $cwrappersource $cwrapper
- trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
-
- cat > $cwrappersource <<EOF
-
-/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
- Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-
- The $output program cannot be directly executed until all the libtool
- libraries that it depends on are installed.
-
- This wrapper executable should never be moved out of the build directory.
- If it is, it will not operate correctly.
-
- Currently, it simply execs the wrapper *script* "/bin/sh $output",
- but could eventually absorb all of the scripts functionality and
- exec $objdir/$outputname directly.
-*/
-EOF
- cat >> $cwrappersource<<"EOF"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <malloc.h>
-#include <stdarg.h>
-#include <assert.h>
-
-#if defined(PATH_MAX)
-# define LT_PATHMAX PATH_MAX
-#elif defined(MAXPATHLEN)
-# define LT_PATHMAX MAXPATHLEN
-#else
-# define LT_PATHMAX 1024
-#endif
-
-#ifndef DIR_SEPARATOR
-#define DIR_SEPARATOR '/'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
- defined (__OS2__)
-#define HAVE_DOS_BASED_FILE_SYSTEM
-#ifndef DIR_SEPARATOR_2
-#define DIR_SEPARATOR_2 '\\'
-#endif
-#endif
-
-#ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-#else /* DIR_SEPARATOR_2 */
-# define IS_DIR_SEPARATOR(ch) \
- (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-#endif /* DIR_SEPARATOR_2 */
-
-#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
-#define XFREE(stale) do { \
- if (stale) { free ((void *) stale); stale = 0; } \
-} while (0)
-
-const char *program_name = NULL;
-
-void * xmalloc (size_t num);
-char * xstrdup (const char *string);
-char * basename (const char *name);
-char * fnqualify(const char *path);
-char * strendzap(char *str, const char *pat);
-void lt_fatal (const char *message, ...);
-
-int
-main (int argc, char *argv[])
-{
- char **newargz;
- int i;
-
- program_name = (char *) xstrdup ((char *) basename (argv[0]));
- newargz = XMALLOC(char *, argc+2);
-EOF
-
- cat >> $cwrappersource <<EOF
- newargz[0] = "$SHELL";
-EOF
-
- cat >> $cwrappersource <<"EOF"
- newargz[1] = fnqualify(argv[0]);
- /* we know the script has the same name, without the .exe */
- /* so make sure newargz[1] doesn't end in .exe */
- strendzap(newargz[1],".exe");
- for (i = 1; i < argc; i++)
- newargz[i+1] = xstrdup(argv[i]);
- newargz[argc+1] = NULL;
-EOF
-
- cat >> $cwrappersource <<EOF
- execv("$SHELL",newargz);
-EOF
-
- cat >> $cwrappersource <<"EOF"
-}
-
-void *
-xmalloc (size_t num)
-{
- void * p = (void *) malloc (num);
- if (!p)
- lt_fatal ("Memory exhausted");
-
- return p;
-}
-
-char *
-xstrdup (const char *string)
-{
- return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
-;
-}
-
-char *
-basename (const char *name)
-{
- const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- /* Skip over the disk name in MSDOS pathnames. */
- if (isalpha (name[0]) && name[1] == ':')
- name += 2;
-#endif
-
- for (base = name; *name; name++)
- if (IS_DIR_SEPARATOR (*name))
- base = name + 1;
- return (char *) base;
-}
-
-char *
-fnqualify(const char *path)
-{
- size_t size;
- char *p;
- char tmp[LT_PATHMAX + 1];
-
- assert(path != NULL);
-
- /* Is it qualified already? */
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- if (isalpha (path[0]) && path[1] == ':')
- return xstrdup (path);
-#endif
- if (IS_DIR_SEPARATOR (path[0]))
- return xstrdup (path);
-
- /* prepend the current directory */
- /* doesn't handle '~' */
- if (getcwd (tmp, LT_PATHMAX) == NULL)
- lt_fatal ("getcwd failed");
- size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
- p = XMALLOC(char, size);
- sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
- return p;
-}
-
-char *
-strendzap(char *str, const char *pat)
-{
- size_t len, patlen;
-
- assert(str != NULL);
- assert(pat != NULL);
-
- len = strlen(str);
- patlen = strlen(pat);
-
- if (patlen <= len)
- {
- str += len - patlen;
- if (strcmp(str, pat) == 0)
- *str = '\0';
- }
- return str;
-}
-
-static void
-lt_error_core (int exit_status, const char * mode,
- const char * message, va_list ap)
-{
- fprintf (stderr, "%s: %s: ", program_name, mode);
- vfprintf (stderr, message, ap);
- fprintf (stderr, ".\n");
-
- if (exit_status >= 0)
- exit (exit_status);
-}
-
-void
-lt_fatal (const char *message, ...)
-{
- va_list ap;
- va_start (ap, message);
- lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
- va_end (ap);
-}
-EOF
- # we should really use a build-platform specific compiler
- # here, but OTOH, the wrappers (shell script and this C one)
- # are only useful if you want to execute the "real" binary.
- # Since the "real" binary is built for $host, then this
- # wrapper might as well be built for $host, too.
- $run $LTCC -s -o $cwrapper $cwrappersource
- ;;
- esac
- $rm $output
- trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
-
- $echo > $output "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='${SED} -e 1s/^X//'
-sed_quote_subst='$sed_quote_subst'
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
- # install mode needs the following variable:
- notinst_deplibs='$notinst_deplibs'
-else
- # When we are sourced in execute mode, \$file and \$echo are already set.
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- echo=\"$qecho\"
- file=\"\$0\"
- # Make sure echo works.
- if test \"X\$1\" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
- elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
- # Yippee, \$echo works!
- :
- else
- # Restart under the correct shell, and then maybe \$echo will work.
- exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
- fi
- fi\
-"
- $echo >> $output "\
-
- # Find the directory that this script lives in.
- thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
- test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
- # Follow symbolic links until we get to the real thisdir.
- file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
- while test -n \"\$file\"; do
- destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
-
- # If there was a directory component, then change thisdir.
- if test \"x\$destdir\" != \"x\$file\"; then
- case \"\$destdir\" in
- [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
- *) thisdir=\"\$thisdir/\$destdir\" ;;
- esac
- fi
-
- file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
- file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
- done
-
- # Try to get the absolute directory name.
- absdir=\`cd \"\$thisdir\" && pwd\`
- test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
- if test "$fast_install" = yes; then
- $echo >> $output "\
- program=lt-'$outputname'$exeext
- progdir=\"\$thisdir/$objdir\"
-
- if test ! -f \"\$progdir/\$program\" || \\
- { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
- test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
- file=\"\$\$-\$program\"
-
- if test ! -d \"\$progdir\"; then
- $mkdir \"\$progdir\"
- else
- $rm \"\$progdir/\$file\"
- fi"
-
- $echo >> $output "\
-
- # relink executable if necessary
- if test -n \"\$relink_command\"; then
- if relink_command_output=\`eval \$relink_command 2>&1\`; then :
- else
- $echo \"\$relink_command_output\" >&2
- $rm \"\$progdir/\$file\"
- exit $EXIT_FAILURE
- fi
- fi
-
- $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
- { $rm \"\$progdir/\$program\";
- $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
- $rm \"\$progdir/\$file\"
- fi"
- else
- $echo >> $output "\
- program='$outputname'
- progdir=\"\$thisdir/$objdir\"
-"
- fi
-
- $echo >> $output "\
-
- if test -f \"\$progdir/\$program\"; then"
-
- # Export our shlibpath_var if we have one.
- if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- $echo >> $output "\
- # Add our own library path to $shlibpath_var
- $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
- # Some systems cannot cope with colon-terminated $shlibpath_var
- # The second colon is a workaround for a bug in BeOS R4 sed
- $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
- export $shlibpath_var
-"
- fi
-
- # fixup the dll searchpath if we need to.
- if test -n "$dllsearchpath"; then
- $echo >> $output "\
- # Add the dll search path components to the executable PATH
- PATH=$dllsearchpath:\$PATH
-"
- fi
-
- $echo >> $output "\
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- # Run the actual program with our arguments.
-"
- case $host in
- # Backslashes separate directories on plain windows
- *-*-mingw | *-*-os2*)
- $echo >> $output "\
- exec \$progdir\\\\\$program \${1+\"\$@\"}
-"
- ;;
-
- *)
- $echo >> $output "\
- exec \$progdir/\$program \${1+\"\$@\"}
-"
- ;;
- esac
- $echo >> $output "\
- \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
- exit $EXIT_FAILURE
- fi
- else
- # The program doesn't exist.
- \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
- \$echo \"This script is just a wrapper for \$program.\" 1>&2
- $echo \"See the $PACKAGE documentation for more information.\" 1>&2
- exit $EXIT_FAILURE
- fi
-fi\
-"
- chmod +x $output
- fi
- exit $EXIT_SUCCESS
- ;;
- esac
-
- # See if we need to build an old-fashioned archive.
- for oldlib in $oldlibs; do
-
- if test "$build_libtool_libs" = convenience; then
- oldobjs="$libobjs_save"
- addlibs="$convenience"
- build_libtool_libs=no
- else
- if test "$build_libtool_libs" = module; then
- oldobjs="$libobjs_save"
- build_libtool_libs=no
- else
- oldobjs="$old_deplibs $non_pic_objects"
- fi
- addlibs="$old_convenience"
- fi
-
- if test -n "$addlibs"; then
- gentop="$output_objdir/${outputname}x"
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- status=$?
- if test "$status" -ne 0 && test ! -d "$gentop"; then
- exit $status
- fi
- generated="$generated $gentop"
-
- # Add in members from convenience archives.
- for xlib in $addlibs; do
- # Extract the objects.
- case $xlib in
- [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
- *) xabs=`pwd`"/$xlib" ;;
- esac
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
- xdir="$gentop/$xlib"
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "$mkdir $xdir"
- $run $mkdir "$xdir"
- status=$?
- if test "$status" -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- # We will extract separately just the conflicting names and we will no
- # longer touch any unique names. It is faster to leave these extract
- # automatically by $AR in one run.
- $show "(cd $xdir && $AR x $xabs)"
- $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
- if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
- $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
- $AR t "$xabs" | sort | uniq -cd | while read -r count name
- do
- i=1
- while test "$i" -le "$count"
- do
- # Put our $i before any first dot (extension)
- # Never overwrite any file
- name_to="$name"
- while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
- do
- name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
- done
- $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
- $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
- i=`expr $i + 1`
- done
- done
- fi
-
- oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
- done
- fi
-
- # Do each command in the archive commands.
- if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- cmds=$old_archive_from_new_cmds
- else
- eval cmds=\"$old_archive_cmds\"
-
- if len=`expr "X$cmds" : ".*"` &&
- test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- cmds=$old_archive_cmds
- else
- # the command line is too long to link in one step, link in parts
- $echo "using piecewise archive linking..."
- save_RANLIB=$RANLIB
- RANLIB=:
- objlist=
- concat_cmds=
- save_oldobjs=$oldobjs
- # GNU ar 2.10+ was changed to match POSIX; thus no paths are
- # encoded into archives. This makes 'ar r' malfunction in
- # this piecewise linking case whenever conflicting object
- # names appear in distinct ar calls; check, warn and compensate.
- if (for obj in $save_oldobjs
- do
- $echo "X$obj" | $Xsed -e 's%^.*/%%'
- done | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
- $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
- AR_FLAGS=cq
- fi
- # Is there a better way of finding the last object in the list?
- for obj in $save_oldobjs
- do
- last_oldobj=$obj
- done
- for obj in $save_oldobjs
- do
- oldobjs="$objlist $obj"
- objlist="$objlist $obj"
- eval test_cmds=\"$old_archive_cmds\"
- if len=`expr "X$test_cmds" : ".*"` &&
- test "$len" -le "$max_cmd_len"; then
- :
- else
- # the above command should be used before it gets too long
- oldobjs=$objlist
- if test "$obj" = "$last_oldobj" ; then
- RANLIB=$save_RANLIB
- fi
- test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
- objlist=
- fi
- done
- RANLIB=$save_RANLIB
- oldobjs=$objlist
- if test "X$oldobjs" = "X" ; then
- eval cmds=\"\$concat_cmds\"
- else
- eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
- fi
- fi
- fi
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- eval cmd=\"$cmd\"
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$generated"; then
- $show "${rm}r$generated"
- $run ${rm}r$generated
- fi
-
- # Now create the libtool archive.
- case $output in
- *.la)
- old_library=
- test "$build_old_libs" = yes && old_library="$libname.$libext"
- $show "creating $output"
-
- # Preserve any variables that may affect compiler behavior
- for var in $variables_saved_for_relink; do
- if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
- elif eval var_value=\$$var; test -z "$var_value"; then
- relink_command="$var=; export $var; $relink_command"
- else
- var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
- fi
- done
- # Quote the link command for shipping.
- relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
- relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
- if test "$hardcode_automatic" = yes ; then
- relink_command=
- fi
-
-
- # Only create the output if not a dry run.
- if test -z "$run"; then
- for installed in no yes; do
- if test "$installed" = yes; then
- if test -z "$install_libdir"; then
- break
- fi
- output="$output_objdir/$outputname"i
- # Replace all uninstalled libtool libraries with the installed ones
- newdependency_libs=
- for deplib in $dependency_libs; do
- case $deplib in
- *.la)
- name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- if test -z "$libdir"; then
- $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
- newdependency_libs="$newdependency_libs $libdir/$name"
- ;;
- *) newdependency_libs="$newdependency_libs $deplib" ;;
- esac
- done
- dependency_libs="$newdependency_libs"
- newdlfiles=
- for lib in $dlfiles; do
- name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- if test -z "$libdir"; then
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
- newdlfiles="$newdlfiles $libdir/$name"
- done
- dlfiles="$newdlfiles"
- newdlprefiles=
- for lib in $dlprefiles; do
- name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- if test -z "$libdir"; then
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
- newdlprefiles="$newdlprefiles $libdir/$name"
- done
- dlprefiles="$newdlprefiles"
- else
- newdlfiles=
- for lib in $dlfiles; do
- case $lib in
- [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
- *) abs=`pwd`"/$lib" ;;
- esac
- newdlfiles="$newdlfiles $abs"
- done
- dlfiles="$newdlfiles"
- newdlprefiles=
- for lib in $dlprefiles; do
- case $lib in
- [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
- *) abs=`pwd`"/$lib" ;;
- esac
- newdlprefiles="$newdlprefiles $abs"
- done
- dlprefiles="$newdlprefiles"
- fi
- $rm $output
- # place dlname in correct position for cygwin
- tdlname=$dlname
- case $host,$output,$installed,$module,$dlname in
- *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
- esac
- $echo > $output "\
-# $outputname - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='$tdlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Is this an already installed library?
-installed=$installed
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=$module
-
-# Files to dlopen/dlpreopen
-dlopen='$dlfiles'
-dlpreopen='$dlprefiles'
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'"
- if test "$installed" = no && test "$need_relink" = yes; then
- $echo >> $output "\
-relink_command=\"$relink_command\""
- fi
- done
- fi
-
- # Do a symbolic link so that the libtool archive can be found in
- # LD_LIBRARY_PATH before the program is installed.
- $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
- $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
- ;;
- esac
- exit $EXIT_SUCCESS
- ;;
-
- # libtool install mode
- install)
- modename="$modename: install"
-
- # There may be an optional sh(1) argument at the beginning of
- # install_prog (especially on Windows NT).
- if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
- # Allow the use of GNU shtool's install command.
- $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
- # Aesthetically quote it.
- arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$arg "
- arg="$1"
- shift
- else
- install_prog=
- arg="$nonopt"
- fi
-
- # The real first argument should be the name of the installation program.
- # Aesthetically quote it.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog$arg"
-
- # We need to accept at least all the BSD install flags.
- dest=
- files=
- opts=
- prev=
- install_type=
- isdir=no
- stripme=
- for arg
- do
- if test -n "$dest"; then
- files="$files $dest"
- dest="$arg"
- continue
- fi
-
- case $arg in
- -d) isdir=yes ;;
- -f) prev="-f" ;;
- -g) prev="-g" ;;
- -m) prev="-m" ;;
- -o) prev="-o" ;;
- -s)
- stripme=" -s"
- continue
- ;;
- -*) ;;
-
- *)
- # If the previous option needed an argument, then skip it.
- if test -n "$prev"; then
- prev=
- else
- dest="$arg"
- continue
- fi
- ;;
- esac
-
- # Aesthetically quote the argument.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog $arg"
- done
-
- if test -z "$install_prog"; then
- $echo "$modename: you must specify an install program" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- if test -n "$prev"; then
- $echo "$modename: the \`$prev' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- if test -z "$files"; then
- if test -z "$dest"; then
- $echo "$modename: no file or destination specified" 1>&2
- else
- $echo "$modename: you must specify a destination" 1>&2
- fi
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Strip any trailing slash from the destination.
- dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
-
- # Check to see that the destination is a directory.
- test -d "$dest" && isdir=yes
- if test "$isdir" = yes; then
- destdir="$dest"
- destname=
- else
- destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
- test "X$destdir" = "X$dest" && destdir=.
- destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
-
- # Not a directory, so check to see that there is only one file specified.
- set dummy $files
- if test "$#" -gt 2; then
- $echo "$modename: \`$dest' is not a directory" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
- fi
- case $destdir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- for file in $files; do
- case $file in
- *.lo) ;;
- *)
- $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- done
- ;;
- esac
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- staticlibs=
- future_libdirs=
- current_libdirs=
- for file in $files; do
-
- # Do each installation.
- case $file in
- *.$libext)
- # Do the static libraries later.
- staticlibs="$staticlibs $file"
- ;;
-
- *.la)
- # Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- library_names=
- old_library=
- relink_command=
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Add the libdir to current_libdirs if it is the destination.
- if test "X$destdir" = "X$libdir"; then
- case "$current_libdirs " in
- *" $libdir "*) ;;
- *) current_libdirs="$current_libdirs $libdir" ;;
- esac
- else
- # Note the libdir as a future libdir.
- case "$future_libdirs " in
- *" $libdir "*) ;;
- *) future_libdirs="$future_libdirs $libdir" ;;
- esac
- fi
-
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
- test "X$dir" = "X$file/" && dir=
- dir="$dir$objdir"
-
- if test -n "$relink_command"; then
- # Determine the prefix the user has applied to our future dir.
- inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
-
- # Don't allow the user to place us outside of our expected
- # location b/c this prevents finding dependent libraries that
- # are installed to the same prefix.
- # At present, this check doesn't affect windows .dll's that
- # are installed into $libdir/../bin (currently, that works fine)
- # but it's something to keep an eye on.
- if test "$inst_prefix_dir" = "$destdir"; then
- $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
- exit $EXIT_FAILURE
- fi
-
- if test -n "$inst_prefix_dir"; then
- # Stick the inst_prefix_dir data into the link command.
- relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
- else
- relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
- fi
-
- $echo "$modename: warning: relinking \`$file'" 1>&2
- $show "$relink_command"
- if $run eval "$relink_command"; then :
- else
- $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
- exit $EXIT_FAILURE
- fi
- fi
-
- # See the names of the shared library.
- set dummy $library_names
- if test -n "$2"; then
- realname="$2"
- shift
- shift
-
- srcname="$realname"
- test -n "$relink_command" && srcname="$realname"T
-
- # Install the shared library and build the symlinks.
- $show "$install_prog $dir/$srcname $destdir/$realname"
- $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
- if test -n "$stripme" && test -n "$striplib"; then
- $show "$striplib $destdir/$realname"
- $run eval "$striplib $destdir/$realname" || exit $?
- fi
-
- if test "$#" -gt 0; then
- # Delete the old symlinks, and create new ones.
- for linkname
- do
- if test "$linkname" != "$realname"; then
- $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
- fi
- done
- fi
-
- # Do each command in the postinstall commands.
- lib="$destdir/$realname"
- cmds=$postinstall_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Install the pseudo-library for information purposes.
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- instname="$dir/$name"i
- $show "$install_prog $instname $destdir/$name"
- $run eval "$install_prog $instname $destdir/$name" || exit $?
-
- # Maybe install the static library, too.
- test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
- ;;
-
- *.lo)
- # Install (i.e. copy) a libtool object.
-
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # Deduce the name of the destination old-style object file.
- case $destfile in
- *.lo)
- staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
- ;;
- *.$objext)
- staticdest="$destfile"
- destfile=
- ;;
- *)
- $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- # Install the libtool object if requested.
- if test -n "$destfile"; then
- $show "$install_prog $file $destfile"
- $run eval "$install_prog $file $destfile" || exit $?
- fi
-
- # Install the old object if enabled.
- if test "$build_old_libs" = yes; then
- # Deduce the name of the old-style object file.
- staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
-
- $show "$install_prog $staticobj $staticdest"
- $run eval "$install_prog \$staticobj \$staticdest" || exit $?
- fi
- exit $EXIT_SUCCESS
- ;;
-
- *)
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # If the file is missing, and there is a .exe on the end, strip it
- # because it is most likely a libtool script we actually want to
- # install
- stripped_ext=""
- case $file in
- *.exe)
- if test ! -f "$file"; then
- file=`$echo $file|${SED} 's,.exe$,,'`
- stripped_ext=".exe"
- fi
- ;;
- esac
-
- # Do a test to see if this is really a libtool program.
- case $host in
- *cygwin*|*mingw*)
- wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
- ;;
- *)
- wrapper=$file
- ;;
- esac
- if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
- notinst_deplibs=
- relink_command=
-
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
- esac
-
- # Check the variables that should have been set.
- if test -z "$notinst_deplibs"; then
- $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- finalize=yes
- for lib in $notinst_deplibs; do
- # Check to see that each library is installed.
- libdir=
- if test -f "$lib"; then
- # If there is no directory component, then add one.
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
- fi
- libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
- if test -n "$libdir" && test ! -f "$libfile"; then
- $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
- finalize=no
- fi
- done
-
- relink_command=
- # To insure that "foo" is sourced, and not "foo.exe",
- # finese the cygwin/MSYS system by explicitly sourcing "foo."
- # which disallows the automatic-append-.exe behavior.
- case $build in
- *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
- *) wrapperdot=${wrapper} ;;
- esac
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . ${wrapperdot} ;;
- *) . ./${wrapperdot} ;;
- esac
-
- outputname=
- if test "$fast_install" = no && test -n "$relink_command"; then
- if test "$finalize" = yes && test -z "$run"; then
- tmpdir="/tmp"
- test -n "$TMPDIR" && tmpdir="$TMPDIR"
- tmpdir="$tmpdir/libtool-$$"
- save_umask=`umask`
- umask 0077
- if $mkdir "$tmpdir"; then
- umask $save_umask
- else
- umask $save_umask
- $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
- continue
- fi
- file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
- outputname="$tmpdir/$file"
- # Replace the output file specification.
- relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
-
- $show "$relink_command"
- if $run eval "$relink_command"; then :
- else
- $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
- ${rm}r "$tmpdir"
- continue
- fi
- file="$outputname"
- else
- $echo "$modename: warning: cannot relink \`$file'" 1>&2
- fi
- else
- # Install the binary that we compiled earlier.
- file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
- fi
- fi
-
- # remove .exe since cygwin /usr/bin/install will append another
- # one anyways
- case $install_prog,$host in
- */usr/bin/install*,*cygwin*)
- case $file:$destfile in
- *.exe:*.exe)
- # this is ok
- ;;
- *.exe:*)
- destfile=$destfile.exe
- ;;
- *:*.exe)
- destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
- ;;
- esac
- ;;
- esac
- $show "$install_prog$stripme $file $destfile"
- $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
- test -n "$outputname" && ${rm}r "$tmpdir"
- ;;
- esac
- done
-
- for file in $staticlibs; do
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-
- # Set up the ranlib parameters.
- oldlib="$destdir/$name"
-
- $show "$install_prog $file $oldlib"
- $run eval "$install_prog \$file \$oldlib" || exit $?
-
- if test -n "$stripme" && test -n "$old_striplib"; then
- $show "$old_striplib $oldlib"
- $run eval "$old_striplib $oldlib" || exit $?
- fi
-
- # Do each command in the postinstall commands.
- cmds=$old_postinstall_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$future_libdirs"; then
- $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
- fi
-
- if test -n "$current_libdirs"; then
- # Maybe just do a dry run.
- test -n "$run" && current_libdirs=" -n$current_libdirs"
- exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
- else
- exit $EXIT_SUCCESS
- fi
- ;;
-
- # libtool finish mode
- finish)
- modename="$modename: finish"
- libdirs="$nonopt"
- admincmds=
-
- if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
- for dir
- do
- libdirs="$libdirs $dir"
- done
-
- for libdir in $libdirs; do
- if test -n "$finish_cmds"; then
- # Do each command in the finish commands.
- cmds=$finish_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || admincmds="$admincmds
- $cmd"
- done
- IFS="$save_ifs"
- fi
- if test -n "$finish_eval"; then
- # Do the single finish_eval.
- eval cmds=\"$finish_eval\"
- $run eval "$cmds" || admincmds="$admincmds
- $cmds"
- fi
- done
- fi
-
- # Exit here if they wanted silent mode.
- test "$show" = : && exit $EXIT_SUCCESS
-
- $echo "----------------------------------------------------------------------"
- $echo "Libraries have been installed in:"
- for libdir in $libdirs; do
- $echo " $libdir"
- done
- $echo
- $echo "If you ever happen to want to link against installed libraries"
- $echo "in a given directory, LIBDIR, you must either use libtool, and"
- $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
- $echo "flag during linking and do at least one of the following:"
- if test -n "$shlibpath_var"; then
- $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
- $echo " during execution"
- fi
- if test -n "$runpath_var"; then
- $echo " - add LIBDIR to the \`$runpath_var' environment variable"
- $echo " during linking"
- fi
- if test -n "$hardcode_libdir_flag_spec"; then
- libdir=LIBDIR
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- $echo " - use the \`$flag' linker flag"
- fi
- if test -n "$admincmds"; then
- $echo " - have your system administrator run these commands:$admincmds"
- fi
- if test -f /etc/ld.so.conf; then
- $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
- fi
- $echo
- $echo "See any operating system documentation about shared libraries for"
- $echo "more information, such as the ld(1) and ld.so(8) manual pages."
- $echo "----------------------------------------------------------------------"
- exit $EXIT_SUCCESS
- ;;
-
- # libtool execute mode
- execute)
- modename="$modename: execute"
-
- # The first argument is the command name.
- cmd="$nonopt"
- if test -z "$cmd"; then
- $echo "$modename: you must specify a COMMAND" 1>&2
- $echo "$help"
- exit $EXIT_FAILURE
- fi
-
- # Handle -dlopen flags immediately.
- for file in $execute_dlfiles; do
- if test ! -f "$file"; then
- $echo "$modename: \`$file' is not a file" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- dir=
- case $file in
- *.la)
- # Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Read the libtool library.
- dlname=
- library_names=
-
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Skip this library if it cannot be dlopened.
- if test -z "$dlname"; then
- # Warn if it was a shared library.
- test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
- continue
- fi
-
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
-
- if test -f "$dir/$objdir/$dlname"; then
- dir="$dir/$objdir"
- else
- $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
- exit $EXIT_FAILURE
- fi
- ;;
-
- *.lo)
- # Just add the directory containing the .lo file.
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
- ;;
-
- *)
- $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
- continue
- ;;
- esac
-
- # Get the absolute pathname.
- absdir=`cd "$dir" && pwd`
- test -n "$absdir" && dir="$absdir"
-
- # Now add the directory to shlibpath_var.
- if eval "test -z \"\$$shlibpath_var\""; then
- eval "$shlibpath_var=\"\$dir\""
- else
- eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
- fi
- done
-
- # This variable tells wrapper scripts just to set shlibpath_var
- # rather than running their programs.
- libtool_execute_magic="$magic"
-
- # Check if any of the arguments is a wrapper script.
- args=
- for file
- do
- case $file in
- -*) ;;
- *)
- # Do a test to see if this is really a libtool program.
- if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Transform arg to wrapped name.
- file="$progdir/$program"
- fi
- ;;
- esac
- # Quote arguments (to preserve shell metacharacters).
- file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
- args="$args \"$file\""
- done
-
- if test -z "$run"; then
- if test -n "$shlibpath_var"; then
- # Export the shlibpath_var.
- eval "export $shlibpath_var"
- fi
-
- # Restore saved environment variables
- if test "${save_LC_ALL+set}" = set; then
- LC_ALL="$save_LC_ALL"; export LC_ALL
- fi
- if test "${save_LANG+set}" = set; then
- LANG="$save_LANG"; export LANG
- fi
-
- # Now prepare to actually exec the command.
- exec_cmd="\$cmd$args"
- else
- # Display what would be done.
- if test -n "$shlibpath_var"; then
- eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
- $echo "export $shlibpath_var"
- fi
- $echo "$cmd$args"
- exit $EXIT_SUCCESS
- fi
- ;;
-
- # libtool clean and uninstall mode
- clean | uninstall)
- modename="$modename: $mode"
- rm="$nonopt"
- files=
- rmforce=
- exit_status=0
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- for arg
- do
- case $arg in
- -f) rm="$rm $arg"; rmforce=yes ;;
- -*) rm="$rm $arg" ;;
- *) files="$files $arg" ;;
- esac
- done
-
- if test -z "$rm"; then
- $echo "$modename: you must specify an RM program" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- rmdirs=
-
- origobjdir="$objdir"
- for file in $files; do
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$dir" = "X$file"; then
- dir=.
- objdir="$origobjdir"
- else
- objdir="$dir/$origobjdir"
- fi
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- test "$mode" = uninstall && objdir="$dir"
-
- # Remember objdir for removal later, being careful to avoid duplicates
- if test "$mode" = clean; then
- case " $rmdirs " in
- *" $objdir "*) ;;
- *) rmdirs="$rmdirs $objdir" ;;
- esac
- fi
-
- # Don't error if the file doesn't exist and rm -f was used.
- if (test -L "$file") >/dev/null 2>&1 \
- || (test -h "$file") >/dev/null 2>&1 \
- || test -f "$file"; then
- :
- elif test -d "$file"; then
- exit_status=1
- continue
- elif test "$rmforce" = yes; then
- continue
- fi
-
- rmfiles="$file"
-
- case $name in
- *.la)
- # Possibly a libtool archive, so verify it.
- if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- . $dir/$name
-
- # Delete the libtool libraries and symlinks.
- for n in $library_names; do
- rmfiles="$rmfiles $objdir/$n"
- done
- test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
- test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
-
- if test "$mode" = uninstall; then
- if test -n "$library_names"; then
- # Do each command in the postuninstall commands.
- cmds=$postuninstall_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd"
- if test "$?" -ne 0 && test "$rmforce" != yes; then
- exit_status=1
- fi
- done
- IFS="$save_ifs"
- fi
-
- if test -n "$old_library"; then
- # Do each command in the old_postuninstall commands.
- cmds=$old_postuninstall_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd"
- if test "$?" -ne 0 && test "$rmforce" != yes; then
- exit_status=1
- fi
- done
- IFS="$save_ifs"
- fi
- # FIXME: should reinstall the best remaining shared library.
- fi
- fi
- ;;
-
- *.lo)
- # Possibly a libtool object, so verify it.
- if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-
- # Read the .lo file
- . $dir/$name
-
- # Add PIC object to the list of files to remove.
- if test -n "$pic_object" \
- && test "$pic_object" != none; then
- rmfiles="$rmfiles $dir/$pic_object"
- fi
-
- # Add non-PIC object to the list of files to remove.
- if test -n "$non_pic_object" \
- && test "$non_pic_object" != none; then
- rmfiles="$rmfiles $dir/$non_pic_object"
- fi
- fi
- ;;
-
- *)
- if test "$mode" = clean ; then
- noexename=$name
- case $file in
- *.exe)
- file=`$echo $file|${SED} 's,.exe$,,'`
- noexename=`$echo $name|${SED} 's,.exe$,,'`
- # $file with .exe has already been added to rmfiles,
- # add $file without .exe
- rmfiles="$rmfiles $file"
- ;;
- esac
- # Do a test to see if this is a libtool program.
- if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- relink_command=
- . $dir/$noexename
-
- # note $name still contains .exe if it was in $file originally
- # as does the version of $file that was added into $rmfiles
- rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
- if test "$fast_install" = yes && test -n "$relink_command"; then
- rmfiles="$rmfiles $objdir/lt-$name"
- fi
- if test "X$noexename" != "X$name" ; then
- rmfiles="$rmfiles $objdir/lt-${noexename}.c"
- fi
- fi
- fi
- ;;
- esac
- $show "$rm $rmfiles"
- $run $rm $rmfiles || exit_status=1
- done
- objdir="$origobjdir"
-
- # Try to remove the ${objdir}s in the directories where we deleted files
- for dir in $rmdirs; do
- if test -d "$dir"; then
- $show "rmdir $dir"
- $run rmdir $dir >/dev/null 2>&1
- fi
- done
-
- exit $exit_status
- ;;
-
- "")
- $echo "$modename: you must specify a MODE" 1>&2
- $echo "$generic_help" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- if test -z "$exec_cmd"; then
- $echo "$modename: invalid operation mode \`$mode'" 1>&2
- $echo "$generic_help" 1>&2
- exit $EXIT_FAILURE
- fi
-fi # test -z "$show_help"
-
-if test -n "$exec_cmd"; then
- eval exec $exec_cmd
- exit $EXIT_FAILURE
-fi
-
-# We need to display help for each of the modes.
-case $mode in
-"") $echo \
-"Usage: $modename [OPTION]... [MODE-ARG]...
-
-Provide generalized library-building support services.
-
- --config show all configuration variables
- --debug enable verbose shell tracing
--n, --dry-run display commands without modifying any files
- --features display basic configuration information and exit
- --finish same as \`--mode=finish'
- --help display this help message and exit
- --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
- --quiet same as \`--silent'
- --silent don't print informational messages
- --tag=TAG use configuration variables from tag TAG
- --version print version information
-
-MODE must be one of the following:
-
- clean remove files from the build directory
- compile compile a source file into a libtool object
- execute automatically set library path, then run a program
- finish complete the installation of libtool libraries
- install install libraries or executables
- link create a library or an executable
- uninstall remove libraries from an installed directory
-
-MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
-a more detailed description of MODE.
-
-Report bugs to <bug-libtool@gnu.org>."
- exit $EXIT_SUCCESS
- ;;
-
-clean)
- $echo \
-"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
-
-Remove files from the build directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, object or program, all the files associated
-with it are deleted. Otherwise, only FILE itself is deleted using RM."
- ;;
-
-compile)
- $echo \
-"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
- -o OUTPUT-FILE set the output file name to OUTPUT-FILE
- -prefer-pic try to building PIC objects only
- -prefer-non-pic try to building non-PIC objects only
- -static always build a \`.o' file suitable for static linking
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
- ;;
-
-execute)
- $echo \
-"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
- -dlopen FILE add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
- ;;
-
-finish)
- $echo \
-"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges. Use
-the \`--dry-run' option if you just want to see what would be executed."
- ;;
-
-install)
- $echo \
-"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command. The first component should be
-either the \`install' or \`cp' program.
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
- ;;
-
-link)
- $echo \
-"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
- -all-static do not do any dynamic linking at all
- -avoid-version do not add a version suffix if possible
- -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
- -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
- -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
- -export-symbols SYMFILE
- try to export only the symbols listed in SYMFILE
- -export-symbols-regex REGEX
- try to export only the symbols matching REGEX
- -LLIBDIR search LIBDIR for required installed libraries
- -lNAME OUTPUT-FILE requires the installed library libNAME
- -module build a library that can dlopened
- -no-fast-install disable the fast-install mode
- -no-install link a not-installable executable
- -no-undefined declare that a library does not refer to external symbols
- -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
- -objectlist FILE Use a list of object files found in FILE to specify objects
- -precious-files-regex REGEX
- don't remove output files matching REGEX
- -release RELEASE specify package release information
- -rpath LIBDIR the created library will eventually be installed in LIBDIR
- -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
- -static do not do any dynamic linking of libtool libraries
- -version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename. Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
- ;;
-
-uninstall)
- $echo \
-"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
- ;;
-
-*)
- $echo "$modename: invalid operation mode \`$mode'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
-esac
-
-$echo
-$echo "Try \`$modename --help' for more information about other modes."
-
-exit $EXIT_SUCCESS
-
-# The TAGs below are defined such that we never get into a situation
-# in which we disable both kinds of libraries. Given conflicting
-# choices, we go for a static library, that is the most portable,
-# since we can't tell whether shared libraries were disabled because
-# the user asked for that or because the platform doesn't support
-# them. This is particularly important on AIX, because we don't
-# support having both static and shared libraries enabled at the same
-# time on that platform, so we default to a shared-only configuration.
-# If a disable-shared tag is given, we'll fallback to a static-only
-# configuration. But we'll never go from static-only to shared-only.
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-build_libtool_libs=no
-build_old_libs=yes
-# ### END LIBTOOL TAG CONFIG: disable-shared
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
-# ### END LIBTOOL TAG CONFIG: disable-static
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
+++ /dev/null
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program 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 General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
-fi
-
-case "$1" in
-
- -h|--h|--he|--hel|--help)
- echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
- -h, --help display this help and exit
- -v, --version output version information and exit
-
-Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- automake touch all \`Makefile.in' files
- bison create \`y.tab.[ch]', if possible, from existing .[ch]
- flex create \`lex.yy.c', if possible, from existing .c
- lex create \`lex.yy.c', if possible, from existing .c
- makeinfo touch the output file
- yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
- ;;
-
- -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
- echo "missing - GNU libit 0.0"
- ;;
-
- -*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
- ;;
-
- aclocal)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified \`acinclude.m4' or \`configure.in'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
- any GNU archive site."
- touch aclocal.m4
- ;;
-
- autoconf)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified \`configure.in'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
- archive site."
- touch configure
- ;;
-
- autoheader)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified \`acconfig.h' or \`configure.in'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
- from any GNU archive site."
- files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
- test -z "$files" && files="config.h"
- touch_files=
- for f in $files; do
- case "$f" in
- *:*) touch_files="$touch_files "`echo "$f" |
- sed -e 's/^[^:]*://' -e 's/:.*//'`;;
- *) touch_files="$touch_files $f.in";;
- esac
- done
- touch $touch_files
- ;;
-
- automake)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
- You might want to install the \`Automake' and \`Perl' packages.
- Grab them from any GNU archive site."
- find . -type f -name Makefile.am -print |
- sed 's/\.am$/.in/' |
- while read f; do touch "$f"; done
- ;;
-
- bison|yacc)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified a \`.y' file. You may need the \`Bison' package
- in order for those modifications to take effect. You can get
- \`Bison' from any GNU archive site."
- rm -f y.tab.c y.tab.h
- if [ $# -ne 1 ]; then
- eval LASTARG="\${$#}"
- case "$LASTARG" in
- *.y)
- SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
- if [ -f "$SRCFILE" ]; then
- cp "$SRCFILE" y.tab.c
- fi
- SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
- if [ -f "$SRCFILE" ]; then
- cp "$SRCFILE" y.tab.h
- fi
- ;;
- esac
- fi
- if [ ! -f y.tab.h ]; then
- echo >y.tab.h
- fi
- if [ ! -f y.tab.c ]; then
- echo 'main() { return 0; }' >y.tab.c
- fi
- ;;
-
- lex|flex)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified a \`.l' file. You may need the \`Flex' package
- in order for those modifications to take effect. You can get
- \`Flex' from any GNU archive site."
- rm -f lex.yy.c
- if [ $# -ne 1 ]; then
- eval LASTARG="\${$#}"
- case "$LASTARG" in
- *.l)
- SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
- if [ -f "$SRCFILE" ]; then
- cp "$SRCFILE" lex.yy.c
- fi
- ;;
- esac
- fi
- if [ ! -f lex.yy.c ]; then
- echo 'main() { return 0; }' >lex.yy.c
- fi
- ;;
-
- makeinfo)
- echo 1>&2 "\
-WARNING: \`$1' is missing on your system. You should only need it if
- you modified a \`.texi' or \`.texinfo' file, or any other file
- indirectly affecting the aspect of the manual. The spurious
- call might also be the consequence of using a buggy \`make' (AIX,
- DU, IRIX). You might want to install the \`Texinfo' package or
- the \`GNU make' package. Grab either from any GNU archive site."
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
- if test -z "$file"; then
- file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
- fi
- touch $file
- ;;
-
- *)
- echo 1>&2 "\
-WARNING: \`$1' is needed, and you do not seem to have it handy on your
- system. You might have modified some files without having the
- proper tools for further handling them. Check the \`README' file,
- it often tells you about the needed prerequirements for installing
- this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing \`$1' program."
- exit 1
- ;;
-esac
-
-exit 0
dnl author Patrick GOLDBRONN
dnl
-# AC_ENABLE_PRODUCTION
-AC_DEFUN([AC_ENABLE_PRODUCTION], [dnl
-define([AC_ENABLE_PRODUCTION_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(production,
-changequote(<<, >>)dnl
-<< --enable-production[=PKGS] build without debug information [default=>>AC_ENABLE_PRODUCTION_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_production=yes ;;
-no) enable_production=no ;;
-*)
- enable_production=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_production=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac],
-enable_production=AC_ENABLE_PRODUCTION_DEFAULT)dnl
+dnl AC_ENABLE_PRODUCTION
+dnl
+dnl This macro enables production build : optimized + no debugging information (-g)
+dnl default = not enabled
+dnl
+AC_DEFUN([AC_ENABLE_PRODUCTION],
+[define([AC_ENABLE_PRODUCTION_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([production],
+ [AC_HELP_STRING([--enable-production],
+ [compile in optimized mode @<:@default=]AC_ENABLE_PRODUCTION_DEFAULT[@:>@])],
+ [
+ enable_production=$enableval
+ ],
+ [enable_production=]AC_ENABLE_PRODUCTION_DEFAULT)
AC_CXX_OPTION(-Wno-deprecated,CXXFLAGS)
AC_CXX_OPTION(-Wparentheses,CXXFLAGS)
CFLAGS="$CFLAGS -O"
AC_CXX_OPTION(-Wuninitialized,CXXFLAGS)
CXXFLAGS="$CXXFLAGS -O "
+else
+ CFLAGS="$CFLAGS -g"
+ CXXFLAGS="$CXXFLAGS -g"
fi
])
# AC_DISABLE_PRODUCTION - set the default flag to --disable-production
AC_DEFUN([AC_DISABLE_PRODUCTION], [AC_ENABLE_PRODUCTION(no)])
-# AC_ENABLE_DEBUG
-AC_DEFUN([AC_ENABLE_DEBUG], [dnl
-define([AC_ENABLE_DEBUG_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(debug,
-changequote(<<, >>)dnl
-<< --enable-debug[=PKGS] build without debug information [default=>>AC_ENABLE_DEBUG_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_debug=yes ;;
-no) enable_debug=no ;;
-*)
- enable_debug=no
- # Look at the argument we got. We use all the common list separators.
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
- for pkg in $enableval; do
- if test "X$pkg" = "X$p"; then
- enable_debug=yes
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac],
-enable_debug=AC_ENABLE_DEBUG_DEFAULT)dnl
+dnl AC_ENABLE_DEBUG
+dnl
+dnl This macro enables debugging build : debug + trace
+dnl default = not enabled
+dnl
+AC_DEFUN([AC_ENABLE_DEBUG],
+ [define([AC_ENABLE_DEBUG_DEFAULT], ifelse($1, no, no, yes))dnl
+ AC_ARG_ENABLE([debug],
+ [AC_HELP_STRING([--enable-debug],
+ [build with debug and trace information @<:@default=]AC_ENABLE_DEBUG_DEFAULT[@:>@])],
+ [
+ enable_debug=$enableval
+ ],
+ [enable_debug=]AC_ENABLE_DEBUG_DEFAULT)
if test "X$enable_debug" = "Xyes"; then
CFLAGS="$CFLAGS -g -D_DEBUG_ "
salomeadmdir = $(prefix)/salome_adm
salomeadmuxdir = $(salomeadmdir)/unix
salomem4dir = $(salomeadmdir)/unix/config_files
+salome4deprdir = $(salomeadmdir)/unix/config_files/DEPRECATED
# Shared modules installation directory
sharedpkgpythondir =$(pkgpythondir)/shared_modules
--- /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
+//
+/*
+ * BatchManager.cxx :
+ *
+ * Auteur : Bernard SECHER - CEA/DEN
+ * Date : Juillet 2007
+ * Projet : SALOME
+ *
+ */
+
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <netdb.h>
+#include "BatchLight_Job.hxx"
+#include "BatchLight_BatchManager.hxx"
+#include "Batch_Date.hxx"
+using namespace std;
+
+namespace BatchLight {
+
+ // Constructeur
+ BatchManager::BatchManager(const batchParams& p) throw(SALOME_Exception) : _params(p)
+ {
+ SCRUTE(_params.hostname);
+ SCRUTE(_params.protocol);
+ SCRUTE(_params.username);
+ // On verifie que le hostname est correct
+ if (!gethostbyname(_params.hostname.c_str())) { // hostname unknown from network
+ string msg = "hostname \"";
+ msg += _params.hostname;
+ msg += "\" unknown from the network";
+ throw SALOME_Exception(msg.c_str());
+ }
+ _mpiImpl = NULL;
+ }
+
+ // Destructeur
+ BatchManager::~BatchManager()
+ {
+ MESSAGE("BatchManager destructor "<<_params.hostname);
+ std::map < int, const BatchLight::Job * >::const_iterator it;
+ for(it=_jobmap.begin();it!=_jobmap.end();it++)
+ delete it->second;
+ if(_mpiImpl) delete _mpiImpl;
+ }
+
+ // Methode pour le controle des jobs : soumet un job au gestionnaire
+ const int BatchManager::submitJob(Job* job)
+ {
+ BEGIN_OF("BatchManager::submitJob");
+ int id;
+
+ // temporary directory on cluster to put input files for job
+ setDirForTmpFiles();
+ SCRUTE(_dirForTmpFiles);
+
+ // export input files on cluster
+ exportInputFiles(job->getFileToExecute(),job->getFilesToExportList());
+
+ // build salome coupling script for job
+ buildSalomeCouplingScript(job->getFileToExecute());
+
+ // build batch script for job
+ buildSalomeBatchScript(job->getNbProc());
+
+ // submit job on cluster
+ id = submit();
+
+ // register job on map
+ _jobmap[id] = job;
+ END_OF("BatchManager::submitJob");
+ return id;
+ }
+
+ void BatchManager::setDirForTmpFiles()
+ {
+ int i;
+
+ _dirForTmpFiles = string("Batch/");
+ Batch::Date date = Batch::Date(time(0)) ;
+ std::string thedate = date.str() ;
+ int lend = thedate.size() ;
+ i = 0 ;
+ while ( i < lend ) {
+ if ( thedate[i] == '/' || thedate[i] == '-' || thedate[i] == ':' ) {
+ thedate[i] = '_' ;
+ }
+ i++ ;
+ }
+ _dirForTmpFiles += thedate ;
+ }
+
+ void BatchManager::exportInputFiles(const char *fileToExecute, const Engines::FilesList filesToExportList) throw(SALOME_Exception)
+ {
+ BEGIN_OF("BatchManager::exportInFiles");
+ string command = _params.protocol;
+ int status;
+
+ command += " ";
+
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+
+ command += _params.hostname;
+ command += " \"mkdir -p ";
+ command += _dirForTmpFiles ;
+ command += "\"" ;
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+
+ if( _params.protocol == "rsh" )
+ command = "rcp ";
+ else if( _params.protocol == "ssh" )
+ command = "scp ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+
+ command += fileToExecute;
+ command += " ";
+
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+
+ command += _params.hostname;
+ command += ":";
+ command += _dirForTmpFiles ;
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+
+ int i ;
+ for ( i = 0 ; i < filesToExportList.length() ; i++ ) {
+ if( _params.protocol == "rsh" )
+ command = "rcp ";
+ else if( _params.protocol == "ssh" )
+ command = "scp ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+ command += filesToExportList[i] ;
+ command += " ";
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+ command += _params.hostname;
+ command += ":";
+ command += _dirForTmpFiles ;
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+ }
+
+ END_OF("BatchManager::exportInFiles");
+ }
+
+ void BatchManager::importOutputFiles( const char *directory, const CORBA::Long jobId ) throw(SALOME_Exception)
+ {
+ BEGIN_OF("BatchManager::importOutputFiles");
+ string command;
+ int status;
+
+ const BatchLight::Job* myJob = _jobmap[jobId];
+ Engines::FilesList filesToImportList = myJob->getFilesToImportList();
+
+ for ( int i = 0 ; i < filesToImportList.length() ; i++ ) {
+ if( _params.protocol == "rsh" )
+ command = "rcp ";
+ else if( _params.protocol == "ssh" )
+ command = "scp ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+ command += _params.hostname;
+ command += ":";
+ command += filesToImportList[i] ;
+ command += " ";
+ command += directory;
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+ }
+
+ END_OF("BatchManager::importOutputFiles");
+ }
+
+ string BatchManager::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);
+#else
+
+ char aPID[80];
+ itoa(getpid(), aPID, 10);
+ strcat(temp, aPID);
+#endif
+
+ string command(temp);
+ delete [] temp;
+ command += ".sh";
+ return command;
+ }
+
+ void BatchManager::RmTmpFile()
+ {
+ if (_TmpFileName != ""){
+ string command = "rm ";
+ command += _TmpFileName;
+ char *temp = strdup(command.c_str());
+ int lgthTemp = strlen(temp);
+ temp[lgthTemp - 3] = '*';
+ temp[lgthTemp - 2] = '\0';
+ system(temp);
+ free(temp);
+ }
+ }
+
+ MpiImpl *BatchManager::FactoryMpiImpl(string mpiImpl) throw(SALOME_Exception)
+ {
+ if(mpiImpl == "lam")
+ return new MpiImpl_LAM();
+ else if(mpiImpl == "mpich1")
+ return new MpiImpl_MPICH1();
+ else if(mpiImpl == "mpich2")
+ return new MpiImpl_MPICH2();
+ else if(mpiImpl == "openmpi")
+ return new MpiImpl_OPENMPI();
+ else if(mpiImpl == "indif")
+ throw SALOME_Exception("you must specify a mpi implementation in CatalogResources.xml file");
+ else{
+ ostringstream oss;
+ oss << mpiImpl << " : not yet implemented";
+ throw SALOME_Exception(oss.str().c_str());
+ }
+ }
+
+}
--- /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
+//
+/*
+ * BatchManager.hxx :
+ *
+ * Auteur : Bernard SECHER - CEA/DEN
+ * Date : Juillet 2007
+ * Projet : SALOME
+ *
+ */
+
+#ifndef _BL_BATCHMANAGER_H_
+#define _BL_BATCHMANAGER_H_
+
+#include <vector>
+#include <map>
+#include <string>
+#include "Utils_SALOME_Exception.hxx"
+#include <SALOMEconfig.h>
+#include <stdlib.h>
+#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
+#include "MpiImpl.hxx"
+
+namespace BatchLight {
+
+ class Job;
+
+ struct batchParams{
+ std::string hostname; // serveur ou tourne le BatchManager
+ std::string protocol; // protocole d'acces au serveur: ssh ou rsh
+ std::string username; // username d'acces au serveur
+ std::string applipath; // path of apllication directory on server
+ std::vector<std::string> modulesList; // list of Salome modules installed on server
+ unsigned int nbnodes; // number of nodes on cluster
+ unsigned int nbprocpernode; // number of processors on each node
+ std::string mpiImpl; // mpi implementation
+ };
+
+ class BatchManager
+ {
+ public:
+ // Constructeur et destructeur
+ BatchManager(const batchParams& p) throw(SALOME_Exception); // connexion a la machine host
+ virtual ~BatchManager();
+
+ // Methodes pour le controle des jobs : virtuelles pures
+ const int submitJob(BatchLight::Job* job); // soumet un job au gestionnaire
+ virtual void deleteJob(const int & jobid) = 0; // retire un job du gestionnaire
+ virtual std::string queryJob(const int & jobid) = 0; // renvoie l'etat du job
+ void importOutputFiles( const char *directory, const CORBA::Long jobId ) throw(SALOME_Exception);
+
+ protected:
+ batchParams _params;
+ MpiImpl *_mpiImpl;
+
+ std::map <int,const BatchLight::Job *> _jobmap;
+ std::string _dirForTmpFiles; // repertoire temporaire sur le serveur
+ std::string _TmpFileName;
+ std::string _fileNameToExecute;
+
+ virtual int submit() throw(SALOME_Exception) = 0;
+ void setDirForTmpFiles();
+ void exportInputFiles( const char *fileToExecute, const Engines::FilesList filesToExportList ) throw(SALOME_Exception);
+ virtual void buildSalomeCouplingScript( const char *fileToExecute ) throw(SALOME_Exception) = 0;
+ virtual void buildSalomeBatchScript( const int nbproc ) throw(SALOME_Exception) = 0;
+
+ std::string BuildTemporaryFileName() const;
+ void RmTmpFile();
+ MpiImpl *FactoryMpiImpl(std::string mpiImpl) throw(SALOME_Exception);
+
+ private:
+
+ };
+
+}
+
+#endif
--- /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
+//
+/*
+ * BatchManager.cxx :
+ *
+ * Auteur : Bernard SECHER - CEA/DEN
+ * Date : Juillet 2007
+ * Projet : SALOME
+ *
+ */
+
+#include "BatchLight_BatchManager_PBS.hxx"
+#include "utilities.h"
+#include "BatchLight_Job.hxx"
+#include <fstream>
+#include <iostream>
+#include <sstream>
+#include <sys/stat.h>
+
+using namespace std;
+
+namespace BatchLight {
+
+ // Constructeur
+ BatchManager_PBS::BatchManager_PBS(const batchParams& p) throw(SALOME_Exception) : BatchManager(p)
+ {
+ // pbs batch system needs to know mpi implementation
+ _mpiImpl = FactoryMpiImpl(_params.mpiImpl);
+ }
+
+ // Destructeur
+ BatchManager_PBS::~BatchManager_PBS()
+ {
+ MESSAGE("BatchManager_PBS destructor "<<_params.hostname);
+ }
+
+ // Methode pour le controle des jobs : retire un job du gestionnaire
+ void BatchManager_PBS::deleteJob(const int & jobid)
+ {
+ BEGIN_OF("BatchManager_PBS::deleteJob");
+ string command;
+ int status;
+ ostringstream oss;
+ oss << jobid;
+
+ // define command to submit batch
+ if( _params.protocol == "rsh" )
+ command = "rsh ";
+ else if( _params.protocol == "ssh" )
+ command = "ssh ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+
+ command += _params.hostname;
+ command += " \"qdel " ;
+ command += oss.str();
+ command += "\"";
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+
+ MESSAGE("jobId = " << jobid << "killed");
+ END_OF("BatchManager_PBS::deleteJob");
+ }
+
+ // Methode pour le controle des jobs : renvoie l'etat du job
+ string BatchManager_PBS::queryJob(const int & jobid)
+ {
+ BEGIN_OF("BatchManager_PBS::queryJob");
+ // define name of log file
+ string jstatus;
+ string logFile="/tmp/logs/";
+ logFile += getenv("USER");
+ logFile += "/batchSalome_";
+
+ srand ( time(NULL) );
+ int ir = rand();
+ ostringstream oss;
+ oss << ir;
+ logFile += oss.str();
+ logFile += ".log";
+
+ string command;
+ int status;
+
+ // define command to submit batch
+ if( _params.protocol == "rsh" )
+ command = "rsh ";
+ else if( _params.protocol == "ssh" )
+ command = "ssh ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+
+ command += _params.hostname;
+ command += " \"qstat -f " ;
+ ostringstream oss2;
+ oss2 << jobid;
+ command += oss2.str();
+ command += "\" > ";
+ command += logFile;
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status && status != 153 && status != 256*153){
+ MESSAGE("status="<<status);
+ throw SALOME_Exception("Error of connection on remote host");
+ }
+
+ if(status == 153 || status == 256*153 )
+ // If job is finished qstat command return 153 status
+ jstatus = "D";
+ else{
+ // read status of job in log file
+ char line[128];
+ ifstream fp(logFile.c_str(),ios::in);
+
+ string sline;
+ int pos = string::npos;
+ while( (pos == string::npos) && fp.getline(line,80,'\n') ){
+ sline = string(line);
+ pos = sline.find("job_state");
+ };
+
+ if(pos!=string::npos){
+ istringstream iss(sline);
+ iss >> jstatus;
+ iss >> jstatus;
+ iss >> jstatus;
+ }
+ else
+ jstatus = "U";
+ }
+
+ MESSAGE("jobId = " << jobid << " " << jstatus);
+ END_OF("BatchManager_PBS::queryJob");
+ return jstatus;
+ }
+
+ void BatchManager_PBS::buildSalomeCouplingScript( const char *fileToExecute ) throw(SALOME_Exception)
+ {
+ BEGIN_OF("BatchManager_PBS::buildSalomeCouplingScript");
+ int status;
+
+ string::size_type p1 = string(fileToExecute).find_last_of("/");
+ string::size_type p2 = string(fileToExecute).find_last_of(".");
+ _fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1);
+
+ _TmpFileName = BuildTemporaryFileName();
+ ofstream tempOutputFile;
+ tempOutputFile.open(_TmpFileName.c_str(), ofstream::out );
+ tempOutputFile << "#! /bin/sh -f" << endl ;
+ tempOutputFile << "cd " ;
+ tempOutputFile << _params.applipath << endl ;
+ tempOutputFile << "export PYTHONPATH=~/" ;
+ tempOutputFile << _dirForTmpFiles ;
+ tempOutputFile << ":$PYTHONPATH" << endl ;
+ tempOutputFile << "if test " ;
+ tempOutputFile << _mpiImpl->rank() ;
+ tempOutputFile << " = 0; then" << endl ;
+ tempOutputFile << " ./runAppli --terminal --modules=" ;
+ for ( int i = 0 ; i < _params.modulesList.size() ; i++ ) {
+ tempOutputFile << _params.modulesList[i] ;
+ if ( i != _params.modulesList.size()-1 )
+ tempOutputFile << "," ;
+ }
+ tempOutputFile << " --standalone=registry,study,moduleCatalog --killall &" << endl ;
+ tempOutputFile << " for ((ip=1; ip < ";
+ tempOutputFile << _mpiImpl->size();
+ tempOutputFile << " ; ip++))" << endl;
+ tempOutputFile << " do" << endl ;
+ tempOutputFile << " arglist=\"$arglist YACS_Server_\"$ip" << endl ;
+ tempOutputFile << " done" << endl ;
+ tempOutputFile << " sleep 5" << endl ;
+ tempOutputFile << " ./runSession waitContainers.py $arglist" << endl ;
+ tempOutputFile << " ./runSession python ~/" << _dirForTmpFiles << "/" << _fileNameToExecute << ".py" << endl;
+ tempOutputFile << " ./runSession killCurrentPort" << endl;
+ tempOutputFile << "else" << endl ;
+ tempOutputFile << " sleep 5" << endl ;
+ tempOutputFile << " ./runSession waitNS.py" << endl ;
+ tempOutputFile << " ./runSession SALOME_Container 'YACS_Server_'";
+ tempOutputFile << _mpiImpl->rank() << endl ;
+ tempOutputFile << "fi" << endl ;
+ tempOutputFile.flush();
+ tempOutputFile.close();
+ chmod(_TmpFileName.c_str(), 0x1ED);
+ SCRUTE(_TmpFileName.c_str()) ;
+
+ string command;
+ if( _params.protocol == "rsh" )
+ command = "rcp ";
+ else if( _params.protocol == "ssh" )
+ command = "scp ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+
+ command += _TmpFileName;
+ command += " ";
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+ command += _params.hostname;
+ command += ":";
+ command += _dirForTmpFiles ;
+ command += "/runSalome_" ;
+ command += _fileNameToExecute ;
+ command += "_Batch.sh" ;
+ SCRUTE(_fileNameToExecute) ;
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+ RmTmpFile();
+
+ END_OF("BatchManager_PBS::buildSalomeCouplingScript");
+ }
+
+ void BatchManager_PBS::buildSalomeBatchScript( const int nbproc ) throw(SALOME_Exception)
+ {
+ BEGIN_OF("BatchManager_PBS::buildSalomeBatchScript");
+ int status;
+
+ int nbmaxproc = _params.nbnodes * _params.nbprocpernode;
+ if( nbproc > nbmaxproc ){
+ MESSAGE(nbproc << " processors asked on a cluster of " << nbmaxproc << " processors");
+ throw SALOME_Exception("Too much processors asked for that cluster");
+ }
+
+ int nbnodes;
+ if( nbproc < _params.nbnodes )
+ nbnodes = nbproc;
+ else
+ nbnodes = _params.nbnodes;
+
+ _TmpFileName = BuildTemporaryFileName();
+ ofstream tempOutputFile;
+ tempOutputFile.open(_TmpFileName.c_str(), ofstream::out );
+
+ ostringstream filenameToExecute;
+ filenameToExecute << " ~/" << _dirForTmpFiles << "/runSalome_" << _fileNameToExecute << "_Batch.sh";
+
+ tempOutputFile << "#! /bin/sh -f" << endl ;
+ tempOutputFile << "#PBS -l nodes=" << nbnodes << endl ;
+ tempOutputFile << "#PBS -o ~/" << _dirForTmpFiles << "/runSalome.log${PBS_JOBID}" << endl ;
+ tempOutputFile << _mpiImpl->boot("${PBS_NODEFILE}",nbnodes);
+ tempOutputFile << _mpiImpl->run("${PBS_NODEFILE}",nbproc,filenameToExecute.str());
+ tempOutputFile << _mpiImpl->halt();
+ tempOutputFile.flush();
+ tempOutputFile.close();
+ chmod(_TmpFileName.c_str(), 0x1ED);
+ SCRUTE(_TmpFileName.c_str()) ;
+
+ string command;
+ if( _params.protocol == "rsh" )
+ command = "rcp ";
+ else if( _params.protocol == "ssh" )
+ command = "scp ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+ command += _TmpFileName;
+ command += " ";
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+ command += _params.hostname;
+ command += ":";
+ command += _dirForTmpFiles ;
+ command += "/" ;
+ command += _fileNameToExecute ;
+ command += "_Batch.sh" ;
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+
+ RmTmpFile();
+ END_OF("BatchManager_PBS::buildSalomeBatchScript");
+
+ }
+
+ int BatchManager_PBS::submit() throw(SALOME_Exception)
+ {
+ BEGIN_OF("BatchManager_PBS::submit");
+
+ // define name of log file
+ string logFile="/tmp/logs/";
+ logFile += getenv("USER");
+ logFile += "/batchSalome_";
+
+ srand ( time(NULL) );
+ int ir = rand();
+ ostringstream oss;
+ oss << ir;
+ logFile += oss.str();
+ logFile += ".log";
+
+ string command;
+ int status;
+
+ // define command to submit batch
+ if( _params.protocol == "rsh" )
+ command = "rsh ";
+ else if( _params.protocol == "ssh" )
+ command = "ssh ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+
+ command += _params.hostname;
+ command += " \"qsub " ;
+ command += _dirForTmpFiles ;
+ command += "/" ;
+ command += _fileNameToExecute ;
+ command += "_Batch.sh\" > ";
+ command += logFile;
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+
+ // read id of submitted job in log file
+ char line[128];
+ FILE *fp = fopen(logFile.c_str(),"r");
+ fgets( line, 128, fp);
+ fclose(fp);
+
+ string sline(line);
+ int pos = sline.find(".");
+ string strjob;
+ if(pos == string::npos)
+ strjob = sline;
+ else
+ strjob = sline.substr(0,pos);
+
+ int id;
+ istringstream iss(strjob);
+ iss >> id;
+
+ END_OF("BatchManager_PBS::submit");
+ return id;
+ }
+
+}
--- /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
+//
+/*
+ * BatchManager.hxx :
+ *
+ * Auteur : Bernard SECHER - CEA/DEN
+ * Date : Juillet 2007
+ * Projet : SALOME
+ *
+ */
+
+#ifndef _BL_BATCHMANAGER_PBS_H_
+#define _BL_BATCHMANAGER_PBS_H_
+
+#include <string>
+#include "Utils_SALOME_Exception.hxx"
+#include "BatchLight_BatchManager.hxx"
+
+namespace BatchLight {
+
+ class Job;
+
+ class BatchManager_PBS : public BatchManager
+ {
+ public:
+ // Constructeur et destructeur
+ BatchManager_PBS(const batchParams& p) throw(SALOME_Exception); // connexion a la machine host
+ virtual ~BatchManager_PBS();
+
+ // Methodes pour le controle des jobs : virtuelles pures
+ void deleteJob(const int & jobid); // retire un job du gestionnaire
+ std::string queryJob(const int & jobid); // renvoie l'etat du job
+
+ private:
+ void buildSalomeCouplingScript( const char *fileToExecute ) throw(SALOME_Exception);
+ void buildSalomeBatchScript( const int nbproc ) throw(SALOME_Exception);
+ int submit() throw(SALOME_Exception);
+ };
+
+}
+
+#endif
--- /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
+//
+/*
+ * BatchManager.cxx :
+ *
+ * Auteur : Bernard SECHER - CEA/DEN
+ * Date : Juillet 2007
+ * Projet : SALOME
+ *
+ */
+
+#include "BatchLight_BatchManager_SLURM.hxx"
+#include "utilities.h"
+#include "BatchLight_Job.hxx"
+#include <fstream>
+#include <iostream>
+#include <sstream>
+#include <sys/stat.h>
+
+using namespace std;
+
+namespace BatchLight {
+
+ // Constructeur
+ BatchManager_SLURM::BatchManager_SLURM(const batchParams& p) throw(SALOME_Exception) : BatchManager(p)
+ {
+ }
+
+ // Destructeur
+ BatchManager_SLURM::~BatchManager_SLURM()
+ {
+ MESSAGE("BatchManager_SLURM destructor "<<_params.hostname);
+ }
+
+ // Methode pour le controle des jobs : retire un job du gestionnaire
+ void BatchManager_SLURM::deleteJob(const int & jobid)
+ {
+ BEGIN_OF("BatchManager_SLURM::deleteJob");
+ string command;
+ int status;
+ ostringstream oss;
+ oss << jobid;
+
+ // define command to submit batch
+ if( _params.protocol == "rsh" )
+ command = "rsh ";
+ else if( _params.protocol == "ssh" )
+ command = "ssh ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+
+ command += _params.hostname;
+ command += " \"bkill " ;
+ command += oss.str();
+ command += "\"";
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+
+ MESSAGE("jobId = " << jobid << "killed");
+ END_OF("BatchManager_SLURM::deleteJob");
+ }
+
+ // Methode pour le controle des jobs : renvoie l'etat du job
+ string BatchManager_SLURM::queryJob(const int & jobid)
+ {
+ BEGIN_OF("BatchManager_SLURM::queryJob");
+ // define name of log file
+ string logFile="/tmp/logs/";
+ logFile += getenv("USER");
+ logFile += "/batchSalome_";
+
+ srand ( time(NULL) );
+ int ir = rand();
+ ostringstream oss;
+ oss << ir;
+ logFile += oss.str();
+ logFile += ".log";
+
+ string command;
+ int status;
+
+ // define command to submit batch
+ if( _params.protocol == "rsh" )
+ command = "rsh ";
+ else if( _params.protocol == "ssh" )
+ command = "ssh ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+
+ command += _params.hostname;
+ command += " \"bjobs " ;
+ ostringstream oss2;
+ oss2 << jobid;
+ command += oss2.str();
+ command += "\" > ";
+ command += logFile;
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+
+ // read staus of job in log file
+ char line[128];
+ ifstream fp(logFile.c_str(),ios::in);
+ fp.getline(line,80,'\n');
+
+ string sjobid, username, jstatus;
+ fp >> sjobid;
+ fp >> username;
+ fp >> jstatus;
+
+ MESSAGE("jobId = " << jobid << " " << jstatus);
+ END_OF("BatchManager_SLURM::queryJob");
+ return jstatus;
+ }
+
+ void BatchManager_SLURM::buildSalomeCouplingScript( const char *fileToExecute ) throw(SALOME_Exception)
+ {
+ BEGIN_OF("BatchManager_SLURM::buildSalomeCouplingScript");
+ int status;
+
+ string::size_type p1 = string(fileToExecute).find_last_of("/");
+ string::size_type p2 = string(fileToExecute).find_last_of(".");
+ _fileNameToExecute = string(fileToExecute).substr(p1+1,p2-p1-1);
+
+ _TmpFileName = BuildTemporaryFileName();
+ ofstream tempOutputFile;
+ tempOutputFile.open(_TmpFileName.c_str(), ofstream::out );
+ tempOutputFile << "#! /bin/sh -f" << endl ;
+ tempOutputFile << "cd " ;
+ tempOutputFile << _params.applipath << endl ;
+ tempOutputFile << "export PYTHONPATH=~/" ;
+ tempOutputFile << _dirForTmpFiles ;
+ tempOutputFile << ":$PYTHONPATH" << endl ;
+ tempOutputFile << "if test $SLURM_PROCID = 0; then" << endl ;
+ tempOutputFile << " ./runAppli --terminal --modules=" ;
+ for ( int i = 0 ; i < _params.modulesList.size() ; i++ ) {
+ tempOutputFile << _params.modulesList[i] ;
+ if ( i != _params.modulesList.size()-1 )
+ tempOutputFile << "," ;
+ }
+ tempOutputFile << " --standalone=registry,study,moduleCatalog --killall &" << endl ;
+ tempOutputFile << " for ((ip=1; ip < ${SLURM_NPROCS} ; ip++))" << endl;
+ tempOutputFile << " do" << endl ;
+ tempOutputFile << " arglist=\"$arglist YACS_Server_\"$ip" << endl ;
+ tempOutputFile << " done" << endl ;
+ tempOutputFile << " ./runSession waitNS.sh" << endl ;
+ tempOutputFile << " ./runSession waitContainers.py $arglist" << endl ;
+ tempOutputFile << " ./runSession python ~/" << _dirForTmpFiles << "/" << _fileNameToExecute << ".py" << endl;
+ tempOutputFile << " ./runSession killCurrentPort" << endl;
+ tempOutputFile << "else" << endl ;
+ tempOutputFile << " ./runSession waitNS.sh" << endl ;
+ tempOutputFile << " ./runSession SALOME_Container 'YACS_Server_'${SLURM_PROCID}" << endl ;
+ tempOutputFile << "fi" << endl ;
+ tempOutputFile.flush();
+ tempOutputFile.close();
+ chmod(_TmpFileName.c_str(), 0x1ED);
+ SCRUTE(_TmpFileName.c_str()) ;
+
+ string command;
+ if( _params.protocol == "rsh" )
+ command = "rcp ";
+ else if( _params.protocol == "ssh" )
+ command = "scp ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+
+ command += _TmpFileName;
+ command += " ";
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+ command += _params.hostname;
+ command += ":";
+ command += _dirForTmpFiles ;
+ command += "/runSalome_" ;
+ command += _fileNameToExecute ;
+ command += "_Batch.sh" ;
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+ RmTmpFile();
+
+ END_OF("BatchManager_SLURM::buildSalomeCouplingScript");
+ }
+
+ void BatchManager_SLURM::buildSalomeBatchScript( const int nbproc ) throw(SALOME_Exception)
+ {
+ BEGIN_OF("BatchManager_SLURM::buildSalomeBatchScript");
+ int status;
+ _TmpFileName = BuildTemporaryFileName();
+ ofstream tempOutputFile;
+ tempOutputFile.open(_TmpFileName.c_str(), ofstream::out );
+
+ tempOutputFile << "#! /bin/sh -f" << endl ;
+ tempOutputFile << "#BSUB -n " << nbproc << endl ;
+ tempOutputFile << "#BSUB -o " << _dirForTmpFiles << "/runSalome.log%J" << endl ;
+ tempOutputFile << "mpirun -srun ~/" << _dirForTmpFiles << "/runSalome_" << _fileNameToExecute << "_Batch.sh" << endl ;
+ tempOutputFile.flush();
+ tempOutputFile.close();
+ chmod(_TmpFileName.c_str(), 0x1ED);
+ SCRUTE(_TmpFileName.c_str()) ;
+
+ string command;
+ if( _params.protocol == "rsh" )
+ command = "rcp ";
+ else if( _params.protocol == "ssh" )
+ command = "scp ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+ command += _TmpFileName;
+ command += " ";
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+ command += _params.hostname;
+ command += ":";
+ command += _dirForTmpFiles ;
+ command += "/" ;
+ command += _fileNameToExecute ;
+ command += "_Batch.sh" ;
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+
+ RmTmpFile();
+ END_OF("BatchManager_SLURM::buildSalomeBatchScript");
+
+ }
+
+ int BatchManager_SLURM::submit() throw(SALOME_Exception)
+ {
+ BEGIN_OF("BatchManager_SLURM::submit");
+
+ // define name of log file
+ string logFile="/tmp/logs/";
+ logFile += getenv("USER");
+ logFile += "/batchSalome_";
+
+ srand ( time(NULL) );
+ int ir = rand();
+ ostringstream oss;
+ oss << ir;
+ logFile += oss.str();
+ logFile += ".log";
+
+ string command;
+ int status;
+
+ // define command to submit batch
+ if( _params.protocol == "rsh" )
+ command = "rsh ";
+ else if( _params.protocol == "ssh" )
+ command = "ssh ";
+ else
+ throw SALOME_Exception("Unknown protocol");
+
+ if (_params.username != ""){
+ command += _params.username;
+ command += "@";
+ }
+
+ command += _params.hostname;
+ command += " \"bsub < " ;
+ command += _dirForTmpFiles ;
+ command += "/" ;
+ command += _fileNameToExecute ;
+ command += "_Batch.sh\" > ";
+ command += logFile;
+ SCRUTE(command.c_str());
+ status = system(command.c_str());
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+
+ // read id of submitted job in log file
+ char line[128];
+ FILE *fp = fopen(logFile.c_str(),"r");
+ fgets( line, 128, fp);
+ fclose(fp);
+
+ string sline(line);
+ int p1 = sline.find("<");
+ int p2 = sline.find(">");
+ string strjob = sline.substr(p1+1,p2-p1-1);
+
+ int id;
+ istringstream iss(strjob);
+ iss >> id;
+
+ END_OF("BatchManager_SLURM::submit");
+ return id;
+ }
+
+}
--- /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
+//
+/*
+ * BatchManager.hxx :
+ *
+ * Auteur : Bernard SECHER - CEA/DEN
+ * Date : Juillet 2007
+ * Projet : SALOME
+ *
+ */
+
+#ifndef _BL_BATCHMANAGER_SLURM_H_
+#define _BL_BATCHMANAGER_SLURM_H_
+
+#include <string>
+#include "Utils_SALOME_Exception.hxx"
+#include "BatchLight_BatchManager.hxx"
+
+namespace BatchLight {
+
+ class Job;
+
+ class BatchManager_SLURM : public BatchManager
+ {
+ public:
+ // Constructeur et destructeur
+ BatchManager_SLURM(const batchParams& p) throw(SALOME_Exception); // connexion a la machine host
+ virtual ~BatchManager_SLURM();
+
+ // Methodes pour le controle des jobs : virtuelles pures
+ void deleteJob(const int & jobid); // retire un job du gestionnaire
+ std::string queryJob(const int & jobid); // renvoie l'etat du job
+
+ protected:
+ void buildSalomeCouplingScript( const char *fileToExecute ) throw(SALOME_Exception);
+ void buildSalomeBatchScript( const int nbproc ) throw(SALOME_Exception);
+ int submit() throw(SALOME_Exception);
+
+ private:
+
+ };
+
+}
+
+#endif
--- /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
+//
+/*
+ * Job.cxx :
+ *
+ * Auteur : Bernard SECHER - CEA/DEN
+ * Date : Juillet 2007
+ * Projet : SALOME
+ *
+ */
+
+#include "BatchLight_Job.hxx"
+using namespace std;
+
+namespace BatchLight {
+
+ // Constructeur
+ Job::Job(const char *fileToExecute, const Engines::FilesList& filesToExport, const Engines::FilesList& filesToImport, const int nbproc) : _fileToExecute(fileToExecute), _filesToExport(filesToExport), _filesToImport(filesToImport), _nbproc(nbproc)
+ {
+ // Nothing to do
+ }
+
+ Job::~Job()
+ {
+ MESSAGE("Job destructor");
+ }
+
+}
--- /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
+//
+/*
+ * Job.hxx :
+ *
+ * Auteur : Bernard SECHER - CEA/DEN
+ * Date : Juillet 2007
+ * Projet : SALOME
+ *
+ */
+
+#ifndef _BL_JOB_H_
+#define _BL_JOB_H_
+
+#include "utilities.h"
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
+
+namespace BatchLight {
+
+ class Job
+ {
+ public:
+ // Constructeurs et destructeur
+ Job(const char *fileToExecute, const Engines::FilesList& filesToExport, const Engines::FilesList& filesToImport, const int nbproc);
+ virtual ~Job();
+
+ const char *getFileToExecute() const { return _fileToExecute; }
+ const Engines::FilesList getFilesToExportList() const { return _filesToExport; }
+ const Engines::FilesList getFilesToImportList() const { return _filesToImport; }
+ const int getNbProc() const { return _nbproc; }
+
+ protected:
+ const char* _fileToExecute;
+ const Engines::FilesList _filesToExport;
+ const Engines::FilesList _filesToImport;
+ const int _nbproc;
+
+ private:
+
+ };
+
+}
+
+#endif
Batch_PyVersatile.hxx \
Batch_RunTimeException.hxx \
Batch_StringType.hxx \
- Batch_TypeMismatchException.hxx
+ Batch_TypeMismatchException.hxx \
+ BatchLight_BatchManager.hxx \
+ BatchLight_BatchManager_PBS.hxx \
+ BatchLight_BatchManager_SLURM.hxx \
+ BatchLight_Job.hxx \
+ MpiImpl.hxx
LIB_SRC = \
Batch_PyVersatile.cxx \
Batch_RunTimeException.cxx \
Batch_StringType.cxx \
- Batch_TypeMismatchException.cxx
+ Batch_TypeMismatchException.cxx \
+ BatchLight_BatchManager.cxx \
+ BatchLight_BatchManager_SLURM.cxx \
+ BatchLight_BatchManager_PBS.cxx \
+ BatchLight_Job.cxx \
+ MpiImpl.cxx
LIB_CPPFLAGS = \
@PYTHON_INCLUDES@ \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
+ -I$(srcdir)/../Utils \
-I$(top_builddir)/salome_adm/unix \
- $(LIB_CPPFLAGS)
+ -I$(top_builddir)/idl \
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ $(LIB_CPPFLAGS)
libSalomeBatch_la_LDFLAGS = -no-undefined -version-info=0:0:0
libSalomeBatch_la_LIBADD = \
--- /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
+//
+/*
+ * BatchManager.cxx :
+ *
+ * Auteur : Bernard SECHER - CEA/DEN
+ * Date : Juillet 2007
+ * Projet : SALOME
+ *
+ */
+
+#include <iostream>
+#include <sstream>
+#include <string>
+#include "utilities.h"
+#include "MpiImpl.hxx"
+
+using namespace std;
+
+// Constructor
+MpiImpl::MpiImpl()
+{
+ MESSAGE("MpiImpl constructor");
+}
+
+// Destructor
+MpiImpl::~MpiImpl()
+{
+ MESSAGE("MpiImpl destructor");
+}
+
+// lam implementation
+// Constructor
+MpiImpl_LAM::MpiImpl_LAM() : MpiImpl()
+{
+}
+
+// Destructor
+MpiImpl_LAM::~MpiImpl_LAM()
+{
+ MESSAGE("MpiImpl_LAM destructor");
+}
+
+string MpiImpl_LAM::size()
+{
+ return "${LAMWORLD}";
+}
+
+string MpiImpl_LAM::rank()
+{
+ return "${LAMRANK}";
+}
+
+string MpiImpl_LAM::boot(const string machinefile, const unsigned int nbnodes)
+{
+ ostringstream oss;
+ oss << "lamboot " << machinefile << endl;
+ return oss.str();
+}
+
+string MpiImpl_LAM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
+{
+ ostringstream oss;
+ oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
+ return oss.str();
+}
+
+string MpiImpl_LAM::halt()
+{
+ ostringstream oss;
+ oss << "lamhalt" << endl;
+ return oss.str();
+}
+
+// mpich1 implementation
+// Constructor
+MpiImpl_MPICH1::MpiImpl_MPICH1() : MpiImpl()
+{
+}
+
+// Destructor
+MpiImpl_MPICH1::~MpiImpl_MPICH1()
+{
+ MESSAGE("MpiImpl_MPICH1 destructor");
+}
+
+string MpiImpl_MPICH1::size()
+{
+ throw SALOME_Exception("mpich1 doesn't work with this batch system to submit salome session");
+}
+
+string MpiImpl_MPICH1::rank()
+{
+ throw SALOME_Exception("mpich1 doesn't work with this batch system to submit salome session");
+}
+
+string MpiImpl_MPICH1::boot(const string machinefile, const unsigned int nbnodes)
+{
+ return "";
+}
+
+string MpiImpl_MPICH1::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
+{
+ ostringstream oss;
+ oss << "mpirun -machinefile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
+ return oss.str();
+}
+
+string MpiImpl_MPICH1::halt()
+{
+ return "";
+}
+
+// mpich2 implementation
+// Constructor
+MpiImpl_MPICH2::MpiImpl_MPICH2() : MpiImpl()
+{
+}
+
+// Destructor
+MpiImpl_MPICH2::~MpiImpl_MPICH2()
+{
+ MESSAGE("MpiImpl_MPICH2 destructor");
+}
+
+string MpiImpl_MPICH2::size()
+{
+ return "${PMI_SIZE}";
+}
+
+string MpiImpl_MPICH2::rank()
+{
+ return "${PMI_RANK}";
+}
+
+string MpiImpl_MPICH2::boot(const string machinefile, const unsigned int nbnodes)
+{
+ ostringstream oss;
+ oss << "mpdboot -n " << nbnodes << " -f " << machinefile << endl;
+ return oss.str();
+}
+
+string MpiImpl_MPICH2::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
+{
+ ostringstream oss;
+ oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
+ return oss.str();
+}
+
+string MpiImpl_MPICH2::halt()
+{
+ ostringstream oss;
+ oss << "mpdallexit" << endl;
+ return oss.str();
+}
+
+// openmpi implementation
+// Constructor
+MpiImpl_OPENMPI::MpiImpl_OPENMPI() : MpiImpl()
+{
+}
+
+// Destructor
+MpiImpl_OPENMPI::~MpiImpl_OPENMPI()
+{
+ MESSAGE("MpiImpl_OPENMPI destructor");
+}
+
+string MpiImpl_OPENMPI::size()
+{
+ return "${OMPI_MCA_ns_nds_num_procs}";
+}
+
+string MpiImpl_OPENMPI::rank()
+{
+ return "${OMPI_MCA_ns_nds_vpid}";
+}
+
+string MpiImpl_OPENMPI::boot(const string machinefile, const unsigned int nbnodes)
+{
+ return "";
+}
+
+string MpiImpl_OPENMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
+{
+ ostringstream oss;
+ oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
+ return oss.str();
+}
+
+string MpiImpl_OPENMPI::halt()
+{
+ return "";
+}
+
--- /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
+//
+/*
+ * BatchManager.hxx :
+ *
+ * Auteur : Bernard SECHER - CEA/DEN
+ * Date : Juillet 2007
+ * Projet : SALOME
+ *
+ */
+
+#ifndef _BL_MPIIMPL_H_
+#define _BL_MPIIMPL_H_
+
+#include <string>
+#include "Utils_SALOME_Exception.hxx"
+#include <SALOMEconfig.h>
+
+class MpiImpl
+{
+public:
+ // Constructeur et destructeur
+ MpiImpl(); // constrcuctor
+ virtual ~MpiImpl(); //Destructor
+
+ virtual std::string size() = 0; // get number of process of current job
+ virtual std::string rank() = 0; // get process number of current job
+ virtual std::string boot(const std::string machinefile, const unsigned int nbnodes) = 0; // get boot command
+ virtual std::string run(const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute) = 0; // get run command
+ virtual std::string halt() = 0; // get stop command
+
+protected:
+
+private:
+
+};
+
+class MpiImpl_LAM : public MpiImpl
+{
+public:
+ // Constructeur et destructeur
+ MpiImpl_LAM(); // constructor
+ virtual ~MpiImpl_LAM(); //Destructor
+
+ std::string size(); // get number of process of current job
+ std::string rank(); // get process number of current job
+ std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
+ std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
+ std::string halt(); // get stop command
+
+protected:
+
+private:
+
+};
+
+class MpiImpl_MPICH1 : public MpiImpl
+{
+public:
+ // Constructeur et destructeur
+ MpiImpl_MPICH1(); // constructor
+ virtual ~MpiImpl_MPICH1(); //Destructor
+
+ std::string size(); // get number of process of current job
+ std::string rank(); // get process number of current job
+ std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
+ std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
+ std::string halt(); // get stop command
+
+protected:
+
+private:
+
+};
+
+class MpiImpl_MPICH2 : public MpiImpl
+{
+public:
+ // Constructeur et destructeur
+ MpiImpl_MPICH2(); // constructor
+ virtual ~MpiImpl_MPICH2(); //Destructor
+
+ std::string size(); // get number of process of current job
+ std::string rank(); // get process number of current job
+ std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
+ std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
+ std::string halt(); // get stop command
+
+protected:
+
+private:
+
+};
+
+class MpiImpl_OPENMPI : public MpiImpl
+{
+public:
+ // Constructeur et destructeur
+ MpiImpl_OPENMPI(); // constructor
+ virtual ~MpiImpl_OPENMPI(); //Destructor
+
+ std::string size(); // get number of process of current job
+ std::string rank(); // get process number of current job
+ std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
+ std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
+ std::string halt(); // get stop command
+
+protected:
+
+private:
+
+};
+
+#endif
+++ /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 _CASCatch_HeaderFile
-#define _CASCatch_HeaderFile
-
-#include <Standard_Failure.hxx>
-#include <Standard_ErrorHandler.hxx>
-
-
-#ifdef try
-# undef try
-#endif
-
-#ifdef catch
-# undef catch
-#endif
-
-#ifdef NO_CXX_EXCEPTION
-# if defined(DO_ABORT)
-# define CASCatch_TRY \
- Standard_ErrorHandler _Function; \
- K_SETJMP = 1 ; \
- if(DoesNotAbort(_Function))
-# else //If DO_ABORT is not defined
-# define CASCatch_TRY \
- Standard_ErrorHandler _Function; \
- if(DoesNotAbort(_Function))
-# endif //DO_ABORT
-# define CASCatch_CATCH(Error) \
- else if(_Function.Catches(STANDARD_TYPE(Error)))
-#else
-# define CASCatch_TRY try
-# define CASCatch_CATCH catch
-#endif //NO_CXX_EXCEPTION
-
-
-#endif
+++ /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
-//
-#include "CASCatch_CatchSignals.hxx"
-
-#include "CASCatch_Failure.hxx"
-#include "CASCatch_ErrorHandler.hxx"
-#include <TCollection_AsciiString.hxx>
-
-#define MAX_HANDLER_NUMBER 6
-
-
-//================================================================================
-/*! Public -
- * \brief creates a CASCatch_CatchSignals
- */
-//================================================================================
-CASCatch_CatchSignals::CASCatch_CatchSignals()
- :myIsActivated(Standard_False)
-{
-
- Standard_Integer i = 0;
- for(; i<=MAX_HANDLER_NUMBER; i++)
- mySigStates[i] = NULL;
-}
-
-#ifndef WNT
-
-//================================ UNIX part ==================================================
-
-#include <OSD.hxx>
-#include <OSD_WhoAmI.hxx>
-#include <OSD_SIGHUP.hxx>
-#include <OSD_SIGINT.hxx>
-#include <OSD_SIGQUIT.hxx>
-#include <OSD_SIGILL.hxx>
-#include <OSD_SIGKILL.hxx>
-#include <OSD_SIGBUS.hxx>
-#include <OSD_SIGSEGV.hxx>
-#include <OSD_SIGSYS.hxx>
-#ifndef LIN
-#include <exception.h>
-#endif
-
-//==============================
-typedef void (ACT_SIGIO_HANDLER)(void) ;
-
-ACT_SIGIO_HANDLER *ADR_ACT_SIGIO_HANDLER = NULL ;
-
-typedef void (* SIG_PFV) (int);
-
-#ifdef SUN
-# include <floatingpoint.h>
-#endif
-
-#ifdef SOLARIS
-# include <floatingpoint.h>
-# include <sys/machsig.h>
-# include <stdlib.h>
-# include <stdio.h>
-#endif
-
-#include <signal.h>
-#include <sys/signal.h>
-
-#ifdef LIN
-# include <stdlib.h>
-# include <stdio.h>
-#else
-# ifdef SA_SIGINFO
-# ifndef AIX
-# include <sys/siginfo.h>
-# endif
-# endif
-#endif
-
-
-#ifdef IRIX
-# include <sigfpe.h>
-# include <sys/siginfo.h>
-#endif
-
-
-//================================================================================
-/*! Private -
- * \brief universal handler for signals
- */
-//================================================================================
-static void Handler(const OSD_Signals theSig, const OSD_Signals)
-{
- sigset_t set;
- sigemptyset(&set);
- sigaddset(&set, theSig);
- sigprocmask(SIG_UNBLOCK, &set, NULL) ;
-
- TCollection_AsciiString aMessage(theSig);
- aMessage+=" signal detected";
-
- CASCatch_Failure::Raise(aMessage.ToCString());
-}
-
-
-#ifdef SA_SIGINFO
-//================================================================================
-/*! Private -
- * \brief handler for SIGSEGV signal
- */
-//================================================================================
-static void SegvHandler(const OSD_Signals, const Standard_Address, const Standard_Address)
-{
- sigset_t set;
- sigemptyset(&set);
- sigaddset(&set, SIGSEGV);
- sigprocmask (SIG_UNBLOCK, &set, NULL);
-
- CASCatch_Failure::Raise("SIGSEGV detected");
-}
-#endif
-
-
-//================================================================================
-/*! Public -
- * \brief activates a signals handling
- */
-//================================================================================
-void CASCatch_CatchSignals::Activate()
-{
- if(myIsActivated) return;
-
- struct sigaction act;
-
- Standard_Integer i = 0;
- for(; i<=MAX_HANDLER_NUMBER; i++)
- mySigStates[i] = new struct sigaction(); //Initialize structures
-
- int stat;
- act.sa_handler = (SIG_PFV) &Handler ;
- sigemptyset(&act.sa_mask) ;
-
-
- stat = sigaction(SIGHUP,&act,(struct sigaction*)mySigStates[0]); // ...... hangup
- stat = sigaction(SIGFPE,&act,(struct sigaction*) mySigStates[1]); // ...... floating point exception
- stat = sigaction(SIGINT,&act,(struct sigaction*)mySigStates[2]); // ...... interrupt
- stat = sigaction(SIGQUIT,&act,(struct sigaction*)mySigStates[3]); // ...... quit
- stat = sigaction(SIGBUS,&act,(struct sigaction*)mySigStates[4]); // ...... bus error
- stat = sigaction(SIGILL,&act,(struct sigaction*)mySigStates[5]); // ...... illegal instruction
-
-#ifdef SA_RESTART
- act.sa_flags = SA_RESTART ;
-#else
- act.sa_flags = 0 ;
-#endif
- act.sa_handler = (SIG_PFV) &SegvHandler ;
-
-#ifdef SA_SIGINFO // OSF,SOLARIS,IRIX
- act.sa_flags = act.sa_flags | SA_SIGINFO ;
-# ifdef SOLARIS
- act.sa_sigaction = (void(*)(int, siginfo_t *, void*)) &SegvHandler ;
-# endif
-#endif
-
- stat = sigaction( SIGSEGV , &act , (struct sigaction*)mySigStates[6]); // ...... segmentation violation
-
- myIsActivated = Standard_True;
-}
-
-
-//================================================================================
-/*! Public -
- * \brief deactivates a signals handling
- */
-//================================================================================
-void CASCatch_CatchSignals::Deactivate()
-{
- if(!myIsActivated) return;
-
- struct sigaction oact;
- int stat;
-
- stat = sigaction(SIGHUP,(struct sigaction*)mySigStates[0],&oact); // ...... hangup
- stat = sigaction(SIGFPE,(struct sigaction*)mySigStates[1],&oact); // ...... floating point exception
- stat = sigaction(SIGINT,(struct sigaction*)mySigStates[2],&oact); // ...... interrupt
- stat = sigaction(SIGQUIT,(struct sigaction*)mySigStates[3],&oact); // ...... quit
- stat = sigaction(SIGBUS,(struct sigaction*)mySigStates[4],&oact); // ...... bus error
- stat = sigaction(SIGILL,(struct sigaction*)mySigStates[5],&oact); // ...... illegal instruction
- stat = sigaction(SIGSEGV,(struct sigaction*)mySigStates[6],&oact); // ...... segmentation violation
-
-
- Standard_Integer i = 0;
- for(; i<=MAX_HANDLER_NUMBER; i++)
- delete (struct sigaction*)mySigStates[i];
-
- myIsActivated = Standard_False;
-}
-
-
-
-#else
-//====================================== WNT part ====================================================
-#include <OSD_WNT_1.hxx>
-
-#include <process.h>
-#include <signal.h>
-#include <float.h>
-
-#define _OSD_FPX ( _EM_DENORMAL | _EM_INEXACT | _EM_UNDERFLOW | _EM_ZERODIVIDE | _EM_OVERFLOW) //Mask these exceptions
-
-//================================================================================
-/*! Private -
- * \brief handler for unexpected exceptions
- */
-//================================================================================
-static Standard_Integer WntHandler(const Standard_Address theExceptionInfo)
-{
- LPEXCEPTION_POINTERS lpXP = ( LPEXCEPTION_POINTERS )theExceptionInfo;
- DWORD dwExceptionCode = lpXP -> ExceptionRecord -> ExceptionCode;
-
- TCollection_AsciiString aMessage((Standard_Integer)dwExceptionCode);
- aMessage+=" Exception code - unexpected exception";
-
- CASCatch_Failure::Raise(aMessage.ToCString());
-
- return EXCEPTION_EXECUTE_HANDLER;
-}
-
-void SIGWntHandler(int , int ) ;
-static void (*SIGWNTHANDLER)(int) = ( void (*)(int) ) ( &SIGWntHandler ) ;
-
-
-//================================================================================
-/*! Private -
- * \brief handler for signals
- */
-//================================================================================
-static void SIGWntHandler(const int signum , const int theCode)
-{
-
- void (*OLDSIGWNTHANDLER)(int) ;
- switch( signum ) {
- case SIGFPE :
- _fpreset() ;
- _clearfp() ;
- _controlfp ( _OSD_FPX, _MCW_EM );
- OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER );
-
- if(theCode == _FPE_UNDERFLOW || theCode == _FPE_INEXACT) return;
- CASCatch_Failure::Raise ("Floating point error");
- break;
- case SIGSEGV :
- OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER );
- CASCatch_Failure::Raise("Access violation");
- break;
- case SIGILL :
- OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER );
- CASCatch_Failure::Raise("Illegal instruction" );
- break;
- }
-}
-
-
-//================================================================================
-/*! Public -
- * \brief activates a signals handling
- */
-//================================================================================
-void CASCatch_CatchSignals::Activate()
-{
- if(myIsActivated) return;
-
- mySigStates[0] = SetUnhandledExceptionFilter (( LPTOP_LEVEL_EXCEPTION_FILTER )&WntHandler);
-
- myFloatOpWord = _controlfp(0, 0);
- _controlfp ( _OSD_FPX, _MCW_EM ); //Enable floating point exceptions
-
- mySigStates[1] = signal( SIGSEGV , SIGWNTHANDLER );
- mySigStates[2] = signal( SIGFPE , SIGWNTHANDLER );
- mySigStates[3] = signal( SIGILL , SIGWNTHANDLER );
-
- myIsActivated = Standard_True;
-}
-
-//================================================================================
-/*! Public -
- * \brief deactivates a signals handling
- */
-//================================================================================
-void CASCatch_CatchSignals::Deactivate()
-{
- if(!myIsActivated) return;
-
- SetUnhandledExceptionFilter (( LPTOP_LEVEL_EXCEPTION_FILTER )mySigStates[0]);
-
- _controlfp ( myFloatOpWord, _MCW_EM );
-
- signal( SIGSEGV , ( void (*)(int) )mySigStates[1]);
- signal( SIGFPE , ( void (*)(int) )mySigStates[2]);
- signal( SIGILL , ( void (*)(int) )mySigStates[3]);
-
- Standard_Integer i = 0;
- for(; i<=MAX_HANDLER_NUMBER; i++)
- mySigStates[i] = NULL;
-
- myIsActivated = Standard_False;
-}
-
-#endif
-
-//================================================================================
-/*! Private -
- * \brief deactivates a signals handling
- */
-//================================================================================
-void CASCatch_CatchSignals::Destroy()
-{
- if(myIsActivated) Deactivate();
-}
-
+++ /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 _CASCatch_CatchSignals_HeaderFile
-#define _CASCatch_CatchSignals_HeaderFile
-
-#include <Standard.hxx>
-
-/*!
- * \class CASCatch_CatchSignals
- * \brief This class controls an exception handling
- *
- */
-class CASCatch_CatchSignals {
-
-public:
-
- // Methods PUBLIC
- //
-Standard_EXPORT CASCatch_CatchSignals();
-Standard_EXPORT void Destroy() ;
-~CASCatch_CatchSignals() { Destroy(); }
-Standard_EXPORT void Activate() ;
-Standard_EXPORT void Deactivate() ;
-
-private:
-
-/*!\var mySigStates[7], private
- * \brief stores signals' handler functions
- */
-Standard_Address mySigStates[7];
-
-/*!\var myFloatOpWord
- * \brief stores a float operation word, private
- */
-Standard_Integer myFloatOpWord;
-
-/*!\var myIsActivated
- * \brief stores a flag whether a catcher is activated, private]
- */
-Standard_Boolean myIsActivated;
-
-};
-
-
-#endif
+++ /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
-//
-
-#ifdef NO_CXX_EXCEPTION
-
-#include "CASCatch_ErrorHandler.hxx"
-
-// During setjmp()/longjmp() K_SETJMP_CASCatch is non zero (try)
-// So if there is an abort request and if K_SETJMP_CASCatch is non zero, the abort
-// request will be ignored. If the abort request do a raise during a setjmp
-// or a longjmp, there will be a "terminating SEGV" impossible to handle.
-
-
-Standard_EXPORT int K_SETJMP_CASCatch = 0 ;
-
-static Handle(CASCatch_Failure) GlbError; //Last caught Error, Null if there is no error
-
-static CASCatch_ErrorHandler* Top = 0; //The top of the Errors Stack
-
-//=======================================================================
-//function : CASCatch_ErrorHandler
-//purpose : Constructor
-//=======================================================================
-CASCatch_ErrorHandler::CASCatch_ErrorHandler ()
-{
- Previous = Top;
- Top = this;
- CaughtError.Nullify();
- GlbError.Nullify();
-}
-
-//=======================================================================
-//function : ~CASCatch_ErrorHandler
-//purpose : Destructor : Delete the ErrorHandler and Abort if there is a 'Error'.
-//=======================================================================
-CASCatch_ErrorHandler::~CASCatch_ErrorHandler()
-{
- Top = Top->Previous;
- if( !GlbError.IsNull() ) Abort();
-}
-
-//=======================================================================
-//function : Abort: make a longjmp to the saved Context.
-//purpose : Abort if there is a non null 'Error'
-//=======================================================================
-void CASCatch_ErrorHandler::Abort ()
-{
- //==== Check if can do the "longjmp" =======================================
- if(Top == NULL || Top->Label == NULL) {
- cout << "*** Abort *** an exception was raised, but no catch was found." << endl;
- cout << "\t... The exception is:" << GlbError;
- exit(1);
- }
-
-#ifdef DO_ABORT
- if ( K_SETJMP_CASCatch )
- cout << "Recursive abort ===> Terminating SEGV ..." << endl ;
- K_SETJMP_CASCatch = 1 ;
-#endif
-
- longjmp(Top->Label, Standard_True);
-}
-
-//=======================================================================
-//function : Catches
-//purpose : If there is a 'Error', and it is in good type
-// returns True and clean 'Error', else returns False.
-//=======================================================================
-Standard_Boolean CASCatch_ErrorHandler::Catches
- (const Handle(Standard_Type)& AType)
-{
-#ifdef DO_ABORT
- K_SETJMP_CASCatch = 0 ;
-#endif
- if(GlbError.IsNull())
- return Standard_False;
-
- if(GlbError->IsKind(AType)){
- CaughtError = GlbError;
- GlbError.Nullify();
- return Standard_True;
- } else {
- return Standard_False;
- }
-}
-
-//=======================================================================
-//function : LastCaughtError
-//purpose :
-//=======================================================================
-Handle(CASCatch_Failure) CASCatch_ErrorHandler::LastCaughtError()
-{
- return Top->CaughtError;
-}
-
-//=======================================================================
-//function : Error
-//purpose :
-//=======================================================================
-void CASCatch_ErrorHandler::Error(const Handle(CASCatch_Failure)& aError)
-{
- GlbError = aError;
-}
-
-#endif
+++ /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 _CASCatch_ErrorHandler_HeaderFile
-#define _CASCatch_ErrorHandler_HeaderFile
-
-#include "CASCatch_Failure.hxx"
-
-#include <stdlib.h>
-#include <setjmp.h>
-
-
-extern int K_SETJMP_CASCatch ;
-
-/*!
- * \class CASCatch_ErrorHandler
- * \brief This class is an exception handler, private
- *
- */
-class CASCatch_ErrorHandler
-{
- friend class CASCatch_Failure; // To execute the raise exception.
-
- public:
-
- Standard_EXPORT CASCatch_ErrorHandler();
- Standard_EXPORT ~CASCatch_ErrorHandler();
- Standard_EXPORT Standard_Boolean Catches (const Handle(Standard_Type)&);
-
- private:
- Standard_EXPORT static void Abort();
- Standard_EXPORT static void Error(const Handle(CASCatch_Failure)&);
- Standard_EXPORT static Handle(CASCatch_Failure) LastCaughtError();
-
- //==== The fields ===========================================================
- private:
- CASCatch_ErrorHandler* Previous;
- Handle(CASCatch_Failure) CaughtError;
-
- public:
- jmp_buf Label;
-
-};
-
-#undef CASCatch_TRY
-#define CASCatch_TRY try
-
-#undef CASCatch_CATCH
-#define CASCatch_CATCH catch
-
-
-#ifdef NO_CXX_EXCEPTION
-# undef CASCatch_TRY
-# undef CASCatch_CATCH
-
-# if defined(DO_ABORT)
-
-# define DoesNotAbort_CASCatch(aHandler) !(K_SETJMP_CASCatch = setjmp(aHandler.Label))
-
-# define CASCatch_TRY CASCatch_ErrorHandler _Function; \
- K_SETJMP_CASCatch = 1 ; \
- if(DoesNotAbort_CASCatch(_Function))
-
-# else //If DO_ABORT is not defined
-# define DoesNotAbort_CASCatch(aHandler) !setjmp(aHandler.Label)
-
-# define CASCatch_TRY CASCatch_ErrorHandler _Function; \
- if(DoesNotAbort_CASCatch(_Function))
-# endif //DO_ABORT
-
-
-# define CASCatch_CATCH(Error) else if(_Function.Catches(STANDARD_TYPE(Error)))
-#endif //NO_CXX_EXCEPTION
-
-#endif //_CASCatch_ErrorHandler_HeaderFile
+++ /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
-//
-#include "CASCatch_Failure.hxx"
-#include "CASCatch_ErrorHandler.hxx"
-#include <Standard_TypeMismatch.hxx>
-#include <Standard_Type.hxx>
-#include <string.h>
-
-IMPLEMENT_STANDARD_HANDLE( CASCatch_Failure, Standard_Transient )
-IMPLEMENT_STANDARD_RTTIEXT( CASCatch_Failure, Standard_Transient )
-
-
-#ifndef NO_CXX_EXCEPTION
-static Handle(CASCatch_Failure) RaisedError;
-#endif
-
-//================================================================================
-/*! Public -
- * \brief creates a CASCatch_Failure
- */
-//================================================================================
-CASCatch_Failure::CASCatch_Failure () { myMessage = "Signal detected";}
-
-
-//================================================================================
-/*! Public -
- * \brief creates a CASCatch_Failure with a message
- * \param an exception message
- */
-//================================================================================
-CASCatch_Failure::CASCatch_Failure (const Standard_CString AString)
-{
- if(AString) {
- myMessage = new Standard_Character[strlen(AString) + 1];
- strcpy(myMessage,AString);
- }
-}
-
-//================================================================================
-/*! Public -
- * \brief returns the last caught exception
- */
-//================================================================================
-Handle(CASCatch_Failure) CASCatch_Failure::Caught()
-{
-#ifdef NO_CXX_EXCEPTION
- return CASCatch_ErrorHandler::LastCaughtError();
-#else
- return RaisedError ;
-#endif
-}
-
-//================================================================================
-/*! Public -
- * \brief raises a CASCatch_Failure exception
- * \param an exception message
- */
-//================================================================================
-void CASCatch_Failure::Raise (const Standard_CString AString)
-{
- Handle(CASCatch_Failure) E = new CASCatch_Failure() ;
- E->Reraise (AString) ;
-}
-
-
-//================================================================================
-/*! Public -
- * \brief re-raises a CASCatch_Failure exception
- * \param an exception message
- */
-//================================================================================
-void CASCatch_Failure::Reraise (const Standard_CString AString)
-{
- if(AString){
- myMessage = new Standard_Character[strlen(AString) + 1];
- strcpy(myMessage,AString);
- }
-
-#ifdef NO_CXX_EXCEPTION
- CASCatch_ErrorHandler::Error(this) ;
- CASCatch_ErrorHandler::Abort();
-#else
- RaisedError = this ;
- Throw() ;
-#endif
-}
-
-//================================================================================
-/*! Public -
- * \brief returns an exception message
- */
-//================================================================================
-Standard_CString CASCatch_Failure::GetError() const
-{
- return myMessage;
-}
-
-//================================================================================
-/*! Public -
- * \brief Is called when using standard C++ exceptions
- */
-//================================================================================
-void CASCatch_Failure::Throw() const
-{
-#ifndef NO_CXX_EXCEPTION
- throw CASCatch_Failure() ;
-#endif
-}
-
+++ /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 _CASCATCH_FAILURE_HeaderFile
-#define _CASCATCH_FAILURE_HeaderFile
-
-#include <Standard_Transient.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( CASCatch_Failure, Standard_Transient )
-
-#include <Standard.hxx>
-
-/*!
- * \class CASCatch_Failure
- * \brief This class presents an exception to be thrown
- *
- */
-class CASCatch_Failure : public Standard_Transient
-{
-
-public:
-
-Standard_EXPORT CASCatch_Failure();
-Standard_EXPORT CASCatch_Failure(const Standard_CString aString);
-Standard_EXPORT void Reraise(const Standard_CString aMessage) ;
-Standard_EXPORT Standard_CString GetError() const;
-Standard_EXPORT static Handle_CASCatch_Failure Caught() ;
-Standard_EXPORT static void Raise(const Standard_CString aMessage = "") ;
-Standard_EXPORT virtual void Throw() const;public:
-
-public:
-
-DEFINE_STANDARD_RTTI( CASCatch_Failure )
-
-private:
-/*!\var myMessage
- * \brief stores an exception message
- */
-Standard_CString myMessage;
-
-};
-
-
-#endif
+++ /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 : Makefile.in
-# Author : Sergey RUIN (OCN)
-# Module : SALOME
-
-include $(top_srcdir)/salome_adm/unix/make_common_starter.am
-
-
-salomeinclude_HEADERS = CASCatch.hxx \
- CASCatch_CatchSignals.hxx \
- CASCatch_ErrorHandler.hxx \
- CASCatch_Failure.hxx
-
-lib_LTLIBRARIES = libCASCatch.la
-libCASCatch_la_SOURCES = \
- CASCatch_CatchSignals.cxx \
- CASCatch_ErrorHandler.cxx \
- CASCatch_Failure.cxx
-
-COMMON_CPPFLAGS = \
- @CAS_CPPFLAGS@ @CAS_CXXFLAGS@
-
-libCASCatch_la_CPPFLAGS = $(COMMON_CPPFLAGS)
-libCASCatch_la_LIBADD = $(CAS_KERNEL)
#define COMMUNICATION_EXPORT
#endif
-#endif
\ No newline at end of file
+#endif
#else
#include <sys/timeb.h>
int SIGUSR11 = 1000;
+#include <process.h>
#endif
void Engines_Component_i::ping()
{
+#ifndef WNT
MESSAGE("Engines_Component_i::ping() pid "<< getpid() << " threadid "
<< pthread_self());
+#else
+ MESSAGE("Engines_Component_i::ping() pid "<< _getpid()<< " threadid "
+ << pthread_self().p );
+#endif
}
//=============================================================================
bool Engines_Component_i::Stop_impl()
{
+#ifndef WNT
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
<< 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
+ << dec << " _ThreadId " << _ThreadId );
+#endif
bool RetVal = false ;
bool Engines_Component_i::Suspend_impl()
{
+#ifndef WNT
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
<< 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
+ << dec << " _ThreadId " << _ThreadId );
+#endif
bool RetVal = false ;
#ifndef WNT
bool Engines_Component_i::Resume_impl()
{
+#ifndef WNT
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
<< 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
+ << dec << " _ThreadId " << _ThreadId );
+#endif
bool RetVal = false ;
#ifndef WNT
if ( _ThreadId > 0 && pthread_self() != _ThreadId )
void Engines_Component_i::beginService(const char *serviceName)
{
+#ifndef WNT
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
_ThreadId = pthread_self() ;
#else
(*it).second >>= value;
// ---todo: replace __GNUC__ test by an autoconf macro AC_CHECK_FUNC.
#if defined __GNUC__
- int ret = setenv(cle.c_str(), value, overwrite);
+// int ret = setenv(cle.c_str(), value, overwrite);
+ setenv(cle.c_str(), value, overwrite);
#else
//CCRT porting : setenv not defined in stdlib.h
std::string s(cle);
s+=value;
// char* cast because 1st arg of linux putenv function
// is not a const char* !
- int ret=putenv((char *)s.c_str());
+// int ret=putenv((char *)s.c_str());
+ putenv((char *)s.c_str());
//End of CCRT porting
#endif
MESSAGE("--- setenv: "<<cle<<" = "<< value);
{
if ( !_CanceledThread )
_ThreadCpuUsed = CpuUsed_impl() ;
+
+#ifndef WNT
MESSAGE(pthread_self() << " Send EndService notification for " << serviceName
<< endl << " Component instance : " << _instanceName << " StartUsed "
<< _StartUsed << " _ThreadCpuUsed "<< _ThreadCpuUsed << endl <<endl);
+#else
+ MESSAGE(pthread_self().p << " Send EndService notification for " << serviceName
+ << endl << " Component instance : " << _instanceName << " StartUsed "
+ << _StartUsed << " _ThreadCpuUsed "<< _ThreadCpuUsed << endl <<endl);
+#endif
_ThreadId = 0 ;
}
}
else
{
+#ifndef WNT
MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
<< " pthread_canceled") ;
+#else
+ MESSAGE(pthread_self().p << "Killer : ThreadId " << ThreadId.p
+ << " pthread_canceled") ;
+#endif
}
}
else
}
else
{
- MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
+#ifndef WNT
+ MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
+ << " pthread_killed(" << signum << ")") ;
+#else
+ MESSAGE(pthread_self().p << "Killer : ThreadId " << ThreadId.p
<< " pthread_killed(" << signum << ")") ;
+#endif
}
}
}
CORBA::Boolean isPublished,
CORBA::Boolean& isValidScript)
{
- char* aScript = "def RebuildData(theStudy): pass";
+ const char* aScript = "def RebuildData(theStudy): pass";
char* aBuffer = new char[strlen(aScript)+1];
strcpy(aBuffer, aScript);
CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
isValidScript = true;
return aStreamFile._retn();
}
+
+Engines::Salome_file_ptr
+Engines_Component_i::getInputFileToService(const char* service_name,
+ const char* Salome_file_name)
+{
+ // Try to find the service, if it doesn't exist, we throw an exception.
+ _Service_file_map_it = _Input_Service_file_map.find(service_name);
+ if (_Service_file_map_it == _Input_Service_file_map.end()) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "service doesn't have salome files";
+ throw SALOME::SALOME_Exception(es);
+ }
+ _t_Salome_file_map * _map = _Input_Service_file_map[service_name];
+
+ // Try to find the Salome_file ...
+ _Salome_file_map_it = _map->find(Salome_file_name);
+ if (_Salome_file_map_it == _map->end()) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "service doesn't have this Salome_file";
+ throw SALOME::SALOME_Exception(es);
+ }
+ Salome_file_i * Sfile = (*_map)[Salome_file_name];
+
+ return Sfile->_this();
+}
+
+Engines::Salome_file_ptr
+Engines_Component_i::setInputFileToService(const char* service_name,
+ const char* Salome_file_name)
+{
+ // Try to find the service, if it doesn't exist, we add it.
+ _Service_file_map_it = _Input_Service_file_map.find(service_name);
+ if (_Service_file_map_it == _Input_Service_file_map.end()) {
+ _t_Salome_file_map * _map = new _t_Salome_file_map();
+ _Input_Service_file_map[service_name] = _map;
+ }
+ _t_Salome_file_map * _map = _Input_Service_file_map[service_name];
+
+ // Try to find the Salome_file ...
+ _Salome_file_map_it = _map->find(Salome_file_name);
+ if (_Salome_file_map_it == _map->end()) {
+ Salome_file_i * Sfile = new Salome_file_i();
+ Engines::Container_ptr container = this->GetContainerRef();
+ Sfile->setContainer(Engines::Container::_duplicate(container));
+ (*_map)[Salome_file_name] = Sfile;
+ }
+
+ Salome_file_i * Sfile = (*_map)[Salome_file_name];
+ return Sfile->_this();
+}
+
+void
+Engines_Component_i::checkInputFilesToService(const char* service_name)
+{
+ // Try to find the service, if it doesn't exist, nothing to do.
+ _Service_file_map_it = _Input_Service_file_map.find(service_name);
+ if (_Service_file_map_it != _Input_Service_file_map.end()) {
+ _t_Salome_file_map * _map = _Input_Service_file_map[service_name];
+ _t_Salome_file_map::iterator begin = _map->begin();
+ _t_Salome_file_map::iterator end = _map->end();
+
+ for(;begin!=end;begin++) {
+ Salome_file_i * file = begin->second;
+ std::string file_port_name = begin->first;
+ configureSalome_file(service_name, file_port_name, file);
+ file->recvFiles();
+ }
+ }
+}
+
+Engines::Salome_file_ptr
+Engines_Component_i::getOutputFileToService(const char* service_name,
+ const char* Salome_file_name)
+{
+ // Try to find the service, if it doesn't exist, we throw an exception.
+ _Service_file_map_it = _Output_Service_file_map.find(service_name);
+ if (_Service_file_map_it == _Output_Service_file_map.end()) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "service doesn't have salome files";
+ throw SALOME::SALOME_Exception(es);
+ }
+ _t_Salome_file_map * _map = _Output_Service_file_map[service_name];
+
+ // Try to find the Salome_file ...
+ _Salome_file_map_it = _map->find(Salome_file_name);
+ if (_Salome_file_map_it == _map->end()) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "service doesn't have this Salome_file";
+ throw SALOME::SALOME_Exception(es);
+ }
+ Salome_file_i * Sfile = (*_map)[Salome_file_name];
+
+ return Sfile->_this();
+}
+
+Engines::Salome_file_ptr
+Engines_Component_i::setOutputFileToService(const char* service_name,
+ const char* Salome_file_name)
+{
+ // Try to find the service, if it doesn't exist, we add it.
+ _Service_file_map_it = _Output_Service_file_map.find(service_name);
+ if (_Service_file_map_it == _Output_Service_file_map.end()) {
+ _t_Salome_file_map * _map = new _t_Salome_file_map();
+ _Output_Service_file_map[service_name] = _map;
+ }
+ _t_Salome_file_map * _map = _Output_Service_file_map[service_name];
+
+ // Try to find the Salome_file ...
+ _Salome_file_map_it = _map->find(Salome_file_name);
+ if (_Salome_file_map_it == _map->end()) {
+ Salome_file_i * Sfile = new Salome_file_i();
+ Engines::Container_ptr container = this->GetContainerRef();
+ Sfile->setContainer(Engines::Container::_duplicate(container));
+ (*_map)[Salome_file_name] = Sfile;
+ }
+
+ Salome_file_i * Sfile = (*_map)[Salome_file_name];
+ return Sfile->_this();
+}
+
+void
+Engines_Component_i::checkOutputFilesToService(const char* service_name)
+{
+ // Try to find the service, if it doesn't exist, nothing to do.
+ _Service_file_map_it = _Output_Service_file_map.find(service_name);
+ if (_Service_file_map_it != _Output_Service_file_map.end()) {
+ _t_Salome_file_map * _map = _Output_Service_file_map[service_name];
+ _t_Salome_file_map::iterator begin = _map->begin();
+ _t_Salome_file_map::iterator end = _map->end();
+
+ for(;begin!=end;begin++) {
+ Salome_file_i * file = begin->second;
+ std::string file_port_name = begin->first;
+ configureSalome_file(service_name, file_port_name, file);
+ file->recvFiles();
+ }
+ }
+
+}
+
+//=============================================================================
+/*!
+ * C++ method: used to configure the Salome_file into the runtime.
+ * \param service_name name of the service that use this Salome_file
+ * \param file_port_name name of the Salome_file
+ * \param file Salome_file C++ object
+ */
+//=============================================================================
+void
+Engines_Component_i::configureSalome_file(std::string service_name,
+ std::string file_port_name,
+ Salome_file_i * file)
+{
+ // By default this method does nothing
+}
+
#include <SALOMEconfig.h>
//#ifndef WNT
#include CORBA_SERVER_HEADER(SALOME_Component)
+#include CORBA_SERVER_HEADER(SALOME_Exception)
//#else
//#include <SALOME_Component.hh>
//#endif
#include "SALOME_Component_i.hxx"
#include "SALOME_FileRef_i.hxx"
#include "SALOME_FileTransfer_i.hxx"
+#include "Salome_file_i.hxx"
#include "SALOME_NamingService.hxx"
#include "OpUtil.hxx"
//=============================================================================
Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb,
- PortableServer::POA_var poa,
- char *containerName ,
+ PortableServer::POA_var poa,
+ char *containerName ,
int argc , char* argv[],
- bool activAndRegist,
- bool isServantAloneInProcess
- ) :
+ bool activAndRegist,
+ bool isServantAloneInProcess
+ ) :
_numInstance(0),_isServantAloneInProcess(isServantAloneInProcess)
{
_pid = (long)getpid();
_argv = argv ;
string hostname = GetHostname();
- MESSAGE(hostname << " " << getpid() << " Engines_Container_i starting argc "
- << _argc << " Thread " << pthread_self() ) ;
+#ifndef WNT
+ MESSAGE(hostname << " " << getpid() <<
+ " Engines_Container_i starting argc " <<
+ _argc << " Thread " << pthread_self() ) ;
+#else
+ MESSAGE(hostname << " " << _getpid() <<
+ " Engines_Container_i starting argc " << _argc<< " Thread " << pthread_self().p ) ;
+#endif
int i = 0 ;
while ( _argv[ i ] )
_NS->init_orb( CORBA::ORB::_duplicate(_orb) ) ;
CORBA::Object_var obj=_poa->id_to_reference(*_id);
Engines::Container_var pCont
- = Engines::Container::_narrow(obj);
+ = Engines::Container::_narrow(obj);
_containerName = _NS->BuildContainerNameForNS(containerName,
- hostname.c_str());
+ hostname.c_str());
SCRUTE(_containerName);
_NS->Register(pCont, _containerName.c_str());
MESSAGE("Engines_Container_i::Engines_Container_i : Container name "
- << _containerName);
+ << _containerName);
// Python:
// import SALOME_Container
SCRUTE(myCommand);
if (!_isSupervContainer)
- {
+ {
#ifdef WNT
- //Py_ACQUIRE_NEW_THREAD;
- PyEval_AcquireLock();
- /* It should not be possible for more than one thread state
- to be used for a thread.*/
- PyThreadState *myTstate = PyGILState_GetThisThreadState();
- // if no thread state defined
- if ( !myTstate )
- 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);
- //
+ // 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");
+ 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;
- }
+ PyRun_SimpleString("import SALOME_Container\n");
+ PyRun_SimpleString((char*)myCommand.c_str());
+ Py_RELEASE_NEW_THREAD;
+ }
fileTransfer_i* aFileTransfer = new fileTransfer_i();
_fileTransfer = Engines::fileTransfer::_narrow(aFileTransfer->_this());
MESSAGE("Effective Shutdown of container Begins...");
LocalTraceBufferPool* bp1 = LocalTraceBufferPool::instance();
bp1->deleteInstance(bp1);
- _orb->shutdown(0);
+ if(!CORBA::is_nil(_orb))
+ _orb->shutdown(0);
}
}
PyObject *globals = PyModule_GetDict(mainmod);
PyObject *pyCont = PyDict_GetItemString(globals, "pyCont");
PyObject *result = PyObject_CallMethod(pyCont,
- "import_component",
- "s",componentName);
+ "import_component",
+ "s",componentName);
int ret= PyInt_AsLong(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;
+ }
}
return false;
}
Engines::Component_ptr
Engines_Container_i::create_component_instance(const char*genericRegisterName,
- CORBA::Long studyId)
+ CORBA::Long studyId)
{
if (studyId < 0)
{
if (_library_map[aCompName]) // Python component
{
if (_isSupervContainer)
- {
- INFOS("Supervision Container does not support Python Component Engines");
- return Engines::Component::_nil();
- }
+ {
+ INFOS("Supervision Container does not support Python Component Engines");
+ return Engines::Component::_nil();
+ }
_numInstanceMutex.lock() ; // lock on the instance number
_numInstance++ ;
int numInstance = _numInstance ;
sprintf( aNumI , "%d" , numInstance ) ;
string instanceName = aCompName + "_inst_" + aNumI ;
string component_registerName =
- _containerName + "/" + instanceName;
+ _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,
- "create_component_instance",
- "ssl",
- aCompName.c_str(),
- instanceName.c_str(),
- studyId);
+ "create_component_instance",
+ "ssl",
+ aCompName.c_str(),
+ instanceName.c_str(),
+ studyId);
string iors = PyString_AsString(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 ) ;
+ CORBA::Object_var obj = _orb->string_to_object(iors.c_str());
+ iobject = Engines::Component::_narrow( obj ) ;
}
return iobject._retn();
}
else
{
iobject = createInstance(genericRegisterName,
- handle,
- studyId);
+ handle,
+ studyId);
return iobject._retn();
}
}
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();
string instance = (*itm).first;
SCRUTE(instance);
if (instance.find(registeredName) == 0)
- {
- anEngine = (*itm).second;
- if (studyId == anEngine->getStudyId())
- {
- return anEngine._retn();
- }
- }
+ {
+ anEngine = (*itm).second;
+ if (studyId == anEngine->getStudyId())
+ {
+ return anEngine._retn();
+ }
+ }
itm++;
}
return anEngine._retn();
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() ;
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();
}
+Engines::Salome_file_ptr
+Engines_Container_i::createSalome_file(const char* origFileName)
+{
+ 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
+ {
+ 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));
+ return theSalome_file;
+}
//=============================================================================
/*!
* C++ method: Finds an already existing servant instance of a component, or
Engines::Component_ptr
Engines_Container_i::find_or_create_instance(string genericRegisterName,
- string componentLibraryName)
+ string componentLibraryName)
{
string aGenRegisterName = genericRegisterName;
string impl_name = componentLibraryName;
// --- find a registered instance in naming service, or create
string component_registerBase =
- _containerName + "/" + aGenRegisterName;
+ _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
- {
- // 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");
- }
- }
- }
+ {
+ 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");
+ }
+ }
+ }
catch (...)
- {
- INFOS( "Container_i::load_impl catched" ) ;
- }
+ {
+ INFOS( "Container_i::load_impl catched" ) ;
+ }
return iobject._retn();
}
}
Engines::Component_ptr
Engines_Container_i::createInstance(string genericRegisterName,
- void *handle,
- int studyId)
+ void *handle,
+ int studyId)
{
// --- find the factory
sprintf( aNumI , "%d" , numInstance ) ;
string instanceName = aGenRegisterName + "_inst_" + aNumI ;
string component_registerName =
- _containerName + "/" + instanceName;
+ _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() ) ;
+ aGenRegisterName.c_str() ) ;
if (id == NULL)
- return iobject._retn();
+ return iobject._retn();
// --- get reference & servant from id
iobject = Engines::Component::_narrow( obj ) ;
Engines_Component_i *servant =
- dynamic_cast<Engines_Component_i*>(_poa->reference_to_servant(iobject));
+ dynamic_cast<Engines_Component_i*>(_poa->reference_to_servant(iobject));
ASSERT(servant);
//SCRUTE(servant->pd_refCount);
servant->_remove_ref(); // compensate previous id_to_reference
if (_cntInstances_map[aGenRegisterName] == 0)
{
string impl_name =
- Engines_Component_i::GetDynLibraryName(aGenRegisterName.c_str());
+ Engines_Component_i::GetDynLibraryName(aGenRegisterName.c_str());
SCRUTE(impl_name);
void* handle = _library_map[impl_name];
ASSERT(handle);
#ifndef WNT
void SigIntHandler(int what ,
- siginfo_t * siginfo ,
- void * toto )
+ siginfo_t * siginfo ,
+ void * toto )
{
//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 :
{
ActSigIntHandler() ;
if ( siginfo->si_signo == SIGUSR1 )
- {
- SetCpuUsed() ;
- }
+ {
+ SetCpuUsed() ;
+ }
else if ( siginfo->si_signo == SIGUSR2 )
- {
- CallCancelThread() ;
- }
+ {
+ CallCancelThread() ;
+ }
else
- {
- _Sleeping = true ;
- // MESSAGE("SigIntHandler BEGIN sleeping.") ;
- int count = 0 ;
- while( _Sleeping )
- {
- sleep( 1 ) ;
- count += 1 ;
- }
- // MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
- }
+ {
+ _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
void SigIntHandler( int what )
{
+#ifndef WNT
MESSAGE( pthread_self() << "SigIntHandler what " << what << endl );
+#else
+ MESSAGE( "SigIntHandler what " << what << endl );
+#endif
if ( _Sleeping )
{
_Sleeping = false ;
{
ActSigIntHandler() ;
if ( what == SIGUSR1 )
- {
- SetCpuUsed() ;
- }
+ {
+ SetCpuUsed() ;
+ }
else
- {
- _Sleeping = true ;
- MESSAGE("SigIntHandler BEGIN sleeping.") ;
- int count = 0 ;
- while( _Sleeping )
- {
- Sleep( 1000 ) ;
- count += 1 ;
- }
- MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
- }
+ {
+ _Sleeping = true ;
+ MESSAGE("SigIntHandler BEGIN sleeping.") ;
+ int count = 0 ;
+ while( _Sleeping )
+ {
+ Sleep( 1000 ) ;
+ count += 1 ;
+ }
+ MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
+ }
return ;
}
}
SALOME_FileRef_i.hxx \
SALOME_ContainerManager.hxx \
Container_init_python.hxx \
- SALOME_Container.hxx
+ SALOME_Container.hxx \
+ Salome_file_i.hxx
# Scripts to be installed
dist_salomescript_DATA =\
COMMON_CPPFLAGS=\
@PYTHON_INCLUDES@ \
@MPI_INCLUDES@ \
- @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \
- @QT_INCLUDES@ \
+ @HDF5_INCLUDES@ \
+ -I$(srcdir)/../Batch \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Registry \
-I$(srcdir)/../Notification \
-I$(srcdir)/../ResourcesManager \
+ -I$(srcdir)/../HDFPersist \
-I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
- @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
../Utils/libOpUtil.la \
../SALOMELocalTrace/libSALOMELocalTrace.la \
../Basics/libSALOMEBasics.la \
+ ../HDFPersist/libSalomeHDFPersist.la \
+ ../Batch/libSalomeBatch.la \
$(top_builddir)/idl/libSalomeIDLKernel.la\
@MPI_LIBS@ \
@CORBA_LIBS@
SALOME_FileTransfer_i.cxx \
SALOME_FileRef_i.cxx \
Container_init_python.cxx \
- SALOME_ContainerManager.cxx
+ SALOME_ContainerManager.cxx \
+ Salome_file_i.cxx
libSalomeContainer_la_CPPFLAGS =\
$(COMMON_CPPFLAGS)
# Executables targets
# ===============================================================
#
-bin_PROGRAMS = SALOME_Container SALOME_ContainerManagerServer
+bin_PROGRAMS = SALOME_Container
+noinst_PROGRAMS = TestSalome_file
+
SALOME_Container_SOURCES =\
SALOME_Container.cxx \
SALOME_Container_SignalsHandler.cxx
SALOME_Container_LDADD =\
libSalomeContainer.la \
$(COMMON_LIBS) \
- ../Basics/libSALOMEBasics.la
+ ../Basics/libSALOMEBasics.la \
+ ../Batch/libSalomeBatch.la
+
+SALOME_Container_LDFLAGS =\
+-Xlinker -export-dynamic
-SALOME_ContainerManagerServer_SOURCES =\
- SALOME_ContainerManagerServer.cxx
+TestSalome_file_SOURCES =\
+ TestSalome_file.cxx
-SALOME_ContainerManagerServer_CPPFLAGS=\
+TestSalome_file_CPPFLAGS =\
$(COMMON_CPPFLAGS)
-SALOME_ContainerManagerServer_LDADD =\
+TestSalome_file_LDADD =\
libSalomeContainer.la \
$(COMMON_LIBS) \
../Basics/libSALOMEBasics.la
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Component)
#include "NOTIFICATION.hxx"
+#include "Salome_file_i.hxx"
class RegistryConnexion;
class Engines_Container_i;
CORBA::Boolean isPublished,
CORBA::Boolean& isValidScript);
+ // CORBA operations for Salome_file
+ virtual Engines::Salome_file_ptr getInputFileToService(const char* service_name,
+ const char* Salome_file_name);
+ virtual Engines::Salome_file_ptr getOutputFileToService(const char* service_name,
+ const char* Salome_file_name);
+ virtual void checkInputFilesToService(const char* service_name);
+ virtual Engines::Salome_file_ptr setInputFileToService(const char* service_name,
+ const char* Salome_file_name);
+
+ virtual void checkOutputFilesToService(const char* service_name);
+ virtual Engines::Salome_file_ptr setOutputFileToService(const char* service_name,
+ const char* Salome_file_name);
// --- local C++ methods
PortableServer::ObjectId * getId();
long CpuUsed() ;
void CancelThread() ;
+ virtual void configureSalome_file(std::string service_name,
+ std::string file_port_name,
+ Salome_file_i * file);
+
+
protected:
int _studyId; // -1: not initialised; 0: multiStudy; >0: study
static bool _isMultiStudy;
NOTIFICATION_Supplier* _notifSupplier;
std::map<std::string,CORBA::Any>_fieldsDict;
+ // Map Salome_file_name to Salome_file*
+ typedef std::map<std::string, Salome_file_i*> _t_Salome_file_map;
+ // Map Service_name to _Salome_file_map
+ typedef std::map<std::string, Engines_Component_i::_t_Salome_file_map*> _t_Service_file_map;
+
+ _t_Service_file_map _Input_Service_file_map;
+ _t_Service_file_map _Output_Service_file_map;
+ _t_Service_file_map::iterator _Service_file_map_it;
+ _t_Salome_file_map::iterator _Salome_file_map_it;
+
std::string _serviceName ;
std::string _graphName ;
std::string _nodeName ;
extern "C" void HandleServerSideSignals(CORBA::ORB_ptr theORB);
+#include <stdexcept>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+typedef void (*sighandler_t)(int);
+sighandler_t setsig(int sig, sighandler_t handler)
+{
+ struct sigaction context, ocontext;
+ context.sa_handler = handler;
+ sigemptyset(&context.sa_mask);
+ context.sa_flags = 0;
+ if (sigaction(sig, &context, &ocontext) == -1)
+ return SIG_ERR;
+ return ocontext.sa_handler;
+}
+
+void AttachDebugger()
+{
+ if(getenv ("DEBUGGER"))
+ {
+ std::stringstream exec;
+ exec << "$DEBUGGER SALOME_Container " << getpid() << "&";
+ std::cerr << exec.str() << std::endl;
+ system(exec.str().c_str());
+ while(1);
+ }
+}
+
+void Handler(int theSigId)
+{
+ std::cerr << "SIGSEGV: " << std::endl;
+ AttachDebugger();
+ //to exit or not to exit
+ exit(1);
+}
+
+void terminateHandler(void)
+{
+ std::cerr << "Terminate: not managed exception !" << std::endl;
+ AttachDebugger();
+}
+
+void unexpectedHandler(void)
+{
+ std::cerr << "Unexpected: unexpected exception !" << std::endl;
+ AttachDebugger();
+}
+
int main(int argc, char* argv[])
{
#ifdef HAVE_MPI2
MPI_Init(&argc,&argv);
#endif
+ if(getenv ("DEBUGGER"))
+ {
+ setsig(SIGSEGV,&Handler);
+ set_terminate(&terminateHandler);
+ set_unexpected(&unexpectedHandler);
+ }
+
// Initialise the ORB.
//SRN: BugID: IPAL9541, it's necessary to set a size of one message to be at least 100Mb
//CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
#endif
#include <vector>
#include "Utils_CorbaException.hxx"
+#include "Batch_Date.hxx"
#ifdef WITH_PACO_PARALLEL
#include "PaCO++.h"
using namespace std;
+vector<Engines::Container_ptr> SALOME_ContainerManager::_batchLaunchedContainers;
+
+vector<Engines::Container_ptr>::iterator SALOME_ContainerManager::_batchLaunchedContainersIter;
+
const char *SALOME_ContainerManager::_ContainerManagerNameInNS =
"/ContainerManager";
*/
//=============================================================================
-SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb)
+SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_ResourcesManager *rm, SALOME_NamingService *ns)
{
MESSAGE("constructor");
- _NS = new SALOME_NamingService(orb);
- _ResManager = new SALOME_ResourcesManager(orb);
+ _NS = ns;
+ _ResManager = rm;
_id=0;
- PortableServer::POA_var root_poa = PortableServer::POA::_the_root_poa();
- PortableServer::POAManager_var pman = root_poa->the_POAManager();
- PortableServer::POA_var my_poa;
+ PortableServer::POAManager_var pman = poa->the_POAManager();
+ _orb = CORBA::ORB::_duplicate(orb) ;
CORBA::PolicyList policies;
policies.length(1);
PortableServer::ThreadPolicy_var threadPol =
- root_poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL);
+ poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL);
policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol);
- my_poa =
- root_poa->create_POA("SThreadPOA",pman,policies);
+ _poa = poa->create_POA("SThreadPOA",pman,policies);
threadPol->destroy();
- PortableServer::ObjectId_var id = my_poa->activate_object(this);
- CORBA::Object_var obj = my_poa->id_to_reference(id);
+ PortableServer::ObjectId_var id = _poa->activate_object(this);
+ CORBA::Object_var obj = _poa->id_to_reference(id);
Engines::ContainerManager_var refContMan =
Engines::ContainerManager::_narrow(obj);
SALOME_ContainerManager::~SALOME_ContainerManager()
{
MESSAGE("destructor");
- delete _NS;
- delete _ResManager;
}
//=============================================================================
{
MESSAGE("Shutdown");
ShutdownContainers();
- PortableServer::ObjectId_var oid = _default_POA()->servant_to_id(this);
- _default_POA()->deactivate_object(oid);
- _remove_ref();
-
+ _NS->Destroy_Name(_ContainerManagerNameInNS);
+ PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
+ _poa->deactivate_object(oid);
+ //_remove_ref();
}
//=============================================================================
void SALOME_ContainerManager::ShutdownContainers()
{
MESSAGE("ShutdownContainers");
- _NS->Change_Directory("/Containers");
- vector<string> vec = _NS->list_directory_recurs();
- list<string> lstCont;
- for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++)
- {
+ bool isOK;
+ isOK = _NS->Change_Directory("/Containers");
+ 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));
- }
+ if(!CORBA::is_nil(cont)){
+ lstCont.push_back((*iter));
+ }
}
- MESSAGE("Container list: ");
- for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++)
- {
+ MESSAGE("Container list: ");
+ for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){
SCRUTE((*iter));
}
- for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++)
- {
+ for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.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))
- {
- MESSAGE("ShutdownContainers: " << (*iter));
- cont->Shutdown();
- }
+ if(!CORBA::is_nil(cont)){
+ MESSAGE("ShutdownContainers: " << (*iter));
+ cont->Shutdown();
+ }
else MESSAGE("ShutdownContainers: no container ref for " << (*iter));
}
+ }
}
//=============================================================================
FindOrStartContainer(const Engines::MachineParameters& params,
const Engines::MachineList& possibleComputers)
{
- long id;
- string containerNameInNS;
- char idc[3*sizeof(long)];
-
Engines::Container_ptr ret = FindContainer(params,possibleComputers);
if(!CORBA::is_nil(ret))
return ret;
const Engines::MachineList& possibleComputers,
Engines::ResPolicy policy)
{
+#ifdef WITH_PACO_PARALLEL
+ std::string parallelLib(params.parallelLib);
+ if (parallelLib != "")
+ return FindOrStartParallelContainer(params, possibleComputers);
+#endif
long id;
string containerNameInNS;
char idc[3*sizeof(long)];
command = _ResManager->BuildCommandToLaunchRemoteContainer(theMachine,params,id);
_ResManager->RmTmpFile();
+
+ //check if an entry exists in Naming service
+ if(params.isMPI)
+ {
+ containerNameInNS = "/ContainerManager/id";
+ sprintf(idc,"%ld",id);
+ containerNameInNS += idc;
+ }
+ else
+ containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str());
+
+ SCRUTE(containerNameInNS);
+ CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
+ if ( !CORBA::is_nil(obj) )
+ {
+ // unregister the registered container if it exists
+ _NS->Destroy_Name(containerNameInNS.c_str());
+ // unregister component instances ???
+ //Engines::Container_var cont=Engines::Container::_narrow(obj);
+ }
+
+ // launch container with a system call
int status=system(command.c_str());
if (status == -1){
MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " <<
if ( count != 10 )
MESSAGE( count << ". Waiting for container on " << theMachine);
- if(params.isMPI){
- containerNameInNS = "/ContainerManager/id";
- sprintf(idc,"%ld",id);
- containerNameInNS += idc;
- }
- else
- containerNameInNS = _NS->BuildContainerNameForNS(params,theMachine.c_str());
-
- SCRUTE(containerNameInNS);
CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
ret=Engines::Container::_narrow(obj);
}
Engines::Container_ptr
SALOME_ContainerManager::
StartContainer(const Engines::MachineParameters& params,
- Engines::ResPolicy policy)
+ Engines::ResPolicy policy,
+ const Engines::CompoList& componentList)
{
- Engines::MachineList_var possibleComputers = GetFittingResources(params,"");
+ Engines::MachineList_var possibleComputers = _ResManager->GetFittingResources(params,componentList);
return StartContainer(params,possibleComputers,policy);
}
INFOS("[FindOrStartParallelContainer] Starting a parallel container");
// Step 2.1 : Choose a computer
- string theMachine = _ResManager->FindBest(possibleComputers);
+ string theMachine = _ResManager->FindFirst(possibleComputers);
if(theMachine == "") {
INFOS("[FindOrStartParallelContainer] !!!!!!!!!!!!!!!!!!!!!!!!!!");
INFOS("[FindOrStartParallelContainer] No possible computer found");
#endif
//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-Engines::MachineList *
-SALOME_ContainerManager::
-GetFittingResources(const Engines::MachineParameters& params,
- const char *componentName)
-{
- MESSAGE("SALOME_ContainerManager::GetFittingResources");
- Engines::MachineList *ret=new Engines::MachineList;
- vector<string> vec;
- try
- {
- vec = _ResManager->GetFittingResources(params,componentName);
- }
- catch(const SALOME_Exception &ex)
- {
- INFOS("Caught exception.");
- THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::BAD_PARAM);
- //return ret;
- }
-
- // MESSAGE("Machine list length "<<vec.size());
- ret->length(vec.size());
- for(unsigned int i=0;i<vec.size();i++)
- {
- (*ret)[i]=(vec[i]).c_str();
- }
- return ret;
-}
-
-//=============================================================================
-/*!
- *
+/*! CORBA Method:
+ * Give a suitable Container in a list of machines
+ * \param params Machine Parameters required for the container
+ * \param possibleComputers list of machines usable for start
*/
//=============================================================================
-char*
+Engines::Container_ptr
SALOME_ContainerManager::
-FindFirst(const Engines::MachineList& possibleComputers)
+GiveContainer(const Engines::MachineParameters& params,
+ Engines::ResPolicy policy,
+ const Engines::CompoList& componentList)
{
- string theMachine=_ResManager->FindFirst(possibleComputers);
- return CORBA::string_dup(theMachine.c_str());
+ char *valenv=getenv("SALOME_BATCH");
+ if(valenv)
+ if (strcmp(valenv,"1")==0)
+ {
+ if(_batchLaunchedContainers.empty())
+ fillBatchLaunchedContainers();
+ return *(_batchLaunchedContainersIter++);
+ }
+ return StartContainer(params,policy,componentList);
}
//=============================================================================
return _id;
}
+void SALOME_ContainerManager::fillBatchLaunchedContainers()
+{
+ _batchLaunchedContainers.clear();
+ _NS->Change_Directory("/Containers");
+ vector<string> vec = _NS->list_directory_recurs();
+ for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++){
+ CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+ Engines::Container_ptr cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont)){
+ _batchLaunchedContainers.push_back(cont);
+ }
+ }
+ _batchLaunchedContainersIter=_batchLaunchedContainers.begin();
+}
{
public:
- SALOME_ContainerManager(CORBA::ORB_ptr orb);
+ SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_ResourcesManager *rm, SALOME_NamingService *ns);
~SALOME_ContainerManager();
Engines::Container_ptr
Engines::Container_ptr
StartContainer(const Engines::MachineParameters& params,
- Engines::ResPolicy policy);
-
- Engines::MachineList *
- GetFittingResources(const Engines::MachineParameters& params,
- const char *componentName);
+ Engines::ResPolicy policy,
+ const Engines::CompoList& componentList);
- char* FindFirst(const Engines::MachineList& possibleComputers);
+ Engines::Container_ptr
+ GiveContainer(const Engines::MachineParameters& params,
+ Engines::ResPolicy policy,
+ const Engines::CompoList& componentList);
void Shutdown();
void ShutdownContainers();
const Engines::MachineParameters& params,
const std::string& name);
+ void fillBatchLaunchedContainers();
+
long GetIdForContainer(void);
long _id;
+ CORBA::ORB_var _orb;
+ PortableServer::POA_var _poa;
SALOME_ResourcesManager *_ResManager;
SALOME_NamingService *_NS;
+ static std::vector<Engines::Container_ptr> _batchLaunchedContainers;
+ static std::vector<Engines::Container_ptr>::iterator _batchLaunchedContainersIter;
};
#endif
+++ /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
-//
-#include "SALOME_ContainerManager.hxx"
-#include "utilities.h"
-
-int main(int argc, char* argv[])
-{
- PortableServer::POA_var root_poa;
- PortableServer::POAManager_var pman;
- CORBA::Object_var obj;
-
- CORBA::ORB_ptr orb = CORBA::ORB_init( argc , argv ) ;
- // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
- INFOS_COMPILATION;
- BEGIN_OF(argv[0]);
- try{
- obj = orb->resolve_initial_references("RootPOA");
- if(!CORBA::is_nil(obj))
- root_poa = PortableServer::POA::_narrow(obj);
- if(!CORBA::is_nil(root_poa))
- pman = root_poa->the_POAManager();
- }
- catch(CORBA::COMM_FAILURE&){
- MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
- }
- try{
- SALOME_ContainerManager *cmServ=new SALOME_ContainerManager(orb);
- pman->activate();
- orb->run();
- }catch(CORBA::SystemException&){
- MESSAGE("Caught CORBA::SystemException.");
- }catch(PortableServer::POA::WrongPolicy&){
- MESSAGE("Caught CORBA::WrongPolicyException.");
- }catch(PortableServer::POA::ServantAlreadyActive&){
- MESSAGE("Caught CORBA::ServantAlreadyActiveException");
- }catch(CORBA::Exception&){
- MESSAGE("Caught CORBA::Exception.");
- }catch(std::exception& exc){
- MESSAGE("Caught std::exception - "<<exc.what());
- }catch(...){
- MESSAGE("Caught unknown exception.");
- }
- END_OF(argv[0]);
- // delete myThreadTrace;
-}
-
import sys
import string
-import omnipatch # PAL10310
-
from omniORB import CORBA, PortableServer
import SALOMEDS
import Engines, Engines__POA
Engines::fileRef_ptr createFileRef(const char* origFileName);
Engines::fileTransfer_ptr getFileTransfer();
-
+ virtual Engines::Salome_file_ptr createSalome_file(const char* origFileName);
// --- local C++ methods
Engines::Component_ptr
int _numInstance ;
std::map<std::string,Engines::Component_var> _listInstances_map;
std::map<std::string,Engines::fileRef_var> _fileRef_map;
+ std::map<std::string,Engines::Salome_file_var> _Salome_file_map;
Engines::fileTransfer_var _fileTransfer;
int _argc ;
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA 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 : Salome_file_i.cxx
+// Author : André RIBES, EDF
+// Module : SALOME
+// $Header:
+
+#include "Salome_file_i.hxx"
+#include "utilities.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include "HDFOI.hxx"
+#include <stdlib.h>
+
+//=============================================================================
+/*!
+ * Default constructor,
+ */
+//=============================================================================
+
+Salome_file_i::Salome_file_i()
+{
+ _fileId = 0;
+ _path_max = 1 + pathconf("/", _PC_PATH_MAX);
+ _state.name = CORBA::string_dup("");
+ _state.hdf5_file_name = CORBA::string_dup("");
+ _state.number_of_files = 0;
+ _state.files_ok = true;
+ _container = Engines::Container::_nil();
+ _default_source_Salome_file = Engines::Salome_file::_nil();
+}
+
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+
+Salome_file_i::~Salome_file_i()
+{
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::load
+ */
+//=============================================================================
+void
+Salome_file_i::load(const char* hdf5_file) {
+ _state.hdf5_file_name = CORBA::string_dup(hdf5_file);
+ try
+ {
+ HDFfile *hdf_file;
+ HDFgroup *hdf_group;
+ HDFdataset *hdf_dataset;
+ int size;
+ int fd;
+ char * value;
+ char * buffer;
+
+ hdf_file = new HDFfile((char*) hdf5_file);
+ hdf_file->OpenOnDisk(HDF_RDONLY);
+
+ hdf_group = new HDFgroup("CONFIG",hdf_file);
+ hdf_group->OpenOnDisk();
+ hdf_dataset = new HDFdataset("MODE",hdf_group);
+ hdf_dataset->OpenOnDisk();
+ size = hdf_dataset->GetSize();
+ value = new char[size];
+ hdf_dataset->ReadFromDisk(value);
+ hdf_dataset->CloseOnDisk();
+ std::string mode(value);
+ delete value;
+
+ hdf_group = new HDFgroup("GROUP_FILES",hdf_file);
+ hdf_group->OpenOnDisk();
+ hdf_dataset = new HDFdataset("LIST_OF_FILES",hdf_group);
+ hdf_dataset->OpenOnDisk();
+ size = hdf_dataset->GetSize();
+ value = new char[size];
+ hdf_dataset->ReadFromDisk(value);
+ hdf_dataset->CloseOnDisk();
+ std::string list_of_files(value);
+ delete value;
+
+ std::istringstream iss(list_of_files);
+ std::string file_name;
+ while (std::getline(iss, file_name, ' '))
+ {
+ std::string dataset_group_name("DATASET");
+ dataset_group_name += file_name;
+
+ hdf_group = new HDFgroup(dataset_group_name.c_str(), hdf_file);
+ hdf_group->OpenOnDisk();
+
+ hdf_dataset = new HDFdataset("NAME",hdf_group);
+ hdf_dataset->OpenOnDisk();
+ size = hdf_dataset->GetSize();
+ value = new char[size];
+ hdf_dataset->ReadFromDisk(value);
+ hdf_dataset->CloseOnDisk();
+ std::string name(value);
+
+ hdf_dataset = new HDFdataset("PATH",hdf_group);
+ hdf_dataset->OpenOnDisk();
+ size = hdf_dataset->GetSize();
+ value = new char[size];
+ hdf_dataset->ReadFromDisk(value);
+ hdf_dataset->CloseOnDisk();
+ std::string path(value);
+
+ hdf_dataset = new HDFdataset("TYPE",hdf_group);
+ hdf_dataset->OpenOnDisk();
+ size = hdf_dataset->GetSize();
+ value = new char[size];
+ hdf_dataset->ReadFromDisk(value);
+ hdf_dataset->CloseOnDisk();
+ std::string type(value);
+
+ hdf_dataset = new HDFdataset("SOURCE_FILE_NAME",hdf_group);
+ hdf_dataset->OpenOnDisk();
+ size = hdf_dataset->GetSize();
+ value = new char[size];
+ hdf_dataset->ReadFromDisk(value);
+ hdf_dataset->CloseOnDisk();
+ std::string source_file_name(value);
+
+ hdf_dataset = new HDFdataset("STATUS",hdf_group);
+ hdf_dataset->OpenOnDisk();
+ size = hdf_dataset->GetSize();
+ value = new char[size];
+ hdf_dataset->ReadFromDisk(value);
+ hdf_dataset->CloseOnDisk();
+ std::string status(value);
+
+ if (mode == "all") {
+
+ // Changing path, is now current directory
+ char CurrentPath[_path_max];
+ getcwd(CurrentPath, _path_max);
+ path = CurrentPath;
+
+ std::string group_name("GROUP");
+ group_name += file_name;
+ hdf_group = new HDFgroup(group_name.c_str(),hdf_file);
+ hdf_group->OpenOnDisk();
+ hdf_dataset = new HDFdataset("FILE DATASET",hdf_group);
+ hdf_dataset->OpenOnDisk();
+ size = hdf_dataset->GetSize();
+ buffer = new char[size];
+
+ if ( (fd = ::open(file_name.c_str(),O_RDWR|O_CREAT,00666)) <0) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "open failed";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ };
+ hdf_dataset->ReadFromDisk(buffer);
+ if ( write(fd,buffer,size) <0) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "write failed";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ };
+ // Close the target file
+ ::close(fd);
+
+ Engines::file infos;
+ infos.file_name = CORBA::string_dup(file_name.c_str());
+ infos.path = CORBA::string_dup(path.c_str());
+ infos.type = CORBA::string_dup(type.c_str());
+ infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
+ infos.status = CORBA::string_dup(status.c_str());
+
+ _fileManaged[file_name] = infos;
+
+ // Update Salome_file state
+ _state.number_of_files++;
+ _state.files_ok = true;
+ }
+ else {
+ Engines::file infos;
+ infos.file_name = CORBA::string_dup(file_name.c_str());
+ infos.path = CORBA::string_dup(path.c_str());
+ infos.type = CORBA::string_dup(type.c_str());
+ infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
+ infos.status = CORBA::string_dup(status.c_str());
+ // Infos for parallel extensions...
+ infos.node = 0;
+ infos.container = Engines::Container::_duplicate(_container);
+
+ _fileManaged[file_name] = infos;
+
+ // Update Salome_file state
+ _state.number_of_files++;
+ if (status != "ok")
+ _state.files_ok = false;
+ }
+ }
+ }
+ catch (HDFexception)
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "!!!! HDFexception";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::save
+ */
+//=============================================================================
+void
+Salome_file_i::save(const char* hdf5_file) {
+ _state.hdf5_file_name = CORBA::string_dup(hdf5_file);
+ try
+ {
+ HDFfile *hdf_file;
+ HDFgroup *hdf_group;
+ HDFdataset *hdf_dataset;
+ hdf_size size[1];
+ _t_fileManaged::iterator begin = _fileManaged.begin();
+ _t_fileManaged::iterator end = _fileManaged.end();
+
+ hdf_file = new HDFfile((char*) _state.hdf5_file_name.in());
+ hdf_file->CreateOnDisk();
+
+ // Save mode information
+ hdf_group = new HDFgroup("CONFIG", hdf_file);
+ hdf_group->CreateOnDisk();
+ std::string mode("infos");
+ size[0] = strlen(mode.c_str()) + 1;
+ hdf_dataset = new HDFdataset("MODE", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) mode.c_str());
+ hdf_dataset->CloseOnDisk();
+ hdf_group->CloseOnDisk();
+
+ // List of files that are managed
+ std::string list_of_files;
+ for(;begin!=end;begin++)
+ {
+ Engines::file file_infos = begin->second;
+ std::string file_name(file_infos.file_name.in());
+
+ list_of_files = list_of_files + file_name + std::string(" ");
+ }
+ hdf_group = new HDFgroup("GROUP_FILES", hdf_file);
+ hdf_group->CreateOnDisk();
+ size[0] = strlen(list_of_files.c_str()) + 1;
+ hdf_dataset = new HDFdataset("LIST_OF_FILES", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) list_of_files.c_str());
+ hdf_dataset->CloseOnDisk();
+ hdf_group->CloseOnDisk();
+
+ // Insert Files into the hdf5_file
+ begin = _fileManaged.begin();
+ for(;begin!=end;begin++)
+ {
+ Engines::file file_infos = begin->second;
+ std::string file_name(file_infos.file_name.in());
+ std::string comp_file_name(_fileManaged[file_name].path.in());
+ comp_file_name.append(_fileManaged[file_name].file_name.in());
+ std::string dataset_group_name("DATASET");
+ dataset_group_name += std::string(_fileManaged[file_name].file_name.in());
+
+ hdf_group = new HDFgroup((char *) dataset_group_name.c_str(), hdf_file);
+ hdf_group->CreateOnDisk();
+ size[0] = strlen(file_infos.file_name.in()) + 1;
+ hdf_dataset = new HDFdataset("NAME", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) file_infos.file_name.in());
+ hdf_dataset->CloseOnDisk();
+ size[0] = strlen(file_infos.path.in()) + 1;
+ hdf_dataset = new HDFdataset("PATH", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) file_infos.path.in());
+ hdf_dataset->CloseOnDisk();
+ size[0] = strlen(file_infos.type.in()) + 1;
+ hdf_dataset = new HDFdataset("TYPE", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) file_infos.type.in());
+ hdf_dataset->CloseOnDisk();
+ size[0] = strlen(file_infos.source_file_name.in()) + 1;
+ hdf_dataset = new HDFdataset("SOURCE_FILE_NAME", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) file_infos.source_file_name.in());
+ hdf_dataset->CloseOnDisk();
+ size[0] = strlen(file_infos.status.in()) + 1;
+ hdf_dataset = new HDFdataset("STATUS", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) file_infos.status.in());
+ hdf_dataset->CloseOnDisk();
+ hdf_group->CloseOnDisk();
+ }
+
+ hdf_file->CloseOnDisk();
+
+ // delete hdf_dataset;
+ // delete hdf_group; ----> SEGFAULT !!!
+ // delete hdf_file; ----> SEGFAULT !!!
+ }
+ catch (HDFexception)
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "!!!! HDFexception";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::save_all
+ */
+//=============================================================================
+void
+Salome_file_i::save_all(const char* hdf5_file) {
+
+ _state.hdf5_file_name = CORBA::string_dup(hdf5_file);
+ // Test Salome_file status
+ if (_state.files_ok == false) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "File Not Ok !";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ }
+
+ // For each file we create two groups
+ // First group contains file's informations
+ // Second group contains the file
+ // At the end we create a group and a dataset containing the names
+ // of all the files.
+ try
+ {
+ HDFfile *hdf_file;
+ HDFgroup *hdf_group;
+ HDFdataset *hdf_dataset;
+ hdf_size size[1];
+ _t_fileManaged::iterator begin = _fileManaged.begin();
+ _t_fileManaged::iterator end = _fileManaged.end();
+
+ hdf_file = new HDFfile((char*) _state.hdf5_file_name.in());
+ hdf_file->CreateOnDisk();
+
+ // Save mode information
+ hdf_group = new HDFgroup("CONFIG", hdf_file);
+ hdf_group->CreateOnDisk();
+ std::string mode("all");
+ size[0] = strlen(mode.c_str()) + 1;
+ hdf_dataset = new HDFdataset("MODE", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) mode.c_str());
+ hdf_dataset->CloseOnDisk();
+ hdf_group->CloseOnDisk();
+
+
+ // List of files that will be inserted
+ std::string list_of_files;
+ for(;begin!=end;begin++)
+ {
+ Engines::file file_infos = begin->second;
+ std::string file_name(file_infos.file_name.in());
+
+ list_of_files = list_of_files + file_name + std::string(" ");
+ }
+ hdf_group = new HDFgroup("GROUP_FILES", hdf_file);
+ hdf_group->CreateOnDisk();
+ size[0] = strlen(list_of_files.c_str()) + 1;
+ hdf_dataset = new HDFdataset("LIST_OF_FILES", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) list_of_files.c_str());
+ hdf_dataset->CloseOnDisk();
+ hdf_group->CloseOnDisk();
+
+ // Insert Files into the hdf5_file
+ begin = _fileManaged.begin();
+ for(;begin!=end;begin++)
+ {
+ Engines::file file_infos = begin->second;
+ std::string file_name(file_infos.file_name.in());
+ std::string comp_file_name(_fileManaged[file_name].path.in());
+ comp_file_name.append(_fileManaged[file_name].file_name.in());
+ std::string group_name("GROUP");
+ group_name += std::string(_fileManaged[file_name].file_name.in());
+ std::string dataset_group_name("DATASET");
+ dataset_group_name += std::string(_fileManaged[file_name].file_name.in());
+
+ hdf_group = new HDFgroup((char *) group_name.c_str(), hdf_file);
+ hdf_group->CreateOnDisk();
+ HDFConvert::FromAscii(comp_file_name.c_str(), *hdf_group, "FILE DATASET");
+ hdf_group->CloseOnDisk();
+
+ hdf_group = new HDFgroup((char *) dataset_group_name.c_str(), hdf_file);
+ hdf_group->CreateOnDisk();
+ size[0] = strlen(file_infos.file_name.in()) + 1;
+ hdf_dataset = new HDFdataset("NAME", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) file_infos.file_name.in());
+ hdf_dataset->CloseOnDisk();
+ size[0] = strlen(file_infos.path.in()) + 1;
+ hdf_dataset = new HDFdataset("PATH", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) file_infos.path.in());
+ hdf_dataset->CloseOnDisk();
+ size[0] = strlen(file_infos.type.in()) + 1;
+ hdf_dataset = new HDFdataset("TYPE", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) file_infos.type.in());
+ hdf_dataset->CloseOnDisk();
+ size[0] = strlen(file_infos.source_file_name.in()) + 1;
+ hdf_dataset = new HDFdataset("SOURCE_FILE_NAME", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) file_infos.source_file_name.in());
+ hdf_dataset->CloseOnDisk();
+ size[0] = strlen(file_infos.status.in()) + 1;
+ hdf_dataset = new HDFdataset("STATUS", hdf_group, HDF_STRING, size, 1);
+ hdf_dataset->CreateOnDisk();
+ hdf_dataset->WriteOnDisk((void *) file_infos.status.in());
+ hdf_dataset->CloseOnDisk();
+ hdf_group->CloseOnDisk();
+
+ }
+
+ hdf_file->CloseOnDisk();
+
+ // delete hdf_dataset;
+ // delete hdf_group; ----> SEGFAULT !!!
+ // delete hdf_file; ----> SEGFAULT !!!
+ }
+ catch (HDFexception)
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "!!!! HDFexception";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::setLocalFile
+ */
+//=============================================================================
+void
+Salome_file_i::setLocalFile(const char* comp_file_name)
+{
+ std::string file_name("");
+ std::string path("");
+ std::string type("local");
+ std::string source_file_name("");
+ std::string status("not_ok");
+
+ std::string cp_file_name(comp_file_name);
+ std::size_t index = cp_file_name.rfind("/");
+ if (index != -1)
+ {
+ file_name = cp_file_name.substr(index+1);
+ path = cp_file_name.substr(0,index+1);
+ }
+ else
+ {
+ file_name = comp_file_name;
+ char CurrentPath[_path_max];
+ getcwd(CurrentPath, _path_max);
+ path = CurrentPath;
+ }
+
+ // Test if this file is already added
+ _t_fileManaged::iterator it = _fileManaged.find(file_name);
+ if (it != _fileManaged.end())
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "file already added";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ }
+
+ // Test if the file is ok
+ if(fopen(comp_file_name,"rb") != NULL)
+ status = "ok";
+
+ // Adding file with is informations
+ Engines::file infos;
+ infos.file_name = CORBA::string_dup(file_name.c_str());
+ infos.path = CORBA::string_dup(path.c_str());
+ infos.type = CORBA::string_dup(type.c_str());
+ infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
+ infos.status = CORBA::string_dup(status.c_str());
+ // Infos for parallel extensions...
+ infos.node = 0;
+ infos.container = Engines::Container::_duplicate(_container);
+
+ _fileManaged[file_name] = infos;
+
+ // Update Salome_file state
+ _state.number_of_files++;
+ if (status != "ok")
+ _state.files_ok = false;
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::setDistributedFile
+ */
+//=============================================================================
+void
+Salome_file_i::setDistributedFile(const char* comp_file_name)
+{
+ std::string file_name("");
+ std::string path("");
+ std::string type("distributed");
+ std::string source_file_name("");
+ std::string status("not_ok");
+
+ std::string cp_file_name(comp_file_name);
+ std::size_t index = cp_file_name.rfind("/");
+ if (index != -1)
+ {
+ file_name = cp_file_name.substr(index+1);
+ path = cp_file_name.substr(0,index+1);
+ }
+ else
+ {
+ file_name = comp_file_name;
+ char CurrentPath[_path_max];
+ getcwd(CurrentPath, _path_max);
+ path = CurrentPath;
+ }
+
+ // Test if this file is already added
+ _t_fileManaged::iterator it = _fileManaged.find(file_name);
+ if (it != _fileManaged.end())
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "file already added";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ }
+
+ // Adding file with his informations
+ Engines::file infos;
+ infos.file_name = CORBA::string_dup(file_name.c_str());
+ infos.path = CORBA::string_dup(path.c_str());
+ infos.type = CORBA::string_dup(type.c_str());
+ infos.source_file_name = CORBA::string_dup(source_file_name.c_str());
+ infos.status = CORBA::string_dup(status.c_str());
+ // Infos for parallel extensions...
+ infos.node = 0;
+ infos.container = Engines::Container::_duplicate(_container);
+
+ _fileManaged[file_name] = infos;
+
+ if(!CORBA::is_nil(_default_source_Salome_file))
+ {
+ _fileDistributedSource[file_name] =
+ Engines::Salome_file::_duplicate(_default_source_Salome_file);
+ }
+
+ // Update Salome_file state
+ _state.number_of_files++;
+ _state.files_ok = false;
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::connect
+ */
+//=============================================================================
+void
+Salome_file_i::connect(Engines::Salome_file_ptr source_Salome_file)
+{
+ if(CORBA::is_nil(_default_source_Salome_file))
+ {
+ _default_source_Salome_file = Engines::Salome_file::_duplicate(source_Salome_file);
+ _t_fileManaged::iterator begin = _fileManaged.begin();
+ _t_fileManaged::iterator end = _fileManaged.end();
+ for(;begin!=end;begin++) {
+ // Get the name of the file
+ std::string file_name = begin->first;
+ _t_fileDistributedSource::iterator it = _fileDistributedSource.find(file_name);
+ if (it == _fileDistributedSource.end())
+ {
+ _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file);
+ }
+ }
+ }
+ else
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "already connected to a default Salome_file";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ }
+ // We can connect this Salome_file if there is only one file managed
+ // by the Salome_file
+ //std::string fname;
+ //if (_fileManaged.size() == 1)
+ //{
+ // only one file managed
+ // _t_fileManaged::iterator it = _fileManaged.begin();
+ // fname = it->first;
+ // _fileDistributedSource[fname] = Engines::Salome_file::_duplicate(source_Salome_file);
+ //}
+ //else
+ //{
+ // SALOME::ExceptionStruct es;
+ // es.type = SALOME::INTERNAL_ERROR;
+ // std::string text = "cannot connect";
+ // es.text = CORBA::string_dup(text.c_str());
+ // throw SALOME::SALOME_Exception(es);
+ //}
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::connectDistributedFile
+ */
+//=============================================================================
+void
+Salome_file_i::connectDistributedFile(const char * file_name,
+ Engines::Salome_file_ptr source_Salome_file)
+{
+ // Test if this file is added
+ _t_fileManaged::iterator it = _fileManaged.find(file_name);
+ if (it == _fileManaged.end())
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "file is not added";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ }
+ else
+ {
+ _fileDistributedSource[file_name] = Engines::Salome_file::_duplicate(source_Salome_file);
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::setDistributedSourceFile
+ */
+//=============================================================================
+void
+Salome_file_i::setDistributedSourceFile(const char* file_name,
+ const char * source_file_name)
+{
+ std::string fname(file_name);
+
+ // Test if this file is added
+ _t_fileManaged::iterator it = _fileManaged.find(fname);
+ if (it == _fileManaged.end())
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "file is not added";
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ }
+ else
+ {
+ _fileManaged[fname].source_file_name = CORBA::string_dup(source_file_name);
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::recvFiles
+ */
+//=============================================================================
+void
+Salome_file_i::recvFiles() {
+
+ std::string files_not_ok("");
+
+ _t_fileManaged::iterator begin = _fileManaged.begin();
+ _t_fileManaged::iterator end = _fileManaged.end();
+ for(;begin!=end;begin++)
+ {
+ bool result = true;
+ Engines::file file_infos = begin->second;
+ // Test if the file is local or distributed
+ if (std::string(file_infos.type.in()) == "local")
+ {
+ if (std::string(file_infos.status.in()) == "not_ok")
+ result = checkLocalFile(file_infos.file_name.in());
+ }
+ else
+ {
+ if (std::string(file_infos.status.in()) == "not_ok")
+ result = getDistributedFile(file_infos.file_name.in());
+ }
+ // if the result is false
+ // we add this file to files_not_ok
+ if (!result)
+ {
+ files_not_ok.append(" ");
+ files_not_ok.append(file_infos.file_name.in());
+ }
+ }
+
+ if (files_not_ok != "")
+ {
+ std::cerr << "tutu" << std::endl;
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "files not ready : " + files_not_ok;
+ es.text = CORBA::string_dup(text.c_str());
+ std::cerr << "titi" << std::endl;
+ throw SALOME::SALOME_Exception(es);
+ }
+ else
+ {
+ // We change the state of the Salome_file
+ _state.files_ok = true;
+ }
+}
+
+//=============================================================================
+/*!
+ * local C++ method : This method is used by revFiles to check if a local
+ * managed file is ok.
+ * \param fileName name of the file
+ */
+//=============================================================================
+bool
+Salome_file_i::checkLocalFile(std::string file_name)
+{
+ bool result = true;
+
+ std::string comp_file_name(_fileManaged[file_name].path.in());
+ comp_file_name.append("/");
+ comp_file_name.append(_fileManaged[file_name].file_name.in());
+ if(fopen(comp_file_name.c_str(),"rb") == NULL)
+ {
+ INFOS("file " << comp_file_name << " cannot be open for reading");
+ _fileManaged[file_name].status = CORBA::string_dup("not_ok");
+ result = false;
+ }
+
+ if (result)
+ {
+ _fileManaged[file_name].status = CORBA::string_dup("ok");
+ }
+ return result;
+}
+
+//=============================================================================
+/*!
+ * local C++ method : this method is used by recvFiles to get a
+ * distributed file from is distributed source.
+ * If there is no source_file_name for the file, it tries to get
+ * the file from the source. In this case, the source distributed file has to managed
+ * only one file to be able to the send the file.
+ *
+ * \param fileName name of the file
+ */
+//=============================================================================
+bool
+Salome_file_i::getDistributedFile(std::string file_name)
+{
+ bool result = true;
+ const char * source_file_name = _fileManaged[file_name].source_file_name.in();
+ int fileId;
+ FILE* fp;
+ std::string comp_file_name(_fileManaged[file_name].path.in());
+ comp_file_name.append("/");
+ comp_file_name.append(_fileManaged[file_name].file_name.in());
+
+ // Test if the process can write on disk
+ if ((fp = fopen(comp_file_name.c_str(),"wb")) == NULL)
+ {
+ INFOS("file " << comp_file_name << " cannot be open for writing");
+ _fileManaged[file_name].status = CORBA::string_dup("not_ok");
+ result = false;
+ return result;
+ }
+
+ try
+ {
+ fileId = _fileDistributedSource[file_name]->open(source_file_name);
+ }
+ catch (...)
+ {
+ _fileManaged[file_name].status = CORBA::string_dup("not_ok");
+ fclose(fp);
+ result = false;
+ return result;
+ }
+
+ if (fileId > 0)
+ {
+ Engines::fileBlock* aBlock;
+ int toFollow = 1;
+ int ctr=0;
+ MESSAGE("begin of transfer of " << comp_file_name);
+ while (toFollow)
+ {
+ ctr++;
+ aBlock = _fileDistributedSource[file_name]->getBlock(fileId);
+ toFollow = aBlock->length();
+ CORBA::Octet *buf = aBlock->get_buffer();
+ int nbWri = fwrite(buf, sizeof(CORBA::Octet), toFollow, fp);
+ ASSERT(nbWri == toFollow);
+ }
+ fclose(fp);
+ MESSAGE("end of transfer of " << comp_file_name);
+ _fileDistributedSource[file_name]->close(fileId);
+ }
+ else
+ {
+ INFOS("open reference file for copy impossible");
+ result = false;
+ fclose(fp);
+ _fileManaged[file_name].status = CORBA::string_dup("not_ok");
+ return result;
+ }
+
+ _fileManaged[file_name].status = CORBA::string_dup("ok");
+ return result;
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::removeFile
+ */
+//=============================================================================
+void
+Salome_file_i::removeFile(const char* file_name)
+{
+ MESSAGE("Salome_file_i::removeFile : NOT YET IMPLEMENTED");
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::removeFiles
+ */
+//=============================================================================
+void
+Salome_file_i::removeFiles() {
+ MESSAGE("Salome_file_i::removeFiles : NOT YET IMPLEMENTED");
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::getFilesInfos
+ */
+//=============================================================================
+Engines::files*
+Salome_file_i::getFilesInfos() {
+
+ Engines::files * infos = new Engines::files();
+ infos->length(_fileManaged.size());
+
+ _t_fileManaged::iterator begin = _fileManaged.begin();
+ _t_fileManaged::iterator end = _fileManaged.end();
+ int i = 0;
+ for(;begin!=end;begin++) {
+ (*infos)[i] = *(new Engines::file(begin->second));
+ i++;
+ }
+ return infos;
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::getFileInfos
+ */
+//=============================================================================
+Engines::file*
+Salome_file_i::getFileInfos(const char* file_name) {
+
+ std::string fname(file_name);
+
+ // Test if this file is managed
+ _t_fileManaged::iterator it = _fileManaged.find(fname);
+ if (it == _fileManaged.end())
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "file is not managed";
+ throw SALOME::SALOME_Exception(es);
+ }
+
+ Engines::file * infos = new Engines::file(_fileManaged[fname]);
+ return infos;
+}
+
+//=============================================================================
+/*!
+ * CORBA method
+ * \see Engines::Salome_file::getSalome_fileState
+ */
+//=============================================================================
+Engines::SfState*
+Salome_file_i::getSalome_fileState()
+{
+ return new Engines::SfState(_state);
+}
+
+//=============================================================================
+/*!
+ * CORBA method: try to open the file given. If the file is readable, return
+ * a positive integer else return 0;
+ * \param fileName file name to be transfered
+ * \return fileId = positive integer > 0 if open OK.
+ */
+//=============================================================================
+
+CORBA::Long
+Salome_file_i::open(const char* file_name)
+{
+ int aKey = 0;
+
+ std::string fname(file_name);
+ if (fname == "") {
+ // We enter in the simple case where the user
+ // has not used setDistributedSourceFile.
+ // In this case we try to see if the Salome_file
+ if (_fileManaged.size() == 1)
+ {
+ // only one file managed
+ _t_fileManaged::iterator it = _fileManaged.begin();
+ fname = it->first;
+ }
+ else
+ {
+ // we can't choose the file so :
+ return aKey;
+ }
+ }
+
+ _t_fileManaged::iterator it = _fileManaged.find(fname);
+ if (it == _fileManaged.end())
+ {
+ return aKey;
+ }
+
+ std::string comp_file_name(_fileManaged[fname].path.in());
+ comp_file_name.append("/");
+ comp_file_name.append(fname);
+ MESSAGE("Salome_file_i::open " << comp_file_name);
+ FILE* fp;
+ if ((fp = fopen(comp_file_name.c_str(),"rb")) == NULL)
+ {
+ INFOS("file " << comp_file_name << " is not readable");
+ return aKey;
+ }
+
+ aKey = ++_fileId;
+ _fileAccess[aKey] = fp;
+ return aKey;
+}
+
+//=============================================================================
+/*!
+ * CORBA method: close the file associated to the fileId given at open.
+ * \param fileId got in return from open method
+ */
+//=============================================================================
+
+void
+Salome_file_i::close(CORBA::Long fileId)
+{
+ MESSAGE("Salome_file_i::close");
+ FILE* fp;
+ if (!(fp = _fileAccess[fileId]) )
+ {
+ INFOS(" no FILE structure associated to fileId " << fileId);
+ }
+ else fclose(fp);
+}
+
+//=============================================================================
+/*!
+ * CORBA method: get a block of data from the file associated to the fileId
+ * given at open.
+ * \param fileId got in return from open method
+ * \return an octet sequence. Last one is empty.
+ */
+//=============================================================================
+
+#define FILEBLOCK_SIZE 256*1024
+
+Engines::fileBlock*
+Salome_file_i::getBlock(CORBA::Long fileId)
+{
+ Engines::fileBlock* aBlock = new Engines::fileBlock;
+
+ FILE* fp;
+ if (! (fp = _fileAccess[fileId]) )
+ {
+ INFOS(" no FILE structure associated to fileId " <<fileId);
+ return aBlock;
+ }
+
+ // use replace member function for sequence to avoid copy
+ // see Advanced CORBA Programming with C++ pp 187-194
+ CORBA::Octet *buf;
+ buf = Engines::fileBlock::allocbuf(FILEBLOCK_SIZE);
+ int nbRed = fread(buf, sizeof(CORBA::Octet), FILEBLOCK_SIZE, fp);
+ aBlock->replace(nbRed, nbRed, buf, 1); // 1 means give ownership
+ return aBlock;
+}
+
+void
+Salome_file_i::setContainer(Engines::Container_ptr container)
+{
+ _container = Engines::Container::_duplicate(container);
+
+ // Update All the files
+ _t_fileManaged::iterator begin = _fileManaged.begin();
+ _t_fileManaged::iterator end = _fileManaged.end();
+ for(;begin!=end;begin++) {
+ begin->second.container = Engines::Container::_duplicate(container);
+ }
+}
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA 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 : Salome_file_i.hxx
+// Author : André RIBES, EDF
+// Module : SALOME
+// $Header:
+
+#ifndef _SALOME_FILE_I_HXX_
+#define _SALOME_FILE_I_HXX_
+
+#include <SALOMEconfig.h>
+
+#include CORBA_SERVER_HEADER(SALOME_Component)
+#include CORBA_SERVER_HEADER(SALOME_Exception)
+
+#include <SALOME_Container.hxx>
+#include <map>
+#include <cstdio>
+
+class CONTAINER_EXPORT Salome_file_i:
+ public virtual POA_Engines::Salome_file
+{
+ public:
+ Salome_file_i();
+ virtual ~Salome_file_i();
+
+ // Import and export methods
+ virtual void load(const char* hdf5_file);
+ virtual void save(const char* hdf5_file);
+ virtual void save_all(const char* hdf5_file);
+
+ // Adding files
+ virtual void setLocalFile(const char* comp_file_name);
+ virtual void setDistributedFile(const char* comp_file_name);
+
+ // Configure DistributedFile
+ virtual void connect(Engines::Salome_file_ptr source_Salome_file);
+ virtual void connectDistributedFile(const char * file_name,
+ Engines::Salome_file_ptr source_Salome_file);
+ virtual void setDistributedSourceFile(const char* file_name,
+ const char * source_file_name);
+
+ // Recv and check files
+ virtual void recvFiles();
+
+ // Removing or deleting files
+ virtual void removeFile(const char* file_name);
+ virtual void removeFiles();
+
+ // Informations methods:
+ virtual void setContainer(Engines::Container_ptr container);
+ virtual Engines::files* getFilesInfos();
+ virtual Engines::file* getFileInfos(const char* file_name);
+ virtual Engines::SfState* getSalome_fileState();
+
+ // ---------------- fileTransfert Methods -----------------------
+ virtual CORBA::Long open(const char* file_name);
+ virtual void close(CORBA::Long fileId);
+ virtual Engines::fileBlock* getBlock(CORBA::Long fileId);
+
+ protected:
+ // ---------------- local C++ methods ---------------------------
+ virtual bool checkLocalFile(std::string file_name);
+ virtual bool getDistributedFile(std::string file_name);
+
+ protected:
+
+ // Contains a relation between a file ID (int) with
+ // a fd descriptor (FILE*) open on the file.
+ typedef std::map<int, FILE*> _t_fileAccess;
+
+ // Contains the informations of the files managed by the Salome_file.
+ typedef std::map<std::string, Engines::file> _t_fileManaged;
+
+ // Contains the CORBA reference for each distributed file managed.
+ typedef std::map<std::string, Engines::Salome_file_var> _t_fileDistributedSource;
+
+ int _fileId;
+ long _path_max;
+ _t_fileAccess _fileAccess;
+ _t_fileManaged _fileManaged;
+ _t_fileDistributedSource _fileDistributedSource;
+ Engines::SfState _state;
+ Engines::Container_ptr _container;
+ Engines::Salome_file_ptr _default_source_Salome_file;
+};
+
+#endif
+++ /dev/null
-// SALOME TestContainer : test of container creation and its life cycle
-//
-// 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 : TestContainer.cxx
-// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
-// Module : SALOME
-// $Header$
-
-#include "utilities.h"
-#include <iostream>
-#include <unistd.h>
-#include <SALOMEconfig.h>
-#include "SALOME_NamingService.hxx"
-#include "SALOME_ContainerManager.hxx"
-#include "SALOME_LifeCycleCORBA.hxx"
-#include "NamingService_WaitForServerReadiness.hxx"
-#include "OpUtil.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-#include "Utils_SALOME_Exception.hxx"
-#include "Utils_CommException.hxx"
-using namespace std;
-
-int main (int argc, char * argv[])
-{
- map<string, int> cycle;
- map<string, int> first;
- Engines::Container_ptr cont;
- Engines::Component_ptr compo;
- bool error = false;
- bool bestImplemented;
-
- // Initializing omniORB
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- CORBA::ORB_ptr orb = init( argc , argv ) ;
-
- SALOME_NamingService *_NS=new SALOME_NamingService(orb);
-
- CORBA::Object_var obj = _NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
- ASSERT( !CORBA::is_nil(obj));
- Engines::ContainerManager_var _ContManager=Engines::ContainerManager::_narrow(obj);
-
- Engines::MachineParameters p;
-
- p.hostname = "";
- p.OS = "LINUX";
- p.mem_mb = 1000;
- p.cpu_clock = 1000;
- p.nb_proc_per_node = 1;
- p.nb_node = 1;
- p.isMPI = false;
-
- char st[10];
- for(int i=0;i<10;i++){
- sprintf(st,"cycl_%d",i);
- p.container_name = CORBA::string_dup(st);
- cont = _ContManager->StartContainer(p,Engines::P_CYCL);
- if(CORBA::is_nil(cont)) error = true;
- }
-
- for(int i=0;i<10;i++){
- sprintf(st,"first_%d",i);
- p.container_name = CORBA::string_dup(st);
- cont = _ContManager->StartContainer(p,Engines::P_FIRST);
- if(CORBA::is_nil(cont)) error = true;
- }
-
- p.container_name = CORBA::string_dup("best");
- cont = _ContManager->StartContainer(p,Engines::P_BEST);
- if(CORBA::is_nil(cont)) bestImplemented = false;
- else bestImplemented = true;
-
- SALOME_LifeCycleCORBA LCC(_NS);
- compo = LCC.FindOrLoad_Component("FactoryServer","GEOM");
- if(CORBA::is_nil(compo)) error = true;
- compo = LCC.FindOrLoad_Component("FactoryServer","GEOM");
- if(CORBA::is_nil(compo)) error = true;
-
- _NS->Change_Directory("/Containers");
-
- vector<string> vec = _NS->list_directory_recurs();
- list<string> lstCont;
- for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++){
- CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
- Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont)){
- cycle[cont->getHostName()]=0;
- first[cont->getHostName()]=0;
- lstCont.push_back((*iter));
- }
- }
- for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){
- CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
- Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont)){
- if(strncmp(basename(cont->name()),"cycl",4)==0)
- cycle[cont->getHostName()]++;
- if(strncmp(basename(cont->name()),"first",5)==0)
- first[cont->getHostName()]++;
- }
- }
- _ContManager->ShutdownContainers();
-
- int cmin=10;
- int cmax=0;
- int fmin=10;
- int fmax=0;
- for(map<string,int>::iterator iter=cycle.begin();iter!=cycle.end();iter++){
- if(strcmp((*iter).first.c_str(),"localhost")!=0){
- if(cycle[(*iter).first]<cmin) cmin=cycle[(*iter).first];
- if(cycle[(*iter).first]>cmax) cmax=cycle[(*iter).first];
- if(first[(*iter).first]<fmin) fmin=first[(*iter).first];
- if(first[(*iter).first]>fmax) fmax=first[(*iter).first];
- }
- }
- if( ((cmax-cmin) <= 1) && (fmax == 10) && !error ){
- string msg;
- if(bestImplemented)
- msg = "TEST OK";
- else
- msg = "TEST OK but FindBest not implemented!";
- MESSAGE(msg);
- return 0;
- }
- else{
- MESSAGE("TEST KO");
- return 1;
- }
-}
--- /dev/null
+#include "Salome_file_i.hxx"
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include "HDFascii.hxx"
+
+using namespace std;
+
+void print_infos(Engines::file * infos)
+{
+ cerr << "-------------------------------------------------------------------" << endl;
+ cerr << "file_name = " << infos->file_name << endl;
+ cerr << "path = " << infos->path << endl;
+ cerr << "type = " << infos->type << endl;
+ cerr << "source_file_name = " << infos->source_file_name << endl;
+ cerr << "status = " << infos->status << endl;
+}
+
+void print_state(Engines::SfState * state)
+{
+ cerr << "-------------------------------------------------------------------" << endl;
+ cerr << "name = " << state->name << endl;
+ cerr << "hdf5_file_name = " << state->hdf5_file_name << endl;
+ cerr << "number_of_files = " << state->number_of_files << endl;
+ cerr << "files_ok = " << state->files_ok << endl;
+}
+
+
+int main (int argc, char * argv[])
+{
+ system("rm toto cat test.hdf test2.hdf");
+
+ Salome_file_i file;
+ Salome_file_i file2;
+ Salome_file_i file3;
+ Salome_file_i file4;
+ Salome_file_i file5;
+ Engines::file * infos;
+ Engines::SfState * state;
+ Engines::files * all_infos;
+ PortableServer::POA_var root_poa;
+ PortableServer::POAManager_var pman;
+ CORBA::Object_var obj;
+
+ cerr << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
+ cerr << "Test of setLocalFile()" << endl;
+ file.setLocalFile("/tmp/toto");
+ infos = file.getFileInfos("toto");
+ print_infos(infos);
+
+
+ cerr << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
+ cerr << "Test of getFilesInfos()" << endl;
+ all_infos = file.getFilesInfos();
+ for (int i = 0; i < all_infos->length(); i++)
+ {
+ print_infos(&((*all_infos)[i]));
+ }
+
+ cerr << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
+ cerr << "Test of getSalome_fileState()" << endl;
+ state = file.getSalome_fileState();
+ print_state(state);
+
+ // We start CORBA ...
+ CORBA::ORB_ptr orb = CORBA::ORB_init(argc , argv);
+ obj = orb->resolve_initial_references("RootPOA");
+ root_poa = PortableServer::POA::_narrow(obj);
+ pman = root_poa->the_POAManager();
+ pman->activate();
+
+ file2.setLocalFile("/tmp/toto_distributed_source");
+ Engines::Salome_file_ptr file2_ref = file2._this();
+
+ cerr << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
+ cerr << "Test of setDistributedFile()" << endl;
+ file.setDistributedFile("/tmp/toto_distributed");
+ file.connectDistributedFile("toto_distributed", file2_ref);
+// file.setDistributedSourceFile("toto_distributed", "toto_distributed_source");
+ infos = file.getFileInfos("toto_distributed");
+ print_infos(infos);
+
+ // We create the files ...
+ std::ostringstream oss;
+ oss << "/tmp/toto";
+ std::ofstream f(oss.str().c_str());
+ if (f)
+ f << "blablabla" << std::endl;
+
+ std::ostringstream oss2;
+ oss2 << "/tmp/toto_distributed_source";
+ std::ofstream f2(oss2.str().c_str());
+ if (f2)
+ f2 << "bliblibli" << std::endl;
+
+ try
+ {
+ file.recvFiles();
+ }
+ catch (SALOME::SALOME_Exception & e)
+ {
+ cerr << "Exception : " << e.details.text << endl;
+ }
+
+ cerr << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
+ cerr << "Test of getFilesInfos()" << endl;
+ all_infos = file.getFilesInfos();
+ for (int i = 0; i < all_infos->length(); i++)
+ {
+ print_infos(&((*all_infos)[i]));
+ }
+
+ cerr << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
+ cerr << "Test of getSalome_fileState()" << endl;
+ state = file.getSalome_fileState();
+ print_state(state);
+
+ orb->destroy();
+
+ file3.setLocalFile("/tmp/toto");
+ file3.setLocalFile("/bin/cat");
+ state = file3.getSalome_fileState();
+ print_state(state);
+ file3.save_all("test.hdf");
+ file3.setLocalFile("/bin/tutu");
+ file3.save("test2.hdf");
+
+ file4.load("test.hdf");
+ all_infos = file4.getFilesInfos();
+ for (int i = 0; i < all_infos->length(); i++)
+ {
+ print_infos(&((*all_infos)[i]));
+ }
+ state = file4.getSalome_fileState();
+ print_state(state);
+ file5.load("test2.hdf");
+ all_infos = file5.getFilesInfos();
+ for (int i = 0; i < all_infos->length(); i++)
+ {
+ print_infos(&((*all_infos)[i]));
+ }
+ state = file5.getSalome_fileState();
+ print_state(state);
+
+ // Test of ConvertFromHDFToASCII
+ // and ConvertFromASCIIToHDF
+ cerr << "Test of ConvertFromASCIIToHDF" << endl;
+ HDFascii::ConvertFromASCIIToHDF("/tmp/toto"); // RETURN NULL !
+ cerr << "Test of ConvertFromHDFToASCII" << endl;
+ cerr << HDFascii::ConvertFromHDFToASCII("test2.hdf", false) << endl;
+ cerr << HDFascii::ConvertFromHDFToASCII("test2.hdf", true) << endl;
+
+ cerr << "End of tests" << endl;
+}
--- /dev/null
+#include "DF_definitions.hxx"
+#include "DF_Application.hxx"
+
+using namespace std;
+
+//Constructor
+DF_Application::DF_Application()
+{
+ _currentID = 0;
+}
+
+DF_Application::~DF_Application()
+{
+ _documents.clear();
+}
+
+//Creates a new document with given type, returns a smart pointer to
+//newly created document.
+DF_Document* DF_Application::NewDocument(const string& theDocumentType)
+{
+ DF_Document* aDoc = new DF_Document(theDocumentType);
+ aDoc->_id = ++_currentID;
+ _documents[aDoc->_id] = aDoc;
+ aDoc->_appli = this;
+ return aDoc;
+}
+
+//Closes and removes the given Document
+void DF_Application::Close(const DF_Document* theDocument)
+{
+ int id = -1;
+ if(theDocument) id = theDocument->GetDocumentID();
+
+ if(_documents.find(id) != _documents.end()) {
+ _documents[id]->Clear();
+ _documents.erase(id);
+ delete theDocument;
+ }
+}
+
+//Returns a Document by Document's ID
+DF_Document* DF_Application::GetDocument(int theDocumentID)
+{
+ if(_documents.find(theDocumentID) == _documents.end()) return NULL;
+
+ return _documents[theDocumentID];
+}
+
+//Returns a list of IDs of all currently opened documents
+vector<int> DF_Application::GetDocumentIDs()
+{
+ vector<int> ids;
+ typedef map<int, DF_Document*>::const_iterator DI;
+ for(DI p = _documents.begin(); p!=_documents.end(); p++)
+ ids.push_back(p->first);
+ return ids;
+}
+
+//Returns a number of existent documents
+int DF_Application::NbDocuments()
+{
+ return _documents.size();
+}
+
+
+//Restores a Document from the given file, returns a smart
+//pointer to opened document.
+DF_Document* DF_Application::Open(const string& theFileName)
+{
+ //Not implemented
+ return NULL;
+}
+
+
+//Saves a Document in a given file with name theFileName
+void DF_Application::SaveAs(const DF_Document* theDocument, const string& theFileName)
+{
+ //Not implemented
+}
--- /dev/null
+#ifndef DFAPPLICATION_HXX
+#define DFAPPLICATION_HXX
+
+#include "DF_definitions.hxx"
+#include "DF_Document.hxx"
+#include <string>
+#include <map>
+
+//Class DF_Application responsible for creation and manipulation of Documents
+class DF_Application {
+public:
+ //Constructor
+ Standard_EXPORT DF_Application();
+
+ Standard_EXPORT ~DF_Application();
+
+ //Creates a new document with given type, returns a smart pointer to
+ //newly created document.
+ Standard_EXPORT DF_Document* NewDocument(const std::string& theDocumentType);
+
+ //Closes and removes the given Document
+ Standard_EXPORT void Close(const DF_Document* theDocument);
+
+ //Returns a Document by Document's ID
+ Standard_EXPORT DF_Document* GetDocument(int theDocumentID);
+
+ //Returns a list of IDs of all currently opened documents
+ Standard_EXPORT std::vector<int> GetDocumentIDs();
+
+ //Returns a number of existent documents
+ Standard_EXPORT int NbDocuments();
+
+ //Virtual methods to be redefined if required by specific application
+
+ //Restores a Document from the given file, returns a smart
+ //pointer to opened document.
+ Standard_EXPORT virtual DF_Document* Open(const std::string& theFileName);
+
+ //Saves a Document in a given file with name theFileName
+ Standard_EXPORT virtual void SaveAs(const DF_Document* theDocument, const std::string& theFileName);
+
+private:
+ int _currentID;
+ std::map<int, DF_Document*> _documents;
+
+};
+#endif
--- /dev/null
+#include "DF_definitions.hxx"
+#include "DF_Label.hxx"
+#include "DF_Attribute.hxx"
+
+using namespace std;
+
+//Class DF_Attribute is used to store some data defined by the DF_Attribute type
+
+//Constructor
+DF_Attribute::DF_Attribute()
+{
+ _node = NULL;
+}
+
+DF_Attribute::~DF_Attribute()
+{
+ //Remove an attribute from a map of the node's attributes to
+ //avoid double deletion on the node destruction
+ if(_node) {
+ map<string, DF_Attribute*>::iterator mi;
+ for(mi =_node->_attributes.begin(); mi != _node->_attributes.end(); mi++) {
+ if(mi->second == this) {
+ _node->_attributes.erase(mi);
+ }
+ }
+ }
+}
+
+ //Returns a Label on which this Attribute is located.
+DF_Label DF_Attribute::Label() const
+{
+ return DF_Label(_node);
+}
+
+ //Searches an Attribute with given ID located on the same Label as this Attribute.
+DF_Attribute* DF_Attribute::FindAttribute(const string& theID) const
+{
+ if(!_node) return NULL;
+ return Label().FindAttribute(theID);
+}
+
+
--- /dev/null
+#ifndef DFATTRIBUTE_HXX
+#define DFATTRIBUTE_HXX
+
+#include "DF_definitions.hxx"
+#include <string>
+
+class DF_Label;
+class DF_LabelNode;
+
+//Class DF_Attribute is used to store some data defined by the DF_Attribute type
+class DF_Attribute {
+protected:
+ DF_LabelNode* _node;
+
+public:
+ //Constructor
+ Standard_EXPORT DF_Attribute();
+
+ Standard_EXPORT virtual ~DF_Attribute();
+
+ //Returns a Label on which this Attribute is located.
+ Standard_EXPORT DF_Label Label() const;
+
+ //Searches an Attribute with given ID located on the same Label as this Attribute.
+ Standard_EXPORT DF_Attribute* FindAttribute(const std::string& theID) const;
+
+
+ Standard_EXPORT virtual std::string Save() { return ""; }
+ Standard_EXPORT virtual void Load(const std::string&) {}
+
+ //######## Virtual methods that must be redefined in descendants of the DF_Attribute
+
+ //This method must be redefined in all descendents of the DF_Attribute
+ //ID is a std::string that uniquely identify the given type of Attributes within the Application.
+ Standard_EXPORT virtual const std::string& ID() const = 0;
+
+ //Restores a content of this Attribute from another Attribute
+ Standard_EXPORT virtual void Restore(DF_Attribute* theAttribute) = 0;
+
+ //Creates a new empty copy oà this Attribute
+ Standard_EXPORT virtual DF_Attribute* NewEmpty() const = 0;
+
+ //Pastes a content of this Attribute into another Attribute
+ Standard_EXPORT virtual void Paste(DF_Attribute* theIntoAttribute) = 0;
+
+
+ //######## Callbacks
+
+ Standard_EXPORT virtual void AfterAddition() {}
+ Standard_EXPORT virtual void BeforeForget() {}
+
+protected:
+ void Backup() {}
+
+
+friend class DF_Label;
+
+};
+
+#endif
--- /dev/null
+#include "DF_ChildIterator.hxx"
+
+using namespace std;
+
+
+//Constructor
+DF_ChildIterator::DF_ChildIterator(const DF_Label& theLabel, bool allLevels)
+ :_root(NULL), _current(NULL)
+{
+ Init(theLabel, allLevels);
+}
+
+DF_ChildIterator::DF_ChildIterator()
+ :_root(NULL), _current(NULL)
+{
+}
+
+DF_ChildIterator::~DF_ChildIterator()
+{
+ _root = NULL;
+ _current = NULL;
+}
+
+//Initializes the iterator
+void DF_ChildIterator::Init(const DF_Label& theLabel, bool allLevels)
+{
+ _root = theLabel._node;
+ _allLevels = allLevels;
+ if(_root) _current = _root->_firstChild;
+}
+
+//Returns a current Label
+DF_Label DF_ChildIterator::Value()
+{
+ return DF_Label(_current);
+}
+
+//Returns true if there is a current Label
+bool DF_ChildIterator::More()
+{
+ return bool(_current);
+}
+
+//Moves to the next Label
+void DF_ChildIterator::Next()
+{
+ if(!_allLevels) {
+ _current = _current->_next; //Move to the next brother
+ return;
+ }
+ else {
+ if(_current->_firstChild) { //Go down to the first child
+ _current = _current->_firstChild;
+ }
+ else {
+ if(_current->_next) { //Next Brother
+ _current = _current->_next;
+ }
+ else {
+ if(_current->_father && _current->_father != _root) {
+ DF_LabelNode *father = _current->_father;
+ _current = father->_next;
+ if(!_current) {
+ while(father && father != _root) {
+ father = father->_father;
+ if(father->_next) break;
+ }
+ if(father == _root) father = NULL;
+ if(father) _current = father->_next;
+ else _current = NULL;
+ }
+ }
+ else {
+ _current = NULL; //We iterate the whole sub tree
+ }
+ }
+ }
+ }
+}
+
--- /dev/null
+#ifndef DFCHILDITERATOR_HXX
+#define DFCHILDITERATOR_HXX
+
+#include "DF_definitions.hxx"
+#include "DF_Label.hxx"
+
+#include <string>
+
+//Class DF_ChildIterator is used to iterate a tree of Labels in the Document
+class DF_ChildIterator {
+public:
+ //Constructor
+ Standard_EXPORT DF_ChildIterator(const DF_Label& theLabel, bool allLevels = false);
+
+ Standard_EXPORT DF_ChildIterator();
+
+ Standard_EXPORT ~DF_ChildIterator();
+
+ //Initializes the iterator, if allLevels is true the iterator before iterating the next
+ //brother of the current Label iterates the Label children
+ Standard_EXPORT void Init(const DF_Label& theLabel, bool allLevels = false);
+
+ //Returns a current Label
+ Standard_EXPORT DF_Label Value();
+
+ //Returns true if there is a current Label
+ Standard_EXPORT bool More();
+
+ //Moves to the next Label
+ Standard_EXPORT void Next();
+
+private:
+ DF_LabelNode* _root;
+ DF_LabelNode* _current;
+ bool _allLevels;
+};
+
+#endif
--- /dev/null
+#include "DF_definitions.hxx"
+#include "DF_Label.hxx"
+#include "DF_Container.hxx"
+
+using namespace std;
+
+//Static method that returns an ID of the give type of attributes
+const string& DF_Container::GetID()
+{
+ static string id = "DF_Container_srn";
+ return id;
+}
+
+//Creates if not exists a Container attribute and places if is not placed it the Label
+DF_Container* DF_Container::Set(DF_Label& theLabel)
+{
+ DF_Attribute* attr = NULL;
+ if(!(attr = theLabel.FindAttribute(DF_Container::GetID()))) {
+ attr = new DF_Container;
+ theLabel.AddAttribute(attr);
+ }
+
+ return dynamic_cast<DF_Container*>(attr);
+}
+
+//Constructor
+DF_Container::DF_Container()
+{
+ _ints.clear();
+ _doubles.clear();
+ _bools.clear();
+ _strings.clear();
+}
+
+//Destructor
+DF_Container::~DF_Container()
+{
+ _ints.clear();
+ _doubles.clear();
+ _bools.clear();
+ _strings.clear();
+}
+
+//Sets an integer value of the attribute with given ID
+void DF_Container::SetInt(const string& theID, int theValue)
+{
+ _ints[theID] = theValue;
+}
+
+//Returns an integer value of the attribute with given ID
+int DF_Container::GetInt(const string& theID)
+{
+ if(!HasIntID(theID))
+ return 0;
+ return _ints[theID];
+}
+
+//Returns True if there is an integer with given ID
+bool DF_Container::HasIntID(const string& theID)
+{
+ if(_ints.find(theID) != _ints.end()) return true;
+ return false;
+}
+
+//Sets a double value of the attribute with given ID
+void DF_Container::SetDouble(const string& theID, const double& theValue)
+{
+ _doubles[theID] = theValue;
+}
+
+
+//Returns a double value of the attribute with given ID
+double DF_Container::GetDouble(const string& theID)
+{
+ if(!HasDoubleID(theID)) return 0.0;
+ return _doubles[theID];
+}
+
+//Returns True if there is a double with given ID
+bool DF_Container::HasDoubleID(const string& theID)
+{
+ if(_doubles.find(theID) != _doubles.end()) return true;
+ return false;
+}
+
+//Sets a string value of the attribute with given ID
+void DF_Container::SetString(const string& theID, const string& theValue)
+{
+ _strings[theID] = theValue;
+}
+
+//Returns a string value of the attribute with given ID
+string DF_Container::GetString(const string& theID)
+{
+ if(!HasStringID(theID)) return "";
+ return _strings[theID];
+}
+
+//Returns True if there is a string with given ID
+bool DF_Container::HasStringID(const string& theID)
+{
+ if(_strings.find(theID) != _strings.end()) return true;
+ return false;
+}
+
+//Sets a boolean value of the attribute with given ID
+void DF_Container::SetBool(const string& theID, bool theValue)
+{
+ _bools[theID] = theValue;
+}
+
+//Returns a boolean value of the attribute with given ID
+bool DF_Container::GetBool(const string& theID)
+{
+ if(!HasBoolID(theID)) return false;
+ return _bools[theID];
+}
+
+//Returns True if there is a boolean value with given ID
+bool DF_Container::HasBoolID(const string& theID)
+{
+ if(_bools.find(theID) != _bools.end()) return true;
+ return false;
+}
+
+//Clears a content of the attribute
+void DF_Container::Clear()
+{
+ _ints.clear();
+ _doubles.clear();
+ _strings.clear();
+ _bools.clear();
+}
+
+//ID is a string that uniquely identify the given type of Attributes within the Application.
+const string& DF_Container::ID() const
+{
+ return GetID();
+}
+
+//Restores a content of this Attribute from another Attribute
+void DF_Container::Restore(DF_Attribute* theAttribute)
+{
+ Clear();
+
+ DF_Container* attr = dynamic_cast<DF_Container*>(theAttribute);
+ if(!attr) return;
+
+ typedef map<string, int>::const_iterator SI;
+ for(SI p = attr->_ints.begin(); p != attr->_ints.end(); p++)
+ _ints[p->first] = p->second;
+
+ typedef map<string, double>::const_iterator SD;
+ for(SD p = attr->_doubles.begin(); p != attr->_doubles.end(); p++)
+ _doubles[p->first] = p->second;
+
+ typedef map<string, string>::const_iterator SS;
+ for(SS p = attr->_strings.begin(); p != attr->_strings.end(); p++)
+ _strings[p->first] = p->second;
+
+ typedef map<string, bool>::const_iterator SB;
+ for(SB p = attr->_bools.begin(); p != attr->_bools.end(); p++)
+ _bools[p->first] = p->second;
+}
+
+//Creates a new empty copy oà this Attribute
+DF_Attribute* DF_Container::NewEmpty() const
+{
+ return new DF_Container();
+}
+
+//Pastes a content of this Attribute into another Attribute
+void DF_Container::Paste(DF_Attribute* theIntoAttribute)
+{
+ DF_Container* attr = dynamic_cast<DF_Container*>(theIntoAttribute);
+ if(!attr) return;
+
+ attr->Clear();
+
+ typedef map<string, int>::const_iterator SI;
+ for(SI p = _ints.begin(); p != _ints.end(); p++)
+ attr->_ints[p->first] = p->second;
+
+ typedef map<string, double>::const_iterator SD;
+ for(SD p = _doubles.begin(); p != _doubles.end(); p++)
+ attr->_doubles[p->first] = p->second;
+
+ typedef map<string, string>::const_iterator SS;
+ for(SS p = _strings.begin(); p != _strings.end(); p++)
+ attr->_strings[p->first] = p->second;
+
+ typedef map<string, bool>::const_iterator SB;
+ for(SB p = _bools.begin(); p != _bools.end(); p++)
+ attr-> _bools[p->first] = p->second;
+}
+
--- /dev/null
+#ifndef DFCONTAINER_HXX
+#define DFCONTAINER_HXX
+
+#include "DF_definitions.hxx"
+#include "DF_Attribute.hxx"
+#include <string>
+#include <map>
+
+//Class DF_Container is used to store several types of data
+class DF_Container : public DF_Attribute
+{
+public:
+
+ //Static method that returns an ID of the give type of attributes
+ Standard_EXPORT static const std::string& GetID();
+
+ //Creates if not exists a Container attribute and places if is not placed it the Label
+ Standard_EXPORT static DF_Container* Set(DF_Label& theLabel);
+
+ //Constructor
+ Standard_EXPORT DF_Container();
+
+ //Destructor
+ Standard_EXPORT ~DF_Container();
+
+ //Sets an integer value of the attribute with given ID
+ Standard_EXPORT void SetInt(const std::string& theID, int theValue);
+
+ //Returns an integer value of the attribute with given ID
+ Standard_EXPORT int GetInt(const std::string& theID);
+
+ //Returns True if there is an integer with given ID
+ Standard_EXPORT bool HasIntID(const std::string& theID);
+
+ //Sets a double value of the attribute with given ID
+ Standard_EXPORT void SetDouble(const std::string& theID, const double& theValue);
+
+ //Returns a double value of the attribute with given ID
+ Standard_EXPORT double GetDouble(const std::string& theID);
+
+ //Returns True if there is a double with given ID
+ Standard_EXPORT bool HasDoubleID(const std::string& theID);
+
+ //Sets a string value of the attribute with given ID
+ Standard_EXPORT void SetString(const std::string& theID, const std::string& theValue);
+
+ //Returns a string value of the attribute with given ID
+ Standard_EXPORT std::string GetString(const std::string& theID);
+
+ //Returns True if there is a string with given ID
+ Standard_EXPORT bool HasStringID(const std::string& theID);
+
+ //Sets a boolean value of the attribute with given ID
+ Standard_EXPORT void SetBool(const std::string& theID, bool theValue);
+
+ //Returns a boolean value of the attribute with given ID
+ Standard_EXPORT bool GetBool(const std::string& theID);
+
+ //Returns True if there is a boolean value with given ID
+ Standard_EXPORT bool HasBoolID(const std::string& theID);
+
+ //Clears a content of the attribute
+ Standard_EXPORT void Clear();
+
+ //ID is a std::string that uniquely identify the given type of Attributes within the Application.
+ Standard_EXPORT virtual const std::string& ID() const;
+
+ //Restores a content of this Attribute from another Attribute
+ Standard_EXPORT virtual void Restore(DF_Attribute* theAttribute);
+
+ //Creates a new empty copy of this Attribute
+ Standard_EXPORT virtual DF_Attribute* NewEmpty() const;
+
+ //Pastes a content of this Attribute into another Attribute
+ Standard_EXPORT virtual void Paste(DF_Attribute* theIntoAttribute);
+
+
+protected:
+ std::map<std::string, int> _ints;
+ std::map<std::string, double> _doubles;
+ std::map<std::string, std::string> _strings;
+ std::map<std::string, bool> _bools;
+};
+
+#endif
--- /dev/null
+#include "DF_definitions.hxx"
+#include "DF_Document.hxx"
+#include "DF_Label.hxx"
+#include "DF_ChildIterator.hxx"
+
+using namespace std;
+
+//Class DF_Document is container for user's data stored as a tree of Labels
+//with assigned Attributes
+
+DF_Document::DF_Document(const string& theDocumentType)
+{
+ _id = -1;
+ _type = theDocumentType;
+ _modified = true;
+}
+
+DF_Document::~DF_Document()
+{
+ Clear();
+}
+
+DF_Application* DF_Document::GetApplication()
+{
+ return _appli;
+}
+
+//Returns a Label of this Document with entry "0:1"
+DF_Label DF_Document::Main()
+{
+ if(!_main.IsNull()) return _main;
+
+ if(_root.IsNull()) {
+ _root = DF_Label(new DF_LabelNode());
+ _root._node->_document = this;
+ }
+
+ _main = _root.FindChild(1, true);
+
+ return _main;
+}
+
+//Returns a Label of this Document with entry "0:"
+DF_Label DF_Document::Root()
+{
+ if(!_root.IsNull()) return _root;
+
+ if(_root.IsNull()) {
+ _root = DF_Label(new DF_LabelNode());
+ _root._node->_document = this;
+ }
+
+ return _root;
+}
+
+
+//Returns an ID of this
+int DF_Document::GetDocumentID() const
+{
+ return _id;
+}
+
+//Returns a type of the Document
+string DF_Document::GetDocumentType()
+{
+ return _type;
+}
+
+//Clears the content of this Document
+void DF_Document::Clear()
+{
+ if(_root.IsNull()) return;
+
+ vector<DF_LabelNode*> vn;
+ DF_ChildIterator CI(_root, true);
+ for(; CI.More(); CI.Next()) {
+ DF_LabelNode* node = CI.Value()._node;
+ if(node) vn.push_back(node);
+ }
+
+ for(int i = 0, len = vn.size(); i<len; i++)
+ delete vn[i];
+
+ _root._node->Reset();
+}
+
+//Returns true if this document is empty
+bool DF_Document::IsEmpty()
+{
+ if(_root.IsNull()) return true;
+
+ DF_ChildIterator CI(_root, true);
+ for(; CI.More(); CI.Next()) {
+ DF_LabelNode* node = CI.Value()._node;
+ if(node->_attributes.size()) return false;
+ }
+
+ return true;
+}
+
+//Returns true if this document is modified
+bool DF_Document::IsModified()
+{
+ return _modified;
+}
+
+//Sets whether a document is modified
+void DF_Document::SetModified(bool isModified)
+{
+ _modified = isModified;
+}
+
+
+//Restores a content of the Document from the std::string theData
+void DF_Document::Load(const std::string& theData)
+{
+ //Not implemented
+}
+
+//Converts a content of the Document into the std::string
+string DF_Document::Save()
+{
+ //Not implemented
+ return "";
+}
--- /dev/null
+#ifndef DFDOCUMENT_HXX
+#define DFDOCUMENT_HXX
+
+#include "DF_definitions.hxx"
+#include "DF_Label.hxx"
+
+#include <string>
+
+class DF_Application;
+
+//Class DF_Document is container for user's data stored as a tree of Labels
+//with assigned Attributes
+class DF_Document {
+public:
+ //Constructor
+ Standard_EXPORT DF_Document(const std::string& theDocumentType);
+
+ Standard_EXPORT ~DF_Document();
+
+ Standard_EXPORT DF_Application* GetApplication();
+
+ //Returns a Label of this Document with entry "0:1"
+ Standard_EXPORT DF_Label Main();
+
+ //Returns a root Label with entry "0:"
+ Standard_EXPORT DF_Label Root();
+
+ //Returns an ID of this
+ Standard_EXPORT int GetDocumentID() const;
+
+ //Returns a type of the Document
+ Standard_EXPORT std::string GetDocumentType();
+
+ //Clears the content of this Document
+ Standard_EXPORT void Clear();
+
+ //Returns true if this document is empty
+ Standard_EXPORT bool IsEmpty();
+
+ //Returns true if this document is modified
+ Standard_EXPORT bool IsModified();
+
+ //Returns true if this document is modified
+ Standard_EXPORT void SetModified(bool isModified);
+
+ //########### Load/Save virtual methods ##
+
+ //Restores a content of the Document from the std::string theData
+ Standard_EXPORT virtual void Load(const std::string& theData);
+
+ //Converts a content of the Document into the std::string
+ Standard_EXPORT virtual std::string Save();
+
+ friend class DF_Application;
+
+private:
+ DF_Label _main;
+ DF_Label _root;
+ std::string _type;
+ int _id;
+ bool _modified;
+ DF_Application* _appli;
+};
+
+#endif
--- /dev/null
+#include "DF_definitions.hxx"
+#include "DF_Label.hxx"
+#include "DF_Document.hxx"
+#include "DF_Attribute.hxx"
+#include "DF_ChildIterator.hxx"
+
+#include <algorithm>
+
+using namespace std;
+
+//Class DF_Label defines a persistence reference in DF_Document that contains a tree of Labels.
+//This reference is named "entry" and is a sequence of tags divided by ":". The root entry is "0:".
+//For example "0:1:1" corresponds the following structure
+// 0_
+// |
+// |_1_
+// |
+// |_ 1
+
+DF_Label DF_Label::Label(const DF_Label& theLabel, const string& theEntry, bool isCreated)
+{
+ if(theLabel.IsNull()) return DF_Label();
+
+ DF_Label aLabel = theLabel.Root();
+ if(theEntry == "0:") return aLabel;
+ if(theEntry == "0:1") return theLabel.GetDocument()->Main();
+
+ char* cc = (char*)theEntry.c_str();
+ int n = 0;
+ vector<int> tags;
+
+ while (*cc != '\0') {
+ while ( *cc >= '0' && *cc <= '9') {
+ n = 10*n + (*cc - '0');
+ ++cc;
+ }
+ if (*cc == ':' || *cc == '\0') {
+ tags.push_back(n);
+ n = 0;
+ if (*cc != '\0') ++cc;
+ }
+ else {
+ tags.clear();
+ break;
+ }
+ }
+
+ if(!tags.size()) return DF_Label();
+
+ for(int i = 1, len = tags.size(); !aLabel.IsNull() && i<len; i++)
+ aLabel = aLabel.FindChild(tags[i], isCreated);
+
+ return aLabel;
+}
+
+DF_Label::DF_Label(DF_LabelNode* theNode)
+ :_node(theNode)
+{
+}
+
+//Constructor
+DF_Label::DF_Label()
+{
+ _node = NULL;
+}
+
+//Copy constructor
+DF_Label::DF_Label(const DF_Label& theLabel)
+{
+ _node = theLabel._node;
+}
+
+DF_Label& DF_Label::operator=(const DF_Label& theLabel)
+{
+ _node = theLabel._node;
+ return *this;
+}
+
+//Destructor
+DF_Label::~DF_Label()
+{
+ _node = NULL;
+}
+
+//Returns a smart pointer to Document which contains this Label
+DF_Document* DF_Label::GetDocument() const
+{
+ if(!_node) return NULL;
+ return _node->_document;
+}
+
+//Returns true if theLabel equals to this label
+bool DF_Label::operator==(const DF_Label& theLabel)
+{
+ if(IsNull() || theLabel.IsNull()) return false;
+ return (theLabel.Entry() == Entry());
+}
+
+//Returns true if theLabel doesn't equals to this label
+bool DF_Label::operator!=(const DF_Label& theLabel)
+{
+ if(IsNull() || theLabel.IsNull()) return true;
+ return (theLabel.Entry() != Entry());
+}
+
+
+//Returns a tag of this Label
+int DF_Label::Tag() const
+{
+ if(!_node) return -1;
+ return _node->_tag;
+}
+
+//Returns true if this Label is attached to the tree in the Document.
+bool DF_Label::IsAttached()
+{
+ if(!_node) return false;
+ return (bool)(_node->_document);
+}
+
+//Searches an Attribute with given ID located on this Label.
+//Returns true if the Attribute is found.
+DF_Attribute* DF_Label::FindAttribute(const std::string& theID) const
+{
+ if(!_node) return NULL;
+
+ if(_node->_attributes.find(theID) == _node->_attributes.end()) return NULL;
+ return _node->_attributes[theID];
+}
+
+//Returns true if there is an Attribute with given ID on this Label.
+bool DF_Label::IsAttribute(const std::string& theID) const
+{
+ if(!_node) return false;
+
+ return (_node->_attributes.find(theID) != _node->_attributes.end());
+}
+
+//Adds theAttribute to the Label where this Attribute is located.
+//Returns true if theAttribute was added.
+bool DF_Label::AddAttribute(DF_Attribute* theAttribute) const
+{
+ if(!_node) return false;
+
+ if(_node->_attributes.find(theAttribute->ID()) != _node->_attributes.end()) return false;
+ theAttribute->_node = _node;
+ _node->_attributes[theAttribute->ID()] = theAttribute;
+ theAttribute->AfterAddition();
+
+ return true;
+}
+
+//Forgets an Attribute with given ID located on the this Label.
+bool DF_Label::ForgetAttribute(const std::string& theID) const
+{
+ if(!_node) return false;
+
+ if(_node->_attributes.find(theID) == _node->_attributes.end()) return false;
+ DF_Attribute* attr = _node->_attributes[theID];
+ attr->BeforeForget();
+ _node->_attributes.erase(theID);
+ delete attr;
+
+ return true;
+}
+
+//Forgets all Attributes located on this Label.
+bool DF_Label::ForgetAllAttributes(bool clearChildren) const
+{
+ if(!_node) return false;
+
+ vector<DF_Attribute*> va = GetAttributes();
+ _node->_attributes.clear();
+
+ for(int i = 0, len = va.size(); i<len; i++) {
+ va[i]->BeforeForget();
+ delete va[i];
+ }
+
+ if(clearChildren) {
+ DF_ChildIterator CI(*this, true);
+ for(; CI.More(); CI.Next())
+ CI.Value().ForgetAllAttributes(true);
+ }
+
+ return true;
+}
+
+//Returns Father of this Label.
+DF_Label DF_Label::Father() const
+{
+ if(!_node) return DF_Label();
+
+ return _node->_father;
+}
+
+//Returns is this Label is not initialized
+bool DF_Label::IsNull() const
+{
+ return (!_node || (_node->_document == NULL));
+}
+
+//Returns is this Label is a Root label
+bool DF_Label::IsRoot() const
+{
+ if(IsNull() || Father().IsNull()) return true;
+ return false;
+}
+
+
+//Returns true if this Label has Attributes.
+bool DF_Label::HasAttributes() const
+{
+ if(!_node) return false;
+
+ return !(_node->_attributes.empty());
+}
+
+//Returns a list of Attributes of this Label.
+vector<DF_Attribute*> DF_Label::GetAttributes() const
+{
+ vector<DF_Attribute*> attributes;
+ if(!_node) return attributes;
+
+ typedef map<string, DF_Attribute*>::const_iterator AI;
+ vector<string> sorted;
+ for(AI p = _node->_attributes.begin(); p!=_node->_attributes.end(); p++)
+ sorted.push_back(p->first);
+
+ sort(sorted.begin(), sorted.end());
+ int len = sorted.size();
+ for(int i = 0; i<len; i++)
+ attributes.push_back(_node->_attributes[sorted[i]]);
+
+ return attributes;
+}
+
+//Returns true if this Label has a child Label.
+bool DF_Label::HasChild() const
+{
+ if(!_node) return false;
+
+ return (bool)(_node->_firstChild);
+}
+
+//Returns a number of child Labels.
+int DF_Label::NbChildren() const
+{
+ if(!_node) return -1;
+
+ if(!_node->_firstChild) return 0;
+ int nb = 1;
+ DF_LabelNode* next = _node->_firstChild->_next;
+ while(next) {
+ nb++;
+ next = next->_next;
+ }
+
+ return nb;
+}
+
+//Returns the depth (a number of fathers required to identify the Label) of this Label in the tree.
+int DF_Label::Depth() const
+{
+ if(!_node) return -1;
+
+ return _node->_depth;
+}
+
+//Returns true if this Label is a descendant of theLabel.
+bool DF_Label::IsDescendant(const DF_Label& theLabel)
+{
+ if(!_node) return false;
+
+ DF_LabelNode* father = _node->_father;
+ if(!father) return false;
+
+ while(father) {
+ if(father == theLabel._node) return true;
+ father = father->_father;
+ }
+
+ return false;
+}
+
+//Returns the root Label of a Label tree to which this Label belongs.
+DF_Label DF_Label::Root() const
+{
+ if(!_node) return DF_Label();
+
+ return _node->_document->Main().Father();
+}
+
+//Finds a child Label of this Label with a given tag. If isCreate = true and there is no child
+//Label with the given tag, the child Label is created.
+DF_Label DF_Label::FindChild(int theTag, bool isCreate)
+{
+ if(!_node || IsNull()) return DF_Label();
+
+ DF_LabelNode *aLabel = NULL, *aPrevious = NULL, *aNext = NULL;
+ if(!_node->_firstChild && !isCreate) return DF_Label();
+
+ if(_node->_firstChild && _node->_firstChild->_tag == theTag)
+ return DF_Label(_node->_firstChild);
+
+ if(_node->_lastChild) {
+ if(_node->_lastChild->_tag == theTag) return DF_Label(_node->_lastChild);
+ if(_node->_lastChild->_tag < theTag) aPrevious = _node->_lastChild;
+ }
+
+ if(!aPrevious) {
+ aLabel = _node->_firstChild;
+ while(aLabel) {
+ if(aLabel->_tag == theTag) return DF_Label(aLabel);
+ if(aLabel->_tag > theTag) {
+ aNext = aLabel;
+ break;
+ }
+ if(aLabel->_tag < theTag) aPrevious = aLabel;
+ aLabel = aLabel->_next;
+ }
+ }
+
+ if(!isCreate) return DF_Label();
+
+ DF_LabelNode* aChild = new DF_LabelNode();
+ aChild->_father = this->_node;
+ aChild->_document = _node->_document;
+ aChild->_tag = theTag;
+ aChild->_depth = _node->_depth+1;
+ if(aNext) {
+ aChild->_previous = aNext->_previous;
+ aChild->_next = aNext;
+ aNext->_previous = aChild;
+ }
+ if(aPrevious) {
+ aChild->_previous = aPrevious;
+ aChild->_next = aPrevious->_next;
+ aPrevious->_next = aChild;
+ }
+
+ if(!_node->_firstChild || (aNext && aNext == _node->_firstChild) ) _node->_firstChild = aChild;
+ if(!_node->_lastChild || !aNext) _node->_lastChild = aChild;
+
+ return aChild;
+}
+
+//Creates a new child Label of this Label.
+DF_Label DF_Label::NewChild()
+{
+ if(!_node || IsNull()) return DF_Label();
+
+ int tag = 1;
+ if(_node->_lastChild) tag = _node->_lastChild->_tag+1;
+
+ return FindChild(tag, true);
+}
+
+//Returns a string entry of this Label
+string DF_Label::Entry() const
+{
+ string entry = "";
+ vector<int> vi;
+ DF_LabelNode* father = this->_node;
+ while(father) {
+ vi.push_back(father->_tag);
+ father = father->_father;
+ }
+
+ int len = vi.size();
+ if(len == 1) {
+ entry = "0:";
+ }
+ else {
+ char buffer[128];
+ for(int i = len-1; i>=0; i--) {
+ int tag = vi[i];
+ sprintf(buffer, "%d", tag);
+ entry+=string(buffer);
+ if(i) entry += ":";
+ }
+ }
+
+ return entry;
+}
+
+bool DF_Label::IsEqual(const DF_Label& theLabel)
+{
+ if(theLabel.IsNull() || IsNull()) return false;
+ DF_Label L(theLabel);
+ return (L.Entry() == Entry());
+}
+
+
+void DF_Label::Nullify()
+{
+ delete _node;
+ _node = NULL;
+}
+
+void DF_Label::dump()
+{
+ if(!_node) cout << "DF_Label addr : " << this << " NULL " << endl;
+ else {
+ cout << "DF_Label addr : " << this->_node << " entry : " << Entry() << endl;
+ if(_node->_father) cout << " Father : " << _node->_father << " entry : " << Father().Entry() << endl;
+ else cout << " Father : NULL " << endl;
+
+ if(_node->_firstChild) cout << " FirstChild : " << _node->_firstChild << " entry : " << DF_Label(_node->_firstChild).Entry() << endl;
+ else cout << " FirstChild : NULL " << endl;
+
+ if(_node->_lastChild) cout << " LastChild : " << _node->_lastChild << " entry : " << DF_Label(_node->_lastChild).Entry() << endl;
+ else cout << " LastChild : NULL " << endl;
+
+ if(_node->_previous) cout << " Previous : " << _node->_previous << " entry : " << DF_Label(_node->_previous).Entry() << endl;
+ else cout << " Previous : NULL " << endl;
+
+ if(_node->_next) cout << " Next : " << _node->_next << " entry : " << DF_Label(_node->_next).Entry() << endl;
+ else cout << " Next : NULL " << endl;
+ }
+}
+
+
+/*
+ ###############################################
+ DF_LabelNode methods
+ ###############################################
+*/
+
+DF_LabelNode::DF_LabelNode()
+{
+ _depth = 0;
+ _tag = 0;
+ _attributes.clear();
+ _document = NULL;
+ _father = NULL;
+ _firstChild = NULL;
+ _lastChild = NULL;
+ _previous = NULL;
+ _next = NULL;
+}
+
+DF_LabelNode::~DF_LabelNode()
+{
+ vector<DF_Attribute*> va;
+ typedef map<string, DF_Attribute*>::const_iterator AI;
+ for(AI p = _attributes.begin(); p!=_attributes.end(); p++)
+ va.push_back(p->second);
+
+ for(int i = 0, len = va.size(); i<len; i++)
+ delete va[i];
+
+ _attributes.clear();
+}
+
+
+void DF_LabelNode::Reset()
+{
+ _depth = 0;
+ _tag = 0;
+
+ vector<DF_Attribute*> va;
+ typedef map<string, DF_Attribute*>::const_iterator AI;
+ for(AI p = _attributes.begin(); p!=_attributes.end(); p++)
+ va.push_back(p->second);
+
+ for(int i = 0, len = va.size(); i<len; i++)
+ delete va[i];
+
+ _attributes.clear();
+ _document = NULL;
+ _father = NULL;
+ _firstChild = NULL;
+ _lastChild = NULL;
+ _previous = NULL;
+ _next = NULL;
+}
--- /dev/null
+#ifndef DFLABEL_HXX
+#define DFLABEL_HXX
+
+#include "DF_definitions.hxx"
+#include "DF_Attribute.hxx"
+
+#include <string>
+#include <vector>
+#include <map>
+
+class DF_Document;
+
+
+class DF_LabelNode
+{
+public:
+ DF_LabelNode();
+ ~DF_LabelNode();
+ void Reset();
+private:
+ int _tag;
+ int _depth;
+ DF_LabelNode* _father;
+ DF_LabelNode* _previous;
+ DF_LabelNode* _next;
+ DF_LabelNode* _firstChild;
+ DF_LabelNode* _lastChild;
+ DF_Document* _document;
+ std::map< std::string, DF_Attribute* > _attributes;
+
+ friend class DF_Document;
+ friend class DF_Label;
+ friend class DF_ChildIterator;
+ friend class DF_Attribute;
+};
+
+//Class DF_Label defines a persistence reference in DF_Document that contains a tree of Labels.
+//This reference is named "entry" and is a sequence of tags divided by ":". The root entry is "0:".
+//For example "0:1:1" corresponds the following structure
+// 0_
+// |
+// |_1_
+// |
+// |_ 1
+
+class DF_Label {
+public:
+
+ //Returns a Label by its entry, if isCreated true the Label will be created if not exists
+ Standard_EXPORT static DF_Label Label(const DF_Label& theLabel, const std::string& theEntry, bool isCreated = true);
+
+ //Constructors: creates a root label
+ Standard_EXPORT DF_Label();
+
+ //Copy constructor
+ Standard_EXPORT DF_Label(const DF_Label& theLabel);
+
+ //Creates a Label from the LabelNode
+ Standard_EXPORT DF_Label(DF_LabelNode* theNode);
+
+ //Operator =
+ Standard_EXPORT DF_Label& operator=(const DF_Label& theLabel);
+
+ //Destructor
+ Standard_EXPORT ~DF_Label();
+
+ //Returns a smart pointer to Document which contains this Label
+ Standard_EXPORT DF_Document* GetDocument() const;
+
+ //Returns true if theLabel equals to this label
+ Standard_EXPORT bool operator==(const DF_Label& theLabel);
+
+ //Returns true if theLabel doesn't equals to this label
+ Standard_EXPORT bool operator!=(const DF_Label& theLabel);
+
+ //Returns a tag of this Label
+ Standard_EXPORT int Tag() const;
+
+ //Returns true if this Label is attached to the tree in the Document.
+ Standard_EXPORT bool IsAttached();
+
+ //Searches an Attribute with given ID located on this Label.
+ //Returns true if the Attribute is found.
+ Standard_EXPORT DF_Attribute* FindAttribute(const std::string& theID) const;
+
+ //Returns true if there is an Attribute with given ID on this Label.
+ Standard_EXPORT bool IsAttribute(const std::string& theID) const;
+
+ //Adds theAttribute to the Label where this Attribute is located.
+ //Returns true if theAttribute was added.
+ Standard_EXPORT bool AddAttribute(DF_Attribute* theAttribute) const;
+
+ //Forgets an Attribute with given ID located on the this Label.
+ Standard_EXPORT bool ForgetAttribute(const std::string& theID) const;
+
+ //Forgets all Attributes located on this Label.
+ Standard_EXPORT bool ForgetAllAttributes(bool clearChildren = true) const;
+
+ //Returns Father of this Label.
+ Standard_EXPORT DF_Label Father() const;
+
+ //Return true if the label is not initialized
+ Standard_EXPORT bool IsNull() const;
+
+ //Return true if the label is a Root label
+ Standard_EXPORT bool IsRoot() const;
+
+ //Returns true if this Label has Attributes.
+ Standard_EXPORT bool HasAttributes() const;
+
+ //Returns a list of Attributes of this Label.
+ Standard_EXPORT std::vector<DF_Attribute*> GetAttributes() const;
+
+ //Returns true if this Label has a child Label.
+ Standard_EXPORT bool HasChild() const;
+
+ //Returns a number of child Labels.
+ Standard_EXPORT int NbChildren() const;
+
+ //Returns the depth (a number of fathers required to identify the Label) of this Label in the tree.
+ Standard_EXPORT int Depth() const;
+
+ //Returns true if this Label is a descendant of theLabel.
+ Standard_EXPORT bool IsDescendant(const DF_Label& theLabel);
+
+ //Returns the root Label of a Label tree to which this Label belongs.
+ Standard_EXPORT DF_Label Root() const;
+
+ //Finds a child Label of this Label with a given tag. If isCreate = true and there is no child
+ //Label with the given tag, the child Label is created.
+ Standard_EXPORT DF_Label FindChild(int theTag, bool isCreate = true);
+
+ //Creates a new child Label of this Label.
+ Standard_EXPORT DF_Label NewChild();
+
+ //Returns a string presentation of the entry
+ Standard_EXPORT std::string Entry() const;
+
+ //Returns true if theLabel is the same as me
+ Standard_EXPORT bool IsEqual(const DF_Label& theLabel);
+
+ Standard_EXPORT void dump();
+
+private:
+ //Nullifies the content of the label
+ void Nullify();
+
+friend class DF_Document;
+friend class DF_ChildIterator;
+
+private:
+ DF_LabelNode* _node;
+};
+
+#endif
--- /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 DF_DEF_HXX
+#define DF_DEF_HXX
+
+#ifdef WIN32
+# ifdef DF_EXPORTS
+# define DF_EXPORT __declspec( dllexport )
+# else
+# define DF_EXPORT __declspec( dllimport )
+# endif
+#else
+# define DF_EXPORT
+#endif
+
+#include <iostream.h>
+#include <stdio.h>
+#include <boost/shared_ptr.hpp>
+
+template<class T> class df_shared_ptr: public boost::shared_ptr<T>
+{
+public:
+ df_shared_ptr() {}
+
+ template<class Y>
+ explicit df_shared_ptr(Y * p)
+ {
+ boost::shared_ptr<T>::reset(p);
+ }
+
+ template<class Y>
+ df_shared_ptr(df_shared_ptr<Y> const & r):
+ boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag())
+ {}
+
+ template<class Y>
+ df_shared_ptr & operator=(df_shared_ptr<Y> const & r)
+ {
+ df_shared_ptr<T>(r).swap(*this);
+ return *this;
+ }
+
+ template<class Y> df_shared_ptr& operator()(Y * p) // Y must be complete
+ {
+ if(T* pt = dynamic_cast<T*>(p))
+ boost::shared_ptr<T>::reset(pt);
+ else
+ boost::throw_exception(std::bad_cast());
+ return *this;
+ }
+
+};
+
+# if defined(WNT) && !defined(HAVE_NO_DLL)
+
+# ifndef Standard_EXPORT
+# define Standard_EXPORT __declspec( dllexport )
+// For global variables :
+# define Standard_EXPORTEXTERN __declspec( dllexport ) extern
+# define Standard_EXPORTEXTERNC extern "C" __declspec( dllexport )
+# endif /* Standard_EXPORT */
+
+# ifndef Standard_IMPORT
+# define Standard_IMPORT __declspec( dllimport ) extern
+# define Standard_IMPORTC extern "C" __declspec( dllimport )
+# endif /* Standard_IMPORT */
+
+# else /* WNT */
+
+# ifndef Standard_EXPORT
+# define Standard_EXPORT
+// For global variables :
+# define Standard_EXPORTEXTERN extern
+# define Standard_EXPORTEXTERNC extern "C"
+# endif /* Standard_EXPORT */
+
+# ifndef Standard_IMPORT
+# define Standard_IMPORT extern
+# define Standard_IMPORTC extern "C"
+# endif /* Standard_IMPORT */
+
+# endif /* WNT */
+
+# ifndef __Standard_API
+//# ifdef WNT
+# if !defined(WNT)
+# define __Standard_API Standard_EXPORT
+# define __Standard_APIEXTERN Standard_EXPORTEXTERN
+# else
+# define __Standard_API Standard_IMPORT
+# define __Standard_APIEXTERN Standard_IMPORT
+# endif // __Standard_DLL
+//# else
+//# define __Standard_API
+//# endif // WNT
+# endif // __Standard_API
+
+#include <iostream>
+class Standard_EXPORT DFexception
+{
+public :
+ DFexception(const char *message) {
+ std::cerr << message << std::endl;
+ }
+};
+
+
+#endif
--- /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 : Makefile.am
+# Author : Guillaume Boulant (CSSI)
+# Module : KERNEL
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+#
+# ===============================================================
+# Files to be installed
+# ===============================================================
+#
+# header files
+salomeinclude_HEADERS= \
+ DF_Attribute.hxx \
+ DF_Label.hxx \
+ DF_Application.hxx \
+ DF_Document.hxx \
+ DF_ChildIterator.hxx \
+ DF_Container.hxx \
+ DF_definitions.hxx
+
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS=\
+ -I$(srcdir)/../Basics \
+ -I$(srcdir)/../SALOMELocalTrace \
+ -I$(srcdir)/../HDFPersist \
+ @HDF5_INCLUDES@ \
+ @BOOST_CPPFLAGS@
+
+# This flag is used to resolve the dependencies of OCC libraries.
+LDXMUFLAGS = -L/usr/X11R6/lib@LIB_LOCATION_SUFFIX@ -lXmu
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS =\
+ ../HDFPersist/libSalomeHDFPersist.la \
+ @HDF5_LIBS@ \
+ $(LDXMUFLAGS)
+
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+lib_LTLIBRARIES = libDF.la
+libDF_la_SOURCES = \
+ DF_Attribute.cxx \
+ DF_Label.cxx \
+ DF_Document.cxx \
+ DF_Application.cxx \
+ DF_ChildIterator.cxx \
+ DF_Container.cxx \
+\
+ DF_Attribute.hxx \
+ DF_Label.hxx \
+ DF_Application.hxx \
+ DF_Document.hxx \
+ DF_ChildIterator.hxx \
+ DF_Container.hxx \
+ DF_definitions.hxx
+
+libDF_la_CPPFLAGS = $(COMMON_CPPFLAGS)
+libDF_la_LDFLAGS = -no-undefined -version-info=0:0:0
+libDF_la_LIBADD = $(COMMON_LIBS)
+
+#
+# ===============================================================
+# Executables targets
+# ===============================================================
+#
+bin_PROGRAMS = testDF
+testDF_SOURCES = testDF.cxx
+testDF_CPPFLAGS = $(COMMON_CPPFLAGS)
+testDF_LDADD = libDF.la $(COMMON_LIBS)
+
--- /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
+//
+//File: testDF.cxx
+//Author: Sergey RUIN
+
+#include <stdio.h>
+#include <iostream.h>
+#include <vector>
+#include <string>
+
+#include "DF_definitions.hxx"
+#include "DF_Application.hxx"
+#include "DF_Document.hxx"
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include "DF_Container.hxx"
+#include "DF_ChildIterator.hxx"
+
+#ifndef WNT
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <pwd.h>
+#else
+#include <time.h>
+#include <lmcons.h>
+#endif
+
+using namespace std;
+
+void printStr(const string& theValue)
+{
+ cout << "printStr: " << theValue << endl;
+}
+
+void GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds)
+{
+#ifdef WNT
+ SYSTEMTIME st;
+
+ GetLocalTime ( &st );
+
+ month = st.wMonth;
+ day = st.wDay;
+ year = st.wYear;
+ hours = st.wHour;
+ minutes = st.wMinute;
+ seconds = st.wSecond;
+#else
+ struct tm transfert;
+ struct timeval tval;
+ struct timezone tzone;
+ int status;
+
+ status = gettimeofday( &tval, &tzone );
+ memcpy(&transfert, localtime((time_t *)&tval.tv_sec), sizeof(tm));
+
+ month = transfert.tm_mon + 1;
+ day = transfert.tm_mday;
+ year = transfert.tm_year + 1900;
+ hours = transfert.tm_hour;
+ minutes = transfert.tm_min ;
+ seconds = transfert.tm_sec ;
+#endif
+}
+
+string GetUserName()
+{
+#ifdef WNT
+ char* pBuff = new char[UNLEN + 1];
+ DWORD dwSize = UNLEN + 1;
+ string retVal;
+ GetUserName ( pBuff, &dwSize );
+ string theTmpUserName(pBuff,(int)dwSize -1 );
+ retVal = theTmpUserName;
+ delete [] pBuff;
+ return retVal;
+#else
+ struct passwd *infos;
+ infos = getpwuid(getuid());
+ return string(infos->pw_name);
+#endif
+}
+
+string GetNameFromPath(const string& thePath) {
+ if (thePath.empty()) return "";
+ int pos1 = thePath.rfind('/');
+ int pos2 = thePath.rfind('\\');
+ if(pos1 > 0) return thePath.substr(pos1+1, thePath.size());
+ if(pos2 > 0) return thePath.substr(pos2+1, thePath.size());
+ return thePath;
+}
+
+string GetDirFromPath(const string& thePath) {
+ if (thePath.empty()) return "";
+
+ int pos = thePath.rfind('/');
+ string path;
+ if(pos > 0) {
+ path = thePath.substr(0, pos+1);
+ }
+ if(path.empty()) {
+ pos = thePath.rfind('\\');
+ if(pos > 0) path = thePath.substr(0, pos+1);
+ }
+ if(path.empty()) {
+ pos = thePath.rfind('|');
+ if(pos > 0) path = thePath.substr(0, pos+1);
+ }
+ if(path.empty()) {
+ path = thePath+"/";
+ }
+
+#ifdef WNT //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++)
+ if(path[i] == '|') path[i] = '/';
+ return path;
+}
+
+
+bool Exists(const string thePath)
+{
+#ifdef WNT
+ 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;
+}
+
+
+string divideString(const string& theValue, int nbChars)
+{
+ return theValue.substr(nbChars, theValue.size());
+}
+
+vector<string> splitString(const string& theValue, char separator)
+{
+ vector<string> vs;
+ if(theValue[0] == separator && theValue.size() == 1) return vs;
+ int pos = theValue.find(separator);
+ if(pos < 0) {
+ vs.push_back(theValue);
+ return vs;
+ }
+
+ string s = theValue;
+ if(s[0] == separator) s = s.substr(1, s.size());
+ while((pos = s.find(separator)) >= 0) {
+ vs.push_back(s.substr(0, pos));
+ s = s.substr(pos+1, s.size());
+ }
+
+ if(!s.empty() && s[0] != separator) vs.push_back(s);
+ return vs;
+}
+
+
+int main (int argc, char * argv[])
+{
+ cout << "Test started " << endl;
+
+ DF_Application* appli = new DF_Application;
+ DF_Document* doc1 = appli->NewDocument("doc_1");
+
+ /*
+ DF_Label root1 = doc1->Main();
+ DF_Label child = root1.FindChild(3, true); //0:1:3
+
+ DF_Container* attr1 = DF_Container::Set(child);
+ attr1->SetInt("eighteen", 18);
+
+
+ DF_Attribute* attr = NULL;
+ if(!(attr = child.FindAttribute(DF_Container::GetID()))) {
+ cout << "Attribute wasn't found" << endl;
+ }
+ else {
+ attr1 = dynamic_cast<DF_Container*>(attr);
+ cout << "Attribute was found " << " HasID " << attr1->HasIntID("eighteen") << " value = " << attr1->GetInt("eighteen")<< endl;
+ }
+
+ DF_Container *attr2 = (DF_Container*)child.FindAttribute(DF_Container::GetID());
+
+ if(!attr2) cout << "Can't find the attribute" << endl;
+
+ cout << "Change find : " << attr2->GetInt("eighteen") << endl;
+
+
+ cout << "Forgetting " << child.ForgetAttribute(DF_Container::GetID()) << endl;
+ if(!child.FindAttribute(DF_Container::GetID())) {
+ cout << "Attribute wasn't found" << endl;
+ }
+
+
+ child = root1.NewChild(); //0:1:4
+
+ child.NewChild();//0:1:4:1
+
+ child.NewChild();//0:1:4:2
+
+ cout << "Is equal " << (child == child) << endl;
+ cout << "Is equal " << (child == root1) << endl;
+
+ child = root1.NewChild(); //0:1:5
+
+ child.NewChild();//0:1:5:1
+ root1.NewChild();//0:1:6
+
+
+ DF_ChildIterator CI(root1.Father(), true);
+ //root1.dump();
+ for(; CI.More(); CI.Next()) {
+ cout << CI.Value().Entry() << endl;
+ //CI.Value().dump();
+ }
+
+ DF_Label L = DF_Label::Label(child, "0:1:4:1");
+ cout << "Found Label " << L.Entry() << endl;
+
+ std::string s("012-56");
+
+ int pos = s.find('-');
+ cout << "Fisrt part : " << s.substr(0, pos) << endl;
+ cout << "Last part : " << s.substr(pos+1, s.size()) << endl;
+
+ vector<string> vs = splitString("/dn20/salome/srn/salome2/", '/');
+ for(int i = 0; i<vs.size(); i++)
+ cout << vs[i] << endl;
+
+ cout << "Diveded str = " << divideString("abcdefg",3) << endl;
+
+ //mkdir("/dn20/salome/srn/salome2", 0x1ff);
+
+ //cout << "Exists " << Exists("/dn20/salome/srn/salome2") << endl;
+
+ //cout << GetDirFromPath("/dn20/salome/srn/salome2/test.hdf") << endl;
+ //cout << GetDirFromPath("D:\\salome\\srn\\salome2\\test.hdf") << endl;
+ //cout << GetDirFromPath("D:") << endl;
+ //cout << GetDirFromPath("/dn20") << endl;
+ //cout << GetDirFromPath("..") << endl;
+ //cout << GetDirFromPath("D:\\") << endl;
+ //cout << GetDirFromPath("D:\\test.hdf") << endl;
+
+ cout << "User : " << GetUserName() << endl;
+
+ int month=0,day=0,year=0,hh=0,mn=0,ss=0;
+ GetSystemDate(year, month, day, hh, mn, ss);
+ cout << "Date: " << year << " " << month << " " << day << " " << hh << " " << mn << " " << ss << endl;
+
+ string t("absd");
+ t.insert(t.begin(), 'b');
+ cout << "Result = " << t << endl;
+ char* cstr = (char*)t.c_str();
+ printStr(cstr+1);
+
+ */
+
+ DF_Document* doc2 = appli->NewDocument("doc_2");
+
+ DF_Label root2 = doc2->Main();
+ DF_Label sco = root2.NewChild(); //0:1:1
+ DF_Label so1 = sco.FindChild(3, true); //0:1:1:3
+ DF_Label so5 = so1.FindChild(5, true); //0:1:1:5
+ DF_Label so51 = so5.NewChild(); //0:1:1:5:1
+ DF_Label so511 = so51.NewChild(); //0:1:1:5:1:1
+ DF_Label so513 = so51.FindChild(3, true); //0:1:1:5:1:3
+ DF_Label so5131 = so513.NewChild(); //0:1:1:5:1:3:1
+
+
+ so51.FindChild(2, true);
+
+
+ DF_ChildIterator CI2(so5, true);
+ so5.dump();
+ for(; CI2.More(); CI2.Next()) {
+ cout << " ###### Found child with entry = " << CI2.Value().Entry() << endl;
+ //CI2.Value().dump();
+ }
+
+ delete appli;
+
+ cout << "Test finished " << endl;
+ return 0;
+}
+
--- /dev/null
+/*!
+
+\page dsc_page DSC
+
+DSC means Dynamic Software Component. It's an extension of the %SALOME programming model.
+It provides a new paradigm to design %SALOME components. It also provides new ports for %SALOME services.
+These ports are : interface ports and datastream ports.
+
+\section S1_DSC Datastream ports
+
+We list in this section the datastream ports that are provided by %SALOME.
+
+<ol>
+
+<li>
+<b>BASIC datastream ports</b>
+<table>
+<tr><td> <b> Port name </b> </td><td> <b> Data type </b> </td><td> <b> Idl Name </b> </td><td> <b> Idl File </b> </td></tr>
+<tr><td> BASIC_short </td><td> short </td><td> Data_Short_Port </td><td> SALOME_Ports.idl </td></tr>
+</table>
+</li>
+
+<li>
+<b>CALCIUM datastream ports</b>
+<table>
+<tr><td> <b> Port name </b> </td><td> <b> Data type </b> </td><td> <b> Idl Name </b> </td><td> <b> Idl File </b> </td></tr>
+<tr><td> CALCIUM_integer </td><td> sequence of long </td><td> Calcium_Integer_Port </td><td> Calcium_Ports.idl </td></tr>
+<tr><td> CALCIUM_real </td><td> sequence of float </td><td> Calcium_Real_Port </td><td> Calcium_Ports.idl </td></tr>
+<tr><td> CALCIUM_double </td><td> sequence of double </td><td> Calcium_Double_Port </td><td> Calcium_Ports.idl </td></tr>
+<tr><td> CALCIUM_string </td><td> sequence of %string </td><td> Calcium_String_Port </td><td> Calcium_Ports.idl </td></tr>
+<tr><td> CALCIUM_logical </td><td> sequence of boolean </td><td> Calcium_Logical_Port </td><td> Calcium_Ports.idl </td></tr>
+<tr><td> CALCIUM_complex </td><td> sequence of float </td><td> Calcium_Complex_Port </td><td> Calcium_Ports.idl </td></tr>
+</table>
+</li>
+
+<li>
+<b>PALM datastream ports</b>
+<table>
+<tr><td> <b> Port name </b> </td><td> <b> Data type </b> </td><td> <b> Idl Name </b> </td><td> <b> Idl File </b> </td></tr>
+<tr><td> PALM_short </td><td> short </td><td> Palm_Data_Short_Port </td><td> Palm_Ports.idl </td></tr>
+<tr><td> PALM_seq_short </td><td> sequence of short </td><td> Palm_Data_Seq_Short_Port </td><td> Palm_Ports.idl </td></tr>
+</table>
+</li>
+
+</ol>
+
+*/
+
+
#include "SALOME_NamingService.hxx"
ConnectionManager_i::ConnectionManager_i(CORBA::ORB_ptr orb) {
+ _orb = CORBA::ORB::_duplicate(orb) ;
SALOME_NamingService * ns = new SALOME_NamingService(orb);
const char * ConnectionManagerNameInNS = "/ConnectionManager";
- ns->Register(_this(), ConnectionManagerNameInNS);
+ CORBA::Object_var obref = _this();
+ _remove_ref();
+ ns->Register(obref, ConnectionManagerNameInNS);
+ delete ns;
current_id = 0;
pthread_mutex_init(&mutex, NULL);
const char* uses_port_name,
Engines::DSC_ptr provides_component,
const char* provides_port_name)
-throw (Engines::DSC::PortNotDefined,
- Engines::DSC::BadPortType,
- Engines::DSC::NilPort)
{
- Ports::Port_ptr p_port = provides_component->get_provides_port(provides_port_name, false);
+ Ports::Port_var p_port = provides_component->get_provides_port(provides_port_name, false);
uses_component->connect_uses_port(uses_port_name, p_port);
provides_component->connect_provides_port(provides_port_name);
void
ConnectionManager_i::disconnect(Engines::ConnectionManager::connectionId id,
Engines::DSC::Message message)
-throw (Engines::ConnectionManager::BadId)
{
+ int err=0;
// Connection id exist ?
ids_it = ids.find(id);
if (ids_it == ids.end())
// TODO
// We need to catch exceptions if one of these disconnect operation fails.
connection_infos * infos = ids[id];
- infos->provides_component->disconnect_provides_port(infos->provides_port_name.c_str(),
+ try
+ {
+ infos->provides_component->disconnect_provides_port(infos->provides_port_name.c_str(),
message);
- infos->uses_component->disconnect_uses_port(infos->uses_port_name.c_str(),
- Ports::Port::_duplicate(infos->provides_port),
+ }
+ catch(CORBA::SystemException& ex)
+ {
+ std::cerr << "Problem in disconnect(CORBA::SystemException) provides port: " << infos->provides_port_name << std::endl;
+ err=1;
+ }
+ try
+ {
+ infos->uses_component->disconnect_uses_port(infos->uses_port_name.c_str(),
+ infos->provides_port,
message);
+ }
+ catch(CORBA::SystemException& ex)
+ {
+ std::cerr << "Problem in disconnect(CORBA::SystemException) uses port: " << infos->uses_port_name << std::endl;
+ err=1;
+ }
delete infos;
ids.erase(id);
+
+ if(err)
+ throw Engines::DSC::BadPortReference();
+}
+
+void
+ConnectionManager_i::ShutdownWithExit()
+{
+ if(!CORBA::is_nil(_orb))
+ _orb->shutdown(0);
+
+ //exit( EXIT_SUCCESS );
+}
+
+CORBA::Long
+ConnectionManager_i::getPID()
+{
+ return (CORBA::Long)getpid();
}
Engines::ConnectionManager::connectionId connect(Engines::DSC_ptr uses_component,
const char* uses_port_name,
Engines::DSC_ptr provides_component,
- const char* provides_port_name)
- throw (Engines::DSC::PortNotDefined,
- Engines::DSC::BadPortType,
- Engines::DSC::NilPort);
+ const char* provides_port_name);
/*!
* CORBA method : releases a connection performed with
* \see Engines::ConnectionManager::disconnect
*/
void disconnect(Engines::ConnectionManager::connectionId id,
- Engines::DSC::Message message)
- throw (Engines::ConnectionManager::BadId);
+ Engines::DSC::Message message);
+
+ /*!
+ Shutdown the ConnectionManager process.
+ */
+ void ShutdownWithExit();
+
+ /*!
+ Returns the PID of the connection manager
+ */
+ CORBA::Long getPID();
private :
struct connection_infos {
- Engines::DSC_ptr uses_component;
+ Engines::DSC_var uses_component;
std::string uses_port_name;
- Engines::DSC_ptr provides_component;
+ Engines::DSC_var provides_component;
std::string provides_port_name;
- Ports::Port_ptr provides_port;
+ Ports::Port_var provides_port;
};
typedef std::map<Engines::ConnectionManager::connectionId,
int current_id;
pthread_mutex_t mutex;
+ protected:
+ CORBA::ORB_var _orb;
};
#endif
#define DSC_BASIC_EXPORT
#endif
-#endif
\ No newline at end of file
+#endif
+
pman->activate();
orb->run();
+ orb->destroy();
}catch(CORBA::SystemException&){
MESSAGE("Caught CORBA::SystemException.");
}catch(PortableServer::POA::WrongPolicy&){
--- /dev/null
+# Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+#
+#
+# File : Makefile.am
+# Author : André RIBES (EDF), Eric Fayolle (EDF)
+# Module : KERNEL
+#
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \
+ -I$(top_srcdir)/src/DSC/DSC_User/Datastream \
+ -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Palm \
+ -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Calcium \
+ -I$(top_srcdir)/src/DSC/DSC_User/Basic \
+ -I$(top_srcdir)/src/DSC/DSC_Basic \
+ -I$(top_srcdir)/src/SALOMELocalTrace \
+ -I$(top_srcdir)/src/Basics \
+ -I$(top_srcdir)/src/Utils \
+ -I$(top_srcdir)/src/Container \
+ -I$(top_srcdir)/src/Notification \
+ -I$(top_builddir)/salome_adm/unix \
+ -I$(top_builddir)/idl \
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS = @CORBA_LIBS@
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+
+AM_CFLAGS = -fexceptions
+pkgpython_PYTHON = calcium.py dsccalcium.py
+pkgpyexec_LTLIBRARIES = _calcium.la
+MY_SWIG_FLAGS= $(SWIG_FLAGS) -noexcept
+SWIG_SRC=calcium.i
+_calcium_la_SOURCES = calcium_wrap.cpp
+_calcium_la_LDFLAGS = -module
+_calcium_la_LIBADD = ../DSC_User/Datastream/Calcium/libCalciumC.la \
+ ../DSC_User/Datastream/libSalomeDatastream.la \
+ ../DSC_User/Basic/libSalomeDSCSupervBasic.la \
+ ../DSC_User/libSalomeDSCSuperv.la \
+ ../DSC_Basic/libSalomeDSCContainer.la \
+ ../../Container/libSalomeContainer.la
+
+_calcium_la_CXXFLAGS = $(PYTHON_INCLUDES) $(COMMON_CPPFLAGS)
+
+calcium_wrap.cpp calcium.py:calcium.i
+ $(SWIG) $(MY_SWIG_FLAGS) -o calcium_wrap.cpp $<
+
+CLEANFILES = calcium_wrap.cpp
+
--- /dev/null
+%define DOCSTRING
+"CALCIUM python wrapping : Superv_Component class
+"
+%enddef
+
+%module(docstring=DOCSTRING) calcium
+
+%feature("autodoc", "0");
+
+%{
+//C++ Includes
+#include <SALOMEconfig.h>
+#include <Calcium.hxx>
+#include <calcium.h>
+#include <Superv_Component_i.hxx>
+#include <omniORB4/CORBA.h>
+
+//--- from omniORBpy.h (not present on Debian Sarge packages)
+
+struct omniORBpyAPI {
+
+ PyObject* (*cxxObjRefToPyObjRef)(const CORBA::Object_ptr cxx_obj,
+ CORBA::Boolean hold_lock);
+ // Convert a C++ object reference to a Python object reference.
+ // If <hold_lock> is true, caller holds the Python interpreter lock.
+
+ CORBA::Object_ptr (*pyObjRefToCxxObjRef)(PyObject* py_obj,
+ CORBA::Boolean hold_lock);
+ // Convert a Python object reference to a C++ object reference.
+ // Raises BAD_PARAM if the Python object is not an object reference.
+ // If <hold_lock> is true, caller holds the Python interpreter lock.
+
+
+ omniORBpyAPI();
+ // Constructor for the singleton. Sets up the function pointers.
+};
+
+ omniORBpyAPI* api;
+
+%}
+
+%init
+%{
+ // init section
+
+#ifdef WITH_NUMPY
+ import_array()
+#endif
+
+ PyObject* omnipy = PyImport_ImportModule((char*)"_omnipy");
+ if (!omnipy)
+ {
+ PyErr_SetString(PyExc_ImportError,
+ (char*)"Cannot import _omnipy");
+ return;
+ }
+ PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API");
+ api = (omniORBpyAPI*)PyCObject_AsVoidPtr(pyapi);
+ Py_DECREF(pyapi);
+%}
+
+%include "carrays.i"
+
+%array_class(int, intArray);
+%array_class(float, floatArray);
+%array_class(double, doubleArray);
+
+#ifdef WITH_NUMPY
+/*
+ * Most of this code is borrowed from numpy distribution
+ * The following code originally appeared in enthought/kiva/agg/src/numeric.i,
+ * author unknown. It was translated from C++ to C by John Hunter. Bill
+ * Spotz has modified it slightly to fix some minor bugs, add some comments
+ * and some functionality.
+ */
+
+%{
+
+#include <numpy/arrayobject.h>
+
+/* Macros to extract array attributes.
+ */
+#define is_array(a) ((a) && PyArray_Check((PyArrayObject *)a))
+#define array_type(a) (int)(PyArray_TYPE(a))
+#define array_dimensions(a) (((PyArrayObject *)a)->nd)
+#define array_size(a,i) (((PyArrayObject *)a)->dimensions[i])
+#define array_is_contiguous(a) (PyArray_ISCONTIGUOUS(a))
+
+/* Given a PyObject, return a string describing its type.
+ */
+char* pytype_string(PyObject* py_obj) {
+ if (py_obj == NULL ) return "C NULL value";
+ if (PyCallable_Check(py_obj)) return "callable" ;
+ if (PyString_Check( py_obj)) return "string" ;
+ if (PyInt_Check( py_obj)) return "int" ;
+ if (PyFloat_Check( py_obj)) return "float" ;
+ if (PyDict_Check( py_obj)) return "dict" ;
+ if (PyList_Check( py_obj)) return "list" ;
+ if (PyTuple_Check( py_obj)) return "tuple" ;
+ if (PyFile_Check( py_obj)) return "file" ;
+ if (PyModule_Check( py_obj)) return "module" ;
+ if (PyInstance_Check(py_obj)) return "instance" ;
+
+ return "unkown type";
+}
+
+/* Given a Numeric typecode, return a string describing the type.
+ */
+char* typecode_string(int typecode) {
+ char* type_names[20] = {"char","unsigned byte","byte","short",
+ "unsigned short","int","unsigned int","long",
+ "float","double","complex float","complex double",
+ "object","ntype","unkown"};
+ return type_names[typecode];
+}
+
+/* Make sure input has correct numeric type. Allow character and byte
+ * to match. Also allow int and long to match.
+ */
+int type_match(int actual_type, int desired_type) {
+ return PyArray_EquivTypenums(actual_type, desired_type);
+}
+
+/* Given a PyObject pointer, cast it to a PyArrayObject pointer if
+ * legal. If not, set the python error string appropriately and
+ * return NULL./
+ */
+PyArrayObject* obj_to_array_no_conversion(PyObject* input, int typecode) {
+ PyArrayObject* ary = NULL;
+ if (is_array(input) && (typecode == PyArray_NOTYPE ||
+ PyArray_EquivTypenums(array_type(input),
+ typecode))) {
+ ary = (PyArrayObject*) input;
+ }
+ else if is_array(input) {
+ char* desired_type = typecode_string(typecode);
+ char* actual_type = typecode_string(array_type(input));
+ PyErr_Format(PyExc_TypeError,
+ "Array of type '%s' required. Array of type '%s' given",
+ desired_type, actual_type);
+ ary = NULL;
+ }
+ else {
+ char * desired_type = typecode_string(typecode);
+ char * actual_type = pytype_string(input);
+ PyErr_Format(PyExc_TypeError,
+ "Array of type '%s' required. A %s was given",
+ desired_type, actual_type);
+ ary = NULL;
+ }
+ return ary;
+}
+
+/* Convert the given PyObject to a Numeric array with the given
+ * typecode. On Success, return a valid PyArrayObject* with the
+ * correct type. On failure, the python error string will be set and
+ * the routine returns NULL.
+ */
+PyArrayObject* obj_to_array_allow_conversion(PyObject* input, int typecode,
+ int* is_new_object)
+{
+ PyArrayObject* ary = NULL;
+ PyObject* py_obj;
+ if (is_array(input) && (typecode == PyArray_NOTYPE || type_match(array_type(input),typecode))) {
+ ary = (PyArrayObject*) input;
+ *is_new_object = 0;
+ }
+ else {
+ py_obj = PyArray_FromObject(input, typecode, 0, 0);
+ /* If NULL, PyArray_FromObject will have set python error value.*/
+ ary = (PyArrayObject*) py_obj;
+ *is_new_object = 1;
+ }
+ return ary;
+}
+
+/* Given a PyArrayObject, check to see if it is contiguous. If so,
+ * return the input pointer and flag it as not a new object. If it is
+ * not contiguous, create a new PyArrayObject using the original data,
+ * flag it as a new object and return the pointer.
+ */
+PyArrayObject* make_contiguous(PyArrayObject* ary, int* is_new_object,
+ int min_dims, int max_dims)
+{
+ PyArrayObject* result;
+ if (array_is_contiguous(ary)) {
+ result = ary;
+ *is_new_object = 0;
+ }
+ else {
+ result = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*)ary,
+ array_type(ary),
+ min_dims,
+ max_dims);
+ *is_new_object = 1;
+ }
+ return result;
+}
+
+/* Convert a given PyObject to a contiguous PyArrayObject of the
+ * specified type. If the input object is not a contiguous
+ * PyArrayObject, a new one will be created and the new object flag
+ * will be set.
+ */
+PyArrayObject* obj_to_array_contiguous_allow_conversion(PyObject* input,
+ int typecode,
+ int* is_new_object) {
+ int is_new1 = 0;
+ int is_new2 = 0;
+ PyArrayObject* ary2;
+ PyArrayObject* ary1 = obj_to_array_allow_conversion(input, typecode,
+ &is_new1);
+ if (ary1) {
+ ary2 = make_contiguous(ary1, &is_new2, 0, 0);
+ if ( is_new1 && is_new2) {
+ Py_DECREF(ary1);
+ }
+ ary1 = ary2;
+ }
+ *is_new_object = is_new1 || is_new2;
+ return ary1;
+}
+
+/* Test whether a python object is contiguous. If array is
+ * contiguous, return 1. Otherwise, set the python error string and
+ * return 0.
+ */
+int require_contiguous(PyArrayObject* ary) {
+ int contiguous = 1;
+ if (!array_is_contiguous(ary)) {
+ PyErr_SetString(PyExc_TypeError, "Array must be contiguous. A discontiguous array was given");
+ contiguous = 0;
+ }
+ return contiguous;
+}
+
+/* Require the given PyArrayObject to have a specified number of
+ * dimensions. If the array has the specified number of dimensions,
+ * return 1. Otherwise, set the python error string and return 0.
+ */
+int require_dimensions(PyArrayObject* ary, int exact_dimensions) {
+ int success = 1;
+ if (array_dimensions(ary) != exact_dimensions) {
+ PyErr_Format(PyExc_TypeError,
+ "Array must have %d dimensions. Given array has %d dimensions",
+ exact_dimensions, array_dimensions(ary));
+ success = 0;
+ }
+ return success;
+}
+
+/* Require the given PyArrayObject to have one of a list of specified
+ * number of dimensions. If the array has one of the specified number
+ * of dimensions, return 1. Otherwise, set the python error string
+ * and return 0.
+ */
+int require_dimensions_n(PyArrayObject* ary, int* exact_dimensions, int n) {
+ int success = 0;
+ int i;
+ char dims_str[255] = "";
+ char s[255];
+ for (i = 0; i < n && !success; i++) {
+ if (array_dimensions(ary) == exact_dimensions[i]) {
+ success = 1;
+ }
+ }
+ if (!success) {
+ for (i = 0; i < n-1; i++) {
+ sprintf(s, "%d, ", exact_dimensions[i]);
+ strcat(dims_str,s);
+ }
+ sprintf(s, " or %d", exact_dimensions[n-1]);
+ strcat(dims_str,s);
+ PyErr_Format(PyExc_TypeError,
+ "Array must have %s dimensions. Given array has %d dimensions",
+ dims_str, array_dimensions(ary));
+ }
+ return success;
+}
+
+/* Require the given PyArrayObject to have a specified shape. If the
+ * array has the specified shape, return 1. Otherwise, set the python
+ * error string and return 0.
+ */
+int require_size(PyArrayObject* ary, int* size, int n) {
+ int i;
+ int success = 1;
+ int len;
+ char desired_dims[255] = "[";
+ char s[255];
+ char actual_dims[255] = "[";
+ for(i=0; i < n;i++) {
+ if (size[i] != -1 && size[i] != array_size(ary,i)) {
+ success = 0;
+ }
+ }
+ if (!success) {
+ for (i = 0; i < n; i++) {
+ if (size[i] == -1) {
+ sprintf(s, "*,");
+ }
+ else
+ {
+ sprintf(s, "%d,", size[i]);
+ }
+ strcat(desired_dims,s);
+ }
+ len = strlen(desired_dims);
+ desired_dims[len-1] = ']';
+ for (i = 0; i < n; i++) {
+ sprintf(s, "%d,", array_size(ary,i));
+ strcat(actual_dims,s);
+ }
+ len = strlen(actual_dims);
+ actual_dims[len-1] = ']';
+ PyErr_Format(PyExc_TypeError,
+ "Array must have shape of %s. Given array has shape of %s",
+ desired_dims, actual_dims);
+ }
+ return success;
+}
+
+%}
+
+/* input typemap */
+%define TYPEMAP_IN3(type,typecode)
+%typemap(in) type* IN_ARRAY3
+ (PyArrayObject* array=NULL, int is_new_object) {
+ int size[1] = {-1};
+ if ((SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,0)) == -1)
+ {
+ array = obj_to_array_contiguous_allow_conversion($input, typecode, &is_new_object);
+ if (!array || !require_dimensions(array,1) || !require_size(array,size,1)) SWIG_fail;
+ $1 = (type*) array->data;
+ }
+}
+%typemap(freearg) type* IN_ARRAY3 {
+ if (is_new_object$argnum && array$argnum) Py_DECREF(array$argnum);
+}
+%enddef
+
+TYPEMAP_IN3(int, PyArray_INT)
+TYPEMAP_IN3(float, PyArray_FLOAT )
+TYPEMAP_IN3(double, PyArray_DOUBLE)
+
+#undef TYPEMAP_IN3
+
+%apply int* IN_ARRAY3 {int *val};
+%apply float* IN_ARRAY3 {float *val};
+%apply double* IN_ARRAY3 {double *val};
+
+/* inplace typemaps */
+
+%define TYPEMAP_INPLACE3(type,typecode)
+%typemap(in) type* INPLACE_ARRAY3 (PyArrayObject* temp=NULL) {
+ if ((SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,0)) == -1)
+ {
+ temp = obj_to_array_no_conversion($input,typecode);
+ if (!temp || !require_contiguous(temp)) SWIG_fail;
+ $1 = (type*) temp->data;
+ }
+}
+%enddef
+
+TYPEMAP_INPLACE3(int, PyArray_INT)
+TYPEMAP_INPLACE3(float, PyArray_FLOAT )
+TYPEMAP_INPLACE3(double, PyArray_DOUBLE)
+
+#undef TYPEMAP_INPLACE3
+
+%apply int* INPLACE_ARRAY3 {int *lval};
+%apply float* INPLACE_ARRAY3 {float *lval};
+%apply double* INPLACE_ARRAY3 {double *lval};
+
+#endif
+
+%typemap(in) CORBA::Boolean
+{
+ $1=(CORBA::Boolean)PyInt_AsLong($input);
+}
+
+%typemap(in) CORBA::ORB_ptr
+{
+ try {
+ CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1);
+ $1 = CORBA::ORB::_narrow(obj);
+ }
+ catch (...) {
+ PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr");
+ }
+}
+
+%typemap(in) PortableServer::POA_ptr
+{
+ try {
+ CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1);
+ $1 = PortableServer::POA::_narrow(obj);
+ }
+ catch (...) {
+ PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr");
+ }
+}
+
+%typemap(in) Engines::Container_ptr
+{
+ try {
+ CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1);
+ $1 = Engines::Container::_narrow(obj);
+ }
+ catch (...) {
+ PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr");
+ }
+}
+
+%typemap(in) Ports::Port_ptr
+{
+ try {
+ CORBA::Object_ptr obj = api->pyObjRefToCxxObjRef($input,1);
+ $1 = Ports::Port::_narrow(obj);
+ }
+ catch (...) {
+ PyErr_SetString(PyExc_RuntimeError, "not a valid CORBA object ptr");
+ }
+}
+
+%typemap(out) Ports::Port_ptr , Ports::PortProperties_ptr
+{
+ $result = api->cxxObjRefToPyObjRef($1, 1);
+}
+
+/*
+ * Exception section
+ */
+// a general exception handler
+%exception {
+ try {
+ $action
+ } catch(Engines::DSC::PortNotDefined& _e) {
+ PyErr_SetString(PyExc_ValueError,"Port not defined");
+ return NULL;
+ } catch(Engines::DSC::PortNotConnected& _e) {
+ PyErr_SetString(PyExc_ValueError,"Port not connected");
+ return NULL;
+ } catch(Engines::DSC::BadPortType& _e) {
+ PyErr_SetString(PyExc_ValueError,"Bad port type");
+ return NULL;
+ } catch(...) {
+ PyErr_SetString(PyExc_ValueError,"Unknown exception");
+ return NULL;
+ }
+}
+
+/*
+ * End of Exception section
+ */
+namespace Engines
+{
+class DSC
+{
+ public:
+ enum Message { AddingConnection, RemovingConnection, ApplicationError };
+};
+}
+
+class PySupervCompo:public Superv_Component_i
+{
+ public:
+
+ PySupervCompo(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ Engines::Container_ptr contai,
+ const char *instanceName,
+ const char *interfaceName);
+
+ virtual ~PySupervCompo();
+ CORBA::Boolean init_service(const char * service_name){return true;};
+ virtual provides_port * create_provides_data_port(const char* port_fab_type)
+ throw (BadFabType);
+ virtual uses_port * create_uses_data_port(const char* port_fab_type)
+ throw (BadFabType);
+ virtual void add_port(const char * port_fab_type,
+ const char * port_type,
+ const char * port_name)
+ throw (PortAlreadyDefined, BadFabType, BadType, BadProperty);
+ template < typename SpecificPortType >
+ SpecificPortType * add_port(const char * port_fab_type,
+ const char * port_type,
+ const char * port_name)
+ throw (PortAlreadyDefined, BadFabType, BadType, BadCast, BadProperty);
+ virtual void add_port(provides_port * port,
+ const char* provides_port_name)
+ throw (PortAlreadyDefined, NilPort, BadProperty);
+ virtual void add_port(uses_port * port,
+ const char* uses_port_name)
+ throw (PortAlreadyDefined, NilPort, BadProperty);
+ template <typename SpecificPortType >
+ SpecificPortType * get_port( const char * port_name)
+ throw (PortNotDefined, PortNotConnected, BadCast, UnexpectedState);
+ virtual Ports::Port_ptr get_provides_port(const char* provides_port_name,
+ const CORBA::Boolean connection_error)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortType);
+ virtual void connect_uses_port(const char* uses_port_name,
+ Ports::Port_ptr provides_port_ref)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::BadPortType,
+ Engines::DSC::NilPort);
+ virtual void connect_provides_port(const char* provides_port_name)
+ throw (Engines::DSC::PortNotDefined);
+ virtual void disconnect_provides_port(const char* provides_port_name,
+ const Engines::DSC::Message message)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected);
+
+ virtual void disconnect_uses_port(const char* uses_port_name,
+ Ports::Port_ptr provides_port_ref,
+ const Engines::DSC::Message message)
+ throw (Engines::DSC::PortNotDefined,
+ Engines::DSC::PortNotConnected,
+ Engines::DSC::BadPortReference);
+
+ virtual Ports::PortProperties_ptr get_port_properties(const char* port_name);
+
+ %extend
+ {
+ //To get the address of the component
+ long ptr()
+ {
+ return (long)self;
+ }
+ }
+};
+
+%apply int *OUTPUT { int *nval };
+%apply float *INOUT { float *ti };
+%apply float *INPUT { float *tf };
+%apply int *INOUT { int *niter };
+%apply double *INOUT { double *ti };
+%apply double *INPUT { double *tf };
+
+extern "C" void create_calcium_port(Superv_Component_i* compo,char* name,char* type,char *mode,char* depend);
+
+#define CP_TEMPS 40
+#define CP_ITERATION 41
+#define CP_SEQUENTIEL 42
+#define CP_CONT 20
+#define CP_ARRET 21
+
+int cp_cd(void *component,char *name);
+
+int cp_een(void *component,int dep,float t,int n,char *nom,int nval,int *eval);
+int cp_edb(void *component,int dep,double t,int n,char *nom,int nval,double *eval);
+int cp_ere(void *component,int dep,float t,int n,char *nom,int nval,float *eval);
+int cp_ecp(void *component,int dep,float t,int n,char *nom,int nval,float *eval);
+int cp_elo(void *component,int dep,float t,int n,char *nom,int nval,int *eval);
+
+int cp_len(void *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval);
+int cp_ldb(void *component,int dep,double *ti,double *tf,int *niter,char *nom,int nmax,int *nval,double *lval);
+int cp_lre(void *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval);
+int cp_lcp(void *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,float *lval);
+int cp_llo(void *component,int dep,float *ti,float *tf,int *niter,char *nom,int nmax,int *nval,int *lval);
+
+int cp_fin(void *component,int cp_end);
+
--- /dev/null
+import calcium
+import SALOME_ComponentPy
+import SALOME_DriverPy
+import Engines
+
+class PyDSCComponent(SALOME_ComponentPy.SALOME_ComponentPy_i,
+ SALOME_DriverPy.SALOME_DriverPy_i):
+ """
+ A Python SALOME component is implemented by a Python class that has
+ the name of the component and is located in a python module that has the
+ name of the component.
+
+ This class is a base class for Python DSC components.
+
+ You must derive it and implement init_service and those methods
+ that are services of the component.
+ """
+ def __init__ ( self, orb, poa, contID, containerName, instanceName, interfaceName ):
+ SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa,
+ contID, containerName, instanceName, interfaceName, 0)
+ SALOME_DriverPy.SALOME_DriverPy_i.__init__(self, interfaceName)
+ # create the DSC proxy
+ self.proxy=calcium.PySupervCompo(orb,poa,contID,instanceName,interfaceName )
+ # Store a reference on naming service in _naming_service attribute
+ self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb )
+
+ def init_service(self,service):
+ return True
+
+ enums={Engines.DSC.RemovingConnection:calcium.DSC.RemovingConnection,
+ Engines.DSC.AddingConnection:calcium.DSC.AddingConnection,
+ Engines.DSC.ApplicationError:calcium.DSC.ApplicationError,
+ }
+ def get_provides_port(self,name,error):
+ return self.proxy.get_provides_port(name,error)
+
+ def connect_uses_port(self,name,port):
+ self.proxy.connect_uses_port(name,port)
+
+ def connect_provides_port(self,name):
+ self.proxy.connect_provides_port(name)
+
+ def disconnect_provides_port(self,name,message):
+ self.proxy.disconnect_provides_port(name,message._v)
+ #self.proxy.disconnect_provides_port(name,self.enums[message])
+
+ def disconnect_uses_port(self,name,port,message):
+ self.proxy.disconnect_uses_port(name,port,message._v)
+ #self.proxy.disconnect_uses_port(name,port,self.enums[message])
+
+ def get_port_properties(self,name):
+ return self.proxy.get_port_properties(name)
+
#ifndef _BASIC_PORT_FACTORY_HXX_
#define _BASIC_PORT_FACTORY_HXX_
+#include "port_factory.hxx"
#include "data_short_port_provides.hxx"
#include "data_short_port_uses.hxx"
* to be used by Superv_Component_i.
* It builds basic ports.
*/
-class basic_port_factory
+class basic_port_factory :
+ public port_factory
{
public:
basic_port_factory();
data_short_port_provides::data_short_port_provides() {
_val = 0;
+ short_termine = false;
+ short_mutex = new pthread_mutex_t();
+ pthread_mutex_init(short_mutex, NULL);
+ short_condition = new pthread_cond_t();
+ pthread_cond_init(short_condition, NULL);
+ short_termine_cp = true;
+ short_mutex_cp = new pthread_mutex_t();
+ pthread_mutex_init(short_mutex_cp, NULL);
+ short_condition_cp = new pthread_cond_t();
+ pthread_cond_init(short_condition_cp, NULL);
}
-data_short_port_provides::~data_short_port_provides() {}
+data_short_port_provides::~data_short_port_provides() {
+ pthread_mutex_destroy(short_mutex);
+ delete short_mutex;
+ pthread_cond_destroy(short_condition);
+ delete short_condition;
+ pthread_mutex_destroy(short_mutex_cp);
+ delete short_mutex_cp;
+ pthread_cond_destroy(short_condition_cp);
+ delete short_condition_cp;
+}
void
data_short_port_provides::put(CORBA::Short data) {
+ // On attend que le get soit fait
+ pthread_mutex_lock(short_mutex_cp);
+ while (short_termine_cp == false)
+ {
+ pthread_cond_wait(short_condition_cp, short_mutex_cp);
+ }
+ short_termine_cp = false;
+ pthread_mutex_unlock(short_mutex_cp);
+
+ pthread_mutex_lock(short_mutex);
_val = data;
+ short_termine = true;
+ pthread_cond_signal(short_condition);
+ pthread_mutex_unlock(short_mutex);
}
CORBA::Short
data_short_port_provides::get() {
- return _val;
+ CORBA::Short result;
+ pthread_mutex_lock(short_mutex);
+ while (short_termine == false)
+ {
+ pthread_cond_wait(short_condition, short_mutex);
+ }
+ result = _val;
+ short_termine = false;
+ pthread_mutex_unlock(short_mutex);
+
+ // On indique que l'on a copie la valeur
+ pthread_mutex_lock(short_mutex_cp);
+ short_termine_cp = true;
+ pthread_cond_signal(short_condition_cp);
+ pthread_mutex_unlock(short_mutex_cp);
+ return result;
}
Ports::Port_ptr
#include <iostream>
#include "SALOME_Ports.hh"
#include "provides_port.hxx"
+#include <pthread.h>
/*! \class data_short_port_provides
* \brief This class a port that sends a CORBA short with
private :
CORBA::Short _val;
+ pthread_mutex_t * short_mutex;
+ pthread_cond_t * short_condition;
+ bool short_termine;
+ pthread_mutex_t * short_mutex_cp;
+ pthread_cond_t * short_condition_cp;
+ bool short_termine_cp;
+
};
#endif
using namespace std;
data_short_port_uses::data_short_port_uses() {
- _my_port = Ports::Data_Short_Port::_nil();
_my_ports = NULL;
}
return "IDL:Ports/Data_Short_Port:1.0";
}
-bool
-data_short_port_uses::set_port(Ports::Port_ptr port) {
- _my_port = Ports::Data_Short_Port::_narrow(port);
-}
-
void
data_short_port_uses::put(CORBA::Short data) {
// if (!CORBA::is_nil(_my_port))
*/
virtual const char * get_repository_id();
- /*!
- * \warning deprecated
- */
- virtual bool set_port(Ports::Port_ptr port);
-
/*!
* This method is used by the component to send
* a short value to all the provides ports connected.
const Engines::DSC::Message message);
private :
- Ports::Data_Short_Port_ptr _my_port;
Engines::DSC::uses_port * _my_ports;
};
// Suppose que les valeurs passées en paramètres sont triées par ordre croissant
bool operator()(const T &v1) {
+#ifdef _DEBUG_
std::cout << "AdjacentFunctor: " << _minValue << _maxValue << std::endl;
std::cout << "AdjacentFunctor: " << _min << _max << std::endl;
+#endif
if ( v1 <= _minValue && v1 >= _maxValue)
{
_equal= true;
+#ifdef _DEBUG_
std::cout << "AdjacentFunctor: _equal : " << v1 << std::endl;
+#endif
return true;
}
if ( v1 < _minValue )
{
_min=v1;_minFound=true;
+#ifdef _DEBUG_
std::cout << "AdjacentFunctor: _minFound : " <<_min << std::endl;
+#endif
}
else if ( v1 > _maxValue )
{
_max=v1;_maxFound=true;
+#ifdef _DEBUG_
std::cout << "AdjacentFunctor: _maxFound : " <<_max << std::endl;
+#endif
}
bool isEqual() const { return _equal;}
bool isBounded() const { return _minFound && _maxFound;}
bool getBounds(TNoConst & min, TNoConst & max) const {
+#ifdef _DEBUG_
std::cout << "_minFound : " <<_minFound << ", _maxFound " << _maxFound << std::endl;
+#endif
if (_minFound && _maxFound ) { min=_min; max=_max; return true; }
return false;
}
#include "calcium.h"
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
// Interface C de SalomeCalcium
fflush(stderr); \
fprintf(stderr,"Beginning of CPExx: %s %d %f\n",nomvar,i,t); \
if ( (data == NULL) || (nbelem < 1) ) return CPNTNULL; \
- printf("cp_name : Valeur de nomvar %s\n",nomvar); \
\
InfoType info = ecp_ecriture_##_typeName (component, mode, &t, i, \
nomvar, nbelem, \
CALCIUM_ECR_INTERFACE_C_(edb,double,double,double,);
CALCIUM_ECR_INTERFACE_C_(elo,float,bool,bool,);
CALCIUM_ECR_INTERFACE_C_(ecp,float,float,cplx,);
+
--- /dev/null
+#include "Calcium.hxx"
+#include <CalciumInterface.hxx>
+#include <calcium.h>
+#include <iostream>
+#include <string>
+#include <exception>
+
+//#define _DEBUG_
+
+PySupervCompo::PySupervCompo( CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ Engines::Container_ptr contain,
+ const char *instanceName,
+ const char *interfaceName,
+ bool notif) :
+ Superv_Component_i(orb, poa,poa->reference_to_id(contain), instanceName, interfaceName)
+{
+}
+
+PySupervCompo::~PySupervCompo()
+{
+}
+
+
+extern "C"
+{
+ void cp_exit(int err)
+ {
+ throw CalciumException(err,LOC("Abort coupling"));
+ }
+
+ void setDependency(provides_port * port,char* type,CalciumTypes::DependencyType depend)
+ {
+ if(std::string(type)=="CALCIUM_real")
+ {
+ dynamic_cast<calcium_real_port_provides *>(port)->setDependencyType(depend);
+ }
+ else if(std::string(type)=="CALCIUM_double")
+ {
+ dynamic_cast<calcium_double_port_provides *>(port)->setDependencyType(depend);
+ }
+ else if(std::string(type)=="CALCIUM_integer")
+ {
+ dynamic_cast<calcium_integer_port_provides *>(port)->setDependencyType(depend);
+ }
+ else
+ {
+ std::cerr << "unknown type:" << std::endl;
+ }
+ }
+
+ void create_calcium_port(Superv_Component_i* compo,char* name,char* type,char *mode,char* depend)
+ {
+#ifdef _DEBUG_
+ std::cerr << "create_calcium_port: " << name << " " << type << " " << mode << " " << depend << std::endl;
+#endif
+
+ if(std::string(mode) == "IN")
+ {
+ provides_port * port ;
+ //provides port
+ try
+ {
+ port = compo->create_provides_data_port(type);
+ compo->add_port(port, name);
+ if(std::string(depend) == "I")
+ setDependency(port,type,CalciumTypes::ITERATION_DEPENDENCY);
+ else if(std::string(depend) == "T")
+ setDependency(port,type,CalciumTypes::TIME_DEPENDENCY);
+ else
+ {
+ std::cerr << "create_calcium_port:unknown dependency: " << depend << std::endl;
+ }
+ }
+ catch(const Superv_Component_i::PortAlreadyDefined& ex)
+ {
+ //Port already defined : we use the old one
+ delete port;
+ std::cerr << "create_calcium_port: " << ex.what() << std::endl;
+ }
+ catch ( ... )
+ {
+ std::cerr << "create_calcium_port: unknown exception" << std::endl;
+ }
+ }
+ else if(std::string(mode) == "OUT")
+ {
+ uses_port * uport ;
+ try
+ {
+ uport = compo->create_uses_data_port(type);
+ compo->add_port(uport, name);
+ }
+ catch(const Superv_Component_i::PortAlreadyDefined& ex)
+ {
+ //Port already defined : we use the old one
+ delete uport;
+ std::cerr << "create_calcium_port: " << ex.what() << std::endl;
+ }
+ catch ( ... )
+ {
+ std::cerr << "create_calcium_port: unknown exception" << std::endl;
+ }
+ }
+ else
+ {
+ //Unknown mode
+ std::cerr << "create_calcium_port:Unknown mode: " << mode << std::endl;
+ }
+ }
+
+}
+
+
--- /dev/null
+#include "Superv_Component_i.hxx"
+
+class PySupervCompo:public Superv_Component_i
+{
+ public:
+ PySupervCompo(CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ Engines::Container_ptr contain,
+ const char *instanceName,
+ const char *interfaceName,
+ bool notif = false);
+ virtual ~PySupervCompo();
+ CORBA::Boolean init_service(const char * service_name){return true;};
+};
+
+
+extern "C" void create_calcium_port(Superv_Component_i* compo,char* name,char* type,char *mode,char* depend);
MapIterator it2=it1; ++it2;
size_t dataSize1 = DataManipulator::size(it1->second);
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId1 : " << dataSize1 << std::endl;
+#endif
// Gérer dans calcium la limite de la taille du buffer donnée par
// l'utilisateur.
size_t dataSize2 = DataManipulator::size(it2->second);
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Taille de donnée dataId2 : " << dataSize2 << std::endl;
+#endif
size_t dataSize = std::min< size_t >( dataSize1, dataSize2 );
DataId dataId2 = it2->first;
DataId dataId1 = it1->first;
TimeType t2 = dataId2.first;
TimeType t1 = dataId1.first;
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t1 : " << t1 << std::endl;
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t2 : " << t2 << std::endl;
+#endif
TimeType t = dataId.first;
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de t : " << t << std::endl;
+#endif
TimeType timeDiff = t2-t1;
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de timeDiff : " << timeDiff << std::endl;
+#endif
TimeType coeff = (t2-t)/timeDiff;
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Valeur de coeff : " << coeff << std::endl;
+#endif
InnerType const * const InIt1 = DataManipulator::getPointer(it1->second);
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t1 : " << std::endl;
std::copy(InIt1,InIt1+dataSize1,std::ostream_iterator<InnerType>(std::cout," "));
std::cout << std::endl;
+#endif
InnerType const * const InIt2 = DataManipulator::getPointer(it2->second);
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données à t2 : " << std::endl;
std::copy(InIt2,InIt2+dataSize2,std::ostream_iterator<InnerType>(std::cout," "));
std::cout << std::endl;
+#endif
Type dataOut = DataManipulator::create(dataSize);
InnerType * const OutIt = DataManipulator::getPointer(dataOut);
// }
}
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::BoundedDataIdProcessor : Données calculées à t : " << std::endl;
std::copy(OutIt,OutIt+dataSize,std::ostream_iterator<InnerType>(std::cout," "));
std::cout << std::endl;
+#endif
data = dataOut;
}
AdjacentFunctor< key_type > af(expectedDataId);
if ( _dependencyType == CalciumTypes::TIME_DEPENDENCY )
{
+#ifdef _DEBUG_
std::cout << "-------- time expected : " << expectedDataId.first << std::endl;
std::cout << "-------- time expected corrected : " << expectedDataId.first*(1.0-_deltaT) << std::endl;
+#endif
af.setMaxValue(key_type(expectedDataId.first*(1.0-_deltaT),0));
}
isBounded = false;
typename AssocContainer::iterator current = prev;
while ( (current != storedDatas.end()) && !af(current->first) )
{
+#ifdef _DEBUG_
std::cout << "------- stored time : " << current->first << std::endl;
+#endif
// if ( af(current->first) ) break;
prev = current++;
}
else
wDataIt1 = storedDatas.end();
+#ifdef _DEBUG_
std::cout << "-------- isDataIdConvenient : isEqual : " << isEqual << " , isBounded " << isBounded << std::endl;
+#endif
return isEqual || isBounded;
}
typedef typename Container::value_type value_type;
typedef typename Container::iterator iterator;
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::eraseDataId, storedDatasSize : " << storedDatas.size() << std::endl;
+#endif
if ( _couplingPolicy._storageLevel == CalciumTypes::UNLIMITED_STORAGE_LEVEL ) return;
if (s > 0 ) {
size_t dist=distance(storedDatas.begin(),wDataIt1);
for (int i=0; i<s; ++i) {
- DataManipulator::delete_data((*storedDatas.begin()).second);
- storedDatas.erase(storedDatas.begin());
+ //no bug if removed : DataManipulator::delete_data((*storedDatas.begin()).second);
+ DataManipulator::delete_data((*storedDatas.begin()).second);
+ storedDatas.erase(storedDatas.begin());
}
// Si l'itérateur pointait sur une valeur que l'on vient de supprimer
if (dist < s ) {
" vient d'entraîner la suppression de la donnée à renvoyer")));
}
}
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::eraseDataId, new storedDatasSize : " << storedDatas.size() << std::endl;
+#endif
return;
}
typedef typename Container::iterator iterator;
// Pas de traitement particulier a effectuer
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK1 ("<< _couplingPolicy._disconnectDirective<<") --------" << std::endl;
+#endif
if ( (_couplingPolicy._disconnectDirective) == (CalciumTypes::UNDEFINED_DIRECTIVE) ) return false;
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK2 --------" << std::endl;
+#endif
// TODO : Ds GenericPort::next il faut convertir en CPSTOPSEQ
if ( _couplingPolicy._disconnectDirective == CalciumTypes::CP_ARRET )
throw(CalciumException(CalciumTypes::CPINARRET,LOC(OSS()<< "La directive CP_ARRET"
<< " provoque l'interruption de toute lecture de données")));
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK3 --------" << std::endl;
+#endif
// S'il n'y a plus de données indique que l'on a pas pu effectuer de traitement
// qu'en mode itératif il ne soit pas plus grand que le plus grand DataId stocké auquel
// cas on doit renvoyer une expection car on n'est plus connecté et on ne pourra jamais
// fournir de données pour ce dataId.
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK4 " << expectedDataId <<" --------" << std::endl;
+#endif
// >= expectedDataId
iterator it1 = storedDatas.lower_bound(expectedDataId);
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK5 " << std::endl;
for (iterator it=storedDatas.begin();it!=storedDatas.end();++it)
std::cout <<" "<<(*it).first ;
std::cout <<std::endl;
+#endif
// TODO : Il faut en fait renvoyer le plus proche cf IT ou DT
if (it1 == storedDatas.end())
throw(CalciumException(CalciumTypes::CPNTNULL,LOC(OSS()<< "La directive CP_CONT"
<< " est active mais le dataId demandé est inférieur ou égal au dernier reçu.")));
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor MARK6 " << std::endl;
+#endif
wDataIt1 = storedDatas.end();
--wDataIt1;
+#ifdef _DEBUG_
std::cout << "-------- CalciumCouplingPolicy::DisconnectProcessor, CP_CONT : " << (*wDataIt1).first << std::endl;
+#endif
return true;
}
virtual CORBA::Any* get_property(const char* name) \
throw (Ports::NotDefined); \
\
- }; \
+ virtual void provides_port_changed(int connection_nbr, \
+ const Engines::DSC::Message message) { \
+ if ( !connection_nbr && (message == Engines::DSC::RemovingConnection) ) \
+ { \
+ disconnect(false); \
+ } \
+ } \
+ }; \
for(int i = 0; i < this->_my_ports->length(); i++) {
CorbaPortTypePtr port = CorbaPortType::_narrow((*this->_my_ports)[i]);
try {
- std::cerr << "-------- CalciumGenericUsesPort<>::disconnect"<< std::endl;
+ std::cerr << "-------- CalciumGenericUsesPort<>::disconnect: "<< i << std::endl;
port->disconnect(provideLastGivenValue);
} catch(const CORBA::SystemException& ex){
- throw DSC_Exception(LOC(OSS() << "Impossible d'invoquer la méthode disconnect sur le port provide n°"
- << i << " ( i>= 0)"));
+ std::cerr << "Can't call disconnect on provides port " << i << std::endl;
}
}
#include <stdio.h>
+//#define _DEBUG_
// Déplacer cette information dans CorbaTypeManipulator
// Gérer en même temps la recopie profonde.
-class CalciumInterface {
-public :
+//class CalciumInterface {
+namespace CalciumInterface {
+//public :
static void
// calcium_uses_port* myCalciumUsesPort=
// dynamic_cast<calcium_uses_port*>(myUsesPort);
+#ifdef _DEBUG_
std::cerr << "-------- CalciumInterface(ecp_fin) MARK 1 -|"<< *it <<"|----"<<
// typeid(myUsesPort).name() <<"-------------" <<
typeid(myCalciumUsesPort).name() <<"-------------" << std::endl;
+#endif
// if ( !myCalciumUsesPort )
// throw Superv_Component_i::BadCast(LOC(OSS()<<"Impossible de convertir le port "
myCalciumUsesPort->disconnect(provideLastGivenValue);
} catch ( const Superv_Component_i::BadCast & ex) {
+#ifdef _DEBUG_
std::cerr << ex.what() << std::endl;
+#endif
throw (CalciumException(CalciumTypes::CPTPVR,ex));
} catch ( const DSC_Exception & ex) {
+#ifdef _DEBUG_
std::cerr << ex.what() << std::endl;
+#endif
// Exception venant de SupervComponent :
// PortNotDefined(CPNMVR), PortNotConnected(CPLIEN)
// ou du port uses : Dsc_Exception
// Uniquement appelé par l'utilisateur s'il a passé un pointeur de données NULL
// à l'appel de ecp_lecture (demande de 0 copie)
- template <typename T1 > static void
- ecp_free ( T1 * dataPtr )
- {
- ecp_free<T1,T1> ( dataPtr );
- }
-
- template <typename T1,typename T2 > static void
+ template <typename T1, typename T2> static void
ecp_free ( T1 * dataPtr )
- {
-
- typedef typename ProvidesPortTraits<T2>::PortType PortType;
+ {
+ typedef typename ProvidesPortTraits<T2>::PortType PortType;
typedef typename PortType::DataManipulator DataManipulator;
typedef typename DataManipulator::Type DataType; // Attention != T
typedef typename DataManipulator::InnerType InnerType;
DeleteTraits<IsSameType<T1,InnerType>::value >::apply(dataPtr);
+ }
+ template <typename T1> static void
+ ecp_free ( T1 * dataPtr )
+ {
+ ecp_free<T1,T1> ( dataPtr );
}
template <typename T1 > static void
CorbaDataType corbaData;
long ilong;
+#ifdef _DEBUG_
std::cerr << "-------- CalciumInterface(ecp_lecture) MARK 1 ------------------" << std::endl;
+#endif
if (nomVar.empty())
throw CalciumException(CalciumTypes::CPNMVR,
LOC("Le nom de la variable est <nul>"));
PortType * port;
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 2 ------------------" << std::endl;
+#endif
try {
port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str());
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 3 ------------------" << std::endl;
+#endif
} catch ( const Superv_Component_i::PortNotDefined & ex) {
+#ifdef _DEBUG_
std::cerr << ex.what() << std::endl;
+#endif
throw (CalciumException(CalciumTypes::CPNMVR,ex));
} catch ( const Superv_Component_i::PortNotConnected & ex) {
+#ifdef _DEBUG_
std::cerr << ex.what() << std::endl;;
+#endif
throw (CalciumException(CalciumTypes::CPLIEN,ex));
// VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN
} catch ( const Superv_Component_i::BadCast & ex) {
+#ifdef _DEBUG_
std::cerr << ex.what() << std::endl;
+#endif
throw (CalciumException(CalciumTypes::CPTPVR,ex));
}
if ( dependencyType == CalciumTypes::TIME_DEPENDENCY ) {
corbaData = port->get(ti,tf, 0);
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 5 ------------------" << std::endl;
+#endif
}
else if ( dependencyType == CalciumTypes::ITERATION_DEPENDENCY ) {
corbaData = port->get(0, i);
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 6 ------------------" << std::endl;
+#endif
} else {
// Lecture en séquence
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 7 ------------------" << std::endl;
+#endif
corbaData = port->next(ti,i);
}
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 8 ------------------" << std::endl;
+#endif
size_t corbaDataSize = DataManipulator::size(corbaData);
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) corbaDataSize : " << corbaDataSize << std::endl;
+#endif
// Vérifie si l'utilisateur demande du 0 copie
if ( data == NULL ) {
nRead = corbaDataSize;
// Si les types T et InnerType sont différents, il faudra effectuer tout de même une recopie
if (!IsSameType<T1,InnerType>::value) data = new T1[nRead];
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 9 ------------------" << std::endl;
+#endif
// On essaye de faire du 0 copy si les types T et InnerType sont les mêmes
Copy2UserSpace< IsSameType<T1,InnerType>::value >::apply(data,corbaData,nRead);
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 10 ------------------" << std::endl;
+#endif
// Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non
// la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante :
// old : Dans les deux cas la structure CORBA n'est plus utile
// DataManipulator::delete_data(corbaData);
} else {
nRead = std::min < size_t > (corbaDataSize,bufferLength);
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 11 ------------------" << std::endl;
+#endif
Copy2UserSpace<false>::apply(data,corbaData,nRead);
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 12 ------------------" << std::endl;
+#endif
// Attention : Seul CalciumCouplingPolicy via eraseDataId doit décider de supprimer ou non
// la donnée corba associée à un DataId ! Ne pas effectuer la desallocation suivante :
// DataManipulator::delete_data(corbaData);
}
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecp_lecture), Valeur de data : " << std::endl;
std::copy(data,data+nRead,std::ostream_iterator<T1>(std::cout," "));
std::cout << "Ptr :" << data << std::endl;
std::cout << "-------- CalciumInterface(ecp_lecture) MARK 13 ------------------" << std::endl;
+#endif
return;
typedef typename DataManipulator::Type CorbaDataType; // Attention != T1
typedef typename DataManipulator::InnerType InnerType;
+#ifdef _DEBUG_
std::cerr << "-------- CalciumInterface(ecriture) MARK 1 ------------------" << std::endl;
+#endif
if ( nomVar.empty() ) throw CalciumException(CalciumTypes::CPNMVR,
LOC("Le nom de la variable est <nul>"));
PortType * port;
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecriture) MARK 2 ------------------" << std::endl;
+#endif
try {
port = component.Superv_Component_i::get_port< PortType > (nomVar.c_str());
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecriture) MARK 3 ------------------" << std::endl;
+#endif
} catch ( const Superv_Component_i::PortNotDefined & ex) {
+#ifdef _DEBUG_
std::cerr << ex.what() << std::endl;
+#endif
throw (CalciumException(CalciumTypes::CPNMVR,ex));
} catch ( const Superv_Component_i::PortNotConnected & ex) {
+#ifdef _DEBUG_
std::cerr << ex.what() << std::endl;;
+#endif
throw (CalciumException(CalciumTypes::CPLIEN,ex));
// VERIFIER LES CAS DES CODES : CPINARRET, CPSTOPSEQ, CPCTVR, CPLIEN
} catch ( const Superv_Component_i::BadCast & ex) {
+#ifdef _DEBUG_
std::cerr << ex.what() << std::endl;
+#endif
throw (CalciumException(CalciumTypes::CPTPVR,ex));
}
LOC(OSS()<<"Le buffer a envoyer est de taille nulle "));
- std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl;
+#ifdef _DEBUG_
+ std::cout << "-------- CalciumInterface(ecriture) MARK 4 ------------------" << std::endl;
+#endif
CorbaDataType corbaData;
//TODO : GERER LES EXCEPTIONS ICI : ex le port n'est pas connecté
if ( dependencyType == CalciumTypes::TIME_DEPENDENCY ) {
- port->put(*corbaData,t, -1);
+ try
+ {
+ port->put(*corbaData,t, -1);
+ }
+ catch ( const DSC_Exception & ex)
+ {
+ throw (CalciumException(CalciumTypes::CPATAL,ex.what()));
+ }
//Le -1 peut être traité par le cst DataIdContainer et transformé en 0
//Etre obligé de mettre une étoile ds (*corbadata) va poser des pb pour les types <> seq
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecriture) MARK 5 ------------------" << std::endl;
+#endif
}
else if ( dependencyType == CalciumTypes::ITERATION_DEPENDENCY ) {
- port->put(*corbaData,-1, i);
+ try
+ {
+ port->put(*corbaData,-1, i);
+ }
+ catch ( const DSC_Exception & ex)
+ {
+ throw (CalciumException(CalciumTypes::CPATAL,ex.what()));
+ }
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecriture) MARK 6 ------------------" << std::endl;
+#endif
}
+#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;
+#endif
// if ( !IsSameType<T1,InnerType>::value ) delete corbaData;
// Supprime l'objet CORBA avec eventuellement les données qu'il contient (case de la recopie)
delete corbaData;
+#ifdef _DEBUG_
std::cout << "-------- CalciumInterface(ecriture) MARK 7 ------------------" << std::endl;
+#endif
return;
}
CalciumInterface::ecp_fin( *_component,
provideLastGivenValue);
} catch ( const CalciumException & ex) { //tester l'arrêt par exception
+#ifdef _DEBUG_
std::cerr << ex.what() << std::endl;
+#endif
return ex.getInfo();
}
return CalciumTypes::CPOK;
};
+#ifdef _DEBUG_
+#define DEBTRACE(msg) {std::cerr<<std::flush<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<std::endl<<std::flush;}
+#else
+#define DEBTRACE(msg)
+#endif
+
#define CALCIUM_C2CPP_INTERFACE_(_name,_type,_qual) \
extern "C" CalciumTypes::InfoType ecp_lecture_##_name (void * component, int dependencyType, \
static_cast<CalciumTypes::DependencyType>(dependencyType); \
\
if ( IsSameType< _name , cplx >::value ) _bufferLength*=2; \
- std::cout << "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" << std::endl; \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1 ------------------" ) \
try { \
CalciumInterface::ecp_lecture< _type, _name >( *_component, \
_dependencyType, \
nomvar, \
_bufferLength, _nRead, *data); \
} catch ( const CalciumException & ex) { \
- std::cout << "-------- CalciumInterface(lecture Inter Part) MARK 1b ------------------" << std::endl; \
- std::cerr << ex.what() << std::endl; \
- std::cout << "-------- CalciumInterface(lecture Inter Part) MARK 1ter ------------------" << std::endl; \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1b ------------------" ) \
+ DEBTRACE( ex.what() ) \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) MARK 1ter ------------------" ) \
return ex.getInfo(); \
} \
if ( IsSameType< _name , cplx >::value ) { *nRead=_nRead/2; \
- std::cout << "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" << std::endl; \
- std::cout << "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead << std::endl; \
- std::cout << "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead << std::endl; \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) IsSameType cplx -------------" ) \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) _nRead : " << _nRead ) \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part) *nRead : " << *nRead ) \
} else *nRead = _nRead; \
if (_dependencyType == CalciumTypes::CP_SEQUENTIEL ) \
*ti=(CalTimeType< _type _qual >::TimeType)(_ti); \
- std::cout << "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data << std::endl; \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \
+ /* \
for (int i=0; i<_nRead;++i) \
printf("-------- CalciumInterface(lecture Inter Part), Valeur de data (typage entier) data[%d] : %d \n",i,(*data)[i]); \
- std::cout << "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data << std::endl; \
+ */ \
+ DEBTRACE( "-------- CalciumInterface(lecture Inter Part), Data Ptr :" << *data ) \
return CalciumTypes::CPOK; \
}; \
extern "C" void ecp_lecture_##_name##_free ( _type _qual * data) { \
double _t=*t; \
size_t _bufferLength=bufferLength; \
if ( IsSameType< _name , cplx >::value ) _bufferLength=_bufferLength*2; \
- std::cout << "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" << std::endl; \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part) MARK 1 ------------------" ) \
try { \
- printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar); \
+ /*printf("-------- CalciumInterface(ecriture Inter Part), cp_name : Nom de la var. de type %s : %s\n",#_type,nomvar);*/ \
std::string essai(nomvar); \
- std::cout << "----------->-" << nomvar << std::endl; \
+ DEBTRACE( "----------->-" << nomvar ) \
CalciumInterface::ecp_ecriture< _type, _name >( *_component, \
static_cast<CalciumTypes::DependencyType>(dependencyType), \
_t,i,nomvar,_bufferLength,*data); \
std::cerr << ex.what() << std::endl; \
return ex.getInfo(); \
} \
- std::cout << "-------- CalciumInterface(ecriture Inter Part), Valeur de data : " << std::endl; \
- std::cout << "-------- CalciumInterface(ecriture Inter Part), Ptr(1) :" << data << std::endl; \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Valeur de data : " ) \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Ptr(1) :" << data ) \
+ /* \
for (int i=0; i<_bufferLength;++i) \
printf("-------- CalciumInterface(ecriture Inter Part), Valeur de data (typage entier) data[%d] : %d \n",i,data[i]); \
- std::cout << "-------- CalciumInterface(ecriture Inter Part), Ptr(2) :" << data << std::endl; \
+ */ \
+ DEBTRACE( "-------- CalciumInterface(ecriture Inter Part), Ptr(2) :" << data ) \
return CalciumTypes::CPOK; \
}; \
table[CalciumTypes::UNDEFINED_DEPENDENCY ] = Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ;
+#ifdef _DEBUG_
std::cout << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::TIME_DEPENDENCY<<"] : "<<
table[CalciumTypes::TIME_DEPENDENCY] << std::endl;
std::cout << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::ITERATION_DEPENDENCY<<"] : "<<
table[CalciumTypes::ITERATION_DEPENDENCY] << std::endl;
std::cout << "CORBA_DEPENDENCY_TYPE() : table["<<CalciumTypes::UNDEFINED_DEPENDENCY<<"] : "<<
table[CalciumTypes::UNDEFINED_DEPENDENCY] << std::endl;
+#endif
}
table = (map<CalciumTypes::DependencyType,
Ports::Calcium_Ports::DependencyType >& ) *this ;
+#ifdef _DEBUG_
std::cout << "CORBA_DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
+#endif
assert( table.find( (CalciumTypes::DependencyType)c ) != table.end() ) ;
return table[ (CalciumTypes::DependencyType)c ] ;
typedef typename PortType::DataManipulator DataManipulator;
typedef typename DataManipulator::InnerType InnerType;
+#ifdef _DEBUG_
std::cerr << "-------- Copy2CorbaSpace<true> MARK 1 ------------------" << std::endl;
+#endif
// Crée le type corba à partir du data sans lui en donner la propriété
corbaData = DataManipulator::create(nRead,&data,false);
+#ifdef _DEBUG_
std::cerr << "-------- Copy2CorbaSpace<true> MARK 2 --(dataPtr : "
<< DataManipulator::getPointer(corbaData,false)<<")----------------" << std::endl;
+#endif
}
};
corbaData = DataManipulator::create(nRead);
InnerType * dataPtr = DataManipulator::getPointer(corbaData,false);
+#ifdef _DEBUG_
std::cerr << "-------- Copy2CorbaSpace<false> MARK 1 --(dataPtr : " <<
dataPtr<<")----------------" << std::endl;
+#endif
std::copy(&data,&data+nRead,dataPtr);
+#ifdef _DEBUG_
std::cerr << "-------- Copy2CorbaSpace<false> MARK 2 --(nRead: "<<nRead<<")-------------" << std::endl;
std::cerr << "-------- Copy2CorbaSpace<false> MARK 3 : " ;
for (int i=0; i<nRead; ++i)
std::cerr << (*corbaData)[i] << " ";
std::cout << std::endl;
+#endif
}
};
// Recopie des données dans le buffer allouée la méthode appelante
// dans le cas d'une demande utilisateur 0 copie mais sur
// des types utilisateurs et CORBA incompatibles.
+#ifdef _DEBUG_
std::cerr << "-------- Copy2UserSpace<false> MARK 1 --(dataPtr : " <<dataPtr<<")----------------" << std::endl;
+#endif
std::copy(dataPtr,dataPtr+nRead,data);
+#ifdef _DEBUG_
std::cerr << "-------- Copy2UserSpace<false> MARK 2 --(nRead: "<<nRead<<")-------------" << std::endl;
std::cerr << "-------- Copy2UserSpace<false> MARK 3 --(data : " <<data<<") :";
std::copy(data,data+nRead,std::ostream_iterator<T1>(std::cout," "));
std::cout << std::endl;
+#endif
}
};
table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY ] = CalciumTypes::UNDEFINED_DEPENDENCY ;
+#ifdef _DEBUG_
std::cout << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::TIME_DEPENDENCY<<"] : "<<
table[Ports::Calcium_Ports::TIME_DEPENDENCY] << std::endl;
std::cout << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::ITERATION_DEPENDENCY<<"] : "<<
table[Ports::Calcium_Ports::ITERATION_DEPENDENCY] << std::endl;
std::cout << "DEPENDENCY_TYPE() : table["<<Ports::Calcium_Ports::UNDEFINED_DEPENDENCY<<"] : "<<
table[Ports::Calcium_Ports::UNDEFINED_DEPENDENCY] << std::endl;
+#endif
}
CalciumTypes::DependencyType> &table = (map<Ports::Calcium_Ports::DependencyType,
CalciumTypes::DependencyType>&)*this ;
+#ifdef _DEBUG_
std::cout << "DEPENDENCY_TYPE() : ::operator["<<c<<"]: " << table[c] << std::endl;
+#endif
assert( table.find( (Ports::Calcium_Ports::DependencyType)c ) != table.end() ) ;
return table[ (Ports::Calcium_Ports::DependencyType)c ] ;
Copy2CorbaSpace.hxx \
CalciumPortTraits.hxx \
calcium.h \
+ Calcium.hxx \
calciumP.h \
version.h \
calcium.hf
# This local variable defines the list of CPPFLAGS common to all target in this package.
COMMON_CPPFLAGS= -I$(top_srcdir)/src/DSC/DSC_User \
-I$(top_srcdir)/src/DSC/DSC_User/Datastream \
+ -I$(top_srcdir)/src/DSC/DSC_User/Datastream/Palm \
+ -I$(top_srcdir)/src/DSC/DSC_User/Basic \
-I$(top_srcdir)/src/DSC/DSC_Basic \
-I$(top_srcdir)/src/SALOMELocalTrace \
-I$(top_srcdir)/src/Basics \
-I$(top_srcdir)/src/Utils \
+ -I$(top_srcdir)/src/Container \
+ -I$(top_srcdir)/src/Notification \
-I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@
CorbaTypes2CalciumTypes.cxx \
CalciumTypes2CorbaTypes.cxx \
CalciumProvidesPort.cxx \
+ Calcium.cxx \
calcium_destructors_port_uses.cxx
libSalomeCalcium_la_CXXFLAGS = $(COMMON_CPPFLAGS)
AM_CFLAGS = -fexceptions
lib_LTLIBRARIES = libCalciumC.la
-libCalciumC_la_SOURCES = Calcium.c
+libCalciumC_la_SOURCES = Calcium.c Calcium.cxx calciumf.c
+libCalciumC_la_CXXFLAGS = $(COMMON_CPPFLAGS)
#
# ===============================================================
#
noinst_PROGRAMS = test_DataIdContainer
## testInterpolation
-
-testInterpolation_SOURCES = testInterpolation.cxx
-testInterpolation_CXXFLAGS = -I/usr/include
+## testInterpolation_SOURCES = testInterpolation.cxx
+## testInterpolation_CXXFLAGS = -I/usr/include
test_DataIdContainer_SOURCES = test_DataIdContainer.cxx
-
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#ifndef _CALCIUM_PORT_FACTORY_HXX_
#define _CALCIUM_PORT_FACTORY_HXX_
+#include "port_factory.hxx"
#include "uses_port.hxx"
#include "provides_port.hxx"
#include <string>
using namespace std;
-class calcium_port_factory
+class calcium_port_factory :
+ public port_factory
{
public:
calcium_port_factory();
--- /dev/null
+#include <string.h>
+#include <stdlib.h>
+#include <fortoc.h>
+#include <calcium.h>
+#include <stdio.h>
+
+static void* COMPO=0;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static void fstrtocstr(char *cstr, char *fstr,int fstr_len)
+{
+ int i,iend;
+ for (iend = fstr_len-1; iend >= 0; iend--)
+ if (fstr[iend] != ' ') break;
+ for (i = 0; i <= iend; i++)
+ cstr[i] = fstr[i];
+ cstr[i] = '\0';
+}
+
+static void cstrtofstr(char *cstr, char *fstr,int fstr_len)
+{
+ int i, len;
+ len = strlen(cstr);
+ if (len > fstr_len) len = fstr_len;
+ for (i = 0; i < len; i++)
+ fstr[i] = cstr[i];
+ while (i < fstr_len)
+ fstr[i++] = ' ';
+}
+
+static char * fstr1(char *nom,int nnom)
+{
+ char * cnom=(char*)malloc((nnom+1)*sizeof(char));
+ fstrtocstr(cnom,nom,nnom);
+ return cnom;
+}
+
+static char * free_str1(char *nom)
+{
+ free(nom);
+}
+
+void F_FUNC(cpcd,CPCD)(long *compo,STR_PSTR(nom),int *info STR_PLEN(nom))
+{
+ /* nom is OUT argument */
+ cp_cd((void *)*compo,STR_PTR(nom));
+ /* replace in place ??? */
+ cstrtofstr(STR_PTR(nom),STR_PTR(nom),STR_LEN(nom));
+}
+
+void F_FUNC(cplen,CPLEN)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom),
+ int *max,int *n, int *tab,int *err STR_PLEN(nom))
+{
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ fprintf(stderr,"CPLEN: %s %f %f\n",cnom,*ti,*tf);
+ *err=cp_len((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+ fprintf(stderr,"End of CPLEN: %s \n",cnom);
+ free_str1(cnom);
+}
+
+void F_FUNC(cpldb,CPLDB)(long *compo,int *dep,double *ti,double *tf,int *iter,STR_PSTR(nom),
+ int *max,int *n, double *tab,int *err STR_PLEN(nom))
+{
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ fprintf(stderr,"CPLDB: %s %f %f \n",cnom, *ti,*tf);
+ *err=cp_ldb((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+ fprintf(stderr,"End of CPLDB: %s %f %f \n",cnom,*ti,*tf);
+ free_str1(cnom);
+}
+
+void F_FUNC(cplre,CPLRE)(long *compo,int *dep,float *ti,float *tf,int *iter,STR_PSTR(nom),
+ int *max,int *n, float *tab,int *err STR_PLEN(nom))
+{
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ fprintf(stderr,"CPLRE: %s %f %f \n",cnom, *ti,*tf);
+ *err=cp_lre((void *)*compo,*dep,ti,tf,iter,cnom,*max,n,tab);
+ fprintf(stderr,"End of CPLRE: %s %f %f \n",cnom,*ti,*tf);
+ free_str1(cnom);
+}
+
+void F_FUNC(cpedb,CPEDB)(long *compo,int *dep,double *ti,int *iter,STR_PSTR(nom),int *n, double *tab,int *err STR_PLEN(nom))
+{
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ fprintf(stderr,"CPEDB: %s %f \n",cnom, *ti);
+ *err=cp_edb((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+ fprintf(stderr,"End of CPEDB: %s %f \n",cnom, *ti);
+ free_str1(cnom);
+}
+
+void F_FUNC(cpere,CPERE)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, float *tab,int *err STR_PLEN(nom))
+{
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ fprintf(stderr,"CPERE: %s %f \n",cnom, *ti);
+ *err=cp_ere((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+ fprintf(stderr,"End of CPERE: %s %f \n",cnom, *ti);
+ free_str1(cnom);
+}
+
+void F_FUNC(cpeen,CPEEN)(long *compo,int *dep,float *ti,int *iter,STR_PSTR(nom),int *n, int *tab,int *err STR_PLEN(nom))
+{
+ char* cnom=fstr1(STR_PTR(nom),STR_LEN(nom));
+ fprintf(stderr,"CPEEN: %s %f %d\n",cnom, *ti,*iter);
+ *err=cp_een((void *)*compo,*dep,*ti,*iter,cnom,*n,tab);
+ fprintf(stderr,"End of CPEEN: %s %f \n",cnom,*ti);
+ free_str1(cnom);
+}
+
+void F_FUNC(cpfin,CPFIN)(long *compo,int *dep,int *err)
+{
+ fprintf(stderr,"CPFIN: \n");
+ *err=cp_fin((void *)*compo,*dep);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
--- /dev/null
+
+#ifndef FORTRAN_H
+#define FORTRAN_H
+
+/* Operateur de concatenation */
+#define _(A,B) A##B
+
+#ifdef __linux
+#define F_FUNC(lname,uname) _(lname,_) /* Fortran function name */
+#define F_CALL(lname,uname) _(lname,_) /* Fortran function call */
+#define STR_PSTR(str) char *str /* fortran string arg pointer */
+#define STR_PLEN(str) , int _(Len,str) /* fortran string arg length */
+#define STR_PTR(str) str /* fortran string pointer */
+#define STR_LEN(str) _(Len,str) /* fortran string length */
+
+
+#endif
+
+#endif
+
// ATTENTION TESTER p184 si le pointeur est null
// ATTENTION TESTER Si le flag release si la sequence contient des chaines
// ou des object refs
+#ifdef _DEBUG_
std::cout << "----seq_u_manipulation::get_data(..)-- MARK 1 ------------------" << std::endl;
+#endif
InnerType * p_data = const_cast<seq_T &>(data).get_buffer(true);
+#ifdef _DEBUG_
std::cout << "----seq_u_manipulation::get_data(..)-- MARK 2 ------"<< p_data <<"------------" << std::endl;
+#endif
// Crée une nouvelle sequence propriétaire des données du buffer (pas de recopie)
// Les données seront automatiquement désallouées par appel interne à la méthode freebuf
template < typename DataManipulator, typename COUPLING_POLICY> void
GenericPort<DataManipulator, COUPLING_POLICY>::wakeupWaiting()
{
+#ifdef _DEBUG_
std::cout << "-------- wakeupWaiting ------------------" << std::endl;
+#endif
storedDatas_mutex.lock();
if (waitingForAnyDataId || waitingForConvenientDataId) {
+#ifdef _DEBUG_
std::cout << "-------- wakeupWaiting:signal --------" << std::endl;
std::cout << std::flush;
+#endif
cond_instance.signal();
}
storedDatas_mutex.unlock();
fflush(stdout);
fflush(stderr);
try {
+#ifdef _DEBUG_
// Affichage des donnees pour DEBUGging
cerr << "parametres emis: " << time << ", " << tag << endl;
DataManipulator::dump(dataParam);
+#endif
// L'intérêt des paramètres time et tag pour ce port est décidé dans la politique de couplage
// Il est possible de filtrer en prenant en compte uniquement un paramètre time/tag ou les deux
bool expectedDataReceived = false;
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 1 ------------------" << std::endl;
+#endif
if ( dataIds.empty() ) return;
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 1bis ------------------" << std::endl;
+#endif
// Recupere les donnees venant de l'ORB et relâche les structures CORBA
// qui n'auraient plus cours en sortie de méthode put
int nbOfIter = 0;
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 2 ------ "<< (dataIdIt == dataIds.end()) << "------------" << std::endl;
std::cout << "-------- Put : MARK 2bis "<< (*dataIdIt) <<"------------------" << std::endl;
+#endif
storedDatas_mutex.lock();
for (;dataIdIt != dataIds.end();++dataIdIt) {
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 3 ------------------" << std::endl;
+#endif
// Duplique l'instance de donnée pour les autres dataIds
if (nbOfIter > 0) data = DataManipulator::clone(data);
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 3bis -----"<< dataIdIt.operator*() <<"------------" << std::endl;
+#endif
DataId currentDataId=*dataIdIt;
+#ifdef _DEBUG_
std::cerr << "processing dataId : "<< currentDataId << std::endl;
std::cout << "-------- Put : MARK 4 ------------------" << std::endl;
+#endif
// Ajoute l'instance de la donnee a sa place dans la table de données
// ou remplace une instance précédente si elle existe
// <=> premier emplacement où l'on pourrait insérer notre DataId
// <=> en général équivaux à (*wDataIt).first >= currentDataId
typename DataTable::iterator wDataIt = storedDatas.lower_bound(currentDataId);
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 5 ------------------" << std::endl;
+#endif
// On n'a pas trouvé de dataId supérieur au notre ou
// on a trouvé une clé > à cet Id
if (wDataIt == storedDatas.end() || storedDatas.key_comp()(currentDataId,(*wDataIt).first) ) {
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 6 ------------------" << std::endl;
+#endif
// Ajoute la donnee dans la table
wDataIt = storedDatas.insert(wDataIt, make_pair (currentDataId, data));
} else {
// Si on n'est pas en fin de liste et qu'il n'y a pas de relation d'ordre strict
// entre notre dataId et le DataId pointé c'est qu'ils sont identiques
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 7 ------------------" << std::endl;
+#endif
// Les données sont remplacées par les nouvelles valeurs
// lorsque que le dataId existe déjà
DataType old_data = (*wDataIt).second;
DataManipulator::delete_data (old_data);
}
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 8 ------------------" << std::endl;
+#endif
// Compte le nombre de dataIds à traiter
++nbOfIter;
+#ifdef _DEBUG_
std::cout << "-------- Put : waitingForConvenientDataId : " << waitingForConvenientDataId <<"---" << std::endl;
std::cout << "-------- Put : waitingForAnyDataId : " << waitingForAnyDataId <<"---" << std::endl;
std::cout << "-------- Put : currentDataId : " << currentDataId <<"---" << std::endl;
std::cout << "-------- Put : expectedDataId : " << expectedDataId <<"---" << std::endl;
std::cout << "-------- Put : MARK 9 ------------------" << std::endl;
+#endif
// A simplifier mais :
// - pas possible de mettre des arguments optionnels à cause
( waitingForConvenientDataId &&
isDataIdConveniant(storedDatas, expectedDataId, dummy1, dummy2, dummy3) )
) {
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 10 ------------------" << std::endl;
+#endif
//Doit pouvoir réveiller le get ici (a vérifier)
expectedDataReceived = true;
}
}
if (expectedDataReceived) {
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 11 ------------------" << std::endl;
+#endif
// si waitingForAnyDataId était positionné, c'est forcément lui qui a activer
// expectedDataReceived à true
if (waitingForAnyDataId)
// Pb2 : également si deux attentes de DataIds même différents car on n'en stocke qu'un !
// Conclusion : Pour l'instant on ne gère pas un service multithreadé qui effectue
// des lectures simultanées sur le même port !
+#ifdef _DEBUG_
std::cout << "-------- Put : new datas available ------------------" << std::endl;
+#endif
fflush(stdout);fflush(stderr);
cond_instance.signal();
}
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 12 ------------------" << std::endl;
+#endif
// Deverouille l'acces a la table : On peut remonter l'appel au dessus de expected...
storedDatas_mutex.unlock();
+#ifdef _DEBUG_
std::cout << "-------- Put : MARK 13 ------------------" << std::endl;
+#endif
fflush(stdout);
fflush(stderr);
catch ( const SALOME_Exception & ex ) {
// On évite de laisser un mutex
storedDatas_mutex.unlock();
- std::cerr << ex;
THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
}
bool isEqual, isBounded;
typedef typename DataManipulator::InnerType InnerType;
+#ifdef _DEBUG_
std::cout << "-------- Get : MARK 1 ------------------" << std::endl;
+#endif
expectedDataId = DataId(time,tag);
+#ifdef _DEBUG_
std::cout << "-------- Get : MARK 2 ------------------" << std::endl;
+#endif
typename DataTable::iterator wDataIt1;
// - l'itérateur wDataIt1 est tel que wDataIt1->first < wdataId < (wDataIt1+1)->first
// Méthode provenant de la COUPLING_POLICY
isDataIdConveniant(storedDatas,expectedDataId,isEqual,isBounded,wDataIt1);
+#ifdef _DEBUG_
std::cout << "-------- Get : MARK 3 ------------------" << std::endl;
+#endif
// L'ordre des différents tests est important
if ( isEqual ) {
+#ifdef _DEBUG_
std::cout << "-------- Get : MARK 4 ------------------" << std::endl;
+#endif
// La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM.
// Si l'utilisateur supprime la donnée, storedDataIds devient incohérent
// C'est EraseDataId qui choisi ou non de supprimer la donnée
// Du coup interaction potentielle entre le 0 copy et gestion de l'historique
dataToTransmit = (*wDataIt1).second;
+#ifdef _DEBUG_
std::cout << "-------- Get : MARK 5 ------------------" << std::endl;
std::cout << "-------- Get : Données trouvées à t : " << std::endl;
typename DataManipulator::InnerType const * const InIt1 = DataManipulator::getPointer(dataToTransmit);
std::copy(InIt1, InIt1 + N,
std::ostream_iterator< InnerType > (std::cout," "));
std::cout << std::endl;
+#endif
// Décide de la suppression de certaines instances de données
// La donnée contenu dans la structure CORBA et son dataId sont désallouées
// Méthode provenant de la COUPLING_POLICY
typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
processEraseDataId.apply(storedDatas,wDataIt1);
+#ifdef _DEBUG_
std::cout << "-------- Get : MARK 6 ------------------" << std::endl;
+#endif
break;
}
+#ifdef _DEBUG_
std::cout << "-------- Get : MARK 7 ------------------" << std::endl;
+#endif
//if ( isBounded() && COUPLING_POLICY::template needToProcessBoundedDataId() ) {
// Le DataId demandé n'est pas trouvé mais est encadré ET la politique de couplage
// l'interpolation.
// Les données calciulées sont donc stockées dans storedDatas.
// La propriété des données N'EST PAS transférée à l'utilisateur en mode CALCIUM.
+#ifdef _DEBUG_
std::cout << "-------- Get : MARK 8 ------------------" << std::endl;
+#endif
typename COUPLING_POLICY::template BoundedDataIdProcessor<DataManipulator> processBoundedDataId(*this);
//si static BDIP::apply(dataToTransmit,expectedDataId,wDataIt1);
// A déplacer en paramètre de la méthode précédente ?
storedDatas[expectedDataId]=dataToTransmit;
+#ifdef _DEBUG_
std::cout << "-------- Get : Données calculées à t : " << std::endl;
typename DataManipulator::InnerType const * const InIt1 = DataManipulator::getPointer(dataToTransmit);
size_t N = DataManipulator::size(dataToTransmit);
std::ostream_iterator< InnerType > (std::cout," "));
std::cout << std::endl;
std::cout << "-------- Get : MARK 9 ------------------" << std::endl;
+#endif
typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
processEraseDataId.apply(storedDatas,wDataIt1);
// Réception bloquante sur le dataId demandé
// Si l'instance de donnée n'est pas trouvee
+#ifdef _DEBUG_
std::cout << "-------- Get : MARK 10 ------------------" << std::endl;
+#endif
//Positionné à faux dans la méthode put
waitingForConvenientDataId = true;
+#ifdef _DEBUG_
std::cout << "-------- Get : MARK 11 ------------------" << std::endl;
// Ici on attend que la méthode put recoive la donnée
std::cout << "-------- Get : waiting datas ------------------" << std::endl;
+#endif
fflush(stdout);fflush(stderr);
cond_instance.wait();
+#ifdef _DEBUG_
std::cout << "-------- Get : MARK 12 ------------------" << std::endl;
+#endif
}
} catch (...) {
// Deverouille l'acces a la table
storedDatas_mutex.unlock();
+#ifdef _DEBUG_
std::cout << "-------- Get : MARK 13 ------------------" << std::endl;
+#endif
// La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM
// Si l'utilisateur supprime la donnée, storedDataIds devient incohérent
try {
storedDatas_mutex.lock();// Gérer les Exceptions ds le corps de la méthode
+#ifdef _DEBUG_
std::cout << "-------- Next : MARK 1 ---lastDataIdSet ("<<lastDataIdSet<<")---------------" << std::endl;
+#endif
typename DataTable::iterator wDataIt1;
wDataIt1 = storedDatas.end();
waitingForAnyDataId = false; break;
}
+#ifdef _DEBUG_
std::cout << "-------- Next : MARK 2 ------------------" << std::endl;
+#endif
//Positionné à faux dans la méthode put
waitingForAnyDataId = true;
+#ifdef _DEBUG_
std::cout << "-------- Next : MARK 3 ------------------" << std::endl;
// Ici on attend que la méthode put recoive la donnée
std::cout << "-------- Next : waiting datas ------------------" << std::endl;
+#endif
fflush(stdout);fflush(stderr);
cond_instance.wait();
if (lastDataIdSet) {
+#ifdef _DEBUG_
std::cout << "-------- Next : MARK 4 ------------------" << std::endl;
+#endif
wDataIt1 = storedDatas.upper_bound(lastDataId);
} else {
+#ifdef _DEBUG_
std::cout << "-------- Next : MARK 5 ------------------" << std::endl;
+#endif
lastDataIdSet = true;
wDataIt1 = storedDatas.begin();
}
}
+#ifdef _DEBUG_
std::cout << "-------- Next : MARK 6 ------------------" << std::endl;
+#endif
t = getTime( (*wDataIt1).first );
tag = getTag ( (*wDataIt1).first );
dataToTransmit = (*wDataIt1).second;
+#ifdef _DEBUG_
std::cout << "-------- Next : MARK 7 ------------------" << std::endl;
+#endif
lastDataId = (*wDataIt1).first;
typename COUPLING_POLICY::template EraseDataIdProcessor<DataManipulator> processEraseDataId(*this);
processEraseDataId.apply(storedDatas, wDataIt1);
+#ifdef _DEBUG_
std::cout << "-------- Next : MARK 8 ------------------" << std::endl;
+#endif
} catch (...) {
+#ifdef _DEBUG_
std::cout << "-------- Next : MARK 8bis ------------------" << std::endl;
+#endif
waitingForAnyDataId = false;
storedDatas_mutex.unlock();
throw;
}
storedDatas_mutex.unlock();
+#ifdef _DEBUG_
std::cout << "-------- Next : MARK 9 ------------------" << std::endl;
+#endif
// La propriété de la données N'EST PAS transmise à l'utilisateur en mode CALCIUM
// Si l'utilisateur supprime la donnée, storedDataIds devient incohérent
virtual ~GenericUsesPort();
virtual const char * get_repository_id();
- virtual bool set_port(Ports::Port_ptr port);
template <typename TimeType,typename TagType>
void put(CorbaInDataType data, TimeType time, TagType tag);
}
-template <typename DataManipulator,typename CorbaPortType, char * repositoryName, typename UsesPort >
-bool
-GenericUsesPort< DataManipulator,CorbaPortType, repositoryName, UsesPort >::set_port(Ports::Port_ptr port) {
- if (_my_ports) {
- size_t n = _my_ports->length()+1;
- _my_ports->length(n);
- (*_my_ports)[n]=CorbaPortType::_narrow(port);
- return true;
- } else {
- // Vérifier si port is_nil
- _my_ports = new Engines::DSC::uses_port();
- _my_ports->length(1);
- (*_my_ports)[0]=CorbaPortType::_narrow(port);
- return true;
- }
- return false;
-}
-
template <typename DataManipulator,typename CorbaPortType, char * repositoryName, typename UsesPort >
template <typename TimeType,typename TagType>
void
CorbaPortTypePtr port = CorbaPortType::_narrow((*_my_ports)[i]);
//if (i) { PB1
copyOfData = DataManipulator::clone(data);
+#ifdef _DEBUG_
std::cout << "-------- GenericUsesPort::put : Copie de data("
//<< DataManipulator::getPointer(data)
<<") vers copyOfData ("
<<DataManipulator::getPointer(copyOfData)
<<")------------------" << std::endl;
+#endif
//} PB1
try {
port->put(*copyOfData,time,tag); // catcher les exceptions
{
if (_my_ports) delete _my_ports;
+#ifdef _DEBUG_
std::cerr << "GenericUsesPort::uses_port_changed" << endl;
+#endif
_my_ports = new Engines::DSC::uses_port(*new_uses_port);
}
#ifndef _PALM_PORT_FACTORY_HXX_
#define _PALM_PORT_FACTORY_HXX_
+#include "port_factory.hxx"
#include "uses_port.hxx"
#include "provides_port.hxx"
#include <string>
using namespace std;
-class palm_port_factory
+class palm_port_factory :
+ public port_factory
{
public:
palm_port_factory();
# Author : André RIBES (EDF)
# Module : KERNEL
-SUBDIRS = Basic Datastream
include $(top_srcdir)/salome_adm/unix/make_common_starter.am
uses_port.hxx \
provides_port.hxx \
Superv_Component_i.hxx \
- DSC_Exception.hxx
+ DSC_Exception.hxx \
+ port_factory.hxx
#
# ===============================================================
test_DSC_Exception_LDADD = $(top_builddir)/src/Utils/libOpUtil.la
+SUBDIRS = Basic Datastream
bool notif) :
Engines_DSC_i(orb, poa, contId, instanceName, interfaceName)
{
+#ifdef _DEBUG_
std::cout << "--Superv_Component_i : MARK 1 ---- " << instanceName << "----" << std::endl;
- _my_basic_factory = new basic_port_factory();
- _my_palm_factory = new palm_port_factory();
- _my_calcium_factory = new calcium_port_factory();
+#endif
+ register_factory("BASIC", new basic_port_factory());
+ register_factory("PALM", new palm_port_factory());
+ register_factory("CALCIUM", new calcium_port_factory());
}
-Superv_Component_i::~Superv_Component_i() {
- delete _my_basic_factory;
+Superv_Component_i::~Superv_Component_i()
+{
+ factory_map_t::iterator begin = _factory_map.begin();
+ factory_map_t::iterator end = _factory_map.end();
+ for(;begin!=end;begin++)
+ {
+ delete begin->second;
+ }
+}
+
+void
+Superv_Component_i::register_factory(const std::string & factory_name,
+ port_factory * factory_ptr)
+{
+ factory_map_t::iterator it = _factory_map.find(factory_name);
+
+ if (it == _factory_map.end() )
+ {
+ _factory_map[factory_name] = factory_ptr;
+ }
+}
+
+port_factory *
+Superv_Component_i::get_factory(const std::string & factory_name)
+{
+ port_factory * rtn_factory = NULL;
+ factory_map_t::iterator it = _factory_map.find(factory_name);
+
+ if (it != _factory_map.end() )
+ {
+ rtn_factory = _factory_map[factory_name];
+ }
+
+ return rtn_factory;
}
provides_port *
-Superv_Component_i::create_provides_data_port(const char* port_fab_type)
+Superv_Component_i::create_provides_data_port(const std::string& port_fab_type)
throw (BadFabType)
{
- assert(port_fab_type);
-
provides_port * rtn_port = NULL;
- string the_type(port_fab_type);
+ std::string factory_name;
+ std::string type_name;
int search_result;
- search_result = the_type.find("BASIC_");
- if (search_result == 0) {
- rtn_port = _my_basic_factory->create_data_servant(the_type.substr(search_result+6,
- the_type.length()));
- }
- search_result = the_type.find("PALM_");
- if (search_result == 0) {
- rtn_port = _my_palm_factory->create_data_servant(the_type.substr(search_result+5,
- the_type.length()));
- }
+ search_result = port_fab_type.find("_");
+ factory_name = port_fab_type.substr(0,search_result);
+ type_name = port_fab_type.substr(search_result+1, port_fab_type.length());
- search_result = the_type.find("CALCIUM_");
- if (search_result == 0) {
- rtn_port = _my_calcium_factory->create_data_servant(the_type.substr(search_result+8, the_type.length()));
+ port_factory * factory = get_factory(factory_name);
+ if (factory) {
+ rtn_port = factory->create_data_servant(type_name);
}
if (rtn_port == NULL)
}
uses_port *
-Superv_Component_i::create_uses_data_port(const char* port_fab_type)
+Superv_Component_i::create_uses_data_port(const std::string& port_fab_type)
throw (BadFabType)
{
- assert(port_fab_type);
-
uses_port * rtn_proxy = NULL;
- string the_type(port_fab_type);
+ std::string factory_name;
+ std::string type_name;
int search_result;
- search_result = the_type.find("BASIC_");
- if (search_result == 0) {
- rtn_proxy = _my_basic_factory->create_data_proxy(the_type.substr(search_result+6,
- the_type.length()));
- }
-
- search_result = the_type.find("CALCIUM_");
- if (search_result == 0) {
- std::cout << "---- Superv_Component_i::create_uses_data_port : MARK 1 ---- " << the_type.substr(search_result+8, the_type.length()) << "----" << std::endl;
- rtn_proxy = _my_calcium_factory->create_data_proxy(the_type.substr(search_result+8, the_type.length()));
+ search_result = port_fab_type.find("_");
+ factory_name = port_fab_type.substr(0,search_result);
+ type_name = port_fab_type.substr(search_result+1, port_fab_type.length());
+
+ port_factory * factory = get_factory(factory_name);
+ if (factory) {
+ rtn_proxy = factory->create_data_proxy(type_name);
}
if (rtn_proxy == NULL)
add_port(port, port_name);
}
else if (s_port_type == "uses") {
+#ifdef _DEBUG_
std::cout << "---- Superv_Component_i::add_port : MARK 1 ---- " << std::endl;
+#endif
uses_port * port = create_uses_data_port(port_fab_type);
+#ifdef _DEBUG_
std::cout << "---- Superv_Component_i::add_port : MARK 2 ---- " << std::endl;
+#endif
add_port(port, port_name);
}
else
#include "base_port.hxx"
#include "uses_port.hxx"
#include "provides_port.hxx"
+#include "port_factory.hxx"
-// Les différentes fabriques de ports
+// default ports factories on the Kernel
#include "basic_port_factory.hxx"
#include "palm_port_factory.hxx"
#include "calcium_port_factory.hxx"
{return NULL;}
/*!
- * This methode permits to create a provides port provided by the platform.
+ * This method permits to create a provides port provided by the platform.
* (See documentation of DSC for knoing these ports).
*
*
*
* \note It's user repsonsability to destroy the provides port.
*/
- virtual provides_port * create_provides_data_port(const char* port_fab_type)
+ virtual provides_port * create_provides_data_port(const std::string& port_fab_type)
throw (BadFabType);
/*!
- * This methode permits to create a uses port provided by the platform.
+ * This method permits to create a uses port provided by the platform.
* (See documentation of DSC for knoing these ports).
*
*
*
* \note It's user repsonsability to destroy the uses port.
*/
- virtual uses_port * create_uses_data_port(const char* port_fab_type)
+ virtual uses_port * create_uses_data_port(const std::string& port_fab_type)
throw (BadFabType);
/*!
const Engines::DSC::Message message);
-private:
+ /*!
+ * Add a factory the component. If the factory_name is already
+ * used, the new library is not added.
+ *
+ * \param factory_name name of the factory (used by Superv_Component_i::create_provides_data_port
+ * and Superv_Component_i::create_uses_data_port)
+ * \param factory_ptr factory pointer (destroyed by the component)
+ */
+ virtual void register_factory(const std::string & factory_name,
+ port_factory * factory_ptr);
+
+ /*!
+ * Get a factory from the component.
+ *
+ * \param factory_name name of the factory.
+ * \return factory pointer, NULL if the factory doesn't exist.
+ */
+ virtual port_factory * get_factory(const std::string & factory_name);
- // Fabrics
- basic_port_factory * _my_basic_factory;
- palm_port_factory * _my_palm_factory;
- calcium_port_factory * _my_calcium_factory;
+private:
+ // Factory map
+ typedef std::map<std::string, port_factory*> factory_map_t;
+ factory_map_t _factory_map;
/*-------------------------------------------------*/
// A Superv_Component port.
assert(port_name);
SpecificPortType * retPort;
+#ifdef _DEBUG_
std::cout << "---- Superv_Component_i::add_port : Mark 0 ---- " << port_name << "----" << std::endl;
+#endif
std::string s_port_type(port_type);
if (s_port_type == "provides") {
else if (s_port_type == "uses") {
uses_port * port = create_uses_data_port(port_fab_type);
add_port(port, port_name);
+#ifdef _DEBUG_
std::cout << "---- Superv_Component_i::add_port : Mark 1 ---- " << port << "----" << std::endl;
std::cout << "---- Superv_Component_i::add_port : Mark 1 ---- get_repository_id()" << port->get_repository_id() << std::endl;
+#endif
retPort = dynamic_cast<SpecificPortType *>(port);
+#ifdef _DEBUG_
std::cout << "---- Superv_Component_i::add_port : Mark 2 ---- " << retPort << "----" << std::endl;
+#endif
if ( retPort == NULL ) { delete port;
throw BadCast( LOC("La conversion vers le type de port demandé n'est pas possible " ));
}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : port_factory.hxx
+// Author : André RIBES (EDF)
+// Module : KERNEL
+
+#ifndef _PORT_FACTORY_HXX
+#define _PORT_FACTORY_HXX
+
+#include "base_port.hxx"
+#include "uses_port.hxx"
+#include "provides_port.hxx"
+
+#include <string>
+
+/*! \class port_factory
+ * \brief This class is an abstract for all the DSC ports factories that have to be
+ * registered into the component.
+ */
+class port_factory {
+ public:
+ virtual ~port_factory() {}
+
+ /*!
+ * This method creates a provides port.
+ *
+ * \param type port's type.
+ * \return a pointer of the provides port.
+ */
+ virtual provides_port * create_data_servant(std::string type) = 0;
+
+ /*!
+ * This method creates a uses port.
+ *
+ * \param type port's type.
+ * \return a pointer of the uses port.
+ */
+ virtual uses_port * create_data_proxy(std::string type) = 0;
+};
+
+#endif
+
*/
virtual const char * get_repository_id() = 0;
- /*!
- * DEPRECATED --- WILL BE REMOVED
- * It was used when uses port where not multiple.
- * It's an abstract method.
- *
- */
- virtual bool set_port(Ports::Port_ptr port) = 0;
-
/*!
* This method is the uses port's callback to be aware of
* connections states.
SUBDIR_PAR = ParallelDSC
endif
-SUBDIRS = DSC_Basic DSC_User $(SUBDIR_PAR)
+SUBDIRS = DSC_Basic DSC_User $(SUBDIR_PAR) DSC_Python
+
+EXTRA_DIST= DSC.dox
Engines_Parallel_Component_i(orb, ior, poa, contId, instanceName, interfaceName, notif),
Engines::Parallel_DSC_serv(orb, ior),
Engines::DSC_serv(orb, ior),
-// Engines::Superv_Component_serv(orb, ior),
+ Engines::Superv_Component_serv(orb, ior),
Engines::Component_serv(orb, ior),
+ Engines::Parallel_Component_serv(orb, ior),
InterfaceParallel_impl(orb,ior)
{
}
virtual ~Engines_ParallelDSC_i();
- //virtual CORBA::Boolean init_service(const char* service_name) {return true;}
-
/*!
* \see Engines::DSC::add_provides_port
*/
#include "HDFOI.hxx"
-#include <OSD_Path.hxx>
-#include <OSD_File.hxx>
-#include <OSD_Protection.hxx>
-#include <OSD_Directory.hxx>
-#include <TCollection_AsciiString.hxx>
-
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <stdio.h>
+#include <string>
#ifdef WNT
#include <io.h>
using namespace std;
+void Move(const string& fName, const string& fNameDst);
+bool Exists(const string thePath);
bool CreateAttributeFromASCII(HDFinternalObject *father, FILE* fp);
bool CreateDatasetFromASCII(HDFcontainerObject *father, FILE *fp);
bool CreateGroupFromASCII(HDFcontainerObject *father, FILE *fp);
void SaveGroupInASCIIfile(HDFgroup *hdf_group, FILE* fp, int ident);
void SaveDatasetInASCIIfile(HDFdataset *hdf_dataset, FILE* fp, int ident);
-char* GetTmpDir();
+string GetTmpDir();
char* makeName(char* name);
char* restoreName(char* name);
void write_float64(FILE* fp, hdf_float64* value);
bool isReplace,
const char* theExtension)
{
- TCollection_AsciiString aPath((char*)thePath);
+ string aPath(thePath);
if(!isReplace) {
if(theExtension == NULL) aPath += ".asc";
else aPath += (char*)theExtension;
}
- TCollection_AsciiString aFileName(aPath);
+ string aFileName(aPath);
if(isReplace) aFileName=aPath+".ascii_tmp";
HDFfile *hdf_file = new HDFfile((char*)thePath);
char name[HDF_NAME_MAX_LEN+1];
int nbsons = hdf_file->nInternalObjects(), nbAttr = hdf_file->nAttributes();
- FILE* fp = fopen(aFileName.ToCString(), "w");
+ FILE* fp = fopen(aFileName.c_str(), "w");
fprintf(fp, "%s\n", ASCIIHDF_ID);
fprintf(fp, "%i\n", nbsons+nbAttr);
hdf_attribute = 0;
}
- for (Standard_Integer i=0; i<nbsons; i++) {
+ for (int i=0; i<nbsons; i++) {
hdf_file->InternalObjectIndentify(i,name);
if (strncmp(name, "INTERNAL_COMPLEX",16) == 0) continue;
delete hdf_file;
if(isReplace) {
- OSD_Path anOSDPath(aFileName);
- OSD_File anOSDFile(anOSDPath);
- if(anOSDFile.Exists())
- anOSDFile.Move(aPath);
+ if(Exists(aFileName))
+ Move(aFileName, aPath);
else
return NULL;
}
- int length = strlen(aPath.ToCString());
+ int length = strlen(aPath.c_str());
char *new_str = new char[ 1+length ];
- strcpy(new_str , aPath.ToCString()) ;
+ strcpy(new_str , aPath.c_str()) ;
return new_str;
}
{
hdf_group->OpenOnDisk();
- TCollection_AsciiString anIdent(ident, '\t');
int nbsons = hdf_group->nInternalObjects(), nbAttr = hdf_group->nAttributes();
- /*fprintf(fp, "%s%s\n", anIdent.ToCString(), GROUP_ID);*/
fprintf(fp, "%s\n", GROUP_ID);
char* name = makeName(hdf_group->GetName());
- /*fprintf(fp, "%s%s %i\n", anIdent.ToCString(), name, nbsons+nbAttr);*/
fprintf(fp, "%s %i\n", name, nbsons+nbAttr);
delete name;
}
}
- /*fprintf(fp, "%s%s\n", anIdent.ToCString(), GROUP_ID_END);*/
fprintf(fp, "%s\n", GROUP_ID_END);
hdf_group->CloseOnDisk();
hdf_byte_order order = hdf_dataset->GetOrder();
int nbAttr = hdf_dataset->nAttributes();
- TCollection_AsciiString anIdent(ident, '\t');
- TCollection_AsciiString anIdentChild(ident+1, '\t');
-
char* name = makeName(hdf_dataset->GetName());
- /*fprintf(fp, "%s%s\n", anIdent.ToCString(), DATASET_ID);*/
fprintf(fp, "%s\n", DATASET_ID);
- /*fprintf(fp, "%s%s %i %i\n", anIdent.ToCString(), name, type, nbAttr);*/
fprintf(fp, "%s %i %i\n", name, type, nbAttr);
delete name;
hdf_dataset->GetDim(dim);
- /*fprintf(fp, "%s %i\n", anIdentChild.ToCString(), ndim);*/
fprintf(fp, " %i\n", ndim);
for(int i = 0;i < ndim;i++) {
- /*fprintf(fp, "%s%i", anIdentChild.ToCString(), dim[i]);*/
fprintf(fp, " %i", dim[i]);
}
- /*fprintf(fp, "%s\n", anIdentChild.ToCString());*/
fprintf(fp, "\n");
delete dim;
- /*fprintf(fp, "%s%li:", anIdentChild.ToCString(), size);*/
-// fprintf(fp, "%li:", size);
fprintf(fp, "%li %i:", size, order);
if (type == HDF_STRING) {
hdf_attribute = 0;
}
- /*fprintf(fp, "%s%s\n", anIdent.ToCString(), DATASET_ID_END); */
fprintf(fp, "%s\n", DATASET_ID_END);
hdf_dataset->CloseOnDisk();
hdf_type type = hdf_attribute->GetType();
- TCollection_AsciiString anIdent(ident, '\t');
- TCollection_AsciiString anIdentChild(ident+1, '\t');
-
char* name = makeName(hdf_attribute->GetName());
int size = hdf_attribute->GetSize();
- /*fprintf(fp, "%s%s\n", anIdent.ToCString(), ATTRIBUTE_ID);*/
fprintf(fp, "%s\n", ATTRIBUTE_ID);
- /*fprintf(fp, "%s%s %i %i\n", anIdent.ToCString(), name, type, size);*/
fprintf(fp, "%s %i %i\n", name, type, size);
delete name;
if (type == HDF_STRING) {
char* val = new char[size+1];
hdf_attribute->ReadFromDisk(val);
- /*fprintf(fp, "%s:", anIdentChild.ToCString());*/
fprintf(fp, ":");
fwrite(val, 1, size, fp);
fprintf(fp, "\n");
} else if (type == HDF_FLOAT64) {
hdf_float64 val;
hdf_attribute->ReadFromDisk(&val);
- /*fprintf(fp, "%s", anIdentChild.ToCString());*/
write_float64(fp, &val);
fprintf(fp, "\n");
} else if(type == HDF_INT64) {
hdf_int64 val;
hdf_attribute->ReadFromDisk(&val);
- /*fprintf(fp, "%s%li \n", anIdentChild.ToCString(), val);*/
fprintf(fp, "%li \n", val);
} else if(type == HDF_INT32) {
hdf_int32 val;
hdf_attribute->ReadFromDisk(&val);
- /*fprintf(fp, "%s%i \n", anIdentChild.ToCString(), val);*/
fprintf(fp, "%i \n", val);
}
- /*fprintf(fp, "%s%s\n", anIdent.ToCString(), ATTRIBUTE_ID_END);*/
fprintf(fp, "%s\n", ATTRIBUTE_ID_END);
hdf_attribute->CloseOnDisk();
char* HDFascii::ConvertFromASCIIToHDF(const char* thePath)
{
// Get a temporary directory to store a file
- TCollection_AsciiString aTmpDir = GetTmpDir(), aFileName("hdf_from_ascii.hdf");
+ string aTmpDir = GetTmpDir(), aFileName("hdf_from_ascii.hdf");
// Build a full file name of temporary file
- TCollection_AsciiString aFullName = aTmpDir + aFileName;
+ string aFullName = aTmpDir + aFileName;
- HDFfile *hdf_file = new HDFfile(aFullName.ToCString());
+ HDFfile *hdf_file = new HDFfile((char*)aFullName.c_str());
hdf_file->CreateOnDisk();
FILE *fp = fopen(thePath, "r");
hdf_file->CloseOnDisk();
delete hdf_file;
- int length = strlen(aTmpDir.ToCString());
+ int length = strlen(aTmpDir.c_str());
char *new_str = new char[ 1+length ];
- strcpy(new_str , aTmpDir.ToCString()) ;
+ strcpy(new_str , aTmpDir.c_str()) ;
return new_str;
}
// function : GetTempDir
// purpose : Return a temp directory to store created files like "/tmp/sub_dir/"
//============================================================================
-char* GetTmpDir()
+string GetTmpDir()
{
- //Find a temporary directory to store a file
- TCollection_AsciiString aTmpDir;
+ //Find a temporary directory to store a file
-#ifdef WNT
- char *aTmp;
- aTmp = getenv("TMP");
- if(aTmp != NULL)
- aTmpDir = TCollection_AsciiString(aTmp);
- else
- aTmpDir = TCollection_AsciiString("C:\\");
+ string aTmpDir;
+
+ char *Tmp_dir = getenv("SALOME_TMP_DIR");
+ if(Tmp_dir != NULL) {
+ aTmpDir = string(Tmp_dir);
+#ifdef WIN32
+ if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\';
#else
- aTmpDir = TCollection_AsciiString("/tmp/");
+ if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/';
+#endif
+ }
+ else {
+#ifdef WIN32
+ aTmpDir = string("C:\\");
+#else
+ aTmpDir = string("/tmp/");
#endif
+ }
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
- TCollection_AsciiString aSubDir(aRND);
- if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876");
+ char buffer[127];
+ sprintf(buffer, "%d", aRND);
+ string aSubDir(buffer);
+ if(aSubDir.size() <= 1) aSubDir = string("123409876");
aTmpDir += aSubDir; //Get RND sub directory
#ifdef WIN32
- if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
+ if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\';
#else
- if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
+ if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/';
#endif
- OSD_Path aPath(aTmpDir);
- OSD_Directory aDir(aPath);
-
- for(aRND = 0; aDir.Exists(); aRND++) {
- aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name
- aPath = OSD_Path(aTmpDir);
- aDir = OSD_Directory(aPath);
+ string aDir = aTmpDir;
+
+ for(aRND = 0; Exists(aDir); aRND++) {
+ sprintf(buffer, "%d", aRND);
+ aDir = aTmpDir+buffer; //Build a unique directory name
}
- OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX);
- aDir.Build(aProtection);
-
- int length = strlen(aTmpDir.ToCString());
- char *new_str = new char[ 1+length ];
- strcpy(new_str , aTmpDir.ToCString());
+#ifdef WNT
+ CreateDirectory(aDir.c_str(), NULL);
+#else
+ mkdir(aDir.c_str(), 0x1ff);
+#endif
- return new_str;
+ return aDir;
}
char* makeName(char* name)
{
- TCollection_AsciiString aName(name), aNewName;
- Standard_Integer i, length = aName.Length();
+ string aName(name), aNewName;
+ int i, length = aName.size();
char replace = (char)19;
- for(i=1; i<=length; i++) {
- if(aName.Value(i) == ' ') aNewName+=replace;
- else aNewName += aName.Value(i);
+ for(i=0; i<length; i++) {
+ if(aName[i] == ' ') aNewName+=replace;
+ else aNewName += aName[i];
}
- length = strlen(aNewName.ToCString());
+ length = strlen(aNewName.c_str());
char *new_str = new char[ 1+length ];
- strcpy(new_str , aNewName.ToCString()) ;
+ strcpy(new_str , aNewName.c_str()) ;
return new_str;
}
char* restoreName(char* name)
{
- TCollection_AsciiString aName(name), aNewName;
- Standard_Integer i, length = aName.Length();
+ string aName(name), aNewName;
+ int i, length = aName.size();
char replace = (char)19;
- for(i=1; i<=length; i++) {
- if(aName.Value(i) == replace) aNewName+=' ';
- else aNewName += aName.Value(i);
+ for(i=0; i<length; i++) {
+ if(aName[i] == replace) aNewName+=' ';
+ else aNewName += aName[i];
}
- length = strlen(aNewName.ToCString());
+ length = strlen(aNewName.c_str());
char *new_str = new char[ 1+length ];
- strcpy(new_str , aNewName.ToCString()) ;
+ strcpy(new_str , aNewName.c_str()) ;
return new_str;
}
array[i] = (unsigned char)tmp;
}
}
+
+bool Exists(const string thePath)
+{
+#ifdef WNT
+ 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;
+}
+
+void Move(const string& fName, const string& fNameDst)
+{
+#ifdef WNT
+ MoveFileEx (fName.c_str(), fNameDst.c_str(),MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED);
+#else
+ rename(fName.c_str(), fNameDst.c_str());
+#endif
+}
+
#ifndef __HDFascii_H__
#define __HDFascii_H__
-#include <Standard_Macro.hxx>
+#include "HDFexport.hxx"
-class Standard_EXPORT HDFascii
+class HDF_EXPORT HDFascii
{
public:
}
#include "HDFcontainerObject.hxx"
#include "HDFexception.hxx"
-#include "utilities.h"
+//#include "utilities.h"
using namespace std;
-HDFcontainerObject::HDFcontainerObject(char *name)
+HDFcontainerObject::HDFcontainerObject(const char *name)
: HDFinternalObject(name)
{
_nsons = 0;
}
#include "HDFobject.hxx"
#include "HDFinternalObject.hxx"
-#include <Standard_Macro.hxx>
+#include "HDFexport.hxx"
-class Standard_EXPORT HDFcontainerObject : public HDFinternalObject
+class HDF_EXPORT HDFcontainerObject : public HDFinternalObject
{
private :
HDFinternalObject *_firstson;
HDFinternalObject *_lastson;
int _nsons;
public :
- HDFcontainerObject(char *name);
+ HDFcontainerObject(const char *name);
virtual ~HDFcontainerObject();
virtual int nInternalObjects();
return 1;
}
-HDFdataset::HDFdataset(char *name, HDFcontainerObject *father,hdf_type type,
+HDFdataset::HDFdataset(const char *name, HDFcontainerObject *father,hdf_type type,
hdf_size dim[], int dimsize, hdf_byte_order order)
: HDFinternalObject(name)
{
}
-HDFdataset::HDFdataset(char *name,HDFcontainerObject *father)
+HDFdataset::HDFdataset(const char *name,HDFcontainerObject *father)
: HDFinternalObject(name)
{
_father = father;
}
#include "HDFinternalObject.hxx"
#include "HDFcontainerObject.hxx"
-#include <Standard_Macro.hxx>
+#include "HDFexport.hxx"
-class Standard_EXPORT HDFdataset : public HDFinternalObject
+class HDF_EXPORT HDFdataset : public HDFinternalObject
{
private :
HDFcontainerObject *_father;
char* _attribute;
public:
- HDFdataset(char *name, HDFcontainerObject *father,hdf_type type,
+ HDFdataset(const char *name, HDFcontainerObject *father,hdf_type type,
hdf_size dim[],int dimsize, hdf_byte_order order = H5T_ORDER_NONE);
- HDFdataset(char *name,HDFcontainerObject *father);
+ HDFdataset(const char *name,HDFcontainerObject *father);
virtual ~HDFdataset();
void CreateOnDisk();
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : HDFexport.hxx
+// Author : Andre Ribes - EDF R&D
+// Module : SALOME
+
+#ifndef _HDF_export_HXX_
+#define _HDF_export_HXX_
+
+#ifdef WNT
+ #if defined WIN32
+ #define HDF_EXPORT __declspec( dllimport )
+ #else
+ #define HDF_EXPORT
+ #endif
+#else
+ #define HDF_EXPORT
+#endif
+
+#endif
#include "HDFtypes.h"
}
#include "HDFcontainerObject.hxx"
-#include <Standard_Macro.hxx>
+#include "HDFexport.hxx"
-class Standard_EXPORT HDFfile : public HDFcontainerObject
+class HDF_EXPORT HDFfile : public HDFcontainerObject
{
private :
hdf_access_mode _access_mode;
return 1;
}
-HDFgroup::HDFgroup(char *name, HDFcontainerObject *father)
+HDFgroup::HDFgroup(const char *name, HDFcontainerObject *father)
: HDFcontainerObject(name)
{
_father = father;
#include "HDFtypes.h"
}
#include "HDFcontainerObject.hxx"
-#include <Standard_Macro.hxx>
+#include "HDFexport.hxx"
-class Standard_EXPORT HDFgroup : public HDFcontainerObject
+class HDF_EXPORT HDFgroup : public HDFcontainerObject
{
private :
HDFcontainerObject *_father;
hdf_idt _mid;
char* _attribute;
public :
- HDFgroup(char *name, HDFcontainerObject *father);
+ HDFgroup(const char *name, HDFcontainerObject *father);
void CreateOnDisk();
void OpenOnDisk();
using namespace std;
#endif
-HDFinternalObject::HDFinternalObject(char *name)
+HDFinternalObject::HDFinternalObject(const char *name)
: HDFobject(name)
{
_previousbrother = NULL;
#include "HDFtypes.h"
}
#include "HDFobject.hxx"
-#include <Standard_Macro.hxx>
+#include "HDFexport.hxx"
-class Standard_EXPORT HDFinternalObject : public HDFobject
+class HDF_EXPORT HDFinternalObject : public HDFobject
{
private :
HDFinternalObject *_previousbrother;
HDFinternalObject *_nextbrother;
public :
- HDFinternalObject(char *name);
+ HDFinternalObject(const char *name);
HDFinternalObject *GetPreviousBrother();
HDFinternalObject *GetNextBrother();
#include "hdfi.h"
#include <string.h>
}
-#include "utilities.h"
+//#include "utilities.h"
using namespace std;
-HDFobject::HDFobject(char *name)
+HDFobject::HDFobject(const char *name)
{
// MESSAGE("-------- constructor " << name << " " << this);
HDFerrorModeLock();
{
#include "HDFtypes.h"
}
-#include <Standard_Macro.hxx>
+#include <HDFexport.hxx>
-class Standard_EXPORT HDFobject {
+class HDF_EXPORT HDFobject {
protected :
char *_name;
hdf_idt _id;
public :
- HDFobject(char *name);
+ HDFobject(const char *name);
virtual ~HDFobject();
hdf_idt GetId();
HDFtypes.h \
HDFconvert.hxx \
hdfi.h \
- HDFascii.hxx
+ HDFascii.hxx \
+ HDFexport.hxx
# Libraries targets
lib_LTLIBRARIES = libSalomeHDFPersist.la
HDFascii.cc
libSalomeHDFPersist_la_LDFLAGS = -no-undefined -version-info=0:0:0
-libSalomeHDFPersist_la_CPPFLAGS = @CAS_CPPFLAGS@ @HDF5_INCLUDES@ -DPCLINUX \
+
+libSalomeHDFPersist_la_CPPFLAGS = @HDF5_INCLUDES@ -DPCLINUX \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Basics
-libSalomeHDFPersist_la_LIBADD = @CAS_KERNEL@ @HDF5_LIBS@
+libSalomeHDFPersist_la_LIBADD = @HDF5_LIBS@
EXTRA_DIST = \
test1.c \
module salome gives access to Salome ressources:
variables:
- salome:orb : CORBA
+ salome.orb : CORBA
salome.naming_service : instance of naming Service class
methods:
Resolve(name) : find a CORBA object (ior) by its pathname
-help = SalomeDoc('''
+Help = SalomeDoc('''
Availables modules:
salome : gives access to Salome ressources
geompy : encapsulation of GEOM Engine methods
supervision : gives access to SuperVision Engine
-To obtain specific help on a module "truc", type: help.truc()
+To obtain specific help on a module "truc", type: Help.truc()
To run an example, type: import example3
''')
# File : batchmode_salome.py
# Module : SALOME
-import salome_shared_modules
+#import salome_shared_modules
from omniORB import CORBA
from LifeCycleCORBA import *
# Author : Paul RASCLE, EDF
# Module : SALOME
# $Header$
+"""
+Module salome gives access to Salome ressources.
+
+variables:
+
+ salome.orb : CORBA
+ salome.naming_service : instance of naming Service class
+ methods:
+ Resolve(name) : find a CORBA object (ior) by its pathname
+ Register(name) : register a CORBA object under a pathname
+ salome.lcc : instance of lifeCycleCORBA class
+ methods:
+ FindOrLoadComponent(server,name) :
+ obtain an Engine (CORBA object)
+ or launch the Engine if not found,
+ with a Server name and an Engine name
+ salome.sg
+ methods:
+ updateObjBrowser(bool):
+ getActiveStudyId():
+ getActiveStudyName():
+
+ SelectedCount(): returns number of selected objects
+ getSelected(i): returns entry of selected object number i
+ getAllSelected(): returns list of entry of selected objects
+ AddIObject(Entry): select an existing Interactive object
+ RemoveIObject(Entry): remove object from selection
+ ClearIObjects(): clear selection
+
+ Display(*Entry):
+ DisplayOnly(Entry):
+ Erase(Entry):
+ DisplayAll():
+ EraseAll():
+
+ IDToObject(Entry): returns CORBA reference from entry
+
+ salome.myStudyName : active Study Name
+ salome.myStudyId : active Study Id
+ salome.myStudy : the active Study itself (CORBA ior)
+ methods : defined in SALOMEDS.idl
+
+"""
from salome_kernel import *
from salome_study import *
from salome_iapp import *
+orb, lcc, naming_service, cm,sg=None,None,None,None,None
+myStudyManager, myStudyId, myStudy, myStudyName=None,None,None,None
+
salome_initial=1
def salome_init(theStudyId=0,embedded=0):
"""
============================================
"""
raise
+
+#to expose all objects to pydoc
+__all__=dir()
salome_iapp_initial = 1
-class SalomeOutsideGUI:
+class SalomeOutsideGUI(object):
"""
Provides a replacement for class SalomeGUI outside GUI process.
Do almost nothing
#--------------------------------------------------------------------------
def DumpStudy(Study):
+ """
+ Dump a study, given the ior
+ """
itcomp = Study.NewComponentIterator()
while itcomp.More():
SC = itcomp.Value()
--- /dev/null
+# SALOME Container : implementation of container and engine for Kernel
+#
+# 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 : Makefile.am
+# Author : Guillaume Boulant (CSSI)
+# Module : KERNEL
+# $Header$
+
+
+include $(top_srcdir)/salome_adm/unix/make_common_starter.am
+
+#
+# ===============================================================
+# Header to be installed
+# ===============================================================
+#
+# header files
+salomeinclude_HEADERS = \
+ SALOME_Launcher.hxx
+
+# Scripts to be installed
+dist_salomescript_DATA =
+
+# These files are executable scripts
+dist_salomescript_SCRIPTS=
+
+#
+# ===============================================================
+# Local definitions
+# ===============================================================
+#
+
+# This local variable defines the list of CPPFLAGS common to all target in this package.
+COMMON_CPPFLAGS=\
+ @PYTHON_INCLUDES@ \
+ @MPI_INCLUDES@ \
+ @LIBXML_INCLUDES@ \
+ -I$(srcdir)/../Batch \
+ -I$(srcdir)/../Basics \
+ -I$(srcdir)/../SALOMELocalTrace \
+ -I$(srcdir)/../NamingService \
+ -I$(srcdir)/../Utils \
+ -I$(srcdir)/../Registry \
+ -I$(srcdir)/../Notification \
+ -I$(srcdir)/../ResourcesManager \
+ -I$(srcdir)/../Container \
+ -I$(top_builddir)/salome_adm/unix \
+ -I$(top_builddir)/idl \
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+
+# This local variable defines the list of dependant libraries common to all target in this package.
+COMMON_LIBS =\
+ ../Registry/libRegistry.la \
+ ../Notification/libSalomeNotification.la \
+ ../Container/libSalomeContainer.la \
+ ../ResourcesManager/libSalomeResourcesManager.la \
+ ../NamingService/libSalomeNS.la \
+ ../Utils/libOpUtil.la \
+ ../SALOMELocalTrace/libSALOMELocalTrace.la \
+ ../Basics/libSALOMEBasics.la \
+ ../Batch/libSalomeBatch.la \
+ $(top_builddir)/idl/libSalomeIDLKernel.la\
+ @MPI_LIBS@ \
+ @CORBA_LIBS@
+ @LIBXML_LIBS@
+
+# @PYTHON_LIBS@
+
+#
+# ===============================================================
+# Libraries targets
+# ===============================================================
+#
+lib_LTLIBRARIES = libSalomeLauncher.la
+libSalomeLauncher_la_SOURCES=\
+ SALOME_Launcher.cxx
+
+libSalomeLauncher_la_CPPFLAGS =\
+ $(COMMON_CPPFLAGS)
+
+libSalomeLauncher_la_LDFLAGS =\
+ -no-undefined -version-info=0:0:0 \
+ @LDEXPDYNFLAGS@
+
+libSalomeLauncher_la_LIBADD =\
+ $(PYTHON_LIBS) \
+ $(COMMON_LIBS)
+
+
+#
+# ===============================================================
+# Executables targets
+# ===============================================================
+#
+bin_PROGRAMS = SALOME_LauncherServer
+
+SALOME_LauncherServer_SOURCES =\
+ SALOME_LauncherServer.cxx
+
+SALOME_LauncherServer_CPPFLAGS=\
+ $(COMMON_CPPFLAGS)
+
+SALOME_LauncherServer_LDADD =\
+ libSalomeLauncher.la \
+ $(COMMON_LIBS) \
+ ../Basics/libSALOMEBasics.la \
+ ../Batch/libSalomeBatch.la
+
+
--- /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
+//
+#include "BatchLight_BatchManager_PBS.hxx"
+#include "BatchLight_BatchManager_SLURM.hxx"
+#include "BatchLight_Job.hxx"
+#include "SALOME_Launcher.hxx"
+#include "OpUtil.hxx"
+#include <sys/types.h>
+#ifndef WNT
+#include <unistd.h>
+#endif
+#include <vector>
+#include "Utils_CorbaException.hxx"
+#include "Batch_Date.hxx"
+
+#define TIME_OUT_TO_LAUNCH_CONT 21
+
+using namespace std;
+
+const char *SALOME_Launcher::_LauncherNameInNS = "/SalomeLauncher";
+
+//=============================================================================
+/*!
+ * Constructor
+ * \param orb
+ * Define a CORBA single thread policy for the server, which avoid to deal
+ * with non thread-safe usage like Change_Directory in SALOME naming service
+ */
+//=============================================================================
+
+SALOME_Launcher::SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa)
+{
+ MESSAGE("constructor");
+ _NS = new SALOME_NamingService(orb);
+ _ResManager = new SALOME_ResourcesManager(orb,poa,_NS);
+ _ContManager = new SALOME_ContainerManager(orb,poa,_ResManager,_NS);
+ _ResManager->_remove_ref();
+ _ContManager->_remove_ref();
+
+ _orb = CORBA::ORB::_duplicate(orb) ;
+ _poa = PortableServer::POA::_duplicate(poa) ;
+ PortableServer::ObjectId_var id = _poa->activate_object(this);
+ CORBA::Object_var obj = _poa->id_to_reference(id);
+ Engines::SalomeLauncher_var refContMan = Engines::SalomeLauncher::_narrow(obj);
+
+ _NS->Register(refContMan,_LauncherNameInNS);
+ MESSAGE("constructor end");
+}
+
+//=============================================================================
+/*!
+ * destructor
+ */
+//=============================================================================
+
+SALOME_Launcher::~SALOME_Launcher()
+{
+ MESSAGE("destructor");
+ delete _NS;
+ std::map < string, BatchLight::BatchManager * >::const_iterator it;
+ for(it=_batchmap.begin();it!=_batchmap.end();it++)
+ delete it->second;
+}
+
+//=============================================================================
+/*! CORBA method:
+ * shutdown all the containers, then the ContainerManager servant
+ */
+//=============================================================================
+
+void SALOME_Launcher::Shutdown()
+{
+ MESSAGE("Shutdown");
+ _NS->Destroy_Name(_LauncherNameInNS);
+ _ContManager->Shutdown();
+ _ResManager->Shutdown();
+ PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
+ _poa->deactivate_object(oid);
+ //_remove_ref();
+ if(!CORBA::is_nil(_orb))
+ _orb->shutdown(0);
+}
+
+//=============================================================================
+/*! CORBA Method:
+ * Returns the PID of the process
+ */
+//=============================================================================
+CORBA::Long SALOME_Launcher::getPID()
+{
+ return (CORBA::Long)getpid();
+}
+
+//=============================================================================
+/*! CORBA Method:
+ * Submit a batch job on a cluster and returns the JobId
+ * \param fileToExecute : .py/.exe/.sh/... to execute on the batch cluster
+ * \param filesToExport : to export on the batch cluster
+ * \param NumberOfProcessors : Number of processors needed on the batch cluster
+ * \param params : Constraints for the choice of the batch cluster
+ */
+//=============================================================================
+CORBA::Long SALOME_Launcher::submitSalomeJob( const char * fileToExecute ,
+ const Engines::FilesList& filesToExport ,
+ const Engines::FilesList& filesToImport ,
+ const CORBA::Long NumberOfProcessors ,
+ const Engines::MachineParameters& params)
+{
+ MESSAGE("BEGIN OF SALOME_Launcher::submitSalomeJob");
+ CORBA::Long jobId;
+ try{
+ // find a cluster matching the structure params
+ Engines::CompoList aCompoList ;
+ Engines::MachineList *aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ;
+ const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]);
+ string clustername(p->alias);
+
+ // search batch manager for that cluster in map or instanciate one
+ std::map < string, BatchLight::BatchManager * >::const_iterator it = _batchmap.find(clustername);
+ SCRUTE(clustername);
+ if(it == _batchmap.end())
+ _batchmap[clustername] = FactoryBatchManager( p );
+
+ // submit job on cluster
+ BatchLight::Job* job = new BatchLight::Job( fileToExecute, filesToExport, filesToImport, NumberOfProcessors );
+ jobId = _batchmap[clustername]->submitJob(job);
+ }
+ catch(const SALOME_Exception &ex){
+ MESSAGE(ex.what());
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
+ }
+ return jobId;
+}
+
+//=============================================================================
+/*! CORBA Method:
+ * Query a batch job on a cluster and returns the status of job
+ * \param jobId : identification of Salome job
+ * \param params : Constraints for the choice of the batch cluster
+ */
+//=============================================================================
+char* SALOME_Launcher::querySalomeJob( const CORBA::Long jobId,
+ const Engines::MachineParameters& params)
+{
+ string status;
+ try{
+ // find a cluster matching params structure
+ Engines::CompoList aCompoList ;
+ Engines::MachineList * aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ;
+ const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]);
+ string clustername(p->alias);
+
+ // search batch manager for that cluster in map
+ std::map < string, BatchLight::BatchManager * >::const_iterator it = _batchmap.find(clustername);
+ if(it == _batchmap.end())
+ throw SALOME_Exception("no batchmanager for that cluster");
+
+ status = _batchmap[clustername]->queryJob(jobId);
+ }
+ catch(const SALOME_Exception &ex){
+ INFOS("Caught exception.");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::BAD_PARAM);
+ }
+ return CORBA::string_dup(status.c_str());
+}
+
+//=============================================================================
+/*! CORBA Method:
+ * Delete a batch job on a cluster
+ * \param jobId : identification of Salome job
+ * \param params : Constraints for the choice of the batch cluster
+ */
+//=============================================================================
+void SALOME_Launcher::deleteSalomeJob( const CORBA::Long jobId,
+ const Engines::MachineParameters& params)
+{
+ try{
+ // find a cluster matching params structure
+ Engines::CompoList aCompoList ;
+ Engines::MachineList *aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ;
+ const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]);
+ string clustername(p->alias);
+
+ // search batch manager for that cluster in map
+ std::map < string, BatchLight::BatchManager * >::const_iterator it = _batchmap.find(clustername);
+ if(it == _batchmap.end())
+ throw SALOME_Exception("no batchmanager for that cluster");
+
+ _batchmap[clustername]->deleteJob(jobId);
+ }
+ catch(const SALOME_Exception &ex){
+ INFOS("Caught exception.");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::BAD_PARAM);
+ }
+}
+
+//=============================================================================
+/*! CORBA Method:
+ * Get result files of job on a cluster
+ * \param jobId : identification of Salome job
+ * \param params : Constraints for the choice of the batch cluster
+ */
+//=============================================================================
+void SALOME_Launcher::getResultSalomeJob( const char *directory,
+ const CORBA::Long jobId,
+ const Engines::MachineParameters& params)
+{
+ try{
+ // find a cluster matching params structure
+ Engines::CompoList aCompoList ;
+ Engines::MachineList *aMachineList = _ResManager->GetFittingResources( params , aCompoList ) ;
+ const Engines::MachineParameters* p = _ResManager->GetMachineParameters((*aMachineList)[0]);
+ string clustername(p->alias);
+
+ // search batch manager for that cluster in map
+ std::map < string, BatchLight::BatchManager * >::const_iterator it = _batchmap.find(clustername);
+ if(it == _batchmap.end())
+ throw SALOME_Exception("no batchmanager for that cluster");
+
+ _batchmap[clustername]->importOutputFiles( directory, jobId );
+ }
+ catch(const SALOME_Exception &ex){
+ INFOS("Caught exception.");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::BAD_PARAM);
+ }
+}
+
+//=============================================================================
+/*!
+ * Factory to instanciate the good batch manager for choosen cluster.
+ */
+//=============================================================================
+
+BatchLight::BatchManager *SALOME_Launcher::FactoryBatchManager( const Engines::MachineParameters* params ) throw(SALOME_Exception)
+{
+ // Fill structure for batch manager
+ BatchLight::batchParams p;
+ p.hostname = params->alias;
+ p.protocol = params->protocol;
+ p.username = params->username;
+ p.applipath = params->applipath;
+ for(int i=0;i<params->modList.length();i++)
+ p.modulesList.push_back((const char*)params->modList[i]);
+ p.nbnodes = params->nb_node;
+ p.nbprocpernode = params->nb_proc_per_node;
+ p.mpiImpl = params->mpiImpl;
+
+ string sb = (const char*)params->batch;
+ if(sb == "pbs")
+ return new BatchLight::BatchManager_PBS(p);
+ else if(sb == "slurm")
+ return new BatchLight::BatchManager_SLURM(p);
+ else{
+ MESSAGE("BATCH = " << params->batch);
+ throw SALOME_Exception("no batchmanager for that cluster");
+ }
+}
+
--- /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_HXX__
+#define __SALOME_LAUNCHER_HXX__
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
+#include "SALOME_ContainerManager.hxx"
+#include "BatchLight_BatchManager.hxx"
+
+#include <string>
+
+class SALOME_NamingService;
+
+#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:
+ public POA_Engines::SalomeLauncher,
+ public PortableServer::RefCountServantBase
+{
+
+public:
+ SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa);
+ ~SALOME_Launcher();
+
+ CORBA::Long submitSalomeJob(const char * fileToExecute ,
+ const Engines::FilesList& filesToExport ,
+ const Engines::FilesList& filesToImport ,
+ const CORBA::Long NumberOfProcessors ,
+ 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 );
+
+ void Shutdown();
+
+ CORBA::Long getPID();
+
+ static const char *_LauncherNameInNS;
+
+protected:
+ BatchLight::BatchManager *FactoryBatchManager( const Engines::MachineParameters* params ) throw(SALOME_Exception);
+
+ std::map <std::string,BatchLight::BatchManager*> _batchmap;
+ CORBA::ORB_var _orb;
+ PortableServer::POA_var _poa;
+ SALOME_ContainerManager *_ContManager;
+ SALOME_ResourcesManager *_ResManager;
+ SALOME_NamingService *_NS;
+};
+
+#endif
--- /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
+//
+#include "SALOME_Launcher.hxx"
+#include "utilities.h"
+#include <sstream>
+#include <iostream>
+#include <stdexcept>
+#include <libxml/parser.h>
+
+using namespace std;
+
+void AttachDebugger()
+{
+ if(getenv ("DEBUGGER"))
+ {
+ std::stringstream exec;
+ exec << "$DEBUGGER SALOME_LauncherServer " << getpid() << "&";
+ std::cerr << exec.str() << std::endl;
+ system(exec.str().c_str());
+ while(1);
+ }
+}
+
+void terminateHandler(void)
+{
+ std::cerr << "Terminate: not managed exception !" << std::endl;
+ AttachDebugger();
+}
+
+void unexpectedHandler(void)
+{
+ std::cerr << "Unexpected: unexpected exception !" << std::endl;
+ AttachDebugger();
+}
+
+
+int main(int argc, char* argv[])
+{
+ if(getenv ("DEBUGGER"))
+ {
+// setsig(SIGSEGV,&Handler);
+ set_terminate(&terminateHandler);
+ set_unexpected(&unexpectedHandler);
+ }
+ /* Init libxml
+ * To avoid memory leak, need to call xmlInitParser in the main thread
+ * and not call xmlCleanupParser later (cause implicit reinitialization in thread)
+ */
+ xmlInitParser();
+
+ PortableServer::POA_var root_poa;
+ PortableServer::POAManager_var pman;
+ CORBA::Object_var obj;
+
+ CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ INFOS_COMPILATION;
+ BEGIN_OF(argv[0]);
+ try{
+ obj = orb->resolve_initial_references("RootPOA");
+ if(!CORBA::is_nil(obj))
+ root_poa = PortableServer::POA::_narrow(obj);
+ if(!CORBA::is_nil(root_poa))
+ pman = root_poa->the_POAManager();
+ }
+ catch(CORBA::COMM_FAILURE&){
+ MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+ }
+ try{
+ SALOME_Launcher *lServ=new SALOME_Launcher(orb,root_poa);
+ pman->activate();
+ lServ->_remove_ref();
+ orb->run();
+ orb->destroy();
+ }catch(CORBA::SystemException&){
+ MESSAGE("Caught CORBA::SystemException.");
+ }catch(PortableServer::POA::WrongPolicy&){
+ MESSAGE("Caught CORBA::WrongPolicyException.");
+ }catch(PortableServer::POA::ServantAlreadyActive&){
+ MESSAGE("Caught CORBA::ServantAlreadyActiveException");
+ }catch(CORBA::Exception&){
+ MESSAGE("Caught CORBA::Exception.");
+ }catch(std::exception& exc){
+ MESSAGE("Caught std::exception - "<<exc.what());
+ }catch(...){
+ MESSAGE("Caught unknown exception.");
+ }
+ END_OF(argv[0]);
+ // delete myThreadTrace;
+}
+
-I$(srcdir)/../SALOMETraceCollector \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Utils \
+ -I$(srcdir)/../Container \
-I$(srcdir)/../ResourcesManager \
-I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
- @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
libSalomeLifeCycleCORBA_la_CPPFLAGS = \
$(COMMON_CPPFLAGS) \
@PYTHON_INCLUDES@ \
- @QT_INCLUDES@ \
+ -I$(srcdir)/../Batch \
-I$(srcdir)/../Container \
-I$(srcdir)/../Notification
# Executables targets
# ===============================================================
#
-bin_PROGRAMS = Test_LifeCycleCORBA
+bin_PROGRAMS = Test_LifeCycleCORBA TestContainerManager
Test_LifeCycleCORBA_SOURCES = Test_LifeCycleCORBA.cxx
Test_LifeCycleCORBA_CPPFLAGS =\
-I$(srcdir)/../Registry \
$(COMMON_LIBS) \
@CORBA_LIBS@
-#CPPFLAGS += $(PYTHON_INCLUDES) $(QT_INCLUDES)
+TestContainerManager_SOURCES = TestContainerManager.cxx
+TestContainerManager_CPPFLAGS =\
+ -I$(srcdir)/../Batch \
+ -I$(srcdir)/../Registry \
+ -I$(srcdir)/../Notification \
+ $(COMMON_CPPFLAGS)
+
+TestContainerManager_LDADD = \
+ libSalomeLifeCycleCORBA.la \
+ ../Registry/libRegistry.la \
+ ../Notification/libSalomeNotification.la \
+ ../Container/libSalomeContainer.la \
+ $(COMMON_LIBS) \
+ @CORBA_LIBS@
-#LDFLAGS += -lSalomeNS -lOpUtil -lSALOMELocalTrace -lSalomeContainer -lSalomeResourcesManager
-#LDFLAGSFORBIN= $(LDFLAGS) -lRegistry -lSalomeNotification -lSALOMEBasics
-#LIBS += $(PYTHON_LIBS)
SALOME_LifeCycleCORBA LCC;
Engines::ContainerManager_var contManager = LCC.getContainerManager();
+ Engines::ResourcesManager_var resManager = LCC.getResourcesManager();
Engines::MachineParameters params;
LCC.preSet(params);
params.container_name = _containerName.c_str();
params.hostname = _refMachine.c_str();
+ Engines::CompoList clist;
Engines::MachineList_var listOfMachines =
- contManager->GetFittingResources(params, "");
+ resManager->GetFittingResources(params, clist);
container = contManager->FindOrStartContainer(params,
listOfMachines);
_NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
ASSERT( !CORBA::is_nil(obj));
_ContManager=Engines::ContainerManager::_narrow(obj);
+
+ obj = _NS->Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS);
+ ASSERT( !CORBA::is_nil(obj));
+ _ResManager=Engines::ResourcesManager::_narrow(obj);
}
//=============================================================================
if (! isKnownComponentClass(componentName))
return Engines::Component::_nil();
+ Engines::CompoList clist;
+ clist.length(1);
+ clist[0] = componentName;
Engines::MachineList_var listOfMachines =
- _ContManager->GetFittingResources(params, componentName);
+ _ResManager->GetFittingResources(params, clist);
Engines::Component_var compo = _FindComponent(params,
componentName,
if (! isKnownComponentClass(componentName))
return Engines::Component::_nil();
+ Engines::CompoList clist;
+ clist.length(1);
+ clist[0] = componentName;
Engines::MachineList_var listOfMachines =
- _ContManager->GetFittingResources(params, componentName);
+ _ResManager->GetFittingResources(params, clist);
Engines::Component_var compo = _LoadComponent(params,
componentName,
if (! isKnownComponentClass(componentName))
return Engines::Component::_nil();
+ Engines::CompoList clist;
+ clist.length(1);
+ clist[0] = componentName;
Engines::MachineList_var listOfMachines =
- _ContManager->GetFittingResources(params,componentName);
+ _ResManager->GetFittingResources(params,clist);
Engines::Component_var compo = _FindComponent(params,
componentName,
SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName,
const char *componentName)
{
+ char *valenv=getenv("SALOME_BATCH");
+ if(valenv)
+ if (strcmp(valenv,"1")==0)
+ {
+ MESSAGE("SALOME_LifeCycleCORBA::FindOrLoad_Component BATCH " << containerName << " " << componentName ) ;
+ _NS->Change_Directory("/Containers");
+ CORBA::Object_ptr obj=_NS->Resolve(containerName);
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ bool isLoadable = cont->load_component_Library(componentName);
+ if (!isLoadable) return Engines::Component::_nil();
+
+ Engines::Component_ptr myInstance =
+ cont->create_component_instance(componentName, 0);
+ return myInstance;
+ }
+ MESSAGE("SALOME_LifeCycleCORBA::FindOrLoad_Component INTERACTIF " << containerName << " " << componentName ) ;
+ //#if 0
// --- Check if Component Name is known in ModuleCatalog
if (! isKnownComponentClass(componentName))
// SCRUTE(params->isMPI);
free(stContainer);
return FindOrLoad_Component(params,componentName);
-
+ //#endif
}
//=============================================================================
SALOME_ModuleCatalog::ModuleCatalog_var Catalog =
SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ;
ASSERT(! CORBA::is_nil(Catalog));
- SALOME_ModuleCatalog::Acomponent_ptr compoInfo =
+ SALOME_ModuleCatalog::Acomponent_var compoInfo =
Catalog->GetComponent(componentName);
if (CORBA::is_nil (compoInfo))
{
params.nb_proc_per_node = 0;
params.nb_node = 0;
params.isMPI = false;
+
+ params.parallelLib = "";
+ params.nb_component_nodes = 0;
}
//=============================================================================
return contManager._retn();
}
+//=============================================================================
+/*! Public -
+ * \return the container Manager
+ */
+//=============================================================================
+
+Engines::ResourcesManager_ptr SALOME_LifeCycleCORBA::getResourcesManager()
+{
+ Engines::ResourcesManager_var resManager =
+ Engines::ResourcesManager::_duplicate(_ResManager);
+ return resManager._retn();
+}
+
//=============================================================================
/*! Protected -
if(lghtOfmachinesOK != 0)
{
machinesOK->length(lghtOfmachinesOK);
- CORBA::String_var bestMachine = _ContManager->FindFirst(machinesOK);
+ CORBA::String_var bestMachine = _ResManager->FindFirst(machinesOK);
CORBA::Object_var obj = _NS->ResolveComponent(bestMachine,
containerName,
componentName,
int studyId,
const Engines::MachineList& listOfMachines)
{
- const char *containerName = params.container_name;
- int nbproc = NbProc(params);
-
- MESSAGE("_LoadComponent, required " << containerName <<
- " " << componentName << " " << nbproc);
+ MESSAGE("_LoadComponent, required " << params.container_name <<
+ " " << componentName << " " << NbProc(params));
Engines::Container_var cont =
_ContManager->FindOrStartContainer(params,
MESSAGE("Number of component nodes : " << params.nb_component_nodes);
MESSAGE("Component Name : " << componentName);*/
+ Engines::CompoList clist;
+ clist.length(1);
+ clist[0] = componentName;
MESSAGE("Building a list of machines");
- Engines::MachineList_var listOfMachines = _ContManager->GetFittingResources(params, componentName);
+ Engines::MachineList_var listOfMachines = _ResManager->GetFittingResources(params, clist);
if (listOfMachines->length() == 0)
{
INFOS("No matching machines founded !");
void preSet(Engines::MachineParameters& params);
Engines::ContainerManager_ptr getContainerManager();
+ Engines::ResourcesManager_ptr getResourcesManager();
protected:
SALOME_NamingService *_NS;
Engines::ContainerManager_var _ContManager;
+ Engines::ResourcesManager_var _ResManager;
} ;
{
SALOME_LifeCycleCORBA _LCC(&_NS);
- CORBA::Object_var obj = _NS.Resolve("/ContainerManager");
+ CORBA::Object_var obj = _NS.Resolve("/ResourcesManager");
CPPUNIT_ASSERT(!CORBA::is_nil(obj));
- Engines::ContainerManager_var containerManager =
- Engines::ContainerManager::_narrow(obj);
- CPPUNIT_ASSERT(!CORBA::is_nil(containerManager));
+ Engines::ResourcesManager_var resourcesManager =
+ Engines::ResourcesManager::_narrow(obj);
+ CPPUNIT_ASSERT(!CORBA::is_nil(resourcesManager));
Engines::MachineParameters params;
_LCC.preSet(params); // empty params to get all the machines
+ Engines::CompoList clist;
+ clist.length(1);
+ clist[0] = "SalomeTestComponent";
Engines::MachineList_var hostList =
- containerManager->GetFittingResources(params,"SalomeTestComponent");
+ resourcesManager->GetFittingResources(params,clist);
CPPUNIT_ASSERT(hostList->length() > 1);
string localHost = GetHostname();
import sys, os,signal,string,commands
import runSalome
+import setenv
import orbmodule
import TestKiller
import addToKillList
# get SALOME environment :
-args, modules_list, modules_root_dir = runSalome.get_config()
-runSalome.set_env(args, modules_list, modules_root_dir)
+args, modules_list, modules_root_dir = setenv.get_config()
+setenv.set_env(args, modules_list, modules_root_dir)
# set environment for trace in logger
# (with file, servers may be killed before the write to the file...)
cataServer.run()
clt.waitNS("/Kernel/ModulCatalog")
-# launch container manager server
+# launch launcher server
-myCmServer = runSalome.ContainerManagerServer(args)
+myCmServer = runSalome.LauncherServer(args)
myCmServer.setpath(modules_list,modules_root_dir)
myCmServer.run()
-clt.waitNS("/ContainerManager")
+clt.waitNS("/SalomeLauncher")
# execute Unit Test
# kill containers created by the Container Manager
import Engines
-containerManager = clt.waitNS("/ContainerManager",Engines.ContainerManager)
-containerManager.Shutdown()
+launcher = clt.waitNS("/SalomeLauncher",Engines.SalomeLauncher)
+launcher.Shutdown()
# kill Test process
--- /dev/null
+// SALOME TestContainer : test of container creation and its life cycle
+//
+// 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 : TestContainer.cxx
+// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
+// Module : SALOME
+// $Header$
+
+#include "utilities.h"
+#include <iostream>
+#include <unistd.h>
+#include <SALOMEconfig.h>
+#include "SALOME_NamingService.hxx"
+#include "SALOME_ContainerManager.hxx"
+#include "SALOME_LifeCycleCORBA.hxx"
+#include "NamingService_WaitForServerReadiness.hxx"
+#include "OpUtil.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "Utils_SALOME_Exception.hxx"
+#include "Utils_CommException.hxx"
+using namespace std;
+
+int main (int argc, char * argv[])
+{
+ map<string, int> cycle;
+ map<string, int> first;
+ Engines::Container_ptr cont;
+ Engines::Component_ptr compo;
+ bool error = false;
+ bool bestImplemented;
+ int status;
+
+ // Initializing omniORB
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ CORBA::ORB_ptr orb = init( argc , argv ) ;
+
+ SALOME_NamingService *_NS=new SALOME_NamingService(orb);
+
+ CORBA::Object_var obj = _NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
+ ASSERT( !CORBA::is_nil(obj));
+ Engines::ContainerManager_var _ContManager=Engines::ContainerManager::_narrow(obj);
+ obj = _NS->Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS);
+ ASSERT( !CORBA::is_nil(obj));
+ Engines::ResourcesManager_var _ResManager=Engines::ResourcesManager::_narrow(obj);
+
+ Engines::MachineParameters p;
+ Engines::CompoList clist;
+ clist.length(2);
+ clist[0] = "MED";
+ clist[1] = "GEOM";
+
+ p.hostname = "";
+ p.OS = "LINUX";
+ p.mem_mb = 1000;
+ p.cpu_clock = 1000;
+ p.nb_proc_per_node = 1;
+ p.nb_node = 1;
+ p.isMPI = false;
+
+ char st[10];
+ for(int i=0;i<10;i++){
+ sprintf(st,"cycl_%d",i);
+ p.container_name = CORBA::string_dup(st);
+ cont = _ContManager->GiveContainer(p,Engines::P_CYCL,clist);
+ if(CORBA::is_nil(cont)) error = true;
+ }
+
+ for(int i=0;i<10;i++){
+ sprintf(st,"first_%d",i);
+ p.container_name = CORBA::string_dup(st);
+ cont = _ContManager->GiveContainer(p,Engines::P_FIRST,clist);
+ if(CORBA::is_nil(cont)) error = true;
+ }
+
+ p.container_name = CORBA::string_dup("best");
+ cont = _ContManager->GiveContainer(p,Engines::P_BEST,clist);
+ if(CORBA::is_nil(cont)) bestImplemented = false;
+ else bestImplemented = true;
+
+ SALOME_LifeCycleCORBA LCC(_NS);
+ p.container_name = CORBA::string_dup("FactoryServer");
+ compo = LCC.FindOrLoad_Component(p,"SMESH");
+ if(CORBA::is_nil(compo)) error = true;
+ compo = LCC.FindOrLoad_Component(p,"SMESH");
+ if(CORBA::is_nil(compo)) error = true;
+
+ _NS->Change_Directory("/Containers");
+
+ vector<string> vec = _NS->list_directory_recurs();
+ list<string> lstCont;
+ for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++){
+ CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont)){
+ cycle[cont->getHostName()]=0;
+ first[cont->getHostName()]=0;
+ lstCont.push_back((*iter));
+ }
+ }
+ for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){
+ CORBA::Object_var obj=_NS->Resolve((*iter).c_str());
+ Engines::Container_var cont=Engines::Container::_narrow(obj);
+ if(!CORBA::is_nil(cont)){
+ if(strncmp(basename(cont->name()),"cycl",4)==0)
+ cycle[cont->getHostName()]++;
+ if(strncmp(basename(cont->name()),"first",5)==0)
+ first[cont->getHostName()]++;
+ }
+ }
+ _ContManager->ShutdownContainers();
+
+ int cmin=10;
+ int cmax=0;
+ int fmin=10;
+ int fmax=0;
+ int nbpmax;
+ for(map<string,int>::iterator iter=cycle.begin();iter!=cycle.end();iter++){
+ if(strcmp((*iter).first.c_str(),"localhost")!=0){
+ Engines::MachineParameters *p = _ResManager->GetMachineParameters((*iter).first.c_str());
+ int nbproc = p->nb_node * p->nb_proc_per_node;
+ if(cycle[(*iter).first]/nbproc<cmin) cmin=cycle[(*iter).first]/nbproc;
+ if(cycle[(*iter).first]/nbproc>cmax) cmax=cycle[(*iter).first]/nbproc;
+ if(first[(*iter).first]/nbproc<fmin) fmin=first[(*iter).first]/nbproc;
+ if(first[(*iter).first]/nbproc>fmax){
+ fmax=first[(*iter).first]/nbproc;
+ nbpmax = nbproc;
+ }
+ }
+ }
+ string msg;
+ if( ((cmax-cmin) <= 2) && (fmax == 10/nbpmax) && !error ){
+ if(bestImplemented)
+ msg = "TEST OK";
+ else
+ msg = "TEST OK but FindBest not implemented!";
+ status=0;
+ }
+ else{
+ msg ="TEST KO";
+ status=1;
+ }
+ cout << msg << endl;
+
+ return status;
+}
{
INFOS("Caught system exception COMM_FAILURE -- unable to contact the object.");
}
-#ifndef WNT
- catch(CORBA::SystemException&)
- {
- INFOS("Caught a CORBA::SystemException.");
- }
-#endif
catch(CORBA::Exception&)
{
INFOS("Caught CORBA::Exception.");
import sys, os,signal,string,commands
import runSalome
+import setenv
import orbmodule
import TestKiller
import addToKillList
# get SALOME environment :
-args, modules_list, modules_root_dir = runSalome.get_config()
-runSalome.set_env(args, modules_list, modules_root_dir)
+args, modules_list, modules_root_dir = setenv.get_config()
+setenv.set_env(args, modules_list, modules_root_dir)
# set environment for trace in logger
# (with file, servers may be killed before the write to the file...)
# launch container manager server
-myCmServer = runSalome.ContainerManagerServer(args)
+myCmServer = runSalome.LauncherServer(args)
myCmServer.setpath(modules_list,modules_root_dir)
myCmServer.run()
-clt.waitNS("/ContainerManager")
+clt.waitNS("/SalomeLauncher")
# execute Unit Test
# kill containers created by the Container Manager
import Engines
-containerManager = clt.waitNS("/ContainerManager",Engines.ContainerManager)
-containerManager.Shutdown()
+launcher = clt.waitNS("/SalomeLauncher",Engines.SalomeLauncher)
+launcher.Shutdown()
# kill Test process
SUBDIR_BASE = \
Basics \
SALOMELocalTrace \
- CASCatch \
HDFPersist
SUBDIR_CORBA = \
+ DF \
Logger \
SALOMETraceCollector \
Utils \
NOTIFICATION_SWIG \
Container \
TestContainer \
+ Launcher \
LifeCycleCORBA \
LifeCycleCORBA_SWIG \
SALOMEDSClient \
SUBDIRS = $(SUBDIR_BASE)
+if WITH_BATCH
+ SUBDIRS += $(SUBDIR_BATCH)
+endif
+
if CORBA_GEN
SUBDIRS += $(SUBDIR_CORBA)
endif
# SUBDIRS += $(SUBDIR_MPI)
#endif
-if WITH_BATCH
- SUBDIRS += $(SUBDIR_BATCH)
-endif
-
if CPPUNIT_IS_OK
if CORBA_GEN
SUBDIRS += \
-I$(srcdir)/../Utils \
-I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
- @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \
- @QT_INCLUDES@
+ @LIBXML_INCLUDES@ \
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
../Utils/libOpUtil.la \
../SALOMELocalTrace/libSALOMELocalTrace.la \
../Basics/libSALOMEBasics.la \
- $(top_builddir)/idl/libSalomeIDLKernel.la
+ $(top_builddir)/idl/libSalomeIDLKernel.la \
+ @LIBXML_LIBS@
libSalomeCatalog_la_SOURCES =\
SALOME_ModuleCatalog_Handler.cxx \
libSalomeCatalog_la_LDFLAGS = -no-undefined -version-info=0:0:0
libSalomeCatalog_la_LIBADD =\
- $(COMMON_LIBS) \
- @QT_LIBS@
+ $(COMMON_LIBS)
#
// and the pathes prefixes for all computers
//----------------------------------------------------------------------
SALOME_ModuleCatalog_AcomponentImpl::SALOME_ModuleCatalog_AcomponentImpl
-(SALOME_ModuleCatalog::Component &C) : _Component(C)
+(SALOME_ModuleCatalog::ComponentDef &C) : _Component(C)
{
if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_AcomponentImpl");
{
public:
//! standard constructor
- SALOME_ModuleCatalog_AcomponentImpl(SALOME_ModuleCatalog::Component &C);
+ SALOME_ModuleCatalog_AcomponentImpl(SALOME_ModuleCatalog::ComponentDef &C);
//! standard destructor
virtual ~SALOME_ModuleCatalog_AcomponentImpl();
private :
- SALOME_ModuleCatalog::Component _Component;
+ SALOME_ModuleCatalog::ComponentDef _Component;
//! method to duplicate an interface
/*!
void PrintComponent(SALOME_ModuleCatalog::Acomponent_ptr C)
{
- const char *_name = C->componentname();
-
MESSAGE("Name : " << C->componentname());
MESSAGE("Type : " << C->component_type() << " multistudy : " << C->multistudy());
MESSAGE("Constraint : " << C->constraint());
// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// Function : SALOME_ModuleCatalog_Handler
// Purpose : Constructor
//----------------------------------------------------------------------
-SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler()
+SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler(ParserPathPrefixes& pathList,
+ ParserComponents& moduleList,
+ ParserTypes& typeMap,
+ TypeList& typeList):_typeMap(typeMap),_typeList(typeList),
+ _pathList(pathList),_moduleList(moduleList)
+
{
if(MYDEBUG) BEGIN_OF("SALOME_ModuleCatalog_Handler");
// Used in the function endElement
test_path_prefix_name = "path-prefix-name";
test_computer_name = "computer-name" ;
+ test_computer_list = "computer-list" ;
test_path_prefix = "path-prefix" ;
+ test_path_prefix_list = "path-prefix-list" ;
test_component_name = "component-name";
test_component_username = "component-username";
test_constraint = "constraint";
+ test_component_list = "component-list";
test_component="component";
if(MYDEBUG) END_OF("SALOME_ModuleCatalog_Handler");
if(MYDEBUG) END_OF("~SALOME_ModuleCatalog_Handler()")
}
-//----------------------------------------------------------------------
-// Function : startDocument
-// Purpose : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_ModuleCatalog_Handler::startDocument()
+
+//=============================================================================
+/*!
+ * Processes XML document and fills the list of modules
+ */
+//=============================================================================
+
+void SALOME_ModuleCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
{
if(MYDEBUG) MESSAGE("Begin parse document");
// Empty the private elements
_outDataStreamParamList.resize(0);
_inParamList.resize(0);
_outParamList.resize(0);
- return true;
-}
-//----------------------------------------------------------------------
-// Function : startElement
-// Purpose : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_ModuleCatalog_Handler::startElement(const QString&,
- const QString &,
- const QString& qName,
- const QXmlAttributes& atts)
-{
- _xml_pile.push(qName);
-
- return true;
-}
-
-//----------------------------------------------------------------------
-// Function : endElement
-// Purpose : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
- const QString &,
- const QString& qName)
-{
- QString parent, grandparent;
- _xml_pile.pop();
- if (!_xml_pile.empty()) {
- parent = _xml_pile.top();
- _xml_pile.pop();
- if (!_xml_pile.empty()) grandparent = _xml_pile.top();
- _xml_pile.push(parent);
- }
-
- // Path prefix
-
- // tag test_path_prefix_name
- if((qName.compare(test_path_prefix_name)==0)) {
- _pathPrefix.path = content;
- return true;
- }
-
- // tag test_computer_name
- if((qName.compare(test_computer_name)==0)) {
- _pathPrefix.listOfComputer.push_back(content);
- return true;
- }
-
- // tag test_path_prefix
- if((qName.compare(test_path_prefix)==0)) {
- _pathList.push_back(_pathPrefix);
- _pathPrefix.listOfComputer.resize(0);
- return true;
- }
-
- // Component identification
-
- // tag test_component_name
- if((qName.compare(test_component_name)==0)) {
- _aModule.name = content ;
- return true;
- }
-
- // tag test_component_username
- if((qName.compare(test_component_username)==0)) {
- _aModule.username = content ;
- return true;
- }
-
- // tag test_component_type
- if((qName.compare(test_component_type)==0))
- {
- if ((content.compare("MESH") == 0) ||
- (content.compare("Mesh") == 0) ||
- (content.compare("mesh") == 0))
- _aModule.type = MESH ;
- else if((content.compare("MED") == 0) ||
- (content.compare("Med") == 0) ||
- (content.compare("med") == 0))
- _aModule.type = Med ;
- else if((content.compare("GEOM") == 0) ||
- (content.compare("Geom") == 0) ||
- (content.compare("geom") == 0))
- _aModule.type = GEOM ;
- else if((content.compare("SOLVER") == 0) ||
- (content.compare("Solver") == 0) ||
- (content.compare("solver") == 0))
- _aModule.type = SOLVER ;
- else if((content.compare("SUPERV") == 0) ||
- (content.compare("Superv") == 0) ||
- (content.compare("Supervision") == 0) ||
- (content.compare("superv") == 0))
- _aModule.type = SUPERV ;
- else if((content.compare("DATA") == 0) ||
- (content.compare("Data") == 0) ||
- (content.compare("data") == 0))
- _aModule.type = DATA ;
- else if((content.compare("VISU") == 0) ||
- (content.compare("Visu") == 0) ||
- (content.compare("visu") == 0))
- _aModule.type = VISU ;
- else if((content.compare("OTHER") == 0) ||
- (content.compare("Other") == 0) ||
- (content.compare("other") == 0))
- _aModule.type = OTHER ;
- else
- // If it'not in all theses cases, the type is affected to OTHER
- _aModule.type = OTHER ;
- return true;
- }
-
- // tag test_component_multistudy
- if((qName.compare(test_component_multistudy)==0)) {
- _aModule.multistudy = atoi(content.c_str()) ;
- return true;
- }
-
- // tag test_component_impltype
- if((qName.compare(QString(test_component_impltype))==0))
- _aModule.implementationType = atoi(content.c_str()) ;
-
- // tag test_component_icon
- if((qName.compare(test_component_icon)==0)) {
- _aModule.icon = content ;
- return true;
- }
-
- // tag test_component_version
- if((qName.compare(test_component_version)==0)) {
- _aModule.version = content ;
- return true;
- }
-
- // tag test_component_comment
- if((qName.compare(test_component_comment)==0)) {
- _aModule.comment = content ;
- return true;
- }
-
- // interface identification
-
- // tag test_interface_name
- if ((qName.compare(test_interface_name)==0)) {
- _aInterface.name = content ;
- return true;
- }
-
- // Service identification
-
- // tag test_service_name
- if ((qName.compare(test_service_name)==0)) {
- _aService.name = content ;
- return true;
- }
-
- //tag test_defaultservice
- if ((qName.compare(test_defaultservice)==0)) {
- _aService.byDefault = atoi(content.c_str()) ;
- return true;
- }
-
- //tag test_typeofnode
- if((qName.compare(QString(test_typeofnode))==0))
- _aService.typeOfNode = atoi(content.c_str()) ;
-
- // Parameter in
-
- // tag test_inDataStreamParameter_type
- if ((qName.compare(test_inDataStreamParameter_type)==0)) {
- if (grandparent.compare(test_inDataStreamParameter_list) == 0)
- _inDataStreamParam.type = content ;
- else
- _inParam.type = content ;
- return true;
- }
-
- // tag test_inParameter_type
- if ((qName.compare(test_inParameter_type)==0)) {
- if (grandparent.compare(test_inDataStreamParameter_list) == 0)
- _inDataStreamParam.type = content ;
- else
- _inParam.type = content ;
- return true;
- }
-
- //tag test_inDataStreamParameter_name
- if ((qName.compare(test_inDataStreamParameter_name)==0)) {
- if (grandparent.compare(test_inDataStreamParameter_list) == 0)
- _inDataStreamParam.name = content ;
- else
- _inParam.name = content ;
- return true;
- }
-
- //tag test_inParameter_name
- if ((qName.compare(test_inParameter_name)==0)) {
- if(MYDEBUG) SCRUTE(parent.toLatin1().data());
- if(MYDEBUG) SCRUTE(grandparent.toLatin1().data());
- if (grandparent.compare(test_inDataStreamParameter_list) == 0)
- _inDataStreamParam.name = content ;
- else
- _inParam.name = content ;
- return true;
- }
-
- //tag test_inDataStreamParameter_dependency
- if ((qName.compare(test_inDataStreamParameter_dependency)==0)) {
- _inDataStreamParam.dependency = content ;
- return true;
- }
-
- //tag test_inParameter
- if ((qName.compare(test_inParameter)==0))
- {
- if (parent.compare(test_inParameter_list)==0) {
-
- if(MYDEBUG) MESSAGE("add inParameter : " << _inParam.name);
- _inParamList.push_back(_inParam) ;
-
- // Empty temporary structures
- _inParam.type = "";
- _inParam.name = "";
- }
- else if ((qName.compare(test_inDataStreamParameter)==0)) {
-
- if(MYDEBUG) MESSAGE("add inDataStreamParameter : " << _inDataStreamParam.name);
- _inDataStreamParamList.push_back(_inDataStreamParam) ;
-
- // Empty temporary structures
- _inDataStreamParam.type = "";
- _inDataStreamParam.name = "";
- _inDataStreamParam.dependency = "";
- }
- return true;
- }
+ // Get the document root node
+ xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc);
+ aCurNode = aCurNode->xmlChildrenNode;
- //tag test_inParameter_list
- if((qName.compare(test_inParameter_list)==0))
- {
- if(MYDEBUG) SCRUTE(_inParamList.size());
- _aService.inParameters = _inParamList;
- _inParamList.resize(0);
- return true;
- }
-
- //tag test_inDataStreamParameter_list
- if((qName.compare(test_inDataStreamParameter_list)==0))
- {
- if(MYDEBUG) SCRUTE(_inDataStreamParamList.size());
- _aService.inDataStreamParameters = _inDataStreamParamList;
- _inDataStreamParamList.resize(0);
- }
- //tag test_outDataStreamParameter_list
- if((qName.compare(test_outDataStreamParameter_list)==0))
- {
- if(MYDEBUG) SCRUTE(_outDataStreamParamList.size());
- _aService.outDataStreamParameters = _outDataStreamParamList;
- _outDataStreamParamList.resize(0);
- return true;
- }
-
-
-
- // Parameter out
- if(MYDEBUG) SCRUTE(qName.toLatin1().data());
-
- // tag test_outParameter_type
- if ((qName.compare(test_outParameter_type)==0)) {
- if (grandparent.compare(test_outDataStreamParameter_list) == 0)
- _outDataStreamParam.type = content ;
- else
- _outParam.type = content ;
- return true;
- }
-
- // tag test_outDataStreamParameter_type
- if ((qName.compare(test_outDataStreamParameter_type)==0)) {
- if (grandparent.compare(test_outDataStreamParameter_list) == 0)
- _outDataStreamParam.type = content ;
- else
- _outParam.type = content ;
- return true;
- }
-
- //tag test_outParameter_name
- if ((qName.compare(test_outParameter_name)==0)) {
- if (grandparent.compare(test_outDataStreamParameter_list) == 0)
- _outDataStreamParam.name = content ;
- else
- _outParam.name = content ;
- return true;
- }
-
- //tag test_outDataStreamParameter_name
- if ((qName.compare(test_outDataStreamParameter_name)==0)) {
- if(MYDEBUG) SCRUTE(grandparent.toLatin1().data());
- if(MYDEBUG) SCRUTE(test_outDataStreamParameter_list.toLatin1().data());
- if (grandparent.compare(test_outDataStreamParameter_list) == 0)
- _outDataStreamParam.name = content ;
- else
- _outParam.name = content ;
- return true;
- }
-
- //tag test_outParameter_dependency
- if ((qName.compare(test_outDataStreamParameter_dependency)==0)) {
- _outDataStreamParam.dependency = content ;
- return true;
- }
-
- //tag test_outParameter
- if ((qName.compare(test_outParameter)==0))
+ // Processing the document nodes
+ while(aCurNode != NULL)
+ {
+ // Part 1: Process path prefix list (tag test_path_prefix_list)
+ if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_path_prefix_list) )
{
- if (parent.compare(test_outParameter_list)==0) {
-
- if(MYDEBUG) MESSAGE("add outParameter : " << _outParam.name);
- _outParamList.push_back(_outParam) ;
-
- // Empty temporary structures
- _outParam.type = "";
- _outParam.name = "";
- }
- else if ((qName.compare(test_outDataStreamParameter)==0)) {
-
- if(MYDEBUG) MESSAGE("add outDataStreamParameter : " << _outDataStreamParam.name);
- _outDataStreamParamList.push_back(_outDataStreamParam) ;
-
- // Empty temporary structures
- _outDataStreamParam.type = "";
- _outDataStreamParam.name = "";
- _outDataStreamParam.dependency = "";
+ xmlNodePtr aCurSubNode = aCurNode->xmlChildrenNode;
+ while(aCurSubNode != NULL)
+ {
+ // Forming a PathPrefix structure (tag test_path_prefix)
+ if ( xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_path_prefix) ) {
+ aCurSubNode = aCurSubNode->next;
+ continue;
+ }
+
+ xmlNodePtr aCurSubSubNode = aCurSubNode->xmlChildrenNode;
+ while(aCurSubSubNode != NULL)
+ {
+ // Tag test_path_prefix_name
+ if ( !xmlStrcmp(aCurSubSubNode->name, (const xmlChar*)test_path_prefix_name) ) {
+ xmlChar* aPath = xmlNodeGetContent(aCurSubSubNode);
+ if (aPath != NULL) {
+ _pathPrefix.path = (const char*)aPath;
+ xmlFree(aPath);
+ }
+ }
+
+ // Tag test_computer_list
+ if ( !xmlStrcmp(aCurSubSubNode->name, (const xmlChar*)test_computer_list) ) {
+ xmlNodePtr aComputerNode = aCurSubSubNode->xmlChildrenNode;
+ while (aComputerNode != NULL) {
+ // Tag test_computer_name
+ if ( !xmlStrcmp(aComputerNode->name, (const xmlChar*) test_computer_name) ) {
+ xmlChar* aCompName = xmlNodeGetContent(aComputerNode);
+ if (aCompName != NULL) {
+ _pathPrefix.listOfComputer.push_back((const char*)aCompName);
+ xmlFree(aCompName);
+ }
+ }
+
+ aComputerNode = aComputerNode->next;
+ }
+ }
+
+ aCurSubSubNode = aCurSubSubNode->next;
+ }
+
+ _pathList.push_back(_pathPrefix);
+ _pathPrefix.listOfComputer.resize(0);
+
+ aCurSubNode = aCurSubNode->next;
}
- return true;
}
-
- //tag test_outParameter_list
- if((qName.compare(test_outParameter_list)==0))
- {
- if(MYDEBUG) SCRUTE(_outParamList.size());
- _aService.outParameters = _outParamList;
- _outParamList.resize(0);
- return true;
- }
-
- // tag test_service
- if((qName.compare(test_service)==0))
- {
- _serviceList.push_back(_aService);
-
- // Empty temporary structures
- _aService.name = "";
- _aService.typeOfNode = 1;
- _aService.inParameters.resize(0);
- _aService.outParameters.resize(0);
- _aService.inDataStreamParameters.resize(0);
- _aService.outDataStreamParameters.resize(0);
- }
-
- // tag test_service_list
- if((qName.compare(test_service_list)==0))
- {
- _aInterface.services = _serviceList ;
-
- // Empty temporary structures
- _serviceList.resize(0);
- _interfaceList.push_back(_aInterface);
- _aInterface.name ="";
- _aInterface.services.resize(0);
-
- }
-
- //tag test_interface_list
- if((qName.compare(test_interface_list)==0))
- {
- _aModule.interfaces = _interfaceList ;
- _interfaceList.resize(0);
- }
-
- //tag test_constraint
- if((qName.compare(test_constraint)==0))
- _aModule.constraint = content ;
-
- // tag test_component
- if((qName.compare(test_component)==0))
- {
- _moduleList.push_back(_aModule) ;
-
- // Empty temporary structures
- _aModule.name = "";
- _aModule.constraint = "";
- _aModule.icon="";
- _aModule.interfaces.resize(0);
- }
-
- return true;
-}
-
-//----------------------------------------------------------------------
-// Function : characters
-// Purpose : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_ModuleCatalog_Handler::characters(const QString& chars)
-{
- content = chars.toLatin1().data() ;
- return true;
-}
-//----------------------------------------------------------------------
-// Function : endDocument
-// Purpose : overload handler function
-// Print all informations find in the catalog
-// (only in DEBUG mode!!)
-//----------------------------------------------------------------------
-#include <fstream>
-bool SALOME_ModuleCatalog_Handler::endDocument()
-{
-// ofstream f("/tmp/logs/xxx.log", std::ofstream::app);
-// f << "---------------------------------------------------------" << std::endl;
- if(MYDEBUG) BEGIN_OF("endDocument");
- //_pathlist
- for (unsigned int ind = 0; ind < _pathList.size(); ind++)
+ //Part 2: Process list of types
+ if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)"type-list") )
+ {
+ xmlNodePtr aTypeNode = aCurNode->xmlChildrenNode;
+ while (aTypeNode != NULL)
+ {
+ // match "type"
+ if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"type" ))
+ {
+ // Here is a basic type description
+ ParserType aType;
+ xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name");
+ if(name)
+ {
+ aType.name = (const char*)name;
+ xmlFree(name);
+ }
+ xmlChar *kind=xmlGetProp(aTypeNode,(const xmlChar*)"kind");
+ if(kind)
+ {
+ aType.kind = (const char*)kind;
+ xmlFree(kind);
+ }
+ if(aType.kind == "double" ||
+ aType.kind == "int" ||
+ aType.kind == "bool" ||
+ aType.kind == "string")
+ {
+ if ( _typeMap.find(aType.name) == _typeMap.end() )
+ {
+ std::cerr << "Registered basic type: " << aType.name << " " << aType.kind << std::endl;
+ _typeMap[aType.name]=aType;
+ _typeList.push_back(aType);
+ }
+ else
+ std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl;
+ }
+ else
+ std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") has incorrect kind, it will be ignored." << std::endl;
+ }
+ else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"sequence" ))
+ {
+ // Here is a sequence type description
+ ParserSequence aType;
+ xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name");
+ if(name)
+ {
+ aType.name = (const char*)name;
+ xmlFree(name);
+ }
+ xmlChar *content=xmlGetProp(aTypeNode,(const xmlChar*)"content");
+ if(content)
+ {
+ aType.content = (const char*)content;
+ xmlFree(content);
+ }
+ if ( _typeMap.find(aType.content) != _typeMap.end() )
+ {
+ if ( _typeMap.find(aType.name) == _typeMap.end() )
+ {
+ std::cerr << "Registered sequence type: " << aType.name << " " << aType.content << std::endl;
+ _typeMap[aType.name]=aType;
+ _typeList.push_back(aType);
+ }
+ else
+ std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl;
+ }
+ else
+ {
+ std::cerr << "Warning: this sequence type (" << aType.name << "," << aType.content << ") has unknown content type, it will be ignored." << std::endl;
+ }
+ }
+ else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"objref" ))
+ {
+ // Here is an objref type description
+ ParserObjref aType;
+ int error=0;
+ xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name");
+ if(name)
+ {
+ aType.name = (const char*)name;
+ xmlFree(name);
+ }
+ xmlChar *id=xmlGetProp(aTypeNode,(const xmlChar*)"id");
+ if(id)
+ {
+ aType.id = (const char*)id;
+ xmlFree(id);
+ }
+
+ xmlNodePtr aTypeSubNode = aTypeNode->xmlChildrenNode;
+ while (aTypeSubNode != NULL)
+ {
+ if ( !xmlStrcmp(aTypeSubNode->name, (const xmlChar*)"base" ))
+ {
+ //a base type
+ xmlChar* content = xmlNodeGetContent(aTypeSubNode);
+ if(content)
+ {
+ std::string base=(const char*)content;
+ xmlFree(content);
+ if ( _typeMap.find(base) != _typeMap.end() && _typeMap[base].kind == "objref")
+ {
+ aType.bases.push_back(base);
+ }
+ else
+ {
+ std::cerr << "Warning: this objref type (" << aType.name << ") has unknown base type (" << base << "), it will be ignored." << std::endl;
+ error=1;
+ break;
+ }
+ }
+ }
+ aTypeSubNode = aTypeSubNode->next;
+ }
+ if(!error)
+ {
+ if ( _typeMap.find(aType.name) == _typeMap.end() )
+ {
+ std::cerr << "Registered objref type: " << aType.name << " " << aType.id << std::endl;
+ _typeMap[aType.name]=aType;
+ _typeList.push_back(aType);
+ }
+ else
+ std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl;
+ }
+ }
+ else if ( !xmlStrcmp(aTypeNode->name, (const xmlChar*)"struct" ))
+ {
+ // Here is a struct type description
+ ParserStruct aType;
+ int error=0;
+ xmlChar * name=xmlGetProp(aTypeNode,(const xmlChar*)"name");
+ if(name)
+ {
+ aType.name = (const char*)name;
+ xmlFree(name);
+ }
+ xmlChar *id=xmlGetProp(aTypeNode,(const xmlChar*)"id");
+ if(id)
+ {
+ aType.id = (const char*)id;
+ xmlFree(id);
+ }
+
+ xmlNodePtr aTypeSubNode = aTypeNode->xmlChildrenNode;
+ while (aTypeSubNode != NULL)
+ {
+ if ( !xmlStrcmp(aTypeSubNode->name, (const xmlChar*)"member" ))
+ {
+ std::pair<std::string,std::string> member;
+ xmlChar * m_name=xmlGetProp(aTypeSubNode,(const xmlChar*)"name");
+ if(m_name)
+ {
+ member.first=(const char*)m_name;
+ xmlFree(m_name);
+ }
+ xmlChar * m_type=xmlGetProp(aTypeSubNode,(const xmlChar*)"type");
+ if(m_type)
+ {
+ member.second=(const char*)m_type;
+ xmlFree(m_type);
+ }
+ if ( _typeMap.find(member.second) != _typeMap.end() )
+ {
+ aType.members.push_back(member);
+ }
+ else
+ {
+ std::cerr << "Warning: this struct type (" << aType.name << ") has unknown member type (" << member.first << "," << member.second << "), it will be ignored." << std::endl;
+ error=1;
+ break;
+ }
+ }
+ aTypeSubNode = aTypeSubNode->next;
+ }
+ if(!error)
+ {
+ if ( _typeMap.find(aType.name) == _typeMap.end() )
+ {
+ std::cerr << "Registered struct type: " << aType.name << " " << aType.id << std::endl;
+ _typeMap[aType.name]=aType;
+ _typeList.push_back(aType);
+ }
+ else
+ std::cerr << "Warning: this type (" << aType.name << "," << aType.kind << ") already exists, it will be ignored." << std::endl;
+ }
+ } // end of struct
+ aTypeNode = aTypeNode->next;
+ }
+ }
+
+ //Part 3: Process list of components (tag test_component_list)
+ if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_component_list) )
{
- if(MYDEBUG) MESSAGE("Path :"<<_pathList[ind].path);
- for (unsigned int i = 0; i < _pathList[ind].listOfComputer.size(); i++)
- if(MYDEBUG) MESSAGE("Computer name :" << _pathList[ind].listOfComputer[i]);
+ xmlNodePtr aComponentNode = aCurNode->xmlChildrenNode;
+ while (aComponentNode != NULL)
+ {
+ // Do not process tags differ from test_component here
+ if ( xmlStrcmp(aComponentNode->name, (const xmlChar*)test_component) ) {
+ aComponentNode = aComponentNode->next;
+ continue;
+ }
+
+ // Component identification
+
+ // Empty temporary structures
+ _aModule.name = "";
+ _aModule.constraint = "";
+ _aModule.icon="";
+ _aModule.interfaces.resize(0);
+
+ xmlNodePtr aComponentSubNode = aComponentNode->xmlChildrenNode;
+ while(aComponentSubNode != NULL)
+ {
+ xmlChar* aNodeContent = xmlNodeGetContent(aComponentSubNode);
+
+ if (aNodeContent == NULL) {
+ aComponentSubNode = aComponentSubNode->next;
+ continue;
+ }
+
+ std::string aContent = (const char*)aNodeContent;
+
+ // Tag test_component_name
+ if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_name) )
+ _aModule.name = aContent;
+
+ // Tag test_component_username
+ if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_username) )
+ _aModule.username = aContent;
+
+ // Tag test_component_type
+ if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_type) ) {
+ std::string aType = aContent;
+
+ if ((aType.compare("MESH") == 0) ||
+ (aType.compare("Mesh") == 0) ||
+ (aType.compare("mesh") == 0))
+ _aModule.type = MESH ;
+ else if((aType.compare("MED") == 0) ||
+ (aType.compare("Med") == 0) ||
+ (aType.compare("med") == 0))
+ _aModule.type = Med ;
+ else if((aType.compare("GEOM") == 0) ||
+ (aType.compare("Geom") == 0) ||
+ (aType.compare("geom") == 0))
+ _aModule.type = GEOM ;
+ else if((aType.compare("SOLVER") == 0) ||
+ (aType.compare("Solver") == 0) ||
+ (aType.compare("solver") == 0))
+ _aModule.type = SOLVER ;
+ else if((aType.compare("SUPERV") == 0) ||
+ (aType.compare("Superv") == 0) ||
+ (aType.compare("Supervision") == 0) ||
+ (aType.compare("superv") == 0))
+ _aModule.type = SUPERV ;
+ else if((aType.compare("DATA") == 0) ||
+ (aType.compare("Data") == 0) ||
+ (aType.compare("data") == 0))
+ _aModule.type = DATA ;
+ else if((aType.compare("VISU") == 0) ||
+ (aType.compare("Visu") == 0) ||
+ (aType.compare("visu") == 0))
+ _aModule.type = VISU ;
+ else if((aType.compare("OTHER") == 0) ||
+ (aType.compare("Other") == 0) ||
+ (aType.compare("other") == 0))
+ _aModule.type = OTHER ;
+ else
+ // If it'not in all theses cases, the type is affected to OTHER
+ _aModule.type = OTHER ;
+ }
+
+ // Tag test_component_multistudy
+ if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_multistudy) )
+ _aModule.multistudy = atoi( aContent.c_str() );
+
+ // Tag test_component_impltype
+ if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_impltype) )
+ _aModule.implementationType = atoi(aContent.c_str());
+
+ // Tag test_component_icon
+ if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_icon) )
+ _aModule.icon = aContent;
+
+ // Tag test_component_version
+ if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_version) )
+ _aModule.version = aContent;
+
+ // Tag test_component_comment
+ if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_component_comment) )
+ _aModule.comment = aContent;
+
+ // Tag test_constraint
+ if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_constraint) )
+ _aModule.constraint = aContent;
+
+ xmlFree(aNodeContent);
+
+ // Process tag test_interface_list:
+ if ( !xmlStrcmp(aComponentSubNode->name, (const xmlChar*)test_interface_list) ) {
+
+ // Form an interface list for the component
+ xmlNodePtr aSubNode = aComponentSubNode->xmlChildrenNode;
+ while(aSubNode != NULL) {
+ // Tag test_interface_name
+ if ( !xmlStrcmp(aSubNode->name, (const xmlChar*)test_interface_name) ) {
+ xmlChar* anInterfaceName = xmlNodeGetContent(aSubNode);
+ if (anInterfaceName != NULL) {
+ _aInterface.name = (const char*)anInterfaceName;
+ xmlFree(anInterfaceName);
+ }
+ }
+
+ // Tag test_service_list
+ if ( !xmlStrcmp(aSubNode->name, (const xmlChar*)test_service_list) ) {
+ // Form a service list for the interface
+ xmlNodePtr aCompServiceNode = aSubNode->xmlChildrenNode;
+ while(aCompServiceNode != NULL) {
+ // Tag test_service
+ if ( !xmlStrcmp(aCompServiceNode->name, (const xmlChar*)"component-service") ) {
+ xmlNodePtr aCompServiceSubNode = aCompServiceNode->xmlChildrenNode;
+ while(aCompServiceSubNode != NULL)
+ {
+ xmlChar* aCompServiceData = xmlNodeGetContent(aCompServiceSubNode);
+
+ if ( aCompServiceData != NULL)
+ {
+ // Tag test_service_name
+ if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_service_name) )
+ _aService.name = (const char*)aCompServiceData;
+
+ // Tag test_defaultservice
+ if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_defaultservice) )
+ _aService.byDefault = (const char*)aCompServiceData;
+
+ // Tag test_typeofnode
+ if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_typeofnode) )
+ _aService.typeOfNode = (const char*)aCompServiceData;
+
+ xmlFree(aCompServiceData);
+ }
+
+ // Tag test_inParameter_list
+ if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_inParameter_list) ) {
+ xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode;
+ while (aParamNode != NULL)
+ {
+ // Tag test_inParameter
+ if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_inParameter)) {
+ aParamNode = aParamNode->next;
+ continue;
+ }
+
+ xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode;
+ while (aParamItemNode != NULL)
+ {
+ xmlChar* aParamData = xmlNodeGetContent(aParamItemNode);
+
+ if (aParamData != NULL)
+ {
+ // Tag test_inParameter_name
+ if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inParameter_name) )
+ _inParam.name = (const char*)aParamData;
+
+ // Tag test_inParameter_type
+ if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inParameter_type) )
+ _inParam.type = (const char*)aParamData;
+
+ xmlFree(aParamData);
+ }
+
+ aParamItemNode = aParamItemNode->next;
+ }
+
+ _inParamList.push_back(_inParam) ;
+
+ // Empty temporary structures
+ _inParam.type = "";
+ _inParam.name = "";
+
+ aParamNode = aParamNode->next;
+ }
+
+ _aService.inParameters = _inParamList;
+ _inParamList.resize(0);
+ }
+
+ // Tag test_outParameter_list
+ if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_outParameter_list) ) {
+ xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode;
+ while (aParamNode != NULL)
+ {
+ // Tag test_outParameter
+ if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_outParameter)) {
+ aParamNode = aParamNode->next;
+ continue;
+ }
+
+ xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode;
+ while (aParamItemNode != NULL)
+ {
+ xmlChar* anOutParamData = xmlNodeGetContent(aParamItemNode);
+
+ if (anOutParamData != NULL)
+ {
+ // Tag test_outParameter_name
+ if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outParameter_name) )
+ _outParam.name = (const char*)anOutParamData;
+
+ // Tag test_outParameter_type
+ if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outParameter_type) )
+ _outParam.type = (const char*)anOutParamData;
+
+ xmlFree(anOutParamData);
+ }
+
+ aParamItemNode = aParamItemNode->next;
+ }
+
+ _outParamList.push_back(_outParam) ;
+
+ // Empty temporary structures
+ _outParam.type = "";
+ _outParam.name = "";
+
+ aParamNode = aParamNode->next;
+ }
+
+ _aService.outParameters = _outParamList;
+ _outParamList.resize(0);
+ }
+
+ //@ Tag test_inDataStreamParameter_list
+ if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_inDataStreamParameter_list) )
+ {
+ xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode;
+ while (aParamNode != NULL)
+ {
+ // Tag test_inDataStreamParameter
+ if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_inDataStreamParameter)) {
+ aParamNode = aParamNode->next;
+ continue;
+ }
+
+ xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode;
+ while (aParamItemNode != NULL)
+ {
+ xmlChar* inDataStreamParamData = xmlNodeGetContent(aParamItemNode);
+
+ if (inDataStreamParamData != NULL)
+ {
+ // Tag test_inDataStreamParameter_name
+ if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_name) )
+ _inDataStreamParam.name = (const char*)inDataStreamParamData;
+
+ // Tag test_inDataStreamParameter_type
+ if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_type) )
+ _inDataStreamParam.type = (const char*)inDataStreamParamData;
+
+ // Tag test_inDataStreamParameter_dependency
+ if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_inDataStreamParameter_dependency) )
+ _inDataStreamParam.dependency = (const char*)inDataStreamParamData;
+
+ xmlFree(inDataStreamParamData);
+ }
+
+ aParamItemNode = aParamItemNode->next;
+ }
+
+ _inDataStreamParamList.push_back(_inDataStreamParam) ;
+
+ // Empty temporary structures
+ _inDataStreamParam.type = "";
+ _inDataStreamParam.name = "";
+ _inDataStreamParam.dependency = "";
+
+ aParamNode = aParamNode->next;
+ }
+
+ _aService.inDataStreamParameters = _inDataStreamParamList;
+ _inDataStreamParamList.resize(0);
+ }
+
+ // Tag test_outDataStreamParameter_list
+ if ( !xmlStrcmp(aCompServiceSubNode->name, (const xmlChar*)test_outDataStreamParameter_list) )
+ {
+ xmlNodePtr aParamNode = aCompServiceSubNode->xmlChildrenNode;
+ while (aParamNode != NULL)
+ {
+ // Tag test_outDataStreamParameter
+ if (xmlStrcmp(aParamNode->name, (const xmlChar*)test_outDataStreamParameter)) {
+ aParamNode = aParamNode->next;
+ continue;
+ }
+
+ xmlNodePtr aParamItemNode = aParamNode->xmlChildrenNode;
+ while (aParamItemNode != NULL)
+ {
+ xmlChar* outDataStreamParamData = xmlNodeGetContent(aParamItemNode);
+
+ if (outDataStreamParamData != NULL)
+ {
+ // Tag test_outDataStreamParameter_name
+ if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_name) )
+ _outDataStreamParam.name = (const char*)outDataStreamParamData;
+
+ // Tag test_outDataStreamParameter_type
+ if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_type) )
+ _outDataStreamParam.type = (const char*)outDataStreamParamData;
+
+ // Tag test_outDataStreamParameter_dependency
+ if ( !xmlStrcmp(aParamItemNode->name, (const xmlChar*)test_outDataStreamParameter_dependency) )
+ _outDataStreamParam.dependency = (const char*)outDataStreamParamData;
+
+ xmlFree(outDataStreamParamData);
+ }
+
+ aParamItemNode = aParamItemNode->next;
+ }
+
+ _outDataStreamParamList.push_back(_outDataStreamParam) ;
+
+ // Empty temporary structures
+ _outDataStreamParam.type = "";
+ _outDataStreamParam.name = "";
+ _outDataStreamParam.dependency = "";
+
+ aParamNode = aParamNode->next;
+ }
+
+ _aService.outDataStreamParameters = _outDataStreamParamList;
+ _outDataStreamParamList.resize(0);
+ }
+
+ aCompServiceSubNode = aCompServiceSubNode->next;
+ }
+
+ // Put formed service into the list
+ _serviceList.push_back(_aService);
+
+ // Empty temporary structures
+ _aService.name = "";
+ _aService.typeOfNode = 1;
+ _aService.inParameters.resize(0);
+ _aService.outParameters.resize(0);
+ _aService.inDataStreamParameters.resize(0);
+ _aService.outDataStreamParameters.resize(0);
+ }
+
+ aCompServiceNode = aCompServiceNode->next;
+ }
+
+ _aInterface.services = _serviceList ;
+
+ // Empty temporary structures
+ _serviceList.resize(0);
+ _interfaceList.push_back(_aInterface);
+ _aInterface.name ="";
+ _aInterface.services.resize(0);
+ }
+
+ aSubNode = aSubNode->next;
+ }
+
+ _aModule.interfaces = _interfaceList ;
+ _interfaceList.resize(0);
+ }
+
+ aComponentSubNode = aComponentSubNode->next;
+ }
+
+ _moduleList.push_back(_aModule);
+
+ aComponentNode = aComponentNode->next;
+ }
}
- // _moduleList
-// if(MYDEBUG) SCRUTE(_moduleList.size());
-// for (unsigned int ind = 0; ind < _moduleList.size(); ind++)
-// {
-// f << _moduleList[ind] << std::endl;
-// }
-
- if(MYDEBUG) MESSAGE("Document parsed");
- if(MYDEBUG) END_OF("endDocument");
- return true;
-}
-
-//----------------------------------------------------------------------
-// Function : errorProtocol
-// Purpose : overload handler function
-//----------------------------------------------------------------------
-QString SALOME_ModuleCatalog_Handler::errorProtocol()
-{
- return errorProt ;
-}
-
-
-//----------------------------------------------------------------------
-// Function : fatalError
-// Purpose : overload handler function
-//----------------------------------------------------------------------
-bool SALOME_ModuleCatalog_Handler::fatalError(const QXmlParseException& exception)
-{
- errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
- .arg( exception.message() )
- .arg( exception.lineNumber() )
- .arg( exception.columnNumber() );
-
- return QXmlDefaultHandler::fatalError( exception );
+ aCurNode = aCurNode->next;
+ }
}
#include <SALOME_ModuleCatalog.hxx>
#include "SALOME_ModuleCatalog_Parser.hxx"
-#include <qxml.h>
+
#include <string>
#include <stack>
#include <map>
-class MODULECATALOG_EXPORT SALOME_ModuleCatalog_Handler : public QXmlDefaultHandler
+#include <libxml/parser.h>
+
+class MODULECATALOG_EXPORT SALOME_ModuleCatalog_Handler
{
public:
//! standard constructor
- SALOME_ModuleCatalog_Handler();
+ SALOME_ModuleCatalog_Handler(ParserPathPrefixes& pathList,ParserComponents& moduleList,ParserTypes& typeMap,TypeList& typeList);
//! standard destructor
virtual ~SALOME_ModuleCatalog_Handler();
-
- //! method to overload handler function startDocument
- /*! Is called before a xml file is parsed
- \return true if no error was detected
- */
- virtual bool startDocument();
-
-
- //! method to overload handler function startElement
- /*!
- \param QString argument by value
- \param QString argument by value
- \param QString argument by value
- \param QXmlAttributes argument by value
- \return true if no error was detected
- */
- virtual bool startElement(const QString&, const QString &,
- const QString& qName, const QXmlAttributes& atts);
-
- //! method to overload handler function endElement
- /*!
- \param QString argument by value
- \param QString argument by value
- \param QString argument by value
- \return true if no error was detected
- \sa _Find
- */
- virtual bool endElement(const QString&, const QString &,
- const QString& qName);
-
-
- //! method to overload handler function characters
- /*!
- \param QString argument by value
- \return true if no error was detected
- */
- virtual bool characters(const QString& chars);
-
- //! method to overload handler function endDocument
- /*! Is called at the end of the parsing
- \return true if no error was detected
- */
- virtual bool endDocument();
-
- //! method to overload handler function errorProtocol
- /*!
- \return the error message
- */
- virtual QString errorProtocol();
-
- //! method to overload handler function fatalError
- /*!
- \param QXmlParseExecption argument by value
- \return true if no error was detected
- */
- virtual bool fatalError(const QXmlParseException& exception);
+ void ProcessXmlDocument(xmlDocPtr theDoc);
private:
- QString errorProt ;
-
- std::string content;
- QString test_path_prefix_name ;
- QString test_computer_name ;
- QString test_path_prefix ;
-
- QString test_component_name;
- QString test_component_username;
- QString test_component_type ;
- QString test_component_multistudy ;
- QString test_component_icon ;
- QString test_component_impltype;
- QString test_component_version;
- QString test_component_comment;
-
- QString test_interface_name;
-
- QString test_service_name;
- QString test_defaultservice;
- QString test_typeofnode;
-
- QString test_inParameter_type;
- QString test_inParameter_name;
- QString test_inParameter;
- QString test_inParameter_list;
-
- QString test_outParameter_type;
- QString test_outParameter_name;
- QString test_outParameter;
- QString test_outParameter_list;
-
- QString test_inDataStreamParameter_type;
- QString test_inDataStreamParameter_name;
- QString test_inDataStreamParameter_dependency;
- QString test_inDataStreamParameter;
- QString test_inDataStreamParameter_list;
-
- QString test_outDataStreamParameter_type;
- QString test_outDataStreamParameter_name;
- QString test_outDataStreamParameter_dependency;
- QString test_outDataStreamParameter;
- QString test_outDataStreamParameter_list;
-
- QString test_service;
- QString test_service_list;
- QString test_interface_list;
- QString test_constraint;
+ const char *test_path_prefix_name ;
+ const char *test_computer_name ;
+ const char *test_computer_list ;
+ const char *test_path_prefix ;
+ const char *test_path_prefix_list;
+
+ const char *test_component_name;
+ const char *test_component_username;
+ const char *test_component_type ;
+ const char *test_component_multistudy ;
+ const char *test_component_icon ;
+ const char *test_component_impltype;
+ const char *test_component_version;
+ const char *test_component_comment;
+
+ const char *test_interface_name;
+
+ const char *test_service_name;
+ const char *test_defaultservice;
+ const char *test_typeofnode;
+
+ const char *test_inParameter_type;
+ const char *test_inParameter_name;
+ const char *test_inParameter;
+ const char *test_inParameter_list;
+
+ const char *test_outParameter_type;
+ const char *test_outParameter_name;
+ const char *test_outParameter;
+ const char *test_outParameter_list;
+
+ const char *test_inDataStreamParameter_type;
+ const char *test_inDataStreamParameter_name;
+ const char *test_inDataStreamParameter_dependency;
+ const char *test_inDataStreamParameter;
+ const char *test_inDataStreamParameter_list;
+
+ const char *test_outDataStreamParameter_type;
+ const char *test_outDataStreamParameter_name;
+ const char *test_outDataStreamParameter_dependency;
+ const char *test_outDataStreamParameter;
+ const char *test_outDataStreamParameter_list;
+
+ const char *test_service;
+ const char *test_service_list;
+ const char *test_interface_list;
+ const char *test_constraint;
+
+ const char *test_component_list;
+ const char *test_component;
- QString test_component;
-
ParserPathPrefix _pathPrefix;
-
+
ParserComponent _aModule;
-
-
+
+ ParserPathPrefixes& _pathList;
+ ParserComponents& _moduleList;
+
ParserInterfaces _interfaceList;
ParserInterface _aInterface;
-
+
ParserServices _serviceList;
ParserService _aService;
ParserParameters _inParamList;
ParserParameter _inParam;
-
+
ParserParameters _outParamList;
ParserParameter _outParam;
-
+
ParserDataStreamParameters _inDataStreamParamList;
ParserDataStreamParameter _inDataStreamParam;
-
+
ParserDataStreamParameters _outDataStreamParamList;
ParserDataStreamParameter _outDataStreamParam;
- std::stack<QString> _xml_pile;
+ ParserTypes& _typeMap;
+ TypeList& _typeList;
+
+ ParserSequences _sequenceMap;
+ ParserObjrefs _objrefMap;
+ ParserStructs _structMap;
};
#endif // SALOME_CATALOG_HANDLER_H
#include <string>
#include <vector>
+#include <map>
// Type Definitions
struct ParserPathPrefix
typedef std::vector<ParserComponent> ParserComponents ;
-#ifdef WRITE_CATA_COMPONENT
-// contains all the paths and the computers defined in the catalog
- ParserPathPrefixes _pathList;
-
-// contains all the modules defined in the catalog
- ParserComponents _moduleList;
-#else
-extern ParserPathPrefixes _pathList;
-extern ParserComponents _moduleList;
-#endif
+struct ParserType
+{
+ std::string name;
+ std::string kind;
+ std::string id;
+ std::string content;
+ std::vector<std::string> bases;
+ std::vector< std::pair<std::string,std::string> > members;
+};
+typedef std::map<std::string,ParserType> ParserTypes ;
+typedef std::map<std::string,ParserType&> RefTypes ;
+typedef std::vector<ParserType> TypeList ;
+
+struct ParserSequence:public ParserType
+{
+ ParserSequence(){kind="sequence";}
+};
+typedef std::map<std::string,ParserSequence> ParserSequences ;
+struct ParserObjref:public ParserType
+{
+ ParserObjref(){kind="objref";}
+};
+typedef std::map<std::string,ParserObjref> ParserObjrefs ;
+
+struct ParserStruct:public ParserType
+{
+ ParserStruct(){kind="struct";}
+};
+typedef std::map<std::string,ParserStruct> ParserStructs ;
#endif // SALOME_CATALOG_PARSER_H
int main(int argc,char **argv)
{
// initialize the ORB
- CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
// LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
try
{
// Active catalog
- SALOME_ModuleCatalogImpl Catalogue_i(argc, argv, orb);
- poa->activate_object (&Catalogue_i);
+ SALOME_ModuleCatalogImpl* Catalogue_i=new SALOME_ModuleCatalogImpl(argc, argv, orb);
+ PortableServer::ObjectId_var cataid = poa->activate_object (Catalogue_i);
+ //activate POA manager
mgr->activate();
-
- CORBA::Object_ptr myCata = Catalogue_i._this();
+ CORBA::Object_var myCata = Catalogue_i->_this();
+ Catalogue_i->_remove_ref();
// initialise Naming Service
- SALOME_NamingService *_NS;
- _NS = new SALOME_NamingService(orb);
+ SALOME_NamingService _NS(orb);
// register Catalog in Naming Service
- _NS->Register(myCata ,"/Kernel/ModulCatalog");
+ _NS.Register(myCata ,"/Kernel/ModulCatalog");
MESSAGE("Running CatalogServer.");
timer.ShowAbsolute();
#endif
orb->run();
+ std::cerr << "server returned from orb->run()" << std::endl;
+ orb->destroy();
- mgr->deactivate(true,true);
- poa->destroy(1,1);
+// mgr->deactivate(true,true);
+// poa->destroy(1,1);
}
catch(CORBA::SystemException&) {
INFOS("Caught CORBA::Exception.")
}
+ END_OF( argv[0] );
// delete myThreadTrace;
return 0;
}
#include <fstream>
#include <map>
-#include <qstringlist.h>
-#include <qfileinfo.h>
using namespace std;
#include "utilities.h"
static const char* SEPARATOR = "::";
static const char* OLD_SEPARATOR = ":";
+
+list<string> splitStringToList(const string& theString, const string& theSeparator)
+{
+ list<string> aList;
+
+ int sepLen = theSeparator.length();
+ int startPos = 0, sepPos = theString.find(theSeparator, startPos);
+
+ while (1)
+ {
+ string anItem ;
+ if(sepPos != string::npos)
+ anItem = theString.substr(startPos, sepPos - startPos);
+ else
+ anItem = theString.substr(startPos);
+ if (anItem.length() > 0)
+ aList.push_back(anItem);
+ if(sepPos == string::npos)
+ break;
+ startPos = sepPos + sepLen;
+ sepPos = theString.find(theSeparator, startPos);
+ }
+
+ return aList;
+}
+
//----------------------------------------------------------------------
// Function : SALOME_ModuleCatalogImpl
// Purpose : Constructor
if(MYDEBUG) MESSAGE( "Error while argument parsing" );
// Test existency of files
- if (_general_path == NULL){
+ if (_general_path == NULL)
+ {
if(MYDEBUG) MESSAGE( "Error the general catalog should be indicated" );
- }else{
+ }
+ else
+ {
// Affect the _general_module_list and _general_path_list members
// with the common catalog
-
- QStringList dirList;
+
+ list<string> dirList;
+
#ifdef WNT
- dirList = QString( _general_path ).split( SEPARATOR, QString::SkipEmptyParts ); // skip empty entries
+ dirList = splitStringToList(_general_path, SEPARATOR);
#else
//check for new format
- if ( QString( _general_path ).contains(SEPARATOR) ) {
+ bool isNew = (std::string( _general_path ).find(SEPARATOR) != string::npos);
+ if ( isNew ) {
//using new format
- dirList = QString( _general_path ).split( SEPARATOR, QString::SkipEmptyParts ); // skip empty entries
+ dirList = splitStringToList(_general_path, SEPARATOR);
} else {
//support old format
- dirList = QString( _general_path ).split( OLD_SEPARATOR, QString::SkipEmptyParts ); // skip empty entries
- }
+ dirList = splitStringToList(_general_path, OLD_SEPARATOR);
+ }
#endif
-
- for ( int i = 0; i < dirList.count(); i++ ) {
- //QFileInfo fileInfo( dirList[ i ] );
- QFileInfo fileInfo( dirList[ i ].replace( '\"', "" ) ); //remove inverted commas from filename
- if ( fileInfo.isFile() && fileInfo.exists() ) {
- _parse_xml_file(fileInfo.filePath().toLatin1().data(),
- _general_module_list,
- _general_path_list);
- }
+
+ for (list<string>::iterator iter = dirList.begin(); iter != dirList.end(); iter++)
+ {
+ string aPath = (*iter);
+ //remove inverted commas from filename
+ while (aPath.find('\"') != string::npos)
+ aPath.erase(aPath.find('\"'), 1);
+
+ _parse_xml_file(aPath.c_str(),
+ _general_module_list,
+ _general_path_list,
+ _typeMap,
+ _typeList);
}
-
+
// Verification of _general_path_list content
- if(!_verify_path_prefix(_general_path_list)){
+ if (!_verify_path_prefix(_general_path_list)) {
if(MYDEBUG) MESSAGE( "Error while parsing the general path list, "
"differents paths are associated to the same computer,"
"the first one will be choosen");
- }else{
+ } else {
if(MYDEBUG) MESSAGE("General path list OK");
}
-
- if(_personal_path != NULL){
+
+ if (_personal_path != NULL) {
// Initialize the _personal_module_list and
// _personal_path_list members with the personal catalog files
_parse_xml_file(_personal_path,
_personal_module_list,
- _personal_path_list);
+ _personal_path_list,
+ _typeMap,
+ _typeList);
// Verification of _general_path_list content
if(!_verify_path_prefix(_personal_path_list)){
}
+//! Get the list of all types of the catalog
+/*!
+ * \return the list of types
+ */
+SALOME_ModuleCatalog::ListOfTypeDefinition* SALOME_ModuleCatalogImpl::GetTypes()
+{
+ SALOME_ModuleCatalog::ListOfTypeDefinition_var type_list = new SALOME_ModuleCatalog::ListOfTypeDefinition();
+ type_list->length(_typeList.size());
+
+ for (int ind = 0 ; ind < _typeList.size() ; ind++)
+ {
+ std::cerr << "name: " << _typeList[ind].name << std::endl;
+ //no real need to call string_dup, omniorb calls it on operator= (const char *) but it is safer
+ type_list[ind].name=CORBA::string_dup(_typeList[ind].name.c_str());
+ type_list[ind].kind=SALOME_ModuleCatalog::NONE;
+ if(_typeList[ind].kind=="double")
+ type_list[ind].kind=SALOME_ModuleCatalog::Dble;
+ else if(_typeList[ind].kind=="int")
+ type_list[ind].kind=SALOME_ModuleCatalog::Int;
+ else if(_typeList[ind].kind=="bool")
+ type_list[ind].kind=SALOME_ModuleCatalog::Bool;
+ else if(_typeList[ind].kind=="string")
+ type_list[ind].kind=SALOME_ModuleCatalog::Str;
+ else if(_typeList[ind].kind=="objref")
+ {
+ type_list[ind].kind=SALOME_ModuleCatalog::Objref;
+ type_list[ind].id=CORBA::string_dup(_typeList[ind].id.c_str());
+ //bases
+ type_list[ind].bases.length(_typeList[ind].bases.size());
+ std::vector<std::string>::const_iterator miter;
+ miter=_typeList[ind].bases.begin();
+ int n_memb=0;
+ while(miter != _typeList[ind].bases.end())
+ {
+ type_list[ind].bases[n_memb]=CORBA::string_dup(miter->c_str());
+ miter++;
+ n_memb++;
+ }
+ }
+ else if(_typeList[ind].kind=="sequence")
+ {
+ type_list[ind].kind=SALOME_ModuleCatalog::Seq;
+ type_list[ind].content=CORBA::string_dup(_typeList[ind].content.c_str());
+ }
+ else if(_typeList[ind].kind=="array")
+ {
+ type_list[ind].kind=SALOME_ModuleCatalog::Array;
+ type_list[ind].content=CORBA::string_dup(_typeList[ind].content.c_str());
+ }
+ else if(_typeList[ind].kind=="struct")
+ {
+ type_list[ind].kind=SALOME_ModuleCatalog::Struc;
+ //members
+ type_list[ind].members.length(_typeList[ind].members.size());
+
+ std::vector< std::pair<std::string,std::string> >::const_iterator miter;
+ miter=_typeList[ind].members.begin();
+ int n_memb=0;
+ while(miter != _typeList[ind].members.end())
+ {
+ type_list[ind].members[n_memb].name=CORBA::string_dup(miter->first.c_str());
+ type_list[ind].members[n_memb].type=CORBA::string_dup(miter->second.c_str());
+ n_memb++;
+ miter++;
+ }
+ }
+ }
+ return type_list._retn();
+}
+
//----------------------------------------------------------------------
// Function : GetComputerList
// Purpose : get a computer list
if (_personal_module_list[ind].type == _temp_component_type)
{
_list_typed_component->length(_j + 1);
- _list_typed_component[_j] = (_moduleList[ind].name).c_str();
+ _list_typed_component[_j] = _personal_module_list[ind].name.c_str();
//if(MYDEBUG) SCRUTE(_list_typed_component[_j]);
_j++;
}
std::string s(name);
ParserComponent *C_parser = NULL;
- //ParserPathPrefixes *pp = NULL; // VSR : commented : unused variable
+ //ParserPathPrefixes *pp = NULL;
SALOME_ModuleCatalog::Acomponent_ptr compo
= SALOME_ModuleCatalog::Acomponent::_nil();
// DebugParserComponent(*C_parser);
- SALOME_ModuleCatalog::Component C_corba;
+ SALOME_ModuleCatalog::ComponentDef C_corba;
duplicate(C_corba, *C_parser);
return compo;
}
-SALOME_ModuleCatalog::Component *
+SALOME_ModuleCatalog::ComponentDef *
SALOME_ModuleCatalogImpl::GetComponentInfo(const char *name)
{
std::string s(name);
if (C_parser) {
- SALOME_ModuleCatalog::Component * C_corba
- = new SALOME_ModuleCatalog::Component;
+ SALOME_ModuleCatalog::ComponentDef * C_corba
+ = new SALOME_ModuleCatalog::ComponentDef;
duplicate(*C_corba, *C_parser);
return C_corba;
}
return NULL;
}
+CORBA::Long SALOME_ModuleCatalogImpl::getPID()
+{
+ return (CORBA::Long)getpid();
+}
+
+void SALOME_ModuleCatalogImpl::ShutdownWithExit()
+{
+ exit( EXIT_SUCCESS );
+}
+
ParserComponent *
SALOME_ModuleCatalogImpl::findComponent(const string & name)
{
void
SALOME_ModuleCatalogImpl::_parse_xml_file(const char* file,
ParserComponents& modulelist,
- ParserPathPrefixes& pathList)
+ ParserPathPrefixes& pathList,
+ ParserTypes& typeMap,
+ TypeList& typeList)
{
if(MYDEBUG) BEGIN_OF("_parse_xml_file");
if(MYDEBUG) SCRUTE(file);
- SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler();
- QFile xmlFile(file);
+ //Local path and module list for the file to parse
+ ParserPathPrefixes _pathList;
+ ParserComponents _moduleList;
+
+ SALOME_ModuleCatalog_Handler* handler = new SALOME_ModuleCatalog_Handler(_pathList,_moduleList,typeMap,typeList);
- QXmlInputSource source(&xmlFile);
-
- QXmlSimpleReader reader;
- reader.setContentHandler( handler );
- reader.setErrorHandler( handler );
- reader.parse( source );
- xmlFile.close();
+ FILE* aFile = fopen(file, "r");
+ if (aFile != NULL)
+ {
+ xmlDocPtr aDoc = xmlReadFile(file, NULL, 0);
+
+ if (aDoc != NULL)
+ handler->ProcessXmlDocument(aDoc);
+ else
+ INFOS("ModuleCatalog: could not parse file "<<file);
+
+ xmlFreeDoc(aDoc);
+ xmlCleanupParser();
+ fclose(aFile);
+ }
+ else
+ INFOS("ModuleCatalog: file "<<file<<" is not readable.");
+
+ delete handler;
+
unsigned int i, j;
for ( i = 0; i < _moduleList.size(); i++) {
void
SALOME_ModuleCatalogImpl::ImportXmlCatalogFile(const char* file)
{
- _parse_xml_file(file, _personal_module_list, _personal_path_list);
+ _parse_xml_file(file, _personal_module_list, _personal_path_list,_typeMap,_typeList);
}
// Purpose : create a component from the catalog parsing
//----------------------------------------------------------------------
void SALOME_ModuleCatalogImpl::duplicate
-(SALOME_ModuleCatalog::Component & C_corba,
+(SALOME_ModuleCatalog::ComponentDef & C_corba,
const ParserComponent & C_parser)
{
C_corba.name = CORBA::string_dup(C_parser.name.c_str());
}
return _return_value;
}
-
-
*/
virtual SALOME_ModuleCatalog::ListOfComputers* GetComputerList();
+ //! method to get the list of all types of the catalog
+ /*!
+ * \return the types list
+ */
+ virtual SALOME_ModuleCatalog::ListOfTypeDefinition* GetTypes();
+
//! method to get the PathPrefix of a computer
/*! If the wanted computer doesn't exist, the Notfound exception is thrown
\param machinename const char* arguments
\param componentname const char* arguments
\return the wanted component description
*/
- virtual SALOME_ModuleCatalog::Component *
+ virtual SALOME_ModuleCatalog::ComponentDef *
GetComponentInfo(const char *name);
void ping(){};
+ CORBA::Long getPID();
+ void ShutdownWithExit();
- void shutdown() { if (_orb) _orb->shutdown(1); };
+ void shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); };
private:
//! method to parse one module catalog
\param file const char* arguments
\param modulelist ParserComponents arguments
\param pathlist ParserPathPrefixes arguments
+ \param typeMap ParserTypes arguments
*/
virtual void _parse_xml_file(const char* file,
ParserComponents & modulelist,
- ParserPathPrefixes & pathlist);
+ ParserPathPrefixes & pathlist,
+ ParserTypes& typeMap,
+ TypeList& typeList);
//! method to find component in the parser list
/*!
\param C_corba Component argument
\param C_parser const ParserComponent argument
*/
- void duplicate(SALOME_ModuleCatalog::Component & C_corba,
+ void duplicate(SALOME_ModuleCatalog::ComponentDef & C_corba,
const ParserComponent & C_parser);
//! method to create a CORBA interface description from parser
// These variables will contain the informations on the general common catalog
ParserComponents _general_module_list ;
ParserPathPrefixes _general_path_list ;
+ ParserTypes _typeMap;
+ TypeList _typeList;
// These variables will contain the informations on the personal catalog
ParserComponents _personal_module_list ;
// --- _current_context is replaced to the _root_context
// if the Path begins whith '/'
- if (Path[0] == '/')
- {
- _current_context = _root_context;
- }
+ if (Path[0] == '/'){
+ _current_context = _root_context;
+ }
// --- the resolution of the directory path has to be done
// to place the current_context to the correct node
CORBA::Boolean not_exist = false;
- if (dimension_resultat > 0)
- {
- // A directory is treated (not only an object name)
- // test if the directory where ObjRef should be recorded already exists
- // If not, create the new context
-
- try
- {
- CORBA::Object_var obj = _current_context->resolve(context_name);
- _current_context = CosNaming::NamingContext::_narrow(obj);
- }
-
- catch (CosNaming::NamingContext::NotFound &)
- {
- // --- failed to resolve, therefore assume cold start
- not_exist = true;
- }
-
- catch (CosNaming::NamingContext::InvalidName &)
- {
- INFOS("Register() : CosNaming::NamingContext::InvalidName");
- }
-
- catch (CosNaming::NamingContext::CannotProceed &)
- {
- INFOS("Register() : CosNaming::NamingContext::CannotProceed");
- }
-
- catch (CORBA::SystemException&)
- {
- INFOS("Register() : CORBA::SystemException: "
- << "unable to contact the naming service");
- throw ServiceUnreachable();
- }
-
- if (not_exist)
- {
- try
- {
- context_name.length(1);
- for (int i = 0 ; i < dimension_resultat ;i++)
- {
- context_name[0].id =
- CORBA::string_dup(splitPath[i].c_str());
- context_name[0].kind = CORBA::string_dup("dir");
- // SCRUTE(_context_name[0].id);
- // --- check if the path is created
- try
- {
- // --- if the context is already created, nothing to do
- CORBA::Object_var obj =
- _current_context->resolve(context_name);
- _current_context =
- CosNaming::NamingContext::_narrow(obj);
- }
-
- catch (CosNaming::NamingContext::NotFound &)
- {
- // --- the context must be created
- CosNaming::NamingContext_var temp_context =
- _current_context->bind_new_context(context_name);
- _current_context = temp_context;
- }
- }
- }
-
- catch (CosNaming::NamingContext::AlreadyBound&)
- {
- INFOS("Register() : CosNaming::NamingContext::AlreadyBound");
- }
-
- catch (CosNaming::NamingContext::NotFound& ex)
- {
- CosNaming::Name n = ex.rest_of_name;
-
- if (ex.why == CosNaming::NamingContext::missing_node)
- INFOS("Register() : " << (char *) n[0].id
- << " (" << (char *) n[0].kind << ") not found");
+ if (dimension_resultat > 0){
+ // A directory is treated (not only an object name)
+ // test if the directory where ObjRef should be recorded already exists
+ // If not, create the new context
+
+ try{
+ CORBA::Object_var obj = _current_context->resolve(context_name);
+ _current_context = CosNaming::NamingContext::_narrow(obj);
+ }
- if (ex.why == CosNaming::NamingContext::not_context)
- INFOS("Register() : " << (char *) n[0].id
- << " (" << (char *) n[0].kind
- << ") is not a context");
+ catch (CosNaming::NamingContext::NotFound &){
+ // --- failed to resolve, therefore assume cold start
+ not_exist = true;
+ }
- if (ex.why == CosNaming::NamingContext::not_object)
- INFOS("Register() : " << (char *) n[0].id
- << " (" << (char *) n[0].kind
- << ") is not an object");
- }
+ catch (CosNaming::NamingContext::InvalidName &){
+ INFOS("Register() : CosNaming::NamingContext::InvalidName");
+ }
- catch (CosNaming::NamingContext::CannotProceed&)
- {
- INFOS("Register(): CosNaming::NamingContext::CannotProceed");
- }
+ catch (CosNaming::NamingContext::CannotProceed &){
+ INFOS("Register() : CosNaming::NamingContext::CannotProceed");
+ }
- catch (CosNaming::NamingContext::InvalidName&)
- {
- INFOS("Register(): CosNaming::NamingContext::InvalidName");
- }
+ catch (CORBA::SystemException&){
+ INFOS("Register() : CORBA::SystemException: "
+ << "unable to contact the naming service");
+ throw ServiceUnreachable();
+ }
- catch (CORBA::SystemException&)
- {
- INFOS("Register():CORBA::SystemException: "
- << "unable to contact the naming service");
- throw ServiceUnreachable();
- }
- }
+ if (not_exist){
+ try{
+ context_name.length(1);
+ for (int i = 0 ; i < dimension_resultat ;i++){
+ context_name[0].id = CORBA::string_dup(splitPath[i].c_str());
+ context_name[0].kind = CORBA::string_dup("dir");
+ // SCRUTE(_context_name[0].id);
+ // --- check if the path is created
+ try{
+ // --- if the context is already created, nothing to do
+ CORBA::Object_var obj = _current_context->resolve(context_name);
+ _current_context = CosNaming::NamingContext::_narrow(obj);
+ }
+
+ catch (CosNaming::NamingContext::NotFound &){
+ try{
+ // --- the context must be created
+ CosNaming::NamingContext_var temp_context =
+ _current_context->bind_new_context(context_name);
+ _current_context = temp_context;
+ }
+ catch (CosNaming::NamingContext::AlreadyBound&){
+ CORBA::Object_var obj = _current_context->resolve(context_name);
+ _current_context = CosNaming::NamingContext::_narrow(obj);
+ }
+ }
+ }
+ }
+
+ catch (CosNaming::NamingContext::AlreadyBound&){
+ INFOS("Register() : CosNaming::NamingContext::AlreadyBound");
+ }
+
+ catch (CosNaming::NamingContext::NotFound& ex){
+ CosNaming::Name n = ex.rest_of_name;
+
+ if (ex.why == CosNaming::NamingContext::missing_node)
+ INFOS("Register() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind << ") not found");
+
+ if (ex.why == CosNaming::NamingContext::not_context)
+ INFOS("Register() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not a context");
+
+ if (ex.why == CosNaming::NamingContext::not_object)
+ INFOS("Register() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not an object");
+ }
+
+ catch (CosNaming::NamingContext::CannotProceed&){
+ INFOS("Register(): CosNaming::NamingContext::CannotProceed");
+ }
+
+ catch (CosNaming::NamingContext::InvalidName&){
+ INFOS("Register(): CosNaming::NamingContext::InvalidName");
+ }
+
+ catch (CORBA::SystemException&){
+ INFOS("Register():CORBA::SystemException: "
+ << "unable to contact the naming service");
+ throw ServiceUnreachable();
+ }
}
+ }
// --- The current directory is now the directory where the object should
// be recorded
int sizePath = splitPath.size();
- if (sizePath > dimension_resultat)
- {
- ASSERT(sizePath == dimension_resultat+1);
- context_name.length(1);
+ if (sizePath > dimension_resultat){
+ ASSERT(sizePath == dimension_resultat+1);
+ context_name.length(1);
- try
- {
- // --- the last element is an object and not a directory
+ try{
+ // --- the last element is an object and not a directory
- context_name[0].id =
- CORBA::string_dup(splitPath[dimension_resultat].c_str());
- context_name[0].kind = CORBA::string_dup("object");
- //SCRUTE(context_name[0].id);
+ context_name[0].id = CORBA::string_dup(splitPath[dimension_resultat].c_str());
+ context_name[0].kind = CORBA::string_dup("object");
+ //SCRUTE(context_name[0].id);
- _current_context->bind(context_name, ObjRef);
- }
+ _current_context->bind(context_name, ObjRef);
+ }
- catch (CosNaming::NamingContext::NotFound& ex)
- {
- CosNaming::Name n = ex.rest_of_name;
+ catch (CosNaming::NamingContext::NotFound& ex){
+ CosNaming::Name n = ex.rest_of_name;
- if (ex.why == CosNaming::NamingContext::missing_node)
- INFOS("Register() : " << (char *) n[0].id
- << " (" << (char *) n[0].kind << ") not found");
+ if (ex.why == CosNaming::NamingContext::missing_node)
+ INFOS("Register() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind << ") not found");
- if (ex.why == CosNaming::NamingContext::not_context)
- INFOS("Register() : " << (char *) n[0].id
- << " (" << (char *) n[0].kind
- << ") is not a context");
+ if (ex.why == CosNaming::NamingContext::not_context)
+ INFOS("Register() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not a context");
- if (ex.why == CosNaming::NamingContext::not_object)
- INFOS("Register() : " << (char *) n[0].id
- << " (" << (char *) n[0].kind
- << ") is not an object");
- }
+ if (ex.why == CosNaming::NamingContext::not_object)
+ INFOS("Register() : " << (char *) n[0].id
+ << " (" << (char *) n[0].kind
+ << ") is not an object");
+ }
- catch (CosNaming::NamingContext::CannotProceed&)
- {
- INFOS("Register(): CosNaming::NamingContext::CannotProceed");
- }
+ catch (CosNaming::NamingContext::CannotProceed&){
+ INFOS("Register(): CosNaming::NamingContext::CannotProceed");
+ }
- catch (CosNaming::NamingContext::InvalidName&)
- {
- INFOS("Register(): CosNaming::NamingContext::InvalidName");
- }
+ catch (CosNaming::NamingContext::InvalidName&){
+ INFOS("Register(): CosNaming::NamingContext::InvalidName");
+ }
- catch (CosNaming::NamingContext::AlreadyBound&)
- {
- INFOS("Register(): CosNaming::NamingContext::AlreadyBound, "
- << "object will be rebind");
- _current_context->rebind(context_name, ObjRef);
- }
+ catch (CosNaming::NamingContext::AlreadyBound&){
+ INFOS("Register(): CosNaming::NamingContext::AlreadyBound, "
+ << "object will be rebind");
+ _current_context->rebind(context_name, ObjRef);
+ }
- catch (CORBA::SystemException&)
- {
- INFOS("!!!Register(): CORBA::SystemException: "
- << "unable to contact the naming service");
- throw ServiceUnreachable();
- }
+ catch (CORBA::SystemException&){
+ INFOS("!!!Register(): CORBA::SystemException: "
+ << "unable to contact the naming service");
+ throw ServiceUnreachable();
}
+ }
}
// ============================================================================
vector<string> dirList ;
- string currentDir = Current_Directory();
+ char* currentDir = Current_Directory();
_list_directory_recurs(dirList, "", currentDir);
+ free(currentDir);
+
return dirList;
}
{
// --- directory, search in it
- splitPath.push_back(CORBA::string_dup(bindingName[0].id));
+ const char* bindingNameid=bindingName[0].id;
+ splitPath.push_back(bindingNameid);
lengthResult++;
CORBA::Object_var obj = _current_context->resolve(bindingName);
from SALOME_utilities import *
#=============================================================================
-class SALOME_NamingServicePy_i:
+class SALOME_NamingServicePy_i(object):
_orb = None
_root_context=None
_current_context=None
if steps == 0 and self._root_context is None:
MESSAGE ( "Name Service Reference is invalid" )
sys.exit(1)
+
#-------------------------------------------------------------------------
+
def Register(self,ObjRef, Path):
+ """ ns.Register(object,pathname )
+
+ register a CORBA object under a pathname
+ """
+
MESSAGE ( "SALOME_NamingServicePy_i::Register" )
_not_exist = 0
path_list = list(Path)
except (CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE):
MESSAGE ( "Register : CORBA.TRANSIENT,CORBA.OBJECT_NOT_EXIST,CORBA.COMM_FAILURE" )
-
#-------------------------------------------------------------------------
+
def Resolve(self, Path):
+ """ ns.Resolve(pathname) -> object
+
+ find a CORBA object (ior) by its pathname
+ """
#MESSAGE ( "SALOME_NamingServicePy_i::Resolve" )
path_list = list(Path)
if path_list[0]=='/':
return self._obj
-
#-------------------------------------------------------------------------
+
def Create_Directory(self,ObjRef, Path):
MESSAGE ( "SALOME_NamingServicePy_i::Create_Directory" )
_not_exist = 0
#
import sys, os,signal,string,commands
import runSalome
+import setenv
import orbmodule
import TestKiller
# get SALOME environment :
-args, modules_list, modules_root_dir = runSalome.get_config()
-runSalome.set_env(args, modules_list, modules_root_dir)
+args, modules_list, modules_root_dir = setenv.get_config()
+setenv.set_env(args, modules_list, modules_root_dir)
# set environment for trace in logger
# (with file, servers may be killed before the write to the file...)
#
# header files
salomeinclude_HEADERS = SALOME_ParallelComponent_i.hxx \
- SALOME_ParallelContainer_i.hxx
+ SALOME_ParallelContainer_i.hxx \
+ Parallel_Salome_file_i.hxx
#
# ===============================================================
-I$(top_srcdir)/src/NamingService \
-I$(top_srcdir)/src/Registry \
-I$(top_srcdir)/src/Utils \
+ -I$(srcdir)/../HDFPersist \
-I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
-I$(top_srcdir)/src/SALOMETraceCollector \
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS = $(top_builddir)/src/Container/libSalomeContainer.la \
+ $(top_builddir)/src/HDFPersist/libSalomeHDFPersist.la \
$(top_builddir)/idl/libSalomeParallelIDLKernel.la \
+ $(top_builddir)/idl/libSalomeIDLKernel.la \
@CORBA_LIBS@ \
@PACO_LIBS@
lib_LTLIBRARIES = libSalomeParallelContainer.la
libSalomeParallelContainer_la_SOURCES = SALOME_ParallelComponent_i.cxx \
- SALOME_ParallelContainer_i.cxx
+ SALOME_ParallelContainer_i.cxx \
+ $(top_srcdir)/src/Container/Salome_file_i.cxx \
+ Parallel_Salome_file_i.cxx
libSalomeParallelContainer_la_CXXFLAGS = $(COMMON_CPPFLAGS)
SALOME_ParallelContainerProxyDummy_SOURCES = SALOME_ParallelContainerProxyDummy.cxx
SALOME_ParallelContainerProxyDummy_CXXFLAGS = $(COMMON_CPPFLAGS)
SALOME_ParallelContainerProxyDummy_LDADD = libSalomeParallelContainer.la \
- -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_omnithread
+ -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_omnithread \
+ $(COMMON_LIBS)
SALOME_ParallelContainerNodeDummy_SOURCES = SALOME_ParallelContainerNodeDummy.cxx
SALOME_ParallelContainerNodeDummy_CXXFLAGS = $(COMMON_CPPFLAGS)
SALOME_ParallelContainerNodeDummy_LDADD = libSalomeParallelContainer.la \
- -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_omnithread
+ -L@PACOPATH@/lib -lPaCO_dummy -lPaCO_omnithread \
+ $(COMMON_LIBS)
SALOME_ParallelContainerProxyMpi_SOURCES = SALOME_ParallelContainerProxyMpi.cxx
SALOME_ParallelContainerProxyMpi_CXXFLAGS = $(COMMON_CPPFLAGS) @MPI_INCLUDES@
SALOME_ParallelContainerProxyMpi_LDADD = libSalomeParallelContainer.la \
-L@PACOPATH@/lib -lPaCO_dummy -lPaCO_mpi -lPaCO_omnithread \
- @MPI_LIBS@
+ @MPI_LIBS@ \
+ $(COMMON_LIBS)
+
SALOME_ParallelContainerNodeMpi_SOURCES = SALOME_ParallelContainerNodeMpi.cxx
SALOME_ParallelContainerNodeMpi_CXXFLAGS = $(COMMON_CPPFLAGS) @MPI_INCLUDES@
SALOME_ParallelContainerNodeMpi_LDADD = libSalomeParallelContainer.la \
-L@PACOPATH@/lib -lPaCO_dummy -lPaCO_mpi -lPaCO_omnithread \
- @MPI_LIBS@
+ @MPI_LIBS@\
+ $(COMMON_LIBS)
+
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA 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 : Parallel_Salome_file_i.cxx
+// Author : André RIBES, EDF
+// Module : SALOME
+// $Header:
+
+#include "Parallel_Salome_file_i.hxx"
+#include "utilities.h"
+
+Parallel_Salome_file_i::Parallel_Salome_file_i(CORBA::ORB_ptr orb, const char * ior) :
+ InterfaceParallel_impl(orb,ior),
+ Engines::Salome_file_serv(orb,ior),
+ Engines::fileTransfer_serv(orb,ior),
+ Engines::Parallel_Salome_file_serv(orb,ior)
+{
+ CORBA::Object_ptr obj = _orb->string_to_object(ior);
+ proxy = Engines::Parallel_Salome_file::_narrow(obj);
+ parallel_file = NULL;
+}
+
+Parallel_Salome_file_i::~Parallel_Salome_file_i() {}
+
+void
+Parallel_Salome_file_i::load(const char* hdf5_file) {
+ MESSAGE("Parallel_Salome_file_i::load : NOT YET IMPLEMENTED");
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "Parallel_Salome_file_i::load : NOT YET IMPLEMENTED";
+ throw SALOME::SALOME_Exception(es);
+}
+
+void
+Parallel_Salome_file_i::save(const char* hdf5_file) {
+ MESSAGE("Parallel_Salome_file_i::save : NOT YET IMPLEMENTED");
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "Parallel_Salome_file_i::save : NOT YET IMPLEMENTED";
+ throw SALOME::SALOME_Exception(es);
+}
+
+void
+Parallel_Salome_file_i::save_all(const char* hdf5_file) {
+ MESSAGE("Parallel_Salome_file_i::save_all : NOT YET IMPLEMENTED");
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "Parallel_Salome_file_i::save_all : NOT YET IMPLEMENTED";
+ throw SALOME::SALOME_Exception(es);
+}
+
+void
+Parallel_Salome_file_i::connect(Engines::Salome_file_ptr source_Salome_file) {
+ // only one file managed case
+ Salome_file_i::connect(source_Salome_file);
+
+ // Test if the file is managed in an another node
+ // If yes, node is updated
+ _t_fileManaged::iterator begin = _fileManaged.begin();
+ _t_fileManaged::iterator end = _fileManaged.end();
+ for(;begin!=end;begin++) {
+ std::string file_name = begin->first;
+ if (_fileManaged[file_name].node > 0 && getMyRank() == 0) {
+ if (parallel_file == NULL)
+ parallel_file = Engines::PaCO_Parallel_Salome_file::PaCO_narrow(proxy, _orb);
+ parallel_file->connect(source_Salome_file, _fileManaged[file_name].node);
+ }
+ }
+}
+
+void
+Parallel_Salome_file_i::connectDistributedFile(const char * file_name,
+ Engines::Salome_file_ptr source_Salome_file) {
+ Salome_file_i::connectDistributedFile(file_name, source_Salome_file);
+
+ // Test if the file is managed in an another node
+ // If yes, node is updated
+ std::string fname(file_name);
+ if (_fileManaged[fname].node > 0 && getMyRank() == 0) {
+ if (parallel_file == NULL)
+ parallel_file = Engines::PaCO_Parallel_Salome_file::PaCO_narrow(proxy, _orb);
+ parallel_file->connectDistributedFile(file_name, source_Salome_file, _fileManaged[fname].node);
+ }
+}
+
+void
+Parallel_Salome_file_i::setDistributedSourceFile(const char* file_name,
+ const char * source_file_name) {
+ Salome_file_i::setDistributedSourceFile(file_name, source_file_name);
+ // Test if the file is managed in an another node
+ // If yes, node is updated
+ std::string fname(file_name);
+ if (_fileManaged[fname].node > 0 && getMyRank() == 0) {
+ if (parallel_file == NULL)
+ parallel_file = Engines::PaCO_Parallel_Salome_file::PaCO_narrow(proxy, _orb);
+ parallel_file->setDistributedSourceFile(file_name, source_file_name, _fileManaged[fname].node);
+ }
+}
+
+void
+Parallel_Salome_file_i::recvFiles() {
+ if (parallel_file == NULL)
+ parallel_file = Engines::PaCO_Parallel_Salome_file::PaCO_narrow(proxy, _orb);
+
+ std::string files_not_ok("");
+ int total = getTotalNode();
+ for (int i =0; i<total; i++) {
+ try {
+ parallel_file->recvFiles_node(i);
+ }
+ catch (SALOME::SALOME_Exception & ex) {
+ files_not_ok = files_not_ok + std::string(ex.details.text.in());
+ }
+ }
+
+ if (files_not_ok != "")
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = "files not ready : " + files_not_ok;
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ }
+ else
+ {
+ // We change the state of the Salome_file
+ _state.files_ok = true;
+ }
+}
+
+void
+Parallel_Salome_file_i::recvFiles_node() {
+
+ std::string files_not_ok("");
+ _t_fileManaged::iterator begin = _fileManaged.begin();
+ _t_fileManaged::iterator end = _fileManaged.end();
+ for(;begin!=end;begin++)
+ {
+ bool result = true;
+ Engines::file file_infos = begin->second;
+ if (file_infos.node == getMyRank()) {
+ // Test if the file is local or distributed
+ if (std::string(file_infos.type.in()) == "local")
+ {
+ if (std::string(file_infos.status.in()) == "not_ok")
+ result = checkLocalFile(file_infos.file_name.in());
+ }
+ else
+ {
+ if (std::string(file_infos.status.in()) == "not_ok") {
+ // 2 cases :
+ // Source file is a Salome_file
+ // Source file is a Parallel_Salome_file
+ PaCO::ParallelKernel_var interface_manager =
+ PaCO::ParallelKernel::_narrow(_fileDistributedSource[file_infos.file_name.in()]);
+ if (CORBA::is_nil(interface_manager))
+ result = getDistributedFile(file_infos.file_name.in());
+ else
+ result = getParallelDistributedFile(file_infos.file_name.in());
+ }
+ }
+ // if the result is false
+ // we add this file to files_not_ok
+ if (!result)
+ {
+ files_not_ok.append(" ");
+ files_not_ok.append(file_infos.file_name.in());
+ }
+ }
+ }
+ if (files_not_ok != "")
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ std::string text = files_not_ok;
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+ }
+}
+
+bool
+Parallel_Salome_file_i::getParallelDistributedFile(std::string file_name) {
+
+ bool result = true;
+ const char * source_file_name = _fileManaged[file_name].source_file_name.in();
+ int fileId;
+ FILE* fp;
+ std::string comp_file_name(_fileManaged[file_name].path.in());
+ comp_file_name.append("/");
+ comp_file_name.append(_fileManaged[file_name].file_name.in());
+
+ // Test if the process can write on disk
+ if ((fp = fopen(comp_file_name.c_str(),"wb")) == NULL)
+ {
+ INFOS("file " << comp_file_name << " cannot be open for writing");
+ _fileManaged[file_name].status = CORBA::string_dup("not_ok");
+ result = false;
+ return result;
+ }
+
+ Engines::PaCO_Parallel_Salome_file * parallel_source_file =
+ Engines::PaCO_Parallel_Salome_file::PaCO_narrow(_fileDistributedSource[file_name], _orb);
+
+ int node = parallel_source_file->getFileNode(source_file_name);
+
+ try
+ {
+ fileId = parallel_source_file->open(source_file_name, node);
+ }
+ catch (...)
+ {
+ _fileManaged[file_name].status = CORBA::string_dup("not_ok");
+ fclose(fp);
+ result = false;
+ return result;
+ }
+
+ if (fileId > 0)
+ {
+ Engines::fileBlock* aBlock;
+ int toFollow = 1;
+ int ctr=0;
+ MESSAGE("begin of transfer of " << comp_file_name);
+ while (toFollow)
+ {
+ ctr++;
+ aBlock = parallel_source_file->getBlock(fileId, node);
+ toFollow = aBlock->length();
+ CORBA::Octet *buf = aBlock->get_buffer();
+ int nbWri = fwrite(buf, sizeof(CORBA::Octet), toFollow, fp);
+ ASSERT(nbWri == toFollow);
+ }
+ fclose(fp);
+ MESSAGE("end of transfer of " << comp_file_name);
+ parallel_source_file->close(fileId, node);
+ }
+ else
+ {
+ INFOS("open reference file for copy impossible");
+ result = false;
+ fclose(fp);
+ _fileManaged[file_name].status = CORBA::string_dup("not_ok");
+ return result;
+ }
+
+ _fileManaged[file_name].status = CORBA::string_dup("ok");
+ return result;
+}
+
+void
+Parallel_Salome_file_i::setContainer(Engines::Container_ptr container) {
+ _container = Engines::Container::_duplicate(container);
+
+ // Update All the files managed by the node
+ _t_fileManaged::iterator begin = _fileManaged.begin();
+ _t_fileManaged::iterator end = _fileManaged.end();
+ for(;begin!=end;begin++) {
+ begin->second.container = Engines::Container::_duplicate(container);
+ }
+}
+
+void
+Parallel_Salome_file_i::setFileNode(const char* file_name, CORBA::Long node) {
+
+ // Test if this file is managed
+ std::string fname(file_name);
+ _t_fileManaged::iterator it = _fileManaged.find(fname);
+ if (it == _fileManaged.end())
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "file is not managed";
+ throw SALOME::SALOME_Exception(es);
+ }
+
+ // Update file infos into this node (node 0)
+ // and into the node that actually managed it
+ _fileManaged[fname].node = node;
+
+ if (node > 0) {
+ if (parallel_file == NULL)
+ parallel_file = Engines::PaCO_Parallel_Salome_file::PaCO_narrow(proxy, _orb);
+
+ Engines::Container_ptr cont = parallel_file->updateFile(_fileManaged[fname], node);
+ parallel_file->connectDistributedFile(fname.c_str(),
+ _fileDistributedSource[fname],
+ node);
+
+ // Update file infos with the new reference of the container
+ _fileManaged[fname].container = Engines::Container::_duplicate(cont);
+ }
+}
+
+Engines::Container_ptr
+Parallel_Salome_file_i::updateFile(const Engines::file& file) {
+ // Copy file
+ Engines::file new_file_infos(file);
+
+ // Adding it to node list
+ new_file_infos.container = Engines::Container::_duplicate(_container);
+ std::string fname(new_file_infos.file_name.in());
+ _fileManaged[fname] = new_file_infos;
+
+ // Return the new reference of the container associated to the file
+ return Engines::Container::_duplicate(_container);
+}
+
+CORBA::Long
+Parallel_Salome_file_i::getFileNode(const char* file_name) {
+
+ // Test if this file is managed
+ std::string fname(file_name);
+ if (fname == "") {
+ // We enter in the simple case where the user
+ // has not used setDistributedSourceFile.
+ // In this case we try to see if the Salome_file
+ if (_fileManaged.size() == 1)
+ {
+ // only one file managed
+ _t_fileManaged::iterator it = _fileManaged.begin();
+ fname = it->first;
+ }
+ else
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "Error : there is more than one file that is managed";
+ throw SALOME::SALOME_Exception(es);
+ }
+ }
+ _t_fileManaged::iterator it = _fileManaged.find(fname);
+ if (it == _fileManaged.end())
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "file is not managed";
+ throw SALOME::SALOME_Exception(es);
+ }
+
+ return _fileManaged[fname].node;
+}
--- /dev/null
+// Copyright (C) 2007 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA 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 : Parallel_Salome_file_i.hxx
+// Author : André RIBES, EDF
+// Module : SALOME
+// $Header:
+
+#ifndef _PARALLEL_SALOME_FILE_I_HXX_
+#define _PARALLEL_SALOME_FILE_I_HXX_
+
+#include <SALOMEconfig.h>
+#include <SALOME_Container.hxx>
+#include <map>
+#include <cstdio>
+
+#include "SALOME_ComponentPaCO_Engines_Parallel_Salome_file_server.h"
+#include "Salome_file_i.hxx"
+
+class CONTAINER_EXPORT Parallel_Salome_file_i:
+ public virtual Salome_file_i,
+ public virtual Engines::Parallel_Salome_file_serv
+{
+ public:
+ Parallel_Salome_file_i(CORBA::ORB_ptr orb, const char * ior);
+ virtual ~Parallel_Salome_file_i();
+
+ virtual void setFileNode(const char* file_name, CORBA::Long node);
+ virtual CORBA::Long getFileNode(const char* file_name);
+ virtual Engines::Container_ptr updateFile(const Engines::file& file);
+
+ // New implementation for these methods
+ // For the parallel cases
+ virtual void load(const char* hdf5_file);
+ virtual void save(const char* hdf5_file);
+ virtual void save_all(const char* hdf5_file);
+ virtual void connect(Engines::Salome_file_ptr source_Salome_file);
+ virtual void connectDistributedFile(const char * file_name,
+ Engines::Salome_file_ptr source_Salome_file);
+ virtual void setDistributedSourceFile(const char* file_name,
+ const char * source_file_name);
+ virtual void recvFiles();
+ virtual void recvFiles_node();
+ virtual void setContainer(Engines::Container_ptr container);
+ //virtual void removeFile(const char* file_name);
+ //virtual void removeFiles();
+
+ // Local C++ methods
+ virtual bool getParallelDistributedFile(std::string file_name);
+
+ private :
+ Engines::Parallel_Salome_file_var proxy;
+ Engines::PaCO_Parallel_Salome_file * parallel_file;
+};
+
+#endif
+
int SIGUSR11 = 1000;
#endif
+#include <paco_dummy.h>
using namespace std;
//=============================================================================
Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior) :
- InterfaceParallel_impl(orb,ior), Engines::Component_serv(orb,ior)
+ InterfaceParallel_impl(orb,ior), Engines::Component_serv(orb,ior), Engines::Parallel_Component_serv(orb,ior)
{
//ASSERT(0);
INFOS("Default Constructor...");
const char *instanceName,
const char *interfaceName,
bool notif) :
- InterfaceParallel_impl(orb,ior), Engines::Component_serv(orb,ior),
+ InterfaceParallel_impl(orb,ior),
+ Engines::Component_serv(orb,ior),
+ Engines::Parallel_Component_serv(orb,ior),
_instanceName(instanceName),
_interfaceName(interfaceName),
_myConnexionToRegistry(0),
_instanceName.c_str());
_notifSupplier = new NOTIFICATION_Supplier(instanceName, notif);
- //SCRUTE(pd_refCount);
+
+ deploy_mutex = new pthread_mutex_t();
+ pthread_mutex_init(deploy_mutex, NULL);
+ _proxy = NULL;
+ //SCRUTE(pd_refCount);
}
//=============================================================================
{
MESSAGE("Component destructor");
Engines_Parallel_Container_i::decInstanceCnt(_interfaceName);
+ pthread_mutex_destroy(deploy_mutex);
+ delete deploy_mutex;
+
+ if (_proxy)
+ delete _proxy;
}
//=============================================================================
(*it).second >>= value;
// ---todo: replace __GNUC__ test by an autoconf macro AC_CHECK_FUNC.
#if defined __GNUC__
- int ret = setenv(cle.c_str(), value, overwrite);
+ //int ret = setenv(cle.c_str(), value, overwrite);
+ setenv(cle.c_str(), value, overwrite);
#else
//CCRT porting : setenv not defined in stdlib.h
std::string s(cle);
s+=value;
// char* cast because 1st arg of linux putenv function
// is not a const char* !
- int ret=putenv((char *)s.c_str());
+ //int ret=putenv((char *)s.c_str());
+ putenv((char *)s.c_str());
//End of CCRT porting
#endif
MESSAGE("--- setenv: "<<cle<<" = "<< value);
//=============================================================================
Engines::TMPFile* Engines_Parallel_Component_i::DumpPython(CORBA::Object_ptr theStudy,
- CORBA::Boolean isPublished,
- CORBA::Boolean& isValidScript)
+ CORBA::Boolean isPublished,
+ CORBA::Boolean& isValidScript)
{
- char* aScript = "def RebuildData(theStudy): pass";
+ const char* aScript = "def RebuildData(theStudy): pass";
char* aBuffer = new char[strlen(aScript)+1];
strcpy(aBuffer, aScript);
CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
isValidScript = true;
return aStreamFile._retn();
}
+
+
+Engines::Salome_file_ptr
+Engines_Parallel_Component_i::setInputFileToService(const char* service_name,
+ const char* Salome_file_name)
+{
+ // Try to find the service, if it doesn't exist, we add it.
+ _Service_file_map_it = _Input_Service_file_map.find(service_name);
+ if (_Service_file_map_it == _Input_Service_file_map.end()) {
+ _t_Salome_file_map * _map = new _t_Salome_file_map();
+ _Input_Service_file_map[service_name] = _map;
+ _t_Proxy_Salome_file_map * _proxy_map = new _t_Proxy_Salome_file_map();
+ _Proxy_Input_Service_file_map[service_name] = _proxy_map;
+ _t_IOR_Proxy_Salome_file_map * _IOR_proxy_map = new _t_IOR_Proxy_Salome_file_map();
+ _IOR_Proxy_Input_Service_file_map[service_name] = _IOR_proxy_map;
+ }
+ _t_Salome_file_map * _map = _Input_Service_file_map[service_name];
+ _t_Proxy_Salome_file_map * _proxy_map = _Proxy_Input_Service_file_map[service_name];
+ _t_IOR_Proxy_Salome_file_map * _IOR_proxy_map = _IOR_Proxy_Input_Service_file_map[service_name];
+
+ pthread_mutex_lock(deploy_mutex);
+ std::string proxy_ior;
+
+ // Try to find the Salome_file ...
+ _Salome_file_map_it = _map->find(Salome_file_name);
+ if (_Salome_file_map_it == _map->end()) {
+
+ // We create a new PaCO++ object.
+ // He has the same configuration than
+ // his component
+
+ // Firstly, we have to create the proxy object
+ // of the Salome_file and transmit his
+ // reference to the other nodes.
+ if (getMyRank() == 0) {
+ Engines::Parallel_Salome_file_proxy_impl * proxy =
+ new Engines::Parallel_Salome_file_proxy_impl(CORBA::ORB::_duplicate(_orb));
+ PaCO_operation * proxy_global_ptr = proxy->getContext("global_paco_context");
+ // We initialize the object with the context of the Parallel component
+ PaCO_operation * compo_global_ptr = getContext("global_paco_context");
+ //compo_global_ptr->init_context(proxy_global_ptr);
+ proxy_global_ptr->init_context(compo_global_ptr);
+
+ paco_fabrique_manager* pfm = paco_getFabriqueManager();
+ pfm->register_com("dummy", new paco_dummy_fabrique());
+ proxy_global_ptr->setComFab(NULL);
+ proxy_global_ptr->setLibCom("dummy",NULL);
+
+ proxy_global_ptr->setTypeClient(true);
+ PaCO::PacoTopology_t client_topo;
+ client_topo.total = 1;
+ proxy_global_ptr->setClientTopo(client_topo);
+ PaCO::PacoTopology_t serveur_topo;
+ serveur_topo.total = getTotalNode();
+ proxy->setTopo(serveur_topo);
+
+ // We register the CORBA objet into the POA
+ CORBA::Object_ptr proxy_ref = proxy->_this();
+
+ // We send the reference to all the nodes...
+ CORBA::Object_ptr comp_proxy = _orb->string_to_object(_ior.c_str());
+ Engines::Parallel_Component_var component_proxy = Engines::Parallel_Component::_narrow(comp_proxy);
+ component_proxy->send_parallel_proxy_object(proxy_ref);
+
+ // Adding proxy into the map
+ (*_proxy_map)[Salome_file_name] = proxy;
+ }
+ else {
+ this->wait_parallel_object_proxy();
+ }
+
+ proxy_ior = this->get_parallel_proxy_object();
+ (*_IOR_proxy_map)[Salome_file_name] = proxy_ior;
+
+ // We register each node of the parallel Salome_file object
+ // into the proxy.
+ for (int i = 0; i < getTotalNode(); i++) {
+ if (i == getMyRank()) {
+ Parallel_Salome_file_i * servant =
+ new Parallel_Salome_file_i(CORBA::ORB::_duplicate(_orb), proxy_ior.c_str());
+ PaCO_operation * servant_global_ptr = servant->getContext("global_paco_context");
+
+ // We initialize the object with the context of the Parallel component
+ PaCO_operation * compo_global_ptr = this->getContext("global_paco_context");
+// compo_global_ptr->init_context(servant_global_ptr);
+ servant_global_ptr->init_context(compo_global_ptr);
+
+ // We register the CORBA objet into the POA
+ servant->POA_PaCO::InterfaceParallel::_this();
+
+ // Register the servant
+ servant->deploy(getMyRank());
+
+ // Adding servant to the map
+ (*_map)[Salome_file_name] = servant;
+ }
+
+ PaCO_operation * compo_global_ptr = this->getContext("global_paco_context");
+ compo_global_ptr->my_com->paco_barrier();
+ }
+
+ // Parallel_Salome_file is created and deployed
+ delete _proxy;
+ _proxy = NULL;
+ }
+ pthread_mutex_unlock(deploy_mutex);
+ proxy_ior = (*_IOR_proxy_map)[Salome_file_name];
+ CORBA::Object_ptr proxy_ref = _orb->string_to_object(proxy_ior.c_str());
+ return Engines::Salome_file::_narrow(proxy_ref);
+}
+
+Engines::Salome_file_ptr
+Engines_Parallel_Component_i::setOutputFileToService(const char* service_name,
+ const char* Salome_file_name)
+{
+ // Try to find the service, if it doesn't exist, we add it.
+ _Service_file_map_it = _Output_Service_file_map.find(service_name);
+ if (_Service_file_map_it == _Output_Service_file_map.end()) {
+ _t_Salome_file_map * _map = new _t_Salome_file_map();
+ _Output_Service_file_map[service_name] = _map;
+ _t_Proxy_Salome_file_map * _proxy_map = new _t_Proxy_Salome_file_map();
+ _Proxy_Output_Service_file_map[service_name] = _proxy_map;
+ _t_IOR_Proxy_Salome_file_map * _IOR_proxy_map = new _t_IOR_Proxy_Salome_file_map();
+ _IOR_Proxy_Output_Service_file_map[service_name] = _IOR_proxy_map;
+ }
+ _t_Salome_file_map * _map = _Output_Service_file_map[service_name];
+ _t_Proxy_Salome_file_map * _proxy_map = _Proxy_Output_Service_file_map[service_name];
+ _t_IOR_Proxy_Salome_file_map * _IOR_proxy_map = _IOR_Proxy_Output_Service_file_map[service_name];
+
+ pthread_mutex_lock(deploy_mutex);
+ std::string proxy_ior;
+
+ // Try to find the Salome_file ...
+ _Salome_file_map_it = _map->find(Salome_file_name);
+ if (_Salome_file_map_it == _map->end()) {
+
+ // We create a new PaCO++ object.
+ // He has the same configuration than
+ // his component
+
+ // Firstly, we have to create the proxy object
+ // of the Salome_file and transmit his
+ // reference to the other nodes.
+ if (getMyRank() == 0) {
+ Engines::Parallel_Salome_file_proxy_impl * proxy =
+ new Engines::Parallel_Salome_file_proxy_impl(CORBA::ORB::_duplicate(_orb));
+ PaCO_operation * proxy_global_ptr = proxy->getContext("global_paco_context");
+ // We initialize the object with the context of the Parallel component
+ PaCO_operation * compo_global_ptr = getContext("global_paco_context");
+ //compo_global_ptr->init_context(proxy_global_ptr);
+ proxy_global_ptr->init_context(compo_global_ptr);
+
+ paco_fabrique_manager* pfm = paco_getFabriqueManager();
+ pfm->register_com("dummy", new paco_dummy_fabrique());
+ proxy_global_ptr->setComFab(NULL);
+ proxy_global_ptr->setLibCom("dummy",NULL);
+
+ proxy_global_ptr->setTypeClient(true);
+ PaCO::PacoTopology_t client_topo;
+ client_topo.total = 1;
+ proxy_global_ptr->setClientTopo(client_topo);
+ PaCO::PacoTopology_t serveur_topo;
+ serveur_topo.total = getTotalNode();
+ proxy->setTopo(serveur_topo);
+
+ // We register the CORBA objet into the POA
+ CORBA::Object_ptr proxy_ref = proxy->_this();
+
+ // We send the reference to all the nodes...
+ CORBA::Object_ptr comp_proxy = _orb->string_to_object(_ior.c_str());
+ Engines::Parallel_Component_var component_proxy = Engines::Parallel_Component::_narrow(comp_proxy);
+ component_proxy->send_parallel_proxy_object(proxy_ref);
+
+ // Adding proxy into the map
+ (*_proxy_map)[Salome_file_name] = proxy;
+ }
+ else {
+ this->wait_parallel_object_proxy();
+ }
+
+ proxy_ior = this->get_parallel_proxy_object();
+ (*_IOR_proxy_map)[Salome_file_name] = proxy_ior;
+
+ // We register each node of the parallel Salome_file object
+ // into the proxy.
+ for (int i = 0; i < getTotalNode(); i++) {
+ if (i == getMyRank()) {
+ Parallel_Salome_file_i * servant =
+ new Parallel_Salome_file_i(CORBA::ORB::_duplicate(_orb), proxy_ior.c_str());
+ PaCO_operation * servant_global_ptr = servant->getContext("global_paco_context");
+
+ // We initialize the object with the context of the Parallel component
+ PaCO_operation * compo_global_ptr = this->getContext("global_paco_context");
+// compo_global_ptr->init_context(servant_global_ptr);
+ servant_global_ptr->init_context(compo_global_ptr);
+
+ // We register the CORBA objet into the POA
+ servant->POA_PaCO::InterfaceParallel::_this();
+
+ // Register the servant
+ servant->deploy(getMyRank());
+
+ // Adding servant to the map
+ (*_map)[Salome_file_name] = servant;
+ }
+
+ PaCO_operation * compo_global_ptr = this->getContext("global_paco_context");
+ compo_global_ptr->my_com->paco_barrier();
+ }
+
+ // Parallel_Salome_file is created and deployed
+ delete _proxy;
+ _proxy = NULL;
+ }
+ pthread_mutex_unlock(deploy_mutex);
+ proxy_ior = (*_IOR_proxy_map)[Salome_file_name];
+ CORBA::Object_ptr proxy_ref = _orb->string_to_object(proxy_ior.c_str());
+ return Engines::Salome_file::_narrow(proxy_ref);
+}
+
+Engines::Salome_file_ptr
+Engines_Parallel_Component_i::getInputFileToService(const char* service_name,
+ const char* Salome_file_name)
+{
+ // Try to find the service, if it doesn't exist, we throw an exception.
+ _Proxy_Service_file_map_it = _Proxy_Input_Service_file_map.find(service_name);
+ if (_Proxy_Service_file_map_it == _Proxy_Input_Service_file_map.end()) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "service doesn't have salome files";
+ throw SALOME::SALOME_Exception(es);
+ }
+ _t_Proxy_Salome_file_map * _map = _Proxy_Input_Service_file_map[service_name];
+
+ // Try to find the Salome_file ...
+ _Proxy_Salome_file_map_it = _map->find(Salome_file_name);
+ if (_Proxy_Salome_file_map_it == _map->end()) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "service doesn't have this Salome_file";
+ throw SALOME::SALOME_Exception(es);
+ }
+
+ // Client get the proxy object
+ Engines::Parallel_Salome_file_proxy_impl * Sfile = (*_map)[Salome_file_name];
+ return Sfile->_this();
+}
+
+Engines::Salome_file_ptr
+Engines_Parallel_Component_i::getOutputFileToService(const char* service_name,
+ const char* Salome_file_name)
+{
+ // Try to find the service, if it doesn't exist, we throw an exception.
+ _Proxy_Service_file_map_it = _Proxy_Output_Service_file_map.find(service_name);
+ if (_Proxy_Service_file_map_it == _Proxy_Output_Service_file_map.end()) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "service doesn't have salome files";
+ throw SALOME::SALOME_Exception(es);
+ }
+ _t_Proxy_Salome_file_map * _map = _Proxy_Output_Service_file_map[service_name];
+
+ // Try to find the Salome_file ...
+ _Proxy_Salome_file_map_it = _map->find(Salome_file_name);
+ if (_Proxy_Salome_file_map_it == _map->end()) {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::INTERNAL_ERROR;
+ es.text = "service doesn't have this Salome_file";
+ throw SALOME::SALOME_Exception(es);
+ }
+
+ // Client get the proxy object
+ Engines::Parallel_Salome_file_proxy_impl * Sfile = (*_map)[Salome_file_name];
+ return Sfile->_this();
+}
+
+
+void
+Engines_Parallel_Component_i::checkInputFilesToService(const char* service_name)
+{
+ // Try to find the service, if it doesn't exist, nothing to do.
+ _Proxy_Service_file_map_it = _Proxy_Input_Service_file_map.find(service_name);
+ if (_Proxy_Service_file_map_it != _Proxy_Input_Service_file_map.end()) {
+ _t_Proxy_Salome_file_map * _proxy_map = _Proxy_Input_Service_file_map[service_name];
+ _t_Proxy_Salome_file_map::iterator begin = _proxy_map->begin();
+ _t_Proxy_Salome_file_map::iterator end = _proxy_map->end();
+
+ for(;begin!=end;begin++) {
+ Engines::Parallel_Salome_file_proxy_impl * file = begin->second;
+ std::string file_port_name = begin->first;
+ configureSalome_file(service_name, file_port_name, file);
+ file->recvFiles();
+ }
+ }
+}
+
+void
+Engines_Parallel_Component_i::checkOutputFilesToService(const char* service_name)
+{
+ // Try to find the service, if it doesn't exist, nothing to do.
+ _Proxy_Service_file_map_it = _Proxy_Output_Service_file_map.find(service_name);
+ if (_Proxy_Service_file_map_it != _Proxy_Output_Service_file_map.end()) {
+ _t_Proxy_Salome_file_map * _map = _Proxy_Output_Service_file_map[service_name];
+ _t_Proxy_Salome_file_map::iterator begin = _map->begin();
+ _t_Proxy_Salome_file_map::iterator end = _map->end();
+
+ for(;begin!=end;begin++) {
+ Engines::Parallel_Salome_file_proxy_impl * file = begin->second;
+ std::string file_port_name = begin->first;
+ configureSalome_file(service_name, file_port_name, file);
+ file->recvFiles();
+ }
+ }
+
+}
+
+//=============================================================================
+/*!
+ * C++ method: Used by the Parallel Component to deploy a Parallel Salome_file
+ */
+//=============================================================================
+void
+Engines_Parallel_Component_i::send_parallel_proxy_object(CORBA::Object_ptr proxy_ref) {
+ _proxy = _orb->object_to_string(proxy_ref);
+}
+
+//=============================================================================
+/*!
+ * C++ method: Used by the Parallel Component to deploy a Parallel Salome_file
+ */
+//=============================================================================
+void
+Engines_Parallel_Component_i::wait_parallel_object_proxy() {
+ char * proxy = NULL;
+ proxy = get_parallel_proxy_object();
+ while(proxy == NULL)
+ {
+ sleep(1);
+ proxy = get_parallel_proxy_object();
+ }
+}
+
+//=============================================================================
+/*!
+ * C++ method: Used by the Parallel Component to deploy a Parallel Salome_file
+ */
+//=============================================================================
+char *
+Engines_Parallel_Component_i::get_parallel_proxy_object() {
+ return _proxy;
+}
+
+
+//=============================================================================
+/*!
+ * C++ method: used to configure the Salome_file into the runtime.
+ * \param service_name name of the service that use this Salome_file
+ * \param file_port_name name of the Salome_file
+ * \param file Parallel Salome_file C++ object
+ */
+//=============================================================================
+void
+Engines_Parallel_Component_i::configureSalome_file(std::string service_name,
+ std::string file_port_name,
+ Engines::Parallel_Salome_file_proxy_impl * file)
+{
+ // By default this method does nothing
+}
+
#include <map>
#include <SALOMEconfig.h>
-#include "SALOME_ComponentPaCO_Engines_Component_server.h"
+#include "SALOME_ComponentPaCO_Engines_Parallel_Component_server.h"
#include "NOTIFICATION.hxx"
#include "RegistryConnexion.hxx"
+#include "Parallel_Salome_file_i.hxx"
class Engines_Parallel_Container_i;
#endif
class CONTAINER_EXPORT Engines_Parallel_Component_i:
- public virtual Engines::Component_serv,
+ public virtual Engines::Parallel_Component_serv,
public virtual PortableServer::RefCountServantBase
{
public:
CORBA::Boolean isPublished,
CORBA::Boolean& isValidScript);
+ // CORBA operations for Salome_file
+ virtual Engines::Salome_file_ptr getInputFileToService(const char* service_name,
+ const char* Salome_file_name);
+ virtual Engines::Salome_file_ptr getOutputFileToService(const char* service_name,
+ const char* Salome_file_name);
+
+ virtual void checkInputFilesToService(const char* service_name);
+ virtual Engines::Salome_file_ptr setInputFileToService(const char* service_name,
+ const char* Salome_file_name);
+
+ virtual void checkOutputFilesToService(const char* service_name);
+ virtual Engines::Salome_file_ptr setOutputFileToService(const char* service_name,
+ const char* Salome_file_name);
+
+ void send_parallel_proxy_object(CORBA::Object_ptr proxy_ref);
// --- local C++ methods
void SetCurCpu() ;
long CpuUsed() ;
+ void wait_parallel_object_proxy();
+ char * get_parallel_proxy_object();
+
+ virtual void configureSalome_file(std::string service_name,
+ std::string file_port_name,
+ Engines::Parallel_Salome_file_proxy_impl * file);
+
protected:
int _studyId; // -1: not initialised; 0: multiStudy; >0: study
static bool _isMultiStudy;
NOTIFICATION_Supplier* _notifSupplier;
std::map<std::string,CORBA::Any>_fieldsDict;
+ // Map Salome_file_name to Parallel_Salome_file*
+ typedef std::map<std::string, Parallel_Salome_file_i*> _t_Salome_file_map;
+ typedef std::map<std::string, Engines::Parallel_Salome_file_proxy_impl*> _t_Proxy_Salome_file_map;
+ typedef std::map<std::string, std::string> _t_IOR_Proxy_Salome_file_map;
+
+ // Map Service_name to _Salome_file_map
+ typedef std::map<std::string, Engines_Parallel_Component_i::_t_Salome_file_map*> _t_Service_file_map;
+ typedef std::map<std::string, Engines_Parallel_Component_i::_t_Proxy_Salome_file_map*> _t_Proxy_Service_file_map;
+ typedef std::map<std::string, Engines_Parallel_Component_i::_t_IOR_Proxy_Salome_file_map*> _t_IOR_Proxy_Service_file_map;
+
+ _t_Service_file_map _Input_Service_file_map;
+ _t_Service_file_map _Output_Service_file_map;
+ _t_Service_file_map::iterator _Service_file_map_it;
+ _t_Salome_file_map::iterator _Salome_file_map_it;
+
+ _t_Proxy_Service_file_map _Proxy_Input_Service_file_map;
+ _t_Proxy_Service_file_map _Proxy_Output_Service_file_map;
+ _t_Proxy_Service_file_map::iterator _Proxy_Service_file_map_it;
+ _t_Proxy_Salome_file_map::iterator _Proxy_Salome_file_map_it;
+
+ _t_IOR_Proxy_Service_file_map _IOR_Proxy_Input_Service_file_map;
+ _t_IOR_Proxy_Service_file_map _IOR_Proxy_Output_Service_file_map;
+ _t_IOR_Proxy_Service_file_map::iterator _IOR_Proxy_Service_file_map_it;
+ _t_IOR_Proxy_Salome_file_map::iterator _IOR_Proxy_Salome_file_map_it;
+
std::string _serviceName ;
std::string _graphName ;
std::string _nodeName ;
+ pthread_mutex_t * deploy_mutex;
+ char * _proxy;
+
private:
#ifndef WNT
pthread_t _ThreadId ;
}
#endif
+typedef void (*sighandler_t)(int);
+sighandler_t setsig(int sig, sighandler_t handler)
+{
+ struct sigaction context, ocontext;
+ context.sa_handler = handler;
+ sigemptyset(&context.sa_mask);
+ context.sa_flags = 0;
+ if (sigaction(sig, &context, &ocontext) == -1)
+ return SIG_ERR;
+ return ocontext.sa_handler;
+}
+
+void AttachDebugger()
+{
+ if(getenv ("DEBUGGER"))
+ {
+ std::stringstream exec;
+ exec << "$DEBUGGER SALOME_ParallelContainerNodeDummy " << getpid() << "&";
+ std::cerr << exec.str() << std::endl;
+ system(exec.str().c_str());
+ while(1);
+ }
+}
+
+void Handler(int theSigId)
+{
+ std::cerr << "SIGSEGV: " << std::endl;
+ AttachDebugger();
+ //to exit or not to exit
+ exit(1);
+}
+
+void terminateHandler(void)
+{
+ std::cerr << "Terminate: not managed exception !" << std::endl;
+ AttachDebugger();
+}
+
+void unexpectedHandler(void)
+{
+ std::cerr << "Unexpected: unexpected exception !" << std::endl;
+ AttachDebugger();
+}
+
int main(int argc, char* argv[])
{
INFOS("Launching a parallel container node");
#ifdef _DEBUG_
- signal(SIGSEGV, handler);
+// signal(SIGSEGV, handler);
#endif
+ if(getenv ("DEBUGGER"))
+ {
+ setsig(SIGSEGV,&Handler);
+ set_terminate(&terminateHandler);
+ set_unexpected(&unexpectedHandler);
+ }
// Initialise the ORB.
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
using namespace std;
-#ifdef DEBUG_PARALLEL
+#ifdef _DEBUG_
#include <signal.h>
+void test(int sigval) {
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "SIGSEGV in :" << getpid() << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
+ while (1) {}
+}
+
void handler(int t) {
cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
}
#endif
+typedef void (*sighandler_t)(int);
+sighandler_t setsig(int sig, sighandler_t handler)
+{
+ struct sigaction context, ocontext;
+ context.sa_handler = handler;
+ sigemptyset(&context.sa_mask);
+ context.sa_flags = 0;
+ if (sigaction(sig, &context, &ocontext) == -1)
+ return SIG_ERR;
+ return ocontext.sa_handler;
+}
+
+void AttachDebugger()
+{
+ if(getenv ("DEBUGGER"))
+ {
+ std::stringstream exec;
+ exec << "$DEBUGGER SALOME_ParallelContainerNodeMpi " << getpid() << "&";
+ std::cerr << exec.str() << std::endl;
+ system(exec.str().c_str());
+ while(1);
+ }
+}
+
+void Handler(int theSigId)
+{
+ std::cerr << "SIGSEGV: " << std::endl;
+ AttachDebugger();
+ //to exit or not to exit
+ exit(1);
+}
+
+void terminateHandler(void)
+{
+ std::cerr << "Terminate: not managed exception !" << std::endl;
+ AttachDebugger();
+}
+
+void unexpectedHandler(void)
+{
+ std::cerr << "Unexpected: unexpected exception !" << std::endl;
+ AttachDebugger();
+}
+
int main(int argc, char* argv[])
{
INFOS("Launching a parallel Mpi container node");
-#ifdef DEBUG_PARALLEL
- signal(SIGSEGV, handler);
+#ifdef _DEBUG_
+// struct sigaction action;
+// action.sa_handler = &test;
+// sigaction(SIGSEGV, &action, NULL);
#endif
// MPI Init
int provided;
MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE ,&provided);
-#ifdef DEBUG_PARALLEL
+ if(getenv ("DEBUGGER"))
+ {
+ std::cerr << "Unexpected: unexpected exception !" << std::endl;
+ setsig(SIGSEGV,&Handler);
+ set_terminate(&terminateHandler);
+ set_unexpected(&unexpectedHandler);
+ }
+#ifdef _DEBUG_
cerr << "Level MPI_THREAD_SINGLE : " << MPI_THREAD_SINGLE << endl;
cerr << "Level MPI_THREAD_SERIALIZED : " << MPI_THREAD_SERIALIZED << endl;
cerr << "Level MPI_THREAD_FUNNELED : " << MPI_THREAD_FUNNELED << endl;
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
// File : SALOME_ParallelContainer_i.cxx
-// Author : André RIBES, EDF
+// Author : Andr� RIBES, EDF
// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
#include <SALOMEconfig.h>
// in the nameing service.
_numInstanceMutex.lock() ; // lock on the instance number
_numInstance++ ;
- int numInstance = _numInstance ;
+// int numInstance = _numInstance ;
_numInstanceMutex.unlock() ;
}
cerr << "Node " << getMyRank() << " entering in paco_barrier()" << endl;
}
+Engines::Salome_file_ptr
+Engines_Parallel_Container_i::createSalome_file(const char* origFileName)
+{
+ string origName(origFileName);
+ if (CORBA::is_nil(_Salome_file_map[origName]))
+ {
+ Salome_file_i* aSalome_file = new Salome_file_i();
+ 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() ;
+ }
+
+ Engines::Salome_file_ptr theSalome_file =
+ Engines::Salome_file::_duplicate(_Salome_file_map[origName]);
+ ASSERT(!CORBA::is_nil(theSalome_file));
+ return theSalome_file;
+}
Engines::fileRef_ptr createFileRef(const char* origFileName);
Engines::fileTransfer_ptr getFileTransfer();
+
+ virtual Engines::Salome_file_ptr createSalome_file(const char* origFileName);
protected:
static std::map<std::string, int> _cntInstances_map;
int _numInstance ;
std::map<std::string,Engines::Component_var> _listInstances_map;
std::map<std::string,Engines::fileRef_var> _fileRef_map;
+ std::map<std::string,Engines::Salome_file_var> _Salome_file_map;
Engines::fileTransfer_var _fileTransfer;
int _argc ;
#ifndef WNT
#include <unistd.h>
+#else
+#include <process.h>
#endif
using namespace std;
RegistryService::RegistryService( void ) : _SessionName(0), _Compteur(0)
{
MESSAGE("Passage dans RegistryService::RegistryService()") ;
-
+ _orb = CORBA::ORB::_nil();
}
}
void RegistryService::ping()
{
+#ifndef WNT
MESSAGE(" RegistryService::ping() pid "<< getpid());
+#else
+ MESSAGE(" RegistryService::ping() pid "<< _getpid());
+#endif
+}
+
+CORBA::Long RegistryService::getPID()
+{
+ return (CORBA::Long)getpid();
}
virtual ~RegistryService(void);
void ping();
+ CORBA::Long getPID();
virtual CORBA::ULong add (const Registry::Infos & infos);
virtual CORBA::ULong size ( void );
#ifndef WNT
void SessionName( const char *sessionName ) ;
+ void SetOrb( CORBA::ORB_ptr orb ) { _orb = orb; return; }
+
+ void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }
protected :
+ CORBA::ORB_var _orb;
const char *_SessionName ;
int _Compteur ;
std::map<int,client_infos *> _reg ;
#define REGISTRY_EXPORT
#endif
-#endif
\ No newline at end of file
+#endif
+
naming.init_orb( orb ) ;
RegistryService *ptrRegistry = SINGLETON_<RegistryService>::Instance() ;
ptrRegistry->SessionName( ptrSessionName ) ;
+ ptrRegistry->SetOrb(orb);
varComponents = ptrRegistry->_this() ;
// The RegistryService must not already exist.
}
string absoluteName = string("/") + registryName;
naming.Register( varComponents , absoluteName.c_str() ) ;
- MESSAGE("On attend les requetes des clients") ;
+ MESSAGE("Wait client requests") ;
try
{
// Activation du POA
- MESSAGE("Activation du POA") ;
+ MESSAGE("POA activation") ;
manager->activate() ;
// Lancement de l'ORB
- MESSAGE("Lancement de l'ORB") ;
+ MESSAGE("ORB launching") ;
#ifdef CHECKTIME
Utils_Timer timer;
timer.Start();
}
catch( const CORBA::Exception &ex )
{
- MESSAGE("Erreur systeme") ;
+ MESSAGE("System error") ;
return EXIT_FAILURE ;
}
# This local variable defines the list of CPPFLAGS common to all target in this package.
COMMON_CPPFLAGS=\
+ -I$(srcdir)/../Batch \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../Utils \
-I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
+ @LIBXML_INCLUDES@ \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
../NamingService/libSalomeNS.la \
../Utils/libOpUtil.la \
- $(top_builddir)/idl/libSalomeIDLKernel.la
+ $(top_builddir)/idl/libSalomeIDLKernel.la \
+ @LIBXML_LIBS@
#
# ===============================================================
SALOME_ResourcesManager.cxx
libSalomeResourcesManager_la_CPPFLAGS =\
- $(COMMON_CPPFLAGS) \
- @QT_INCLUDES@
+ $(COMMON_CPPFLAGS)
+
libSalomeResourcesManager_la_LDFLAGS = -no-undefined -version-info=0:0:0
libSalomeResourcesManager_la_LIBADD =\
- $(COMMON_LIBS) \
- @QT_LIBS@
+ $(COMMON_LIBS)
return string(hosts[0]);
}
-string SALOME_LoadRateManager::FindNext(const Engines::MachineList& hosts,SALOME_NamingService *ns)
+string SALOME_LoadRateManager::FindNext(const Engines::MachineList& hosts,MapOfParserResourcesType& resList,SALOME_NamingService *ns)
{
MESSAGE("SALOME_LoadRateManager::FindNext " << hosts.length());
map<string, int> machines;
ns->Change_Directory("/Containers");
vector<string> vec = ns->list_directory_recurs();
- list<string> lstCont;
+ Engines::Container_var cont;
for(vector<string>::iterator iter = vec.begin();iter!=vec.end();iter++){
- CORBA::Object_var obj=ns->Resolve((*iter).c_str());
- Engines::Container_var cont=Engines::Container::_narrow(obj);
+ try
+ {
+ CORBA::Object_var obj=ns->Resolve((*iter).c_str());
+ cont=Engines::Container::_narrow(obj);
+ }
+ catch(CORBA::SystemException& ex)
+ {
+ MESSAGE("SALOME_LoadRateManager::FindNext CORBA::SystemException ignore it");
+ continue;
+ }
if(!CORBA::is_nil(cont)){
- lstCont.push_back((*iter));
- }
- }
- for(list<string>::iterator iter=lstCont.begin();iter!=lstCont.end();iter++){
- CORBA::Object_var obj=ns->Resolve((*iter).c_str());
- Engines::Container_var cont=Engines::Container::_narrow(obj);
- if(!CORBA::is_nil(cont)){
- string mach = cont->getHostName();
- machines[mach]++;
+ try
+ {
+ CORBA::String_var hostname = cont->getHostName();
+ std::string mach=(const char*)hostname;
+ machines[mach]++;
+ }
+ catch(CORBA::SystemException& ex)
+ {
+ MESSAGE("SALOME_LoadRateManager::FindNext CORBA::SystemException ignore it");
+ continue;
+ }
}
}
int imin = 0;
- int min = machines[string(hosts[0])];
+ ParserResourcesType resource = resList[string(hosts[0])];
+ int nbproc = resource.DataForSort._nbOfProcPerNode * resource.DataForSort._nbOfNodes;
+ int min = machines[string(hosts[0])]/nbproc;
for(int i=1;i<hosts.length();i++){
- if( machines[string(hosts[i])] < min ){
+ resource = resList[string(hosts[i])];
+ nbproc = resource.DataForSort._nbOfProcPerNode * resource.DataForSort._nbOfNodes;
+ if( machines[string(hosts[i])]/nbproc < min ){
imin = i;
- min = machines[string(hosts[i])];
+ min = machines[string(hosts[i])]/nbproc;
}
}
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
#include <string>
+#include "SALOME_ResourcesCatalog_Parser.hxx"
#include "SALOME_NamingService.hxx"
#if defined RESOURCESMANAGER_EXPORTS
public:
std::string FindFirst(const Engines::MachineList& hosts);
- std::string FindNext(const Engines::MachineList& hosts,SALOME_NamingService *ns);
+ std::string FindNext(const Engines::MachineList& hosts,MapOfParserResourcesType& resList,SALOME_NamingService *ns);
std::string FindBest(const Engines::MachineList& hosts) throw (SALOME_Exception);
};
#include "SALOME_ResourcesCatalog_Handler.hxx"
#include <iostream>
#include <map>
-#include <qdom.h>
#include "utilities.h"
using namespace std;
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
//=============================================================================
/*!
* Constructor
test_alias = "alias";
test_protocol = "protocol";
test_mode = "mode";
+ test_batch = "batch";
+ test_mpi = "mpi";
test_user_name = "userName";
test_appli_path = "appliPath";
test_modules = "modules";
test_module_name = "moduleName";
- test_module_path = "modulePath";
- test_pre_req_file_path = "preReqFilePath";
test_os = "OS";
test_mem_in_mb = "memInMB";
test_cpu_freq_mhz = "CPUFreqMHz";
const MapOfParserResourcesType&
SALOME_ResourcesCatalog_Handler::GetResourcesAfterParsing() const
- {
- return _resources_list;
- }
-
-//=============================================================================
-/*!
- * Overload handler function startDocument.
- * Called before an xml file is parsed.
- * Clears the list of resources.
- * \return true (if no error detected...)
- */
-//=============================================================================
-
-bool SALOME_ResourcesCatalog_Handler::startDocument()
{
- // MESSAGE("Begin parse document");
-
- // --- Empty private elements
-
- _resources_list.clear();
- return true;
+ return _resources_list;
}
//=============================================================================
/*!
- * Overload handler function startElement.
- * \param QString argument by reference (not used here ?)
- * \param QString argument by reference (not used here ?)
- * \param name (not used here ?)
- * \param atts
- * \return true if no error was detected
+ * Processes XML document and fills the list of resources
*/
//=============================================================================
-bool
-SALOME_ResourcesCatalog_Handler::
-startElement( const QString&,
- const QString&,
- const QString& name,
- const QXmlAttributes& attrs )
+void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
{
- for (int i = 0;i < attrs.count();i++)
- {
- QString qName(attrs.localName(i));
- std::string content(attrs.value(i).toLatin1().data());
+ if (MYDEBUG) MESSAGE("Begin parse document");
- if ((qName.compare(QString(test_hostname)) == 0))
- _resource.DataForSort._hostName = content;
+ // Empty private elements
+ _resources_list.clear();
- if ((qName.compare(QString(test_alias)) == 0))
- _resource.Alias = content;
+ // Get the document root node
+ xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc);
- if ((qName.compare(QString(test_protocol)) == 0))
- {
- switch (content[0])
+ aCurNode = aCurNode->xmlChildrenNode;
+
+ // Processing the document nodes
+ while(aCurNode != NULL)
+ {
+ if ( !xmlStrcmp(aCurNode->name,(const xmlChar*)test_machine) )
+ {
+ _resource.Clear();
+ if (xmlHasProp(aCurNode, (const xmlChar*)test_hostname))
{
-
- case 'r':
- _resource.Protocol = rsh;
- break;
-
- case 's':
- _resource.Protocol = ssh;
- break;
-
- default:
- // If it'not in all theses cases, the protocol is affected to rsh
- _resource.Protocol = rsh;
- break;
+ xmlChar* hostname = xmlGetProp(aCurNode, (const xmlChar*)test_hostname);
+ _resource.DataForSort._hostName = (const char*)hostname;
+ xmlFree(hostname);
}
- }
+ else
+ break;
- if ((qName.compare(QString(test_mode)) == 0))
- {
- switch (content[0])
+ if (xmlHasProp(aCurNode, (const xmlChar*)test_alias))
+ {
+ xmlChar* alias = xmlGetProp(aCurNode, (const xmlChar*)test_alias);
+ _resource.Alias = (const char*)alias;
+ xmlFree(alias);
+ }
+ else
+ _resource.Alias = "";
+
+ xmlChar* protocol= xmlGetProp(aCurNode, (const xmlChar*)test_protocol);
+ switch ( protocol[0])
+ {
+ case 'r':
+ _resource.Protocol = rsh;
+ break;
+ case 's':
+ _resource.Protocol = ssh;
+ break;
+ default:
+ // If it'not in all theses cases, the protocol is affected to rsh
+ _resource.Protocol = rsh;
+ break;
+ }
+ xmlFree(protocol);
+
+ xmlChar* mode=xmlGetProp(aCurNode, (const xmlChar*)test_mode);
+ switch ( mode[0] )
{
-
case 'i':
_resource.Mode = interactive;
break;
-
- case 'b':
+ case 'b':
_resource.Mode = batch;
break;
-
default:
// If it'not in all theses cases, the mode is affected to interactive
_resource.Mode = interactive;
break;
}
- }
+ xmlFree(mode);
- if ((qName.compare(QString(test_user_name)) == 0))
- _resource.UserName = content;
-
- if ((qName.compare(QString(test_appli_path)) == 0))
- _resource.AppliPath = content;
-
- if ((qName.compare(QString(test_module_name)) == 0))
- previous_module_name = content;
-
- if ((qName.compare(QString(test_module_path)) == 0))
- previous_module_path = content;
-
- if ((qName.compare(QString(test_pre_req_file_path)) == 0))
- _resource.PreReqFilePath = content;
-
- if ((qName.compare(QString(test_os)) == 0))
- _resource.OS = content;
-
- if ((qName.compare(QString(test_mem_in_mb)) == 0))
- _resource.DataForSort._memInMB = atoi(content.c_str());
-
- if ((qName.compare(QString(test_cpu_freq_mhz)) == 0))
- _resource.DataForSort._CPUFreqMHz = atoi(content.c_str());
+ if (xmlHasProp(aCurNode, (const xmlChar*)test_batch))
+ {
+ xmlChar* batch = xmlGetProp(aCurNode, (const xmlChar*)test_batch);
+ std::string aBatch = (const char*)batch;
+ xmlFree(batch);
+ if (aBatch == "pbs")
+ _resource.Batch = pbs;
+ else if (aBatch == "lsf")
+ _resource.Batch = lsf;
+ else if (aBatch == "slurm")
+ _resource.Batch = slurm;
+ else
+ _resource.Batch = none;
+ }
- if ((qName.compare(QString(test_nb_of_nodes)) == 0))
- _resource.DataForSort._nbOfNodes = atoi(content.c_str());
+ if (xmlHasProp(aCurNode, (const xmlChar*)test_mpi))
+ {
+ xmlChar* mpi = xmlGetProp(aCurNode, (const xmlChar*)test_mpi);
+ std::string anMpi = (const char*)mpi;
+ xmlFree(mpi);
+ if (anMpi == "lam")
+ _resource.mpi = lam;
+ else if (anMpi == "mpich1")
+ _resource.mpi = mpich1;
+ else if (anMpi == "mpich2")
+ _resource.mpi = mpich2;
+ else if (anMpi == "openmpi")
+ _resource.mpi = openmpi;
+ else
+ _resource.mpi = indif;
+ }
- if ((qName.compare(QString(test_nb_of_proc_per_node)) == 0))
- _resource.DataForSort._nbOfProcPerNode = atoi(content.c_str());
+ if (xmlHasProp(aCurNode, (const xmlChar*)test_user_name))
+ {
+ xmlChar* user_name= xmlGetProp(aCurNode, (const xmlChar*)test_user_name);
+ _resource.UserName = (const char*)user_name;
+ xmlFree(user_name);
+ }
+
+ if (xmlHasProp(aCurNode, (const xmlChar*)test_appli_path))
+ {
+ xmlChar* appli_path = xmlGetProp(aCurNode, (const xmlChar*)test_appli_path);
+ _resource.AppliPath = (const char*)appli_path;
+ xmlFree(appli_path);
+ }
+
+ if (xmlHasProp(aCurNode, (const xmlChar*)test_os))
+ {
+ xmlChar* os = xmlGetProp(aCurNode, (const xmlChar*)test_os);
+ _resource.OS = (const char*)os;
+ xmlFree(os);
+ }
+
+ if (xmlHasProp(aCurNode, (const xmlChar*)test_mem_in_mb))
+ {
+ xmlChar* mem_in_mb = xmlGetProp(aCurNode, (const xmlChar*)test_mem_in_mb);
+ _resource.DataForSort._memInMB = atoi((const char*)mem_in_mb);
+ xmlFree(mem_in_mb);
+ }
+
+ if (xmlHasProp(aCurNode, (const xmlChar*)test_cpu_freq_mhz))
+ {
+ xmlChar* cpu_freq_mhz = xmlGetProp(aCurNode, (const xmlChar*)test_cpu_freq_mhz);
+ _resource.DataForSort._CPUFreqMHz = atoi((const char*)cpu_freq_mhz);
+ xmlFree(cpu_freq_mhz);
+ }
+
+ if (xmlHasProp(aCurNode, (const xmlChar*)test_nb_of_nodes))
+ {
+ xmlChar* nb_of_nodes = xmlGetProp(aCurNode, (const xmlChar*)test_nb_of_nodes);
+ _resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
+ xmlFree(nb_of_nodes);
+ }
+
+ if (xmlHasProp(aCurNode, (const xmlChar*)test_nb_of_proc_per_node))
+ {
+ xmlChar* nb_of_proc_per_node = xmlGetProp(aCurNode, (const xmlChar*)test_nb_of_proc_per_node);
+ _resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
+ xmlFree(nb_of_proc_per_node);
+ }
+
+ // Process modules
+ xmlNodePtr aCurSubNode = aCurNode->xmlChildrenNode;
+ while(aCurSubNode != NULL)
+ {
+ if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
+ {
+ if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
+ {
+ xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
+ std::string aModuleName = (const char*)module_name;
+ _resource.ModulesList.push_back(aModuleName);
+ xmlFree(module_name);
+ }
+ }
+ aCurSubNode = aCurSubNode->next;
+ }
+
+ int aNbNodes = _resource.DataForSort._nbOfNodes;
+ if( aNbNodes > 1 ){
+ string clusterNode = _resource.DataForSort._hostName ;
+ for( int i=0; i < aNbNodes; i++ ){
+ char inode[64];
+ inode[0] = '\0' ;
+ sprintf(inode,"%s%d",clusterNode.c_str(),i+1);
+ std::string nodeName(inode);
+ _resource.DataForSort._hostName = nodeName ;
+ _resources_list[nodeName] = _resource;
+ }
+ }
+ else
+ _resources_list[_resource.DataForSort._hostName] = _resource;
+ }
+
+ aCurNode = aCurNode->next;
}
- return true;
-}
-
-//=============================================================================
-/*!
- * Overload handler function endElement.
- * \param QString argument by reference (not used here ?)
- * \param QString argument by reference (not used here ?)
- * \param qName
- * \return true (if no error detected ...)
- */
-//=============================================================================
-
-bool SALOME_ResourcesCatalog_Handler::
-endElement(const QString&,
- const QString&,
- const QString& qName)
-{
- if ((qName.compare(QString(test_modules)) == 0))
- _resource.ModulesPath[previous_module_name] = previous_module_path;
-
- if ((qName.compare(QString(test_machine)) == 0)){
- int nbnodes = _resource.DataForSort._nbOfNodes;
- if( nbnodes > 1 ){
- string clusterNode = _resource.DataForSort._hostName ;
- for(int i=0;i<nbnodes;i++){
- char inode[64];
- inode[0] = '\0' ;
- sprintf(inode,"%s%d",clusterNode.c_str(),i+1);
- std::string nodeName(inode);
-// _resource.DataForSort._nbOfNodes = 1;
- _resource.DataForSort._hostName = nodeName ;
- _resources_list[nodeName] = _resource;
- //cout << "SALOME_ResourcesCatalog_Handler::endElement _resources_list["
- // << nodeName << "] = _resource " << _resource.DataForSort._hostName.c_str()
- // << endl ;
- }
+ // For debug only
+ if (MYDEBUG)
+ {
+ for (map<string, ParserResourcesType>::const_iterator iter =
+ _resources_list.begin();
+ iter != _resources_list.end();
+ iter++)
+ {
+ SCRUTE((*iter).second.Alias);
+ SCRUTE((*iter).second.UserName);
+ SCRUTE((*iter).second.AppliPath);
+ SCRUTE((*iter).second.OS);
+ SCRUTE((*iter).second.Protocol);
+ SCRUTE((*iter).second.Mode);
+ }
+
+ MESSAGE("This is the end of document");
}
- else
- _resources_list[_resource.DataForSort._hostName] = _resource;
- }
-
- return true;
-}
-
-//=============================================================================
-/*!
- * Overload handler function characters.
- * fills the private attribute string 'content'.
- * \param chars
- * \return true (if no error detected ...)
- */
-//=============================================================================
-
-bool SALOME_ResourcesCatalog_Handler::characters(const QString& chars)
-{
- content = chars.toLatin1().data() ;
- return true;
-}
-
-//=============================================================================
-/*!
- * Overload handler function endDocument.
- * Called after the document has been parsed.
- * \return true (if no error detected ...)
- */
-//=============================================================================
-
-bool SALOME_ResourcesCatalog_Handler::endDocument()
-{
-// for (map<string, ParserResourcesType>::const_iterator iter =
-// _resources_list.begin();
-// iter != _resources_list.end();
-// iter++)
-// {
-// SCRUTE((*iter).second.Alias);
-// SCRUTE((*iter).second.UserName);
-// SCRUTE((*iter).second.AppliPath);
-// SCRUTE((*iter).second.PreReqFilePath);
-// SCRUTE((*iter).second.OS);
-// SCRUTE((*iter).second.Protocol);
-// SCRUTE((*iter).second.Mode);
-// }
-
-// MESSAGE("This is the end of document");
- return true;
-}
-
-//=============================================================================
-/*!
- * Overload handler function errorProtocol.
- * \return the error message.
- */
-//=============================================================================
-
-QString SALOME_ResourcesCatalog_Handler::errorProtocol()
-{
- INFOS(" ------------- error protocol !");
- return errorProt;
}
-//=============================================================================
-/*!
- * Overload handler function fatalError.
- * Fills the private string errorProt with details on error.
- * \param exception from parser
- * \return boolean (meaning ?)
- */
-//=============================================================================
-
-bool
-SALOME_ResourcesCatalog_Handler::fatalError
-(const QXmlParseException& exception)
-{
- INFOS(" ------------- fatal error !");
- errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
- .arg( exception.message() )
- .arg( exception.lineNumber() )
- .arg( exception.columnNumber() );
- INFOS("parser error: " << errorProt.toLatin1().data());
-
- return QXmlDefaultHandler::fatalError( exception );
-}
//=============================================================================
/*!
* Fill the document tree in xml file, used to write in an xml file.
- * \param doc document to fill.
+ * \param theDoc document to fill.
*/
//=============================================================================
-void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(QDomDocument& doc)
+void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
{
- QDomElement root = doc.createElement("resources");
- doc.appendChild(root);
+ // Node pointers
+ xmlNodePtr root_node = NULL, node = NULL, node1 = NULL;
+ char string_buf[80];
+ root_node = xmlNewNode(NULL, BAD_CAST "resources");
+ xmlDocSetRootElement(theDoc, root_node);
+
for (map<string, ParserResourcesType>::iterator iter =
_resources_list.begin();
iter != _resources_list.end();
iter++)
{
- QDomElement eltRoot = doc.createElement(test_machine);
- root.appendChild( eltRoot );
- eltRoot.setAttribute((char *)test_hostname, (*iter).first.c_str());
- eltRoot.setAttribute((char *)test_alias, (*iter).second.Alias.c_str());
-
+ node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
+ xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).first.c_str());
+ xmlNewProp(node, BAD_CAST test_alias, BAD_CAST (*iter).second.Alias.c_str());
+
switch ((*iter).second.Protocol)
{
-
case rsh:
- eltRoot.setAttribute((char *)test_protocol, "rsh");
+ xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
break;
-
case ssh:
- eltRoot.setAttribute((char *)test_protocol, "ssh");
- break;
-
+ xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
+ break;
default:
- eltRoot.setAttribute((char *)test_protocol, "rsh");
- }
+ xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
+ }
switch ((*iter).second.Mode)
{
-
- case interactive:
- eltRoot.setAttribute((char *)test_mode, "interactive");
+ case interactive:
+ xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
break;
-
case batch:
- eltRoot.setAttribute((char *)test_mode, "batch");
+ xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
break;
+ default:
+ xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
+ }
+ switch ((*iter).second.Batch)
+ {
+ case pbs:
+ xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
+ break;
+ case lsf:
+ xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
+ break;
+ case slurm:
+ xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "slurm");
+ break;
+ default:
+ xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
+ }
+
+ switch ((*iter).second.mpi)
+ {
+ case lam:
+ xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
+ break;
+ case mpich1:
+ xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
+ break;
+ case mpich2:
+ xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
+ break;
+ case openmpi:
+ xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
+ break;
default:
- eltRoot.setAttribute((char *)test_mode, "interactive");
+ xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
}
- eltRoot.setAttribute((char *)test_user_name,
- (*iter).second.UserName.c_str());
+ xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
- for (map<string, string>::const_iterator iter2 =
- (*iter).second.ModulesPath.begin();
- iter2 != (*iter).second.ModulesPath.end();
+ for (vector<string>::const_iterator iter2 =
+ (*iter).second.ModulesList.begin();
+ iter2 != (*iter).second.ModulesList.end();
iter2++)
{
- QDomElement rootForModulesPaths = doc.createElement(test_modules);
- rootForModulesPaths.setAttribute(test_module_name,
- (*iter2).first.c_str());
- rootForModulesPaths.setAttribute(test_module_path,
- (*iter2).second.c_str());
- eltRoot.appendChild(rootForModulesPaths);
+ node1 = xmlNewChild(node, NULL, BAD_CAST test_modules, NULL);
+ xmlNewProp(node1, BAD_CAST test_module_name, BAD_CAST (*iter2).c_str());
}
- eltRoot.setAttribute(test_pre_req_file_path,
- (*iter).second.PreReqFilePath.c_str());
- eltRoot.setAttribute(test_os, (*iter).second.OS.c_str());
- eltRoot.setAttribute(test_mem_in_mb,
- (*iter).second.DataForSort._memInMB);
- eltRoot.setAttribute(test_cpu_freq_mhz,
- (*iter).second.DataForSort._CPUFreqMHz);
- eltRoot.setAttribute(test_nb_of_nodes,
- (*iter).second.DataForSort._nbOfNodes);
- eltRoot.setAttribute(test_nb_of_proc_per_node,
- (*iter).second.DataForSort._nbOfProcPerNode);
+ xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
+ xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
+ xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
+ xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
+ xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));
}
}
#include "SALOME_ResourcesCatalog_Parser.hxx"
-#include <qxml.h>
#include <string>
#include <vector>
-class QDomElement;
-
-class QDomDocument;
-
-class SALOME_ResourcesCatalog_Handler : public QXmlDefaultHandler
- {
+#include <libxml/parser.h>
+class SALOME_ResourcesCatalog_Handler
+{
+
public :
SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& listOfResources);
virtual ~SALOME_ResourcesCatalog_Handler();
- virtual bool startDocument();
-
- virtual bool startElement(const QString& , const QString& ,
- const QString& name,
- const QXmlAttributes& attrs);
-
- virtual bool endElement(const QString&, const QString&,
- const QString& qName);
-
- virtual bool characters(const QString& chars);
-
- virtual bool endDocument();
-
- virtual QString errorProtocol();
- virtual bool fatalError(const QXmlParseException& exception);
-
- void PrepareDocToXmlFile(QDomDocument& doc);
+ void ProcessXmlDocument(xmlDocPtr theDoc);
+
+ void PrepareDocToXmlFile(xmlDocPtr theDoc);
private :
- QString errorProt;
- std::string content;
std::string previous_module_name;
- std::string previous_module_path;
ParserResourcesType _resource;
MapOfParserResourcesType& _resources_list;
const char *test_alias;
const char *test_protocol;
const char *test_mode;
+ const char *test_batch;
+ const char *test_mpi;
const char *test_user_name;
const char *test_appli_path;
const char *test_modules;
const char *test_module_name;
- const char *test_module_path;
- const char *test_pre_req_file_path;
const char *test_os;
const char *test_mem_in_mb;
const char *test_cpu_freq_mhz;
SCRUTE(_memInMB);
}
-void ParserResourcesType::Print()
+void ParserResourcesType::Print() const
{
- MESSAGE("##############*****");
- MESSAGE("HostName : " << DataForSort._hostName);
- MESSAGE("Alias : " << Alias);
- MESSAGE("Protocol : " << Protocol);
- MESSAGE("Mode : " << Mode);
- MESSAGE("UserName : " << UserName);
- MESSAGE("Modules : ");
- int i = 1;
-
- for (std::map<std::string, std::string>::iterator iter = ModulesPath.begin();
- iter != ModulesPath.end();
- iter++)
- {
- MESSAGE("Module " << i++ << " called : " << (*iter).first
- << " with path : " << (*iter).second);
- }
-
- MESSAGE("PreReqFilePath : " << PreReqFilePath);
- MESSAGE("OS : " << OS);
- DataForSort.Print();
+ ostringstream oss;
+ oss << endl <<
+ "HostName : " << DataForSort._hostName << endl <<
+ "Alias : " << Alias << endl <<
+ "NbOfNodes : " << DataForSort._nbOfNodes << endl <<
+ "NbOfProcPerNode : " << DataForSort._nbOfProcPerNode << endl <<
+ "CPUFreqMHz : " << DataForSort._CPUFreqMHz << endl <<
+ "MemInMB : " << DataForSort._memInMB << endl <<
+ "Protocol : " << Protocol << endl <<
+ "Mode : " << Mode << endl <<
+ "Batch : " << Batch << endl <<
+ "mpi : " << mpi << endl <<
+ "UserName : " << UserName << endl <<
+ "AppliPath : " << AppliPath << endl <<
+ "OS : " << OS << endl <<
+ "Modules : " << endl;
+
+ for(int i=0;i<ModulesList.size();i++)
+ oss << "Module " << i+1 << " called : " << ModulesList[i] << endl;
+
+ MESSAGE(oss.str());
+
+}
+
+void ParserResourcesType::Clear()
+{
+ DataForSort._hostName = "";
+ DataForSort._nbOfNodes = 1;
+ DataForSort._nbOfProcPerNode = 1;
+ DataForSort._CPUFreqMHz = 0;
+ DataForSort._memInMB = 0;
+ Alias = "";
+ Protocol = rsh;
+ Mode = interactive;
+ Batch = none;
+ mpi = indif;
+ UserName = "";
+ AppliPath = "";
+ ModulesList.clear();
+ OS = "";
}
#include <map>
#include <iostream>
-typedef std::map<std::string, std::string> MapOfModulesPath;
-
enum AccessProtocolType {rsh, ssh};
enum AccessModeType {interactive, batch};
+enum BatchType {none, pbs, lsf, slurm};
+
+enum MpiImplType {indif, lam, mpich1, mpich2, openmpi};
+
class ResourceDataToSort
{
std::string Alias;
AccessProtocolType Protocol;
AccessModeType Mode;
+ BatchType Batch;
+ MpiImplType mpi;
std::string UserName;
std::string AppliPath;
- MapOfModulesPath ModulesPath;
- std::string PreReqFilePath;
+ std::vector<std::string> ModulesList;
std::string OS;
- void Print();
+ void Print() const;
+ void Clear();
};
typedef std::map<std::string, ParserResourcesType> MapOfParserResourcesType;
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "SALOME_ResourcesManager.hxx"
-//#include "SALOME_Container_i.hxx"
#include "Utils_ExceptHandlers.hxx"
+#include "Utils_CorbaException.hxx"
#include "OpUtil.hxx"
-#include <qdom.h>
-
#include <stdlib.h>
#ifndef WNT
#include <unistd.h>
using namespace std;
+const char *SALOME_ResourcesManager::_ResourcesManagerNameInNS = "/ResourcesManager";
+
//=============================================================================
/*!
* just for test
//=============================================================================
SALOME_ResourcesManager::
-SALOME_ResourcesManager(CORBA::ORB_ptr orb,
+SALOME_ResourcesManager(CORBA::ORB_ptr orb,
+ PortableServer::POA_var poa,
+ SALOME_NamingService *ns,
const char *xmlFilePath) :
_path_resources(xmlFilePath)
{
- _NS = new SALOME_NamingService(orb);
+ MESSAGE("constructor");
+ _NS = ns;
+ _orb = CORBA::ORB::_duplicate(orb) ;
+ _poa = PortableServer::POA::_duplicate(poa) ;
+ PortableServer::ObjectId_var id = _poa->activate_object(this);
+ CORBA::Object_var obj = _poa->id_to_reference(id);
+ Engines::SalomeLauncher_var refContMan =
+ Engines::SalomeLauncher::_narrow(obj);
+
+ _NS->Register(refContMan,_ResourcesManagerNameInNS);
_MpiStarted = false;
+ MESSAGE("constructor end");
}
//=============================================================================
/*!
* Standard constructor, parse resource file.
* - if ${APPLI} exists in environment,
- * look for ${HOME}/*{APPLI}/CatalogResources.xml
+ * look for ${HOME}/${APPLI}/CatalogResources.xml
* - else look for default:
* ${KERNEL_ROOT_DIR}/share/salome/resources/kernel/CatalogResources.xml
* - parse XML resource file.
*/
//=============================================================================
-SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb)
+SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb,
+ PortableServer::POA_var poa,
+ SALOME_NamingService *ns)
{
- _NS = new SALOME_NamingService(orb);
+ MESSAGE("constructor");
+ _NS = ns;
+ _orb = CORBA::ORB::_duplicate(orb) ;
+ _poa = PortableServer::POA::_duplicate(poa) ;
+ PortableServer::ObjectId_var id = _poa->activate_object(this);
+ CORBA::Object_var obj = _poa->id_to_reference(id);
+ Engines::ResourcesManager_var refContMan = Engines::ResourcesManager::_narrow(obj);
+ _NS->Register(refContMan,_ResourcesManagerNameInNS);
+
_isAppliSalomeDefined = (getenv("APPLI") != 0);
_MpiStarted = false;
}
ParseXmlFile();
+ MESSAGE("constructor end");
}
//=============================================================================
SALOME_ResourcesManager::~SALOME_ResourcesManager()
{
- delete _NS;
+ MESSAGE("destructor");
+}
+
+
+//=============================================================================
+/*! CORBA method:
+ * shutdown all the containers, then the ContainerManager servant
+ */
+//=============================================================================
+
+void SALOME_ResourcesManager::Shutdown()
+{
+ MESSAGE("Shutdown");
+ _NS->Destroy_Name(_ResourcesManagerNameInNS);
+ PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
+ _poa->deactivate_object(oid);
+ //_remove_ref();
}
//=============================================================================
*/
//=============================================================================
-vector<string>
-SALOME_ResourcesManager::
-GetFittingResources(const Engines::MachineParameters& params,
- const char *moduleName)
-throw(SALOME_Exception)
+Engines::MachineList *
+SALOME_ResourcesManager::GetFittingResources(const Engines::MachineParameters& params,
+ const Engines::CompoList& componentList)
+//throw(SALOME_Exception)
{
// MESSAGE("ResourcesManager::GetFittingResources");
- vector <std::string> ret;
+ vector <std::string> vec;
+ Engines::MachineList *ret=new Engines::MachineList;
+ try{
+ // --- To be sure that we search in a correct list.
+ ParseXmlFile();
- // --- To be sure that we search in a correct list.
- ParseXmlFile();
-
- const char *hostname = (const char *)params.hostname;
- MESSAGE("GetFittingResources " << hostname << " " << GetHostname().c_str());
+ const char *hostname = (const char *)params.hostname;
+ MESSAGE("GetFittingResources " << hostname << " " << GetHostname().c_str());
- if (hostname[0] != '\0')
- {
+ if (hostname[0] != '\0')
+ {
// MESSAGE("ResourcesManager::GetFittingResources : hostname specified" );
- if ( strcmp(hostname, "localhost") == 0 ||
- strcmp(hostname, GetHostname().c_str()) == 0 )
- {
-// MESSAGE("ResourcesManager::GetFittingResources : localhost" );
- ret.push_back(GetHostname().c_str());
-// MESSAGE("ResourcesManager::GetFittingResources : " << ret.size());
- }
-
- else if (_resourcesList.find(hostname) != _resourcesList.end())
- {
- // --- params.hostname is in the list of resources so return it.
- ret.push_back(hostname);
- }
-
- else
- {
-// Cas d'un cluster: nombre de noeuds > 1
- int cpt=0;
- for (map<string, ParserResourcesType>::const_iterator iter = _resourcesList.begin(); iter != _resourcesList.end(); iter++){
- if( (*iter).second.DataForSort._nbOfNodes > 1 ){
- if( strncmp(hostname,(*iter).first.c_str(),strlen(hostname)) == 0 ){
- ret.push_back((*iter).first.c_str());
- //cout << "SALOME_ResourcesManager::GetFittingResources vector["
- // << cpt << "] = " << (*iter).first.c_str() << endl ;
- cpt++;
- }
- }
- }
- if(cpt==0){
- // --- user specified an unknown hostame so notify him.
- MESSAGE("ResourcesManager::GetFittingResources : SALOME_Exception");
- throw SALOME_Exception("unknown host");
- }
- }
- }
+ if ( strcmp(hostname, "localhost") == 0 ||
+ strcmp(hostname, GetHostname().c_str()) == 0 )
+ {
+ // MESSAGE("ResourcesManager::GetFittingResources : localhost" );
+ vec.push_back(GetHostname().c_str());
+ // MESSAGE("ResourcesManager::GetFittingResources : " << vec.size());
+ }
+
+ else if (_resourcesList.find(hostname) != _resourcesList.end())
+ {
+ // --- params.hostname is in the list of resources so return it.
+ vec.push_back(hostname);
+ }
+
+ else
+ {
+ // Cas d'un cluster: nombre de noeuds > 1
+ int cpt=0;
+ for (map<string, ParserResourcesType>::const_iterator iter = _resourcesList.begin(); iter != _resourcesList.end(); iter++){
+ if( (*iter).second.DataForSort._nbOfNodes > 1 ){
+ if( strncmp(hostname,(*iter).first.c_str(),strlen(hostname)) == 0 ){
+ vec.push_back((*iter).first.c_str());
+ //cout << "SALOME_ResourcesManager::GetFittingResources vector["
+ // << cpt << "] = " << (*iter).first.c_str() << endl ;
+ cpt++;
+ }
+ }
+ }
+ if(cpt==0){
+ // --- user specified an unknown hostame so notify him.
+ MESSAGE("ResourcesManager::GetFittingResources : SALOME_Exception");
+ throw SALOME_Exception("unknown host");
+ }
+ }
+ }
+
+ else
+ // --- Search for available resources sorted by priority
+ {
+ SelectOnlyResourcesWithOS(vec, params.OS);
+
+ KeepOnlyResourcesWithModule(vec, componentList);
+
+ if (vec.size() == 0)
+ SelectOnlyResourcesWithOS(vec, params.OS);
+
+ // --- set wanted parameters
+ ResourceDataToSort::_nbOfNodesWanted = params.nb_node;
+
+ ResourceDataToSort::_nbOfProcPerNodeWanted = params.nb_proc_per_node;
+
+ ResourceDataToSort::_CPUFreqMHzWanted = params.cpu_clock;
+
+ ResourceDataToSort::_memInMBWanted = params.mem_mb;
+
+ // --- end of set
+
+ list<ResourceDataToSort> li;
+
+ for (vector<string>::iterator iter = vec.begin();
+ iter != vec.end();
+ iter++)
+ li.push_back(_resourcesList[(*iter)].DataForSort);
+
+ li.sort();
+
+ unsigned int i = 0;
+
+ for (list<ResourceDataToSort>::iterator iter2 = li.begin();
+ iter2 != li.end();
+ iter2++)
+ vec[i++] = (*iter2)._hostName;
+ }
+
+ // MESSAGE("ResourcesManager::GetFittingResources : return" << ret.size());
+ ret->length(vec.size());
+ for(unsigned int i=0;i<vec.size();i++)
+ (*ret)[i]=(vec[i]).c_str();
- else
- // --- Search for available resources sorted by priority
+ }
+ catch(const SALOME_Exception &ex)
{
- SelectOnlyResourcesWithOS(ret, params.OS);
-
- KeepOnlyResourcesWithModule(ret, moduleName);
-
- if (ret.size() == 0)
- SelectOnlyResourcesWithOS(ret, params.OS);
-
- // --- set wanted parameters
- ResourceDataToSort::_nbOfNodesWanted = params.nb_node;
-
- ResourceDataToSort::_nbOfProcPerNodeWanted = params.nb_proc_per_node;
-
- ResourceDataToSort::_CPUFreqMHzWanted = params.cpu_clock;
-
- ResourceDataToSort::_memInMBWanted = params.mem_mb;
-
- // --- end of set
+ INFOS("Caught exception.");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::BAD_PARAM);
+ //return ret;
+ }
- list<ResourceDataToSort> li;
-
- for (vector<string>::iterator iter = ret.begin();
- iter != ret.end();
- iter++)
- li.push_back(_resourcesList[(*iter)].DataForSort);
-
- li.sort();
-
- unsigned int i = 0;
-
- for (list<ResourceDataToSort>::iterator iter2 = li.begin();
- iter2 != li.end();
- iter2++)
- ret[i++] = (*iter2)._hostName;
- }
-
- // MESSAGE("ResourcesManager::GetFittingResources : return" << ret.size());
return ret;
}
int
SALOME_ResourcesManager::
AddResourceInCatalog(const Engines::MachineParameters& paramsOfNewResources,
- const map<string, string>& modulesOnNewResources,
- const char *environPathOfPrerequired,
+ const vector<string>& modulesOnNewResources,
const char *alias,
const char *userName,
AccessModeType mode,
AccessProtocolType prot)
throw(SALOME_Exception)
{
- map<string, string>::const_iterator iter =
- modulesOnNewResources.find("KERNEL");
+ vector<string>::const_iterator iter = find(modulesOnNewResources.begin(),
+ modulesOnNewResources.end(),
+ "KERNEL");
if (iter != modulesOnNewResources.end())
{
newElt.Protocol = prot;
newElt.Mode = mode;
newElt.UserName = userName;
- newElt.ModulesPath = modulesOnNewResources;
- newElt.PreReqFilePath = environPathOfPrerequired;
+ newElt.ModulesList = modulesOnNewResources;
newElt.OS = paramsOfNewResources.OS;
newElt.DataForSort._memInMB = paramsOfNewResources.mem_mb;
newElt.DataForSort._CPUFreqMHz = paramsOfNewResources.cpu_clock;
void SALOME_ResourcesManager::WriteInXmlFile()
{
- QDomDocument doc("ResourcesCatalog");
+ const char* aFilePath = _path_resources.c_str();
+
+ FILE* aFile = fopen(aFilePath, "w");
+
+ if (aFile == NULL)
+ {
+ INFOS("Error opening file !");
+ return;
+ }
+
+ xmlDocPtr aDoc = xmlNewDoc(BAD_CAST "1.0");
+ xmlNewDocComment(aDoc, BAD_CAST "ResourcesCatalog");
+
SALOME_ResourcesCatalog_Handler* handler =
new SALOME_ResourcesCatalog_Handler(_resourcesList);
- handler->PrepareDocToXmlFile(doc);
+ handler->PrepareDocToXmlFile(aDoc);
delete handler;
- QFile file( _path_resources );
-
- if ( !file.open( QIODevice::WriteOnly ) )
- INFOS("WRITING ERROR !");
-
- QTextStream ts( &file );
-
- ts << doc.toString();
-
- file.close();
+ int isOk = xmlSaveFile(aFilePath, aDoc);
+
+ if (!isOk)
+ INFOS("Error while XML file saving.");
+
+ // Free the document
+ xmlFreeDoc(aDoc);
+ fclose(aFile);
+
MESSAGE("WRITING DONE!");
}
{
SALOME_ResourcesCatalog_Handler* handler =
new SALOME_ResourcesCatalog_Handler(_resourcesList);
- QFile xmlFile(_path_resources);
- QXmlInputSource source(&xmlFile);
+ const char* aFilePath = _path_resources.c_str();
+ FILE* aFile = fopen(aFilePath, "r");
+
+ if (aFile != NULL)
+ {
+ xmlDocPtr aDoc = xmlReadFile(aFilePath, NULL, 0);
+
+ if (aDoc != NULL)
+ handler->ProcessXmlDocument(aDoc);
+ else
+ INFOS("ResourcesManager: could not parse file "<<aFilePath);
+
+ // Free the document
+ xmlFreeDoc(aDoc);
- QXmlSimpleReader reader;
- reader.setContentHandler( handler );
- reader.setErrorHandler( handler );
- reader.parse( source );
- xmlFile.close();
+ fclose(aFile);
+ }
+ else
+ INFOS("ResourcesManager: file "<<aFilePath<<" is not readable.");
+
delete handler;
+
return _resourcesList;
}
*/
//=============================================================================
-string
+char *
SALOME_ResourcesManager::FindFirst(const Engines::MachineList& listOfMachines)
{
- return _dynamicResourcesSelecter.FindFirst(listOfMachines);
+ return CORBA::string_dup(_dynamicResourcesSelecter.FindFirst(listOfMachines).c_str());
}
//=============================================================================
string
SALOME_ResourcesManager::FindNext(const Engines::MachineList& listOfMachines)
{
- return _dynamicResourcesSelecter.FindNext(listOfMachines,_NS);
+ return _dynamicResourcesSelecter.FindNext(listOfMachines,_resourcesList,_NS);
}
//=============================================================================
/*!
return _dynamicResourcesSelecter.FindBest(listOfMachines);
}
-
-
//=============================================================================
/*!
* This is no longer valid (C++ container are also python containers)
return command;
}
-
//=============================================================================
/*!
* builds the command to be launched.
command += machine;
command += " ";
- string path = (*(resInfo.ModulesPath.find("KERNEL"))).second;
+ string path = getenv("KERNEL_ROOT_DIR");
command += path;
command += "/bin/salome/";
void
SALOME_ResourcesManager::KeepOnlyResourcesWithModule
( vector<string>& hosts,
- const char *moduleName) const
+ const Engines::CompoList& componentList) const
throw(SALOME_Exception)
{
for (vector<string>::iterator iter = hosts.begin(); iter != hosts.end();)
{
MapOfParserResourcesType::const_iterator it = _resourcesList.find(*iter);
- const map<string, string>& mapOfModulesOfCurrentHost =
- (((*it).second).ModulesPath);
-
- if (mapOfModulesOfCurrentHost.find(moduleName) ==
- mapOfModulesOfCurrentHost.end())
+ const vector<string>& mapOfModulesOfCurrentHost = (((*it).second).ModulesList);
+
+ bool erasedHost = false;
+ if( mapOfModulesOfCurrentHost.size() > 0 ){
+ for(int i=0;i<componentList.length();i++){
+ const char* compoi = componentList[i];
+ vector<string>::const_iterator itt = find(mapOfModulesOfCurrentHost.begin(),
+ mapOfModulesOfCurrentHost.end(),
+ compoi);
+// componentList[i]);
+ if (itt == mapOfModulesOfCurrentHost.end()){
+ erasedHost = true;
+ break;
+ }
+ }
+ }
+ if(erasedHost)
hosts.erase(iter);
else
iter++;
char *iorstr = _NS->getIORaddr();
command += "ORBInitRef NameService=";
command += iorstr;
+ //It's in fact a CORBA::String allocated with new [] !!!
+ delete [] iorstr;
}
string
SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer
(const string& machine,
- const Engines::MachineParameters& params)
+ const Engines::MachineParameters& params) throw(SALOME_Exception)
{
+ int status;
+
_TmpFileName = BuildTemporaryFileName();
ofstream tempOutputFile;
tempOutputFile.open(_TmpFileName.c_str(), ofstream::out );
// --- set env vars
- tempOutputFile << "source " << resInfo.PreReqFilePath << endl;
-
- for (map<string, string>::const_iterator iter = resInfo.ModulesPath.begin();
- iter != resInfo.ModulesPath.end();
- iter++)
- {
- string curModulePath((*iter).second);
- tempOutputFile << (*iter).first << "_ROOT_DIR=" << curModulePath << endl;
- tempOutputFile << "export " << (*iter).first << "_ROOT_DIR" << endl;
- tempOutputFile << "LD_LIBRARY_PATH=" << curModulePath
- << "/lib/salome" << ":${LD_LIBRARY_PATH}" << endl;
- tempOutputFile << "PYTHONPATH=" << curModulePath << "/bin/salome:"
- << curModulePath << "/lib/salome:" << curModulePath
- << "/lib/python${PYTHON_VERSION}/site-packages/salome:";
- tempOutputFile << curModulePath
- << "/lib/python${PYTHON_VERSION}/site-packages/salome/shared_modules:${PYTHONPATH}"
- << endl;
- }
-
- tempOutputFile << "export LD_LIBRARY_PATH" << endl;
- tempOutputFile << "export PYTHONPATH" << endl;
tempOutputFile << "export SALOME_trace=local" << endl; // mkr : 27.11.2006 : PAL13967 - Distributed supervision graphs - Problem with "SALOME_trace"
//tempOutputFile << "source " << resInfo.PreReqFilePath << endl;
#endif
}
- tempOutputFile << (*(resInfo.ModulesPath.find("KERNEL"))).second
- << "/bin/salome/";
+ tempOutputFile << getenv("KERNEL_ROOT_DIR") << "/bin/salome/";
if (params.isMPI)
{
commandRcp += machine;
commandRcp += ":";
commandRcp += _TmpFileName;
- system(commandRcp.c_str());
+ status = system(commandRcp.c_str());
}
else if (resInfo.Protocol == ssh)
commandRcp += machine;
commandRcp += ":";
commandRcp += _TmpFileName;
- system(commandRcp.c_str());
+ status = system(commandRcp.c_str());
}
else
throw SALOME_Exception("Unknown protocol");
+ if(status)
+ throw SALOME_Exception("Error of connection on remote host");
+
command += machine;
_CommandForRemAccess = command;
command += " ";
if (par < 0)
{
// Nodes case
+
command = "mpiexec -np " + string(buffer) + " ";
+// command += "gdb --args ";
command += real_exe_name;
command += " " + _NS->ContainerName(rtn);
command += " " + parallelLib;
if (log == "xterm")
{
command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; "
- + command + " \" &";
- //command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; "
- // + command + "; cat \" &";
+ + command + " \" &";
+// + command + "; echo $LD_LIBRARY_PATH; cat \" &";
}
return command;
}
}
-
+Engines::MachineParameters* SALOME_ResourcesManager::GetMachineParameters(const char *hostname)
+{
+ ParserResourcesType resource = _resourcesList[string(hostname)];
+ Engines::MachineParameters *p_ptr = new Engines::MachineParameters;
+ p_ptr->container_name = CORBA::string_dup("");
+ p_ptr->hostname = CORBA::string_dup("hostname");
+ p_ptr->alias = CORBA::string_dup(resource.Alias.c_str());
+ if( resource.Protocol == rsh )
+ p_ptr->protocol = "rsh";
+ else if( resource.Protocol == ssh )
+ p_ptr->protocol = "ssh";
+ 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++)
+ 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 = "lam";
+ else if( resource.mpi == mpich1 )
+ p_ptr->mpiImpl = "mpich1";
+ else if( resource.mpi == mpich2 )
+ p_ptr->mpiImpl = "mpich2";
+ else if( resource.mpi == openmpi )
+ p_ptr->mpiImpl = "openmpi";
+ if( resource.Batch == pbs )
+ p_ptr->batch = "pbs";
+ else if( resource.Batch == lsf )
+ p_ptr->batch = "lsf";
+ else if( resource.Batch == slurm )
+ p_ptr->batch = "slurm";
+ return p_ptr;
+}
#include <fstream>
#include <vector>
+#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
+
// --- WARNING ---
// The call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done
// in a critical section to be sure to be clean.
// Only one thread should use the SALOME_ResourcesManager class in a SALOME
// session.
-class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager
+class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager:
+ public POA_Engines::ResourcesManager,
+ public PortableServer::RefCountServantBase
{
public:
- SALOME_ResourcesManager(CORBA::ORB_ptr orb, const char *xmlFilePath);
- SALOME_ResourcesManager(CORBA::ORB_ptr orb);
+ SALOME_ResourcesManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService *ns, const char *xmlFilePath);
+ SALOME_ResourcesManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService *ns);
~SALOME_ResourcesManager();
- std::vector<std::string>
+ Engines::MachineList *
GetFittingResources(const Engines::MachineParameters& params,
- const char *moduleName)
- throw(SALOME_Exception);
+ const Engines::CompoList& componentList);
+// throw(SALOME_Exception);
- std::string FindFirst(const Engines::MachineList& listOfMachines);
+ char* FindFirst(const Engines::MachineList& listOfMachines);
std::string FindNext(const Engines::MachineList& listOfMachines);
std::string FindBest(const Engines::MachineList& listOfMachines);
int AddResourceInCatalog
(const Engines::MachineParameters& paramsOfNewResources,
- const std::map<std::string, std::string>& modulesOnNewResources,
- const char *environPathOfPrerequired,
+ const std::vector<std::string>& modulesOnNewResources,
const char *alias,
const char *userName,
AccessModeType mode,
std::string BuildCommandToLaunchLocalParallelContainer(const std::string& exe_name,
const Engines::MachineParameters& params,
const std::string& log = "default");
+ Engines::MachineParameters* GetMachineParameters(const char *hostname);
+
+ void Shutdown();
+
+ static const char *_ResourcesManagerNameInNS;
+
protected:
// Parallel extension
bool _MpiStarted;
SALOME_NamingService *_NS;
+ CORBA::ORB_var _orb;
+ PortableServer::POA_var _poa;
std::string BuildTempFileToLaunchRemoteContainer
(const std::string& machine,
- const Engines::MachineParameters& params);
+ const Engines::MachineParameters& params) throw(SALOME_Exception);
void SelectOnlyResourcesWithOS(std::vector<std::string>& hosts,
const char *OS) const
throw(SALOME_Exception);
void KeepOnlyResourcesWithModule(std::vector<std::string>& hosts,
- const char *moduleName) const
+ const Engines::CompoList& componentList) const
throw(SALOME_Exception);
void AddOmninamesParams(std::string& command) const;
std::string BuildTemporaryFileName() const;
-
//! will contain the path to the ressources catalog
- QString _path_resources;
+ std::string _path_resources;
//! attribute that contains current tmp files generated
std::string _TmpFileName;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx
-// Author : Sergey Ruin
-// Module : SALOME
-
-#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile
-#define _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TCollection_MapNode_HeaderFile
-#include <Handle_TCollection_MapNode.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TCollection_MapNode);
-class SALOMEDS_DataMapNodeOfDataMapOfIntegerString;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString);
-
-class Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) : public Handle(TCollection_MapNode) {
- public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)():Handle(TCollection_MapNode)() {}
- Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)(const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)& aHandle) : Handle(TCollection_MapNode)(aHandle)
- {
- }
-
- Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)(const SALOMEDS_DataMapNodeOfDataMapOfIntegerString* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem)
- {
- }
-
- Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)& operator=(const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)& operator=(const SALOMEDS_DataMapNodeOfDataMapOfIntegerString* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_DataMapNodeOfDataMapOfIntegerString* operator->()
- {
- return (SALOMEDS_DataMapNodeOfDataMapOfIntegerString *)ControlAccess();
- }
-
- SALOMEDS_DataMapNodeOfDataMapOfIntegerString* operator->() const
- {
- return (SALOMEDS_DataMapNodeOfDataMapOfIntegerString *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)();
-
- Standard_EXPORT static const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
-#define _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TCollection_MapNode_HeaderFile
-#include <Handle_TCollection_MapNode.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TCollection_MapNode);
-class SALOMEDS_DataMapNodeOfDataMapStringLabel;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel);
-
-class Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) : public Handle(TCollection_MapNode) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)():Handle(TCollection_MapNode)() {}
- Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)(const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)& aHandle) : Handle(TCollection_MapNode)(aHandle)
- {
- }
-
- Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)(const SALOMEDS_DataMapNodeOfDataMapStringLabel* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem)
- {
- }
-
- Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)& operator=(const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)& operator=(const SALOMEDS_DataMapNodeOfDataMapStringLabel* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_DataMapNodeOfDataMapStringLabel* operator->()
- {
- return (SALOMEDS_DataMapNodeOfDataMapStringLabel *)ControlAccess();
- }
-
- SALOMEDS_DataMapNodeOfDataMapStringLabel* operator->() const
- {
- return (SALOMEDS_DataMapNodeOfDataMapStringLabel *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)();
-
- Standard_EXPORT static const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_DrawableAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_DrawableAttribute_HeaderFile
-#define _Handle_SALOMEDS_DrawableAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_Integer_HeaderFile
-#include <Handle_TDataStd_Integer.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_Integer);
-class SALOMEDS_DrawableAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_DrawableAttribute);
-
-class Handle(SALOMEDS_DrawableAttribute) : public Handle(TDataStd_Integer) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_DrawableAttribute)():Handle(TDataStd_Integer)() {}
- Handle(SALOMEDS_DrawableAttribute)(const Handle(SALOMEDS_DrawableAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle)
- {
- }
-
- Handle(SALOMEDS_DrawableAttribute)(const SALOMEDS_DrawableAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem)
- {
- }
-
- Handle(SALOMEDS_DrawableAttribute)& operator=(const Handle(SALOMEDS_DrawableAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_DrawableAttribute)& operator=(const SALOMEDS_DrawableAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_DrawableAttribute* operator->()
- {
- return (SALOMEDS_DrawableAttribute *)ControlAccess();
- }
-
- SALOMEDS_DrawableAttribute* operator->() const
- {
- return (SALOMEDS_DrawableAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_DrawableAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_DrawableAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_ExpandableAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_ExpandableAttribute_HeaderFile
-#define _Handle_SALOMEDS_ExpandableAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_Integer_HeaderFile
-#include <Handle_TDataStd_Integer.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_Integer);
-class SALOMEDS_ExpandableAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_ExpandableAttribute);
-
-class Handle(SALOMEDS_ExpandableAttribute) : public Handle(TDataStd_Integer) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_ExpandableAttribute)():Handle(TDataStd_Integer)() {}
- Handle(SALOMEDS_ExpandableAttribute)(const Handle(SALOMEDS_ExpandableAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle)
- {
- }
-
- Handle(SALOMEDS_ExpandableAttribute)(const SALOMEDS_ExpandableAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem)
- {
- }
-
- Handle(SALOMEDS_ExpandableAttribute)& operator=(const Handle(SALOMEDS_ExpandableAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_ExpandableAttribute)& operator=(const SALOMEDS_ExpandableAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_ExpandableAttribute* operator->()
- {
- return (SALOMEDS_ExpandableAttribute *)ControlAccess();
- }
-
- SALOMEDS_ExpandableAttribute* operator->() const
- {
- return (SALOMEDS_ExpandableAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_ExpandableAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_ExpandableAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// File generated by CPPExt (Transient)
-//
-// Copyright (C) 1991,1995 by
-//
-// MATRA DATAVISION, FRANCE
-//
-// This software is furnished in accordance with the terms and conditions
-// of the contract and with the inclusion of the above copyright notice.
-// This software or any other copy thereof may not be provided or otherwise
-// be made available to any other person. No title to an ownership of the
-// software is hereby transferred.
-//
-// At the termination of the contract, the software and all copies of this
-// software must be deleted.
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-
-#ifndef _Handle_SALOMEDS_ExternalFileDef_HeaderFile
-#define _Handle_SALOMEDS_ExternalFileDef_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_Comment_HeaderFile
-#include <Handle_TDataStd_Comment.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_Comment);
-class SALOMEDS_ExternalFileDef;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_ExternalFileDef);
-
-class Handle(SALOMEDS_ExternalFileDef) : public Handle(TDataStd_Comment) {
- public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- Handle(SALOMEDS_ExternalFileDef)():Handle(TDataStd_Comment)() {}
- Handle(SALOMEDS_ExternalFileDef)(const Handle(SALOMEDS_ExternalFileDef)& aHandle) : Handle(TDataStd_Comment)(aHandle)
- {
- }
-
- Handle(SALOMEDS_ExternalFileDef)(const SALOMEDS_ExternalFileDef* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem)
- {
- }
-
- Handle(SALOMEDS_ExternalFileDef)& operator=(const Handle(SALOMEDS_ExternalFileDef)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_ExternalFileDef)& operator=(const SALOMEDS_ExternalFileDef* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_ExternalFileDef* operator->()
- {
- return (SALOMEDS_ExternalFileDef *)ControlAccess();
- }
-
- SALOMEDS_ExternalFileDef* operator->() const
- {
- return (SALOMEDS_ExternalFileDef *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_ExternalFileDef)();
-
- Standard_EXPORT static const Handle(SALOMEDS_ExternalFileDef) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// File generated by CPPExt (Transient)
-//
-// Copyright (C) 1991,1995 by
-//
-// MATRA DATAVISION, FRANCE
-//
-// This software is furnished in accordance with the terms and conditions
-// of the contract and with the inclusion of the above copyright notice.
-// This software or any other copy thereof may not be provided or otherwise
-// be made available to any other person. No title to an ownership of the
-// software is hereby transferred.
-//
-// At the termination of the contract, the software and all copies of this
-// software must be deleted.
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-
-#ifndef _Handle_SALOMEDS_FileType_HeaderFile
-#define _Handle_SALOMEDS_FileType_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_Comment_HeaderFile
-#include <Handle_TDataStd_Comment.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_Comment);
-class SALOMEDS_FileType;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_FileType);
-
-class Handle(SALOMEDS_FileType) : public Handle(TDataStd_Comment) {
- public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- Handle(SALOMEDS_FileType)():Handle(TDataStd_Comment)() {}
- Handle(SALOMEDS_FileType)(const Handle(SALOMEDS_FileType)& aHandle) : Handle(TDataStd_Comment)(aHandle)
- {
- }
-
- Handle(SALOMEDS_FileType)(const SALOMEDS_FileType* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem)
- {
- }
-
- Handle(SALOMEDS_FileType)& operator=(const Handle(SALOMEDS_FileType)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_FileType)& operator=(const SALOMEDS_FileType* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_FileType* operator->()
- {
- return (SALOMEDS_FileType *)ControlAccess();
- }
-
- SALOMEDS_FileType* operator->() const
- {
- return (SALOMEDS_FileType *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_FileType)();
-
- Standard_EXPORT static const Handle(SALOMEDS_FileType) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_IORAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_IORAttribute_HeaderFile
-#define _Handle_SALOMEDS_IORAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_Comment_HeaderFile
-#include <Handle_TDataStd_Comment.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_Comment);
-class SALOMEDS_IORAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_IORAttribute);
-
-class Handle(SALOMEDS_IORAttribute) : public Handle(TDataStd_Comment) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_IORAttribute)():Handle(TDataStd_Comment)() {}
- Handle(SALOMEDS_IORAttribute)(const Handle(SALOMEDS_IORAttribute)& aHandle) : Handle(TDataStd_Comment)(aHandle)
- {
- }
-
- Handle(SALOMEDS_IORAttribute)(const SALOMEDS_IORAttribute* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem)
- {
- }
-
- Handle(SALOMEDS_IORAttribute)& operator=(const Handle(SALOMEDS_IORAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_IORAttribute)& operator=(const SALOMEDS_IORAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_IORAttribute* operator->()
- {
- return (SALOMEDS_IORAttribute *)ControlAccess();
- }
-
- SALOMEDS_IORAttribute* operator->() const
- {
- return (SALOMEDS_IORAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_IORAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_IORAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_LocalIDAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_LocalIDAttribute_HeaderFile
-#define _Handle_SALOMEDS_LocalIDAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_Integer_HeaderFile
-#include <Handle_TDataStd_Integer.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_Integer);
-class SALOMEDS_LocalIDAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_LocalIDAttribute);
-
-class Handle(SALOMEDS_LocalIDAttribute) : public Handle(TDataStd_Integer) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_LocalIDAttribute)():Handle(TDataStd_Integer)() {}
- Handle(SALOMEDS_LocalIDAttribute)(const Handle(SALOMEDS_LocalIDAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle)
- {
- }
-
- Handle(SALOMEDS_LocalIDAttribute)(const SALOMEDS_LocalIDAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem)
- {
- }
-
- Handle(SALOMEDS_LocalIDAttribute)& operator=(const Handle(SALOMEDS_LocalIDAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_LocalIDAttribute)& operator=(const SALOMEDS_LocalIDAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_LocalIDAttribute* operator->()
- {
- return (SALOMEDS_LocalIDAttribute *)ControlAccess();
- }
-
- SALOMEDS_LocalIDAttribute* operator->() const
- {
- return (SALOMEDS_LocalIDAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_LocalIDAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_LocalIDAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_OCAFApplication.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_OCAFApplication_HeaderFile
-#define _Handle_SALOMEDS_OCAFApplication_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDocStd_Application_HeaderFile
-#include <Handle_TDocStd_Application.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDocStd_Application);
-class SALOMEDS_OCAFApplication;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_OCAFApplication);
-
-class Handle(SALOMEDS_OCAFApplication) : public Handle(TDocStd_Application) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_OCAFApplication)():Handle(TDocStd_Application)() {}
- Handle(SALOMEDS_OCAFApplication)(const Handle(SALOMEDS_OCAFApplication)& aHandle) : Handle(TDocStd_Application)(aHandle)
- {
- }
-
- Handle(SALOMEDS_OCAFApplication)(const SALOMEDS_OCAFApplication* anItem) : Handle(TDocStd_Application)((TDocStd_Application *)anItem)
- {
- }
-
- Handle(SALOMEDS_OCAFApplication)& operator=(const Handle(SALOMEDS_OCAFApplication)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_OCAFApplication)& operator=(const SALOMEDS_OCAFApplication* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_OCAFApplication* operator->()
- {
- return (SALOMEDS_OCAFApplication *)ControlAccess();
- }
-
- SALOMEDS_OCAFApplication* operator->() const
- {
- return (SALOMEDS_OCAFApplication *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_OCAFApplication)();
-
- Standard_EXPORT static const Handle(SALOMEDS_OCAFApplication) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_OpenedAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_OpenedAttribute_HeaderFile
-#define _Handle_SALOMEDS_OpenedAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_Integer_HeaderFile
-#include <Handle_TDataStd_Integer.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_Integer);
-class SALOMEDS_OpenedAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_OpenedAttribute);
-
-class Handle(SALOMEDS_OpenedAttribute) : public Handle(TDataStd_Integer) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_OpenedAttribute)():Handle(TDataStd_Integer)() {}
- Handle(SALOMEDS_OpenedAttribute)(const Handle(SALOMEDS_OpenedAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle)
- {
- }
-
- Handle(SALOMEDS_OpenedAttribute)(const SALOMEDS_OpenedAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem)
- {
- }
-
- Handle(SALOMEDS_OpenedAttribute)& operator=(const Handle(SALOMEDS_OpenedAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_OpenedAttribute)& operator=(const SALOMEDS_OpenedAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_OpenedAttribute* operator->()
- {
- return (SALOMEDS_OpenedAttribute *)ControlAccess();
- }
-
- SALOMEDS_OpenedAttribute* operator->() const
- {
- return (SALOMEDS_OpenedAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_OpenedAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_OpenedAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_PersRefAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_PersRefAttribute_HeaderFile
-#define _Handle_SALOMEDS_PersRefAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_Comment_HeaderFile
-#include <Handle_TDataStd_Comment.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_Comment);
-class SALOMEDS_PersRefAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_PersRefAttribute);
-
-class Handle(SALOMEDS_PersRefAttribute) : public Handle(TDataStd_Comment) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_PersRefAttribute)():Handle(TDataStd_Comment)() {}
- Handle(SALOMEDS_PersRefAttribute)(const Handle(SALOMEDS_PersRefAttribute)& aHandle) : Handle(TDataStd_Comment)(aHandle)
- {
- }
-
- Handle(SALOMEDS_PersRefAttribute)(const SALOMEDS_PersRefAttribute* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem)
- {
- }
-
- Handle(SALOMEDS_PersRefAttribute)& operator=(const Handle(SALOMEDS_PersRefAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_PersRefAttribute)& operator=(const SALOMEDS_PersRefAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_PersRefAttribute* operator->()
- {
- return (SALOMEDS_PersRefAttribute *)ControlAccess();
- }
-
- SALOMEDS_PersRefAttribute* operator->() const
- {
- return (SALOMEDS_PersRefAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_PersRefAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_PersRefAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_PixMapAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_PixMapAttribute_HeaderFile
-#define _Handle_SALOMEDS_PixMapAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_Comment_HeaderFile
-#include <Handle_TDataStd_Comment.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_Comment);
-class SALOMEDS_PixMapAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_PixMapAttribute);
-
-class Handle(SALOMEDS_PixMapAttribute) : public Handle(TDataStd_Comment) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_PixMapAttribute)():Handle(TDataStd_Comment)() {}
- Handle(SALOMEDS_PixMapAttribute)(const Handle(SALOMEDS_PixMapAttribute)& aHandle) : Handle(TDataStd_Comment)(aHandle)
- {
- }
-
- Handle(SALOMEDS_PixMapAttribute)(const SALOMEDS_PixMapAttribute* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem)
- {
- }
-
- Handle(SALOMEDS_PixMapAttribute)& operator=(const Handle(SALOMEDS_PixMapAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_PixMapAttribute)& operator=(const SALOMEDS_PixMapAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_PixMapAttribute* operator->()
- {
- return (SALOMEDS_PixMapAttribute *)ControlAccess();
- }
-
- SALOMEDS_PixMapAttribute* operator->() const
- {
- return (SALOMEDS_PixMapAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_PixMapAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_PixMapAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : Handle_SALOMEDS_PythonObjectAttribute.hxx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_PythonObjectAttribute_HeaderFile
-#define _Handle_SALOMEDS_PythonObjectAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDF_Attribute);
-class SALOMEDS_PythonObjectAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_PythonObjectAttribute);
-
-class Handle(SALOMEDS_PythonObjectAttribute) : public Handle(TDF_Attribute) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_PythonObjectAttribute)():Handle(TDF_Attribute)() {}
- Handle(SALOMEDS_PythonObjectAttribute)(const Handle(SALOMEDS_PythonObjectAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle)
- {
- }
-
- Handle(SALOMEDS_PythonObjectAttribute)(const SALOMEDS_PythonObjectAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem)
- {
- }
-
- Handle(SALOMEDS_PythonObjectAttribute)& operator=(const Handle(SALOMEDS_PythonObjectAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_PythonObjectAttribute)& operator=(const SALOMEDS_PythonObjectAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_PythonObjectAttribute* operator->()
- {
- return (SALOMEDS_PythonObjectAttribute *)ControlAccess();
- }
-
- SALOMEDS_PythonObjectAttribute* operator->() const
- {
- return (SALOMEDS_PythonObjectAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_PythonObjectAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_PythonObjectAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_SelectableAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_SelectableAttribute_HeaderFile
-#define _Handle_SALOMEDS_SelectableAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_Integer_HeaderFile
-#include <Handle_TDataStd_Integer.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_Integer);
-class SALOMEDS_SelectableAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_SelectableAttribute);
-
-class Handle(SALOMEDS_SelectableAttribute) : public Handle(TDataStd_Integer) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_SelectableAttribute)():Handle(TDataStd_Integer)() {}
- Handle(SALOMEDS_SelectableAttribute)(const Handle(SALOMEDS_SelectableAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle)
- {
- }
-
- Handle(SALOMEDS_SelectableAttribute)(const SALOMEDS_SelectableAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem)
- {
- }
-
- Handle(SALOMEDS_SelectableAttribute)& operator=(const Handle(SALOMEDS_SelectableAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_SelectableAttribute)& operator=(const SALOMEDS_SelectableAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_SelectableAttribute* operator->()
- {
- return (SALOMEDS_SelectableAttribute *)ControlAccess();
- }
-
- SALOMEDS_SelectableAttribute* operator->() const
- {
- return (SALOMEDS_SelectableAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_SelectableAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_SelectableAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_SequenceOfIntegerAttribute_HeaderFile
-#define _Handle_SALOMEDS_SequenceOfIntegerAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDF_Attribute);
-class SALOMEDS_SequenceOfIntegerAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute);
-
-class Handle(SALOMEDS_SequenceOfIntegerAttribute) : public Handle(TDF_Attribute) {
- public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- Handle(SALOMEDS_SequenceOfIntegerAttribute)():Handle(TDF_Attribute)() {}
- Handle(SALOMEDS_SequenceOfIntegerAttribute)(const Handle(SALOMEDS_SequenceOfIntegerAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle)
- {
- }
-
- Handle(SALOMEDS_SequenceOfIntegerAttribute)(const SALOMEDS_SequenceOfIntegerAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem)
- {
- }
-
- Handle(SALOMEDS_SequenceOfIntegerAttribute)& operator=(const Handle(SALOMEDS_SequenceOfIntegerAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_SequenceOfIntegerAttribute)& operator=(const SALOMEDS_SequenceOfIntegerAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_SequenceOfIntegerAttribute* operator->()
- {
- return (SALOMEDS_SequenceOfIntegerAttribute *)ControlAccess();
- }
-
- SALOMEDS_SequenceOfIntegerAttribute* operator->() const
- {
- return (SALOMEDS_SequenceOfIntegerAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_SequenceOfIntegerAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_SequenceOfIntegerAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_SequenceOfRealAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_SequenceOfRealAttribute_HeaderFile
-#define _Handle_SALOMEDS_SequenceOfRealAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDF_Attribute);
-class SALOMEDS_SequenceOfRealAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute);
-
-class Handle(SALOMEDS_SequenceOfRealAttribute) : public Handle(TDF_Attribute) {
- public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- Handle(SALOMEDS_SequenceOfRealAttribute)():Handle(TDF_Attribute)() {}
- Handle(SALOMEDS_SequenceOfRealAttribute)(const Handle(SALOMEDS_SequenceOfRealAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle)
- {
- }
-
- Handle(SALOMEDS_SequenceOfRealAttribute)(const SALOMEDS_SequenceOfRealAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem)
- {
- }
-
- Handle(SALOMEDS_SequenceOfRealAttribute)& operator=(const Handle(SALOMEDS_SequenceOfRealAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_SequenceOfRealAttribute)& operator=(const SALOMEDS_SequenceOfRealAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_SequenceOfRealAttribute* operator->()
- {
- return (SALOMEDS_SequenceOfRealAttribute *)ControlAccess();
- }
-
- SALOMEDS_SequenceOfRealAttribute* operator->() const
- {
- return (SALOMEDS_SequenceOfRealAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_SequenceOfRealAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_SequenceOfRealAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : Handle_SALOMEDS_StudyPropertiesAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_StudyPropertiesAttribute_HeaderFile
-#define _Handle_SALOMEDS_StudyPropertiesAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDF_Attribute);
-class SALOMEDS_StudyPropertiesAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute);
-
-class Handle(SALOMEDS_StudyPropertiesAttribute) : public Handle(TDF_Attribute) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_StudyPropertiesAttribute)():Handle(TDF_Attribute)() {}
- Handle(SALOMEDS_StudyPropertiesAttribute)(const Handle(SALOMEDS_StudyPropertiesAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle)
- {
- }
-
- Handle(SALOMEDS_StudyPropertiesAttribute)(const SALOMEDS_StudyPropertiesAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem)
- {
- }
-
- Handle(SALOMEDS_StudyPropertiesAttribute)& operator=(const Handle(SALOMEDS_StudyPropertiesAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_StudyPropertiesAttribute)& operator=(const SALOMEDS_StudyPropertiesAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_StudyPropertiesAttribute* operator->()
- {
- return (SALOMEDS_StudyPropertiesAttribute *)ControlAccess();
- }
-
- SALOMEDS_StudyPropertiesAttribute* operator->() const
- {
- return (SALOMEDS_StudyPropertiesAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_StudyPropertiesAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_StudyPropertiesAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : Handle_SALOMEDS_TableOfIntegerAttribute.hxx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_TableOfIntegerAttribute_HeaderFile
-#define _Handle_SALOMEDS_TableOfIntegerAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDF_Attribute);
-class SALOMEDS_TableOfIntegerAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TableOfIntegerAttribute);
-
-class Handle(SALOMEDS_TableOfIntegerAttribute) : public Handle(TDF_Attribute) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_TableOfIntegerAttribute)():Handle(TDF_Attribute)() {}
- Handle(SALOMEDS_TableOfIntegerAttribute)(const Handle(SALOMEDS_TableOfIntegerAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle)
- {
- }
-
- Handle(SALOMEDS_TableOfIntegerAttribute)(const SALOMEDS_TableOfIntegerAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem)
- {
- }
-
- Handle(SALOMEDS_TableOfIntegerAttribute)& operator=(const Handle(SALOMEDS_TableOfIntegerAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_TableOfIntegerAttribute)& operator=(const SALOMEDS_TableOfIntegerAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_TableOfIntegerAttribute* operator->()
- {
- return (SALOMEDS_TableOfIntegerAttribute *)ControlAccess();
- }
-
- SALOMEDS_TableOfIntegerAttribute* operator->() const
- {
- return (SALOMEDS_TableOfIntegerAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_TableOfIntegerAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_TableOfIntegerAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : Handle_SALOMEDS_TableOfRealAttribute.hxx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_TableOfRealAttribute_HeaderFile
-#define _Handle_SALOMEDS_TableOfRealAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDF_Attribute);
-class SALOMEDS_TableOfRealAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TableOfRealAttribute);
-
-class Handle(SALOMEDS_TableOfRealAttribute) : public Handle(TDF_Attribute) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_TableOfRealAttribute)():Handle(TDF_Attribute)() {}
- Handle(SALOMEDS_TableOfRealAttribute)(const Handle(SALOMEDS_TableOfRealAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle)
- {
- }
-
- Handle(SALOMEDS_TableOfRealAttribute)(const SALOMEDS_TableOfRealAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem)
- {
- }
-
- Handle(SALOMEDS_TableOfRealAttribute)& operator=(const Handle(SALOMEDS_TableOfRealAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_TableOfRealAttribute)& operator=(const SALOMEDS_TableOfRealAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_TableOfRealAttribute* operator->()
- {
- return (SALOMEDS_TableOfRealAttribute *)ControlAccess();
- }
-
- SALOMEDS_TableOfRealAttribute* operator->() const
- {
- return (SALOMEDS_TableOfRealAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_TableOfRealAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_TableOfRealAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : Handle_SALOMEDS_TableOfStringAttribute.hxx
-// Author : Sergey Ruin
-// Module : SALOME
-
-#ifndef _Handle_SALOMEDS_TableOfStringAttribute_HeaderFile
-#define _Handle_SALOMEDS_TableOfStringAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDF_Attribute);
-class SALOMEDS_TableOfStringAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TableOfStringAttribute);
-
-class Handle(SALOMEDS_TableOfStringAttribute) : public Handle(TDF_Attribute) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_TableOfStringAttribute)():Handle(TDF_Attribute)() {}
- Handle(SALOMEDS_TableOfStringAttribute)(const Handle(SALOMEDS_TableOfStringAttribute)& aHandle) : Handle(TDF_Attribute)(aHandle)
- {
- }
-
- Handle(SALOMEDS_TableOfStringAttribute)(const SALOMEDS_TableOfStringAttribute* anItem) : Handle(TDF_Attribute)((TDF_Attribute *)anItem)
- {
- }
-
- Handle(SALOMEDS_TableOfStringAttribute)& operator=(const Handle(SALOMEDS_TableOfStringAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_TableOfStringAttribute)& operator=(const SALOMEDS_TableOfStringAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_TableOfStringAttribute* operator->()
- {
- return (SALOMEDS_TableOfStringAttribute *)ControlAccess();
- }
-
- SALOMEDS_TableOfStringAttribute* operator->() const
- {
- return (SALOMEDS_TableOfStringAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_TableOfStringAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_TableOfStringAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_TargetAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_TargetAttribute_HeaderFile
-#define _Handle_SALOMEDS_TargetAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_Integer_HeaderFile
-#include <Handle_TDataStd_Integer.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_Integer);
-class SALOMEDS_TargetAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TargetAttribute);
-
-class Handle(SALOMEDS_TargetAttribute) : public Handle(TDataStd_Integer) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_TargetAttribute)():Handle(TDataStd_Integer)() {}
- Handle(SALOMEDS_TargetAttribute)(const Handle(SALOMEDS_TargetAttribute)& aHandle) : Handle(TDataStd_Integer)(aHandle)
- {
- }
-
- Handle(SALOMEDS_TargetAttribute)(const SALOMEDS_TargetAttribute* anItem) : Handle(TDataStd_Integer)((TDataStd_Integer *)anItem)
- {
- }
-
- Handle(SALOMEDS_TargetAttribute)& operator=(const Handle(SALOMEDS_TargetAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_TargetAttribute)& operator=(const SALOMEDS_TargetAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_TargetAttribute* operator->()
- {
- return (SALOMEDS_TargetAttribute *)ControlAccess();
- }
-
- SALOMEDS_TargetAttribute* operator->() const
- {
- return (SALOMEDS_TargetAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_TargetAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_TargetAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_TextColorAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_TextColorAttribute_HeaderFile
-#define _Handle_SALOMEDS_TextColorAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_RealArray_HeaderFile
-#include <Handle_TDataStd_RealArray.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_RealArray);
-class SALOMEDS_TextColorAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TextColorAttribute);
-
-class Handle(SALOMEDS_TextColorAttribute) : public Handle(TDataStd_RealArray) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_TextColorAttribute)():Handle(TDataStd_RealArray)() {}
- Handle(SALOMEDS_TextColorAttribute)(const Handle(SALOMEDS_TextColorAttribute)& aHandle) : Handle(TDataStd_RealArray)(aHandle)
- {
- }
-
- Handle(SALOMEDS_TextColorAttribute)(const SALOMEDS_TextColorAttribute* anItem) : Handle(TDataStd_RealArray)((TDataStd_RealArray *)anItem)
- {
- }
-
- Handle(SALOMEDS_TextColorAttribute)& operator=(const Handle(SALOMEDS_TextColorAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_TextColorAttribute)& operator=(const SALOMEDS_TextColorAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_TextColorAttribute* operator->()
- {
- return (SALOMEDS_TextColorAttribute *)ControlAccess();
- }
-
- SALOMEDS_TextColorAttribute* operator->() const
- {
- return (SALOMEDS_TextColorAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_TextColorAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_TextColorAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_TextHighlightColorAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Handle_SALOMEDS_TextHighlightColorAttribute_HeaderFile
-#define _Handle_SALOMEDS_TextHighlightColorAttribute_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_TDataStd_RealArray_HeaderFile
-#include <Handle_TDataStd_RealArray.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TDataStd_RealArray);
-class SALOMEDS_TextHighlightColorAttribute;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_TextHighlightColorAttribute);
-
-class Handle(SALOMEDS_TextHighlightColorAttribute) : public Handle(TDataStd_RealArray) {
- public:
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- Handle(SALOMEDS_TextHighlightColorAttribute)():Handle(TDataStd_RealArray)() {}
- Handle(SALOMEDS_TextHighlightColorAttribute)(const Handle(SALOMEDS_TextHighlightColorAttribute)& aHandle) : Handle(TDataStd_RealArray)(aHandle)
- {
- }
-
- Handle(SALOMEDS_TextHighlightColorAttribute)(const SALOMEDS_TextHighlightColorAttribute* anItem) : Handle(TDataStd_RealArray)((TDataStd_RealArray *)anItem)
- {
- }
-
- Handle(SALOMEDS_TextHighlightColorAttribute)& operator=(const Handle(SALOMEDS_TextHighlightColorAttribute)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(SALOMEDS_TextHighlightColorAttribute)& operator=(const SALOMEDS_TextHighlightColorAttribute* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- SALOMEDS_TextHighlightColorAttribute* operator->()
- {
- return (SALOMEDS_TextHighlightColorAttribute *)ControlAccess();
- }
-
- SALOMEDS_TextHighlightColorAttribute* operator->() const
- {
- return (SALOMEDS_TextHighlightColorAttribute *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(SALOMEDS_TextHighlightColorAttribute)();
-
- Standard_EXPORT static const Handle(SALOMEDS_TextHighlightColorAttribute) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
# This local variable defines the list of CPPFLAGS common to all target in this package.
COMMON_CPPFLAGS=\
- @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \
@BOOST_CPPFLAGS@ \
-I$(srcdir)/../HDFPersist \
@HDF5_INCLUDES@ \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../Utils \
+ -I$(srcdir)/../DF \
-I$(srcdir)/../SALOMEDSImpl \
-I$(srcdir)/../NamingService \
-I$(srcdir)/../GenericObj \
../SALOMELocalTrace/libSALOMELocalTrace.la \
../Basics/libSALOMEBasics.la \
../HDFPersist/libSalomeHDFPersist.la \
+ ../DF/libDF.la \
../SALOMEDSImpl/libSalomeDSImpl.la \
../GenericObj/libSalomeGenericObj.la \
../LifeCycleCORBA/libSalomeLifeCycleCORBA.la \
$(top_builddir)/idl/libSalomeIDLKernel.la\
- @CAS_KERNEL@ \
@HDF5_LIBS@ \
$(LDXMUFLAGS)
SALOMEDS_AttributeParameter.cxx \
SALOMEDS_AttributeString.cxx \
SALOMEDS_IParameters.cxx \
- \
- Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx \
- Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx \
- Handle_SALOMEDS_DrawableAttribute.hxx \
- Handle_SALOMEDS_ExpandableAttribute.hxx \
- Handle_SALOMEDS_ExternalFileDef.hxx \
- Handle_SALOMEDS_FileType.hxx \
- Handle_SALOMEDS_IORAttribute.hxx \
- Handle_SALOMEDS_LocalIDAttribute.hxx \
- Handle_SALOMEDS_OCAFApplication.hxx \
- Handle_SALOMEDS_OpenedAttribute.hxx \
- Handle_SALOMEDS_PersRefAttribute.hxx \
- Handle_SALOMEDS_PixMapAttribute.hxx \
- Handle_SALOMEDS_PythonObjectAttribute.hxx \
- Handle_SALOMEDS_SelectableAttribute.hxx \
- Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx \
- Handle_SALOMEDS_SequenceOfRealAttribute.hxx \
- Handle_SALOMEDS_StudyPropertiesAttribute.hxx \
- Handle_SALOMEDS_TableOfIntegerAttribute.hxx \
- Handle_SALOMEDS_TableOfRealAttribute.hxx \
- Handle_SALOMEDS_TableOfStringAttribute.hxx \
- Handle_SALOMEDS_TargetAttribute.hxx \
- Handle_SALOMEDS_TextColorAttribute.hxx \
- Handle_SALOMEDS_TextHighlightColorAttribute.hxx \
SALOMEDS_AttLong_i.hxx \
SALOMEDS_AttReal_i.hxx \
SALOMEDS_AttributeComment.hxx \
SALOMEDS_ChildIterator.hxx \
SALOMEDS_ChildIterator_i.hxx \
SALOMEDS_ClientAttributes.hxx \
- SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx \
- SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx \
- SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx \
- SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx \
- SALOMEDS_DataMapOfIntegerString.hxx \
- SALOMEDS_DataMapStringLabel.hxx \
- SALOMEDS_DrawableAttribute.hxx \
SALOMEDS_Driver_i.hxx \
- SALOMEDS_ExpandableAttribute.hxx \
- SALOMEDS_ExternalFileDef.hxx \
- SALOMEDS_FileType.hxx \
- SALOMEDS_FlagsAttribute.hxx \
SALOMEDS_GenericAttribute.hxx \
SALOMEDS_GenericAttribute_i.hxx \
- SALOMEDS_GraphicAttribute.hxx \
SALOMEDS.hxx \
- SALOMEDS_IORAttribute.hxx \
- SALOMEDS_LocalIDAttribute.hxx \
- SALOMEDS_OCAFApplication.hxx \
- SALOMEDS_OpenedAttribute.hxx \
- SALOMEDS_PersRefAttribute.hxx \
- SALOMEDS_PixMapAttribute.hxx \
- SALOMEDS_PythonObjectAttribute.hxx \
- SALOMEDS_SAttribute_i.hxx \
SALOMEDS_SComponent.hxx \
SALOMEDS_SComponent_i.hxx \
SALOMEDS_SComponentIterator.hxx \
SALOMEDS_SComponentIterator_i.hxx \
- SALOMEDS_SelectableAttribute.hxx \
- SALOMEDS_SequenceOfIntegerAttribute.hxx \
- SALOMEDS_SequenceOfRealAttribute.hxx \
SALOMEDS_SObject.hxx \
SALOMEDS_SObject_i.hxx \
SALOMEDS_StudyBuilder.hxx \
SALOMEDS_Study_i.hxx \
SALOMEDS_StudyManager.hxx \
SALOMEDS_StudyManager_i.hxx \
- SALOMEDS_StudyPropertiesAttribute.hxx \
- SALOMEDS_TableOfIntegerAttribute.hxx \
- SALOMEDS_TableOfRealAttribute.hxx \
- SALOMEDS_TableOfStringAttribute.hxx \
- SALOMEDS_TargetAttribute.hxx \
- SALOMEDS_TextColorAttribute.hxx \
- SALOMEDS_TextHighlightColorAttribute.hxx \
SALOMEDS_UseCaseBuilder.hxx \
SALOMEDS_UseCaseBuilder_i.hxx \
SALOMEDS_UseCaseIterator.hxx \
SALOMEDS_Server_SOURCES = SALOMEDS_Server.cxx
SALOMEDS_Server_CPPFLAGS = $(COMMON_CPPFLAGS)
-SALOMEDS_Server_LDADD = \
- libSalomeDS.la $(COMMON_LIBS) \
- ../ResourcesManager/libSalomeResourcesManager.la \
- @CAS_OCAF@ \
- @CORBA_LIBS@
+SALOMEDS_Server_LDADD = libSalomeDS.la
SALOMEDS_Client_SOURCES = SALOMEDS_Client.cxx
SALOMEDS_Client_CPPFLAGS = $(COMMON_CPPFLAGS)
-SALOMEDS_Client_LDADD = \
- libSalomeDS.la $(COMMON_LIBS) \
- ../ResourcesManager/libSalomeResourcesManager.la \
- -lTKLCAF -lTKMath \
- @CORBA_LIBS@
-
+SALOMEDS_Client_LDADD = libSalomeDS.la
+++ /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
---
--- File : SALOMEDS.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-package SALOMEDS
-
-uses TDocStd,
- TDF,
- TCollection,
- TColStd,
- TDataStd
-
-
-is
-
- class OCAFApplication ;
- class IORAttribute ;
- class PersRefAttribute;
- class SequenceOfRealAttribute;
- class SequenceOfIntegerAttribute;
- class DrawableAttribute;
- class SelectableAttribute;
- class ExpandableAttribute;
- class OpenedAttribute;
- class PixMapAttribute;
- class TextColorAttribute;
- class TextHighlightColorAttribute;
- class LocalIDAttribute;
- class UserIDAttribute;
- class TableOfIntegerAttribute;
- class TableOfRealAttribute;
- class StudyPropertiesAttribute;
- class PythonObjectAttribute;
-
- class DataMapStringLabel instantiates DataMap from TCollection
- (ExtendedString from TColleciton,
- Label from TDF,
- ExtendedString from TCollection);
-
-end SALOMEDS;
#include "SALOMEDS_AttLong_i.hxx"
#include "utilities.h"
-#include <TDF_Tool.hxx>
#include <stdio.h>
+#include <SALOMEDSImpl_AttributeInteger.hxx>
using namespace std;
//============================================================================
void SALOMEDS_AttLong_i::Set(CORBA::Long i)
{
CheckLocked();
- TDataStd_Integer::Set (_Lab,i);
+ SALOMEDSImpl_AttributeInteger::Set (_Lab,i);
}
//============================================================================
//============================================================================
CORBA::Long SALOMEDS_AttLong_i::Get()
{
- Handle(TDataStd_Integer) Att;
+ SALOMEDSImpl_AttributeInteger* Att = NULL;
CORBA::Long x;
- if (_Lab.FindAttribute(TDataStd_Integer::GetID(),Att))
+ if ((Att=(SALOMEDSImpl_AttributeInteger*)_Lab.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID())))
x = Att->Get ();
return x;
}
//============================================================================
CORBA::Boolean SALOMEDS_AttLong_i::GetPtr(SALOMEDS::SObject_ptr anObject)
{
- Handle(TDataStd_Integer) Att;
- return _Lab.FindAttribute(TDataStd_Integer::GetID(),Att);
+ return (_Lab.IsAttribute(SALOMEDSImpl_AttributeInteger::GetID()));
}
//============================================================================
#define __SALOMEDS_ATTLONG_I_H__
// IDL headers
-#include <TDataStd_Integer.hxx>
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS_AttLong)
#include "SALOMEDS_BasicAttribute_i.hxx"
#include "SALOMEDS_AttReal_i.hxx"
#include "utilities.h"
-#include <TDF_Tool.hxx>
#include <stdio.h>
#include <cstring>
+#include <SALOMEDSImpl_AttributeReal.hxx>
using namespace std;
//============================================================================
void SALOMEDS_AttReal_i::Set(CORBA::Double r)
{
CheckLocked();
- TDataStd_Real::Set (_Lab,r);
+ SALOMEDSImpl_AttributeReal::Set (_Lab,r);
}
//============================================================================
//============================================================================
CORBA::Double SALOMEDS_AttReal_i::Get()
{
- Handle(TDataStd_Real) Att;
+ SALOMEDSImpl_AttributeReal* Att;
CORBA::Double x;
- if (_Lab.FindAttribute(TDataStd_Real::GetID(),Att))
+ if ((Att=(SALOMEDSImpl_AttributeReal*)_Lab.FindAttribute(TDataStd_Real::GetID())))
x = Att->Get ();
return x;
}
//============================================================================
CORBA::Boolean SALOMEDS_AttReal_i::GetPtr(SALOMEDS::SObject_ptr anObject)
{
- Handle(TDataStd_Real) Att;
- return _Lab.FindAttribute(TDataStd_Real::GetID(),Att);
+ return _Lab.IsAttribute(SALOMEDSImpl_AttributeReal::GetID());
}
//============================================================================
#define __SALOMEDS_ATTREAL_I_H__
// IDL headers
-#include <TDataStd_Real.hxx>
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS_AttReal)
#include "SALOMEDS_BasicAttribute_i.hxx"
#include "SALOMEDS.hxx"
#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-SALOMEDS_AttributeComment::SALOMEDS_AttributeComment(const Handle(SALOMEDSImpl_AttributeComment)& theAttr)
+SALOMEDS_AttributeComment::SALOMEDS_AttributeComment(SALOMEDSImpl_AttributeComment* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
std::string aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeComment)::
- DownCast(_local_impl)->Value()).ToCString();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeComment*>(_local_impl)->Value();
}
else aValue = SALOMEDS::AttributeComment::_narrow(_corba_impl)->Value();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeComment)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeComment*>(_local_impl)->SetValue(value);
}
else SALOMEDS::AttributeComment::_narrow(_corba_impl)->SetValue(value.c_str());
}
class SALOMEDS_AttributeComment: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeComment
{
public:
- SALOMEDS_AttributeComment(const Handle(SALOMEDSImpl_AttributeComment)& theAttr);
+ SALOMEDS_AttributeComment(SALOMEDSImpl_AttributeComment* theAttr);
SALOMEDS_AttributeComment(SALOMEDS::AttributeComment_ptr theAttr);
~SALOMEDS_AttributeComment();
#include "SALOMEDS_AttributeComment_i.hxx"
-#include <TCollection_ExtendedString.hxx>
#include "SALOMEDS_SObject_i.hxx"
#include "SALOMEDS.hxx"
SALOMEDS::Locker lock;
CORBA::String_var c_s =
- CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeComment)::DownCast(_impl)->Value()).ToCString());
+ CORBA::string_dup(dynamic_cast<SALOMEDSImpl_AttributeComment*>(_impl)->Value().c_str());
return c_s._retn();
}
SALOMEDS::Locker lock;
CheckLocked();
- TCollection_AsciiString aStr((char*)value);
- Handle(SALOMEDSImpl_AttributeComment)::DownCast(_impl)->SetValue(TCollection_ExtendedString(aStr));
+ CORBA::String_var Str = CORBA::string_dup(value);
+ string aValue((char*)Str.in());
+ dynamic_cast<SALOMEDSImpl_AttributeComment*>(_impl)->SetValue(aValue);
}
public virtual SALOMEDS_GenericAttribute_i
{
public:
- SALOMEDS_AttributeComment_i(const Handle(SALOMEDSImpl_AttributeComment)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeComment_i(SALOMEDSImpl_AttributeComment* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
virtual ~SALOMEDS_AttributeComment_i() {};
#include "SALOMEDS_AttributeDrawable.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-SALOMEDS_AttributeDrawable::SALOMEDS_AttributeDrawable(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr)
+SALOMEDS_AttributeDrawable::SALOMEDS_AttributeDrawable(SALOMEDSImpl_AttributeDrawable* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
bool aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = (bool)Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->IsDrawable();
+ aValue = (bool)dynamic_cast<SALOMEDSImpl_AttributeDrawable*>(_local_impl)->IsDrawable();
}
else aValue = SALOMEDS::AttributeDrawable::_narrow(_corba_impl)->IsDrawable();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_local_impl)->SetDrawable((int)value);
+ dynamic_cast<SALOMEDSImpl_AttributeDrawable*>(_local_impl)->SetDrawable((int)value);
}
else SALOMEDS::AttributeDrawable::_narrow(_corba_impl)->SetDrawable(value);
}
class SALOMEDS_AttributeDrawable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeDrawable
{
public:
- SALOMEDS_AttributeDrawable(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr);
+ SALOMEDS_AttributeDrawable(SALOMEDSImpl_AttributeDrawable* theAttr);
SALOMEDS_AttributeDrawable(SALOMEDS::AttributeDrawable_ptr theAttr);
~SALOMEDS_AttributeDrawable();
CORBA::Boolean SALOMEDS_AttributeDrawable_i::IsDrawable()
{
SALOMEDS::Locker lock;
- return (Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->IsDrawable() == 1);
+ return (dynamic_cast<SALOMEDSImpl_AttributeDrawable*>(_impl)->IsDrawable() == 1);
}
void SALOMEDS_AttributeDrawable_i::SetDrawable(CORBA::Boolean value)
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeDrawable)::DownCast(_impl)->SetDrawable(value);
+ dynamic_cast<SALOMEDSImpl_AttributeDrawable*>(_impl)->SetDrawable(value);
}
{
public:
- SALOMEDS_AttributeDrawable_i(const Handle(SALOMEDSImpl_AttributeDrawable)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeDrawable_i(SALOMEDSImpl_AttributeDrawable* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
virtual ~SALOMEDS_AttributeDrawable_i() {};
#include "SALOMEDS_AttributeExpandable.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-SALOMEDS_AttributeExpandable::SALOMEDS_AttributeExpandable
- (const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr)
+SALOMEDS_AttributeExpandable::SALOMEDS_AttributeExpandable(SALOMEDSImpl_AttributeExpandable* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
bool aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = (bool)Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->IsExpandable();
+ aValue = (bool)dynamic_cast<SALOMEDSImpl_AttributeExpandable*>(_local_impl)->IsExpandable();
}
else aValue = SALOMEDS::AttributeExpandable::_narrow(_corba_impl)->IsExpandable();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_local_impl)->SetExpandable((int)value);
+ dynamic_cast<SALOMEDSImpl_AttributeExpandable*>(_local_impl)->SetExpandable((int)value);
}
else SALOMEDS::AttributeExpandable::_narrow(_corba_impl)->SetExpandable(value);
}
class SALOMEDS_AttributeExpandable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeExpandable
{
public:
- SALOMEDS_AttributeExpandable(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr);
+ SALOMEDS_AttributeExpandable(SALOMEDSImpl_AttributeExpandable* theAttr);
SALOMEDS_AttributeExpandable(SALOMEDS::AttributeExpandable_ptr theAttr);
~SALOMEDS_AttributeExpandable();
CORBA::Boolean SALOMEDS_AttributeExpandable_i::IsExpandable()
{
SALOMEDS::Locker lock;
- return (Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->IsExpandable() == 1);
+ return (dynamic_cast<SALOMEDSImpl_AttributeExpandable*>(_impl)->IsExpandable() == 1);
}
void SALOMEDS_AttributeExpandable_i::SetExpandable(CORBA::Boolean value)
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeExpandable)::DownCast(_impl)->SetExpandable(value);
+ dynamic_cast<SALOMEDSImpl_AttributeExpandable*>(_impl)->SetExpandable(value);
}
{
public:
- SALOMEDS_AttributeExpandable_i(const Handle(SALOMEDSImpl_AttributeExpandable)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeExpandable_i(SALOMEDSImpl_AttributeExpandable* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeExpandable_i() {};
#include "SALOMEDS_AttributeExternalFileDef.hxx"
#include "SALOMEDS.hxx"
-
#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-SALOMEDS_AttributeExternalFileDef::SALOMEDS_AttributeExternalFileDef(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr)
+SALOMEDS_AttributeExternalFileDef::SALOMEDS_AttributeExternalFileDef(SALOMEDSImpl_AttributeExternalFileDef* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
std::string aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeExternalFileDef)::
- DownCast(_local_impl)->Value()).ToCString();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeExternalFileDef*>(_local_impl)->Value();
}
else aValue = SALOMEDS::AttributeExternalFileDef::_narrow(_corba_impl)->Value();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeExternalFileDef*>(_local_impl)->SetValue(value);
}
else SALOMEDS::AttributeExternalFileDef::_narrow(_corba_impl)->SetValue(value.c_str());
}
class SALOMEDS_AttributeExternalFileDef: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeExternalFileDef
{
public:
- SALOMEDS_AttributeExternalFileDef(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr);
+ SALOMEDS_AttributeExternalFileDef(SALOMEDSImpl_AttributeExternalFileDef* theAttr);
SALOMEDS_AttributeExternalFileDef(SALOMEDS::AttributeExternalFileDef_ptr theAttr);
~SALOMEDS_AttributeExternalFileDef();
#include "SALOMEDS_AttributeExternalFileDef_i.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_ExtendedString.hxx>
using namespace std;
{
SALOMEDS::Locker lock;
CORBA::String_var c_s =
- CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_impl)->Value()).ToCString());
+ CORBA::string_dup(dynamic_cast<SALOMEDSImpl_AttributeExternalFileDef*>(_impl)->Value().c_str());
return c_s._retn();
}
SALOMEDS::Locker lock;
CheckLocked();
CORBA::String_var Str = CORBA::string_dup(value);
- Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str));
+ dynamic_cast<SALOMEDSImpl_AttributeExternalFileDef*>(_impl)->SetValue(string(Str));
}
{
public:
- SALOMEDS_AttributeExternalFileDef_i(const Handle(SALOMEDSImpl_AttributeExternalFileDef)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeExternalFileDef_i(SALOMEDSImpl_AttributeExternalFileDef* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {}
~SALOMEDS_AttributeExternalFileDef_i() {};
#include "SALOMEDS.hxx"
#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-SALOMEDS_AttributeFileType::SALOMEDS_AttributeFileType(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr)
+SALOMEDS_AttributeFileType::SALOMEDS_AttributeFileType(SALOMEDSImpl_AttributeFileType* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
std::string aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeFileType)::
- DownCast(_local_impl)->Value()).ToCString();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeFileType*>(_local_impl)->Value();
}
else aValue = SALOMEDS::AttributeFileType::_narrow(_corba_impl)->Value();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeFileType*>(_local_impl)->SetValue(value);
}
else SALOMEDS::AttributeFileType::_narrow(_corba_impl)->SetValue(value.c_str());
}
class SALOMEDS_AttributeFileType: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeFileType
{
public:
- SALOMEDS_AttributeFileType(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr);
+ SALOMEDS_AttributeFileType(SALOMEDSImpl_AttributeFileType* theAttr);
SALOMEDS_AttributeFileType(SALOMEDS::AttributeFileType_ptr theAttr);
~SALOMEDS_AttributeFileType();
#include "SALOMEDS_AttributeFileType_i.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_ExtendedString.hxx>
using namespace std;
{
SALOMEDS::Locker lock;
CORBA::String_var c_s =
- CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_impl)->Value()).ToCString());
+ CORBA::string_dup(dynamic_cast<SALOMEDSImpl_AttributeFileType*>(_impl)->Value().c_str());
return c_s._retn();
}
SALOMEDS::Locker lock;
CheckLocked();
CORBA::String_var Str = CORBA::string_dup(value);
- Handle(SALOMEDSImpl_AttributeFileType)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str));
+ string aValue((char*)Str.in());
+ dynamic_cast<SALOMEDSImpl_AttributeFileType*>(_impl)->SetValue(aValue);
}
public virtual SALOMEDS_GenericAttribute_i {
public:
- SALOMEDS_AttributeFileType_i(const Handle(SALOMEDSImpl_AttributeFileType)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeFileType_i(SALOMEDSImpl_AttributeFileType* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeFileType_i() {};
#include "SALOMEDS_AttributeFlags.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-SALOMEDS_AttributeFlags::SALOMEDS_AttributeFlags(const Handle(SALOMEDSImpl_AttributeFlags)& theAttr)
+SALOMEDS_AttributeFlags::SALOMEDS_AttributeFlags(SALOMEDSImpl_AttributeFlags* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
int aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Get();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_local_impl)->Get();
}
else aValue = SALOMEDS::AttributeFlags::_narrow(_corba_impl)->GetFlags();
return aValue;
{
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl)->Set(theFlags);
+ dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_local_impl)->Set(theFlags);
}
else SALOMEDS::AttributeFlags::_narrow(_corba_impl)->SetFlags(theFlags);
}
{
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeFlags* anAttr = dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_local_impl);
if (theValue)
anAttr->Set(anAttr->Get() | theFlag);
else
class SALOMEDS_AttributeFlags: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeFlags
{
public:
- SALOMEDS_AttributeFlags(const Handle(SALOMEDSImpl_AttributeFlags)& theAttr);
+ SALOMEDS_AttributeFlags(SALOMEDSImpl_AttributeFlags* theAttr);
SALOMEDS_AttributeFlags(SALOMEDS::AttributeFlags_ptr theAttr);
~SALOMEDS_AttributeFlags();
CORBA::Long SALOMEDS_AttributeFlags_i::GetFlags()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get();
+ return dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Get();
}
//=======================================================================
void SALOMEDS_AttributeFlags_i::SetFlags( CORBA::Long theFlags )
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Set( theFlags );
+ dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Set( theFlags );
}
//=======================================================================
CORBA::Boolean SALOMEDS_AttributeFlags_i::Get( CORBA::Long theFlag )
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl)->Get() & theFlag ? true : false;
+ return dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl)->Get() & theFlag ? true : false;
}
//=======================================================================
void SALOMEDS_AttributeFlags_i::Set( CORBA::Long theFlag, CORBA::Boolean theValue )
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeFlags) anAttr = Handle(SALOMEDSImpl_AttributeFlags)::DownCast(_impl);
+ SALOMEDSImpl_AttributeFlags* anAttr = dynamic_cast<SALOMEDSImpl_AttributeFlags*>(_impl);
if ( theValue )
anAttr->Set( anAttr->Get() | theFlag );
else
{
public:
- SALOMEDS_AttributeFlags_i( const Handle(SALOMEDSImpl_AttributeFlags)& theAttr, CORBA::ORB_ptr orb )
+ SALOMEDS_AttributeFlags_i( SALOMEDSImpl_AttributeFlags* theAttr, CORBA::ORB_ptr orb )
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
virtual ~SALOMEDS_AttributeFlags_i() {};
#include "SALOMEDS_AttributeGraphic.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-SALOMEDS_AttributeGraphic::SALOMEDS_AttributeGraphic(const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr)
+SALOMEDS_AttributeGraphic::SALOMEDS_AttributeGraphic(SALOMEDSImpl_AttributeGraphic* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
bool aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = (bool)Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->GetVisibility(theViewId);
+ aValue = (bool)dynamic_cast<SALOMEDSImpl_AttributeGraphic*>(_local_impl)->GetVisibility(theViewId);
}
else aValue = SALOMEDS::AttributeGraphic::_narrow(_corba_impl)->GetVisibility(theViewId);
return aValue;
{
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_local_impl)->SetVisibility(theViewId, theValue);
+ dynamic_cast<SALOMEDSImpl_AttributeGraphic*>(_local_impl)->SetVisibility(theViewId, theValue);
}
else SALOMEDS::AttributeGraphic::_narrow(_corba_impl)->SetVisibility(theViewId, theValue);
}
class SALOMEDS_AttributeGraphic: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeGraphic
{
public:
- SALOMEDS_AttributeGraphic(const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr);
+ SALOMEDS_AttributeGraphic(SALOMEDSImpl_AttributeGraphic* theAttr);
SALOMEDS_AttributeGraphic(SALOMEDS::AttributeGraphic_ptr theAttr);
~SALOMEDS_AttributeGraphic();
CORBA::Boolean theValue )
{
SALOMEDS::Locker lock;
- if ( !_impl.IsNull() )
- Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_impl)->SetVisibility( theViewId, theValue );
+ if ( _impl )
+ dynamic_cast<SALOMEDSImpl_AttributeGraphic*>(_impl)->SetVisibility( theViewId, theValue );
}
//=======================================================================
CORBA::Boolean SALOMEDS_AttributeGraphic_i::GetVisibility( CORBA::Long theViewId )
{
SALOMEDS::Locker lock;
- return !_impl.IsNull() ? Handle(SALOMEDSImpl_AttributeGraphic)::DownCast(_impl)->GetVisibility( theViewId ) : false;
+ return ( _impl ) ? dynamic_cast<SALOMEDSImpl_AttributeGraphic*>(_impl)->GetVisibility( theViewId ) : false;
}
{
public:
- SALOMEDS_AttributeGraphic_i( const Handle(SALOMEDSImpl_AttributeGraphic)& theAttr, CORBA::ORB_ptr orb )
+ SALOMEDS_AttributeGraphic_i( SALOMEDSImpl_AttributeGraphic* theAttr, CORBA::ORB_ptr orb )
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
virtual ~SALOMEDS_AttributeGraphic_i() {};
#include "SALOMEDS.hxx"
#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-SALOMEDS_AttributeIOR::SALOMEDS_AttributeIOR(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr)
+SALOMEDS_AttributeIOR::SALOMEDS_AttributeIOR(SALOMEDSImpl_AttributeIOR* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
std::string aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeIOR)::
- DownCast(_local_impl)->Value()).ToCString();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeIOR*>(_local_impl)->Value();
}
else aValue = SALOMEDS::AttributeIOR::_narrow(_corba_impl)->Value();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeIOR*>(_local_impl)->SetValue(value);
}
else SALOMEDS::AttributeIOR::_narrow(_corba_impl)->SetValue(value.c_str());
}
class SALOMEDS_AttributeIOR: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeIOR
{
public:
- SALOMEDS_AttributeIOR(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr);
+ SALOMEDS_AttributeIOR(SALOMEDSImpl_AttributeIOR* theAttr);
SALOMEDS_AttributeIOR(SALOMEDS::AttributeIOR_ptr theAttr);
~SALOMEDS_AttributeIOR();
#include "SALOMEDS_AttributeIOR_i.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_ExtendedString.hxx>
using namespace std;
{
SALOMEDS::Locker lock;
CORBA::String_var c_s =
- CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_impl)->Value()).ToCString());
+ CORBA::string_dup(dynamic_cast<SALOMEDSImpl_AttributeIOR*>(_impl)->Value().c_str());
return c_s._retn();
}
SALOMEDS::Locker lock;
CheckLocked();
CORBA::String_var Str = CORBA::string_dup(value);
- TCollection_ExtendedString anExtStr((char *)Str.in());
- Handle(SALOMEDSImpl_AttributeIOR)::DownCast(_impl)->SetValue(anExtStr);
+ string anExtStr((char *)Str.in());
+ dynamic_cast<SALOMEDSImpl_AttributeIOR*>(_impl)->SetValue(anExtStr);
}
public virtual SALOMEDS_GenericAttribute_i {
public:
- SALOMEDS_AttributeIOR_i(const Handle(SALOMEDSImpl_AttributeIOR)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeIOR_i(SALOMEDSImpl_AttributeIOR* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeIOR_i() {};
#include "SALOMEDS_AttributeInteger.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-SALOMEDS_AttributeInteger::SALOMEDS_AttributeInteger(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr)
+SALOMEDS_AttributeInteger::SALOMEDS_AttributeInteger(SALOMEDSImpl_AttributeInteger* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
int SALOMEDS_AttributeInteger::Value()
{
- int aValue;
+ int aValue = 0;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->Value();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeInteger*>(_local_impl)->Value();
+ }
+ else {
+ aValue = SALOMEDS::AttributeInteger::_narrow(_corba_impl)->Value();
}
- else aValue = SALOMEDS::AttributeInteger::_narrow(_corba_impl)->Value();
return aValue;
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_local_impl)->SetValue(value);
+ dynamic_cast<SALOMEDSImpl_AttributeInteger*>(_local_impl)->SetValue(value);
}
else SALOMEDS::AttributeInteger::_narrow(_corba_impl)->SetValue(value);
}
class SALOMEDS_AttributeInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeInteger
{
public:
- SALOMEDS_AttributeInteger(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr);
+ SALOMEDS_AttributeInteger(SALOMEDSImpl_AttributeInteger* theAttr);
SALOMEDS_AttributeInteger(SALOMEDS::AttributeInteger_ptr theAttr);
~SALOMEDS_AttributeInteger();
CORBA::Long SALOMEDS_AttributeInteger_i::Value()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->Value();
+ return dynamic_cast<SALOMEDSImpl_AttributeInteger*>(_impl)->Value();
}
void SALOMEDS_AttributeInteger_i::SetValue(CORBA::Long value)
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeInteger)::DownCast(_impl)->SetValue(value);
+ dynamic_cast<SALOMEDSImpl_AttributeInteger*>(_impl)->SetValue(value);
}
public virtual SALOMEDS_GenericAttribute_i {
public:
- SALOMEDS_AttributeInteger_i(const Handle(SALOMEDSImpl_AttributeInteger)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeInteger_i(SALOMEDSImpl_AttributeInteger* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeInteger_i() {};
#include "SALOMEDS_AttributeLocalID.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-SALOMEDS_AttributeLocalID::SALOMEDS_AttributeLocalID(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr)
+SALOMEDS_AttributeLocalID::SALOMEDS_AttributeLocalID(SALOMEDSImpl_AttributeLocalID* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
int aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->Value();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeLocalID*>(_local_impl)->Value();
}
else aValue = SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->Value();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_local_impl)->SetValue(value);
+ dynamic_cast<SALOMEDSImpl_AttributeLocalID*>(_local_impl)->SetValue(value);
}
else SALOMEDS::AttributeLocalID::_narrow(_corba_impl)->SetValue(value);
}
class SALOMEDS_AttributeLocalID: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeLocalID
{
public:
- SALOMEDS_AttributeLocalID(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr);
+ SALOMEDS_AttributeLocalID(SALOMEDSImpl_AttributeLocalID* theAttr);
SALOMEDS_AttributeLocalID(SALOMEDS::AttributeLocalID_ptr theAttr);
~SALOMEDS_AttributeLocalID();
CORBA::Long SALOMEDS_AttributeLocalID_i::Value()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_impl)->Value();
+ return dynamic_cast<SALOMEDSImpl_AttributeLocalID*>(_impl)->Value();
}
void SALOMEDS_AttributeLocalID_i::SetValue(CORBA::Long value)
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeLocalID)::DownCast(_impl)->SetValue(value);
+ dynamic_cast<SALOMEDSImpl_AttributeLocalID*>(_impl)->SetValue(value);
}
{
public:
- SALOMEDS_AttributeLocalID_i(const Handle(SALOMEDSImpl_AttributeLocalID)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeLocalID_i(SALOMEDSImpl_AttributeLocalID* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeLocalID_i() {};
#include "SALOMEDS.hxx"
#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-SALOMEDS_AttributeName::SALOMEDS_AttributeName(const Handle(SALOMEDSImpl_AttributeName)& theAttr)
+SALOMEDS_AttributeName::SALOMEDS_AttributeName(SALOMEDSImpl_AttributeName* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
std::string aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeName)::
- DownCast(_local_impl)->Value()).ToCString();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeName*>(_local_impl)->Value();
}
else aValue = SALOMEDS::AttributeName::_narrow(_corba_impl)->Value();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeName)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeName*>(_local_impl)->SetValue(value);
}
else SALOMEDS::AttributeName::_narrow(_corba_impl)->SetValue(value.c_str());
}
class SALOMEDS_AttributeName: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeName
{
public:
- SALOMEDS_AttributeName(const Handle(SALOMEDSImpl_AttributeName)& theAttr);
+ SALOMEDS_AttributeName(SALOMEDSImpl_AttributeName* theAttr);
SALOMEDS_AttributeName(SALOMEDS::AttributeName_ptr theAttr);
~SALOMEDS_AttributeName();
#include "SALOMEDS_AttributeName_i.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_ExtendedString.hxx>
using namespace std;
{
SALOMEDS::Locker lock;
CORBA::String_var c_s =
- CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeName)::DownCast(_impl)->Value()).ToCString());
+ CORBA::string_dup(dynamic_cast<SALOMEDSImpl_AttributeName*>(_impl)->Value().c_str());
return c_s._retn();
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeName)::DownCast(_impl)->SetValue(TCollection_ExtendedString((char*)value));
+ dynamic_cast<SALOMEDSImpl_AttributeName*>(_impl)->SetValue(string(value));
}
{
public:
- SALOMEDS_AttributeName_i(const Handle(SALOMEDSImpl_AttributeName)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeName_i(SALOMEDSImpl_AttributeName* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeName_i() {};
#include "SALOMEDS_AttributeOpened.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-SALOMEDS_AttributeOpened::SALOMEDS_AttributeOpened(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr)
+SALOMEDS_AttributeOpened::SALOMEDS_AttributeOpened(SALOMEDSImpl_AttributeOpened* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
bool aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = (bool)Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->IsOpened();
+ aValue = (bool)dynamic_cast<SALOMEDSImpl_AttributeOpened*>(_local_impl)->IsOpened();
}
else aValue = SALOMEDS::AttributeOpened::_narrow(_corba_impl)->IsOpened();
return aValue;
{
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_local_impl)->SetOpened((int)value);
+ dynamic_cast<SALOMEDSImpl_AttributeOpened*>(_local_impl)->SetOpened((int)value);
}
else SALOMEDS::AttributeOpened::_narrow(_corba_impl)->SetOpened(value);
}
class SALOMEDS_AttributeOpened: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeOpened
{
public:
- SALOMEDS_AttributeOpened(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr);
+ SALOMEDS_AttributeOpened(SALOMEDSImpl_AttributeOpened* theAttr);
SALOMEDS_AttributeOpened(SALOMEDS::AttributeOpened_ptr theAttr);
~SALOMEDS_AttributeOpened();
CORBA::Boolean SALOMEDS_AttributeOpened_i::IsOpened()
{
SALOMEDS::Locker lock;
- return (Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->IsOpened() == 1);
+ return (dynamic_cast<SALOMEDSImpl_AttributeOpened*>(_impl)->IsOpened() == 1);
}
void SALOMEDS_AttributeOpened_i::SetOpened(CORBA::Boolean value)
{
SALOMEDS::Locker lock;
- Standard_Integer val = 0;
+ int val = 0;
if (value != 0) val = 1;
- Handle(SALOMEDSImpl_AttributeOpened)::DownCast(_impl)->SetOpened(val);
+ dynamic_cast<SALOMEDSImpl_AttributeOpened*>(_impl)->SetOpened(val);
}
{
public:
- SALOMEDS_AttributeOpened_i(const Handle(SALOMEDSImpl_AttributeOpened)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeOpened_i(SALOMEDSImpl_AttributeOpened* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeOpened_i() {};
#include "SALOMEDS.hxx"
#include <string>
-#include <TCollection_AsciiString.hxx>
+
+using namespace std;
//=======================================================================
/*!
* Purpose : Creates a new instance of SALOMEDS_AttributeParameter
*/
//=======================================================================
-SALOMEDS_AttributeParameter::SALOMEDS_AttributeParameter(const Handle(SALOMEDSImpl_AttributeParameter)& theAttr)
+SALOMEDS_AttributeParameter::SALOMEDS_AttributeParameter(SALOMEDSImpl_AttributeParameter* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
if(_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetInt(theID, theValue);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->SetInt(theID, theValue);
}
else
SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetInt(theID.c_str(), theValue);
int aValue;
if(_isLocal) {
SALOMEDS::Locker lock;
- aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetInt(theID);
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->GetInt(theID);
}
else
aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetInt(theID.c_str());
if(_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetReal(theID, theValue);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->SetReal(theID, theValue);
}
else
SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetReal(theID.c_str(), theValue);
double aValue;
if(_isLocal) {
SALOMEDS::Locker lock;
- aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetReal(theID);
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->GetReal(theID);
}
else
aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetReal(theID.c_str());
if(_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetString(theID, theValue);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->SetString(theID, theValue);
}
else
SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetString(theID.c_str(), theValue.c_str());
string aValue;
if(_isLocal) {
SALOMEDS::Locker lock;
- aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetString(theID);
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->GetString(theID);
}
else
aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetString(theID.c_str());
if(_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetBool(theID, theValue);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->SetBool(theID, theValue);
}
else
SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetBool(theID.c_str(), theValue);
{
if(_isLocal) {
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetBool(theID);
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->GetBool(theID);
}
else
return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetBool(theID.c_str());
if(_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetRealArray(theID, theArray);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->SetRealArray(theID, theArray);
}
else {
SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq;
vector<double> v;
if(_isLocal) {
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetRealArray(theID);
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->GetRealArray(theID);
}
else {
SALOMEDS::DoubleSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetRealArray(theID.c_str());
if(_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetIntArray(theID, theArray);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->SetIntArray(theID, theArray);
}
else {
SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq;
vector<int> v;
if(_isLocal) {
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetIntArray(theID);
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->GetIntArray(theID);
}
else {
SALOMEDS::LongSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetIntArray(theID.c_str());
if(_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetStrArray(theID, theArray);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->SetStrArray(theID, theArray);
}
else {
SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq;
vector<string> v;
if(_isLocal) {
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetStrArray(theID);
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->GetStrArray(theID);
}
else {
SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetStrArray(theID.c_str());
{
if(_isLocal) {
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->IsSet(theID, (Parameter_Types)theType);
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->IsSet(theID, (Parameter_Types)theType);
}
else
return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->IsSet(theID.c_str(), theType);
if(_isLocal) {
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->RemoveID(theID, (Parameter_Types)theType);
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->RemoveID(theID, (Parameter_Types)theType);
}
else
return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->RemoveID(theID.c_str(), theType);
SALOMEDSClient_AttributeParameter* AP = NULL;
if(_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter) AP_impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetFather();
- if(AP_impl.IsNull()) return _PTR(AttributeParameter)(AP);
+ SALOMEDSImpl_AttributeParameter* AP_impl = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->GetFather();
+ if(!AP_impl) return _PTR(AttributeParameter)(AP);
AP = new SALOMEDS_AttributeParameter(AP_impl);
}
else {
{
if(_isLocal) {
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->HasFather();
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->HasFather();
}
else
return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->HasFather();
{
if(_isLocal) {
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->IsRoot();
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->IsRoot();
}
else
return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->IsRoot();
{
if(_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->Clear();
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl)->Clear();
}
else
SALOMEDS::AttributeParameter::_narrow(_corba_impl)->Clear();
vector<string> v;
if(_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter) AP_impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeParameter* AP_impl = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_local_impl);
return AP_impl->GetIDs((Parameter_Types)theType);
}
else {
class SALOMEDS_AttributeParameter: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeParameter
{
public:
- SALOMEDS_AttributeParameter(const Handle(SALOMEDSImpl_AttributeParameter)& theAttr);
+ SALOMEDS_AttributeParameter(SALOMEDSImpl_AttributeParameter* theAttr);
SALOMEDS_AttributeParameter(SALOMEDS::AttributeParameter_ptr theAttr);
~SALOMEDS_AttributeParameter();
#include "SALOMEDS_AttributeParameter_i.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
#include <vector>
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetInt(theID, theValue);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->SetInt(theID, theValue);
}
//=======================================================================
CORBA::Long SALOMEDS_AttributeParameter_i::GetInt(const char* theID)
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetInt(theID);
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->GetInt(theID);
}
//=======================================================================
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetReal(theID, theValue);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->SetReal(theID, theValue);
}
//=======================================================================
CORBA::Double SALOMEDS_AttributeParameter_i::GetReal(const char* theID)
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetReal(theID);
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->GetReal(theID);
}
//=======================================================================
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl);
+ SALOMEDSImpl_AttributeParameter* impl = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl);
impl->SetString(theID, theValue);
}
char* SALOMEDS_AttributeParameter_i::GetString(const char* theID)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl);
+ SALOMEDSImpl_AttributeParameter* impl = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl);
CORBA::String_var c_s = CORBA::string_dup(impl->GetString(theID).c_str());
return c_s._retn();
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetBool(theID, theValue);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->SetBool(theID, theValue);
}
//=======================================================================
CORBA::Boolean SALOMEDS_AttributeParameter_i::GetBool(const char* theID)
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetBool(theID);
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->GetBool(theID);
}
//=======================================================================
v.resize(length);
for(int i = 0; i<length; i++) v[i] = theArray[i];
}
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetRealArray(theID, v);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->SetRealArray(theID, v);
}
//=======================================================================
{
SALOMEDS::Locker lock;
SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq;
- vector<double> v = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetRealArray(theID);
+ vector<double> v = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->GetRealArray(theID);
int length = v.size();
if(length) {
aSeq->length(length);
v.resize(length);
for(int i = 0; i<length; i++) v[i] = theArray[i];
}
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetIntArray(theID, v);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->SetIntArray(theID, v);
}
//=======================================================================
{
SALOMEDS::Locker lock;
SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq;
- vector<int> v = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetIntArray(theID);
+ vector<int> v = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->GetIntArray(theID);
int length = v.size();
if(length) {
aSeq->length(length);
v.resize(length);
for(int i = 0; i<length; i++) v[i] = string(theArray[i].in());
}
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->SetStrArray(theID, v);
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->SetStrArray(theID, v);
}
//=======================================================================
{
SALOMEDS::Locker lock;
SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq;
- vector<string> v = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetStrArray(theID);
+ vector<string> v = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->GetStrArray(theID);
int length = v.size();
if(length) {
aSeq->length(length);
CORBA::Boolean SALOMEDS_AttributeParameter_i::IsSet(const char* theID, CORBA::Long theType)
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->IsSet(theID, (Parameter_Types)theType);
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->IsSet(theID, (Parameter_Types)theType);
}
//=======================================================================
{
SALOMEDS::Locker lock;
CheckLocked();
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->RemoveID(theID, (Parameter_Types)theType);
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->RemoveID(theID, (Parameter_Types)theType);
}
//=======================================================================
SALOMEDS::AttributeParameter_ptr SALOMEDS_AttributeParameter_i::GetFather()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl);
+ SALOMEDSImpl_AttributeParameter* impl = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl);
SALOMEDS_AttributeParameter_i* attr = new SALOMEDS_AttributeParameter_i(impl, _orb);
return attr->AttributeParameter::_this();
}
CORBA::Boolean SALOMEDS_AttributeParameter_i::HasFather()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->HasFather();
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->HasFather();
}
//=======================================================================
CORBA::Boolean SALOMEDS_AttributeParameter_i::IsRoot()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->IsRoot();
+ return dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->IsRoot();
}
//=======================================================================
void SALOMEDS_AttributeParameter_i::Clear()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->Clear();
+ dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->Clear();
}
{
SALOMEDS::Locker lock;
SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq;
- vector<string> A = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetIDs((Parameter_Types)theType);
+ vector<string> A = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(_impl)->GetIDs((Parameter_Types)theType);
if(A.size()) {
int length = A.size();
{
public:
- SALOMEDS_AttributeParameter_i(const Handle(SALOMEDSImpl_AttributeParameter)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeParameter_i(SALOMEDSImpl_AttributeParameter* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeParameter_i() {};
#include "SALOMEDS.hxx"
#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-SALOMEDS_AttributePersistentRef::SALOMEDS_AttributePersistentRef(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr)
+SALOMEDS_AttributePersistentRef::SALOMEDS_AttributePersistentRef(SALOMEDSImpl_AttributePersistentRef* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
std::string aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePersistentRef)::
- DownCast(_local_impl)->Value()).ToCString();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributePersistentRef*>(_local_impl)->Value();
}
else aValue = SALOMEDS::AttributePersistentRef::_narrow(_corba_impl)->Value();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributePersistentRef*>(_local_impl)->SetValue(value);
}
else SALOMEDS::AttributePersistentRef::_narrow(_corba_impl)->SetValue(value.c_str());
}
class SALOMEDS_AttributePersistentRef: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePersistentRef
{
public:
- SALOMEDS_AttributePersistentRef(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr);
+ SALOMEDS_AttributePersistentRef(SALOMEDSImpl_AttributePersistentRef* theAttr);
SALOMEDS_AttributePersistentRef(SALOMEDS::AttributePersistentRef_ptr theAttr);
~SALOMEDS_AttributePersistentRef();
#include "SALOMEDS_AttributePersistentRef_i.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_ExtendedString.hxx>
using namespace std;
{
SALOMEDS::Locker lock;
CORBA::String_var c_s =
- CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_impl)->Value()).ToCString());
+ CORBA::string_dup(dynamic_cast<SALOMEDSImpl_AttributePersistentRef*>(_impl)->Value().c_str());
return c_s._retn();
}
SALOMEDS::Locker lock;
CheckLocked();
CORBA::String_var Str = CORBA::string_dup(value);
- Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast(_impl)->SetValue(TCollection_ExtendedString(Str));
+ dynamic_cast<SALOMEDSImpl_AttributePersistentRef*>(_impl)->SetValue(string(Str));
}
public virtual SALOMEDS_GenericAttribute_i {
public:
- SALOMEDS_AttributePersistentRef_i(const Handle(SALOMEDSImpl_AttributePersistentRef)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributePersistentRef_i(SALOMEDSImpl_AttributePersistentRef* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributePersistentRef_i() {};
#include "SALOMEDS.hxx"
#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-SALOMEDS_AttributePixMap::SALOMEDS_AttributePixMap(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr)
+SALOMEDS_AttributePixMap::SALOMEDS_AttributePixMap(SALOMEDSImpl_AttributePixMap* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->HasPixMap();
+ ret = dynamic_cast<SALOMEDSImpl_AttributePixMap*>(_local_impl)->HasPixMap();
}
else ret = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->HasPixMap();
return ret;
std::string aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap)::
- DownCast(_local_impl)->GetPixMap()).ToCString();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributePixMap*>(_local_impl)->GetPixMap();
}
else aValue = SALOMEDS::AttributePixMap::_narrow(_corba_impl)->GetPixMap();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_local_impl)->SetPixMap((char*)value.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributePixMap*>(_local_impl)->SetPixMap(value);
}
else SALOMEDS::AttributePixMap::_narrow(_corba_impl)->SetPixMap(value.c_str());
}
class SALOMEDS_AttributePixMap: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePixMap
{
public:
- SALOMEDS_AttributePixMap(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr);
+ SALOMEDS_AttributePixMap(SALOMEDSImpl_AttributePixMap* theAttr);
SALOMEDS_AttributePixMap(SALOMEDS::AttributePixMap_ptr theAttr);
~SALOMEDS_AttributePixMap();
#include "SALOMEDS_AttributePixMap_i.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-
using namespace std;
CORBA::Boolean SALOMEDS_AttributePixMap_i::HasPixMap()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->HasPixMap();
+ return dynamic_cast<SALOMEDSImpl_AttributePixMap*>(_impl)->HasPixMap();
}
char* SALOMEDS_AttributePixMap_i::GetPixMap()
{
SALOMEDS::Locker lock;
CORBA::String_var S =
- CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePixMap)::
- DownCast(_impl)->GetPixMap()).ToCString());
+ CORBA::string_dup(dynamic_cast<SALOMEDSImpl_AttributePixMap*>(_impl)->GetPixMap().c_str());
return S._retn();
}
SALOMEDS::Locker lock;
CheckLocked();
CORBA::String_var Str = CORBA::string_dup(value);
- Handle(SALOMEDSImpl_AttributePixMap)::DownCast(_impl)->SetPixMap(TCollection_ExtendedString(Str));
+ dynamic_cast<SALOMEDSImpl_AttributePixMap*>(_impl)->SetPixMap(string(Str));
}
{
public:
- SALOMEDS_AttributePixMap_i(const Handle(SALOMEDSImpl_AttributePixMap)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributePixMap_i(SALOMEDSImpl_AttributePixMap* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributePixMap_i() {};
#include "SALOMEDS.hxx"
#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-SALOMEDS_AttributePythonObject::SALOMEDS_AttributePythonObject(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr)
+SALOMEDS_AttributePythonObject::SALOMEDS_AttributePythonObject(SALOMEDSImpl_AttributePythonObject* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_local_impl)->IsScript();
+ ret = dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(_local_impl)->IsScript();
}
else ret = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->IsScript();
return ret;
std::string aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributePythonObject)::
- DownCast(_local_impl)->GetObject()).ToCString();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(_local_impl)->GetObject().c_str();
}
else aValue = SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->GetObject();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributePythonObject)::
- DownCast(_local_impl)->SetObject((char*)theSequence.c_str(), IsScript);
+ dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(_local_impl)->SetObject(theSequence, IsScript);
}
else SALOMEDS::AttributePythonObject::_narrow(_corba_impl)->SetObject(theSequence.c_str(), IsScript);
}
class SALOMEDS_AttributePythonObject: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributePythonObject
{
public:
- SALOMEDS_AttributePythonObject(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr);
+ SALOMEDS_AttributePythonObject(SALOMEDSImpl_AttributePythonObject* theAttr);
SALOMEDS_AttributePythonObject(SALOMEDS::AttributePythonObject_ptr theAttr);
~SALOMEDS_AttributePythonObject();
#include "SALOMEDS_AttributePythonObject_i.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HArray1OfCharacter.hxx>
using namespace std;
SALOMEDS::Locker lock;
CheckLocked();
char *aSeq = CORBA::string_dup(theSequence);
- Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->SetObject(aSeq, IsScript);
+ dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(_impl)->SetObject(aSeq, IsScript);
}
char* SALOMEDS_AttributePythonObject_i::GetObject()
{
SALOMEDS::Locker lock;
- TCollection_AsciiString aSeq(Handle(SALOMEDSImpl_AttributePythonObject)::
- DownCast(_impl)->GetObject().ToCString());
- CORBA::String_var aStr = CORBA::string_dup(aSeq.ToCString());
+ string aSeq(dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(_impl)->GetObject());
+ CORBA::String_var aStr = CORBA::string_dup(aSeq.c_str());
return aStr._retn();
}
CORBA::Boolean SALOMEDS_AttributePythonObject_i::IsScript()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(_impl)->IsScript();
+ return dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(_impl)->IsScript();
}
public virtual SALOMEDS_GenericAttribute_i {
public:
- SALOMEDS_AttributePythonObject_i(const Handle(SALOMEDSImpl_AttributePythonObject)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributePythonObject_i(SALOMEDSImpl_AttributePythonObject* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributePythonObject_i() {};
#include "SALOMEDS_AttributeReal.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-SALOMEDS_AttributeReal::SALOMEDS_AttributeReal(const Handle(SALOMEDSImpl_AttributeReal)& theAttr)
+SALOMEDS_AttributeReal::SALOMEDS_AttributeReal(SALOMEDSImpl_AttributeReal* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
double aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->Value();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeReal*>(_local_impl)->Value();
}
else aValue = SALOMEDS::AttributeReal::_narrow(_corba_impl)->Value();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeReal)::DownCast(_local_impl)->SetValue(value);
+ dynamic_cast<SALOMEDSImpl_AttributeReal*>(_local_impl)->SetValue(value);
}
else SALOMEDS::AttributeReal::_narrow(_corba_impl)->SetValue(value);
}
class SALOMEDS_AttributeReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeReal
{
public:
- SALOMEDS_AttributeReal(const Handle(SALOMEDSImpl_AttributeReal)& theAttr);
+ SALOMEDS_AttributeReal(SALOMEDSImpl_AttributeReal* theAttr);
SALOMEDS_AttributeReal(SALOMEDS::AttributeReal_ptr theAttr);
~SALOMEDS_AttributeReal();
CORBA::Double SALOMEDS_AttributeReal_i::Value()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->Value();
+ return dynamic_cast<SALOMEDSImpl_AttributeReal*>(_impl)->Value();
}
void SALOMEDS_AttributeReal_i::SetValue(CORBA::Double value)
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeReal)::DownCast(_impl)->SetValue(value);
+ dynamic_cast<SALOMEDSImpl_AttributeReal*>(_impl)->SetValue(value);
}
public virtual SALOMEDS_GenericAttribute_i {
public:
- SALOMEDS_AttributeReal_i(const Handle(SALOMEDSImpl_AttributeReal)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeReal_i(SALOMEDSImpl_AttributeReal* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeReal_i() {};
#include "SALOMEDS_AttributeSelectable.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-SALOMEDS_AttributeSelectable::SALOMEDS_AttributeSelectable(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr)
+SALOMEDS_AttributeSelectable::SALOMEDS_AttributeSelectable(SALOMEDSImpl_AttributeSelectable* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
bool aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = (bool)Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->IsSelectable();
+ aValue = (bool)dynamic_cast<SALOMEDSImpl_AttributeSelectable*>(_local_impl)->IsSelectable();
}
else aValue = SALOMEDS::AttributeSelectable::_narrow(_corba_impl)->IsSelectable();
return aValue;
{
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_local_impl)->SetSelectable((int)value);
+ dynamic_cast<SALOMEDSImpl_AttributeSelectable*>(_local_impl)->SetSelectable((int)value);
}
else SALOMEDS::AttributeSelectable::_narrow(_corba_impl)->SetSelectable(value);
}
class SALOMEDS_AttributeSelectable: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSelectable
{
public:
- SALOMEDS_AttributeSelectable(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr);
+ SALOMEDS_AttributeSelectable(SALOMEDSImpl_AttributeSelectable* theAttr);
SALOMEDS_AttributeSelectable(SALOMEDS::AttributeSelectable_ptr theAttr);
~SALOMEDS_AttributeSelectable();
CORBA::Boolean SALOMEDS_AttributeSelectable_i::IsSelectable()
{
SALOMEDS::Locker lock;
- return (Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->IsSelectable() == 1);
+ return (dynamic_cast<SALOMEDSImpl_AttributeSelectable*>(_impl)->IsSelectable() == 1);
}
void SALOMEDS_AttributeSelectable_i::SetSelectable(CORBA::Boolean value)
{
SALOMEDS::Locker lock;
- Standard_Integer val = 0;
+ int val = 0;
if (value != 0) val = 1;
- Handle(SALOMEDSImpl_AttributeSelectable)::DownCast(_impl)->SetSelectable(val);
+ dynamic_cast<SALOMEDSImpl_AttributeSelectable*>(_impl)->SetSelectable(val);
}
public virtual SALOMEDS_GenericAttribute_i {
public:
- SALOMEDS_AttributeSelectable_i(const Handle(SALOMEDSImpl_AttributeSelectable)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeSelectable_i(SALOMEDSImpl_AttributeSelectable* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeSelectable_i() {};
#include "SALOMEDS_AttributeSequenceOfInteger.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-
SALOMEDS_AttributeSequenceOfInteger::SALOMEDS_AttributeSequenceOfInteger
- (const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr)
+ (SALOMEDSImpl_AttributeSequenceOfInteger* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
- for (i = 0; i < aLength; i++) aSeq->Append(other[i]);
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Assign(aSeq);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->Assign(other);
}
else {
SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq();
int i, aLength;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger) aSeqAttr;
- aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeSequenceOfInteger* aSeqAttr;
+ aSeqAttr = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl);
aLength = aSeqAttr->Length();
for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Add(value);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->Add(value);
}
else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Add(value);
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Remove(index);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->Remove(index);
}
else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Remove(index);
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->ChangeValue(index, value);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->ChangeValue(index, value);
}
else SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->ChangeValue(index, value);
}
int aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)->Value(index);
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)->Value(index);
}
else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)->Value(index);
return aValue;
int aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_local_impl)-> Length();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_local_impl)-> Length();
}
else aValue = SALOMEDS::AttributeSequenceOfInteger::_narrow(_corba_impl)-> Length();
return aValue;
class SALOMEDS_AttributeSequenceOfInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSequenceOfInteger
{
public:
- SALOMEDS_AttributeSequenceOfInteger(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr);
+ SALOMEDS_AttributeSequenceOfInteger(SALOMEDSImpl_AttributeSequenceOfInteger* theAttr);
SALOMEDS_AttributeSequenceOfInteger(SALOMEDS::AttributeSequenceOfInteger_ptr theAttr);
~SALOMEDS_AttributeSequenceOfInteger();
#include "SALOMEDS_AttributeSequenceOfInteger_i.hxx"
#include "SALOMEDS.hxx"
-#include <TColStd_HSequenceOfInteger.hxx>
+#include <vector>
+
using namespace std;
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger;
- for (int i = 0; i < other.length(); i++) {
- CasCadeSeq->Append(other[i]);
- }
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Assign(CasCadeSeq);
+ vector<int> aSeq;
+ for(int i = 0, len = other.length(); i<len; i++) aSeq.push_back(other[i]);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_impl)->Assign(aSeq);
}
SALOMEDS::LongSeq* SALOMEDS_AttributeSequenceOfInteger_i::CorbaSequence()
{
SALOMEDS::Locker lock;
SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger) CasCadeSeq;
- CasCadeSeq = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl);
- CorbaSeq->length(CasCadeSeq->Length());
- for (int i = 0; i < CasCadeSeq->Length(); i++) {
- CorbaSeq[i] = CasCadeSeq->Value(i+1);;
+ const vector<int>& CasCadeSeq = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_impl)->Array();
+ int len = CasCadeSeq.size();
+ CorbaSeq->length(len);
+ for (int i = 0; i < len; i++) {
+ CorbaSeq[i] = CasCadeSeq[i];
}
return CorbaSeq._retn();
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Add(value);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_impl)->Add(value);
}
void SALOMEDS_AttributeSequenceOfInteger_i::Remove(CORBA::Long index)
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Remove(index);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_impl)->Remove(index);
}
void SALOMEDS_AttributeSequenceOfInteger_i::ChangeValue(CORBA::Long index, CORBA::Long value)
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->ChangeValue(index, value);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_impl)->ChangeValue(index, value);
}
CORBA::Long SALOMEDS_AttributeSequenceOfInteger_i::Value(CORBA::Short index)
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Value(index);
+ return dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_impl)->Value(index);
}
CORBA::Long SALOMEDS_AttributeSequenceOfInteger_i::Length()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(_impl)->Length();
+ return dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(_impl)->Length();
}
{
public:
- SALOMEDS_AttributeSequenceOfInteger_i(const Handle(SALOMEDSImpl_AttributeSequenceOfInteger)& theAttr,CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeSequenceOfInteger_i(SALOMEDSImpl_AttributeSequenceOfInteger* theAttr,CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeSequenceOfInteger_i() {};
#include "SALOMEDS_AttributeSequenceOfReal.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfReal.hxx>
-
SALOMEDS_AttributeSequenceOfReal::SALOMEDS_AttributeSequenceOfReal
- (const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr)
+ (SALOMEDSImpl_AttributeSequenceOfReal* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal;
- for (i = 0; i < aLength; i++) aSeq->Append(other[i]);
- Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Assign(aSeq);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl)->Assign(other);
}
else {
SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq();
int i, aLength;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeSequenceOfReal) aSeqAttr;
- aSeqAttr = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeSequenceOfReal* aSeqAttr = NULL;
+ aSeqAttr = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl);
aLength = aSeqAttr->Length();
for (i = 1; i <=aLength; i++) aVector.push_back(aSeqAttr->Value(i));
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Add(value);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl)->Add(value);
}
else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Add(value);
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Remove(index);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl)->Remove(index);
}
else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Remove(index);
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->ChangeValue(index, value);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl)->ChangeValue(index, value);
}
else SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->ChangeValue(index, value);
}
double aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)->Value(index);
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl)->Value(index);
}
else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)->Value(index);
return aValue;
int aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_local_impl)-> Length();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_local_impl)-> Length();
}
else aValue = SALOMEDS::AttributeSequenceOfReal::_narrow(_corba_impl)-> Length();
return aValue;
class SALOMEDS_AttributeSequenceOfReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeSequenceOfReal
{
public:
- SALOMEDS_AttributeSequenceOfReal(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr);
+ SALOMEDS_AttributeSequenceOfReal(SALOMEDSImpl_AttributeSequenceOfReal* theAttr);
SALOMEDS_AttributeSequenceOfReal(SALOMEDS::AttributeSequenceOfReal_ptr theAttr);
~SALOMEDS_AttributeSequenceOfReal();
#include "SALOMEDS_AttributeSequenceOfReal_i.hxx"
#include "SALOMEDS.hxx"
-#include <TColStd_HSequenceOfReal.hxx>
+#include <vector>
using namespace std;
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal;
+ vector<double> CasCadeSeq;
for (int i = 0; i < other.length(); i++) {
- CasCadeSeq->Append(other[i]);
+ CasCadeSeq.push_back(other[i]);
}
- Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Assign(CasCadeSeq);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_impl)->Assign(CasCadeSeq);
}
SALOMEDS::DoubleSeq* SALOMEDS_AttributeSequenceOfReal_i::CorbaSequence()
{
SALOMEDS::Locker lock;
SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq;
- Handle(SALOMEDSImpl_AttributeSequenceOfReal) CasCadeSeq = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl);
- CorbaSeq->length(CasCadeSeq->Length());
- for (int i = 0; i < CasCadeSeq->Length(); i++) {
- CorbaSeq[i] = CasCadeSeq->Value(i+1);;
+ const vector<double>& CasCadeSeq = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_impl)->Array();
+ int len = CasCadeSeq.size();
+ CorbaSeq->length(len);
+ for (int i = 0; i < len; i++) {
+ CorbaSeq[i] = CasCadeSeq[i];
}
return CorbaSeq._retn();
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Add(value);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_impl)->Add(value);
}
void SALOMEDS_AttributeSequenceOfReal_i::Remove(CORBA::Long index)
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Remove(index);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_impl)->Remove(index);
}
void SALOMEDS_AttributeSequenceOfReal_i::ChangeValue(CORBA::Long index, CORBA::Double value)
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->ChangeValue(index, value);
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_impl)->ChangeValue(index, value);
}
CORBA::Double SALOMEDS_AttributeSequenceOfReal_i::Value(CORBA::Short index)
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Value(index);
+ return dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_impl)->Value(index);
}
CORBA::Long SALOMEDS_AttributeSequenceOfReal_i::Length()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(_impl)->Length();
+ return dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(_impl)->Length();
}
public virtual SALOMEDS_GenericAttribute_i {
public:
- SALOMEDS_AttributeSequenceOfReal_i(const Handle(SALOMEDSImpl_AttributeSequenceOfReal)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeSequenceOfReal_i(SALOMEDSImpl_AttributeSequenceOfReal* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeSequenceOfReal_i() {};
#include "SALOMEDS.hxx"
#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-SALOMEDS_AttributeString::SALOMEDS_AttributeString(const Handle(SALOMEDSImpl_AttributeString)& theAttr)
+SALOMEDS_AttributeString::SALOMEDS_AttributeString(SALOMEDSImpl_AttributeString* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
std::string aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeString)::
- DownCast(_local_impl)->Value()).ToCString();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeString*>(_local_impl)->Value();
}
else aValue = SALOMEDS::AttributeString::_narrow(_corba_impl)->Value();
return aValue;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeString)::DownCast(_local_impl)->SetValue((char*)value.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeString*>(_local_impl)->SetValue(value);
}
else SALOMEDS::AttributeString::_narrow(_corba_impl)->SetValue(value.c_str());
}
class SALOMEDS_AttributeString: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeString
{
public:
- SALOMEDS_AttributeString(const Handle(SALOMEDSImpl_AttributeString)& theAttr);
+ SALOMEDS_AttributeString(SALOMEDSImpl_AttributeString* theAttr);
SALOMEDS_AttributeString(SALOMEDS::AttributeString_ptr theAttr);
~SALOMEDS_AttributeString();
#include "SALOMEDS_AttributeString_i.hxx"
-#include <TCollection_ExtendedString.hxx>
#include "SALOMEDS_SObject_i.hxx"
#include "SALOMEDS.hxx"
SALOMEDS::Locker lock;
CORBA::String_var c_s =
- CORBA::string_dup(TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeString)::DownCast(_impl)->Value()).ToCString());
+ CORBA::string_dup(dynamic_cast<SALOMEDSImpl_AttributeString*>(_impl)->Value().c_str());
return c_s._retn();
}
SALOMEDS::Locker lock;
CheckLocked();
- TCollection_AsciiString aStr((char*)value);
- Handle(SALOMEDSImpl_AttributeString)::DownCast(_impl)->SetValue(TCollection_ExtendedString(aStr));
+ dynamic_cast<SALOMEDSImpl_AttributeString*>(_impl)->SetValue(string(value));
}
public virtual SALOMEDS_GenericAttribute_i
{
public:
- SALOMEDS_AttributeString_i(const Handle(SALOMEDSImpl_AttributeString)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeString_i(SALOMEDSImpl_AttributeString* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
virtual ~SALOMEDS_AttributeString_i() {};
#include "SALOMEDS_AttributeStudyProperties.hxx"
#include "SALOMEDS.hxx"
-#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
+using namespace std;
SALOMEDS_AttributeStudyProperties::SALOMEDS_AttributeStudyProperties
- (const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr)
+ (SALOMEDSImpl_AttributeStudyProperties* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl);
- anImpl->ChangeCreatorName((char*)theName.c_str());
+ SALOMEDSImpl_AttributeStudyProperties* anImpl =
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
+ anImpl->ChangeCreatorName(theName);
} else
SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetUserName(theName.c_str());
}
std::string aName;
if (_isLocal) {
SALOMEDS::Locker lock;
- TCollection_ExtendedString S =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreatorName();
- aName = TCollection_AsciiString(S).ToCString();
+ aName = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetCreatorName();
}
#ifndef WNT
else aName = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetUserName();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeStudyProperties* anImpl =
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
int aTmp;
if (anImpl->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return;
- TCollection_ExtendedString S;
+ string S;
anImpl->SetModification(S, theMinute, theHour, theDay, theMonth, theYear);
} else {
SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationDate(theMinute,
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast
+ ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>
(_local_impl)->GetCreationDate(theMinute, theHour, theDay, theMonth, theYear);
} else {
CORBA::Long aMinute, anHour, aDay, aMonth, anYear;
CheckLocked();
SALOMEDS::Locker lock;
if (theMode == "from scratch")
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(1);
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetCreationMode(1);
else if (theMode == "copy from")
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(2);
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetCreationMode(2);
else //Not defined
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetCreationMode(0);
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetCreationMode(0);
}
else SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetCreationMode(theMode.c_str());
}
std::string aMode;
if (_isLocal) {
SALOMEDS::Locker lock;
- int mode = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetCreationMode();
+ int mode = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetCreationMode();
if (mode == 1) aMode = "from scratch";
if (mode == 2) aMode = "copy from";
}
{
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetModified(theModified);
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetModified(theModified);
}
else
SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModified(theModified);
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsModified();
+ ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->IsModified();
}
else
ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsModified();
int isModified;
if (_isLocal) {
SALOMEDS::Locker lock;
- isModified = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->GetModified();
+ isModified = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->GetModified();
}
else
isModified = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->GetModified();
{
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->SetLocked(theLocked);
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->SetLocked(theLocked);
}
else
SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetLocked(theLocked);
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl)->IsLocked();
+ ret = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl)->IsLocked();
}
else
ret = SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->IsLocked();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl);
- anImpl->SetModification((char*)theName.c_str(), theMinute, theHour, theDay, theMonth, theYear);
+ SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
+ anImpl->SetModification(theName, theMinute, theHour, theDay, theMonth, theYear);
} else
SALOMEDS::AttributeStudyProperties::_narrow(_corba_impl)->SetModification(theName.c_str(),
theMinute,
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aNames;
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
- Handle(SALOMEDSImpl_AttributeStudyProperties) anImpl =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_local_impl);
+ vector<string> aNames;
+ vector<int> aMinutes, aHours, aDays, aMonths, aYears;
+ SALOMEDSImpl_AttributeStudyProperties* anImpl = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_local_impl);
anImpl->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
- aLength = aNames->Length();
+ aLength = aNames.size();
i = ((theWithCreator) ? 1 : 2);
for (; i <= aLength; i++) {
- theNames.push_back(TCollection_AsciiString(aNames->Value(i)).ToCString());
- theMinutes.push_back(aMinutes->Value(i));
- theHours.push_back(aHours->Value(i));
- theDays.push_back(aDays->Value(i));
- theMonths.push_back(aMonths->Value(i));
- theYears.push_back(aYears->Value(i));
+ theNames.push_back(aNames[i-1]);
+ theMinutes.push_back(aMinutes[i-1]);
+ theHours.push_back(aHours[i-1]);
+ theDays.push_back(aDays[i-1]);
+ theMonths.push_back(aMonths[i-1]);
+ theYears.push_back(aYears[i-1]);
}
} else {
SALOMEDS::StringSeq_var aNames;
#ifndef SALOMEDS_AttributeStudyProperties_HeaderFile
#define SALOMEDS_AttributeStudyProperties_HeaderFile
-#include <vector>
-#include <string>
-
#include "SALOMEDSClient_AttributeStudyProperties.hxx"
#include "SALOMEDS_GenericAttribute.hxx"
#include "SALOMEDSImpl_AttributeStudyProperties.hxx"
+#include <vector>
+#include <string>
+
// IDL headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
{
public:
- SALOMEDS_AttributeStudyProperties(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr);
+ SALOMEDS_AttributeStudyProperties(SALOMEDSImpl_AttributeStudyProperties* theAttr);
SALOMEDS_AttributeStudyProperties(SALOMEDS::AttributeStudyProperties_ptr theAttr);
~SALOMEDS_AttributeStudyProperties();
#include "SALOMEDS_AttributeStudyProperties_i.hxx"
#include "SALOMEDS.hxx"
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TCollection_ExtendedString.hxx>
-
using namespace std;
#define CREATION_MODE_NOTDEFINED 0
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->ChangeCreatorName((char*)theName);
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->ChangeCreatorName((char*)theName);
}
char* SALOMEDS_AttributeStudyProperties_i::GetUserName()
{
SALOMEDS::Locker lock;
- TCollection_ExtendedString S =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreatorName();
- CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString());
+ string S = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetCreatorName();
+ CORBA::String_var c_s = CORBA::string_dup(S.c_str());
return c_s._retn();
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
+ SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl);
int aTmp;
if (aProp->GetCreationDate(aTmp, aTmp, aTmp, aTmp, aTmp)) return;
- TCollection_ExtendedString S;
+ string S;
aProp->SetModification(S, theMinute, theHour, theDay, theMonth, theYear);
}
CORBA::Long& theYear)
{
SALOMEDS::Locker lock;
- Standard_Integer aMinute;
- Standard_Integer aHour;
- Standard_Integer aDay;
- Standard_Integer aMonth;
- Standard_Integer aYear;
- if (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast
- (_impl)->GetCreationDate(aMinute, aHour, aDay, aMonth, aYear)) {
+ int aMinute;
+ int aHour;
+ int aDay;
+ int aMonth;
+ int aYear;
+ if (dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetCreationDate(aMinute, aHour, aDay, aMonth, aYear)) {
theMinute = aMinute;
theHour = aHour;
theDay = aDay;
theMonth = aMonth;
theYear = aYear;
- return Standard_True;
+ return true;
}
- return Standard_False;
+ return false;
}
void SALOMEDS_AttributeStudyProperties_i::SetCreationMode(const char* theMode)
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
+ SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl);
if (strcmp(theMode,"from scratch")==0) aProp->SetCreationMode(CREATION_MODE_SCRATCH);
else if (strcmp(theMode,"copy from")==0) aProp->SetCreationMode(CREATION_MODE_COPY);
else aProp->SetCreationMode(CREATION_MODE_NOTDEFINED);
{
SALOMEDS::Locker lock;
CORBA::String_var c_s;
- switch (Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetCreationMode()) {
+ switch (dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetCreationMode()) {
case CREATION_MODE_SCRATCH: c_s = "from scratch"; break;
case CREATION_MODE_COPY: c_s = "copy from"; break;
default: c_s = "";
void SALOMEDS_AttributeStudyProperties_i::SetModified(CORBA::Long theModified)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetModified(theModified);
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->SetModified(theModified);
}
CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsModified()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsModified();
+ return dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->IsModified();
}
CORBA::Long SALOMEDS_AttributeStudyProperties_i::GetModified()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->GetModified();
+ return dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->GetModified();
}
void SALOMEDS_AttributeStudyProperties_i::SetLocked(CORBA::Boolean theLocked)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->SetLocked(theLocked);
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->SetLocked(theLocked);
}
CORBA::Boolean SALOMEDS_AttributeStudyProperties_i::IsLocked()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl)->IsLocked();
+ return dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl)->IsLocked();
}
void SALOMEDS_AttributeStudyProperties_i::SetModification(const char* theName,
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
+ SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl);
aProp->SetModification((char*)theName, (int)theMinute, (int)theHour,
(int)theDay, (int)theMonth, (int)theYear);
}
CORBA::Boolean theWithCreator)
{
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aNames;
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(_impl);
+ vector<string> aNames;
+ vector<int> aMinutes, aHours, aDays, aMonths, aYears;
+ SALOMEDSImpl_AttributeStudyProperties* aProp = dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(_impl);
aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
- int aLength = aNames->Length();
+ int aLength = aNames.size();
int aRetLength = aLength - ((theWithCreator) ? 0 : 1);
theNames = new SALOMEDS::StringSeq;
theMinutes = new SALOMEDS::LongSeq;
theYears->length(aRetLength);
int a = 0, ind = ((theWithCreator) ? 1 : 2);
for (; ind <= aLength; a++, ind++) {
- (*theNames)[a] = CORBA::string_dup(TCollection_AsciiString(aNames->Value(ind)).ToCString());
- (*theMinutes)[a] = aMinutes->Value(ind);
- (*theHours)[a] = aHours->Value(ind);
- (*theDays)[a] = aDays->Value(ind);
- (*theMonths)[a] = aMonths->Value(ind);
- (*theYears)[a] = aYears->Value(ind);
+ (*theNames)[a] = CORBA::string_dup(aNames[ind-1].c_str());
+ (*theMinutes)[a] = aMinutes[ind-1];
+ (*theHours)[a] = aHours[ind-1];
+ (*theDays)[a] = aDays[ind-1];
+ (*theMonths)[a] = aMonths[ind-1];
+ (*theYears)[a] = aYears[ind-1];
}
}
public virtual SALOMEDS_GenericAttribute_i {
public:
- SALOMEDS_AttributeStudyProperties_i(const Handle(SALOMEDSImpl_AttributeStudyProperties)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeStudyProperties_i(SALOMEDSImpl_AttributeStudyProperties* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeStudyProperties_i() {};
#include "SALOMEDS_AttributeTableOfInteger.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
-
+using namespace std;
SALOMEDS_AttributeTableOfInteger::SALOMEDS_AttributeTableOfInteger
- (const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr)
+ (SALOMEDSImpl_AttributeTableOfInteger* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->SetTitle(theTitle);
}
else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetTitle(theTitle.c_str());
}
std::string aStr;
if (_isLocal) {
SALOMEDS::Locker lock;
- aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfInteger)::
- DownCast(_local_impl)->GetTitle()).ToCString();
+ aStr = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->GetTitle();
}
else aStr = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetTitle();
return aStr;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger)::
- DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->SetRowTitle(theIndex, theTitle);
}
else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str());
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
- Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowTitles(aSeq);
+ vector<string> aSeq;
+ for (i = 0; i < aLength; i++) aSeq.push_back(theTitles[i]);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->SetRowTitles(aSeq);
}
else {
SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq;
- aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowTitles();
- aLength = aSeq->Length();
- for(i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString((aSeq->Value(i))).ToCString());
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->GetRowTitles();
}
else {
SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowTitles();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger)::
- DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->SetColumnTitle(theIndex, theTitle);
}
else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str());
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
- Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetColumnTitles(aSeq);
+ vector<string> aSeq;
+ for (i = 0; i < aLength; i++) aSeq.push_back(theTitles[i]);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->SetColumnTitles(aSeq);
}
else {
SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq;
- aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetColumnTitles();
- aLength = aSeq->Length();
- for (i = 1; i<= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->GetColumnTitles();
}
else {
SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumnTitles();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger)::
- DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->SetRowUnit(theIndex, theUnit);
}
else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str());
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- for (i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str());
- Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetRowUnits(aSeq);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->SetRowUnits(theUnits);
}
else {
SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq;
- aSeq = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowUnits();
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->GetRowUnits();
}
else {
SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRowUnits();
int aNb;
if (_isLocal) {
SALOMEDS::Locker lock;
- aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbRows();
+ aNb = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->GetNbRows();
}
else aNb = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetNbRows();
return aNb;
int aNb;
if (_isLocal) {
SALOMEDS::Locker lock;
- aNb = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetNbColumns();
+ aNb = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->GetNbColumns();
}
else aNb = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetNbColumns();
return aNb;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable;
- aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl);
- Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger;
- for (int i = 0; i < aLength; i++) aRow->Append(theData[i]);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl);
try {
- aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
+ aTable->SetRowData(aTable->GetNbRows() + 1, theData);
}
catch(...) {
throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable;
- aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl);
- Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger;
- for (int i = 0; i < aLength; i++) aRow->Append(theData[i]);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl);
try {
- aTable->SetRowData(theRow, aRow);
+ aTable->SetRowData(theRow, theData);
}
catch(...) {
throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfInteger) aRow;
- aRow = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetRowData(theRow);
- aLength = aRow->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aRow->Value(i));
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->GetRowData(theRow);
}
else {
SALOMEDS::LongSeq_var aRow = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetRow(theRow);
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable;
- aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl);
- Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger;
- for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl);
try {
- aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
+ aTable->SetColumnData(aTable->GetNbColumns() + 1, theData);
}
catch(...) {
throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable;
- aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl);
- Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger;
- for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl);
try {
- aTable->SetColumnData(theColumn, aColumn);
+ aTable->SetColumnData(theColumn, theData);
}
catch(...) {
throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfInteger) aColumn;
- aColumn = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetColumnData(theColumn);
- aLength = aColumn->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aColumn->Value(i));
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->GetColumnData(theColumn);
}
else {
SALOMEDS::LongSeq_var aColumn = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->GetColumn(theColumn);
CheckLocked();
SALOMEDS::Locker lock;
try {
- Handle(SALOMEDSImpl_AttributeTableOfInteger)::
- DownCast(_local_impl)->PutValue(theValue, theRow, theColumn);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->PutValue(theValue, theRow, theColumn);
}
catch(...) {
throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->HasValue(theRow, theColumn);
+ ret = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->HasValue(theRow, theColumn);
}
else ret = SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->HasValue(theRow, theColumn);
return ret;
if (_isLocal) {
SALOMEDS::Locker lock;
try {
- aValue = Handle(SALOMEDSImpl_AttributeTableOfInteger)::
- DownCast(_local_impl)->GetValue(theRow, theColumn);
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->GetValue(theRow, theColumn);
}
catch(...) {
throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfInteger) aSet;
- aSet = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->GetSetRowIndices(theRow);
- aLength = aSet->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aSet->Value(i));
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->GetSetRowIndices(theRow);
}
else {
SALOMEDS::LongSeq_var aSet =
{
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_local_impl)->SetNbColumns(theNbColumns);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_local_impl)->SetNbColumns(theNbColumns);
}
else SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetNbColumns(theNbColumns);
}
class SALOMEDS_AttributeTableOfInteger: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfInteger
{
public:
- SALOMEDS_AttributeTableOfInteger(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr);
+ SALOMEDS_AttributeTableOfInteger(SALOMEDSImpl_AttributeTableOfInteger* theAttr);
SALOMEDS_AttributeTableOfInteger(SALOMEDS::AttributeTableOfInteger_ptr theAttr);
~SALOMEDS_AttributeTableOfInteger();
#include "SALOMEDS_AttributeTableOfInteger_i.hxx"
#include "SALOMEDS.hxx"
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_ErrorHandler.hxx>
#include "Utils_ExceptHandlers.hxx"
#include <stdexcept>
#include <strstream>
#include <string>
+#include <vector>
using namespace std;
SALOMEDS::Locker lock;
CheckLocked();
CORBA::String_var aStr = CORBA::string_dup(theTitle);
- Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->SetTitle(TCollection_ExtendedString(aStr));
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->SetTitle(string(aStr));
}
char* SALOMEDS_AttributeTableOfInteger_i::GetTitle()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
- CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(aTable->GetTitle()).ToCString());
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
+ CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str());
return c_s._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch (ATI_IncorrectIndex);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
- aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle));
+ aTable->SetRowTitle(theIndex, string(theTitle));
}
void SALOMEDS_AttributeTableOfInteger_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
SALOMEDS::Locker lock;
Unexpect aCatch (ATI_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
for (int i = 0; i < theTitles.length(); i++) {
SetRowTitle(i + 1, theTitles[i]);
SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowTitles()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
aTitles->length(aTable->GetNbRows());
for(int i = 0; i < aTitles->length(); i++)
- aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString());
+ aTitles[i] = CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str());
return aTitles._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch (ATI_IncorrectIndex);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
CORBA::String_var aStr = CORBA::string_dup(theTitle);
- aTable->SetColumnTitle(theIndex, TCollection_ExtendedString(aStr));
+ aTable->SetColumnTitle(theIndex, string(aStr));
}
void SALOMEDS_AttributeTableOfInteger_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
SALOMEDS::Locker lock;
Unexpect aCatch(ATI_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
for (int i = 0; i < theTitles.length(); i++) {
aTable->SetColumnTitle(i + 1, (char*)theTitles[i].in());
SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetColumnTitles()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
aTitles->length(aTable->GetNbColumns());
for(int i = 0; i < aTitles->length(); i++)
- aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetColumnTitle(i + 1)).ToCString());
+ aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str());
return aTitles._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch (ATI_IncorrectIndex);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
- aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit));
+ aTable->SetRowUnit(theIndex, string(theUnit));
}
void SALOMEDS_AttributeTableOfInteger_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
SALOMEDS::Locker lock;
Unexpect aCatch (ATI_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
for (int i = 0; i < theUnits.length(); i++) {
aTable->SetRowUnit(i + 1, (char*)theUnits[i].in());
SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowUnits()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq;
aUnits->length(aTable->GetNbRows());
for(int i = 0; i < aUnits->length(); i++)
- aUnits[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowUnit(i + 1)).ToCString());
+ aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str());
return aUnits._retn();
}
CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbRows()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->GetNbRows();
+ return dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->GetNbRows();
}
CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetNbColumns()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->GetNbColumns();
+ return dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->GetNbColumns();
}
void SALOMEDS_AttributeTableOfInteger_i::AddRow(const SALOMEDS::LongSeq& theData)
SALOMEDS::Locker lock;
Unexpect aCatch(ATI_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
- Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger;
- for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]);
+ vector<int> aRow;
+ for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]);
try {
aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
}
- catch(Standard_Failure) {
+ catch(...) {
throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
}
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATI_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
- Handle(TColStd_HSequenceOfInteger) aRow = new TColStd_HSequenceOfInteger;
- for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]);
+ vector<int> aRow;
+ for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]);
try {
aTable->SetRowData(theRow, aRow);
}
- catch(Standard_Failure) {
+ catch(...) {
throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
}
}
{
SALOMEDS::Locker lock;
Unexpect aCatch(ATI_IncorrectIndex);
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
- Handle(TColStd_HSequenceOfInteger) aRow = aTable->GetRowData(theRow);
- CorbaSeq->length(aRow->Length());
- for (int i = 0; i < aRow->Length(); i++) {
- CorbaSeq[i] = aRow->Value(i + 1);
+ vector<int> aRow = aTable->GetRowData(theRow);
+ CorbaSeq->length(aRow.size());
+ for (int i = 0; i < aRow.size(); i++) {
+ CorbaSeq[i] = aRow[i];
}
return CorbaSeq._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATI_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
- Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger;
- for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]);
+ vector<int> aColumn;
+ for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]);
try {
aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
}
- catch(Standard_Failure) {
+ catch(...) {
throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
}
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATI_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
-
- Handle(TColStd_HSequenceOfInteger) aColumn = new TColStd_HSequenceOfInteger;
- for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
+
+ vector<int> aColumn;
+ for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]);
try {
aTable->SetColumnData(theColumn, aColumn);
}
- catch(Standard_Failure) {
+ catch(...) {
throw SALOMEDS::AttributeTableOfInteger::IncorrectArgumentLength();
}
}
{
SALOMEDS::Locker lock;
Unexpect aCatch(ATI_IncorrectIndex);
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
- Handle(TColStd_HSequenceOfInteger) aColumn = aTable->GetColumnData(theColumn);
- CorbaSeq->length(aColumn->Length());
- for (int i = 0; i < aColumn->Length(); i++) {
- CorbaSeq[i] = aColumn->Value(i + 1);
+ vector<int> aColumn = aTable->GetColumnData(theColumn);
+ CorbaSeq->length(aColumn.size());
+ for (int i = 0; i < aColumn.size(); i++) {
+ CorbaSeq[i] = aColumn[i];
}
return CorbaSeq._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATI_IncorrectIndex);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
try {
aTable->PutValue(theValue, theRow, theColumn);
}
- catch(Standard_Failure) {
+ catch(...) {
throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
}
}
CORBA::Boolean SALOMEDS_AttributeTableOfInteger_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn)
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl)->HasValue(theRow, theColumn);
+ return dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl)->HasValue(theRow, theColumn);
}
CORBA::Long SALOMEDS_AttributeTableOfInteger_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
{
SALOMEDS::Locker lock;
Unexpect aCatch(ATI_IncorrectIndex);
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
CORBA::Long aValue;
try {
aValue = aTable->GetValue(theRow, theColumn);
}
- catch(Standard_Failure) {
+ catch(...) {
throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
}
return aValue;
SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfInteger_i::GetRowSetIndices(CORBA::Long theRow)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfInteger::IncorrectIndex();
SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
- Handle(TColStd_HSequenceOfInteger) aSeq = aTable->GetSetRowIndices(theRow);
- CorbaSeq->length(aSeq->Length());
- for (int i = 0; i < aSeq->Length(); i++) {
- CorbaSeq[i] = aSeq->Value(i + 1);
+ vector<int> aSeq = aTable->GetSetRowIndices(theRow);
+ CorbaSeq->length(aSeq.size());
+ for (int i = 0; i < aSeq.size(); i++) {
+ CorbaSeq[i] = aSeq[i];
}
return CorbaSeq._retn();
}
void SALOMEDS_AttributeTableOfInteger_i::SetNbColumns(CORBA::Long theNbColumns)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
aTable->SetNbColumns(theNbColumns);
}
bool SALOMEDS_AttributeTableOfInteger_i::ReadFromFile(const SALOMEDS::TMPFile& theStream)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
- istrstream aStream((char*)&theStream[0], theStream.length());
- return aTable->RestoreFromString(aStream);
+ string aStream((char*)&theStream[0], theStream.length());
+ aTable->Load(aStream);
+ return true;
}
SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfInteger_i::SaveToFile()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(_impl);
-
- ostrstream ostr;
- string aString;
- aTable->ConvertToString(ostr);
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(_impl);
- aString = ostr.rdbuf()->str();
+ string aString = aTable->Save();
char* aBuffer = (char*)CORBA::string_dup(aString.c_str());
int aBufferSize = strlen((char*)aBuffer);
public:
- SALOMEDS_AttributeTableOfInteger_i(const Handle(SALOMEDSImpl_AttributeTableOfInteger)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeTableOfInteger_i(SALOMEDSImpl_AttributeTableOfInteger* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeTableOfInteger_i() {};
#include "SALOMEDS_AttributeTableOfReal.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TColStd_HSequenceOfReal.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
-
+using namespace std;
SALOMEDS_AttributeTableOfReal::SALOMEDS_AttributeTableOfReal
- (const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr)
+ (SALOMEDSImpl_AttributeTableOfReal* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->SetTitle(theTitle);
}
else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetTitle(theTitle.c_str());
}
std::string aStr;
if (_isLocal) {
SALOMEDS::Locker lock;
- aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfReal)::
- DownCast(_local_impl)->GetTitle()).ToCString();
+ aStr = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->GetTitle();
}
else aStr = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetTitle();
return aStr;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal)::
- DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->SetRowTitle(theIndex, theTitle);
}
else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str());
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
- Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowTitles(aSeq);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->SetRowTitles(theTitles);
}
else {
SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq;
- aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowTitles();
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->GetRowTitles();
}
else {
SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowTitles();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal)::
- DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->SetColumnTitle(theIndex, theTitle);
}
else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str());
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
- Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetColumnTitles(aSeq);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->SetColumnTitles(theTitles);
}
else {
SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq;
- aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetColumnTitles();
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->GetColumnTitles();
}
else {
SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumnTitles();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal)::
- DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->SetRowUnit(theIndex, theUnit);
}
else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str());
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- for (i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str());
- Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetRowUnits(aSeq);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->SetRowUnits(theUnits);
}
else {
SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq;
- aSeq = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowUnits();
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->GetRowUnits();
}
else {
SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowUnits();
aLength = aSeq->length();
- for (i = 0; i < aLength; i++) aVector.push_back(TCollection_AsciiString((char*)aSeq[i].in()).ToCString());
+ for (i = 0; i < aLength; i++) aVector.push_back(string(aSeq[i].in()));
}
return aVector;
}
int aNb;
if (_isLocal) {
SALOMEDS::Locker lock;
- aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbRows();
+ aNb = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->GetNbRows();
}
else aNb = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetNbRows();
return aNb;
int aNb;
if (_isLocal) {
SALOMEDS::Locker lock;
- aNb = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetNbColumns();
+ aNb = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->GetNbColumns();
}
else aNb = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetNbColumns();
return aNb;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable;
- aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl);
- Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal;
- for (int i = 0; i < aLength; i++) aRow->Append(theData[i]);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl);
try {
- aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
+ aTable->SetRowData(aTable->GetNbRows() + 1, theData);
}
catch(...) {
throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable;
- aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl);
- Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal;
- for (int i = 0; i < aLength; i++) aRow->Append(theData[i]);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl);
try {
- aTable->SetRowData(theRow, aRow);
+ aTable->SetRowData(theRow, theData);
}
catch(...) {
throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfReal) aRow;
- aRow = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetRowData(theRow);
- aLength = aRow->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aRow->Value(i));
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->GetRowData(theRow);
}
else {
SALOMEDS::DoubleSeq_var aRow = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRow(theRow);
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable;
- aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl);
- Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal;
- for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl);
try {
- aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
+ aTable->SetColumnData(aTable->GetNbColumns() + 1, theData);
}
catch(...) {
throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable;
- aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl);
- Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal;
- for (int i = 0; i < aLength; i++) aColumn->Append(theData[i]);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl);
try {
- aTable->SetColumnData(theColumn, aColumn);
+ aTable->SetColumnData(theColumn, theData);
}
catch(...) {
throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfReal) aColumn;
- aColumn = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetColumnData(theColumn);
- aLength = aColumn->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aColumn->Value(i));
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->GetColumnData(theColumn);
}
else {
SALOMEDS::DoubleSeq_var aColumn = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetColumn(theColumn);
CheckLocked();
SALOMEDS::Locker lock;
try {
- Handle(SALOMEDSImpl_AttributeTableOfReal)::
- DownCast(_local_impl)->PutValue(theValue, theRow, theColumn);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->PutValue(theValue, theRow, theColumn);
}
catch(...) {
throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->HasValue(theRow, theColumn);
+ ret = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->HasValue(theRow, theColumn);
}
else ret = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->HasValue(theRow, theColumn);
return ret;
if (_isLocal) {
SALOMEDS::Locker lock;
try {
- aValue = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetValue(theRow, theColumn);
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->GetValue(theRow, theColumn);
}
catch(...) {
throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfInteger) aSet;
- aSet = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->GetSetRowIndices(theRow);
- aLength = aSet->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aSet->Value(i));
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->GetSetRowIndices(theRow);
}
else {
SALOMEDS::LongSeq_var aSet = SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->GetRowSetIndices(theRow);
{
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_local_impl)->SetNbColumns(theNbColumns);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_local_impl)->SetNbColumns(theNbColumns);
}
else SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetNbColumns(theNbColumns);
}
class SALOMEDS_AttributeTableOfReal: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfReal
{
public:
- SALOMEDS_AttributeTableOfReal(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr);
+ SALOMEDS_AttributeTableOfReal(SALOMEDSImpl_AttributeTableOfReal* theAttr);
SALOMEDS_AttributeTableOfReal(SALOMEDS::AttributeTableOfReal_ptr theAttr);
~SALOMEDS_AttributeTableOfReal();
#include "SALOMEDS_AttributeTableOfReal_i.hxx"
#include "SALOMEDS.hxx"
-#include <TColStd_HSequenceOfReal.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_ErrorHandler.hxx>
-
#include <strstream>
#include <string>
+#include <vector>
using namespace std;
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
CORBA::String_var aStr = CORBA::string_dup(theTitle);
- aTable->SetTitle(TCollection_ExtendedString(aStr));
+ aTable->SetTitle(string(aStr));
}
char* SALOMEDS_AttributeTableOfReal_i::GetTitle()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
- CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(aTable->GetTitle()).ToCString());
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
+ CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str());
return c_s._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch (ATR_IncorrectIndex);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
- aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle));
+ aTable->SetRowTitle(theIndex, string(theTitle));
}
void SALOMEDS_AttributeTableOfReal_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
SALOMEDS::Locker lock;
Unexpect aCatch (ATR_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
for (int i = 0; i < theTitles.length(); i++) {
aTable->SetRowTitle(i + 1, (char*)theTitles[i].in());
SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowTitles()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
aTitles->length(aTable->GetNbRows());
for(int i = 0; i < aTitles->length(); i++)
- aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString());
+ aTitles[i] = CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str());
return aTitles._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch (ATR_IncorrectIndex);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
CORBA::String_var aStr = CORBA::string_dup(theTitle);
- aTable->SetColumnTitle(theIndex, TCollection_ExtendedString(aStr));
+ aTable->SetColumnTitle(theIndex, string(aStr));
}
void SALOMEDS_AttributeTableOfReal_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
SALOMEDS::Locker lock;
Unexpect aCatch(ATR_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
for (int i = 0; i < theTitles.length(); i++) {
aTable->SetColumnTitle(i + 1, (char*)theTitles[i].in());
SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetColumnTitles()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
aTitles->length(aTable->GetNbColumns());
for(int i = 0; i < aTitles->length(); i++)
- aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetColumnTitle(i + 1)).ToCString());
+ aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str());
return aTitles._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch (ATR_IncorrectIndex);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
- aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit));
+ aTable->SetRowUnit(theIndex, string(theUnit));
}
void SALOMEDS_AttributeTableOfReal_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
SALOMEDS::Locker lock;
Unexpect aCatch (ATR_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectArgumentLength();
for (int i = 0; i < theUnits.length(); i++) {
aTable->SetRowUnit(i + 1, (char*)theUnits[i].in());
SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfReal_i::GetRowUnits()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq;
aUnits->length(aTable->GetNbRows());
for(int i = 0; i < aUnits->length(); i++)
- aUnits[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowUnit(i + 1)).ToCString());
+ aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str());
return aUnits._retn();
}
CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbRows()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->GetNbRows();
+ return dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl)->GetNbRows();
}
CORBA::Long SALOMEDS_AttributeTableOfReal_i::GetNbColumns()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->GetNbColumns();
+ return dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl)->GetNbColumns();
}
void SALOMEDS_AttributeTableOfReal_i::AddRow(const SALOMEDS::DoubleSeq& theData)
SALOMEDS::Locker lock;
Unexpect aCatch(ATR_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
- Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal;
- for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]);
+ vector<double> aRow;
+ for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]);
aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATR_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
- Handle(TColStd_HSequenceOfReal) aRow = new TColStd_HSequenceOfReal;
- for (int i = 0; i < theData.length(); i++) aRow->Append(theData[i]);
+ vector<double> aRow;
+ for (int i = 0; i < theData.length(); i++) aRow.push_back(theData[i]);
aTable->SetRowData(theRow, aRow);
}
{
SALOMEDS::Locker lock;
Unexpect aCatch(ATR_IncorrectIndex);
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq;
- Handle(TColStd_HSequenceOfReal) aRow = aTable->GetRowData(theRow);
- CorbaSeq->length(aRow->Length());
- for (int i = 0; i < aRow->Length(); i++) {
- CorbaSeq[i] = aRow->Value(i + 1);
+ vector<double> aRow = aTable->GetRowData(theRow);
+ CorbaSeq->length(aRow.size());
+ for (int i = 0; i < aRow.size(); i++) {
+ CorbaSeq[i] = aRow[i];
}
return CorbaSeq._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATR_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
- Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal;
- for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]);
+ vector<double> aColumn;
+ for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]);
aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATR_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
- Handle(TColStd_HSequenceOfReal) aColumn = new TColStd_HSequenceOfReal;
- for (int i = 0; i < theData.length(); i++) aColumn->Append(theData[i]);
+ vector<double> aColumn;
+ for (int i = 0; i < theData.length(); i++) aColumn.push_back(theData[i]);
aTable->SetColumnData(theColumn, aColumn);
}
{
SALOMEDS::Locker lock;
Unexpect aCatch(ATR_IncorrectIndex);
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
SALOMEDS::DoubleSeq_var CorbaSeq = new SALOMEDS::DoubleSeq;
- Handle(TColStd_HSequenceOfReal) aColumn = aTable->GetColumnData(theColumn);
- CorbaSeq->length(aColumn->Length());
- for (int i = 0; i < aColumn->Length(); i++) {
- CorbaSeq[i] = aColumn->Value(i + 1);
+ vector<double> aColumn = aTable->GetColumnData(theColumn);
+ CorbaSeq->length(aColumn.size());
+ for (int i = 0; i < aColumn.size(); i++) {
+ CorbaSeq[i] = aColumn[i];
}
return CorbaSeq._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATR_IncorrectIndex);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
aTable->PutValue(theValue, theRow, theColumn);
}
CORBA::Boolean SALOMEDS_AttributeTableOfReal_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn)
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl)->HasValue(theRow, theColumn);
+ return dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl)->HasValue(theRow, theColumn);
}
CORBA::Double SALOMEDS_AttributeTableOfReal_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
{
SALOMEDS::Locker lock;
Unexpect aCatch(ATR_IncorrectIndex);
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
CORBA::Double aValue;
try {
aValue = aTable->GetValue(theRow, theColumn);
}
- catch(Standard_Failure) {
+ catch(...) {
throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
}
SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfReal_i::GetRowSetIndices(CORBA::Long theRow)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfReal::IncorrectIndex();
SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
- Handle(TColStd_HSequenceOfInteger) aSeq = aTable->GetSetRowIndices(theRow);
- CorbaSeq->length(aSeq->Length());
- for (int i = 0; i < aSeq->Length(); i++) {
- CorbaSeq[i] = aSeq->Value(i + 1);
+ vector<int> aSeq = aTable->GetSetRowIndices(theRow);
+ int len = aSeq.size();
+ CorbaSeq->length(len);
+ for (int i = 0; i < len; i++) {
+ CorbaSeq[i] = aSeq[i];
}
return CorbaSeq._retn();
}
void SALOMEDS_AttributeTableOfReal_i::SetNbColumns(CORBA::Long theNbColumns)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
aTable->SetNbColumns(theNbColumns);
}
bool SALOMEDS_AttributeTableOfReal_i::ReadFromFile(const SALOMEDS::TMPFile& theStream)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
- istrstream aStream((char*)&theStream[0], theStream.length());
- return aTable->RestoreFromString(aStream);
+ string aStream((char*)&theStream[0], theStream.length());
+ aTable->Load(aStream);
+ return true;
}
SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfReal_i::SaveToFile()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(_impl);
-
- ostrstream ostr;
- string aString;
- aTable->ConvertToString(ostr);
-
- aString = ostr.rdbuf()->str();
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(_impl);
+ string aString = aTable->Save();
char* aBuffer = (char*)CORBA::string_dup(aString.c_str());
int aBufferSize = strlen((char*)aBuffer);
public:
- SALOMEDS_AttributeTableOfReal_i(const Handle(SALOMEDSImpl_AttributeTableOfReal)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeTableOfReal_i(SALOMEDSImpl_AttributeTableOfReal* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeTableOfReal_i() {};
#include "SALOMEDS.hxx"
#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TColStd_HSequenceOfReal.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
+
+using namespace std;
SALOMEDS_AttributeTableOfString::SALOMEDS_AttributeTableOfString
- (const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr)
+ (SALOMEDSImpl_AttributeTableOfString* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetTitle((char*)theTitle.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetTitle(theTitle);
}
else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetTitle(theTitle.c_str());
}
std::string aStr;
if (_isLocal) {
SALOMEDS::Locker lock;
- aStr = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString)::
- DownCast(_local_impl)->GetTitle()).ToCString();
+ aStr = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetTitle();
}
else aStr = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetTitle();
return aStr;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString)::
- DownCast(_local_impl)->SetRowTitle(theIndex, (char*)theTitle.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetRowTitle(theIndex, theTitle);
}
else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitle(theIndex, theTitle.c_str());
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
- Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowTitles(aSeq);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetRowTitles(theTitles);
}
else {
SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq;
- aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowTitles();
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetRowTitles();
}
else {
SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowTitles();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString)::
- DownCast(_local_impl)->SetColumnTitle(theIndex, (char*)theTitle.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetColumnTitle(theIndex, theTitle);
}
else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitle(theIndex, theTitle.c_str());
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- for (i = 0; i < aLength; i++) aSeq->Append((char*)theTitles[i].c_str());
- Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetColumnTitles(aSeq);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetColumnTitles(theTitles);
}
else {
SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq;
- aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetColumnTitles();
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetColumnTitles();
}
else {
SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetColumnTitles();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString)::
- DownCast(_local_impl)->SetRowUnit(theIndex, (char*)theUnit.c_str());
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetRowUnit(theIndex, theUnit);
}
else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnit(theIndex, theUnit.c_str());
}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- for (i = 0; i < aLength; i++) aSeq->Append((char*)theUnits[i].c_str());
- Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetRowUnits(aSeq);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetRowUnits(theUnits);
}
else {
SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aSeq;
- aSeq = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowUnits();
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aSeq->Value(i)).ToCString());
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetRowUnits();
}
else {
SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRowUnits();
int aNb;
if (_isLocal) {
SALOMEDS::Locker lock;
- aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbRows();
+ aNb = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetNbRows();
}
else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbRows();
return aNb;
int aNb;
if (_isLocal) {
SALOMEDS::Locker lock;
- aNb = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetNbColumns();
+ aNb = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetNbColumns();
}
else aNb = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetNbColumns();
return aNb;
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
- aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl);
- Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString;
- for (int i = 0; i < aLength; i++) aRow->Append((char*)theData[i].c_str());
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl);
try {
- aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
+ aTable->SetRowData(aTable->GetNbRows() + 1, theData);
}
catch(...) {
throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
- aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl);
- Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString;
- for (int i = 0; i < aLength; i++) aRow->Append((char*)theData[i].c_str());
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl);
try {
- aTable->SetRowData(theRow, aRow);
+ aTable->SetRowData(theRow, theData);
}
catch(...) {
throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aRow;
- aRow = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetRowData(theRow);
- aLength = aRow->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(TCollection_AsciiString(aRow->Value(i)).ToCString());
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetRowData(theRow);
}
else {
SALOMEDS::StringSeq_var aRow = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->GetRow(theRow);
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
- aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl);
- Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString;
- for (int i = 0; i < aLength; i++) aColumn->Append((char*)theData[i].c_str());
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl);
try {
- aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
+ aTable->SetColumnData(aTable->GetNbColumns() + 1, theData);
}
catch(...) {
throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable;
- aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl);
- Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString;
- for (int i = 0; i < aLength; i++) aColumn->Append((char*)theData[i].c_str());
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl);
try {
- aTable->SetColumnData(theColumn, aColumn);
+ aTable->SetColumnData(theColumn, theData);
}
catch(...) {
throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfExtendedString) aColumn;
- aColumn = Handle(SALOMEDSImpl_AttributeTableOfString)::
- DownCast(_local_impl)->GetColumnData(theColumn);
- aLength = aColumn->Length();
- for (i = 1; i <= aLength; i++)
- aVector.push_back(TCollection_AsciiString(aColumn->Value(i)).ToCString());
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetColumnData(theColumn);
}
else {
SALOMEDS::StringSeq_var aColumn =
CheckLocked();
SALOMEDS::Locker lock;
try {
- Handle(SALOMEDSImpl_AttributeTableOfString)::
- DownCast(_local_impl)->PutValue((char*)theValue.c_str(), theRow, theColumn);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->PutValue(theValue, theRow, theColumn);
}
catch(...) {
throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->HasValue(theRow, theColumn);
+ ret = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->HasValue(theRow, theColumn);
}
else ret = SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->HasValue(theRow, theColumn);
return ret;
if (_isLocal) {
SALOMEDS::Locker lock;
try {
- aValue = TCollection_AsciiString(Handle(SALOMEDSImpl_AttributeTableOfString)::
- DownCast(_local_impl)->GetValue(theRow, theColumn)).ToCString();
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetValue(theRow, theColumn);
}
catch(...) {
throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfInteger) aSet;
- aSet = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->GetSetRowIndices(theRow);
- aLength = aSet->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aSet->Value(i));
+ aVector = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->GetSetRowIndices(theRow);
}
else {
SALOMEDS::LongSeq_var aSet =
{
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_local_impl)->SetNbColumns(theNbColumns);
+ dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_local_impl)->SetNbColumns(theNbColumns);
}
else SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetNbColumns(theNbColumns);
}
class SALOMEDS_AttributeTableOfString: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTableOfString
{
public:
- SALOMEDS_AttributeTableOfString(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr);
+ SALOMEDS_AttributeTableOfString(SALOMEDSImpl_AttributeTableOfString* theAttr);
SALOMEDS_AttributeTableOfString(SALOMEDS::AttributeTableOfString_ptr theAttr);
~SALOMEDS_AttributeTableOfString();
// Module : SALOME
-#include <TCollection_ExtendedString.hxx>
-#include <TCollection_AsciiString.hxx>
-
#include "SALOMEDS_AttributeTableOfString_i.hxx"
#include "SALOMEDS.hxx"
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_ErrorHandler.hxx>
-
#include <strstream>
#include <string>
+#include <vector>
#include "Utils_ExceptHandlers.hxx"
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
CORBA::String_var aStr = CORBA::string_dup(theTitle);
- aTable->SetTitle(TCollection_ExtendedString(aStr));
+ aTable->SetTitle(string(aStr));
}
char* SALOMEDS_AttributeTableOfString_i::GetTitle()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
- CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(aTable->GetTitle()).ToCString());
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
+ CORBA::String_var c_s = CORBA::string_dup(aTable->GetTitle().c_str());
return c_s._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectIndex);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
- aTable->SetRowTitle(theIndex, TCollection_ExtendedString((char*)theTitle));
+ aTable->SetRowTitle(theIndex, string(theTitle));
}
void SALOMEDS_AttributeTableOfString_i::SetRowTitles(const SALOMEDS::StringSeq& theTitles)
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
if (theTitles.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
for (int i = 0; i < theTitles.length(); i++) {
- aTable->SetRowTitle(i + 1, TCollection_ExtendedString((char*)theTitles[i].in()));
+ aTable->SetRowTitle(i + 1, string((char*)theTitles[i].in()));
}
}
SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowTitles()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
aTitles->length(aTable->GetNbRows());
for(int i = 0; i < aTitles->length(); i++)
- aTitles[i] =CORBA::string_dup(TCollection_AsciiString(aTable->GetRowTitle(i + 1)).ToCString());
+ aTitles[i] =CORBA::string_dup(aTable->GetRowTitle(i + 1).c_str());
return aTitles._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectIndex);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
if (theIndex <= 0 || theIndex > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
- aTable->SetColumnTitle(theIndex, TCollection_ExtendedString((char*)theTitle));
+ aTable->SetColumnTitle(theIndex, string((char*)theTitle));
}
void SALOMEDS_AttributeTableOfString_i::SetColumnTitles(const SALOMEDS::StringSeq& theTitles)
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
if (theTitles.length() != aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
for (int i = 0; i < theTitles.length(); i++) {
- aTable->SetColumnTitle(i + 1, TCollection_ExtendedString((char*)theTitles[i].in()));
+ aTable->SetColumnTitle(i + 1, string((char*)theTitles[i].in()));
}
}
SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetColumnTitles()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
SALOMEDS::StringSeq_var aTitles = new SALOMEDS::StringSeq;
aTitles->length(aTable->GetNbColumns());
for(int i = 0; i < aTitles->length(); i++)
- aTitles[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetColumnTitle(i + 1)).ToCString());
+ aTitles[i] = CORBA::string_dup(aTable->GetColumnTitle(i + 1).c_str());
return aTitles._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectIndex);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
if (theIndex <= 0 || theIndex > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
- aTable->SetRowUnit(theIndex, TCollection_ExtendedString((char*)theUnit));
+ aTable->SetRowUnit(theIndex, string((char*)theUnit));
}
void SALOMEDS_AttributeTableOfString_i::SetRowUnits(const SALOMEDS::StringSeq& theUnits)
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
if (theUnits.length() != aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectArgumentLength();
for (int i = 0; i < theUnits.length(); i++) {
- aTable->SetRowUnit(i + 1, TCollection_ExtendedString((char*)theUnits[i].in()));
+ aTable->SetRowUnit(i + 1, string((char*)theUnits[i].in()));
}
}
SALOMEDS::StringSeq* SALOMEDS_AttributeTableOfString_i::GetRowUnits()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
SALOMEDS::StringSeq_var aUnits = new SALOMEDS::StringSeq;
aUnits->length(aTable->GetNbRows());
for(int i = 0; i < aUnits->length(); i++)
- aUnits[i] = CORBA::string_dup(TCollection_AsciiString(aTable->GetRowUnit(i + 1)).ToCString());
+ aUnits[i] = CORBA::string_dup(aTable->GetRowUnit(i + 1).c_str());
return aUnits._retn();
}
CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbRows()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->GetNbRows();
+ return dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl)->GetNbRows();
}
CORBA::Long SALOMEDS_AttributeTableOfString_i::GetNbColumns()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->GetNbColumns();
+ return dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl)->GetNbColumns();
}
void SALOMEDS_AttributeTableOfString_i::AddRow(const SALOMEDS::StringSeq& theData)
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
- Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString;
- for (int i = 0; i < theData.length(); i++) aRow->Append(TCollection_AsciiString(CORBA::string_dup(theData[i])));
+ vector<string> aRow;
+ for (int i = 0; i < theData.length(); i++) aRow.push_back(string(CORBA::string_dup(theData[i])));
aTable->SetRowData(aTable->GetNbRows() + 1, aRow);
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
- Handle(TColStd_HSequenceOfExtendedString) aRow = new TColStd_HSequenceOfExtendedString;
- for (int i = 0; i < theData.length(); i++) aRow->Append(TCollection_AsciiString(CORBA::string_dup(theData[i])));
+ vector<string> aRow;
+ for (int i = 0; i < theData.length(); i++) aRow.push_back(string(CORBA::string_dup(theData[i].in())));
aTable->SetRowData(theRow, aRow);
}
{
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectIndex);
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
if (theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq;
- Handle(TColStd_HSequenceOfExtendedString) aRow = aTable->GetRowData(theRow);
- CorbaSeq->length(aRow->Length());
- for (int i = 0; i < aRow->Length(); i++) {
- CorbaSeq[i] = CORBA::string_dup((TCollection_AsciiString(aRow->Value(i + 1))).ToCString());
+ vector<string> aRow = aTable->GetRowData(theRow);
+ CorbaSeq->length(aRow.size());
+ for (int i = 0; i < aRow.size(); i++) {
+ CorbaSeq[i] = CORBA::string_dup(aRow[i].c_str());
}
return CorbaSeq._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
- Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString;
- for (int i = 0; i < theData.length(); i++) aColumn->Append(TCollection_AsciiString(CORBA::string_dup(theData[i])));
+ vector<string> aColumn;
+ for (int i = 0; i < theData.length(); i++) aColumn.push_back(string(CORBA::string_dup(theData[i])));
aTable->SetColumnData(aTable->GetNbColumns() + 1, aColumn);
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectArgumentLength);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
- Handle(TColStd_HSequenceOfExtendedString) aColumn = new TColStd_HSequenceOfExtendedString;
- for (int i = 0; i < theData.length(); i++) aColumn->Append(TCollection_AsciiString(CORBA::string_dup(theData[i])));
+ vector<string> aColumn;
+ for (int i = 0; i < theData.length(); i++) aColumn.push_back(string(CORBA::string_dup(theData[i])));
aTable->SetColumnData(theColumn, aColumn);
}
{
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectIndex);
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
if (theColumn <= 0 || theColumn > aTable->GetNbColumns()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq;
- Handle(TColStd_HSequenceOfExtendedString) aColumn = aTable->GetColumnData(theColumn);
- CorbaSeq->length(aColumn->Length());
- for (int i = 0; i < aColumn->Length(); i++) {
- CorbaSeq[i] = CORBA::string_dup((TCollection_AsciiString(aColumn->Value(i + 1))).ToCString());
+ vector<string> aColumn = aTable->GetColumnData(theColumn);
+ CorbaSeq->length(aColumn.size());
+ for (int i = 0; i < aColumn.size(); i++) {
+ CorbaSeq[i] = CORBA::string_dup(aColumn[i].c_str());
}
return CorbaSeq._retn();
}
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectIndex);
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
char* aValue = CORBA::string_dup(theValue);
aTable->PutValue(aValue, theRow, theColumn);
CORBA::Boolean SALOMEDS_AttributeTableOfString_i::HasValue(CORBA::Long theRow, CORBA::Long theColumn)
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl)->HasValue(theRow, theColumn);
+ return dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl)->HasValue(theRow, theColumn);
}
char* SALOMEDS_AttributeTableOfString_i::GetValue(CORBA::Long theRow, CORBA::Long theColumn)
{
SALOMEDS::Locker lock;
Unexpect aCatch(ATS_IncorrectIndex);
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
if (theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
- TCollection_AsciiString aValue;
-
+ string aValue;
try {
aValue = aTable->GetValue(theRow, theColumn);
}
- catch(Standard_Failure) {
+ catch(...) {
throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
}
- return CORBA::string_dup(aValue.ToCString());
+ return CORBA::string_dup(aValue.c_str());
}
SALOMEDS::LongSeq* SALOMEDS_AttributeTableOfString_i::GetRowSetIndices(CORBA::Long theRow)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
if(theRow <= 0 || theRow > aTable->GetNbRows()) throw SALOMEDS::AttributeTableOfString::IncorrectIndex();
SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq;
- Handle(TColStd_HSequenceOfInteger) aSeq = aTable->GetSetRowIndices(theRow);
- CorbaSeq->length(aSeq->Length());
- for (int i = 0; i < aSeq->Length(); i++) {
- CorbaSeq[i] = aSeq->Value(i + 1);
+ vector<int> aSeq = aTable->GetSetRowIndices(theRow);
+ CorbaSeq->length(aSeq.size());
+ for (int i = 0; i < aSeq.size(); i++) {
+ CorbaSeq[i] = aSeq[i];
}
return CorbaSeq._retn();
}
void SALOMEDS_AttributeTableOfString_i::SetNbColumns(CORBA::Long theNbColumns)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
aTable->SetNbColumns(theNbColumns);
}
bool SALOMEDS_AttributeTableOfString_i::ReadFromFile(const SALOMEDS::TMPFile& theStream)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
- istrstream aStream((char*)&theStream[0], theStream.length());
- return aTable->RestoreFromString(aStream);
+ string aStream((char*)&theStream[0], theStream.length());
+ aTable->Load(aStream);
+ return true;
}
SALOMEDS::TMPFile* SALOMEDS_AttributeTableOfString_i::SaveToFile()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(_impl);
+
+ string aString = aTable->Save();
+ char* aBuffer = (char*)CORBA::string_dup(aString.c_str());
+ int aBufferSize = strlen((char*)aBuffer);
+
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
+
+ SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
- ostrstream ostr;
- aTable->ConvertToString(ostr);
- CORBA::Octet* anOctetBuf = (CORBA::Octet*)ostr.rdbuf()->str();
- unsigned long aSize = ostr.pcount();
- SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(aSize, aSize, anOctetBuf, 1);
return aStreamFile._retn();
}
public:
- SALOMEDS_AttributeTableOfString_i(const Handle(SALOMEDSImpl_AttributeTableOfString)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeTableOfString_i(SALOMEDSImpl_AttributeTableOfString* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeTableOfString_i() {};
#include "SALOMEDS_AttributeTarget.hxx"
#include "SALOMEDS.hxx"
-#include <TColStd_HSequenceOfTransient.hxx>
-
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDS_SObject.hxx"
+using namespace std;
-SALOMEDS_AttributeTarget::SALOMEDS_AttributeTarget(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr)
+SALOMEDS_AttributeTarget::SALOMEDS_AttributeTarget(SALOMEDSImpl_AttributeTarget* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Add(aSO->GetLocalImpl());
+ dynamic_cast<SALOMEDSImpl_AttributeTarget*>(_local_impl)->Add(*(aSO->GetLocalImpl()));
}
else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Add(aSO->GetCORBAImpl());
}
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfTransient) aSeq =
- Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Get();
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) {
- aSO = new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)));
+ vector<SALOMEDSImpl_SObject> aSeq = dynamic_cast<SALOMEDSImpl_AttributeTarget*>(_local_impl)->Get();
+ aLength = aSeq.size();
+ for (i = 0; i < aLength; i++) {
+ aSO = new SALOMEDS_SObject(aSeq[i]);
aVector.push_back(_PTR(SObject)(aSO));
}
}
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_local_impl)->Remove(aSO->GetLocalImpl());
+ dynamic_cast<SALOMEDSImpl_AttributeTarget*>(_local_impl)->Remove(*(aSO->GetLocalImpl()));
}
else SALOMEDS::AttributeTarget::_narrow(_corba_impl)->Remove(aSO->GetCORBAImpl());
}
class SALOMEDS_AttributeTarget: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTarget
{
public:
- SALOMEDS_AttributeTarget(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr);
+ SALOMEDS_AttributeTarget(SALOMEDSImpl_AttributeTarget* theAttr);
SALOMEDS_AttributeTarget(SALOMEDS::AttributeTarget_ptr theAttr);
~SALOMEDS_AttributeTarget();
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDS.hxx"
+#include "DF_Label.hxx"
-#include <TColStd_HSequenceOfTransient.hxx>
+#include <vector>
using namespace std;
void SALOMEDS_AttributeTarget_i::Add(SALOMEDS::SObject_ptr anObject)
{
SALOMEDS::Locker lock;
- TDF_Label aLabel;
- TDF_Tool::Label(_impl->Label().Data(),anObject->GetID(),aLabel,1);
- (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Add(SALOMEDSImpl_Study::SObject(aLabel));
+ DF_Label aLabel = DF_Label::Label(_impl->Label(), anObject->GetID(), 1);
+ dynamic_cast<SALOMEDSImpl_AttributeTarget*>(_impl)->Add(SALOMEDSImpl_Study::SObject(aLabel));
}
SALOMEDS::Study::ListOfSObject* SALOMEDS_AttributeTarget_i::Get()
{
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfTransient) aSeq = (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Get();
+ vector<SALOMEDSImpl_SObject> aSeq = dynamic_cast<SALOMEDSImpl_AttributeTarget*>(_impl)->Get();
SALOMEDS::Study::ListOfSObject_var aSList = new SALOMEDS::Study::ListOfSObject;
- int aLength = aSeq->Length(), i;
+ int aLength = aSeq.size(), i;
if (aLength == 0) return aSList._retn();
aSList->length(aLength);
- for(i=1; i <=aLength; i++) {
- SALOMEDS::SObject_var anSO = SALOMEDS_SObject_i::New(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)), _orb);
- aSList[i-1] = anSO;
+ for(i=0; i <aLength; i++) {
+ SALOMEDS::SObject_var anSO = SALOMEDS_SObject_i::New(aSeq[i], _orb);
+ aSList[i] = anSO;
}
return aSList._retn();
}
void SALOMEDS_AttributeTarget_i::Remove(SALOMEDS::SObject_ptr anObject)
{
SALOMEDS::Locker lock;
- TDF_Label aLabel;
- TDF_Tool::Label(_impl->Label().Data(),anObject->GetID(),aLabel,1);
- (Handle(SALOMEDSImpl_AttributeTarget)::DownCast(_impl))->Remove(SALOMEDSImpl_Study::SObject(aLabel));
+ DF_Label aLabel = DF_Label::Label(_impl->Label(), anObject->GetID(), 1);
+ dynamic_cast<SALOMEDSImpl_AttributeTarget*>(_impl)->Remove(SALOMEDSImpl_Study::SObject(aLabel));
}
{
public:
- SALOMEDS_AttributeTarget_i(const Handle(SALOMEDSImpl_AttributeTarget)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeTarget_i(SALOMEDSImpl_AttributeTarget* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeTarget_i() {};
#include "SALOMEDS_AttributeTextColor.hxx"
#include "SALOMEDS.hxx"
-#include <TColStd_HArray1OfReal.hxx>
+#include <vector>
-SALOMEDS_AttributeTextColor::SALOMEDS_AttributeTextColor
- (const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr)
+using namespace std;
+
+SALOMEDS_AttributeTextColor::SALOMEDS_AttributeTextColor(SALOMEDSImpl_AttributeTextColor* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
STextColor aColor;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HArray1OfReal) aSeq =
- Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_local_impl)->TextColor();
- aColor.R = aSeq->Value(1);
- aColor.G = aSeq->Value(2);
- aColor.B = aSeq->Value(3);
+ vector<double> aSeq = dynamic_cast<SALOMEDSImpl_AttributeTextColor*>(_local_impl)->TextColor();
+ aColor.R = aSeq[0];
+ aColor.G = aSeq[1];
+ aColor.B = aSeq[2];
}
else {
SALOMEDS::Color anImplColor = SALOMEDS::AttributeTextColor::_narrow(_corba_impl)->TextColor();
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HArray1OfReal) aSeq = new TColStd_HArray1OfReal(1, 3);
- aSeq->SetValue(1, value.R);
- aSeq->SetValue(2, value.G);
- aSeq->SetValue(3, value.B);
- Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_local_impl)->ChangeArray(aSeq);
+ vector<double> aSeq;
+ aSeq.push_back( value.R );
+ aSeq.push_back( value.G );
+ aSeq.push_back( value.B );
+ dynamic_cast<SALOMEDSImpl_AttributeTextColor*>(_local_impl)->ChangeArray(aSeq);
}
else {
SALOMEDS::Color aColor;
class SALOMEDS_AttributeTextColor: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTextColor
{
public:
- SALOMEDS_AttributeTextColor(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr);
+ SALOMEDS_AttributeTextColor(SALOMEDSImpl_AttributeTextColor* theAttr);
SALOMEDS_AttributeTextColor(SALOMEDS::AttributeTextColor_ptr theAttr);
~SALOMEDS_AttributeTextColor();
#include "SALOMEDS_AttributeTextColor_i.hxx"
#include "SALOMEDS.hxx"
-#include <TColStd_HArray1OfReal.hxx>
+#include <vector>
using namespace std;
{
SALOMEDS::Locker lock;
SALOMEDS::Color TextColor;
- Handle(TColStd_HArray1OfReal) anArray = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_impl)->TextColor();
- if (anArray.IsNull() || anArray->Length()!=3) {
+ vector<double> anArray = dynamic_cast<SALOMEDSImpl_AttributeTextColor*>(_impl)->TextColor();
+ if (anArray.size()!=3) {
TextColor.R = 0;
TextColor.G = 0;
TextColor.B = 0;
}
else {
- TextColor.R = anArray->Value(1);
- TextColor.G = anArray->Value(2);
- TextColor.B = anArray->Value(3);
+ TextColor.R = anArray[0];
+ TextColor.G = anArray[1];
+ TextColor.B = anArray[2];
}
return TextColor;
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(TColStd_HArray1OfReal) anArray = new TColStd_HArray1OfReal(1,3);
- anArray->SetValue(1, value.R);
- anArray->SetValue(2, value.G);
- anArray->SetValue(3, value.B);
- Handle(SALOMEDSImpl_AttributeTextColor)::DownCast(_impl)->ChangeArray(anArray);
+ vector<double> anArray;
+ anArray.push_back(value.R);
+ anArray.push_back(value.G);
+ anArray.push_back(value.B);
+ dynamic_cast<SALOMEDSImpl_AttributeTextColor*>(_impl)->ChangeArray(anArray);
}
{
public:
- SALOMEDS_AttributeTextColor_i(const Handle(SALOMEDSImpl_AttributeTextColor)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeTextColor_i(SALOMEDSImpl_AttributeTextColor* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeTextColor_i() {};
#include "SALOMEDS_AttributeTextHighlightColor.hxx"
#include "SALOMEDS.hxx"
-#include <TColStd_HArray1OfReal.hxx>
+#include <vector>
+
+using namespace std;
SALOMEDS_AttributeTextHighlightColor::SALOMEDS_AttributeTextHighlightColor
- (const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr)
+ (SALOMEDSImpl_AttributeTextHighlightColor* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
STextColor aColor;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HArray1OfReal) aSeq;
- aSeq = Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_local_impl)->TextHighlightColor();
- aColor.R = aSeq->Value(1);
- aColor.G = aSeq->Value(2);
- aColor.B = aSeq->Value(3);
+ vector<double> aSeq = dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(_local_impl)->TextHighlightColor();
+ aColor.R = aSeq[0];
+ aColor.G = aSeq[1];
+ aColor.B = aSeq[2];
}
else {
SALOMEDS::Color anImplColor =
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(TColStd_HArray1OfReal) aSeq = new TColStd_HArray1OfReal(1, 3);
- aSeq->SetValue(1, value.R);
- aSeq->SetValue(2, value.G);
- aSeq->SetValue(3, value.B);
- Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_local_impl)->ChangeArray(aSeq);
+ vector<double> aSeq;
+ aSeq.push_back(value.R);
+ aSeq.push_back(value.G);
+ aSeq.push_back(value.B);
+ dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(_local_impl)->ChangeArray(aSeq);
}
else {
SALOMEDS::Color aColor;
class SALOMEDS_AttributeTextHighlightColor: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTextHighlightColor
{
public:
- SALOMEDS_AttributeTextHighlightColor(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr);
+ SALOMEDS_AttributeTextHighlightColor(SALOMEDSImpl_AttributeTextHighlightColor* theAttr);
SALOMEDS_AttributeTextHighlightColor(SALOMEDS::AttributeTextHighlightColor_ptr theAttr);
~SALOMEDS_AttributeTextHighlightColor();
#include "SALOMEDS_AttributeTextHighlightColor_i.hxx"
#include "SALOMEDS.hxx"
-#include <TColStd_HArray1OfReal.hxx>
+#include <vector>
using namespace std;
{
SALOMEDS::Locker lock;
SALOMEDS::Color TextHighlightColor;
- Handle(TColStd_HArray1OfReal) anArray=Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_impl)->TextHighlightColor();
- if (anArray.IsNull() || anArray->Length()!=3) {
+ vector<double> anArray = dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(_impl)->TextHighlightColor();
+ if (anArray.size()!=3) {
TextHighlightColor.R = 0;
TextHighlightColor.G = 0;
TextHighlightColor.B = 0;
}
else {
- TextHighlightColor.R = anArray->Value(1);
- TextHighlightColor.G = anArray->Value(2);
- TextHighlightColor.B = anArray->Value(3);
+ TextHighlightColor.R = anArray[0];
+ TextHighlightColor.G = anArray[1];
+ TextHighlightColor.B = anArray[2];
}
return TextHighlightColor;
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(TColStd_HArray1OfReal) anArray = new TColStd_HArray1OfReal(1,3);
- anArray->SetValue(1, value.R);
- anArray->SetValue(2, value.G);
- anArray->SetValue(3, value.B);
- Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast(_impl)->ChangeArray(anArray);
+ vector<double> anArray;
+ anArray.push_back(value.R);
+ anArray.push_back(value.G);
+ anArray.push_back(value.B);
+ dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(_impl)->ChangeArray(anArray);
}
{
public:
- SALOMEDS_AttributeTextHighlightColor_i(const Handle(SALOMEDSImpl_AttributeTextHighlightColor)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeTextHighlightColor_i(SALOMEDSImpl_AttributeTextHighlightColor* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeTextHighlightColor_i() {};
#include <string>
#include <stdexcept>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <Standard_GUID.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_Tool.hxx>
-
#include "SALOMEDSImpl_AttributeTreeNode.hxx"
#include "SALOMEDS_AttributeTreeNode.hxx"
-SALOMEDS_AttributeTreeNode::SALOMEDS_AttributeTreeNode(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr)
+using namespace std;
+
+SALOMEDS_AttributeTreeNode::SALOMEDS_AttributeTreeNode(SALOMEDSImpl_AttributeTreeNode* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aFather;
- aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- aFather = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ SALOMEDSImpl_AttributeTreeNode *aNode, *aFather;
+ aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ aFather = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(aTN->_local_impl);
aNode->SetFather(aFather);
}
else {
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
- Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
ret = aNode->HasFather();
}
else {
SALOMEDSClient_AttributeTreeNode* aTN = NULL;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
- Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFather());
}
else {
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aPrev;
- aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- aPrev = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ SALOMEDSImpl_AttributeTreeNode *aNode, *aPrev;
+ aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ aPrev = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(aTN->_local_impl);
aNode->SetPrevious(aPrev);
}
else {
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
- Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
ret = aNode->HasPrevious();
}
else {
SALOMEDSClient_AttributeTreeNode* aTN = NULL;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
- Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
aTN = new SALOMEDS_AttributeTreeNode(aNode->GetPrevious());
}
else {
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aNext;
- aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- aNext = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ SALOMEDSImpl_AttributeTreeNode *aNode, *aNext;
+ aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ aNext = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(aTN->_local_impl);
aNode->SetNext(aNext);
}
else {
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
- Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
ret = aNode->HasNext();
}
else {
SALOMEDSClient_AttributeTreeNode* aTN = NULL;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
- Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
aTN = new SALOMEDS_AttributeTreeNode(aNode->GetNext());
}
else {
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aFirst;
- aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- aFirst = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ SALOMEDSImpl_AttributeTreeNode *aNode, *aFirst;
+ aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ aFirst = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(aTN->_local_impl);
aNode->SetFirst(aFirst);
}
else {
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
- Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
ret = aNode->HasFirst();
}
else {
SALOMEDSClient_AttributeTreeNode* aTN = NULL;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
- Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
aTN = new SALOMEDS_AttributeTreeNode(aNode->GetFirst());
}
else {
void SALOMEDS_AttributeTreeNode::SetTreeID(const std::string& value)
{
- if(!Standard_GUID::CheckGUIDFormat((char*)value.c_str())) throw invalid_argument("Invalid GUID");
-
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
- Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- aNode->SetTreeID(Standard_GUID((char*)value.c_str()));
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ aNode->SetTreeID(value);
}
else {
SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
std::string SALOMEDS_AttributeTreeNode::GetTreeID()
{
- TCollection_AsciiString aGUID;
+ string aGUID;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode =
- Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- char guid[40];
- aNode->GetTreeID().ToCString(guid);
- aGUID = TCollection_AsciiString(guid);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ aGUID = aNode->GetTreeID();
}
else {
SALOMEDS::AttributeTreeNode_var aNode = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl);
- aGUID = TCollection_AsciiString(aNode->GetTreeID());
+ aGUID = aNode->GetTreeID();
}
- return std::string(aGUID.ToCString());
+ return aGUID;
}
void SALOMEDS_AttributeTreeNode::Append(const _PTR(AttributeTreeNode)& value)
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
- aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ SALOMEDSImpl_AttributeTreeNode *aNode, *anOther;
+ aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ anOther = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(aTN->_local_impl);
aNode->Append(anOther);
}
else {
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
- aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ SALOMEDSImpl_AttributeTreeNode *aNode, *anOther;
+ aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ anOther = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(aTN->_local_impl);
aNode->Prepend(anOther);
}
else {
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
- aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ SALOMEDSImpl_AttributeTreeNode *aNode, *anOther;
+ aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ anOther = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(aTN->_local_impl);
aNode->InsertBefore(anOther);
}
else {
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
- aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ SALOMEDSImpl_AttributeTreeNode *aNode, *anOther;
+ aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ anOther = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(aTN->_local_impl);
aNode->InsertAfter(anOther);
}
else {
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Remove();
+ dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl)->Remove();
}
else SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Remove();
}
int aDepth;
if (_isLocal) {
SALOMEDS::Locker lock;
- aDepth = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->Depth();
+ aDepth = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl)->Depth();
}
else aDepth = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Depth();
return aDepth;
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl)->IsRoot();
+ ret = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl)->IsRoot();
}
else ret = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->IsRoot();
return ret;
SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
- aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ SALOMEDSImpl_AttributeTreeNode *aNode, *anOther;
+ aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ anOther = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(aTN->_local_impl);
ret = aNode->IsDescendant(anOther);
}
else {
SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
- aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ SALOMEDSImpl_AttributeTreeNode *aNode, *anOther;
+ aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ anOther = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(aTN->_local_impl);
ret = aNode->IsFather(anOther);
}
else {
SALOMEDS_AttributeTreeNode* aTN = dynamic_cast<SALOMEDS_AttributeTreeNode*>(value.get());
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, anOther;
- aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_local_impl);
- anOther = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(aTN->_local_impl);
+ SALOMEDSImpl_AttributeTreeNode *aNode, *anOther;
+ aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_local_impl);
+ anOther = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(aTN->_local_impl);
ret = aNode->IsChild(anOther);
}
else {
string aLabel;
if (_isLocal) {
SALOMEDS::Locker lock;
- TCollection_AsciiString anAsciiLabel;
- TDF_Tool::Entry(_local_impl->Label(), anAsciiLabel);
- aLabel = std::string(anAsciiLabel.ToCString());
+ aLabel = _local_impl->Label().Entry();
}
else aLabel = SALOMEDS::AttributeTreeNode::_narrow(_corba_impl)->Label();
return aLabel;
class SALOMEDS_AttributeTreeNode: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeTreeNode
{
public:
- SALOMEDS_AttributeTreeNode(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr);
+ SALOMEDS_AttributeTreeNode(SALOMEDSImpl_AttributeTreeNode* theAttr);
SALOMEDS_AttributeTreeNode(SALOMEDS::AttributeTreeNode_ptr theAttr);
~SALOMEDS_AttributeTreeNode();
#include "SALOMEDS_AttributeTreeNode_i.hxx"
#include "utilities.h"
#include "SALOMEDS.hxx"
-#include <TDocStd_Document.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
using namespace std;
-static Handle(SALOMEDSImpl_AttributeTreeNode) GetNode(SALOMEDS::AttributeTreeNode_ptr value,
- const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode)
+static SALOMEDSImpl_AttributeTreeNode* GetNode(SALOMEDS::AttributeTreeNode_ptr value,
+ SALOMEDSImpl_AttributeTreeNode* aNode)
{
- Handle(SALOMEDSImpl_AttributeTreeNode) aResult = new SALOMEDSImpl_AttributeTreeNode;
- TCollection_AsciiString anEntry = value->Label();
- TDF_Label aLabel;
- TDF_Tool::Label(aNode->Label().Data(), anEntry, aLabel);
+ SALOMEDSImpl_AttributeTreeNode* aResult = NULL;
+ DF_Label aLabel = DF_Label::Label(aNode->Label(), value->Label());
if (aLabel.IsNull()) {
MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label")
MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label")
return aResult;
}
- if (!aLabel.FindAttribute(aNode->ID(), aResult)) {
+ if (!(aResult=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(aNode->ID()))) {
MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute")
MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute")
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
aNode->SetFather(GetNode(value, aNode));
}
CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFather()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasFather();
+ return dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->HasFather();
}
SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFather()
{
SALOMEDS::Locker lock;
SALOMEDS_AttributeTreeNode_i* aFather;
- aFather = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetFather(), _orb);
+ aFather = new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetFather(), _orb);
#ifndef WNT
return aFather->POA_SALOMEDS::AttributeTreeNode::_this();
#else
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
aNode->SetPrevious(GetNode(value, aNode));
}
CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasPrevious()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasPrevious();
+ return dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->HasPrevious();
}
SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetPrevious()
{
SALOMEDS::Locker lock;
SALOMEDS_AttributeTreeNode_i* aPrevious;
- aPrevious=new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetPrevious(), _orb);
+ aPrevious=new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetPrevious(), _orb);
#ifndef WNT
return aPrevious->POA_SALOMEDS::AttributeTreeNode::_this();
#else
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
aNode->SetNext(GetNode(value, aNode));
}
CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasNext()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasNext();
+ return dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->HasNext();
}
SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetNext()
{
SALOMEDS::Locker lock;
SALOMEDS_AttributeTreeNode_i* aNext;
- aNext = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetNext(), _orb);
+ aNext = new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetNext(), _orb);
#ifndef WNT
return aNext->POA_SALOMEDS::AttributeTreeNode::_this();
#else
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
aNode->SetFirst(GetNode(value, aNode));
}
CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFirst()
{
SALOMEDS::Locker lock;
- return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasFirst();
+ return dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->HasFirst();
}
SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFirst()
{
SALOMEDS::Locker lock;
SALOMEDS_AttributeTreeNode_i* aFirst;
- aFirst = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetFirst(), _orb);
+ aFirst = new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetFirst(), _orb);
#ifndef WNT
return aFirst->POA_SALOMEDS::AttributeTreeNode::_this();
#else
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
- aNode->SetTreeID(Standard_GUID((char*)value));
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
+ aNode->SetTreeID(value);
}
char* SALOMEDS_AttributeTreeNode_i::GetTreeID()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
- char aGUID[40];
- aNode->ID().ToCString(aGUID);
- return CORBA::String_var(CORBA::string_dup(aGUID))._retn();
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
+ return CORBA::String_var(CORBA::string_dup(aNode->ID().c_str()))._retn();
}
void SALOMEDS_AttributeTreeNode_i::Append(SALOMEDS::AttributeTreeNode_ptr value)
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
aNode->Append(GetNode(value, aNode));
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
aNode->Prepend(GetNode(value, aNode));
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
aNode->InsertBefore(GetNode(value, aNode));
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
aNode->InsertAfter(GetNode(value, aNode));
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
aNode->Remove();
}
CORBA::Long SALOMEDS_AttributeTreeNode_i::Depth()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
return aNode->Depth();
}
CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsRoot()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
return aNode->IsRoot();
}
CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsDescendant(SALOMEDS::AttributeTreeNode_ptr value)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
return aNode->IsDescendant(GetNode(value, aNode));
}
CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsFather(SALOMEDS::AttributeTreeNode_ptr value)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
return aNode->IsFather(GetNode(value, aNode));
}
CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsChild(SALOMEDS::AttributeTreeNode_ptr value)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl);
+ SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
return aNode->IsChild(GetNode(value, aNode));
}
char* SALOMEDS_AttributeTreeNode_i::Label()
{
SALOMEDS::Locker lock;
- TCollection_AsciiString aLabelName;
- TDF_Tool::Entry(_impl->Label(),aLabelName);
- return CORBA::String_var(CORBA::string_dup(aLabelName.ToCString()))._retn();
+ return CORBA::String_var(CORBA::string_dup(_impl->Label().Entry().c_str()))._retn();
}
public virtual SALOMEDS_GenericAttribute_i {
public:
- SALOMEDS_AttributeTreeNode_i(const Handle(SALOMEDSImpl_AttributeTreeNode)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeTreeNode_i(SALOMEDSImpl_AttributeTreeNode* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeTreeNode_i() {};
#include <string>
#include <stdexcept>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <Standard_GUID.hxx>
-
-SALOMEDS_AttributeUserID::SALOMEDS_AttributeUserID(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr)
+SALOMEDS_AttributeUserID::SALOMEDS_AttributeUserID(SALOMEDSImpl_AttributeUserID* theAttr)
:SALOMEDS_GenericAttribute(theAttr)
{}
if (_isLocal) {
SALOMEDS::Locker lock;
char guid[40];
- Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_local_impl)->Value().ToCString(guid);
- aValue = std::string(guid);
+ aValue = dynamic_cast<SALOMEDSImpl_AttributeUserID*>(_local_impl)->Value();
}
else aValue = SALOMEDS::AttributeUserID::_narrow(_corba_impl)->Value();
return aValue;
void SALOMEDS_AttributeUserID::SetValue(const std::string& value)
{
- if(!Standard_GUID::CheckGUIDFormat((char*)value.c_str())) throw invalid_argument("Invalid GUID");
-
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeUserID)::
- DownCast(_local_impl)->SetValue(Standard_GUID((char*)value.c_str()));
+ dynamic_cast<SALOMEDSImpl_AttributeUserID*>(_local_impl)->SetValue(value);
}
else SALOMEDS::AttributeUserID::_narrow(_corba_impl)->SetValue(value.c_str());
}
class SALOMEDS_AttributeUserID: public SALOMEDS_GenericAttribute, public SALOMEDSClient_AttributeUserID
{
public:
- SALOMEDS_AttributeUserID(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr);
+ SALOMEDS_AttributeUserID(SALOMEDSImpl_AttributeUserID* theAttr);
SALOMEDS_AttributeUserID(SALOMEDS::AttributeUserID_ptr theAttr);
~SALOMEDS_AttributeUserID();
#include "SALOMEDS_AttributeUserID_i.hxx"
#include "SALOMEDS.hxx"
-#include <TCollection_ExtendedString.hxx>
using namespace std;
char* SALOMEDS_AttributeUserID_i::Value()
{
SALOMEDS::Locker lock;
- char aGUID[40];
- Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_impl)->ID().ToCString(aGUID);
- CORBA::String_var c_s = CORBA::string_dup(aGUID);
+ CORBA::String_var c_s = CORBA::string_dup(dynamic_cast<SALOMEDSImpl_AttributeUserID*>(_impl)->ID().c_str());
return c_s._retn();
}
SALOMEDS::Locker lock;
CheckLocked();
CORBA::String_var Str = CORBA::string_dup(value);
- Handle(SALOMEDSImpl_AttributeUserID)::DownCast(_impl)->SetValue(Standard_GUID(Standard_CString(Str)));
+ dynamic_cast<SALOMEDSImpl_AttributeUserID*>(_impl)->SetValue(string(Str));
}
public virtual SALOMEDS_GenericAttribute_i {
public:
- SALOMEDS_AttributeUserID_i(const Handle(SALOMEDSImpl_AttributeUserID)& theAttr, CORBA::ORB_ptr orb)
+ SALOMEDS_AttributeUserID_i(SALOMEDSImpl_AttributeUserID* theAttr, CORBA::ORB_ptr orb)
:SALOMEDS_GenericAttribute_i(theAttr, orb) {};
~SALOMEDS_AttributeUserID_i() {};
char* Value();
void SetValue(const char* value);
- static const Standard_GUID& DefaultID() {
+ static const std::string& DefaultID() {
return SALOMEDSImpl_AttributeUserID::DefaultID();
}
#include "SALOMEDS_AttributeString_i.hxx"
#define __CreateCORBAAttribute(CORBA_Name) if (strcmp(aTypeOfAttribute, #CORBA_Name) == 0) { \
- Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theAttr); \
+ SALOMEDSImpl_##CORBA_Name* A = dynamic_cast<SALOMEDSImpl_##CORBA_Name*>(theAttr); \
SALOMEDS_##CORBA_Name##_i* Attr = new SALOMEDS_##CORBA_Name##_i(A, theOrb); \
attr_servant = Attr; \
anAttribute = Attr->CORBA_Name::_this(); \
* Purpose :
*/
//============================================================================
-void SALOMEDS_BasicAttribute_i::SetLabel(const TDF_Label Lab)
+void SALOMEDS_BasicAttribute_i::SetLabel(const DF_Label& Lab)
{
_Lab = Lab;
}
// IDL headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
-#include <TDF_Label.hxx>
+#include <DF_Label.hxx>
class SALOMEDS_BasicAttribute_i: public POA_SALOMEDS::BasicAttribute,
public PortableServer::ServantBase {
protected:
- TDF_Label _Lab;
+ DF_Label _Lab;
public:
SALOMEDS_BasicAttribute_i() {};
virtual char * Save() =0;
virtual void Load () =0;
CORBA::Boolean GetPtr(SALOMEDS::SObject so);
- void SetLabel(const TDF_Label Lab);
+ void SetLabel(const DF_Label& Lab);
virtual char* GetType() = 0;
};
using namespace std;
-SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator)
+SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(const SALOMEDSImpl_ChildIterator& theIterator)
{
SALOMEDS::Locker lock;
_isLocal = true;
- _local_impl = theIterator;
+ _local_impl = theIterator.GetPersistentCopy();
_corba_impl = SALOMEDS::ChildIterator::_nil();
}
SALOMEDS_ChildIterator::SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIterator)
{
_isLocal = false;
- _local_impl = NULL;
_corba_impl = SALOMEDS::ChildIterator::_duplicate(theIterator);
}
SALOMEDS_ChildIterator::~SALOMEDS_ChildIterator()
{
if(!_isLocal) _corba_impl->Destroy();
+ else if(_local_impl) delete _local_impl;
}
void SALOMEDS_ChildIterator::Init()
bool SALOMEDS_ChildIterator::More()
{
- bool ret;
+ bool ret = false;
if (_isLocal) {
SALOMEDS::Locker lock;
ret = _local_impl->More();
{
private:
bool _isLocal;
- Handle(SALOMEDSImpl_ChildIterator) _local_impl;
+ SALOMEDSImpl_ChildIterator* _local_impl;
SALOMEDS::ChildIterator_var _corba_impl;
public:
- SALOMEDS_ChildIterator(const Handle(SALOMEDSImpl_ChildIterator)& theIterator);
+ SALOMEDS_ChildIterator(const SALOMEDSImpl_ChildIterator& theIterator);
SALOMEDS_ChildIterator(SALOMEDS::ChildIterator_ptr theIterator);
~SALOMEDS_ChildIterator();
* Purpose :
*/
//============================================================================
-SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(const Handle(SALOMEDSImpl_ChildIterator)& theImpl,
+SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(const SALOMEDSImpl_ChildIterator& theImpl,
CORBA::ORB_ptr orb)
- : _it(theImpl)
+ : _it(theImpl.GetPersistentCopy())
{
SALOMEDS::Locker lock;
_orb = CORBA::ORB::_duplicate(orb);
//============================================================================
SALOMEDS_ChildIterator_i::~SALOMEDS_ChildIterator_i()
{
+ if(_it) delete _it;
}
//============================================================================
SALOMEDS::SObject_ptr SALOMEDS_ChildIterator_i::Value()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO = _it->Value();
+ SALOMEDSImpl_SObject aSO = _it->Value();
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
return so._retn();
}
{
private:
CORBA::ORB_ptr _orb;
- Handle(SALOMEDSImpl_ChildIterator) _it;
+ SALOMEDSImpl_ChildIterator* _it;
public:
//! standard constructor
- SALOMEDS_ChildIterator_i(const Handle(SALOMEDSImpl_ChildIterator)&, CORBA::ORB_ptr);
+ SALOMEDS_ChildIterator_i(const SALOMEDSImpl_ChildIterator&, CORBA::ORB_ptr);
//! standard destructor
~SALOMEDS_ChildIterator_i();
* Purpose :
*/
//============================================================================
-static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO,Standard_Integer offset) {
+static void DumpComponent(SALOMEDS::Study_ptr Study,SALOMEDS::SObject_ptr SO, int offset) {
SALOMEDS::SObject_var RefSO;
SALOMEDS::ChildIterator_var it = Study->NewChildIterator(SO);
for (; it->More();it->Next()){
{
SALOMEDS::AttributeName_var Name = SALOMEDS::AttributeName::_narrow(anAttr);
CORBA::String_var Val = Name->Value();
- for (Standard_Integer i = 1; i <= offset ; i++)
+ for (int i = 1; i <= offset ; i++)
MESSAGE("--");
MESSAGE(">"<<CSO->GetID()<<Val);
}
if (CSO->ReferencedObject(RefSO)) {
- for (Standard_Integer i = 1; i <= offset ; i++)
+ for (int i = 1; i <= offset ; i++)
MESSAGE(" ");
MESSAGE("*Reference"<<RefSO->GetID());
}
static void DumpStudy (SALOMEDS::Study_ptr Study) {
MESSAGE("Explore Study and Write name of each object if it exists");
- Standard_CString name;
+ char* name;
SALOMEDS::SComponentIterator_var itcomp = Study->NewComponentIterator();
- Standard_Integer offset = 1;
+ int offset = 1;
for (; itcomp->More(); itcomp->Next()) {
SALOMEDS::SComponent_var SC = itcomp->Value();
name = SC->ComponentDataType();
static void Test(SALOMEDS::StudyManager_ptr myStudyMgr )
{
try {
- Standard_CString name;
+ char* name;
MESSAGE("Create New Study Study1");
SALOMEDS::Study_var myStudy = myStudyMgr->NewStudy("Study1");
try {
// Initialise the ORB.
#if OMNIORB_VERSION >= 4
- const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } };
- CORBA::ORB_var orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ;
+ CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ;
#else
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
- omniORB::MaxMessageSize(100 * 1024 * 1024);
+ CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB3" );
#endif
// Obtain a reference to the root POA.
#include "SALOMEDS_AttributeString.hxx"
#define __CreateClientAttributeLocal(CORBA_Name) if (strcmp(aTypeOfAttribute.c_str(), #CORBA_Name) == 0) { \
- Handle(SALOMEDSImpl_##CORBA_Name) A = Handle(SALOMEDSImpl_##CORBA_Name)::DownCast(theGA); \
+ SALOMEDSImpl_##CORBA_Name* A = dynamic_cast<SALOMEDSImpl_##CORBA_Name*>(theGA); \
aGA = new SALOMEDS_##CORBA_Name(A); \
}
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx
-// Author : Sergey Ruin
-// Module : SALOME
-
-#ifndef _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile
-#define _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile
-
-#ifndef _TCollection_BasicMapIterator_HeaderFile
-#include <TCollection_BasicMapIterator.hxx>
-#endif
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile
-#include <Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx>
-#endif
-class Standard_NoSuchObject;
-class TCollection_ExtendedString;
-class TColStd_MapIntegerHasher;
-class SALOMEDS_DataMapOfIntegerString;
-class SALOMEDS_DataMapNodeOfDataMapOfIntegerString;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class SALOMEDS_DataMapIteratorOfDataMapOfIntegerString : public TCollection_BasicMapIterator {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapOfIntegerString();
-Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapOfIntegerString(const SALOMEDS_DataMapOfIntegerString& aMap);
-Standard_EXPORT void Initialize(const SALOMEDS_DataMapOfIntegerString& aMap) ;
-Standard_EXPORT const Standard_Real& Key() const;
-Standard_EXPORT const TCollection_ExtendedString& Value() const;
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_0.cxx
-// Author : Sergey Ruin
-// Module : SALOME
-
-#include <SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx>
-
-#ifndef _Standard_NoSuchObject_HeaderFile
-#include <Standard_NoSuchObject.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TColStd_MapIntegerHasher_HeaderFile
-#include <TColStd_MapIntegerHasher.hxx>
-#endif
-#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile
-#include <SALOMEDS_DataMapOfIntegerString.hxx>
-#endif
-#ifndef _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile
-#include <SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx>
-#endif
-using namespace std;
-
-
-#define TheKey Standard_Real
-#define TheKey_hxx <Standard_Real.hxx>
-#define TheItem TCollection_ExtendedString
-#define TheItem_hxx <TCollection_ExtendedString.hxx>
-#define Hasher TColStd_MapIntegerHasher
-#define Hasher_hxx <TColStd_MapIntegerHasher.hxx>
-#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString
-#define TCollection_DataMapNode_hxx <SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx>
-#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString
-#define TCollection_DataMapIterator_hxx <SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx>
-#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString
-#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_()
-#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString
-#define TCollection_DataMap_hxx <SALOMEDS_DataMapOfIntegerString.hxx>
-#include <TCollection_DataMapIterator.gxx>
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile
-#define _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile
-
-#ifndef _TCollection_BasicMapIterator_HeaderFile
-#include <TCollection_BasicMapIterator.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
-#include <Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx>
-#endif
-class Standard_NoSuchObject;
-class TCollection_ExtendedString;
-class TDF_Label;
-class SALOMEDS_DataMapStringLabel;
-class SALOMEDS_DataMapNodeOfDataMapStringLabel;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class SALOMEDS_DataMapIteratorOfDataMapStringLabel : public TCollection_BasicMapIterator {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapStringLabel();
-Standard_EXPORT SALOMEDS_DataMapIteratorOfDataMapStringLabel(const SALOMEDS_DataMapStringLabel& aMap);
-Standard_EXPORT void Initialize(const SALOMEDS_DataMapStringLabel& aMap) ;
-Standard_EXPORT const TCollection_ExtendedString& Key() const;
-Standard_EXPORT const TDF_Label& Value() const;
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_DataMapIteratorOfDataMapStringLabel_0.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx"
-
-#ifndef _Standard_NoSuchObject_HeaderFile
-#include <Standard_NoSuchObject.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _SALOMEDS_DataMapStringLabel_HeaderFile
-#include "SALOMEDS_DataMapStringLabel.hxx"
-#endif
-#ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
-#include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx"
-#endif
- using namespace std;
-
-
-#define TheKey TCollection_ExtendedString
-#define TheKey_hxx <TCollection_ExtendedString.hxx>
-#define TheItem TDF_Label
-#define TheItem_hxx <TDF_Label.hxx>
-#define Hasher TCollection_ExtendedString
-#define Hasher_hxx <TCollection_ExtendedString.hxx>
-#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel
-#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx"
-#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel
-#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx"
-#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel
-#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_()
-#define TCollection_DataMap SALOMEDS_DataMapStringLabel
-#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx"
-#include <TCollection_DataMapIterator.gxx>
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx
-// Author : Sergey Ruin
-// Module : SALOME
-
-#ifndef _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile
-#define _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile
-#include <Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx>
-#endif
-
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TCollection_MapNode_HeaderFile
-#include <TCollection_MapNode.hxx>
-#endif
-#ifndef _TCollection_MapNodePtr_HeaderFile
-#include <TCollection_MapNodePtr.hxx>
-#endif
-class TCollection_ExtendedString;
-class TColStd_MapIntegerHasher;
-class SALOMEDS_DataMapOfIntegerString;
-class SALOMEDS_DataMapIteratorOfDataMapOfIntegerString;
-
-
-class SALOMEDS_DataMapNodeOfDataMapOfIntegerString : public TCollection_MapNode {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-SALOMEDS_DataMapNodeOfDataMapOfIntegerString(const Standard_Real& K,const TCollection_ExtendedString& I,const TCollection_MapNodePtr& n);
- Standard_Real& Key() const;
- TCollection_ExtendedString& Value() const;
-Standard_EXPORT ~SALOMEDS_DataMapNodeOfDataMapOfIntegerString();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Standard_Real myKey;
-TCollection_ExtendedString myValue;
-
-
-};
-
-#define TheKey Standard_Real
-#define TheKey_hxx <Standard_Real.hxx>
-#define TheItem TCollection_ExtendedString
-#define TheItem_hxx <TCollection_ExtendedString.hxx>
-#define Hasher TColStd_MapIntegerHasher
-#define Hasher_hxx <TColStd_MapIntegerHasher.hxx>
-#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString
-#define TCollection_DataMapNode_hxx <SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx>
-#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString
-#define TCollection_DataMapIterator_hxx <SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx>
-#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString
-#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_()
-#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString
-#define TCollection_DataMap_hxx <SALOMEDS_DataMapOfIntegerString.hxx>
-
-#include <TCollection_DataMapNode.lxx>
-
-#undef TheKey
-#undef TheKey_hxx
-#undef TheItem
-#undef TheItem_hxx
-#undef Hasher
-#undef Hasher_hxx
-#undef TCollection_DataMapNode
-#undef TCollection_DataMapNode_hxx
-#undef TCollection_DataMapIterator
-#undef TCollection_DataMapIterator_hxx
-#undef Handle_TCollection_DataMapNode
-#undef TCollection_DataMapNode_Type_
-#undef TCollection_DataMap
-#undef TCollection_DataMap_hxx
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_DataMapNodeOfDataMapOfIntegerString_0.cxx
-// Author : Sergey Ruin
-// Module : SALOME
-
-#include <SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx>
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TColStd_MapIntegerHasher_HeaderFile
-#include <TColStd_MapIntegerHasher.hxx>
-#endif
-#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile
-#include <SALOMEDS_DataMapOfIntegerString.hxx>
-#endif
-#ifndef _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile
-#include <SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx>
-#endif
-using namespace std;
-SALOMEDS_DataMapNodeOfDataMapOfIntegerString::~SALOMEDS_DataMapNodeOfDataMapOfIntegerString() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_DataMapNodeOfDataMapOfIntegerString",
- sizeof(SALOMEDS_DataMapNodeOfDataMapOfIntegerString),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString))) {
- _anOtherObject = Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)((Handle(SALOMEDS_DataMapNodeOfDataMapOfIntegerString)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_DataMapNodeOfDataMapOfIntegerString::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) ;
-}
-Standard_Boolean SALOMEDS_DataMapNodeOfDataMapOfIntegerString::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapOfIntegerString) == AType || TCollection_MapNode::IsKind(AType));
-}
-Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString::~Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString() {}
-#define TheKey Standard_Real
-#define TheKey_hxx <Standard_Real.hxx>
-#define TheItem TCollection_ExtendedString
-#define TheItem_hxx <TCollection_ExtendedString.hxx>
-#define Hasher TColStd_MapIntegerHasher
-#define Hasher_hxx <TColStd_MapIntegerHasher.hxx>
-#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString
-#define TCollection_DataMapNode_hxx <SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx>
-#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString
-#define TCollection_DataMapIterator_hxx <SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx>
-#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString
-#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_()
-#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString
-#define TCollection_DataMap_hxx <SALOMEDS_DataMapOfIntegerString.hxx>
-#include <TCollection_DataMapNode.gxx>
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
-#define _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
-#include <Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx>
-#endif
-
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TCollection_MapNode_HeaderFile
-#include <TCollection_MapNode.hxx>
-#endif
-#ifndef _TCollection_MapNodePtr_HeaderFile
-#include <TCollection_MapNodePtr.hxx>
-#endif
-class TCollection_ExtendedString;
-class TDF_Label;
-class SALOMEDS_DataMapStringLabel;
-class SALOMEDS_DataMapIteratorOfDataMapStringLabel;
-
-
-class SALOMEDS_DataMapNodeOfDataMapStringLabel : public TCollection_MapNode {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT inline SALOMEDS_DataMapNodeOfDataMapStringLabel(const TCollection_ExtendedString& K,const TDF_Label& I,const TCollection_MapNodePtr& n);
-Standard_EXPORT inline TCollection_ExtendedString& Key() const;
-Standard_EXPORT inline TDF_Label& Value() const;
-Standard_EXPORT ~SALOMEDS_DataMapNodeOfDataMapStringLabel();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-TCollection_ExtendedString myKey;
-TDF_Label myValue;
-
-
-};
-
-#define TheKey TCollection_ExtendedString
-#define TheKey_hxx <TCollection_ExtendedString.hxx>
-#define TheItem TDF_Label
-#define TheItem_hxx <TDF_Label.hxx>
-#define Hasher TCollection_ExtendedString
-#define Hasher_hxx <TCollection_ExtendedString.hxx>
-#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel
-#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx"
-#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel
-#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx"
-#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel
-#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_()
-#define TCollection_DataMap SALOMEDS_DataMapStringLabel
-#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx"
-
-#include <TCollection_DataMapNode.lxx>
-
-#undef TheKey
-#undef TheKey_hxx
-#undef TheItem
-#undef TheItem_hxx
-#undef Hasher
-#undef Hasher_hxx
-#undef TCollection_DataMapNode
-#undef TCollection_DataMapNode_hxx
-#undef TCollection_DataMapIterator
-#undef TCollection_DataMapIterator_hxx
-#undef Handle_TCollection_DataMapNode
-#undef TCollection_DataMapNode_Type_
-#undef TCollection_DataMap
-#undef TCollection_DataMap_hxx
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_0.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _SALOMEDS_DataMapStringLabel_HeaderFile
-#include "SALOMEDS_DataMapStringLabel.hxx"
-#endif
-#ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile
-#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx"
-#endif
-using namespace std;
-SALOMEDS_DataMapNodeOfDataMapStringLabel::~SALOMEDS_DataMapNodeOfDataMapStringLabel() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_DataMapNodeOfDataMapStringLabel",
- sizeof(SALOMEDS_DataMapNodeOfDataMapStringLabel),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel))) {
- _anOtherObject = Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)((Handle(SALOMEDS_DataMapNodeOfDataMapStringLabel)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_DataMapNodeOfDataMapStringLabel::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel) ;
-}
-Standard_Boolean SALOMEDS_DataMapNodeOfDataMapStringLabel::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_DataMapNodeOfDataMapStringLabel) == AType || TCollection_MapNode::IsKind(AType));
-}
-Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel::~Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel() {}
-#define TheKey TCollection_ExtendedString
-#define TheKey_hxx <TCollection_ExtendedString.hxx>
-#define TheItem TDF_Label
-#define TheItem_hxx <TDF_Label.hxx>
-#define Hasher TCollection_ExtendedString
-#define Hasher_hxx <TCollection_ExtendedString.hxx>
-#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel
-#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx"
-#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel
-#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx"
-#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel
-#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_()
-#define TCollection_DataMap SALOMEDS_DataMapStringLabel
-#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx"
-#include <TCollection_DataMapNode.gxx>
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_DataMapOfIntegerString.hxx
-// Author : Sergey Ruin
-// Module : SALOME
-
-#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile
-#define _SALOMEDS_DataMapOfIntegerString_HeaderFile
-
-#ifndef _TCollection_BasicMap_HeaderFile
-#include <TCollection_BasicMap.hxx>
-#endif
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile
-#include <Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-class Standard_DomainError;
-class Standard_NoSuchObject;
-class TCollection_ExtendedString;
-class TColStd_MapIntegerHasher;
-class SALOMEDS_DataMapNodeOfDataMapOfIntegerString;
-class SALOMEDS_DataMapIteratorOfDataMapOfIntegerString;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class SALOMEDS_DataMapOfIntegerString : public TCollection_BasicMap {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOMEDS_DataMapOfIntegerString(const Standard_Integer NbBuckets = 1);
-Standard_EXPORT SALOMEDS_DataMapOfIntegerString& Assign(const SALOMEDS_DataMapOfIntegerString& Other) ;
- SALOMEDS_DataMapOfIntegerString& operator =(const SALOMEDS_DataMapOfIntegerString& Other)
-{
- return Assign(Other);
-}
-
-Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ;
-Standard_EXPORT void Clear() ;
-~SALOMEDS_DataMapOfIntegerString()
-{
- Clear();
-}
-
-Standard_EXPORT Standard_Boolean Bind(const Standard_Real& K,const TCollection_ExtendedString& I) ;
-Standard_EXPORT Standard_Boolean IsBound(const Standard_Real& K) const;
-Standard_EXPORT Standard_Boolean UnBind(const Standard_Real& K) ;
-Standard_EXPORT const TCollection_ExtendedString& Find(const Standard_Real& K) const;
- const TCollection_ExtendedString& operator()(const Standard_Real& K) const
-{
- return Find(K);
-}
-
-Standard_EXPORT TCollection_ExtendedString& ChangeFind(const Standard_Real& K) ;
- TCollection_ExtendedString& operator()(const Standard_Real& K)
-{
- return ChangeFind(K);
-}
-
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-Standard_EXPORT SALOMEDS_DataMapOfIntegerString(const SALOMEDS_DataMapOfIntegerString& Other);
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_DataMapOfIntegerString_0.cxx
-// Author : Sergey Ruin
-// Module : SALOME
-
-#include <SALOMEDS_DataMapOfIntegerString.hxx>
-
-#ifndef _Standard_DomainError_HeaderFile
-#include <Standard_DomainError.hxx>
-#endif
-#ifndef _Standard_NoSuchObject_HeaderFile
-#include <Standard_NoSuchObject.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TColStd_MapIntegerHasher_HeaderFile
-#include <TColStd_MapIntegerHasher.hxx>
-#endif
-#ifndef _SALOMEDS_DataMapNodeOfDataMapOfIntegerString_HeaderFile
-#include <SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx>
-#endif
-#ifndef _SALOMEDS_DataMapIteratorOfDataMapOfIntegerString_HeaderFile
-#include <SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx>
-#endif
- using namespace std;
-
-
-#define TheKey Standard_Real
-#define TheKey_hxx <Standard_Real.hxx>
-#define TheItem TCollection_ExtendedString
-#define TheItem_hxx <TCollection_ExtendedString.hxx>
-#define Hasher TColStd_MapIntegerHasher
-#define Hasher_hxx <TColStd_MapIntegerHasher.hxx>
-#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapOfIntegerString
-#define TCollection_DataMapNode_hxx <SALOMEDS_DataMapNodeOfDataMapOfIntegerString.hxx>
-#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapOfIntegerString
-#define TCollection_DataMapIterator_hxx <SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx>
-#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapOfIntegerString
-#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapOfIntegerString_Type_()
-#define TCollection_DataMap SALOMEDS_DataMapOfIntegerString
-#define TCollection_DataMap_hxx <SALOMEDS_DataMapOfIntegerString.hxx>
-#include <TCollection_DataMap.gxx>
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_DataMapStringLabel.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_DataMapStringLabel_HeaderFile
-#define _SALOMEDS_DataMapStringLabel_HeaderFile
-
-#ifndef _TCollection_BasicMap_HeaderFile
-#include <TCollection_BasicMap.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
-#include <Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-class Standard_DomainError;
-class Standard_NoSuchObject;
-class TCollection_ExtendedString;
-class TDF_Label;
-class SALOMEDS_DataMapNodeOfDataMapStringLabel;
-class SALOMEDS_DataMapIteratorOfDataMapStringLabel;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class SALOMEDS_DataMapStringLabel : public TCollection_BasicMap {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOMEDS_DataMapStringLabel(const Standard_Integer NbBuckets = 1);
-Standard_EXPORT SALOMEDS_DataMapStringLabel& Assign(const SALOMEDS_DataMapStringLabel& Other) ;
- SALOMEDS_DataMapStringLabel& operator =(const SALOMEDS_DataMapStringLabel& Other)
-{
- return Assign(Other);
-}
-
-Standard_EXPORT void ReSize(const Standard_Integer NbBuckets) ;
-Standard_EXPORT void Clear() ;
-~SALOMEDS_DataMapStringLabel()
-{
- Clear();
-}
-
-Standard_EXPORT Standard_Boolean Bind(const TCollection_ExtendedString& K,const TDF_Label& I) ;
-Standard_EXPORT Standard_Boolean IsBound(const TCollection_ExtendedString& K) const;
-Standard_EXPORT Standard_Boolean UnBind(const TCollection_ExtendedString& K) ;
-Standard_EXPORT const TDF_Label& Find(const TCollection_ExtendedString& K) const;
- const TDF_Label& operator()(const TCollection_ExtendedString& K) const
-{
- return Find(K);
-}
-
-Standard_EXPORT TDF_Label& ChangeFind(const TCollection_ExtendedString& K) ;
- TDF_Label& operator()(const TCollection_ExtendedString& K)
-{
- return ChangeFind(K);
-}
-
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-Standard_EXPORT SALOMEDS_DataMapStringLabel(const SALOMEDS_DataMapStringLabel& Other);
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_DataMapStringLabel_0.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_DataMapStringLabel.hxx"
-
-#ifndef _Standard_DomainError_HeaderFile
-#include <Standard_DomainError.hxx>
-#endif
-#ifndef _Standard_NoSuchObject_HeaderFile
-#include <Standard_NoSuchObject.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _SALOMEDS_DataMapNodeOfDataMapStringLabel_HeaderFile
-#include "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx"
-#endif
-#ifndef _SALOMEDS_DataMapIteratorOfDataMapStringLabel_HeaderFile
-#include "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx"
-#endif
- using namespace std;
-
-
-#define TheKey TCollection_ExtendedString
-#define TheKey_hxx <TCollection_ExtendedString.hxx>
-#define TheItem TDF_Label
-#define TheItem_hxx <TDF_Label.hxx>
-#define Hasher TCollection_ExtendedString
-#define Hasher_hxx <TCollection_ExtendedString.hxx>
-#define TCollection_DataMapNode SALOMEDS_DataMapNodeOfDataMapStringLabel
-#define TCollection_DataMapNode_hxx "SALOMEDS_DataMapNodeOfDataMapStringLabel.hxx"
-#define TCollection_DataMapIterator SALOMEDS_DataMapIteratorOfDataMapStringLabel
-#define TCollection_DataMapIterator_hxx "SALOMEDS_DataMapIteratorOfDataMapStringLabel.hxx"
-#define Handle_TCollection_DataMapNode Handle_SALOMEDS_DataMapNodeOfDataMapStringLabel
-#define TCollection_DataMapNode_Type_() SALOMEDS_DataMapNodeOfDataMapStringLabel_Type_()
-#define TCollection_DataMap SALOMEDS_DataMapStringLabel
-#define TCollection_DataMap_hxx "SALOMEDS_DataMapStringLabel.hxx"
-#include <TCollection_DataMap.gxx>
-
+++ /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
---
--- File : SALOMEDS_DrawableAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class DrawableAttribute from SALOMEDS inherits Integer from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- ExtendedString from TCollection,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF; value : Integer from Standard)
- ---Purpose: Find, or create a Comment attribute and set the string.
- -- the Comment attribute is returned.
- returns DrawableAttribute from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable DrawableAttribute from SALOMEDS;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end DrawableAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_DrawableAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_DrawableAttribute.ixx"
-#include <TDataStd_Integer.hxx>
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_DrawableAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_DrawableAttributeID ("12837184-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_DrawableAttributeID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_DrawableAttribute) SALOMEDS_DrawableAttribute::Set (const TDF_Label& L,
- const Standard_Integer value)
-{
- Handle(SALOMEDS_DrawableAttribute) A;
- if (!L.FindAttribute(SALOMEDS_DrawableAttribute::GetID(),A)) {
- A = new SALOMEDS_DrawableAttribute();
- L.AddAttribute(A);
- }
-
- (Handle(TDataStd_Integer)::DownCast(A))->Set (value);
- return A;
-}
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_DrawableAttribute::SALOMEDS_DrawableAttribute()
-{
- TDataStd_Integer::Set(0);
-}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_DrawableAttribute::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_DrawableAttribute::NewEmpty () const
-{
- return new SALOMEDS_DrawableAttribute();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_DrawableAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get ();
- TDataStd_Integer::Set(s);
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_DrawableAttribute::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
-{
- Handle(TDataStd_Integer)::DownCast (into)->Set (Get());
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_DrawableAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_DrawableAttribute_HeaderFile
-#define _SALOMEDS_DrawableAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_DrawableAttribute_HeaderFile
-#include <Handle_SALOMEDS_DrawableAttribute.hxx>
-#endif
-
-#ifndef _TDataStd_Integer_HeaderFile
-#include <TDataStd_Integer.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class Standard_GUID;
-class TDF_Label;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_DrawableAttribute : public TDataStd_Integer {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_DrawableAttribute Set(const TDF_Label& label,const Standard_Integer value) ;
-Standard_EXPORT SALOMEDS_DrawableAttribute();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_DrawableAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_DrawableAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_DrawableAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_DrawableAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_DrawableAttribute::~SALOMEDS_DrawableAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_DrawableAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_DrawableAttribute",
- sizeof(SALOMEDS_DrawableAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_DrawableAttribute) Handle(SALOMEDS_DrawableAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_DrawableAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_DrawableAttribute))) {
- _anOtherObject = Handle(SALOMEDS_DrawableAttribute)((Handle(SALOMEDS_DrawableAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_DrawableAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_DrawableAttribute) ;
-}
-Standard_Boolean SALOMEDS_DrawableAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_DrawableAttribute) == AType || TDataStd_Integer::IsKind(AType));
-}
-Handle_SALOMEDS_DrawableAttribute::~Handle_SALOMEDS_DrawableAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_DrawableAttribute.jxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_DrawableAttribute_HeaderFile
-#include "SALOMEDS_DrawableAttribute.hxx"
-#endif
{
}
-Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
- const TCollection_AsciiString& theURL,
- long& theStreamLength,
- bool isMultiFile)
+SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::Save(const SALOMEDSImpl_SComponent& theComponent,
+ const string& theURL,
+ long& theStreamLength,
+ bool isMultiFile)
{
SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
- CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
+ CORBA::String_var url = CORBA::string_dup(theURL.c_str());
SALOMEDS::unlock();
SALOMEDS::TMPFile_var aStream = _driver->Save(sco.in(), url, isMultiFile);
- Handle(SALOMEDSImpl_TMPFile) aTMPFile(new SALOMEDS_TMPFile_i(aStream._retn()));
+ SALOMEDSImpl_TMPFile* aTMPFile = new SALOMEDS_TMPFile_i(aStream._retn());
theStreamLength = aTMPFile->Size();
SALOMEDS::lock();
return aTMPFile;
}
-Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
- const TCollection_AsciiString& theURL,
- long& theStreamLength,
- bool isMultiFile)
+SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::SaveASCII(const SALOMEDSImpl_SComponent& theComponent,
+ const string& theURL,
+ long& theStreamLength,
+ bool isMultiFile)
{
SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
- CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
+ CORBA::String_var url = CORBA::string_dup(theURL.c_str());
SALOMEDS::unlock();
SALOMEDS::TMPFile_var aStream = _driver->SaveASCII(sco.in(), url, isMultiFile);
- Handle(SALOMEDSImpl_TMPFile) aTMPFile(new SALOMEDS_TMPFile_i(aStream._retn()));
+ SALOMEDSImpl_TMPFile* aTMPFile = new SALOMEDS_TMPFile_i(aStream._retn());
theStreamLength = aTMPFile->Size();
SALOMEDS::lock();
return aTMPFile;
}
-bool SALOMEDS_Driver_i::Load(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+bool SALOMEDS_Driver_i::Load(const SALOMEDSImpl_SComponent& theComponent,
const unsigned char* theStream,
const long theStreamLength,
- const TCollection_AsciiString& theURL,
+ const string& theURL,
bool isMultiFile)
{
SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
- CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
+ CORBA::String_var url = CORBA::string_dup(theURL.c_str());
CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream;
SALOMEDS::TMPFile_var aStream;
return isOk;
}
-bool SALOMEDS_Driver_i::LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+bool SALOMEDS_Driver_i::LoadASCII(const SALOMEDSImpl_SComponent& theComponent,
const unsigned char* theStream,
const long theStreamLength,
- const TCollection_AsciiString& theURL,
+ const string& theURL,
bool isMultiFile)
{
SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
- CORBA::String_var url = CORBA::string_dup(theURL.ToCString());
+ CORBA::String_var url = CORBA::string_dup(theURL.c_str());
CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream;
SALOMEDS::TMPFile_var aStream;
return isOk;
}
-void SALOMEDS_Driver_i::Close(const Handle(SALOMEDSImpl_SComponent)& theComponent)
+void SALOMEDS_Driver_i::Close(const SALOMEDSImpl_SComponent& theComponent)
{
SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (theComponent, _orb);
-TCollection_AsciiString SALOMEDS_Driver_i::IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject,
- const TCollection_AsciiString& IORString,
- bool isMultiFile,
- bool isASCII)
+string SALOMEDS_Driver_i::IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject,
+ const string& IORString,
+ bool isMultiFile,
+ bool isASCII)
{
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theSObject, _orb);
- CORBA::String_var ior = CORBA::string_dup(IORString.ToCString());
+ CORBA::String_var ior = CORBA::string_dup(IORString.c_str());
SALOMEDS::unlock();
CORBA::String_var pers_string =_driver->IORToLocalPersistentID(so.in(), ior.in(), isMultiFile, isASCII);
SALOMEDS::lock();
- return TCollection_AsciiString(pers_string);
+ return string(pers_string);
}
-TCollection_AsciiString SALOMEDS_Driver_i::LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theObject,
- const TCollection_AsciiString& aLocalPersistentID,
- bool isMultiFile,
- bool isASCII)
+string SALOMEDS_Driver_i::LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theObject,
+ const string& aLocalPersistentID,
+ bool isMultiFile,
+ bool isASCII)
{
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb);
- CORBA::String_var pers_string = CORBA::string_dup(aLocalPersistentID.ToCString());
+ CORBA::String_var pers_string = CORBA::string_dup(aLocalPersistentID.c_str());
SALOMEDS::unlock();
CORBA::String_var IOR = _driver->LocalPersistentIDToIOR(so.in(), pers_string.in(), isMultiFile, isASCII);
SALOMEDS::lock();
- return TCollection_AsciiString(IOR);
+ return string(IOR);
}
-bool SALOMEDS_Driver_i::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDS_Driver_i::CanCopy(const SALOMEDSImpl_SObject& theObject)
{
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb);
}
-Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject,
- int& theObjectID,
- long& theStreamLength)
+SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::CopyFrom(const SALOMEDSImpl_SObject& theObject,
+ int& theObjectID,
+ long& theStreamLength)
{
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb);
SALOMEDS::unlock();
CORBA::Long anObjectID;
SALOMEDS::TMPFile_var aStream = _driver->CopyFrom(so.in(), anObjectID);
- Handle(SALOMEDSImpl_TMPFile) aTMPFile(new SALOMEDS_TMPFile_i(aStream._retn()));
+ SALOMEDSImpl_TMPFile* aTMPFile = new SALOMEDS_TMPFile_i(aStream._retn());
theStreamLength = aTMPFile->Size();
theObjectID = anObjectID;
SALOMEDS::lock();
return aTMPFile;
}
-bool SALOMEDS_Driver_i::CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID)
+bool SALOMEDS_Driver_i::CanPaste(const string& theComponentName, int theObjectID)
{
SALOMEDS::unlock();
- bool canPaste = _driver->CanPaste(theComponentName.ToCString(), theObjectID);
+ bool canPaste = _driver->CanPaste(theComponentName.c_str(), theObjectID);
SALOMEDS::lock();
return canPaste;
}
-TCollection_AsciiString SALOMEDS_Driver_i::PasteInto(const unsigned char* theStream,
- const long theStreamLength,
- int theObjectID,
- const Handle(SALOMEDSImpl_SObject)& theObject)
+string SALOMEDS_Driver_i::PasteInto(const unsigned char* theStream,
+ const long theStreamLength,
+ int theObjectID,
+ const SALOMEDSImpl_SObject& theObject)
{
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (theObject, _orb);
CORBA::Octet* anOctetBuf = (CORBA::Octet*)theStream;
SALOMEDS::SObject_var ret_so = _driver->PasteInto(aStream.in(), theObjectID, so.in());
SALOMEDS::lock();
- return TCollection_AsciiString((char*)ret_so->GetID());
+ return string(ret_so->GetID());
}
-Handle(SALOMEDSImpl_TMPFile) SALOMEDS_Driver_i::DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy,
- bool isPublished,
- bool& isValidScript,
- long& theStreamLength)
+SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(SALOMEDSImpl_Study* theStudy,
+ bool isPublished,
+ bool& isValidScript,
+ long& theStreamLength)
{
SALOMEDS_Study_i * st_servant = new SALOMEDS_Study_i (theStudy, _orb);
SALOMEDS::Study_var st = SALOMEDS::Study::_narrow(st_servant->_this());
SALOMEDS::unlock();
CORBA::Boolean aValidScript, aPublished = isPublished;
Engines::TMPFile_var aStream = aComponent->DumpPython(st.in(), aPublished, aValidScript);
- Handle(SALOMEDSImpl_TMPFile) aTMPFile(new Engines_TMPFile_i(aStream._retn()));
+ SALOMEDSImpl_TMPFile* aTMPFile = new Engines_TMPFile_i(aStream._retn());
theStreamLength = aTMPFile->Size();
isValidScript = aValidScript;
SALOMEDS::lock();
// SALOMEDS_DriverFactory
//###############################################################################################################
-SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType
- (const TCollection_AsciiString& theComponentType)
+SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByType(const string& theComponentType)
{
CORBA::Object_var obj;
- TCollection_AsciiString aFactoryType;
+ string aFactoryType;
if (theComponentType == "SUPERV") aFactoryType = "SuperVisionContainer";
else aFactoryType = "FactoryServer";
SALOMEDS::unlock();
- obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component
- (aFactoryType.ToCString(), theComponentType.ToCString());
+ obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component(aFactoryType.c_str(), theComponentType.c_str());
SALOMEDS::lock();
if (CORBA::is_nil(obj)) {
- obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component
- ("FactoryServerPy", theComponentType.ToCString());
+ obj = SALOME_LifeCycleCORBA(_name_service).FindOrLoad_Component("FactoryServerPy", theComponentType.c_str());
}
if (!CORBA::is_nil(obj)) {
return NULL;
}
-SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByIOR(const TCollection_AsciiString& theIOR)
+SALOMEDSImpl_Driver* SALOMEDS_DriverFactory_i::GetDriverByIOR(const string& theIOR)
{
CORBA::Object_var obj;
- obj = _orb->string_to_object(theIOR.ToCString());
+ obj = _orb->string_to_object(theIOR.c_str());
if (!CORBA::is_nil(obj)) {
SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(obj);
#define __SALOMEDS_DRIVER_I_H__
#include <omniORB4/CORBA.h>
-#include <TCollection_AsciiString.hxx>
#include "SALOMEDSImpl_Driver.hxx"
#include "SALOMEDSImpl_SComponent.hxx"
#include "SALOMEDSImpl_SObject.hxx"
~SALOMEDS_Driver_i();
- virtual TCollection_AsciiString GetIOR()
+ virtual std::string GetIOR()
{
CORBA::String_var ior = _orb->object_to_string(_driver);
- return TCollection_AsciiString(ior);
+ return std::string(ior);
}
- virtual Handle(SALOMEDSImpl_TMPFile) Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
- const TCollection_AsciiString& theURL,
- long& theStreamLength,
- bool isMultiFile);
+ virtual SALOMEDSImpl_TMPFile* Save(const SALOMEDSImpl_SComponent& theComponent,
+ const std::string& theURL,
+ long& theStreamLength,
+ bool isMultiFile);
- virtual Handle(SALOMEDSImpl_TMPFile) SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
- const TCollection_AsciiString& theURL,
- long& theStreamLength,
- bool isMultiFile);
+ virtual SALOMEDSImpl_TMPFile* SaveASCII(const SALOMEDSImpl_SComponent& theComponent,
+ const std::string& theURL,
+ long& theStreamLength,
+ bool isMultiFile);
- virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ virtual bool Load(const SALOMEDSImpl_SComponent& theComponent,
const unsigned char* theStream,
const long theStreamLength,
- const TCollection_AsciiString& theURL,
+ const std::string& theURL,
bool isMultiFile);
- virtual bool LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ virtual bool LoadASCII(const SALOMEDSImpl_SComponent& theComponent,
const unsigned char* theStream,
const long theStreamLength,
- const TCollection_AsciiString& theURL,
+ const std::string& theURL,
bool isMultiFile);
- virtual void Close(const Handle(SALOMEDSImpl_SComponent)& theComponent);
+ virtual void Close(const SALOMEDSImpl_SComponent& theComponent);
- virtual TCollection_AsciiString ComponentDataType()
+ virtual std::string ComponentDataType()
{
CORBA::String_var ior = _driver->ComponentDataType();
- return TCollection_AsciiString(ior);
+ return std::string(ior);
}
- virtual TCollection_AsciiString IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject,
- const TCollection_AsciiString& IORString,
- bool isMultiFile,
- bool isASCII);
+ virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject,
+ const std::string& IORString,
+ bool isMultiFile,
+ bool isASCII);
- virtual TCollection_AsciiString LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theSObject,
- const TCollection_AsciiString& aLocalPersistentID,
- bool isMultiFile,
- bool isASCII);
+ virtual std::string LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theSObject,
+ const std::string& aLocalPersistentID,
+ bool isMultiFile,
+ bool isASCII);
- virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject);
+ virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject);
- virtual Handle(SALOMEDSImpl_TMPFile) CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject,
- int& theObjectID,
- long& theStreamLength);
+ virtual SALOMEDSImpl_TMPFile* CopyFrom(const SALOMEDSImpl_SObject& theObject,
+ int& theObjectID,
+ long& theStreamLength);
- virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID);
+ virtual bool CanPaste(const std::string& theComponentName, int theObjectID);
- virtual TCollection_AsciiString PasteInto(const unsigned char* theStream,
- const long theStreamLength,
- int theObjectID,
- const Handle(SALOMEDSImpl_SObject)& theObject);
+ virtual std::string PasteInto(const unsigned char* theStream,
+ const long theStreamLength,
+ int theObjectID,
+ const SALOMEDSImpl_SObject& theObject);
- virtual Handle(SALOMEDSImpl_TMPFile) DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy,
- bool isPublished,
- bool& isValidScript,
- long& theStreamLength);
+ virtual SALOMEDSImpl_TMPFile* DumpPython(SALOMEDSImpl_Study* theStudy,
+ bool isPublished,
+ bool& isValidScript,
+ long& theStreamLength);
};
#include "SALOME_NamingService.hxx"
delete _name_service;
}
- virtual SALOMEDSImpl_Driver* GetDriverByType(const TCollection_AsciiString& theComponentType);
+ virtual SALOMEDSImpl_Driver* GetDriverByType(const std::string& theComponentType);
- virtual SALOMEDSImpl_Driver* GetDriverByIOR(const TCollection_AsciiString& theIOR);
+ virtual SALOMEDSImpl_Driver* GetDriverByIOR(const std::string& theIOR);
};
#endif
+++ /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
---
--- File : SALOMEDS_ExpandableAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class ExpandableAttribute from SALOMEDS inherits Integer from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- ExtendedString from TCollection,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF; value : Integer from Standard)
- ---Purpose: Find, or create a Comment attribute and set the string.
- -- the Comment attribute is returned.
- returns ExpandableAttribute from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable ExpandableAttribute from SALOMEDS;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end ExpandableAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_ExpandableAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_ExpandableAttribute.ixx"
-#include <TDataStd_Integer.hxx>
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_ExpandableAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_ExpandableAttributeID ("12837185-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_ExpandableAttributeID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_ExpandableAttribute) SALOMEDS_ExpandableAttribute::Set (const TDF_Label& L,
- const Standard_Integer value)
-{
- Handle(SALOMEDS_ExpandableAttribute) A;
- if (!L.FindAttribute(SALOMEDS_ExpandableAttribute::GetID(),A)) {
- A = new SALOMEDS_ExpandableAttribute();
- L.AddAttribute(A);
- }
-
- (Handle(TDataStd_Integer)::DownCast(A))->Set (value);
- return A;
-}
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_ExpandableAttribute::SALOMEDS_ExpandableAttribute()
-{
- TDataStd_Integer::Set(0);
-}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_ExpandableAttribute::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_ExpandableAttribute::NewEmpty () const
-{
- return new SALOMEDS_ExpandableAttribute();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_ExpandableAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get ();
- TDataStd_Integer::Set(s);
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_ExpandableAttribute::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
-{
- Handle(TDataStd_Integer)::DownCast (into)->Set (Get());
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_ExpandableAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_ExpandableAttribute_HeaderFile
-#define _SALOMEDS_ExpandableAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_ExpandableAttribute_HeaderFile
-#include <Handle_SALOMEDS_ExpandableAttribute.hxx>
-#endif
-
-#ifndef _TDataStd_Integer_HeaderFile
-#include <TDataStd_Integer.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class Standard_GUID;
-class TDF_Label;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_ExpandableAttribute : public TDataStd_Integer {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_ExpandableAttribute Set(const TDF_Label& label,const Standard_Integer value) ;
-Standard_EXPORT SALOMEDS_ExpandableAttribute();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_ExpandableAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_ExpandableAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_ExpandableAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_ExpandableAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_ExpandableAttribute::~SALOMEDS_ExpandableAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_ExpandableAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_ExpandableAttribute",
- sizeof(SALOMEDS_ExpandableAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_ExpandableAttribute) Handle(SALOMEDS_ExpandableAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_ExpandableAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_ExpandableAttribute))) {
- _anOtherObject = Handle(SALOMEDS_ExpandableAttribute)((Handle(SALOMEDS_ExpandableAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_ExpandableAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_ExpandableAttribute) ;
-}
-Standard_Boolean SALOMEDS_ExpandableAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_ExpandableAttribute) == AType || TDataStd_Integer::IsKind(AType));
-}
-Handle_SALOMEDS_ExpandableAttribute::~Handle_SALOMEDS_ExpandableAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_ExpandableAttribute.jxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_ExpandableAttribute_HeaderFile
-#include "SALOMEDS_ExpandableAttribute.hxx"
-#endif
+++ /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
---
---
--- File : SALOMEDS_ExternalFileDef.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class ExternalFileDef from SALOMEDS inherits Comment from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- ExtendedString from TCollection,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF;
- Name : ExtendedString from TCollection)
- returns ExternalFileDef from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable ExternalFileDef from SALOMEDS;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end ExternalFileDef;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_ExternalFileDef.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_ExternalFileDef.ixx"
-#include <TDataStd_Comment.hxx>
-#include <TCollection_ExtendedString.hxx>
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_ExternalFileDef::GetID ()
-{
- static Standard_GUID SALOMEDS_ExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE");
- return SALOMEDS_ExternalFileDefID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_ExternalFileDef) SALOMEDS_ExternalFileDef::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S)
-{
-
- Handle(SALOMEDS_ExternalFileDef) A;
- if (!L.FindAttribute(SALOMEDS_ExternalFileDef::GetID(),A)) {
- A = new SALOMEDS_ExternalFileDef();
- L.AddAttribute(A);
- }
-
- (Handle(TDataStd_Comment)::DownCast(A))->Set (S);
- return A;
-}
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_ExternalFileDef::SALOMEDS_ExternalFileDef()
-{}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_ExternalFileDef::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_ExternalFileDef::NewEmpty () const
-{
- return new SALOMEDS_ExternalFileDef();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_ExternalFileDef::Restore(const Handle(TDF_Attribute)& with)
-{
- TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get ();
- TDataStd_Comment::Set(s);
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_ExternalFileDef::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
-{
- Handle(TDataStd_Comment)::DownCast (into)->Set (Get());
-}
-
+++ /dev/null
-// File generated by CPPExt (Transient)
-//
-// Copyright (C) 1991,1995 by
-//
-// MATRA DATAVISION, FRANCE
-//
-// This software is furnished in accordance with the terms and conditions
-// of the contract and with the inclusion of the above copyright notice.
-// This software or any other copy thereof may not be provided or otherwise
-// be made available to any other person. No title to an ownership of the
-// software is hereby transferred.
-//
-// At the termination of the contract, the software and all copies of this
-// software must be deleted.
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-
-#ifndef _SALOMEDS_ExternalFileDef_HeaderFile
-#define _SALOMEDS_ExternalFileDef_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_ExternalFileDef_HeaderFile
-#include <Handle_SALOMEDS_ExternalFileDef.hxx>
-#endif
-
-#ifndef _TDataStd_Comment_HeaderFile
-#include <TDataStd_Comment.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class Standard_GUID;
-class TDF_Label;
-class TCollection_ExtendedString;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_ExternalFileDef : public TDataStd_Comment {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_ExternalFileDef Set(const TDF_Label& label,const TCollection_ExtendedString& Name) ;
-Standard_EXPORT SALOMEDS_ExternalFileDef();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_ExternalFileDef();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_ExternalFileDef_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// File generated by CPPExt (Transient)
-// Copyright (C) 1991,1995 by
-//
-// MATRA DATAVISION, FRANCE
-//
-// This software is furnished in accordance with the terms and conditions
-// of the contract and with the inclusion of the above copyright notice.
-// This software or any other copy thereof may not be provided or otherwise
-// be made available to any other person. No title to an ownership of the
-// software is hereby transferred.
-//
-// At the termination of the contract, the software and all copies of this
-// software must be deleted.
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-
-#include <SALOMEDS_ExternalFileDef.jxx>
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_ExternalFileDef::~SALOMEDS_ExternalFileDef() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_ExternalFileDef_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_ExternalFileDef",
- sizeof(SALOMEDS_ExternalFileDef),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_ExternalFileDef) Handle(SALOMEDS_ExternalFileDef)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_ExternalFileDef) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_ExternalFileDef))) {
- _anOtherObject = Handle(SALOMEDS_ExternalFileDef)((Handle(SALOMEDS_ExternalFileDef)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_ExternalFileDef::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_ExternalFileDef) ;
-}
-Standard_Boolean SALOMEDS_ExternalFileDef::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_ExternalFileDef) == AType || TDataStd_Comment::IsKind(AType));
-}
-Handle_SALOMEDS_ExternalFileDef::~Handle_SALOMEDS_ExternalFileDef() {}
-
+++ /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 _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_ExternalFileDef_HeaderFile
-#include <SALOMEDS_ExternalFileDef.hxx>
-#endif
+++ /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
---
---
--- File : SALOMEDS_FileType.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class FileType from SALOMEDS inherits Comment from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- ExtendedString from TCollection,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF;
- Name : ExtendedString from TCollection)
- returns FileType from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable FileType from SALOMEDS;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end FileType;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_FileType.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_FileType.ixx"
-#include <TDataStd_Comment.hxx>
-#include <TCollection_ExtendedString.hxx>
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_FileType::GetID ()
-{
- static Standard_GUID SALOMEDS_FileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340");
- return SALOMEDS_FileTypeID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_FileType) SALOMEDS_FileType::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S)
-{
-
- Handle(SALOMEDS_FileType) A;
- if (!L.FindAttribute(SALOMEDS_FileType::GetID(),A)) {
- A = new SALOMEDS_FileType();
- L.AddAttribute(A);
- }
-
- (Handle(TDataStd_Comment)::DownCast(A))->Set (S);
- return A;
-}
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_FileType::SALOMEDS_FileType()
-{}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_FileType::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_FileType::NewEmpty () const
-{
- return new SALOMEDS_FileType();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_FileType::Restore(const Handle(TDF_Attribute)& with)
-{
- TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get ();
- TDataStd_Comment::Set(s);
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_FileType::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
-{
- Handle(TDataStd_Comment)::DownCast (into)->Set (Get());
-}
-
+++ /dev/null
-// File generated by CPPExt (Transient)
-//
-// Copyright (C) 1991,1995 by
-//
-// MATRA DATAVISION, FRANCE
-//
-// This software is furnished in accordance with the terms and conditions
-// of the contract and with the inclusion of the above copyright notice.
-// This software or any other copy thereof may not be provided or otherwise
-// be made available to any other person. No title to an ownership of the
-// software is hereby transferred.
-//
-// At the termination of the contract, the software and all copies of this
-// software must be deleted.
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-
-#ifndef _SALOMEDS_FileType_HeaderFile
-#define _SALOMEDS_FileType_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_FileType_HeaderFile
-#include <Handle_SALOMEDS_FileType.hxx>
-#endif
-
-#ifndef _TDataStd_Comment_HeaderFile
-#include <TDataStd_Comment.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class Standard_GUID;
-class TDF_Label;
-class TCollection_ExtendedString;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_FileType : public TDataStd_Comment {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_FileType Set(const TDF_Label& label,const TCollection_ExtendedString& Name) ;
-Standard_EXPORT SALOMEDS_FileType();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_FileType();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_FileType_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// File generated by CPPExt (Transient)
-// Copyright (C) 1991,1995 by
-//
-// MATRA DATAVISION, FRANCE
-//
-// This software is furnished in accordance with the terms and conditions
-// of the contract and with the inclusion of the above copyright notice.
-// This software or any other copy thereof may not be provided or otherwise
-// be made available to any other person. No title to an ownership of the
-// software is hereby transferred.
-//
-// At the termination of the contract, the software and all copies of this
-// software must be deleted.
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#include <SALOMEDS_FileType.jxx>
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_FileType::~SALOMEDS_FileType() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_FileType_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_FileType",
- sizeof(SALOMEDS_FileType),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_FileType) Handle(SALOMEDS_FileType)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_FileType) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_FileType))) {
- _anOtherObject = Handle(SALOMEDS_FileType)((Handle(SALOMEDS_FileType)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_FileType::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_FileType) ;
-}
-Standard_Boolean SALOMEDS_FileType::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_FileType) == AType || TDataStd_Comment::IsKind(AType));
-}
-Handle_SALOMEDS_FileType::~Handle_SALOMEDS_FileType() {}
-
+++ /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 _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_FileType_HeaderFile
-#include <SALOMEDS_FileType.hxx>
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_FlagsAttribute.cxx
-// Author : Sergey LITONIN
-// Module : SALOME
-
-#include "SALOMEDS_FlagsAttribute.hxx"
-#include <TDataStd_Integer.hxx>
-#include <Standard_GUID.hxx>
-#include <TDF_Label.hxx>
-
-using namespace std;
-
-
-/*
- Class : SALOMEDS_FlagsAttribute
- Description : This class is intended for storing different object attributes that
- have only two states (0 and 1).
-*/
-
-IMPLEMENT_STANDARD_HANDLE( SALOMEDS_FlagsAttribute, TDataStd_Integer )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDS_FlagsAttribute, TDataStd_Integer )
-
-//=======================================================================
-//function : SALOMEDS_FlagsAttribute::GetID
-//purpose : Get GUID of this attribute
-//=======================================================================
-const Standard_GUID& SALOMEDS_FlagsAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_FlagsAttributeID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" );
- return SALOMEDS_FlagsAttributeID;
-}
-
-//=======================================================================
-//function : SALOMEDS_FlagsAttribute::Set
-//purpose : Set value of the attribute
-//=======================================================================
-Handle(SALOMEDS_FlagsAttribute) SALOMEDS_FlagsAttribute::Set( const TDF_Label& L,
- const Standard_Integer value )
-{
- Handle(SALOMEDS_FlagsAttribute) A;
- if ( !L.FindAttribute(SALOMEDS_FlagsAttribute::GetID(),A ) )
- {
- A = new SALOMEDS_FlagsAttribute();
- L.AddAttribute( A );
- }
-
- ( Handle(TDataStd_Integer)::DownCast( A ) )->Set( value );
- return A;
-}
-
-//=======================================================================
-//function : SALOMEDS_FlagsAttribute::SALOMEDS_FlagsAttribute
-//purpose : Constructor
-//=======================================================================
-SALOMEDS_FlagsAttribute::SALOMEDS_FlagsAttribute()
-{
- TDataStd_Integer::Set( 0 );
-}
-
-SALOMEDS_FlagsAttribute::~SALOMEDS_FlagsAttribute()
-{
-}
-
-//=======================================================================
-//function : SALOMEDS_FlagsAttribute::ID
-//purpose : Get GUID of this attribute
-//=======================================================================
-const Standard_GUID& SALOMEDS_FlagsAttribute::ID () const
-{
- return GetID();
-}
-
-//=======================================================================
-//function : SALOMEDS_FlagsAttribute::NewEmpty
-//purpose : Create new empty attribute
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_FlagsAttribute::NewEmpty () const
-{
- return new SALOMEDS_FlagsAttribute();
-}
-
-//=======================================================================
-//function : SALOMEDS_FlagsAttribute::Restore
-//purpose : Assign given value to the attribute
-//=======================================================================
-void SALOMEDS_FlagsAttribute::Restore( const Handle(TDF_Attribute)& with )
-{
- Standard_Integer s = Handle(TDataStd_Integer)::DownCast( with )->Get();
- TDataStd_Integer::Set( s );
- return;
-}
-
-//=======================================================================
-//function : SALOMEDS_FlagsAttribute::Paste
-//purpose : Assign internal value to the given attribute
-//=======================================================================
-void SALOMEDS_FlagsAttribute::Paste( const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT ) const
-{
- Handle(TDataStd_Integer)::DownCast( into )->Set( Get() );
-}
-
-//=======================================================================
-//function : SALOMEDS_FlagsAttribute::Set
-//purpose : Set value
-//=======================================================================
-void SALOMEDS_FlagsAttribute::Set( const Standard_Integer v )
-{
- TDataStd_Integer::Set( v );
-}
-
-//=======================================================================
-//function : SALOMEDS_FlagsAttribute::Get
-//purpose : GetValue
-//=======================================================================
-Standard_Integer SALOMEDS_FlagsAttribute::Get() const
-{
- return TDataStd_Integer::Get();
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_FlagsAttribute.hxx
-// Author : Sergey LITONIN
-// Module : SALOME
-
-#ifndef SALOMEDS_FlagsAttribute_HeaderFile
-#define SALOMEDS_FlagsAttribute_HeaderFile
-
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDataStd_Integer.hxx>
-
-class Standard_GUID;
-class TDF_Label;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-/*
- Class : SALOMEDS_FlagsAttribute
- Description : This class is intended for storing different object attributes that
- have only two states (0 and 1).
-*/
-
-DEFINE_STANDARD_HANDLE( SALOMEDS_FlagsAttribute, TDataStd_Integer )
-
-class Standard_EXPORT SALOMEDS_FlagsAttribute : public TDataStd_Integer
-{
-public:
-
-static const Standard_GUID& GetID() ;
-static Handle(SALOMEDS_FlagsAttribute) Set( const TDF_Label&,
- const Standard_Integer );
-
- SALOMEDS_FlagsAttribute();
-virtual ~SALOMEDS_FlagsAttribute();
-
-const Standard_GUID& ID() const;
-void Restore( const Handle(TDF_Attribute)& with );
-Handle_TDF_Attribute NewEmpty() const;
-void Paste( const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT ) const;
-void Set( const Standard_Integer );
-Standard_Integer Get() const;
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDS_FlagsAttribute )
-};
-
-#endif
#include <string>
-#include <TCollection_AsciiString.hxx>
#include "SALOMEDS_GenericAttribute.hxx"
#include "SALOMEDSImpl_SObject.hxx"
using namespace std;
-SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA)
+SALOMEDS_GenericAttribute::SALOMEDS_GenericAttribute(SALOMEDSImpl_GenericAttribute* theGA)
{
_isLocal = true;
_local_impl = theGA;
std::string aType;
if (_isLocal) {
SALOMEDS::Locker lock;
- aType = _local_impl->Type().ToCString();
+ aType = _local_impl->Type();
}
else {
aType = _corba_impl->Type();
std::string aType;
if (_isLocal) {
SALOMEDS::Locker lock;
- aType = _local_impl->GetClassType().ToCString();
+ aType = _local_impl->GetClassType();
}
else {
aType = _corba_impl->GetClassType();
}
-SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute
- (const Handle(SALOMEDSImpl_GenericAttribute)& theGA)
+SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDSImpl_GenericAttribute* theGA)
{
SALOMEDS::Locker lock;
SALOMEDS_GenericAttribute* aGA = NULL;
- std::string aTypeOfAttribute = theGA->GetClassType().ToCString();
- __CreateGenericClientAttributeLocal
+ if(theGA) {
+ std::string aTypeOfAttribute = theGA->GetClassType();
+ __CreateGenericClientAttributeLocal
+ }
return aGA;
}
SALOMEDS_GenericAttribute* SALOMEDS_GenericAttribute::CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA)
{
SALOMEDS_GenericAttribute* aGA = NULL;
- std::string aTypeOfAttribute = theGA->GetClassType();
- __CreateGenericClientAttributeCORBA
+ if(!CORBA::is_nil(theGA)) {
+ std::string aTypeOfAttribute = theGA->GetClassType();
+ __CreateGenericClientAttributeCORBA
+ }
return aGA;
}
{
protected:
bool _isLocal;
- Handle(SALOMEDSImpl_GenericAttribute) _local_impl;
+ SALOMEDSImpl_GenericAttribute* _local_impl;
SALOMEDS::GenericAttribute_var _corba_impl;
public:
- SALOMEDS_GenericAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA);
+ SALOMEDS_GenericAttribute(SALOMEDSImpl_GenericAttribute* theGA);
SALOMEDS_GenericAttribute(SALOMEDS::GenericAttribute_ptr theGA);
virtual ~SALOMEDS_GenericAttribute();
std::string GetClassType();
_PTR(SObject) GetSObject();
- static SALOMEDS_GenericAttribute* CreateAttribute(const Handle(SALOMEDSImpl_GenericAttribute)& theGA);
+ static SALOMEDS_GenericAttribute* CreateAttribute(SALOMEDSImpl_GenericAttribute* theGA);
static SALOMEDS_GenericAttribute* CreateAttribute(SALOMEDS::GenericAttribute_ptr theGA);
};
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_Study.hxx"
#include "Utils_ExceptHandlers.hxx"
-#include <TCollection_AsciiString.hxx>
#include <map>
#ifdef WIN32
UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection);
-SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theImpl, CORBA::ORB_ptr theOrb)
+SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb)
{
_orb = CORBA::ORB::_duplicate(theOrb);
_impl = theImpl;
SALOMEDS::Locker lock;
Unexpect aCatch(GALockProtection);
- if (!_impl.IsNull() && _impl->IsValid() && !CORBA::is_nil(_orb)) {
+ if (_impl && !CORBA::is_nil(_orb)) {
try {
SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(_impl);
}
SALOMEDS::SObject_ptr SALOMEDS_GenericAttribute_i::GetSObject()
{
SALOMEDS::Locker lock;
- if (_impl.IsNull() || _impl->Label().IsNull()) return SALOMEDS::SObject::_nil();
- Handle(SALOMEDSImpl_SObject) so_impl = SALOMEDSImpl_Study::SObject(_impl->Label());
+ if (!_impl || _impl->Label().IsNull()) return SALOMEDS::SObject::_nil();
+ SALOMEDSImpl_SObject so_impl = SALOMEDSImpl_Study::SObject(_impl->Label());
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (so_impl, _orb);
return so._retn();
}
char* SALOMEDS_GenericAttribute_i::Type()
{
SALOMEDS::Locker lock;
- if (!_impl.IsNull()) {
+ if (_impl) {
return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetType(_impl));
}
char* SALOMEDS_GenericAttribute_i::GetClassType()
{
SALOMEDS::Locker lock;
- if (!_impl.IsNull()) {
+ if (_impl) {
return CORBA::string_dup(SALOMEDSImpl_GenericAttribute::Impl_GetClassType(_impl));
}
SALOMEDS::GenericAttribute_ptr SALOMEDS_GenericAttribute_i::CreateAttribute
- (const Handle(TDF_Attribute)& theAttr,
- CORBA::ORB_ptr theOrb)
+ (DF_Attribute* theAttr,
+ CORBA::ORB_ptr theOrb)
{
SALOMEDS::Locker lock;
-/*
- static std::map<TDF_Attribute*, SALOMEDS_GenericAttribute_i*> _mapOfAttrib;
- SALOMEDS::GenericAttribute_var anAttribute;
- SALOMEDS_GenericAttribute_i* attr_servant = NULL;
-
- if(_mapOfAttrib.find(theAttr.operator->()) != _mapOfAttrib.end()) {
- attr_servant = _mapOfAttrib[theAttr.operator->()];
- anAttribute = SALOMEDS::GenericAttribute::_narrow(attr_servant->_this());
- }
- else {
- char* aTypeOfAttribute = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr)->GetClassType().ToCString();
- __CreateGenericCORBAAttribute
- _mapOfAttrib[theAttr.operator->()] = attr_servant;
- }
-*/
- // mpv: now servants Destroyed by common algos of CORBA
- TCollection_AsciiString aClassType = Handle(SALOMEDSImpl_GenericAttribute)::
- DownCast(theAttr)->GetClassType();
- char* aTypeOfAttribute = aClassType.ToCString();
+ string aClassType = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr)->GetClassType();
+ char* aTypeOfAttribute = (char*)aClassType.c_str();
SALOMEDS::GenericAttribute_var anAttribute;
SALOMEDS_GenericAttribute_i* attr_servant = NULL;
__CreateGenericCORBAAttribute
long pid = (long)getpid();
#endif
isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
- TDF_Attribute* local_impl = _impl.operator->();
- return ((CORBA::LongLong)local_impl);
+ return ((CORBA::LongLong)_impl);
}
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
#include <SALOME_GenericObj_i.hh>
-#include <TDF_Attribute.hxx>
+#include "DF_Attribute.hxx"
#include "SALOMEDS_SObject_i.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
{
protected:
- Handle(TDF_Attribute) _impl;
- CORBA::ORB_ptr _orb;
+ DF_Attribute* _impl;
+ CORBA::ORB_ptr _orb;
public:
- SALOMEDS_GenericAttribute_i(const Handle(TDF_Attribute)& theImpl, CORBA::ORB_ptr theOrb);
+ SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb);
virtual ~SALOMEDS_GenericAttribute_i() {};
void CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection);
SALOMEDS::SObject_ptr GetSObject();
- virtual Handle(TDF_Attribute) GetImpl() { return _impl; }
+ virtual DF_Attribute* GetImpl() { return _impl; }
- static SALOMEDS::GenericAttribute_ptr CreateAttribute(const Handle(TDF_Attribute)& theAttr, CORBA::ORB_ptr theOrb);
+ static SALOMEDS::GenericAttribute_ptr CreateAttribute(DF_Attribute* theAttr, CORBA::ORB_ptr theOrb);
virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
};
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_GraphicAttribute.cxx
-// Author : Sergey LITONIN
-// Module : SALOME
-
-#include "SALOMEDS_GraphicAttribute.hxx"
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
-#include <TDF_Label.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
-
-/*
- Class : SALOMEDS_GraphicAttribute
- Description : This class is intended for storing information about
- graphic representation of objects in dirrent views
-*/
-
-IMPLEMENT_STANDARD_HANDLE( SALOMEDS_GraphicAttribute, TDF_Attribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDS_GraphicAttribute, TDF_Attribute )
-
-//=======================================================================
-//function : GetID
-//purpose : Get GUID of this attribute
-//=======================================================================
-const Standard_GUID& SALOMEDS_GraphicAttribute::GetID()
-{
- static Standard_GUID SALOMEDS_GraphicAttributeID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" );
- return SALOMEDS_GraphicAttributeID;
-}
-
-//=======================================================================
-//function : SALOMEDS_GraphicAttribute
-//purpose : Empty Constructor
-//=======================================================================
-SALOMEDS_GraphicAttribute::SALOMEDS_GraphicAttribute()
-{
-}
-
-//=======================================================================
-//function : ~SALOMEDS_GraphicAttribute
-//purpose : Destructor
-//=======================================================================
-SALOMEDS_GraphicAttribute::~SALOMEDS_GraphicAttribute()
-{
-}
-
-//=======================================================================
-//function : SetVisibility
-//purpose : Set visibility of object in given view
-//=======================================================================
-void SALOMEDS_GraphicAttribute::SetVisibility( const Standard_Integer theViewId,
- const Standard_Boolean theValue )
-{
- if ( myVisibility.IsBound( theViewId ) && myVisibility( theViewId ) == theValue )
- return;
-
- Backup();
- if ( myVisibility.IsBound( theViewId ) )
- myVisibility.ChangeFind( theViewId ) = theValue ? 1 : 0;
- else
- myVisibility.Bind( theViewId, theValue ? 1 : 0 );
-}
-
-
-//=======================================================================
-//function : Get
-//purpose : Get visibility of object in given view
-//=======================================================================
-Standard_Boolean SALOMEDS_GraphicAttribute::GetVisibility(
- const Standard_Integer theViewId ) const
-{
- return myVisibility.IsBound( theViewId ) ? myVisibility( theViewId ) : false;
-}
-
-
-//=======================================================================
-//function : ID
-//purpose : Get GUID of this attribute
-//=======================================================================
-const Standard_GUID& SALOMEDS_GraphicAttribute::ID () const
-{
- return GetID();
-}
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose : Create new empty attribute
-//=======================================================================
-Handle(TDF_Attribute) SALOMEDS_GraphicAttribute::NewEmpty () const
-{
- return new SALOMEDS_GraphicAttribute ();
-}
-
-//=======================================================================
-//function : SetVisibility
-//purpose : Set visibility of object in all views
-//=======================================================================
-void SALOMEDS_GraphicAttribute::SetVisibility( const TColStd_DataMapOfIntegerInteger& theMap )
-{
- myVisibility = theMap;
-}
-
-//=======================================================================
-//function : SetVisibility
-//purpose : Get visibility of object in all views
-//=======================================================================
-const TColStd_DataMapOfIntegerInteger& SALOMEDS_GraphicAttribute::GetVisibility()
-{
- return myVisibility;
-}
-
-//=======================================================================
-//function : Restore
-//purpose : Restore value of attribute with value of theWith one
-//=======================================================================
-void SALOMEDS_GraphicAttribute::Restore( const Handle(TDF_Attribute)& theWith )
-{
- Handle(SALOMEDS_GraphicAttribute) anAttr =
- Handle(SALOMEDS_GraphicAttribute)::DownCast( theWith );
-
- if ( !anAttr.IsNull() )
- SetVisibility( anAttr->GetVisibility() );
-}
-
-//=======================================================================
-//function : Paste
-//purpose : Paste value of current attribute to the value of entry one
-//=======================================================================
-void SALOMEDS_GraphicAttribute::Paste( const Handle(TDF_Attribute)& theInto,
- const Handle(TDF_RelocationTable)& ) const
-{
- Handle(SALOMEDS_GraphicAttribute) anAttr =
- Handle(SALOMEDS_GraphicAttribute)::DownCast( theInto );
-
- if ( !anAttr.IsNull() )
- anAttr->SetVisibility( myVisibility );
-}
-
-//=======================================================================
-//function : Dump
-//purpose : Dump
-//=======================================================================
-Standard_OStream& SALOMEDS_GraphicAttribute::Dump( Standard_OStream& anOS ) const
-{
- anOS << "Visibility of object:" << endl;
- TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIter( myVisibility );
- for ( ; anIter.More(); anIter.Next() )
- {
- char str[ 100 ];
-
- if ( GetVisibility( anIter.Key() ) )
- sprintf( str, "Viewer ID = 0x%X State = VISIBLE\n", anIter.Key() );
- else
- sprintf( str, "Viewer ID = 0x%X State = INVISIBLE\n", anIter.Key() );
-
- anOS << str;
- }
-
- anOS << "Integer";
- return anOS;
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_GraphicAttribute.hxx
-// Author : Sergey LITONIN
-// Module : SALOME
-
-#ifndef SALOMEDS_GraphicAttribute_HeaderFile
-#define SALOMEDS_GraphicAttribute_HeaderFile
-
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Attribute.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-
-class Standard_GUID;
-class TDF_Label;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-/*
- Class : SALOMEDS_GraphicAttribute
- Description : This class is intended for storing information about
- graphic representation of objects in dirrent views
-*/
-
-DEFINE_STANDARD_HANDLE( SALOMEDS_GraphicAttribute, TDF_Attribute )
-
-class Standard_EXPORT SALOMEDS_GraphicAttribute : public TDF_Attribute
-{
-
-public:
- SALOMEDS_GraphicAttribute();
- ~SALOMEDS_GraphicAttribute();
-
- static const Standard_GUID& GetID() ;
-
- void SetVisibility( const Standard_Integer,
- const Standard_Boolean );
- Standard_Boolean GetVisibility( const Standard_Integer ) const;
- const Standard_GUID& ID() const;
- void Restore( const Handle(TDF_Attribute)& theWith );
- Handle(TDF_Attribute) NewEmpty() const;
- void Paste( const Handle(TDF_Attribute)& theInto,
- const Handle(TDF_RelocationTable)& ) const;
- virtual Standard_OStream& Dump( Standard_OStream& anOS ) const;
-
- void SetVisibility( const TColStd_DataMapOfIntegerInteger& );
-
- const TColStd_DataMapOfIntegerInteger& GetVisibility();
-
-private:
- TColStd_DataMapOfIntegerInteger myVisibility;
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDS_GraphicAttribute )
-};
-
-#endif
+++ /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
---
--- File : SALOMEDS_IORAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class IORAttribute from SALOMEDS inherits Comment from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- ExtendedString from TCollection,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF; string : ExtendedString from TCollection)
- ---Purpose: Find, or create a Comment attribute and set the string.
- -- the Comment attribute is returned.
- returns IORAttribute from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable IORAttribute from SALOMEDS;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end IORAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_IORAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include <TDataStd_Comment.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-#include "SALOMEDS_IORAttribute.ixx"
-#include "SALOMEDS_Study_i.hxx"
-
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_IORAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_IORAttributeID ("92888E01-7074-11d5-A690-0800369C8A03");
- return SALOMEDS_IORAttributeID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_IORAttribute) SALOMEDS_IORAttribute::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S,
- SALOMEDS_Study_i* theStudy)
-{
- Handle(SALOMEDS_IORAttribute) A;
- if (!L.FindAttribute(SALOMEDS_IORAttribute::GetID(),A)) {
- A = new SALOMEDS_IORAttribute();
- L.AddAttribute(A);
- }
-
- (Handle(TDataStd_Comment)::DownCast(A))->Set (S);
- theStudy->IORUpdated(A);
- return A;
-}
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_IORAttribute::SALOMEDS_IORAttribute()
-{}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_IORAttribute::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_IORAttribute::NewEmpty () const
-{
- return new SALOMEDS_IORAttribute();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_IORAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get ();
- TDataStd_Comment::Set(s);
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_IORAttribute::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
-{
- Handle(TDataStd_Comment)::DownCast (into)->Set (Get());
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_IORAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_IORAttribute_HeaderFile
-#define _SALOMEDS_IORAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_IORAttribute_HeaderFile
-#include "Handle_SALOMEDS_IORAttribute.hxx"
-#endif
-
-#ifndef _TDataStd_Comment_HeaderFile
-#include <TDataStd_Comment.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
-class Standard_GUID;
-class TDF_Label;
-class TCollection_ExtendedString;
-class TDF_Attribute;
-class TDF_RelocationTable;
-class SALOMEDS_Study_i;
-
-class SALOMEDS_IORAttribute : public TDataStd_Comment {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_IORAttribute Set(const TDF_Label& label,
- const TCollection_ExtendedString& string,
- SALOMEDS_Study_i* theStudy) ;
-Standard_EXPORT SALOMEDS_IORAttribute();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_IORAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_IORAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_IORAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_IORAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_IORAttribute::~SALOMEDS_IORAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_IORAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_IORAttribute",
- sizeof(SALOMEDS_IORAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_IORAttribute) Handle(SALOMEDS_IORAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_IORAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_IORAttribute))) {
- _anOtherObject = Handle(SALOMEDS_IORAttribute)((Handle(SALOMEDS_IORAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_IORAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_IORAttribute) ;
-}
-Standard_Boolean SALOMEDS_IORAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_IORAttribute) == AType || TDataStd_Comment::IsKind(AType));
-}
-Handle_SALOMEDS_IORAttribute::~Handle_SALOMEDS_IORAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_IORAttribute.jxx
-// Module : SALOME
-
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_IORAttribute_HeaderFile
-#include "SALOMEDS_IORAttribute.hxx"
-#endif
#include "SALOMEDS_IParameters.hxx"
#include <utilities.h>
-#include <TCollection_AsciiString.hxx>
-
using namespace std;
#define PT_INTEGER 0
vector<string> SALOMEDS_IParameters::parseValue(const string& value, const char separator, bool fromEnd)
{
- TCollection_AsciiString val((char*)value.c_str());
+ string val(value);
vector<string> v;
int pos;
- if(fromEnd) pos = val.SearchFromEnd(separator);
- else pos = val.Search(separator);
+ if(fromEnd) pos = val.rfind(separator);
+ else pos = val.find(separator);
if(pos < 0) {
v.push_back(value);
return v;
}
- TCollection_AsciiString part1, part2;
- part1 = val.SubString(1, pos-1);
- part2 = val.SubString(pos+1, val.Length());
- v.push_back(part1.ToCString());
- v.push_back(part2.ToCString());
+ string part1, part2;
+ part1 = val.substr(0, pos);
+ part2 = val.substr(pos+1, val.size());
+ v.push_back(part1);
+ v.push_back(part2);
return v;
}
+++ /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
---
---
--- File : SALOMEDS_LocalIDAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class LocalIDAttribute from SALOMEDS inherits Integer from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- ExtendedString from TCollection,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF; value : Integer from Standard)
- returns OpenedAttribute from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable OpenedAttribute from SALOMEDS;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end LocalIDAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_LocalIDAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_LocalIDAttribute.ixx"
-#include <TDataStd_Integer.hxx>
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_LocalIDAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_OpenedAttributeID ("12837196-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_OpenedAttributeID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_LocalIDAttribute) SALOMEDS_LocalIDAttribute::Set (const TDF_Label& L,
- const Standard_Integer value)
-{
- Handle(SALOMEDS_LocalIDAttribute) A;
- if (!L.FindAttribute(SALOMEDS_LocalIDAttribute::GetID(),A)) {
- A = new SALOMEDS_LocalIDAttribute();
- L.AddAttribute(A);
- }
-
- (Handle(TDataStd_Integer)::DownCast(A))->Set (value);
- return A;
-}
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_LocalIDAttribute::SALOMEDS_LocalIDAttribute()
-{
- TDataStd_Integer::Set(0);
-}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_LocalIDAttribute::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_LocalIDAttribute::NewEmpty () const
-{
- return new SALOMEDS_LocalIDAttribute();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_LocalIDAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get ();
- TDataStd_Integer::Set(s);
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_LocalIDAttribute::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
-{
- Handle(TDataStd_Integer)::DownCast (into)->Set (Get());
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_LocalIDAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_LocalIDAttribute_HeaderFile
-#define _SALOMEDS_LocalIDAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_LocalIDAttribute_HeaderFile
-#include <Handle_SALOMEDS_LocalIDAttribute.hxx>
-#endif
-
-#ifndef _TDataStd_Integer_HeaderFile
-#include <TDataStd_Integer.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class Standard_GUID;
-class TDF_Label;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_LocalIDAttribute : public TDataStd_Integer {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_LocalIDAttribute Set(const TDF_Label& label,const Standard_Integer value) ;
-Standard_EXPORT SALOMEDS_LocalIDAttribute();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_LocalIDAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_LocalIDAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_LocalIDAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_LocalIDAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_LocalIDAttribute::~SALOMEDS_LocalIDAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_LocalIDAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_LocalIDAttribute",
- sizeof(SALOMEDS_LocalIDAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_LocalIDAttribute) Handle(SALOMEDS_LocalIDAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_LocalIDAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_LocalIDAttribute))) {
- _anOtherObject = Handle(SALOMEDS_LocalIDAttribute)((Handle(SALOMEDS_LocalIDAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_LocalIDAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_LocalIDAttribute) ;
-}
-Standard_Boolean SALOMEDS_LocalIDAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_LocalIDAttribute) == AType || TDataStd_Integer::IsKind(AType));
-}
-Handle_SALOMEDS_LocalIDAttribute::~Handle_SALOMEDS_LocalIDAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_LocalIDAttribute.jxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_LocalIDAttribute_HeaderFile
-#include "SALOMEDS_LocalIDAttribute.hxx"
-#endif
+++ /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
---
--- File : SALOMEDS_OCAFApplication.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class OCAFApplication from SALOMEDS inherits Application from TDocStd
-
- ---Purpose:
-
-uses
- Label from TDF,
- SequenceOfExtendedString from TColStd,
- CString from Standard,
- Document from TDocStd
-
-
-is
-
- Create
- returns mutable OCAFApplication from SALOMEDS;
-
- Formats(me: mutable; Formats: out SequenceOfExtendedString from TColStd)
- is redefined;
-
- ResourcesName (me: mutable) returns CString from Standard;
-
-end OCAFApplication;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_OCAFApplication.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_OCAFApplication.ixx"
-using namespace std;
-
-//=======================================================================
-//function : SALOMEDS_OCAFApplication
-//purpose :
-//=======================================================================
-
-SALOMEDS_OCAFApplication::SALOMEDS_OCAFApplication()
-{
-}
-
-
-//=======================================================================
-//function : Formats
-//purpose :
-//=======================================================================
-
-void SALOMEDS_OCAFApplication::Formats(TColStd_SequenceOfExtendedString& Formats)
-{
- Formats.Append(TCollection_ExtendedString ("SALOME_STUDY"));
-}
-
-
-//=======================================================================
-//function : ResourcesName
-//purpose :
-//=======================================================================
-
-Standard_CString SALOMEDS_OCAFApplication::ResourcesName()
-{
- return Standard_CString ("SALOMEDS_Resources");
-}
-
-
-
-
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_OCAFApplication.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_OCAFApplication_HeaderFile
-#define _SALOMEDS_OCAFApplication_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_OCAFApplication_HeaderFile
-#include "Handle_SALOMEDS_OCAFApplication.hxx"
-#endif
-
-#ifndef _TDocStd_Application_HeaderFile
-#include <TDocStd_Application.hxx>
-#endif
-#ifndef _Standard_CString_HeaderFile
-#include <Standard_CString.hxx>
-#endif
-class TColStd_SequenceOfExtendedString;
-
-
-class SALOMEDS_OCAFApplication : public TDocStd_Application {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT SALOMEDS_OCAFApplication();
-Standard_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& Formats) ;
-Standard_EXPORT Standard_CString ResourcesName() ;
-Standard_EXPORT ~SALOMEDS_OCAFApplication();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_OCAFApplication_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_OCAFApplication.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_OCAFApplication.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_OCAFApplication::~SALOMEDS_OCAFApplication() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_OCAFApplication_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDocStd_Application);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDocStd_Application);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(CDF_Application);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(CDF_Application);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(CDM_Application);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(CDM_Application);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_OCAFApplication",
- sizeof(SALOMEDS_OCAFApplication),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_OCAFApplication) Handle(SALOMEDS_OCAFApplication)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_OCAFApplication) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_OCAFApplication))) {
- _anOtherObject = Handle(SALOMEDS_OCAFApplication)((Handle(SALOMEDS_OCAFApplication)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_OCAFApplication::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_OCAFApplication) ;
-}
-Standard_Boolean SALOMEDS_OCAFApplication::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_OCAFApplication) == AType || TDocStd_Application::IsKind(AType));
-}
-Handle_SALOMEDS_OCAFApplication::~Handle_SALOMEDS_OCAFApplication() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_OCAFApplication.jxx
-// Module : SALOME
-
-#ifndef _TColStd_SequenceOfExtendedString_HeaderFile
-#include <TColStd_SequenceOfExtendedString.hxx>
-#endif
-#ifndef _SALOMEDS_OCAFApplication_HeaderFile
-#include "SALOMEDS_OCAFApplication.hxx"
-#endif
+++ /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
---
---
--- File : SALOMEDS_OpenedAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class OpenedAttribute from SALOMEDS inherits Integer from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- ExtendedString from TCollection,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF; value : Integer from Standard)
- ---Purpose: Find, or create a Comment attribute and set the string.
- -- the Comment attribute is returned.
- returns OpenedAttribute from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable OpenedAttribute from SALOMEDS;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end OpenedAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_OpenedAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_OpenedAttribute.ixx"
-#include <TDataStd_Integer.hxx>
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_OpenedAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_OpenedAttributeID ("12837186-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_OpenedAttributeID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_OpenedAttribute) SALOMEDS_OpenedAttribute::Set (const TDF_Label& L,
- const Standard_Integer value)
-{
- Handle(SALOMEDS_OpenedAttribute) A;
- if (!L.FindAttribute(SALOMEDS_OpenedAttribute::GetID(),A)) {
- A = new SALOMEDS_OpenedAttribute();
- L.AddAttribute(A);
- }
-
- (Handle(TDataStd_Integer)::DownCast(A))->Set (value);
- return A;
-}
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_OpenedAttribute::SALOMEDS_OpenedAttribute()
-{
- TDataStd_Integer::Set(0);
-}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_OpenedAttribute::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_OpenedAttribute::NewEmpty () const
-{
- return new SALOMEDS_OpenedAttribute();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_OpenedAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get ();
- TDataStd_Integer::Set(s);
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_OpenedAttribute::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
-{
- Handle(TDataStd_Integer)::DownCast (into)->Set (Get());
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_OpenedAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_OpenedAttribute_HeaderFile
-#define _SALOMEDS_OpenedAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_OpenedAttribute_HeaderFile
-#include <Handle_SALOMEDS_OpenedAttribute.hxx>
-#endif
-
-#ifndef _TDataStd_Integer_HeaderFile
-#include <TDataStd_Integer.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class Standard_GUID;
-class TDF_Label;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_OpenedAttribute : public TDataStd_Integer {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_OpenedAttribute Set(const TDF_Label& label,const Standard_Integer value) ;
-Standard_EXPORT SALOMEDS_OpenedAttribute();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_OpenedAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_OpenedAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_OpenedAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_OpenedAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_OpenedAttribute::~SALOMEDS_OpenedAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_OpenedAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_OpenedAttribute",
- sizeof(SALOMEDS_OpenedAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_OpenedAttribute) Handle(SALOMEDS_OpenedAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_OpenedAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_OpenedAttribute))) {
- _anOtherObject = Handle(SALOMEDS_OpenedAttribute)((Handle(SALOMEDS_OpenedAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_OpenedAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_OpenedAttribute) ;
-}
-Standard_Boolean SALOMEDS_OpenedAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_OpenedAttribute) == AType || TDataStd_Integer::IsKind(AType));
-}
-Handle_SALOMEDS_OpenedAttribute::~Handle_SALOMEDS_OpenedAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_OpenedAttribute.jxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_OpenedAttribute_HeaderFile
-#include "SALOMEDS_OpenedAttribute.hxx"
-#endif
+++ /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
---
--- File : SALOMEDS_PersRefAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class PersRefAttribute from SALOMEDS inherits Comment from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- ExtendedString from TCollection,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF; string : ExtendedString from TCollection)
- ---Purpose: Find, or create a Comment attribute and set the string.
- -- the Comment attribute is returned.
- returns PersRefAttribute from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable PersRefAttribute from SALOMEDS;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end PersRefAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_PersRefAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_PersRefAttribute.ixx"
-#include <TDataStd_Comment.hxx>
-#include <TCollection_ExtendedString.hxx>
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_PersRefAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_PersRefAttributeID ("92888E06-7074-11d5-A690-0800369C8A03");
- return SALOMEDS_PersRefAttributeID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_PersRefAttribute) SALOMEDS_PersRefAttribute::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S)
-{
- Handle(SALOMEDS_PersRefAttribute) A;
- if (!L.FindAttribute(SALOMEDS_PersRefAttribute::GetID(),A)) {
- A = new SALOMEDS_PersRefAttribute();
- L.AddAttribute(A);
- }
-
- (Handle(TDataStd_Comment)::DownCast(A))->Set (S);
- return A;
-}
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_PersRefAttribute::SALOMEDS_PersRefAttribute()
-{}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_PersRefAttribute::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_PersRefAttribute::NewEmpty () const
-{
- return new SALOMEDS_PersRefAttribute();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_PersRefAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get ();
- TDataStd_Comment::Set(s);
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_PersRefAttribute::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
-{
- Handle(TDataStd_Comment)::DownCast (into)->Set (Get());
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_PersRefAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_PersRefAttribute_HeaderFile
-#define _SALOMEDS_PersRefAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_PersRefAttribute_HeaderFile
-#include <Handle_SALOMEDS_PersRefAttribute.hxx>
-#endif
-
-#ifndef _TDataStd_Comment_HeaderFile
-#include <TDataStd_Comment.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class Standard_GUID;
-class TDF_Label;
-class TCollection_ExtendedString;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_PersRefAttribute : public TDataStd_Comment {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_PersRefAttribute Set(const TDF_Label& label,const TCollection_ExtendedString& string) ;
-Standard_EXPORT SALOMEDS_PersRefAttribute();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_PersRefAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_PersRefAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_PersRefAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_PersRefAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_PersRefAttribute::~SALOMEDS_PersRefAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_PersRefAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_PersRefAttribute",
- sizeof(SALOMEDS_PersRefAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_PersRefAttribute) Handle(SALOMEDS_PersRefAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_PersRefAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_PersRefAttribute))) {
- _anOtherObject = Handle(SALOMEDS_PersRefAttribute)((Handle(SALOMEDS_PersRefAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_PersRefAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_PersRefAttribute) ;
-}
-Standard_Boolean SALOMEDS_PersRefAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_PersRefAttribute) == AType || TDataStd_Comment::IsKind(AType));
-}
-Handle_SALOMEDS_PersRefAttribute::~Handle_SALOMEDS_PersRefAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_PersRefAttribute.jxx
-// Module : SALOME
-
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_PersRefAttribute_HeaderFile
-#include "SALOMEDS_PersRefAttribute.hxx"
-#endif
+++ /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
---
--- File : SALOMEDS_PixMapAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class PixMapAttribute from SALOMEDS inherits Comment from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- ExtendedString from TCollection,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF; string : ExtendedString from TCollection)
- ---Purpose: Find, or create a Comment attribute and set the string.
- -- the Comment attribute is returned.
- returns PixMapAttribute from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable PixMapAttribute from SALOMEDS;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end PixMapAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_PixMapAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_PixMapAttribute.ixx"
-#include <TDataStd_Comment.hxx>
-#include <TCollection_ExtendedString.hxx>
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_PixMapAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_PixMapAttributeID ("12837187-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_PixMapAttributeID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_PixMapAttribute) SALOMEDS_PixMapAttribute::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S)
-{
- Handle(SALOMEDS_PixMapAttribute) A;
- if (!L.FindAttribute(SALOMEDS_PixMapAttribute::GetID(),A)) {
- A = new SALOMEDS_PixMapAttribute();
- L.AddAttribute(A);
- }
-
- (Handle(TDataStd_Comment)::DownCast(A))->Set (S);
- return A;
-}
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_PixMapAttribute::SALOMEDS_PixMapAttribute()
-{TDataStd_Comment::Set("None");}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_PixMapAttribute::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_PixMapAttribute::NewEmpty () const
-{
- return new SALOMEDS_PixMapAttribute();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_PixMapAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get ();
- TDataStd_Comment::Set(s);
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_PixMapAttribute::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
-{
- Handle(TDataStd_Comment)::DownCast (into)->Set (Get());
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_PixMapAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_PixMapAttribute_HeaderFile
-#define _SALOMEDS_PixMapAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_PixMapAttribute_HeaderFile
-#include <Handle_SALOMEDS_PixMapAttribute.hxx>
-#endif
-
-#ifndef _TDataStd_Comment_HeaderFile
-#include <TDataStd_Comment.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class Standard_GUID;
-class TDF_Label;
-class TCollection_ExtendedString;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_PixMapAttribute : public TDataStd_Comment {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_PixMapAttribute Set(const TDF_Label& label,const TCollection_ExtendedString& string) ;
-Standard_EXPORT SALOMEDS_PixMapAttribute();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_PixMapAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_PixMapAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_PixMapAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_PixMapAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_PixMapAttribute::~SALOMEDS_PixMapAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_PixMapAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_PixMapAttribute",
- sizeof(SALOMEDS_PixMapAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_PixMapAttribute) Handle(SALOMEDS_PixMapAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_PixMapAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_PixMapAttribute))) {
- _anOtherObject = Handle(SALOMEDS_PixMapAttribute)((Handle(SALOMEDS_PixMapAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_PixMapAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_PixMapAttribute) ;
-}
-Standard_Boolean SALOMEDS_PixMapAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_PixMapAttribute) == AType || TDataStd_Comment::IsKind(AType));
-}
-Handle_SALOMEDS_PixMapAttribute::~Handle_SALOMEDS_PixMapAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_PixMapAttribute.jxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_PixMapAttribute_HeaderFile
-#include "SALOMEDS_PixMapAttribute.hxx"
-#endif
+++ /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
---
---
---
--- File : SALOMEDS_PythonObjectAttribute.cdl
--- Author : Michael Ponikarov
--- Module : SALOME
-
-class PythonObjectAttribute from SALOMEDS inherits Attribute from TDF
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- DataSet from TDF,
- RelocationTable from TDF,
- Data from TDF,
- HArray1OfCharacter from TColStd
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF)
- returns PythonObjectAttribute from SALOMEDS;
-
- ---Purpose: Common methods
- -- ============
-
- Create
- returns mutable PythonObjectAttribute from SALOMEDS;
-
- SetObject(me: mutable; theSequence : CString from Standard; theScript : Boolean from Standard);
-
- GetObject(me) returns CString from Standard;
-
- IsScript(me) returns Boolean from Standard;
-
- GetLength(me) returns Integer from Standard;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-fields
-
- mySequence : CString from Standard;
- myIsScript : Boolean from Standard;
-
-end PythonObjectAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_PythonObjectAttribute.cxx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_PythonObjectAttribute.ixx"
-#include <string>
-using namespace std;
-
-const Standard_GUID& SALOMEDS_PythonObjectAttribute::GetID()
-{
- static Standard_GUID SALOMEDS_PythonObjectAttributeID ("128371A3-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_PythonObjectAttributeID;
-}
-
-Handle(SALOMEDS_PythonObjectAttribute) SALOMEDS_PythonObjectAttribute::Set(const TDF_Label& label)
-{
- Handle(SALOMEDS_PythonObjectAttribute) anAttr;
- if (!label.FindAttribute(SALOMEDS_PythonObjectAttribute::GetID(),anAttr)) {
- anAttr = new SALOMEDS_PythonObjectAttribute();
- label.AddAttribute(anAttr);
- }
- return anAttr;
-}
-
-SALOMEDS_PythonObjectAttribute::SALOMEDS_PythonObjectAttribute()
-{
-}
-
-void SALOMEDS_PythonObjectAttribute::SetObject(const Standard_CString theSequence,
- const Standard_Boolean theScript)
-{
- Backup();
- if(mySequence != NULL) delete mySequence;
- if (theSequence == NULL) {
- mySequence = NULL;
- } else {
- mySequence = new char[strlen(theSequence)+1];
- strcpy(mySequence, theSequence);
- }
-
- myIsScript = theScript;
-}
-
-Standard_CString SALOMEDS_PythonObjectAttribute::GetObject() const
-{
- return mySequence;
-}
-
-Standard_Boolean SALOMEDS_PythonObjectAttribute::IsScript() const
-{
- return myIsScript;
-}
-
-Standard_Integer SALOMEDS_PythonObjectAttribute::GetLength() const
-{
- if (mySequence == NULL) return 0;
- return (strlen(mySequence)+1);
-}
-
-const Standard_GUID& SALOMEDS_PythonObjectAttribute::ID() const
-{
- return GetID();
-}
-
-void SALOMEDS_PythonObjectAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Handle(SALOMEDS_PythonObjectAttribute) anObj = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(with);
- SetObject(anObj->GetObject(),anObj->IsScript());
-}
-
-Handle(TDF_Attribute) SALOMEDS_PythonObjectAttribute::NewEmpty() const
-{
- return new SALOMEDS_PythonObjectAttribute();
-}
-
-void SALOMEDS_PythonObjectAttribute::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
-{
- Handle(SALOMEDS_PythonObjectAttribute) anObj = Handle(SALOMEDS_PythonObjectAttribute)::DownCast(into);
- anObj->SetObject(GetObject(),IsScript());
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_PythonObjectAttribute.hxx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_PythonObjectAttribute_HeaderFile
-#define _SALOMEDS_PythonObjectAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_PythonObjectAttribute_HeaderFile
-#include <Handle_SALOMEDS_PythonObjectAttribute.hxx>
-#endif
-
-#ifndef _Handle_TColStd_HArray1OfCharacter_HeaderFile
-#include <Handle_TColStd_HArray1OfCharacter.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Standard_CString_HeaderFile
-#include <Standard_CString.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class TColStd_HArray1OfCharacter;
-class Standard_GUID;
-class TDF_Label;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_PythonObjectAttribute : public TDF_Attribute {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_PythonObjectAttribute Set(const TDF_Label& label) ;
-Standard_EXPORT SALOMEDS_PythonObjectAttribute();
-Standard_EXPORT void SetObject(const Standard_CString theSequence,const Standard_Boolean theScript) ;
-Standard_EXPORT Standard_CString GetObject() const;
-Standard_EXPORT Standard_Boolean IsScript() const;
-Standard_EXPORT Standard_Integer GetLength() const;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_PythonObjectAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_PythonObjectAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Standard_CString mySequence;
-Standard_Boolean myIsScript;
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_PythonObjectAttribute.ixx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_PythonObjectAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_PythonObjectAttribute::~SALOMEDS_PythonObjectAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_PythonObjectAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_PythonObjectAttribute",
- sizeof(SALOMEDS_PythonObjectAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_PythonObjectAttribute) Handle(SALOMEDS_PythonObjectAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_PythonObjectAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_PythonObjectAttribute))) {
- _anOtherObject = Handle(SALOMEDS_PythonObjectAttribute)((Handle(SALOMEDS_PythonObjectAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_PythonObjectAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_PythonObjectAttribute) ;
-}
-Standard_Boolean SALOMEDS_PythonObjectAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_PythonObjectAttribute) == AType || TDF_Attribute::IsKind(AType));
-}
-Handle_SALOMEDS_PythonObjectAttribute::~Handle_SALOMEDS_PythonObjectAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_PythonObjectAttribute.jxx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#ifndef _TColStd_HArray1OfCharacter_HeaderFile
-#include <TColStd_HArray1OfCharacter.hxx>
-#endif
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_PythonObjectAttribute_HeaderFile
-#include "SALOMEDS_PythonObjectAttribute.hxx"
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SAttribute_i.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef __SALOMEDS_SATTRIBUTE_I_H__
-#define __SALOMEDS_SATTRIBUTE_I_H__
-
-// std C++ headers
-#include <iostream>
-
-// IDL headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
-
-
-// Cascade headers
-#include <TDocStd_Document.hxx>
-#include <stdio.h>
-
-class SALOMEDS_SAttribute_i: public POA_IStudy::SAttribute,
- public PortableServer::ServantBase {
-private:
- CORBA::ORB_ptr _orb;
- char* _Type;
- char
-public:
-
- SALOMEDS_SAttribute_i(const Handle(TDocStd_Document), CORBA::ORB_ptr);
-
- ~SALOMEDS_SAttribute_i();
-
- virtual char* GetID() ;
- virtual SObject_ptr GetOwner();
- virtual char* GetType();
- virtual char* GetValue();
-
-};
-#endif
#include "SALOMEDS_SComponent_i.hxx"
#include <string>
-#include <TCollection_AsciiString.hxx>
using namespace std;
:SALOMEDS_SObject(theSComponent)
{}
-SALOMEDS_SComponent::SALOMEDS_SComponent(const Handle(SALOMEDSImpl_SComponent)& theSComponent)
+SALOMEDS_SComponent::SALOMEDS_SComponent(const SALOMEDSImpl_SComponent& theSComponent)
:SALOMEDS_SObject(theSComponent)
{}
std::string aType;
if (_isLocal) {
SALOMEDS::Locker lock;
- aType = (Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()))->ComponentDataType().ToCString();
+ aType = (dynamic_cast<SALOMEDSImpl_SComponent*>(GetLocalImpl()))->ComponentDataType();
}
else aType = (SALOMEDS::SComponent::_narrow(GetCORBAImpl()))->ComponentDataType();
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- TCollection_AsciiString anIOR;
- ret = (Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()))->ComponentIOR(anIOR);
- theID = anIOR.ToCString();
+ ret = (dynamic_cast<SALOMEDSImpl_SComponent*>(GetLocalImpl()))->ComponentIOR(theID);
}
else {
CORBA::String_var anIOR;
{
if(_isLocal) {
if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SComponent::_duplicate(SALOMEDS::SComponent::_narrow(GetCORBAImpl()));
- SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(Handle(SALOMEDSImpl_SComponent)::DownCast(GetLocalImpl()), _orb);
+ SALOMEDS::SComponent_var aSCO = SALOMEDS_SComponent_i::New(*(dynamic_cast<SALOMEDSImpl_SComponent*>(GetLocalImpl())), _orb);
_corba_impl = SALOMEDS::SComponent::_duplicate(aSCO);
return aSCO._retn();
}
{
public:
- SALOMEDS_SComponent(const Handle(SALOMEDSImpl_SComponent)& theSComponent);
+ SALOMEDS_SComponent(const SALOMEDSImpl_SComponent& theSComponent);
SALOMEDS_SComponent(SALOMEDS::SComponent_ptr theSComponent);
~SALOMEDS_SComponent();
#include "SALOMEDSImpl_SComponent.hxx"
SALOMEDS_SComponentIterator::SALOMEDS_SComponentIterator(const SALOMEDSImpl_SComponentIterator& theIterator)
-:_local_impl(theIterator)
+:_local_impl(theIterator.GetPersistentCopy())
{
_isLocal = true;
_corba_impl = SALOMEDS::SComponentIterator::_nil();
SALOMEDS_SComponentIterator::~SALOMEDS_SComponentIterator()
{
if(!_isLocal) _corba_impl->Destroy();
+ else if(_local_impl) delete _local_impl;
}
void SALOMEDS_SComponentIterator::Init()
{
if (_isLocal) {
SALOMEDS::Locker lock;
- _local_impl.Init();
+ _local_impl->Init();
}
else _corba_impl->Init();
}
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = _local_impl.More();
+ ret = _local_impl->More();
}
else ret = _corba_impl->More();
return ret;
{
if (_isLocal) {
SALOMEDS::Locker lock;
- _local_impl.Next();
+ _local_impl->Next();
}
else _corba_impl->Next();
}
SALOMEDSClient_SComponent* aSCO = NULL;
if (_isLocal) {
SALOMEDS::Locker lock;
- aSCO = new SALOMEDS_SComponent(_local_impl.Value());
+ aSCO = new SALOMEDS_SComponent(_local_impl->Value());
}
else aSCO = new SALOMEDS_SComponent(_corba_impl->Value());
return _PTR(SComponent)(aSCO);
private:
bool _isLocal;
- SALOMEDSImpl_SComponentIterator _local_impl;
+ SALOMEDSImpl_SComponentIterator* _local_impl;
SALOMEDS::SComponentIterator_var _corba_impl;
public:
SALOMEDS_SComponentIterator_i::SALOMEDS_SComponentIterator_i(const SALOMEDSImpl_SComponentIterator& theImpl,
CORBA::ORB_ptr orb)
-:_impl(theImpl)
{
_orb = CORBA::ORB::_duplicate(orb);
+ _impl = theImpl.GetPersistentCopy();
}
//============================================================================
//============================================================================
SALOMEDS_SComponentIterator_i::~SALOMEDS_SComponentIterator_i()
{
+ if(_impl) delete _impl;
}
//============================================================================
void SALOMEDS_SComponentIterator_i::Init()
{
SALOMEDS::Locker lock;
- _impl.Init();
+ _impl->Init();
}
//============================================================================
CORBA::Boolean SALOMEDS_SComponentIterator_i::More()
{
SALOMEDS::Locker lock;
- return _impl.More();
+ return _impl->More();
}
//============================================================================
void SALOMEDS_SComponentIterator_i::Next()
{
SALOMEDS::Locker lock;
- _impl.Next();
+ _impl->Next();
}
SALOMEDS::SComponent_ptr SALOMEDS_SComponentIterator_i::Value()
{
SALOMEDS::Locker lock;
- SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (_impl.Value(), _orb);
+ SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (_impl->Value(), _orb);
return sco._retn();
}
private:
- CORBA::ORB_ptr _orb;
- SALOMEDSImpl_SComponentIterator _impl;
+ CORBA::ORB_ptr _orb;
+ SALOMEDSImpl_SComponentIterator* _impl;
public:
using namespace std;
-SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const Handle(SALOMEDSImpl_SComponent)& theImpl, CORBA::ORB_ptr theORB)
+SALOMEDS::SComponent_ptr SALOMEDS_SComponent_i::New(const SALOMEDSImpl_SComponent& theImpl, CORBA::ORB_ptr theORB)
{
-/*
- static std::map<SALOMEDSImpl_SComponent*, SALOMEDS_SComponent_i*> _mapOfSCO;
- SALOMEDS::SComponent_var sco;
- SALOMEDS_SComponent_i* sco_servant = NULL;
-
- if(_mapOfSCO.find(theImpl.operator->()) != _mapOfSCO.end()) {
- sco_servant = _mapOfSCO[theImpl.operator->()];
- }
- else {
- sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB);
- _mapOfSCO[theImpl.operator->()] = sco_servant;
- }
-
- sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this());
-*/
SALOMEDS_SComponent_i* sco_servant = new SALOMEDS_SComponent_i(theImpl, theORB);
SALOMEDS::SComponent_var sco = SALOMEDS::SComponent::_narrow(sco_servant->SComponent::_this());
* Purpose :
*/
//============================================================================
-SALOMEDS_SComponent_i::SALOMEDS_SComponent_i(const Handle(SALOMEDSImpl_SComponent)& theImpl, CORBA::ORB_ptr orb)
+SALOMEDS_SComponent_i::SALOMEDS_SComponent_i(const SALOMEDSImpl_SComponent& theImpl, CORBA::ORB_ptr orb)
:SALOMEDS_SObject_i(theImpl, orb)
{}
char* SALOMEDS_SComponent_i::ComponentDataType()
{
SALOMEDS::Locker lock;
- TCollection_AsciiString aType = Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentDataType();
- return CORBA::string_dup(aType.ToCString());
+ string aType = dynamic_cast<SALOMEDSImpl_SComponent*>(_impl)->ComponentDataType();
+ return CORBA::string_dup(aType.c_str());
}
CORBA::Boolean SALOMEDS_SComponent_i::ComponentIOR(CORBA::String_out IOR)
{
SALOMEDS::Locker lock;
- TCollection_AsciiString ior;
- if(!Handle(SALOMEDSImpl_SComponent)::DownCast(_impl)->ComponentIOR(ior)) {
+ string ior;
+ if(!dynamic_cast<SALOMEDSImpl_SComponent*>(_impl)->ComponentIOR(ior)) {
IOR = CORBA::string_dup("");
return false;
}
- IOR = CORBA::string_dup(ior.ToCString());
+ IOR = CORBA::string_dup(ior.c_str());
return true;
}
public:
- static SALOMEDS::SComponent_ptr New(const Handle(SALOMEDSImpl_SComponent)&, CORBA::ORB_ptr);
+ static SALOMEDS::SComponent_ptr New(const SALOMEDSImpl_SComponent&, CORBA::ORB_ptr);
- SALOMEDS_SComponent_i(const Handle(SALOMEDSImpl_SComponent)&, CORBA::ORB_ptr);
+ SALOMEDS_SComponent_i(const SALOMEDSImpl_SComponent&, CORBA::ORB_ptr);
virtual ~SALOMEDS_SComponent_i();
// Module : SALOME
#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
#include "SALOMEDS_SObject.hxx"
init_orb();
}
-SALOMEDS_SObject::SALOMEDS_SObject(const Handle(SALOMEDSImpl_SObject)& theSObject)
+SALOMEDS_SObject::SALOMEDS_SObject(const SALOMEDSImpl_SObject& theSObject)
:_isLocal(true)
{
_corba_impl = SALOMEDS::SObject::_nil();
- _local_impl = theSObject;
+
+ if(theSObject.IsComponent()) {
+ SALOMEDSImpl_SComponent sco = theSObject;
+ _local_impl = sco.GetPersistentCopy();
+ }
+ else {
+ _local_impl = theSObject.GetPersistentCopy();
+ }
init_orb();
}
if (!_isLocal) {
_corba_impl->Destroy();
}
+ else {
+ if(_local_impl) delete _local_impl;
+ }
}
std::string SALOMEDS_SObject::GetID()
std::string aValue;
if (_isLocal) {
SALOMEDS::Locker lock;
- aValue = _local_impl->GetID().ToCString();
+ aValue = _local_impl->GetID();
}
else aValue = _corba_impl->GetID();
return aValue;
{
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SComponent) aSCO =
- Handle(SALOMEDSImpl_SComponent)::DownCast(_local_impl->GetFatherComponent());
- return _PTR(SComponent)(new SALOMEDS_SComponent(aSCO));
+ return _PTR(SComponent)(new SALOMEDS_SComponent(_local_impl->GetFatherComponent()));
}
return _PTR(SComponent)(new SALOMEDS_SComponent(_corba_impl->GetFatherComponent()));
}
bool ret = false;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_GenericAttribute) anAttr;
- ret = _local_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute.c_str());
- if(ret) anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(anAttr));
+ DF_Attribute* anAttr = NULL;
+ ret = _local_impl->FindAttribute(anAttr, aTypeOfAttribute);
+ if(ret) {
+ SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(anAttr);
+ anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(ga));
+ }
}
else {
SALOMEDS::GenericAttribute_var anAttr;
bool ret = false;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO;
+ SALOMEDSImpl_SObject aSO;
ret = _local_impl->ReferencedObject(aSO);
if(ret) theObject = _PTR(SObject)(new SALOMEDS_SObject(aSO));
}
bool ret = false;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO;
+ SALOMEDSImpl_SObject aSO;
ret = _local_impl->FindSubObject(theTag, aSO);
if(ret) theObject = _PTR(SObject)(new SALOMEDS_SObject(aSO));
}
std::string aName;
if (_isLocal) {
SALOMEDS::Locker lock;
- aName = _local_impl->Name().ToCString();
+ aName = _local_impl->Name();
}
else aName = _corba_impl->Name();
{
if (_isLocal) {
SALOMEDS::Locker lock;
- _local_impl->Name((char*)theName.c_str());
+ _local_impl->Name(theName);
}
else _corba_impl->Name(theName.c_str());
}
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->GetAllAttributes();
- aLength = aSeq->Length();
- for (int i = 1; i <= aLength; i++) {
- anAttr = SALOMEDS_GenericAttribute::CreateAttribute
- (Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i)));
+ vector<DF_Attribute*> aSeq = _local_impl->GetAllAttributes();
+ aLength = aSeq.size();
+ for (int i = 0; i < aLength; i++) {
+ anAttr = SALOMEDS_GenericAttribute::CreateAttribute(dynamic_cast<SALOMEDSImpl_GenericAttribute*>(aSeq[i]));
aVector.push_back(_PTR(GenericAttribute)(anAttr));
}
}
std::string aName;
if (_isLocal) {
SALOMEDS::Locker lock;
- aName = _local_impl->GetName().ToCString();
+ aName = _local_impl->GetName();
}
else aName = _corba_impl->GetName();
std::string aComment;
if (_isLocal) {
SALOMEDS::Locker lock;
- aComment = _local_impl->GetComment().ToCString();
+ aComment = _local_impl->GetComment();
}
else aComment = _corba_impl->GetComment();
std::string anIOR;
if (_isLocal) {
SALOMEDS::Locker lock;
- anIOR = _local_impl->GetIOR().ToCString();
+ anIOR = _local_impl->GetIOR();
}
else anIOR = _corba_impl->GetIOR();
{
if(_isLocal) {
if(!CORBA::is_nil(_corba_impl)) return SALOMEDS::SObject::_duplicate(_corba_impl);
- SALOMEDS::SObject_var aSO = SALOMEDS_SObject_i::New(_local_impl, _orb);
+ SALOMEDS::SObject_var aSO = SALOMEDS_SObject_i::New(*_local_impl, _orb);
_corba_impl = SALOMEDS::SObject::_duplicate(aSO);
return aSO._retn();
}
protected:
bool _isLocal;
- Handle(SALOMEDSImpl_SObject) _local_impl;
+ SALOMEDSImpl_SObject* _local_impl;
SALOMEDS::SObject_var _corba_impl;
CORBA::ORB_var _orb;
public:
SALOMEDS_SObject(SALOMEDS::SObject_ptr theSObject);
- SALOMEDS_SObject(const Handle(SALOMEDSImpl_SObject)& theSObject);
+ SALOMEDS_SObject(const SALOMEDSImpl_SObject& theSObject);
virtual ~SALOMEDS_SObject();
virtual std::string GetID();
virtual _PTR(Study) GetStudy();
virtual std::string Name();
virtual void Name(const std::string& theName);
- virtual vector<_PTR(GenericAttribute)> GetAllAttributes();
+ virtual std::vector<_PTR(GenericAttribute)> GetAllAttributes();
virtual std::string GetName();
virtual std::string GetComment();
virtual std::string GetIOR();
SALOMEDS::SObject_ptr GetSObject();
SALOMEDS::SObject_ptr GetCORBAImpl() { return SALOMEDS::SObject::_duplicate(_corba_impl); }
- Handle(SALOMEDSImpl_SObject) GetLocalImpl() { return _local_impl; }
+ SALOMEDSImpl_SObject* GetLocalImpl() { return _local_impl; }
private:
void init_orb();
#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDSImpl_AttributeIOR.hxx"
-// OCC Headers
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
#include <map>
#ifdef WIN32
using namespace std;
-SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const Handle(SALOMEDSImpl_SObject)& theImpl, CORBA::ORB_ptr theORB)
+SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const SALOMEDSImpl_SObject& theImpl, CORBA::ORB_ptr theORB)
{
SALOMEDS_SObject_i* so_servant = new SALOMEDS_SObject_i(theImpl, theORB);
SALOMEDS::SObject_var so = SALOMEDS::SObject::_narrow(so_servant->_this());
* Purpose :
*/
//============================================================================
-SALOMEDS_SObject_i::SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)& impl, CORBA::ORB_ptr orb)
- : _impl(impl)
+SALOMEDS_SObject_i::SALOMEDS_SObject_i(const SALOMEDSImpl_SObject& impl, CORBA::ORB_ptr orb)
{
+ if(!impl.IsNull()) {
+ if(impl.IsComponent()) {
+ SALOMEDSImpl_SComponent sco = impl;
+ _impl = sco.GetPersistentCopy();
+ }
+ else {
+ _impl = impl.GetPersistentCopy();
+ }
+ }
_orb = CORBA::ORB::_duplicate(orb);
//SALOME::GenericObj_i::myPOA = SALOMEDS_StudyManager_i::GetPOA(GetStudy());
}
*/
//============================================================================
SALOMEDS_SObject_i::~SALOMEDS_SObject_i()
-{}
+{
+ if(_impl) delete _impl;
+}
//============================================================================
char* SALOMEDS_SObject_i::GetID()
{
SALOMEDS::Locker lock;
- return CORBA::string_dup(_impl->GetID().ToCString());
+ return CORBA::string_dup(_impl->GetID().c_str());
}
//============================================================================
SALOMEDS::Study_ptr SALOMEDS_SObject_i::GetStudy()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_Study) aStudy = _impl->GetStudy();
- if(aStudy.IsNull()) {
+ SALOMEDSImpl_Study* aStudy = _impl->GetStudy();
+ if(!aStudy) {
MESSAGE("Problem GetStudy");
return SALOMEDS::Study::_nil();
}
- TCollection_AsciiString IOR = aStudy->GetTransientReference();
- CORBA::Object_var obj = _orb->string_to_object(IOR.ToCString());
+ string IOR = aStudy->GetTransientReference();
+ CORBA::Object_var obj = _orb->string_to_object(IOR.c_str());
SALOMEDS::Study_var Study = SALOMEDS::Study::_narrow(obj) ;
ASSERT(!CORBA::is_nil(Study));
return SALOMEDS::Study::_duplicate(Study);
const char* aTypeOfAttribute)
{
SALOMEDS::Locker lock;
- Handle(TDF_Attribute) anAttr;
+ DF_Attribute* anAttr = NULL;
if(_impl->FindAttribute(anAttr, (char*)aTypeOfAttribute)) {
anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
- return Standard_True;
+ return true;
}
- return Standard_False;
+ return false;
}
//============================================================================
SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes()
{
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfTransient) aSeq = _impl->GetAllAttributes();
+ vector<DF_Attribute*> aSeq = _impl->GetAllAttributes();
SALOMEDS::ListOfAttributes_var SeqOfAttr = new SALOMEDS::ListOfAttributes;
- Standard_Integer length = aSeq->Length();
+ int length = aSeq.size();
SeqOfAttr->length(length);
if (length != 0) {
- for(int i = 1; i<= length; i++) {
- Handle(SALOMEDSImpl_GenericAttribute) anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i));
+ for(int i = 0; i < length; i++) {
+ SALOMEDSImpl_GenericAttribute* anAttr = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(aSeq[i]);
SALOMEDS::GenericAttribute_var anAttribute;
anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
if (!CORBA::is_nil(anAttribute)) {
- SeqOfAttr[i - 1] = anAttribute;
+ SeqOfAttr[i] = anAttribute;
}
}
}
CORBA::Boolean SALOMEDS_SObject_i::ReferencedObject(SALOMEDS::SObject_out obj)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aRefObj;
+ SALOMEDSImpl_SObject aRefObj;
if(!_impl->ReferencedObject(aRefObj)) return false;
obj = SALOMEDS_SObject_i::New (aRefObj, _orb);
CORBA::Boolean SALOMEDS_SObject_i::FindSubObject(CORBA::Long atag, SALOMEDS::SObject_out obj)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSubObj;
+ SALOMEDSImpl_SObject aSubObj;
if(!_impl->FindSubObject(atag, aSubObj)) return false;
obj = SALOMEDS_SObject_i::New (aSubObj, _orb);
char* SALOMEDS_SObject_i::Name()
{
SALOMEDS::Locker lock;
- return CORBA::string_dup(_impl->Name().ToCString());
+ return CORBA::string_dup(_impl->Name().c_str());
}
//============================================================================
void SALOMEDS_SObject_i::Name(const char* name)
{
SALOMEDS::Locker lock;
- TCollection_AsciiString aName((char*)name);
+ string aName((char*)name);
_impl->Name(aName);
}
SALOMEDS::Locker lock;
CORBA::Object_ptr obj = CORBA::Object::_nil();
try {
- TCollection_AsciiString IOR = _impl->GetIOR();
- char* c_ior = CORBA::string_dup(IOR.ToCString());
+ string IOR = _impl->GetIOR();
+ char* c_ior = CORBA::string_dup(IOR.c_str());
obj = _orb->string_to_object(c_ior);
CORBA::string_free(c_ior);
} catch(...) {}
char* SALOMEDS_SObject_i::GetName()
{
SALOMEDS::Locker lock;
- CORBA::String_var aStr = CORBA::string_dup(_impl->GetName().ToCString());
+ CORBA::String_var aStr = CORBA::string_dup(_impl->GetName().c_str());
return aStr._retn();
}
char* SALOMEDS_SObject_i::GetComment()
{
SALOMEDS::Locker lock;
- CORBA::String_var aStr = CORBA::string_dup(_impl->GetComment().ToCString());
+ CORBA::String_var aStr = CORBA::string_dup(_impl->GetComment().c_str());
return aStr._retn();
}
char* SALOMEDS_SObject_i::GetIOR()
{
SALOMEDS::Locker lock;
- CORBA::String_var aStr = CORBA::string_dup(_impl->GetIOR().ToCString());
+ CORBA::String_var aStr = CORBA::string_dup(_impl->GetIOR().c_str());
return aStr._retn();
}
long pid = (long)getpid();
#endif
isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
- SALOMEDSImpl_SObject* local_impl = _impl.operator->();
- return ((CORBA::LongLong)local_impl);
+ return ((CORBA::LongLong)(void*)_impl);
}
public virtual SALOME::GenericObj_i
{
protected:
- CORBA::ORB_ptr _orb;
- Handle(SALOMEDSImpl_SObject) _impl;
+ CORBA::ORB_ptr _orb;
+ SALOMEDSImpl_SObject* _impl;
public:
- static SALOMEDS::SObject_ptr New(const Handle(SALOMEDSImpl_SObject)&, CORBA::ORB_ptr);
+ static SALOMEDS::SObject_ptr New(const SALOMEDSImpl_SObject&, CORBA::ORB_ptr);
- SALOMEDS_SObject_i(const Handle(SALOMEDSImpl_SObject)&, CORBA::ORB_ptr);
+ SALOMEDS_SObject_i(const SALOMEDSImpl_SObject&, CORBA::ORB_ptr);
virtual ~SALOMEDS_SObject_i();
+++ /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
---
---
--- File : SALOMEDS_SelectableAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class SelectableAttribute from SALOMEDS inherits Integer from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- ExtendedString from TCollection,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF; value : Integer from Standard)
- ---Purpose: Find, or create a Comment attribute and set the string.
- -- the Comment attribute is returned.
- returns SelectableAttribute from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable SelectableAttribute from SALOMEDS;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end SelectableAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SelectableAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_SelectableAttribute.ixx"
-#include <TDataStd_Integer.hxx>
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_SelectableAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_SelectableAttributeID ("12837188-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_SelectableAttributeID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_SelectableAttribute) SALOMEDS_SelectableAttribute::Set (const TDF_Label& L,
- const Standard_Integer value)
-{
- Handle(SALOMEDS_SelectableAttribute) A;
- if (!L.FindAttribute(SALOMEDS_SelectableAttribute::GetID(),A)) {
- A = new SALOMEDS_SelectableAttribute();
- L.AddAttribute(A);
- }
-
- (Handle(TDataStd_Integer)::DownCast(A))->Set (value);
- return A;
-}
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_SelectableAttribute::SALOMEDS_SelectableAttribute()
-{
- TDataStd_Integer::Set(0);
-}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_SelectableAttribute::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_SelectableAttribute::NewEmpty () const
-{
- return new SALOMEDS_SelectableAttribute();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_SelectableAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Standard_Integer s = Handle(TDataStd_Integer)::DownCast (with)->Get ();
- TDataStd_Integer::Set(s);
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_SelectableAttribute::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
-{
- Handle(TDataStd_Integer)::DownCast (into)->Set (Get());
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SelectableAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_SelectableAttribute_HeaderFile
-#define _SALOMEDS_SelectableAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_SelectableAttribute_HeaderFile
-#include <Handle_SALOMEDS_SelectableAttribute.hxx>
-#endif
-
-#ifndef _TDataStd_Integer_HeaderFile
-#include <TDataStd_Integer.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class Standard_GUID;
-class TDF_Label;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_SelectableAttribute : public TDataStd_Integer {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_SelectableAttribute Set(const TDF_Label& label,const Standard_Integer value) ;
-Standard_EXPORT SALOMEDS_SelectableAttribute();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_SelectableAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_SelectableAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SelectableAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_SelectableAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_SelectableAttribute::~SALOMEDS_SelectableAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_SelectableAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Integer);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Integer);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_SelectableAttribute",
- sizeof(SALOMEDS_SelectableAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_SelectableAttribute) Handle(SALOMEDS_SelectableAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_SelectableAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_SelectableAttribute))) {
- _anOtherObject = Handle(SALOMEDS_SelectableAttribute)((Handle(SALOMEDS_SelectableAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_SelectableAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_SelectableAttribute) ;
-}
-Standard_Boolean SALOMEDS_SelectableAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_SelectableAttribute) == AType || TDataStd_Integer::IsKind(AType));
-}
-Handle_SALOMEDS_SelectableAttribute::~Handle_SALOMEDS_SelectableAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SelectableAttribute.jxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_SelectableAttribute_HeaderFile
-#include "SALOMEDS_SelectableAttribute.hxx"
-#endif
+++ /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
---
---
--- File : SALOMEDS_SequenceOfIntegerAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class SequenceOfIntegerAttribute from SALOMEDS inherits Attribute from TDF
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- HSequenceOfInteger from TColStd,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF)
- ---Purpose: Find, or create a Comment attribute and set the string.
- -- the Comment attribute is returned.
- returns SequenceOfIntegerAttribute from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable SequenceOfIntegerAttribute from SALOMEDS;
-
- ---Category: IntegerArray methods
- -- ===============
-
- Assign(me : mutable; other : HSequenceOfInteger from TColStd);
- ---Purpose: Initialize the inner sequence by other one
-
- ChangeValue (me : mutable; Index, Value : Integer from Standard);
- ---Purpose: Sets the <Index>th element of the sequence to <Value>
-
- Add (me : mutable; value : Integer from Standard);
- ---Purpose: Add new value
-
- Value (me : mutable; Index : Integer from Standard) returns Integer;
- ---Purpose: Value of index
-
- Remove (me : mutable; Index : Integer from Standard);
- ---Purpose: Remove element on index <Index>
-
- Length (me : mutable) returns Integer;
- ---Purpose: Returns length of sequence
-
-
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-fields
-
- myValue : HSequenceOfInteger from TColStd;
-
-end SequenceOfIntegerAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SequenceOfIntegerAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_SequenceOfIntegerAttribute.ixx"
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_SequenceOfIntegerAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_SequenceOfIntegerAttributeID ("12837182-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_SequenceOfIntegerAttributeID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_SequenceOfIntegerAttribute) SALOMEDS_SequenceOfIntegerAttribute::Set (const TDF_Label& L)
-{
- Handle(SALOMEDS_SequenceOfIntegerAttribute) A;
- if (!L.FindAttribute(SALOMEDS_SequenceOfIntegerAttribute::GetID(),A)) {
- A = new SALOMEDS_SequenceOfIntegerAttribute();
- L.AddAttribute(A);
- }
- return A;
-}
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_SequenceOfIntegerAttribute::SALOMEDS_SequenceOfIntegerAttribute()
-{myValue = new TColStd_HSequenceOfInteger();}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_SequenceOfIntegerAttribute::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_SequenceOfIntegerAttribute::NewEmpty () const
-{
- return new SALOMEDS_SequenceOfIntegerAttribute();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_SequenceOfIntegerAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Standard_Integer i;
- Handle(SALOMEDS_SequenceOfIntegerAttribute) anSeq = Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(with);
- if(!anSeq->myValue.IsNull()) {
- myValue = new TColStd_HSequenceOfInteger();
- Standard_Integer Len = anSeq->Length();
- for(i = 1; i<=Len; i++) Add(anSeq->Value(i));
- }
- else
- myValue.Nullify();
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_SequenceOfIntegerAttribute::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& ) const
-{
- if(!myValue.IsNull()) {
- Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast (into)->Assign(myValue);
- }
-}
-
-void SALOMEDS_SequenceOfIntegerAttribute::Assign(const Handle(TColStd_HSequenceOfInteger)& other)
-{
- Backup();
- if (myValue.IsNull()) myValue = new TColStd_HSequenceOfInteger;
- myValue->ChangeSequence() = other->Sequence();
-}
-
-void SALOMEDS_SequenceOfIntegerAttribute::ChangeValue(const Standard_Integer Index,const Standard_Integer Value)
-{
- Backup();
- myValue->SetValue(Index, Value);
-}
-
-void SALOMEDS_SequenceOfIntegerAttribute::Add(const Standard_Integer Value)
-{
- Backup();
- myValue->Append(Value);
-}
-
-void SALOMEDS_SequenceOfIntegerAttribute::Remove(const Standard_Integer Index)
-{
- Backup();
- myValue->Remove(Index);
-}
-
-Standard_Integer SALOMEDS_SequenceOfIntegerAttribute::Length()
-{
- return myValue->Length();
-}
-Standard_Integer SALOMEDS_SequenceOfIntegerAttribute::Value(const Standard_Integer Index)
-{
- return myValue->Value(Index);
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SequenceOfIntegerAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_SequenceOfIntegerAttribute_HeaderFile
-#define _SALOMEDS_SequenceOfIntegerAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_SequenceOfIntegerAttribute_HeaderFile
-#include <Handle_SALOMEDS_SequenceOfIntegerAttribute.hxx>
-#endif
-
-#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile
-#include <Handle_TColStd_HSequenceOfInteger.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class TColStd_HSequenceOfInteger;
-class Standard_GUID;
-class TDF_Label;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_SequenceOfIntegerAttribute : public TDF_Attribute {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_SequenceOfIntegerAttribute Set(const TDF_Label& label) ;
-Standard_EXPORT SALOMEDS_SequenceOfIntegerAttribute();
-Standard_EXPORT void Assign(const Handle(TColStd_HSequenceOfInteger)& other) ;
-Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Integer Value) ;
-Standard_EXPORT void Add(const Standard_Integer value) ;
-Standard_EXPORT Standard_Integer Value(const Standard_Integer Index) ;
-Standard_EXPORT void Remove(const Standard_Integer Index) ;
-Standard_EXPORT Standard_Integer Length() ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_SequenceOfIntegerAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_SequenceOfIntegerAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Handle_TColStd_HSequenceOfInteger myValue;
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SequenceOfIntegerAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_SequenceOfIntegerAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_SequenceOfIntegerAttribute::~SALOMEDS_SequenceOfIntegerAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_SequenceOfIntegerAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_SequenceOfIntegerAttribute",
- sizeof(SALOMEDS_SequenceOfIntegerAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_SequenceOfIntegerAttribute) Handle(SALOMEDS_SequenceOfIntegerAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_SequenceOfIntegerAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute))) {
- _anOtherObject = Handle(SALOMEDS_SequenceOfIntegerAttribute)((Handle(SALOMEDS_SequenceOfIntegerAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_SequenceOfIntegerAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute) ;
-}
-Standard_Boolean SALOMEDS_SequenceOfIntegerAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_SequenceOfIntegerAttribute) == AType || TDF_Attribute::IsKind(AType));
-}
-Handle_SALOMEDS_SequenceOfIntegerAttribute::~Handle_SALOMEDS_SequenceOfIntegerAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SequenceOfIntegerAttribute.jxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _TColStd_HSequenceOfInteger_HeaderFile
-#include <TColStd_HSequenceOfInteger.hxx>
-#endif
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_SequenceOfIntegerAttribute_HeaderFile
-#include "SALOMEDS_SequenceOfIntegerAttribute.hxx"
-#endif
+++ /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
---
--- File : SALOMEDS_SequenceOfRealAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class SequenceOfRealAttribute from SALOMEDS inherits Attribute from TDF
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- HSequenceOfReal from TColStd,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF)
- ---Purpose: Find, or create a Comment attribute and set the string.
- -- the Comment attribute is returned.
- returns SequenceOfRealAttribute from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable SequenceOfRealAttribute from SALOMEDS;
-
- ---Category: IntegerArray methods
- -- ===============
-
- Assign(me : mutable; other : HSequenceOfReal from TColStd);
- ---Purpose: Initialize the inner sequence by other one
-
- ChangeValue (me : mutable; Index : Integer from Standard; Value : Real);
- ---Purpose: Sets the <Index>th element of the sequence to <Value>
-
- Add (me : mutable; Value : Real from Standard);
- ---Purpose: Add new value
-
- Value (me : mutable; Index : Integer from Standard) returns Real;
- ---Purpose: Value of index
-
- Remove (me : mutable; Index : Integer from Standard);
- ---Purpose: Remove element on index <Index>
-
- Length (me : mutable) returns Integer;
- ---Purpose: Returns length of sequence
-
-
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-fields
-
- myValue : HSequenceOfReal from TColStd;
-
-end SequenceOfRealAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SequenceOfRealAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_SequenceOfRealAttribute.ixx"
-#include <TDataStd_Real.hxx>
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_SequenceOfRealAttributeID ("12837183-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_SequenceOfRealAttributeID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_SequenceOfRealAttribute) SALOMEDS_SequenceOfRealAttribute::Set (const TDF_Label& L)
-{
- Handle(SALOMEDS_SequenceOfRealAttribute) A;
- if (!L.FindAttribute(SALOMEDS_SequenceOfRealAttribute::GetID(),A)) {
- A = new SALOMEDS_SequenceOfRealAttribute();
- L.AddAttribute(A);
- }
- return A;
-}
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_SequenceOfRealAttribute::SALOMEDS_SequenceOfRealAttribute()
-{myValue = new TColStd_HSequenceOfReal();}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_SequenceOfRealAttribute::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_SequenceOfRealAttribute::NewEmpty () const
-{
- return new SALOMEDS_SequenceOfRealAttribute();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_SequenceOfRealAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Standard_Integer i;
- Handle(SALOMEDS_SequenceOfRealAttribute) anSeq = Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(with);
- if(!anSeq->myValue.IsNull()) {
- myValue = new TColStd_HSequenceOfReal();
- Standard_Integer Len = anSeq->Length();
- for(i = 1; i<=Len; i++) Add(anSeq->Value(i));
- }
- else
- myValue.Nullify();
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_SequenceOfRealAttribute::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& ) const
-{
- if(!myValue.IsNull()) {
- Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast (into)->Assign(myValue);
- }
-}
-
-void SALOMEDS_SequenceOfRealAttribute::Assign(const Handle(TColStd_HSequenceOfReal)& other)
-{
- Backup();
- if (myValue.IsNull()) myValue = new TColStd_HSequenceOfReal;
- myValue->ChangeSequence() = other->Sequence();
-}
-
-void SALOMEDS_SequenceOfRealAttribute::ChangeValue(const Standard_Integer Index,const Standard_Real Value)
-{
- Backup();
- myValue->SetValue(Index, Value);
-}
-
-void SALOMEDS_SequenceOfRealAttribute::Add(const Standard_Real Value)
-{
- Backup();
- myValue->Append(Value);
-}
-
-void SALOMEDS_SequenceOfRealAttribute::Remove(const Standard_Integer Index)
-{
- Backup();
- myValue->Remove(Index);
-}
-
-Standard_Integer SALOMEDS_SequenceOfRealAttribute::Length()
-{
- return myValue->Length();
-}
-
-Standard_Real SALOMEDS_SequenceOfRealAttribute::Value(const Standard_Integer Index)
-{
- return myValue->Value(Index);
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SequenceOfRealAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_SequenceOfRealAttribute_HeaderFile
-#define _SALOMEDS_SequenceOfRealAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_SequenceOfRealAttribute_HeaderFile
-#include <Handle_SALOMEDS_SequenceOfRealAttribute.hxx>
-#endif
-
-#ifndef _Handle_TColStd_HSequenceOfReal_HeaderFile
-#include <Handle_TColStd_HSequenceOfReal.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class TColStd_HSequenceOfReal;
-class Standard_GUID;
-class TDF_Label;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_SequenceOfRealAttribute : public TDF_Attribute {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_SequenceOfRealAttribute Set(const TDF_Label& label) ;
-Standard_EXPORT SALOMEDS_SequenceOfRealAttribute();
-Standard_EXPORT void Assign(const Handle(TColStd_HSequenceOfReal)& other) ;
-Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Real Value) ;
-Standard_EXPORT void Add(const Standard_Real Value) ;
-Standard_EXPORT Standard_Real Value(const Standard_Integer Index) ;
-Standard_EXPORT void Remove(const Standard_Integer Index) ;
-Standard_EXPORT Standard_Integer Length() ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_SequenceOfRealAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_SequenceOfRealAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Handle_TColStd_HSequenceOfReal myValue;
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SequenceOfRealAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_SequenceOfRealAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_SequenceOfRealAttribute::~SALOMEDS_SequenceOfRealAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_SequenceOfRealAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_SequenceOfRealAttribute",
- sizeof(SALOMEDS_SequenceOfRealAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_SequenceOfRealAttribute) Handle(SALOMEDS_SequenceOfRealAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_SequenceOfRealAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute))) {
- _anOtherObject = Handle(SALOMEDS_SequenceOfRealAttribute)((Handle(SALOMEDS_SequenceOfRealAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_SequenceOfRealAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute) ;
-}
-Standard_Boolean SALOMEDS_SequenceOfRealAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_SequenceOfRealAttribute) == AType || TDF_Attribute::IsKind(AType));
-}
-Handle_SALOMEDS_SequenceOfRealAttribute::~Handle_SALOMEDS_SequenceOfRealAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_SequenceOfRealAttribute.jxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _TColStd_HSequenceOfReal_HeaderFile
-#include <TColStd_HSequenceOfReal.hxx>
-#endif
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_SequenceOfRealAttribute_HeaderFile
-#include "SALOMEDS_SequenceOfRealAttribute.hxx"
-#endif
{
// Initialise the ORB.
#if OMNIORB_VERSION >= 4
- const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } };
- CORBA::ORB_var orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ;
+ CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ;
#else
- CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
- omniORB::MaxMessageSize(100 * 1024 * 1024);
+ CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB3" );
#endif
// Obtain a reference to the root POA.
long TIMESleep = 500000000;
#include "SALOMEDS_Driver_i.hxx"
#include "SALOMEDS_Study_i.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-
#include "Utils_ORB_INIT.hxx"
#include "Utils_SINGLETON.hxx"
using namespace std;
-SALOMEDS_Study::SALOMEDS_Study(const Handle(SALOMEDSImpl_Study)& theStudy)
+SALOMEDS_Study::SALOMEDS_Study(SALOMEDSImpl_Study* theStudy)
{
_isLocal = true;
_local_impl = theStudy;
std::string aRef;
if (_isLocal) {
SALOMEDS::Locker lock;
- aRef = _local_impl->GetPersistentReference().ToCString();
+ aRef = _local_impl->GetPersistentReference();
}
else aRef = _corba_impl->GetPersistentReference();
return aRef;
std::string aRef;
if (_isLocal) {
SALOMEDS::Locker lock;
- aRef = _local_impl->GetTransientReference().ToCString();
+ aRef = _local_impl->GetTransientReference();
}
else aRef = _corba_impl->GetTransientReference();
return aRef;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SComponent) aSCO_impl =
- _local_impl->FindComponent((char*)aComponentName.c_str());
- if (aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
+ SALOMEDSImpl_SComponent aSCO_impl = _local_impl->FindComponent(aComponentName);
+ if (!aSCO_impl) return _PTR(SComponent)(aSCO);
aSCO = new SALOMEDS_SComponent(aSCO_impl);
}
else {
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SComponent) aSCO_impl =
- _local_impl->FindComponentID((char*)aComponentID.c_str());
- if (aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
+ SALOMEDSImpl_SComponent aSCO_impl = _local_impl->FindComponentID(aComponentID);
+ if (!aSCO_impl) return _PTR(SComponent)(aSCO);
aSCO = new SALOMEDS_SComponent(aSCO_impl);
}
else {
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObject((char*)anObjectName.c_str());
- if (aSO_impl.IsNull()) return _PTR(SObject)(aSO);
- Handle(SALOMEDSImpl_SComponent) aSCO_impl = Handle(SALOMEDSImpl_SComponent)::DownCast(aSO_impl);
- if (!aSCO_impl.IsNull()) return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl));
+ SALOMEDSImpl_SObject aSO_impl = _local_impl->FindObject(anObjectName);
+ if (!aSO_impl) return _PTR(SObject)(aSO);
+ if(aSO_impl.IsComponent()) {
+ SALOMEDSImpl_SComponent aSCO_impl = aSO_impl;
+ return _PTR(SObject)(new SALOMEDS_SComponent(aSCO_impl));
+ }
aSO = new SALOMEDS_SObject(aSO_impl);
}
else {
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfTransient) aSeq =
- _local_impl->FindObjectByName((char*)anObjectName.c_str(), (char*)aComponentName.c_str());
- aLength = aSeq->Length();
- for (i = 1; i<= aLength; i++)
- aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject
- (Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)))));
+ vector<SALOMEDSImpl_SObject> aSeq = _local_impl->FindObjectByName(anObjectName, aComponentName);
+ aLength = aSeq.size();
+ for (i = 0; i< aLength; i++)
+ aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i])));
}
else {
SALOMEDS::Study::ListOfSObject_var aSeq = _corba_impl->FindObjectByName((char*)anObjectName.c_str(),
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectID((char*)anObjectID.c_str());
- if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+ SALOMEDSImpl_SObject aSO_impl = _local_impl->FindObjectID(anObjectID);
+ if(!aSO_impl) return _PTR(SObject)(aSO);
return _PTR(SObject)(new SALOMEDS_SObject(aSO_impl));
}
else {
SALOMEDSClient_SObject* aSO = NULL;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->CreateObjectID((char*)anObjectID.c_str());
- if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+ SALOMEDSImpl_SObject aSO_impl = _local_impl->CreateObjectID(anObjectID);
+ if(!aSO_impl) return _PTR(SObject)(aSO);
aSO = new SALOMEDS_SObject(aSO_impl);
}
else {
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectIOR((char*)anObjectIOR.c_str());
- if (aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+ SALOMEDSImpl_SObject aSO_impl = _local_impl->FindObjectIOR(anObjectIOR);
+ if (!aSO_impl) return _PTR(SObject)(aSO);
aSO = new SALOMEDS_SObject(aSO_impl);
}
else {
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->FindObjectByPath((char*)thePath.c_str());
- if (aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+ SALOMEDSImpl_SObject aSO_impl = _local_impl->FindObjectByPath(thePath);
+ if (!aSO_impl) return _PTR(SObject)(aSO);
aSO = new SALOMEDS_SObject(aSO_impl);
}
else {
std::string aPath;
if (_isLocal) {
SALOMEDS::Locker lock;
- aPath = _local_impl->GetObjectPath(aSO->GetLocalImpl()).ToCString();
+ aPath = _local_impl->GetObjectPath(*(aSO->GetLocalImpl()));
}
else aPath = _corba_impl->GetObjectPath(aSO->GetCORBAImpl());
return aPath;
{
if (_isLocal) {
SALOMEDS::Locker lock;
- _local_impl->SetContext((char*)thePath.c_str());
+ _local_impl->SetContext(thePath);
}
else _corba_impl->SetContext((char*)thePath.c_str());
}
std::string aPath;
if (_isLocal) {
SALOMEDS::Locker lock;
- aPath = _local_impl->GetContext().ToCString();
+ aPath = _local_impl->GetContext();
}
else aPath = _corba_impl->GetContext();
return aPath;
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
-
- Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetObjectNames((char*)theContext.c_str());
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+ aVector = _local_impl->GetObjectNames(theContext);
}
else {
SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetObjectNames((char*)theContext.c_str());
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
-
- Handle(TColStd_HSequenceOfAsciiString) aSeq =
- _local_impl->GetDirectoryNames((char*)theContext.c_str());
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+ aVector = _local_impl->GetDirectoryNames(theContext);
}
else {
SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetDirectoryNames((char*)theContext.c_str());
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
-
- Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetFileNames((char*)theContext.c_str());
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+ aVector = _local_impl->GetFileNames(theContext);
}
else {
SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetFileNames((char*)theContext.c_str());
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
-
- Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetComponentNames((char*)theContext.c_str());
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+ aVector = _local_impl->GetComponentNames(theContext);
}
else {
SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetComponentNames((char*)theContext.c_str());
SALOMEDSClient_ChildIterator* aCI = NULL;
if (_isLocal) {
SALOMEDS::Locker lock;
-
- Handle(SALOMEDSImpl_ChildIterator) aCIimpl = _local_impl->NewChildIterator(aSO->GetLocalImpl());
+ SALOMEDSImpl_ChildIterator aCIimpl = _local_impl->NewChildIterator(*(aSO->GetLocalImpl()));
aCI = new SALOMEDS_ChildIterator(aCIimpl);
}
else {
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_StudyBuilder) aSBimpl = _local_impl->NewBuilder();
+ SALOMEDSImpl_StudyBuilder* aSBimpl = _local_impl->NewBuilder();
aSB = new SALOMEDS_StudyBuilder(aSBimpl);
}
else {
std::string aName;
if (_isLocal) {
SALOMEDS::Locker lock;
- aName = _local_impl->Name().ToCString();
+ aName = _local_impl->Name();
}
else aName = _corba_impl->Name();
return aName;
{
if (_isLocal) {
SALOMEDS::Locker lock;
- _local_impl->Name((char*)theName.c_str());
+ _local_impl->Name(theName);
}
else _corba_impl->Name((char*)theName.c_str());
}
else isModified = _corba_impl->IsModified();
return isModified;
}
+
+void SALOMEDS_Study::Modified()
+{
+ if (_isLocal) {
+ SALOMEDS::Locker lock;
+ _local_impl->Modify();
+ }
+ else _corba_impl->Modified();
+}
+
std::string SALOMEDS_Study::URL()
{
std::string aURL;
if (_isLocal) {
SALOMEDS::Locker lock;
- aURL = _local_impl->URL().ToCString();
+ aURL = _local_impl->URL();
}
else aURL = _corba_impl->URL();
return aURL;
{
if (_isLocal) {
SALOMEDS::Locker lock;
- _local_impl->URL((char*)url.c_str());
+ _local_impl->URL(url);
}
else _corba_impl->URL((char*)url.c_str());
}
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->FindDependances(aSO->GetLocalImpl());
- if (!aSeq.IsNull()) {
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++)
- aVector.push_back(_PTR(SObject)(
- new SALOMEDS_SObject(Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i)))));
+ vector<SALOMEDSImpl_SObject> aSeq = _local_impl->FindDependances(*(aSO->GetLocalImpl()));
+ if (aSeq.size()) {
+ aLength = aSeq.size();
+ for (i = 0; i < aLength; i++)
+ aVector.push_back(_PTR(SObject)(new SALOMEDS_SObject(aSeq[i])));
}
}
else {
std::string aDate;
if (_isLocal) {
SALOMEDS::Locker lock;
- aDate = _local_impl->GetLastModificationDate().ToCString();
+ aDate = _local_impl->GetLastModificationDate();
}
else aDate = _corba_impl->GetLastModificationDate();
return aDate;
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
-
- Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetModificationsDate();
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+ aVector = _local_impl->GetModificationsDate();
}
else {
SALOMEDS::ListOfDates_var aSeq = _corba_impl->GetModificationsDate();
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_UseCaseBuilder) aUBimpl = _local_impl->GetUseCaseBuilder();
+ SALOMEDSImpl_UseCaseBuilder* aUBimpl = _local_impl->GetUseCaseBuilder();
aUB = new SALOMEDS_UseCaseBuilder(aUBimpl);
}
else {
{
if (_isLocal) {
SALOMEDS::Locker lock;
- _local_impl->SetStudyLock((char*)theLockerID.c_str());
+ _local_impl->SetStudyLock(theLockerID.c_str());
}
else _corba_impl->SetStudyLock((char*)theLockerID.c_str());
}
void SALOMEDS_Study::UnLockStudy(const string& theLockerID)
{
- if(_isLocal) _local_impl->UnLockStudy((char*)theLockerID.c_str());
+ if(_isLocal) _local_impl->UnLockStudy(theLockerID.c_str());
else _corba_impl->UnLockStudy((char*)theLockerID.c_str());
}
int aLength, i;
if (_isLocal) {
SALOMEDS::Locker lock;
-
- Handle(TColStd_HSequenceOfAsciiString) aSeq = _local_impl->GetLockerID();
- aLength = aSeq->Length();
- for (i = 1; i <= aLength; i++) aVector.push_back(aSeq->Value(i).ToCString());
+ aVector = _local_impl->GetLockerID();
}
else {
SALOMEDS::ListOfStrings_var aSeq = _corba_impl->GetLockerID();
SALOMEDS::Locker lock;
if (!CORBA::is_nil(_corba_impl)) return SALOMEDS::Study::_duplicate(_corba_impl);
- std::string anIOR = _local_impl->GetTransientReference().ToCString();
+ std::string anIOR = _local_impl->GetTransientReference();
SALOMEDS::Study_var aStudy;
if (!_local_impl->IsError() && anIOR != "") {
aStudy = SALOMEDS::Study::_narrow(_orb->string_to_object(anIOR.c_str()));
private:
bool _isLocal;
- Handle(SALOMEDSImpl_Study) _local_impl;
+ SALOMEDSImpl_Study* _local_impl;
SALOMEDS::Study_var _corba_impl;
CORBA::ORB_var _orb;
public:
- SALOMEDS_Study(const Handle(SALOMEDSImpl_Study)& theStudy);
+ SALOMEDS_Study(SALOMEDSImpl_Study* theStudy);
SALOMEDS_Study(SALOMEDS::Study_ptr theStudy);
~SALOMEDS_Study();
virtual bool IsSaved();
virtual void IsSaved(bool save);
virtual bool IsModified();
+ virtual void Modified();
virtual std::string URL();
virtual void URL(const std::string& url);
virtual int StudyId();
#include <string>
#include <stdexcept>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Attribute.hxx>
+#include "DF_Attribute.hxx"
#include "Utils_CorbaException.hxx"
#include "Utils_ORB_INIT.hxx"
using namespace std;
-SALOMEDS_StudyBuilder::SALOMEDS_StudyBuilder(const Handle(SALOMEDSImpl_StudyBuilder)& theBuilder)
+SALOMEDS_StudyBuilder::SALOMEDS_StudyBuilder(SALOMEDSImpl_StudyBuilder* theBuilder)
{
_isLocal = true;
_local_impl = theBuilder;
CheckLocked();
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SComponent) aSCO_impl =_local_impl->NewComponent((char*)ComponentDataType.c_str());
- if(aSCO_impl.IsNull()) return _PTR(SComponent)(aSCO);
+ SALOMEDSImpl_SComponent aSCO_impl =_local_impl->NewComponent(ComponentDataType);
+ if(!aSCO_impl) return _PTR(SComponent)(aSCO);
aSCO = new SALOMEDS_SComponent(aSCO_impl);
}
else {
CheckLocked();
SALOMEDS::Locker lock;
- _local_impl->DefineComponentInstance(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()),
- (char*)ComponentIOR.c_str());
+ _local_impl->DefineComponentInstance(*(dynamic_cast<SALOMEDSImpl_SComponent*>(aSCO->GetLocalImpl())),
+ ComponentIOR);
}
else {
CORBA::Object_var obj = _orb->string_to_object(ComponentIOR.c_str());
CheckLocked();
SALOMEDS::Locker lock;
- _local_impl->RemoveComponent(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()));
+ _local_impl->RemoveComponent(*(dynamic_cast<SALOMEDSImpl_SComponent*>(aSCO->GetLocalImpl())));
}
else _corba_impl->RemoveComponent(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()));
}
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->NewObject(father->GetLocalImpl());
- if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
+ SALOMEDSImpl_SObject aSO_impl = _local_impl->NewObject(*(father->GetLocalImpl()));
+ if(!aSO_impl) return _PTR(SObject)(aSO);
aSO = new SALOMEDS_SObject(aSO_impl);
}
else {
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO_impl = _local_impl->NewObjectToTag(father->GetLocalImpl(), theTag);
+ SALOMEDSImpl_SObject aSO_impl = _local_impl->NewObjectToTag(*(father->GetLocalImpl()), theTag);
if(aSO_impl.IsNull()) return _PTR(SObject)(aSO);
aSO = new SALOMEDS_SObject(aSO_impl);
}
_local_impl->AddDirectory((char*)thePath.c_str());
if (_local_impl->IsError()) {
- std::string anErrorCode = _local_impl->GetErrorCode().ToCString();
+ std::string anErrorCode = _local_impl->GetErrorCode();
if (anErrorCode == "StudyNameAlreadyUsed") throw SALOMEDS::Study::StudyNameAlreadyUsed();
if (anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory();
if (anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent();
SALOMEDS::Locker lock;
SALOMEDS_Driver_i* drv = new SALOMEDS_Driver_i(aDriver, _orb);
- Handle(SALOMEDSImpl_SComponent) aSCO_impl =
- Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl());
+ SALOMEDSImpl_SComponent aSCO_impl = *(dynamic_cast<SALOMEDSImpl_SComponent*>(aSCO->GetLocalImpl()));
bool isDone = _local_impl->LoadWith(aSCO_impl, drv);
delete drv;
if(!isDone && _local_impl->IsError())
- THROW_SALOME_CORBA_EXCEPTION(_local_impl->GetErrorCode().ToCString(),SALOME::BAD_PARAM);
+ THROW_SALOME_CORBA_EXCEPTION(_local_impl->GetErrorCode().c_str(),SALOME::BAD_PARAM);
}
else {
_corba_impl->LoadWith(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()), aDriver);
void SALOMEDS_StudyBuilder::Load(const _PTR(SObject)& theSCO)
{
SALOMEDS_SComponent* aSCO = dynamic_cast<SALOMEDS_SComponent*>(theSCO.get());
- if (_isLocal) _local_impl->Load(Handle(SALOMEDSImpl_SComponent)::DownCast(aSCO->GetLocalImpl()));
+ if (_isLocal) _local_impl->Load(*(dynamic_cast<SALOMEDSImpl_SComponent*>(aSCO->GetLocalImpl())));
else _corba_impl->Load(SALOMEDS::SComponent::_narrow(aSCO->GetCORBAImpl()));
}
CheckLocked();
SALOMEDS::Locker lock;
- _local_impl->RemoveObject(aSO->GetLocalImpl());
+ _local_impl->RemoveObject(*(aSO->GetLocalImpl()));
}
else _corba_impl->RemoveObject(aSO->GetCORBAImpl());
}
CheckLocked();
SALOMEDS::Locker lock;
- _local_impl->RemoveObjectWithChildren(aSO->GetLocalImpl());
+ _local_impl->RemoveObjectWithChildren(*(aSO->GetLocalImpl()));
}
else _corba_impl->RemoveObjectWithChildren(aSO->GetCORBAImpl());
}
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_GenericAttribute) aGA;
+ SALOMEDSImpl_GenericAttribute* aGA;
try {
- aGA = Handle(SALOMEDSImpl_GenericAttribute)::DownCast
- (_local_impl->FindOrCreateAttribute(aSO->GetLocalImpl(), (char*)aTypeOfAttribute.c_str()));
+ aGA = dynamic_cast<SALOMEDSImpl_GenericAttribute*>
+ (_local_impl->FindOrCreateAttribute(*(aSO->GetLocalImpl()), aTypeOfAttribute));
}
catch (...) {
throw SALOMEDS::StudyBuilder::LockProtection();
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_GenericAttribute) aGA;
- ret = _local_impl->FindAttribute(aSO->GetLocalImpl(), aGA, (char*)aTypeOfAttribute.c_str());
- if(ret) anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(aGA));
+ DF_Attribute* anAttr = NULL;
+ ret = _local_impl->FindAttribute(*(aSO->GetLocalImpl()), anAttr, aTypeOfAttribute);
+ if(ret) {
+ SALOMEDSImpl_GenericAttribute* aGA = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(anAttr);
+ anAttribute = _PTR(GenericAttribute)(SALOMEDS_GenericAttribute::CreateAttribute(aGA));
+ }
}
else {
SALOMEDS::GenericAttribute_var aGA;
CheckLocked();
SALOMEDS::Locker lock;
- _local_impl->RemoveAttribute(aSO->GetLocalImpl(), (char*)aTypeOfAttribute.c_str());
+ _local_impl->RemoveAttribute(*(aSO->GetLocalImpl()), (char*)aTypeOfAttribute.c_str());
}
else _corba_impl->RemoveAttribute(aSO->GetCORBAImpl(), (char*)aTypeOfAttribute.c_str());
}
void SALOMEDS_StudyBuilder::Addreference(const _PTR(SObject)& me, const _PTR(SObject)& thereferencedObject)
{
- if(!me || !thereferencedObject) return;
+ if(!me || !thereferencedObject) {
+ throw DFexception("Invalid arguments");
+ }
SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(me.get());
SALOMEDS_SObject* aRefSO = dynamic_cast<SALOMEDS_SObject*>(thereferencedObject.get());
CheckLocked();
SALOMEDS::Locker lock;
- _local_impl->Addreference(aSO->GetLocalImpl(), aRefSO->GetLocalImpl());
+ _local_impl->Addreference(*(aSO->GetLocalImpl()), *(aRefSO->GetLocalImpl()));
}
else _corba_impl->Addreference(aSO->GetCORBAImpl(), aRefSO->GetCORBAImpl());
}
CheckLocked();
SALOMEDS::Locker lock;
- _local_impl->RemoveReference(aSO->GetLocalImpl());
+ _local_impl->RemoveReference(*(aSO->GetLocalImpl()));
}
else _corba_impl->RemoveReference(aSO->GetCORBAImpl());
}
void SALOMEDS_StudyBuilder::SetGUID(const _PTR(SObject)& theSO, const std::string& theGUID)
{
if(!theSO) return;
- if(!Standard_GUID::CheckGUIDFormat((char*)theGUID.c_str())) throw invalid_argument("Invalid GUID");
SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
if (_isLocal) {
CheckLocked();
SALOMEDS::Locker lock;
- _local_impl->SetGUID(aSO->GetLocalImpl(), (char*)theGUID.c_str());
+ _local_impl->SetGUID(*(aSO->GetLocalImpl()), theGUID);
}
else _corba_impl->SetGUID(aSO->GetCORBAImpl(), (char*)theGUID.c_str());
}
bool SALOMEDS_StudyBuilder::IsGUID(const _PTR(SObject)& theSO, const std::string& theGUID)
{
- if(!theSO || !Standard_GUID::CheckGUIDFormat((char*)theGUID.c_str())) return false;
-
SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(theSO.get());
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = _local_impl->IsGUID(aSO->GetLocalImpl(), (char*)theGUID.c_str());
+ ret = _local_impl->IsGUID(*(aSO->GetLocalImpl()), (char*)theGUID.c_str());
}
else ret = _corba_impl->IsGUID(aSO->GetCORBAImpl(), (char*)theGUID.c_str());
CheckLocked();
SALOMEDS::Locker lock;
- _local_impl->SetName(aSO->GetLocalImpl(), (char*)theValue.c_str());
+ _local_impl->SetName(*(aSO->GetLocalImpl()), theValue);
}
else _corba_impl->SetName(aSO->GetCORBAImpl(), (char*)theValue.c_str());
}
CheckLocked();
SALOMEDS::Locker lock;
- _local_impl->SetComment(aSO->GetLocalImpl(), (char*)theValue.c_str());
+ _local_impl->SetComment(*(aSO->GetLocalImpl()), theValue);
}
else _corba_impl->SetComment(aSO->GetCORBAImpl(), (char*)theValue.c_str());
}
CheckLocked();
SALOMEDS::Locker lock;
- _local_impl->SetIOR(aSO->GetLocalImpl(), (char*)theValue.c_str());
+ _local_impl->SetIOR(*(aSO->GetLocalImpl()), theValue);
}
else _corba_impl->SetIOR(aSO->GetCORBAImpl(), (char*)theValue.c_str());
}
{
private:
bool _isLocal;
- Handle(SALOMEDSImpl_StudyBuilder) _local_impl;
+ SALOMEDSImpl_StudyBuilder* _local_impl;
SALOMEDS::StudyBuilder_var _corba_impl;
CORBA::ORB_var _orb;
public:
- SALOMEDS_StudyBuilder(const Handle(SALOMEDSImpl_StudyBuilder)& theBuilder);
+ SALOMEDS_StudyBuilder(SALOMEDSImpl_StudyBuilder* theBuilder);
SALOMEDS_StudyBuilder(SALOMEDS::StudyBuilder_ptr theBuilder);
~SALOMEDS_StudyBuilder();
#include "Utils_CorbaException.hxx"
#include "Utils_ExceptHandlers.hxx"
-#include <TDF_Attribute.hxx>
+#include <DF_Attribute.hxx>
+#include <DF_Document.hxx>
#include <stdlib.h>
using namespace std;
* Purpose :
*/
//============================================================================
-SALOMEDS_StudyBuilder_i::SALOMEDS_StudyBuilder_i(const Handle(SALOMEDSImpl_StudyBuilder) theImpl,
+SALOMEDS_StudyBuilder_i::SALOMEDS_StudyBuilder_i(SALOMEDSImpl_StudyBuilder* theImpl,
CORBA::ORB_ptr orb)
{
_orb = CORBA::ORB::_duplicate(orb);
SALOMEDS::Locker lock;
CheckLocked();
//char* aDataType = CORBA::string_dup(DataType);
- Handle(SALOMEDSImpl_SComponent) aSCO = _impl->NewComponent(TCollection_AsciiString((char*)DataType));
+ SALOMEDSImpl_SComponent aSCO = _impl->NewComponent(string(DataType));
//CORBA::free_string(aDataType);
if(aSCO.IsNull()) return SALOMEDS::SComponent::_nil();
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_SComponent) aSCO;
- aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)aComponent->GetID());
+ SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID());
CORBA::String_var iorstr = _orb->object_to_string(IOR);
_impl->DefineComponentInstance(aSCO, (char*)iorstr.in());
SALOMEDS::Locker lock;
CheckLocked();
ASSERT(!CORBA::is_nil(aComponent));
- Handle(SALOMEDSImpl_SComponent) aSCO;
- aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)aComponent->GetID());
+ SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(aComponent->GetID());
_impl->RemoveComponent(aSCO);
}
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_SObject) aFO, aSO;
- aFO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theFatherObject->GetID());
+ SALOMEDSImpl_SObject aFO, aSO;
+ aFO = _impl->GetOwner()->GetSObject(theFatherObject->GetID());
aSO = _impl->NewObject(aFO);
if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO,_orb);
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_SObject) aFO, aSO;
- aFO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theFatherObject->GetID());
+ SALOMEDSImpl_SObject aFO, aSO;
+ aFO = _impl->GetOwner()->GetSObject(theFatherObject->GetID());
aSO = _impl->NewObjectToTag(aFO, atag);
if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_SObject) aSO;
- aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID());
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
_impl->RemoveObject(aSO);
}
{
SALOMEDS::Locker lock;
CheckLocked();
- Handle(SALOMEDSImpl_SObject) aSO;
- aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID());
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
_impl->RemoveObjectWithChildren(aSO);
}
SALOMEDS::Locker lock;
Unexpect aCatch(SBSalomeException);
- Handle(SALOMEDSImpl_SComponent) aSCO;
- aSCO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSComponent((char*)anSCO->GetID());
+ SALOMEDSImpl_SComponent aSCO = _impl->GetOwner()->GetSComponent(anSCO->GetID());
SALOMEDS_Driver_i* driver = new SALOMEDS_Driver_i(aDriver, _orb);
- bool isDone = _impl->LoadWith(aSCO, driver);
+ bool isDone = _impl->LoadWith(aSCO, driver);
delete driver;
if(!isDone && _impl->IsError()) {
- THROW_SALOME_CORBA_EXCEPTION(_impl->GetErrorCode().ToCString(),SALOME::BAD_PARAM);
+ THROW_SALOME_CORBA_EXCEPTION(_impl->GetErrorCode().c_str(),SALOME::BAD_PARAM);
}
}
const char* aTypeOfAttribute)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO;
CORBA::String_var anID = anObject->GetID();
- aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject(anID.inout());
- Handle(TDF_Attribute) anAttr;
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anID.inout());
+ DF_Attribute* anAttr;
try {
- anAttr = _impl->FindOrCreateAttribute(aSO, TCollection_AsciiString((char*)aTypeOfAttribute));
+ anAttr = _impl->FindOrCreateAttribute(aSO, string(aTypeOfAttribute));
}
catch (...) {
throw SALOMEDS::StudyBuilder::LockProtection();
}
SALOMEDS::GenericAttribute_var anAttribute;
- anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
+
+ if(anAttr)
+ anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
return anAttribute._retn();
}
//============================================================================
/*! Function : FindAttribute
- * Purpose : Find attribute of given type assigned SObject, returns Standard_True if it is found
+ * Purpose : Find attribute of given type assigned SObject, returns true if it is found
*/
//============================================================================
{
SALOMEDS::Locker lock;
ASSERT(!CORBA::is_nil(anObject));
- Handle(SALOMEDSImpl_SObject) aSO;
- aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID());
- Handle(TDF_Attribute) anAttr;
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ DF_Attribute* anAttr;
- if(!_impl->FindAttribute(aSO, anAttr, TCollection_AsciiString((char*)aTypeOfAttribute))) return false;
+ if(!_impl->FindAttribute(aSO, anAttr, string(aTypeOfAttribute))) return false;
anAttribute = SALOMEDS::GenericAttribute::_duplicate(SALOMEDS_GenericAttribute_i::CreateAttribute(anAttr, _orb));
return true;
SALOMEDS::Locker lock;
CheckLocked();
ASSERT(!CORBA::is_nil(anObject));
- Handle(SALOMEDSImpl_SObject) aSO;
- aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID());
- _impl->RemoveAttribute(aSO, TCollection_AsciiString((char*)aTypeOfAttribute));
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ _impl->RemoveAttribute(aSO, string(aTypeOfAttribute));
}
//============================================================================
ASSERT(!CORBA::is_nil(me));
ASSERT(!CORBA::is_nil(theReferencedObject));
- Handle(SALOMEDSImpl_SObject) aSO, aRefSO;
- aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)me->GetID());
- aRefSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theReferencedObject->GetID());
+ SALOMEDSImpl_SObject aSO, aRefSO;
+ aSO = _impl->GetOwner()->GetSObject(me->GetID());
+ aRefSO = _impl->GetOwner()->GetSObject(theReferencedObject->GetID());
_impl->Addreference(aSO, aRefSO);
}
SALOMEDS::Locker lock;
CheckLocked();
ASSERT(!CORBA::is_nil(me));
- Handle(SALOMEDSImpl_SObject) aSO;
- aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)me->GetID());
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(me->GetID());
_impl->RemoveReference(aSO);
}
SALOMEDS::Locker lock;
CheckLocked();
if(thePath == NULL || strlen(thePath) == 0) throw SALOMEDS::Study::StudyInvalidDirectory();
- if(!_impl->AddDirectory(TCollection_AsciiString((char*)thePath))) {
- TCollection_AsciiString anErrorCode = _impl->GetErrorCode();
+ if(!_impl->AddDirectory(string(thePath))) {
+ string anErrorCode = _impl->GetErrorCode();
if(anErrorCode == "StudyNameAlreadyUsed") throw SALOMEDS::Study::StudyNameAlreadyUsed();
if(anErrorCode == "StudyInvalidDirectory") throw SALOMEDS::Study::StudyInvalidDirectory();
if(anErrorCode == "StudyInvalidComponent") throw SALOMEDS::Study::StudyInvalidComponent();
SALOMEDS::Locker lock;
CheckLocked();
ASSERT(!CORBA::is_nil(anObject));
- Handle(SALOMEDSImpl_SObject) aSO;
- aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID());
- _impl->SetGUID(aSO, TCollection_AsciiString((char*)theGUID));
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ _impl->SetGUID(aSO, string(theGUID));
}
//============================================================================
{
SALOMEDS::Locker lock;
ASSERT(!CORBA::is_nil(anObject));
- Handle(SALOMEDSImpl_SObject) aSO;
- aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)anObject->GetID());
- return _impl->IsGUID(aSO, TCollection_AsciiString((char*)theGUID));
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(anObject->GetID());
+ return _impl->IsGUID(aSO, string(theGUID));
}
Unexpect aCatch(SBLockProtection);
CheckLocked();
- Handle(SALOMEDSImpl_SObject) aSO;
- aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theSO->GetID());
- _impl->SetName(aSO, TCollection_AsciiString((char*)theValue));
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID());
+ _impl->SetName(aSO, string(theValue));
}
//============================================================================
Unexpect aCatch(SBLockProtection);
CheckLocked();
- Handle(SALOMEDSImpl_SObject) aSO;
- aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theSO->GetID());
- _impl->SetComment(aSO, TCollection_AsciiString((char*)theValue));
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID());
+ _impl->SetComment(aSO, string(theValue));
}
//============================================================================
Unexpect aCatch(SBLockProtection);
CheckLocked();
- Handle(SALOMEDSImpl_SObject) aSO;
- aSO = Handle(SALOMEDSImpl_Study)::DownCast(_impl->GetOwner())->GetSObject((char*)theSO->GetID());
- _impl->SetIOR(aSO, TCollection_AsciiString((char*)theValue));
+ SALOMEDSImpl_SObject aSO = _impl->GetOwner()->GetSObject(theSO->GetID());
+ _impl->SetIOR(aSO, string(theValue));
}
#include "SALOMEDSImpl_StudyBuilder.hxx"
-// Cascade header
-#include <TDocStd_Document.hxx>
-
class SALOMEDS_StudyBuilder_i: public POA_SALOMEDS::StudyBuilder
{
private:
CORBA::ORB_ptr _orb;
- Handle(SALOMEDSImpl_StudyBuilder) _impl; // OCAF Document
+ SALOMEDSImpl_StudyBuilder* _impl;
public:
- SALOMEDS_StudyBuilder_i(const Handle(SALOMEDSImpl_StudyBuilder), CORBA::ORB_ptr);
+ SALOMEDS_StudyBuilder_i(SALOMEDSImpl_StudyBuilder*, CORBA::ORB_ptr);
~SALOMEDS_StudyBuilder_i();
virtual void SetComment(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection);
virtual void SetIOR(SALOMEDS::SObject_ptr theSO, const char* theValue) throw(SALOMEDS::StudyBuilder::LockProtection);
- Handle(SALOMEDSImpl_StudyBuilder) GetImpl() { return _impl; }
+ SALOMEDSImpl_StudyBuilder* GetImpl() { return _impl; }
};
#endif
#include <unistd.h>
#endif
-#include <string>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-
#include "OpUtil.hxx"
using namespace std;
-SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb);
+SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb);
SALOMEDS_StudyManager::SALOMEDS_StudyManager(SALOMEDS::StudyManager_ptr theManager)
{
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfTransient) aSeq = _local_impl->GetOpenStudies();
- aLength = aSeq->Length();
- for(i = 1; i <= aLength; i++)
- aVector.push_back(Handle(SALOMEDSImpl_Study)::DownCast(aSeq->Value(i))->Name().ToCString());
+ vector<SALOMEDSImpl_Study*> aSeq = _local_impl->GetOpenStudies();
+ aLength = aSeq.size();
+ for(i = 0; i < aLength; i++)
+ aVector.push_back(aSeq[i]->Name());
}
else {
SALOMEDS::ListOfOpenStudies_var aSeq = _corba_impl->GetOpenStudies();
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_Study) aStudy_impl = _local_impl->GetStudyByName((char*)theStudyName.c_str());
- if(aStudy_impl.IsNull()) return _PTR(Study)(aStudy);
+ SALOMEDSImpl_Study* aStudy_impl = _local_impl->GetStudyByName(theStudyName);
+ if(!aStudy_impl) return _PTR(Study)(aStudy);
aStudy = new SALOMEDS_Study(aStudy_impl);
}
else {
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_Study) aStudy_impl = _local_impl->GetStudyByID(theStudyID);
- if(aStudy_impl.IsNull()) return _PTR(Study)(aStudy);
+ SALOMEDSImpl_Study* aStudy_impl = _local_impl->GetStudyByID(theStudyID);
+ if(!aStudy_impl) return _PTR(Study)(aStudy);
aStudy = new SALOMEDS_Study(aStudy_impl);
}
else {
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl();
+ SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl());
SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
ret = _local_impl->CanCopy(aSO_impl, aDriver);
delete aDriver;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl();
+ SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl());
SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
ret = _local_impl->Copy(aSO_impl, aDriver);
delete aDriver;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl();
+ SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl());
SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
ret = _local_impl->CanPaste(aSO_impl, aDriver);
delete aDriver;
if (_isLocal) {
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO_impl = aSO->GetLocalImpl();
+ SALOMEDSImpl_SObject aSO_impl = *(aSO->GetLocalImpl());
SALOMEDS_Driver_i* aDriver = GetDriver(aSO_impl, _orb);
- Handle(SALOMEDSImpl_SObject) aNewSO = _local_impl->Paste(aSO_impl, aDriver);
+ SALOMEDSImpl_SObject aNewSO = _local_impl->Paste(aSO_impl, aDriver);
delete aDriver;
if(aNewSO.IsNull()) return _PTR(SObject)(aResult);
aResult = new SALOMEDS_SObject(aNewSO);
_orb = init(0 , 0 );
}
-SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb)
+SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb)
{
SALOMEDS_Driver_i* driver = NULL;
- Handle(SALOMEDSImpl_SComponent) aSCO = theObject->GetFatherComponent();
+ SALOMEDSImpl_SComponent aSCO = theObject.GetFatherComponent();
if(!aSCO.IsNull()) {
- TCollection_AsciiString IOREngine = aSCO->GetIOR();
- if(!IOREngine.IsEmpty()) {
- CORBA::Object_var obj = orb->string_to_object(IOREngine.ToCString());
+ string IOREngine = aSCO.GetIOR();
+ if(!IOREngine.empty()) {
+ CORBA::Object_var obj = orb->string_to_object(IOREngine.c_str());
SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
driver = new SALOMEDS_Driver_i(Engine, orb);
}
{
private:
bool _isLocal;
- Handle(SALOMEDSImpl_StudyManager) _local_impl;
+ SALOMEDSImpl_StudyManager* _local_impl;
SALOMEDS::StudyManager_var _corba_impl;
CORBA::ORB_var _orb;
#include "SALOMEDSImpl_SComponent.hxx"
#include "SALOMEDSImpl_AttributeIOR.hxx"
-#include <TColStd_HArray1OfCharacter.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TCollection_AsciiString.hxx>
-
#include "Utils_CorbaException.hxx"
#include <strstream>
+#include <vector>
#include <map>
using namespace std;
UNEXPECT_CATCH(SalomeException,SALOME::SALOME_Exception);
UNEXPECT_CATCH(LockProtection, SALOMEDS::StudyBuilder::LockProtection);
-static SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb);
+static SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb);
static std::map<int, PortableServer::POA_ptr> _mapOfPOA;
// Destroy directory to register open studies
_name_service->Destroy_Directory("/Study");
delete _factory;
+ delete _impl;
}
//============================================================================
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->NewStudy(TCollection_AsciiString((char*)study_name));
- if(aStudyImpl.IsNull()) {
+ SALOMEDSImpl_Study* aStudyImpl = _impl->NewStudy(study_name);
+ if(!aStudyImpl) {
MESSAGE("NewStudy : Error : " << _impl->GetErrorCode());
return SALOMEDS::Study::_nil();
}
Unexpect aCatch(SalomeException);
MESSAGE("Begin of SALOMEDS_StudyManager_i::Open");
- Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->Open(TCollection_AsciiString((char*)aUrl));
+ SALOMEDSImpl_Study* aStudyImpl = _impl->Open(string(aUrl));
MESSAGE("Open : Creating the CORBA servant holding it... ");
// Register study in the naming service
// Path to acces the study
if(!_name_service->Change_Directory("/Study")) MESSAGE( "Unable to access the study directory" )
- else _name_service->Register(Study, CORBA::string_dup(aStudyImpl->Name().ToCString()));
+ else _name_service->Register(Study, CORBA::string_dup(aStudyImpl->Name().c_str()));
return Study;
}
return false;
}
- Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
return _impl->Save(aStudyImpl, _factory, theMultiFile);
}
return false;
}
- Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
return _impl->SaveASCII(aStudyImpl, _factory, theMultiFile);
}
return false;
}
- Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- return _impl->SaveAs(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile);
+ SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ return _impl->SaveAs(string(aUrl), aStudyImpl, _factory, theMultiFile);
}
CORBA::Boolean SALOMEDS_StudyManager_i::SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile)
return false;
}
- Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- return _impl->SaveAsASCII(TCollection_AsciiString((char*)aUrl), aStudyImpl, _factory, theMultiFile);
+ SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ return _impl->SaveAsASCII(string(aUrl), aStudyImpl, _factory, theMultiFile);
}
//============================================================================
{
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfTransient) anOpened = _impl->GetOpenStudies();
- int aLength = anOpened->Length();
+ vector<SALOMEDSImpl_Study*> anOpened = _impl->GetOpenStudies();
+ int aLength = anOpened.size();
SALOMEDS::ListOfOpenStudies_var _list_open_studies = new SALOMEDS::ListOfOpenStudies;
_list_open_studies->length(aLength);
}
else
{
- for (unsigned int ind=1; ind <= aLength; ind++)
+ for (unsigned int ind=0; ind < aLength; ind++)
{
- Handle(SALOMEDSImpl_Study) aStudy = Handle(SALOMEDSImpl_Study)::DownCast(anOpened->Value(ind));
- _list_open_studies[ind-1] = CORBA::string_dup(aStudy->Name().ToCString());
- SCRUTE(_list_open_studies[ind-1]) ;
+ _list_open_studies[ind] = CORBA::string_dup(anOpened[ind]->Name().c_str());
+ SCRUTE(_list_open_studies[ind]) ;
}
}
return _list_open_studies._retn();
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_Study) aStudyImpl =
- _impl->GetStudyByName(TCollection_AsciiString((char*)aStudyName));
+ SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByName(string(aStudyName));
- if (aStudyImpl.IsNull())
+ if (!aStudyImpl)
{
- MESSAGE(_impl->GetErrorCode().ToCString());
+ MESSAGE(_impl->GetErrorCode().c_str());
return SALOMEDS::Study::_nil();
}
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudyID);
+ SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudyID);
- if (aStudyImpl.IsNull())
+ if (!aStudyImpl)
{
- MESSAGE(_impl->GetErrorCode().ToCString());
+ MESSAGE(_impl->GetErrorCode().c_str());
return SALOMEDS::Study::_nil();
}
SALOMEDS::Locker lock;
SALOMEDS::Study_var aStudy = theObject->GetStudy();
- Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID());
+ SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID());
SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
bool ret = _impl->CanCopy(anObject, aDriver);
SALOMEDS::Locker lock;
SALOMEDS::Study_var aStudy = theObject->GetStudy();
- Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID());
+ SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID());
SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
bool ret = _impl->Copy(anObject, aDriver);
SALOMEDS::Locker lock;
SALOMEDS::Study_var aStudy = theObject->GetStudy();
- Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID());
+ SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID());
SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
bool ret = _impl->CanPaste(anObject, aDriver);
Unexpect aCatch(LockProtection);
SALOMEDS::Study_var aStudy = theObject->GetStudy();
- Handle(SALOMEDSImpl_Study) aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
- Handle(SALOMEDSImpl_SObject) anObject = aStudyImpl->GetSObject((char*)theObject->GetID());
- Handle(SALOMEDSImpl_SObject) aNewSO;
+ SALOMEDSImpl_Study* aStudyImpl = _impl->GetStudyByID(aStudy->StudyId());
+ SALOMEDSImpl_SObject anObject = aStudyImpl->GetSObject(theObject->GetID());
+ SALOMEDSImpl_SObject aNewSO;
try {
SALOMEDS_Driver_i* aDriver = GetDriver(anObject, _orb);
}
-SALOMEDS_Driver_i* GetDriver(const Handle(SALOMEDSImpl_SObject)& theObject, CORBA::ORB_ptr orb)
+SALOMEDS_Driver_i* GetDriver(const SALOMEDSImpl_SObject& theObject, CORBA::ORB_ptr orb)
{
SALOMEDS_Driver_i* driver = NULL;
- Handle(SALOMEDSImpl_SComponent) aSCO = theObject->GetFatherComponent();
+ SALOMEDSImpl_SComponent aSCO = theObject.GetFatherComponent();
if(!aSCO.IsNull()) {
- TCollection_AsciiString IOREngine = aSCO->GetIOR();
- if(!IOREngine.IsEmpty()) {
- CORBA::Object_var obj = orb->string_to_object(IOREngine.ToCString());
+ string IOREngine = aSCO.GetIOR();
+ if(!IOREngine.empty()) {
+ CORBA::Object_var obj = orb->string_to_object(IOREngine.c_str());
SALOMEDS::Driver_var Engine = SALOMEDS::Driver::_narrow(obj) ;
driver = new SALOMEDS_Driver_i(Engine, orb);
}
return PortableServer::POA::_nil();
}
+CORBA::Long SALOMEDS_StudyManager_i::getPID()
+{
+#ifdef WIN32
+ return (CORBA::Long)_getpid();
+#else
+ return (CORBA::Long)getpid();
+#endif
+}
+
+void SALOMEDS_StudyManager_i::ShutdownWithExit()
+{
+ exit( EXIT_SUCCESS );
+}
+
//===========================================================================
// PRIVATE FUNCTIONS
//===========================================================================
long pid = (long)getpid();
#endif
isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
- SALOMEDSImpl_StudyManager* aManager = _impl.operator->();
- return ((CORBA::LongLong)aManager);
+ return ((CORBA::LongLong)(void*)_impl);
}
//===========================================================================
namespace SALOMEDS
{
-/*
- CORBA::Object_var
- GetObject(const TDF_Label& theLabel, CORBA::ORB_ptr theORB)
- {
- try {
- Handle(SALOMEDS_IORAttribute) anAttr;
- if(theLabel.FindAttribute(SALOMEDS_IORAttribute::GetID(),anAttr))
- return theORB->string_to_object(TCollection_AsciiString(anAttr->Get()).ToCString());
- }catch(...){
- }
- return CORBA::Object::_nil();
- }
-*/
-
PortableServer::ServantBase_var
GetServant(CORBA::Object_ptr theObject, PortableServer::POA_ptr thePOA)
{
// std C++ headers
#include <iostream>
+#ifndef WNT
+#include <unistd.h>
+#endif
+
// IDL headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOMEDS)
#include <stdlib.h>
-//Standard not implemented
-#include <Standard_NotImplemented.hxx>
#include "SALOMEDS_Driver_i.hxx"
#include "SALOMEDSImpl_StudyManager.hxx"
namespace SALOMEDS{
- // To convert IOR from SALOMEDS_IORAttribute to CORBA::Object
- /* CORBA::Object_var GetObject(const TDF_Label&, CORBA::ORB_ptr); */
-
// To convert CORBA::Object to PortableServer::ServantBase
PortableServer::ServantBase_var GetServant(CORBA::Object_ptr, PortableServer::POA_ptr);
CORBA::ORB_ptr _orb;
PortableServer::POA_var _poa;
- Handle(SALOMEDSImpl_StudyManager) _impl;
+ SALOMEDSImpl_StudyManager* _impl;
SALOME_NamingService* _name_service;
SALOMEDS_DriverFactory_i* _factory;
virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
void ping(){};
+ CORBA::Long getPID();
+ void ShutdownWithExit();
virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
static PortableServer::POA_ptr GetPOA(const SALOMEDS::Study_ptr theStudy);
+
+ void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }
};
#endif
+++ /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
---
---
--- File : SALOMEDS_StudyPropertiesAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class StudyPropertiesAttribute from SALOMEDS inherits Attribute from TDF
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- DataSet from TDF,
- RelocationTable from TDF,
- Data from TDF,
- ExtendedString from TCollection,
- HSequenceOfExtendedString from TColStd,
- HSequenceOfInteger from TColStd
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF)
- returns StudyPropertiesAttribute from SALOMEDS;
-
- ---Purpose: Common methods
- -- ============
-
- Create
- returns mutable StudyPropertiesAttribute from SALOMEDS;
-
- Init(me: mutable);
-
- SetUserName(me: mutable; theName : ExtendedString from TCollection);
- GetCreatorName(me) returns ExtendedString from TCollection;
- GetUserNames(me) returns HSequenceOfExtendedString from TColStd;
- SetFirstName(me: mutable; theName : ExtendedString from TCollection);
-
- SetModificationDate(me: mutable; theMinute, theHour, theDay, theMonth, theYear : Integer from Standard);
- GetCreationDate(me; theMinute, theHour, theDay, theMonth, theYear : out Integer from Standard)
- returns Boolean from Standard;
- GetModificationDates(me; theMinutes, theHours, theDays, theMonths, theYears : out HSequenceOfInteger from TColStd);
-
- SetCreationMode(me: mutable; theMode : Integer from Standard);
- GetCreationMode(me) returns Integer from Standard;
-
- SetModified(me: mutable; theModified : Integer from Standard);
- IsModified(me) returns Boolean from Standard;
- GetModified(me) returns Integer from Standard;
-
- SetLocked(me: mutable; theLocked : Boolean from Standard);
- IsLocked(me) returns Boolean from Standard;
- IsLockChanged(me: mutable; theErase : Boolean from Standard) returns Boolean from Standard;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-fields
-
- myUserName : HSequenceOfExtendedString from TColStd;
- myMinute : HSequenceOfInteger from TColStd;
- myHour : HSequenceOfInteger from TColStd;
- myDay : HSequenceOfInteger from TColStd;
- myMonth : HSequenceOfInteger from TColStd;
- myYear : HSequenceOfInteger from TColStd;
- myMode : Integer from Standard;
- myModified : Integer from Standard;
- myLocked : Boolean from Standard;
- myLockChanged : Boolean from Standard;
-
-end StudyPropertiesAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_StudyPropertiesAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include <SALOMEDS_StudyPropertiesAttribute.ixx>
-using namespace std;
-
-const Standard_GUID& SALOMEDS_StudyPropertiesAttribute::GetID()
-{
- static Standard_GUID SALOMEDS_StudyPropertiesAttributeID ("128371A2-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_StudyPropertiesAttributeID;
-}
-
-Handle(SALOMEDS_StudyPropertiesAttribute) SALOMEDS_StudyPropertiesAttribute::Set(const TDF_Label& label)
-{
- Handle(SALOMEDS_StudyPropertiesAttribute) anAttr;
- if (!label.FindAttribute(SALOMEDS_StudyPropertiesAttribute::GetID(),anAttr)) {
- anAttr = new SALOMEDS_StudyPropertiesAttribute();
- label.AddAttribute(anAttr);
- }
- return anAttr;
-}
-
-SALOMEDS_StudyPropertiesAttribute::SALOMEDS_StudyPropertiesAttribute()
-{
- myLocked = Standard_False;
- myLockChanged = Standard_False;
- Init();
-}
-
-void SALOMEDS_StudyPropertiesAttribute::Init()
-{
- myUserName = new TColStd_HSequenceOfExtendedString();
- myMinute = new TColStd_HSequenceOfInteger();
- myHour = new TColStd_HSequenceOfInteger();
- myDay = new TColStd_HSequenceOfInteger();
- myMonth = new TColStd_HSequenceOfInteger();
- myYear = new TColStd_HSequenceOfInteger();
-// myModified = 0;
- myMode = 0; // none
-}
-
-void SALOMEDS_StudyPropertiesAttribute::SetUserName(const TCollection_ExtendedString& theName)
-{
- Backup();
- myUserName->Append(theName);
-}
-
-void SALOMEDS_StudyPropertiesAttribute::SetFirstName(const TCollection_ExtendedString& theName)
-{
- Backup();
- if (myUserName->Length() == 0) myUserName->Append(theName);
- else myUserName->SetValue(1, theName);
-}
-
-TCollection_ExtendedString SALOMEDS_StudyPropertiesAttribute::GetCreatorName() const
-{
- if (myUserName->Length() == 0) return TCollection_ExtendedString("");
- return myUserName->Value(1);
-}
-
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDS_StudyPropertiesAttribute::GetUserNames() const
-{
- return myUserName;
-}
-
-void SALOMEDS_StudyPropertiesAttribute::SetModificationDate(const Standard_Integer theMinute,
- const Standard_Integer theHour,
- const Standard_Integer theDay,
- const Standard_Integer theMonth,
- const Standard_Integer theYear)
-{
- Backup();
- if (theMinute<0 || theMinute>60 || theHour<0 || theHour>24 || theDay<0 || theDay>31 || theMonth<0 || theMonth>12)
- return;
- myMinute->Append(theMinute);
- myHour->Append(theHour);
- myDay->Append(theDay);
- myMonth->Append(theMonth);
- myYear->Append(theYear);
-}
-
-Standard_Boolean SALOMEDS_StudyPropertiesAttribute::GetCreationDate(Standard_Integer& theMinute,
- Standard_Integer& theHour,
- Standard_Integer& theDay,
- Standard_Integer& theMonth,
- Standard_Integer& theYear) const
-{
- if (myMinute->Length() != 0) {
- theMinute = myMinute->Value(1);
- theHour = myHour->Value(1);
- theDay = myDay->Value(1);
- theMonth = myMonth->Value(1);
- theYear = myYear->Value(1);
- return Standard_True;
- }
- return Standard_False;
-}
-
-void SALOMEDS_StudyPropertiesAttribute::GetModificationDates(Handle(TColStd_HSequenceOfInteger)& theMinutes,
- Handle(TColStd_HSequenceOfInteger)& theHours,
- Handle(TColStd_HSequenceOfInteger)& theDays,
- Handle(TColStd_HSequenceOfInteger)& theMonths,
- Handle(TColStd_HSequenceOfInteger)& theYears) const
-{
- theMinutes = myMinute;
- theHours = myHour;
- theDays = myDay;
- theMonths = myMonth;
- theYears = myYear;
-}
-
-void SALOMEDS_StudyPropertiesAttribute::SetCreationMode(const Standard_Integer theMode)
-{
- Backup();
- myMode = theMode;
-}
-
-Standard_Integer SALOMEDS_StudyPropertiesAttribute::GetCreationMode() const
-{
- return myMode;
-}
-
-void SALOMEDS_StudyPropertiesAttribute::SetModified(const Standard_Integer theModified)
-{
- myModified = theModified;
-}
-
-Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsModified() const
-{
- return (myModified != 0);
-}
-
-Standard_Integer SALOMEDS_StudyPropertiesAttribute::GetModified() const
-{
- return myModified;
-}
-
-void SALOMEDS_StudyPropertiesAttribute::SetLocked(const Standard_Boolean theLocked)
-{
-// Backup();
- if (myLocked != theLocked) {
- myLockChanged = Standard_True;
- myLocked = theLocked;
- }
-}
-
-Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsLocked() const
-{
- return myLocked;
-}
-
-Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsLockChanged(const Standard_Boolean theErase) {
- if (!myLockChanged) return Standard_False;
- if (theErase) myLockChanged = Standard_False;
- return Standard_True;
-}
-
-const Standard_GUID& SALOMEDS_StudyPropertiesAttribute::ID() const
-{
- return GetID();
-}
-
-void SALOMEDS_StudyPropertiesAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(with);
- Init();
- Standard_Integer i;
- Handle(TColStd_HSequenceOfExtendedString) aNames = aProp->GetUserNames();
- for(i = aNames->Length(); i > 0; i--) {
- myUserName->Prepend(aNames->Value(i));
- }
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
- aProp->GetModificationDates(aMinutes, aHours, aDays, aMonths, aYears);
- for(i = aMinutes->Length(); i > 0; i--) {
- myMinute->Prepend(aMinutes->Value(i));
- myHour->Prepend(aHours->Value(i));
- myDay->Prepend(aDays->Value(i));
- myMonth->Prepend(aMonths->Value(i));
- myYear->Prepend(aYears->Value(i));
- }
- myMode = aProp->GetCreationMode();
-// myModified = aProp->GetModified();
-// myLocked = aProp->IsLocked();
-}
-
-Handle(TDF_Attribute) SALOMEDS_StudyPropertiesAttribute::NewEmpty() const
-{
- return new SALOMEDS_StudyPropertiesAttribute();
-}
-
-void SALOMEDS_StudyPropertiesAttribute::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
-{
- Handle(SALOMEDS_StudyPropertiesAttribute) aProp = Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(into);
- aProp->Init();
-
- Standard_Integer i;
- for(i = 1; i <= myUserName->Length(); i++) {
- aProp->SetUserName(myUserName->Value(i));
- }
- for(i = 1; i <= myMinute->Length(); i++) {
- aProp->SetModificationDate(myMinute->Value(i), myHour->Value(i), myDay->Value(i), myMonth->Value(i), myYear->Value(i));
- }
-
- aProp->SetCreationMode(myMode);
-// aProp->SetModified(myModified);
-// aProp->SetLocked(myLocked);
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_StudyPropertiesAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_StudyPropertiesAttribute_HeaderFile
-#define _SALOMEDS_StudyPropertiesAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_StudyPropertiesAttribute_HeaderFile
-#include <Handle_SALOMEDS_StudyPropertiesAttribute.hxx>
-#endif
-
-#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile
-#include <Handle_TColStd_HSequenceOfExtendedString.hxx>
-#endif
-#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile
-#include <Handle_TColStd_HSequenceOfInteger.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class TColStd_HSequenceOfExtendedString;
-class TColStd_HSequenceOfInteger;
-class Standard_GUID;
-class TDF_Label;
-class TCollection_ExtendedString;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_StudyPropertiesAttribute : public TDF_Attribute {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_StudyPropertiesAttribute Set(const TDF_Label& label) ;
-Standard_EXPORT SALOMEDS_StudyPropertiesAttribute();
-Standard_EXPORT void Init() ;
-Standard_EXPORT void SetUserName(const TCollection_ExtendedString& theName) ;
-Standard_EXPORT void SetFirstName(const TCollection_ExtendedString& theName) ;
-Standard_EXPORT TCollection_ExtendedString GetCreatorName() const;
-Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetUserNames() const;
-Standard_EXPORT void SetModificationDate(const Standard_Integer theMinute,const Standard_Integer theHour,const Standard_Integer theDay,const Standard_Integer theMonth,const Standard_Integer theYear) ;
-Standard_EXPORT Standard_Boolean GetCreationDate(Standard_Integer& theMinute,Standard_Integer& theHour,Standard_Integer& theDay,Standard_Integer& theMonth,Standard_Integer& theYear) const;
-Standard_EXPORT void GetModificationDates(Handle(TColStd_HSequenceOfInteger)& theMinutes,Handle(TColStd_HSequenceOfInteger)& theHours,Handle(TColStd_HSequenceOfInteger)& theDays,Handle(TColStd_HSequenceOfInteger)& theMonths,Handle(TColStd_HSequenceOfInteger)& theYears) const;
-Standard_EXPORT void SetCreationMode(const Standard_Integer theMode) ;
-Standard_EXPORT Standard_Integer GetCreationMode() const;
-Standard_EXPORT void SetModified(const Standard_Integer theModified) ;
-Standard_EXPORT Standard_Boolean IsModified() const;
-Standard_EXPORT Standard_Integer GetModified() const;
-Standard_EXPORT void SetLocked(const Standard_Boolean theLocked) ;
-Standard_EXPORT Standard_Boolean IsLocked() const;
-Standard_EXPORT Standard_Boolean IsLockChanged(const Standard_Boolean theErase) ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_StudyPropertiesAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_StudyPropertiesAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Handle_TColStd_HSequenceOfExtendedString myUserName;
-Handle_TColStd_HSequenceOfInteger myMinute;
-Handle_TColStd_HSequenceOfInteger myHour;
-Handle_TColStd_HSequenceOfInteger myDay;
-Handle_TColStd_HSequenceOfInteger myMonth;
-Handle_TColStd_HSequenceOfInteger myYear;
-Standard_Integer myMode;
-Standard_Integer myModified;
-Standard_Boolean myLocked;
-Standard_Boolean myLockChanged;
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_StudyPropertiesAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include <SALOMEDS_StudyPropertiesAttribute.jxx>
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_StudyPropertiesAttribute::~SALOMEDS_StudyPropertiesAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_StudyPropertiesAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_StudyPropertiesAttribute",
- sizeof(SALOMEDS_StudyPropertiesAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_StudyPropertiesAttribute) Handle(SALOMEDS_StudyPropertiesAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_StudyPropertiesAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute))) {
- _anOtherObject = Handle(SALOMEDS_StudyPropertiesAttribute)((Handle(SALOMEDS_StudyPropertiesAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_StudyPropertiesAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute) ;
-}
-Standard_Boolean SALOMEDS_StudyPropertiesAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_StudyPropertiesAttribute) == AType || TDF_Attribute::IsKind(AType));
-}
-Handle_SALOMEDS_StudyPropertiesAttribute::~Handle_SALOMEDS_StudyPropertiesAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_StudyPropertiesAttribute.jxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#endif
-#ifndef _TColStd_HSequenceOfInteger_HeaderFile
-#include <TColStd_HSequenceOfInteger.hxx>
-#endif
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_StudyPropertiesAttribute_HeaderFile
-#include <SALOMEDS_StudyPropertiesAttribute.hxx>
-#endif
#include "SALOMEDSImpl_ChildIterator.hxx"
#include "SALOMEDSImpl_IParameters.hxx"
-#include <TColStd_SequenceOfExtendedString.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-#include <TDF_Label.hxx>
-#include <TDF_Attribute.hxx>
+#include "DF_Label.hxx"
+#include "DF_Attribute.hxx"
#ifdef WIN32
#include <process.h>
* Purpose : SALOMEDS_Study_i constructor
*/
//============================================================================
-SALOMEDS_Study_i::SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study) theImpl,
+SALOMEDS_Study_i::SALOMEDS_Study_i(SALOMEDSImpl_Study* theImpl,
CORBA::ORB_ptr orb)
{
_orb = CORBA::ORB::_duplicate(orb);
char* SALOMEDS_Study_i::GetPersistentReference()
{
SALOMEDS::Locker lock;
- return CORBA::string_dup(_impl->GetPersistentReference().ToCString());
+ return CORBA::string_dup(_impl->GetPersistentReference().c_str());
}
//============================================================================
/*! Function : GetTransientReference
char* SALOMEDS_Study_i::GetTransientReference()
{
SALOMEDS::Locker lock;
- return CORBA::string_dup(_impl->GetTransientReference().ToCString());
+ return CORBA::string_dup(_impl->GetTransientReference().c_str());
}
//============================================================================
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SComponent) aCompImpl = _impl->FindComponent(TCollection_AsciiString((char*)aComponentName));
+ SALOMEDSImpl_SComponent aCompImpl = _impl->FindComponent(string(aComponentName));
if(aCompImpl.IsNull()) return SALOMEDS::SComponent::_nil();
SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aCompImpl, _orb);
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SComponent) aCompImpl = _impl->FindComponentID(TCollection_AsciiString((char*)aComponentID));
+ SALOMEDSImpl_SComponent aCompImpl = _impl->FindComponentID(string((char*)aComponentID));
if(aCompImpl.IsNull()) return SALOMEDS::SComponent::_nil();
SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aCompImpl, _orb);
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObject(TCollection_AsciiString((char*)anObjectName));
+ SALOMEDSImpl_SObject aSO = _impl->FindObject(string((char*)anObjectName));
if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
- if(aSO->DynamicType() == STANDARD_TYPE(SALOMEDSImpl_SComponent)) {
- Handle(SALOMEDSImpl_SComponent) aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(aSO);
+ if(aSO.IsComponent()) {
+ SALOMEDSImpl_SComponent aSCO = aSO;
SALOMEDS::SComponent_var sco = SALOMEDS_SComponent_i::New (aSCO, _orb);
return sco._retn();
}
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectID(TCollection_AsciiString((char*)anObjectID));
+ SALOMEDSImpl_SObject aSO = _impl->FindObjectID(string((char*)anObjectID));
if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
return so._retn();
if(!anObjectID || strlen(anObjectID) == 0) return SALOMEDS::SObject::_nil();
- Handle(SALOMEDSImpl_SObject) aSO = _impl->CreateObjectID((char*)anObjectID);
+ SALOMEDSImpl_SObject aSO = _impl->CreateObjectID((char*)anObjectID);
if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
{
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfTransient) aSeq = _impl->FindObjectByName(TCollection_AsciiString((char*)anObjectName),
- TCollection_AsciiString((char*)aComponentName));
- int aLength = aSeq->Length();
+ vector<SALOMEDSImpl_SObject> aSeq = _impl->FindObjectByName(string((char*)anObjectName),
+ string((char*)aComponentName));
+ int aLength = aSeq.size();
SALOMEDS::Study::ListOfSObject_var listSO = new SALOMEDS::Study::ListOfSObject ;
listSO->length(aLength);
- for(int i = 1; i<=aLength; i++) {
- Handle(SALOMEDSImpl_SObject) aSO = Handle(SALOMEDSImpl_SObject)::DownCast(aSeq->Value(i));
- SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
- listSO[i-1] = so ;
+ for(int i = 0; i<aLength; i++) {
+ SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSeq[i], _orb);
+ listSO[i] = so ;
}
return listSO._retn() ;
}
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectIOR(TCollection_AsciiString((char*)anObjectIOR));
+ SALOMEDSImpl_SObject aSO = _impl->FindObjectIOR(string((char*)anObjectIOR));
if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO = _impl->FindObjectByPath(TCollection_AsciiString((char*)thePath));
+ SALOMEDSImpl_SObject aSO = _impl->FindObjectByPath(string((char*)thePath));
if(aSO.IsNull()) return SALOMEDS::SObject::_nil();
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
{
SALOMEDS::Locker lock;
- TCollection_AsciiString aPath("");
- if(CORBA::is_nil(theObject)) return CORBA::string_dup(aPath.ToCString());
- Handle(SALOMEDSImpl_SObject) aSO;
+ string aPath("");
+ if(CORBA::is_nil(theObject)) return CORBA::string_dup(aPath.c_str());
+ SALOMEDSImpl_SObject aSO;
SALOMEDS::SObject_var aSObj = SALOMEDS::SObject::_narrow(theObject);
if(!CORBA::is_nil(aSObj)) {
aSO = _impl->FindObjectIOR(_orb->object_to_string(theObject));
}
- if(aSO.IsNull()) return CORBA::string_dup(aPath.ToCString());
+ if(aSO.IsNull()) return CORBA::string_dup(aPath.c_str());
aPath = _impl->GetObjectPath(aSO);
- return CORBA::string_dup(aPath.ToCString());
+ return CORBA::string_dup(aPath.c_str());
}
{
SALOMEDS::Locker lock;
- _impl->SetContext(TCollection_AsciiString((char*)thePath));
+ _impl->SetContext(string((char*)thePath));
if(_impl->IsError() && _impl->GetErrorCode() == "InvalidContext")
throw SALOMEDS::Study::StudyInvalidContext();
}
char* SALOMEDS_Study_i::GetContext()
{
SALOMEDS::Locker lock;
-
+
if(!_impl->HasCurrentContext()) throw SALOMEDS::Study::StudyInvalidContext();
- return CORBA::string_dup(_impl->GetContext().ToCString());
+ return CORBA::string_dup(_impl->GetContext().c_str());
}
//============================================================================
if (strlen(theContext) == 0 && !_impl->HasCurrentContext())
throw SALOMEDS::Study::StudyInvalidContext();
- Handle(TColStd_HSequenceOfAsciiString) aSeq =
- _impl->GetObjectNames(TCollection_AsciiString((char*)theContext));
+ vector<string> aSeq = _impl->GetObjectNames(string((char*)theContext));
if (_impl->GetErrorCode() == "InvalidContext")
throw SALOMEDS::Study::StudyInvalidContext();
- int aLength = aSeq->Length();
+ int aLength = aSeq.size();
aResult->length(aLength);
- for (int anIndex = 1; anIndex <= aLength; anIndex++) {
- aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
+ for (int anIndex = 0; anIndex < aLength; anIndex++) {
+ aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str());
}
return aResult._retn();
if (strlen(theContext) == 0 && !_impl->HasCurrentContext())
throw SALOMEDS::Study::StudyInvalidContext();
- Handle(TColStd_HSequenceOfAsciiString) aSeq =
- _impl->GetDirectoryNames(TCollection_AsciiString((char*)theContext));
+ vector<string> aSeq = _impl->GetDirectoryNames(string((char*)theContext));
if (_impl->GetErrorCode() == "InvalidContext")
throw SALOMEDS::Study::StudyInvalidContext();
- int aLength = aSeq->Length();
+ int aLength = aSeq.size();
aResult->length(aLength);
- for (int anIndex = 1; anIndex <= aLength; anIndex++) {
- aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
+ for (int anIndex = 0; anIndex < aLength; anIndex++) {
+ aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str());
}
return aResult._retn();
if (strlen(theContext) == 0 && !_impl->HasCurrentContext())
throw SALOMEDS::Study::StudyInvalidContext();
- Handle(TColStd_HSequenceOfAsciiString) aSeq =
- _impl->GetFileNames(TCollection_AsciiString((char*)theContext));
+ vector<string> aSeq = _impl->GetFileNames(string((char*)theContext));
if (_impl->GetErrorCode() == "InvalidContext")
throw SALOMEDS::Study::StudyInvalidContext();
- int aLength = aSeq->Length();
+ int aLength = aSeq.size();
aResult->length(aLength);
- for (int anIndex = 1; anIndex <= aLength; anIndex++) {
- aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
+ for (int anIndex = 0; anIndex < aLength; anIndex++) {
+ aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str());
}
return aResult._retn();
SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
- Handle(TColStd_HSequenceOfAsciiString) aSeq =
- _impl->GetComponentNames(TCollection_AsciiString((char*)theContext));
+ vector<string> aSeq = _impl->GetComponentNames(string((char*)theContext));
- int aLength = aSeq->Length();
+ int aLength = aSeq.size();
aResult->length(aLength);
- for(int anIndex = 1; anIndex <= aLength; anIndex++) {
- aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
+ for(int anIndex = 0; anIndex < aLength; anIndex++) {
+ aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str());
}
return aResult._retn();
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO = _impl->GetSObject(theSO->GetID());
- Handle(SALOMEDSImpl_ChildIterator) anItr = new SALOMEDSImpl_ChildIterator(aSO);
+ SALOMEDSImpl_SObject aSO = _impl->GetSObject(theSO->GetID());
+ SALOMEDSImpl_ChildIterator anItr(aSO);
//Create iterator
SALOMEDS_ChildIterator_i* it_servant = new SALOMEDS_ChildIterator_i(anItr, _orb);
char* SALOMEDS_Study_i::Name()
{
SALOMEDS::Locker lock;
- return CORBA::string_dup(_impl->Name().ToCString());
+ return CORBA::string_dup(_impl->Name().c_str());
}
//============================================================================
void SALOMEDS_Study_i::Name(const char* name)
{
SALOMEDS::Locker lock;
- _impl->Name(TCollection_AsciiString((char*)name));
+ _impl->Name(string((char*)name));
}
//============================================================================
return _impl->IsModified();
}
+//============================================================================
+/*! Function : Modified
+ * Purpose : Sets a Modified flag of a Study to True
+ */
+//============================================================================
+void SALOMEDS_Study_i::Modified()
+{
+ SALOMEDS::Locker lock;
+ return _impl->Modify();
+}
+
+
//============================================================================
/*! Function : URL
* Purpose : get URL of the study (persistent reference of the study)
char* SALOMEDS_Study_i::URL()
{
SALOMEDS::Locker lock;
- return CORBA::string_dup(_impl->URL().ToCString());
+ return CORBA::string_dup(_impl->URL().c_str());
}
//============================================================================
void SALOMEDS_Study_i::URL(const char* url)
{
SALOMEDS::Locker lock;
- _impl->URL(TCollection_AsciiString((char*)url));
+ _impl->URL(string((char*)url));
}
void SALOMEDS_Study_i::UpdateIORLabelMap(const char* anIOR,const char* anEntry)
{
SALOMEDS::Locker lock;
- _impl->UpdateIORLabelMap(TCollection_AsciiString((char*)anIOR), TCollection_AsciiString((char*)anEntry));
+ _impl->UpdateIORLabelMap(string((char*)anIOR), string((char*)anEntry));
}
-SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb)
+SALOMEDS::Study_ptr SALOMEDS_Study_i::GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb)
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeIOR) Att;
- if (theLabel.Root().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),Att)){
- char* IOR = CORBA::string_dup(TCollection_AsciiString(Att->Value()).ToCString());
+ SALOMEDSImpl_AttributeIOR* Att = NULL;
+ if ((Att=(SALOMEDSImpl_AttributeIOR*)theLabel.Root().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))){
+ char* IOR = CORBA::string_dup(Att->Value().c_str());
CORBA::Object_var obj = orb->string_to_object(IOR);
SALOMEDS::Study_ptr aStudy = SALOMEDS::Study::_narrow(obj) ;
ASSERT(!CORBA::is_nil(aStudy));
return SALOMEDS::Study::_nil();
}
-void SALOMEDS_Study_i::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute)
+void SALOMEDS_Study_i::IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute)
{
SALOMEDS::Locker lock;
SALOMEDSImpl_Study::IORUpdated(theAttribute);
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr = _impl->GetProperties();
+ SALOMEDSImpl_AttributeStudyProperties* anAttr = _impl->GetProperties();
SALOMEDS_AttributeStudyProperties_i* SP = new SALOMEDS_AttributeStudyProperties_i(anAttr, _orb);
return SP->AttributeStudyProperties::_this();
}
char* SALOMEDS_Study_i::GetLastModificationDate()
{
SALOMEDS::Locker lock;
- return CORBA::string_dup(_impl->GetLastModificationDate().ToCString());
+ return CORBA::string_dup(_impl->GetLastModificationDate().c_str());
}
SALOMEDS::ListOfDates* SALOMEDS_Study_i::GetModificationsDate()
{
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetModificationsDate();
- int aLength = aSeq->Length();
+ vector<string> aSeq = _impl->GetModificationsDate();
+ int aLength = aSeq.size();
SALOMEDS::ListOfDates_var aDates = new SALOMEDS::ListOfDates;
aDates->length(aLength);
- for(int anIndex = 1; anIndex <= aLength; anIndex++) {
- aDates[anIndex-1] = CORBA::string_dup(aSeq->Value(anIndex).ToCString());
+ for(int anIndex = 0; anIndex < aLength; anIndex++) {
+ aDates[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str());
}
return aDates._retn();
}
void SALOMEDS_Study_i::Close()
{
SALOMEDS::Locker lock;
-
+
RemovePostponed(-1);
SALOMEDS::SComponentIterator_var itcomponent = NewComponentIterator();
-
for (; itcomponent->More(); itcomponent->Next()) {
SALOMEDS::SComponent_var sco = itcomponent->Value();
-
MESSAGE ( "Look for an engine for data type :"<< sco->ComponentDataType());
// if there is an associated Engine call its method for closing
CORBA::String_var IOREngine;
}
}
}
+
_impl->Close();
}
void SALOMEDS_Study_i::AddPostponed(const char* theIOR)
{
SALOMEDS::Locker lock;
-
- CORBA::Object_var obj = _orb->string_to_object(theIOR);
- if (!CORBA::is_nil(obj)) {
- SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ;
- if (!CORBA::is_nil(aGeneric)) _impl->AddPostponed((char*)theIOR);
- }
+ //Not implemented
}
void SALOMEDS_Study_i::AddCreatedPostponed(const char* theIOR)
{
SALOMEDS::Locker lock;
-
- CORBA::Object_var obj = _orb->string_to_object(theIOR);
- if (!CORBA::is_nil(obj)) {
- SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj) ;
- if (!CORBA::is_nil(aGeneric)) _impl->AddCreatedPostponed((char*)theIOR);
- }
+ //Not implemented
}
//============================================================================
*/
//============================================================================
#ifndef WNT
-void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long theUndoLimit)
+void SALOMEDS_Study_i::RemovePostponed(const CORBA::Long /*theUndoLimit*/)
#else
-void SALOMEDS_Study_i::RemovePostponed(CORBA::Long theUndoLimit)
+void SALOMEDS_Study_i::RemovePostponed(CORBA::Long /*theUndoLimit*/)
#endif
{
SALOMEDS::Locker lock;
- Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->RemovePostponed(theUndoLimit);
- int aLegth = aSeq->Length();
- for(int i = 1; i <= aLegth; i++) {
- TCollection_AsciiString anIOR = aSeq->Value(i);
- //mkr : fix for bug IPAL9408 : check the length of anIOR
- // before take value from it
- if ( !anIOR.IsEmpty() && anIOR.Value(1) == 'c') {
- CORBA::Object_var obj = _orb->string_to_object(anIOR.Split(1).ToCString());
- SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
- if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
- }
- else if ( !anIOR.IsEmpty() && anIOR.Value(1) == 'd') {
- CORBA::Object_var obj = _orb->string_to_object(anIOR.Split(1).ToCString());
+ vector<string> anIORs = _impl->GetIORs();
+ int i, aSize = (int)anIORs.size();
+
+ for(i = 0; i < aSize; i++) {
+ try {
+ CORBA::Object_var obj = _orb->string_to_object(anIORs[i].c_str());
SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
- }
- else {
- try {
- CORBA::Object_var obj = _orb->string_to_object(anIOR.ToCString());
- SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj);
- if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy();
- } catch (...) {}
- }
+ } catch (...) {}
}
+
+ //Not implemented
}
//============================================================================
#endif
{
SALOMEDS::Locker lock;
-
- _impl->UndoPostponed(theWay);
+ //Not implemented
}
{
SALOMEDS::Locker lock;
- TCollection_AsciiString aPath((char*)thePath), aBaseName((char*)theBaseName);
+ string aPath((char*)thePath), aBaseName((char*)theBaseName);
SALOMEDS_DriverFactory_i* factory = new SALOMEDS_DriverFactory_i(_orb);
CORBA::Boolean ret = _impl->DumpStudy(aPath, aBaseName, isPublished, factory);
delete factory;
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter) anAttr = _impl->GetCommonParameters(theID, theSavePoint);
+ SALOMEDSImpl_AttributeParameter* anAttr = _impl->GetCommonParameters(theID, theSavePoint);
SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb);
return SP->AttributeParameter::_this();
}
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_AttributeParameter) anAttr = _impl->GetModuleParameters(theID, theModuleName, theSavePoint);
+ SALOMEDSImpl_AttributeParameter* anAttr = _impl->GetModuleParameters(theID, theModuleName, theSavePoint);
SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb);
return SP->AttributeParameter::_this();
}
SALOMEDS::ListOfStrings_var aResult = new SALOMEDS::ListOfStrings;
- Handle(TColStd_HSequenceOfAsciiString) aSeq = _impl->GetLockerID();
+ vector<string> aSeq = _impl->GetLockerID();
- int aLength = aSeq->Length();
+ int aLength = aSeq.size();
aResult->length(aLength);
- for(int anIndex = 1; anIndex <= aLength; anIndex++) {
- aResult[anIndex-1] = CORBA::string_dup(TCollection_AsciiString(aSeq->Value(anIndex)).ToCString());
+ for(int anIndex = 0; anIndex < aLength; anIndex++) {
+ aResult[anIndex] = CORBA::string_dup(aSeq[anIndex].c_str());
}
return aResult._retn();
}
void SALOMEDS_Study_i::EnableUseCaseAutoFilling(CORBA::Boolean isEnabled)
{
_impl->EnableUseCaseAutoFilling(isEnabled);
- Handle(SALOMEDSImpl_StudyBuilder) builder = _builder->GetImpl();
- if(!builder.IsNull()) {
+ SALOMEDSImpl_StudyBuilder* builder = _builder->GetImpl();
+ if(builder) {
if(isEnabled) {
builder->SetOnAddSObject(_impl->GetCallback());
builder->SetOnRemoveSObject(_impl->GetCallback());
long pid = (long)getpid();
#endif
isLocal = (strcmp(theHostname, GetHostname().c_str()) == 0 && pid == thePID)?1:0;
- SALOMEDSImpl_Study* local_impl = _impl.operator->();
- return ((CORBA::LongLong)local_impl);
+ return ((CORBA::LongLong)_impl);
}
{
private:
CORBA::ORB_ptr _orb;
- Handle(SALOMEDSImpl_Study) _impl;
+ SALOMEDSImpl_Study* _impl;
SALOMEDS_StudyBuilder_i* _builder;
public:
//! standard constructor
- SALOMEDS_Study_i(const Handle(SALOMEDSImpl_Study), CORBA::ORB_ptr);
+ SALOMEDS_Study_i(SALOMEDSImpl_Study*, CORBA::ORB_ptr);
//! standard destructor
virtual ~SALOMEDS_Study_i();
*/
virtual CORBA::Boolean IsModified();
+ //! method to set Modified flag of a Study to True
+ virtual void Modified();
+
//! method to get URL of the study (idem GetPersistentReference)
/*!
\return char* arguments, the study URL
virtual CORBA::Short StudyId();
virtual void StudyId(CORBA::Short id);
- static SALOMEDS::Study_ptr GetStudy(const TDF_Label theLabel, CORBA::ORB_ptr orb);
+ static SALOMEDS::Study_ptr GetStudy(const DF_Label& theLabel, CORBA::ORB_ptr orb);
- static void IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR) theAttribute);
+ static void IORUpdated(SALOMEDSImpl_AttributeIOR* theAttribute);
virtual void UpdateIORLabelMap(const char* anIOR, const char* aLabel);
virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished);
- virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; }
+ virtual SALOMEDSImpl_Study* GetImpl() { return _impl; }
virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
};
#include "SALOMEDS_TMPFile_i.hxx"
-#include <Handle_Standard_Type.hxx>
-#include <Standard_Transient.hxx>
-
#include <stdexcept>
-
-IMPLEMENT_STANDARD_HANDLE( SALOMEDS_TMPFile_i, SALOMEDSImpl_TMPFile )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDS_TMPFile_i, SALOMEDSImpl_TMPFile )
-
SALOMEDS_TMPFile_i
::SALOMEDS_TMPFile_i(SALOMEDS::TMPFile* theStream):
myStream(theStream)
//-----------------------------------------------------------------------------
-IMPLEMENT_STANDARD_HANDLE( Engines_TMPFile_i, SALOMEDSImpl_TMPFile )
-IMPLEMENT_STANDARD_RTTIEXT( Engines_TMPFile_i, SALOMEDSImpl_TMPFile )
-
Engines_TMPFile_i
::Engines_TMPFile_i(Engines::TMPFile* theStream):
myStream(theStream)
//-----------------------------------------------------------------------------
-DEFINE_STANDARD_HANDLE( SALOMEDS_TMPFile_i, SALOMEDSImpl_TMPFile );
class SALOMEDS_TMPFile_i : public SALOMEDSImpl_TMPFile
{
virtual TOctet& Get(size_t);
- DEFINE_STANDARD_RTTI( SALOMEDS_TMPFile_i );
-
protected:
SALOMEDS::TMPFile_var myStream;
};
//-----------------------------------------------------------------------------
-DEFINE_STANDARD_HANDLE( Engines_TMPFile_i, SALOMEDSImpl_TMPFile );
class Engines_TMPFile_i : public SALOMEDSImpl_TMPFile
{
virtual TOctet& Get(size_t);
- DEFINE_STANDARD_RTTI( Engines_TMPFile_i );
-
protected:
Engines::TMPFile_var myStream;
};
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_TableOfIntegerAttribute.cxx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#include <SALOMEDS_TableOfIntegerAttribute.ixx>
-#include <Standard_Failure.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
-
-#include <string>
-using namespace std;
-
-const Standard_GUID& SALOMEDS_TableOfIntegerAttribute::GetID()
-{
- static Standard_GUID SALOMEDS_TableOfIntegerAttributeID ("128371A0-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_TableOfIntegerAttributeID;
-}
-
-Handle(SALOMEDS_TableOfIntegerAttribute) SALOMEDS_TableOfIntegerAttribute::Set(const TDF_Label& label)
-{
- Handle(SALOMEDS_TableOfIntegerAttribute) anAttr;
- if (!label.FindAttribute(SALOMEDS_TableOfIntegerAttribute::GetID(),anAttr)) {
- anAttr = new SALOMEDS_TableOfIntegerAttribute();
- label.AddAttribute(anAttr);
- }
- return anAttr;
-}
-
-SALOMEDS_TableOfIntegerAttribute::SALOMEDS_TableOfIntegerAttribute() {
- myRows = new TColStd_HSequenceOfExtendedString();
- myCols = new TColStd_HSequenceOfExtendedString();
- myNbRows = 0;
- myNbColumns = 0;
-}
-
-void SALOMEDS_TableOfIntegerAttribute::SetNbColumns(const Standard_Integer theNbColumns)
-{
- Backup();
-
- TColStd_DataMapOfIntegerInteger aMap;
- aMap = myTable;
- myTable.Clear();
-
- TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIterator(aMap);
- for(; anIterator.More(); anIterator.Next()) {
- int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
- int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
- if(aCol == 0) { aCol = myNbColumns; aRow--; }
- if(aCol > theNbColumns) continue;
- int aKey = (aRow-1)*theNbColumns+aCol;
- myTable.Bind(aKey, anIterator.Value());
- }
-
- myNbColumns = theNbColumns;
-
- while (myCols->Length() < myNbColumns) { // append empty columns titles
- myCols->Append(TCollection_ExtendedString(""));
- }
-}
-
-void SALOMEDS_TableOfIntegerAttribute::SetTitle(const TCollection_ExtendedString& theTitle) {
- Backup();
- myTitle = theTitle;
-}
-
-TCollection_ExtendedString SALOMEDS_TableOfIntegerAttribute::GetTitle() const {
- return myTitle;
-}
-
-void SALOMEDS_TableOfIntegerAttribute::SetRowData(const Standard_Integer theRow,
- const Handle(TColStd_HSequenceOfInteger)& theData)
-{
- if(theData->Length() > myNbColumns) SetNbColumns(theData->Length());
-
- Backup();
-
- while (myRows->Length() < theRow) { // append new row titles
- myRows->Append(TCollection_ExtendedString(""));
- }
-
- Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length();
- for(i = 1; i <= aLength; i++) {
- myTable.Bind(aShift + i, theData->Value(i));
- }
-
- if(theRow > myNbRows) myNbRows = theRow;
-}
-
-Handle(TColStd_HSequenceOfInteger) SALOMEDS_TableOfIntegerAttribute::GetRowData(const Standard_Integer theRow)
-{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger();
- Standard_Integer i, aShift = (theRow-1)*myNbColumns;
- for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift+i))
- aSeq->Append(myTable.Find(aShift+i));
- else
- aSeq->Append(0);
- }
-
- return aSeq;
-}
-
-void SALOMEDS_TableOfIntegerAttribute::SetRowTitle(const Standard_Integer theRow,
- const TCollection_ExtendedString& theTitle) {
- Backup();
- myRows->SetValue(theRow,theTitle);
-}
-
-TCollection_ExtendedString SALOMEDS_TableOfIntegerAttribute::GetRowTitle(const Standard_Integer theRow) const {
- return myRows->Value(theRow);
-}
-
-
-void SALOMEDS_TableOfIntegerAttribute::SetColumnData(const Standard_Integer theColumn,
- const Handle(TColStd_HSequenceOfInteger)& theData)
-{
- if(theColumn > myNbColumns) SetNbColumns(theColumn);
-
- Backup();
-
- Standard_Integer i, aLength = theData->Length();
- for(i = 1; i <= aLength; i++) {
- myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i));
- }
-
- if(aLength > myNbRows) {
- myNbRows = aLength;
- while (myRows->Length() < myNbRows) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
- }
- }
-}
-
-
-Handle(TColStd_HSequenceOfInteger) SALOMEDS_TableOfIntegerAttribute::GetColumnData(const Standard_Integer theColumn)
-{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
-
- Standard_Integer i, anIndex;
- for(i = 1; i <= myNbRows; i++) {
- anIndex = myNbColumns*(i-1) + theColumn;
- if(myTable.IsBound(anIndex))
- aSeq->Append(myTable.Find(anIndex));
- else
- aSeq->Append(0);
- }
-
- return aSeq;
-}
-
-void SALOMEDS_TableOfIntegerAttribute::SetColumnTitle(const Standard_Integer theColumn,
- const TCollection_ExtendedString& theTitle) {
- Backup();
- while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString(""));
- myCols->SetValue(theColumn,theTitle);
-}
-
-TCollection_ExtendedString SALOMEDS_TableOfIntegerAttribute::GetColumnTitle(const Standard_Integer theColumn) const {
- if(myCols.IsNull()) return "";
- if(myCols->Length() < theColumn) return "";
- return myCols->Value(theColumn);
-}
-
-
-Standard_Integer SALOMEDS_TableOfIntegerAttribute::GetNbRows() const
-{
- return myNbRows;
-}
-
-Standard_Integer SALOMEDS_TableOfIntegerAttribute::GetNbColumns() const
-{
- return myNbColumns;
-}
-
-void SALOMEDS_TableOfIntegerAttribute::PutValue(const Standard_Integer theValue,
- const Standard_Integer theRow,
- const Standard_Integer theColumn)
-{
- if(theColumn > myNbColumns) SetNbColumns(theColumn);
-
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- myTable.Bind(anIndex, theValue);
-
- if(theRow > myNbRows) {
- while (myRows->Length() < theRow) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
- }
- myNbRows = theRow;
- }
-}
-
-Standard_Boolean SALOMEDS_TableOfIntegerAttribute::HasValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
-{
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- return myTable.IsBound(anIndex);
-}
-
-Standard_Integer SALOMEDS_TableOfIntegerAttribute::GetValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
-{
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- if(myTable.IsBound(anIndex)) return myTable.Find(anIndex);
-
- Standard_Failure::Raise("Invalid cell index");
- return 0;
-}
-
-const Standard_GUID& SALOMEDS_TableOfIntegerAttribute::ID() const
-{
- return GetID();
-}
-
-void SALOMEDS_TableOfIntegerAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Standard_Integer anIndex;
- Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(with);
-
- myTable.Clear();
- myCols->Clear();
- myRows->Clear();
-
- myTable = aTable->myTable;
- myNbRows = aTable->myNbRows;
- myNbColumns = aTable->myNbColumns;
- myTitle = aTable->myTitle;
-
- for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
- myRows->Append(aTable->GetRowTitle(anIndex));
-
- for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++)
- myCols->Append(aTable->GetColumnTitle(anIndex));
-}
-
-Handle(TDF_Attribute) SALOMEDS_TableOfIntegerAttribute::NewEmpty() const
-{
- return new SALOMEDS_TableOfIntegerAttribute();
-}
-
-void SALOMEDS_TableOfIntegerAttribute::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
-{
- Standard_Integer anIndex;
- Handle(SALOMEDS_TableOfIntegerAttribute) aTable = Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(into);
-
- aTable->myTable.Clear();
- aTable->myCols->Clear();
- aTable->myRows->Clear();
-
- aTable->myTable = myTable;
- aTable->myTitle = myTitle;
- aTable->myNbRows = myNbRows;
- aTable->myNbColumns = myNbColumns;
-
- for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
- aTable->myRows->Append(GetRowTitle(anIndex));
- for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++)
- aTable->myCols->Append(GetColumnTitle(anIndex));
-}
-
-
-Handle_TColStd_HSequenceOfInteger SALOMEDS_TableOfIntegerAttribute::GetSetRowIndices(const Standard_Integer theRow)
-{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
-
- Standard_Integer i, aShift = myNbColumns*(theRow-1);
- for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift + i)) aSeq->Append(i);
- }
-
- return aSeq;
-}
-
-Handle_TColStd_HSequenceOfInteger SALOMEDS_TableOfIntegerAttribute::GetSetColumnIndices(const Standard_Integer theColumn)
-{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
-
- Standard_Integer i, anIndex;
- for(i = 1; i <= myNbRows; i++) {
- anIndex = myNbColumns*(i-1)+theColumn;
- if(myTable.IsBound(anIndex)) aSeq->Append(i);
- }
-
- return aSeq;
-}
-
-
-void SALOMEDS_TableOfIntegerAttribute::ConvertToString(ostrstream& theStream)
-{
- int i, j, l;
-
- theStream.precision(64);
-
- //Title
- l = myTitle.Length();
- theStream << l << "\n";
- for(i=1; i<=l; i++)
- theStream << myTitle.Value(i) << "\n";
-
- //Nb rows
- theStream << myNbRows << "\n";
-
- //Rows titles
- for(i=1; i<=myNbRows; i++) {
- l = myRows->Value(i).Length();
- theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myRows->Value(i).Value(j) << "\n";
- }
-
- //Nb columns
- theStream << myNbColumns << "\n";
-
- //Columns titles
- for(i=1; i<=myNbColumns; i++) {
- l = myCols->Value(i).Length();
- theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myCols->Value(i).Value(j) << "\n";
- }
-
- //Store the table values
- l = myTable.Extent();
- theStream << l << "\n";
- TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIterator(myTable);
- for(; anIterator.More(); anIterator.Next()) {
- theStream << anIterator.Key() << "\n";
- theStream << anIterator.Value() << "\n";
- }
-
- return;
-}
-
-bool SALOMEDS_TableOfIntegerAttribute::RestoreFromString(istrstream& theStream)
-{
- Backup();
-
- int i, j, l;
-
- Standard_ExtCharacter anExtChar;
- TCollection_ExtendedString aStr;
-
- //Title
- theStream >> l;
-
- myTitle = TCollection_ExtendedString(l, 0);
- for(i=1; i<=l; i++) {
- theStream >> anExtChar;
- myTitle.SetValue(i, anExtChar);
- }
-
- //Nb rows
- theStream >> myNbRows;
-
- //Rows titles
- myRows->Clear();
- for(i=1; i<=myNbRows; i++) {
- theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
- theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
- }
- myRows->Append(aStr);
- }
-
- //Nb columns
- theStream >> myNbColumns;
-
- //Columns titles
- myCols->Clear();
- for(i=1; i<=myNbColumns; i++) {
- theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
- theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
- }
- myCols->Append(aStr);
- }
-
- //Restore the table values
- theStream >> l;
- myTable.Clear();
- for(i=1; i<=l; i++) {
- int aKey, aValue;
- theStream >> aKey;
- theStream >> aValue;
- myTable.Bind(aKey, aValue);
- }
-
- return true;
-}
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_TableOfIntegerAttribute.hxx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_TableOfIntegerAttribute_HeaderFile
-#define _SALOMEDS_TableOfIntegerAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_TableOfIntegerAttribute_HeaderFile
-#include <Handle_SALOMEDS_TableOfIntegerAttribute.hxx>
-#endif
-
-#ifndef _TColStd_SequenceOfTransient_HeaderFile
-#include <TColStd_SequenceOfTransient.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile
-#include <Handle_TColStd_HSequenceOfExtendedString.hxx>
-#endif
-
-#ifndef _TColStd_DataMapOfIntegerInteger_HeaderFile
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-#endif
-
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile
-#include <Handle_TColStd_HSequenceOfInteger.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class TColStd_HSequenceOfExtendedString;
-class Standard_GUID;
-class TDF_Label;
-class TCollection_ExtendedString;
-class TColStd_HSequenceOfInteger;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-#include <strstream>
-
-class SALOMEDS_TableOfIntegerAttribute : public TDF_Attribute {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_TableOfIntegerAttribute Set(const TDF_Label& label) ;
-Standard_EXPORT SALOMEDS_TableOfIntegerAttribute();
-Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns);
-Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetTitle() const;
-Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfInteger)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetRowData(const Standard_Integer theRow) ;
-Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const;
-Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfInteger)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetColumnData(const Standard_Integer theColumn) ;
-Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const;
-Standard_EXPORT Standard_Integer GetNbRows() const;
-Standard_EXPORT Standard_Integer GetNbColumns() const;
-
-Standard_EXPORT void PutValue(const Standard_Integer theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Integer GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow);
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn);
-
-Standard_EXPORT void ConvertToString(ostrstream& theStream);
-Standard_EXPORT bool RestoreFromString(istrstream& theStream);
-
-Standard_EXPORT ~SALOMEDS_TableOfIntegerAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TableOfIntegerAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-TColStd_DataMapOfIntegerInteger myTable;
-TCollection_ExtendedString myTitle;
-Handle_TColStd_HSequenceOfExtendedString myRows;
-Handle_TColStd_HSequenceOfExtendedString myCols;
-Standard_Integer myNbRows;
-Standard_Integer myNbColumns;
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_TableOfIntegerAttribute.ixx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#include <SALOMEDS_TableOfIntegerAttribute.jxx>
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_TableOfIntegerAttribute::~SALOMEDS_TableOfIntegerAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_TableOfIntegerAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TableOfIntegerAttribute",
- sizeof(SALOMEDS_TableOfIntegerAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_TableOfIntegerAttribute) Handle(SALOMEDS_TableOfIntegerAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_TableOfIntegerAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TableOfIntegerAttribute))) {
- _anOtherObject = Handle(SALOMEDS_TableOfIntegerAttribute)((Handle(SALOMEDS_TableOfIntegerAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_TableOfIntegerAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_TableOfIntegerAttribute) ;
-}
-Standard_Boolean SALOMEDS_TableOfIntegerAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_TableOfIntegerAttribute) == AType || TDF_Attribute::IsKind(AType));
-}
-Handle_SALOMEDS_TableOfIntegerAttribute::~Handle_SALOMEDS_TableOfIntegerAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_TableOfIntegerAttribute.jxx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#endif
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TColStd_HSequenceOfInteger_HeaderFile
-#include <TColStd_HSequenceOfInteger.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_TableOfIntegerAttribute_HeaderFile
-#include <SALOMEDS_TableOfIntegerAttribute.hxx>
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_TableOfRealAttribute.cxx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#include <SALOMEDS_TableOfRealAttribute.ixx>
-#include <Standard_Failure.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerReal.hxx>
-
-#include <string>
-#include <stdio.h>
-using namespace std;
-
-const Standard_GUID& SALOMEDS_TableOfRealAttribute::GetID()
-{
- static Standard_GUID SALOMEDS_TableOfRealAttributeID ("128371A1-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_TableOfRealAttributeID;
-}
-
-Handle(SALOMEDS_TableOfRealAttribute) SALOMEDS_TableOfRealAttribute::Set(const TDF_Label& label)
-{
- Handle(SALOMEDS_TableOfRealAttribute) anAttr;
- if (!label.FindAttribute(SALOMEDS_TableOfRealAttribute::GetID(),anAttr)) {
- anAttr = new SALOMEDS_TableOfRealAttribute();
- label.AddAttribute(anAttr);
- }
- return anAttr;
-}
-
-SALOMEDS_TableOfRealAttribute::SALOMEDS_TableOfRealAttribute() {
- myRows = new TColStd_HSequenceOfExtendedString();
- myCols = new TColStd_HSequenceOfExtendedString();
- myNbRows = 0;
- myNbColumns = 0;
-}
-
-void SALOMEDS_TableOfRealAttribute::SetNbColumns(const Standard_Integer theNbColumns)
-{
- Backup();
-
- TColStd_DataMapOfIntegerReal aMap;
- aMap = myTable;
- myTable.Clear();
-
- TColStd_DataMapIteratorOfDataMapOfIntegerReal anIterator(aMap);
- for(; anIterator.More(); anIterator.Next()) {
- int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
- int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
- if(aCol == 0) { aCol = myNbColumns; aRow--; }
- if(aCol > theNbColumns) continue;
- int aKey = (aRow-1)*theNbColumns+aCol;
- myTable.Bind(aKey, anIterator.Value());
- }
-
- myNbColumns = theNbColumns;
-
- while (myCols->Length() < myNbColumns) { // append empty columns titles
- myCols->Append(TCollection_ExtendedString(""));
- }
-}
-
-void SALOMEDS_TableOfRealAttribute::SetTitle(const TCollection_ExtendedString& theTitle) {
- Backup();
- myTitle = theTitle;
-}
-
-TCollection_ExtendedString SALOMEDS_TableOfRealAttribute::GetTitle() const {
- return myTitle;
-}
-
-void SALOMEDS_TableOfRealAttribute::SetRowData(const Standard_Integer theRow,
- const Handle(TColStd_HSequenceOfReal)& theData)
-{
- if(theData->Length() > myNbColumns) SetNbColumns(theData->Length());
-
- Backup();
-
- while (myRows->Length() < theRow) { // append new row titles
- myRows->Append(TCollection_ExtendedString(""));
- }
-
- Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length();
- for(i = 1; i <= aLength; i++) {
- myTable.Bind(aShift + i, theData->Value(i));
- }
-
- if(theRow > myNbRows) myNbRows = theRow;
-}
-
-Handle(TColStd_HSequenceOfReal) SALOMEDS_TableOfRealAttribute::GetRowData(const Standard_Integer theRow)
-{
- Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal();
- Standard_Integer i, aShift = (theRow-1)*myNbColumns;
- for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift+i))
- aSeq->Append(myTable.Find(aShift+i));
- else
- aSeq->Append(0.);
- }
-
- return aSeq;
-}
-
-void SALOMEDS_TableOfRealAttribute::SetRowTitle(const Standard_Integer theRow,
- const TCollection_ExtendedString& theTitle) {
- Backup();
- myRows->SetValue(theRow,theTitle);
-}
-
-TCollection_ExtendedString SALOMEDS_TableOfRealAttribute::GetRowTitle(const Standard_Integer theRow) const {
- return myRows->Value(theRow);
-}
-
-
-void SALOMEDS_TableOfRealAttribute::SetColumnData(const Standard_Integer theColumn,
- const Handle(TColStd_HSequenceOfReal)& theData)
-{
- if(theColumn > myNbColumns) SetNbColumns(theColumn);
-
- Backup();
-
- Standard_Integer i, aLength = theData->Length();
- for(i = 1; i <= aLength; i++) {
- myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i));
- }
-
- if(aLength > myNbRows) {
- myNbRows = aLength;
- while (myRows->Length() < myNbRows) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
- }
- }
-}
-
-
-Handle(TColStd_HSequenceOfReal) SALOMEDS_TableOfRealAttribute::GetColumnData(const Standard_Integer theColumn)
-{
- Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal;
-
- Standard_Integer i, anIndex;
- for(i = 1; i <= myNbRows; i++) {
- anIndex = myNbColumns*(i-1) + theColumn;
- if(myTable.IsBound(anIndex))
- aSeq->Append(myTable.Find(anIndex));
- else
- aSeq->Append(0.);
- }
-
- return aSeq;
-}
-
-void SALOMEDS_TableOfRealAttribute::SetColumnTitle(const Standard_Integer theColumn,
- const TCollection_ExtendedString& theTitle) {
- Backup();
- while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString(""));
- myCols->SetValue(theColumn,theTitle);
-}
-
-TCollection_ExtendedString SALOMEDS_TableOfRealAttribute::GetColumnTitle(const Standard_Integer theColumn) const {
- if(myCols.IsNull()) return "";
- if(myCols->Length() < theColumn) return "";
- return myCols->Value(theColumn);
-}
-
-
-Standard_Integer SALOMEDS_TableOfRealAttribute::GetNbRows() const
-{
- return myNbRows;
-}
-
-Standard_Integer SALOMEDS_TableOfRealAttribute::GetNbColumns() const
-{
- return myNbColumns;
-}
-
-void SALOMEDS_TableOfRealAttribute::PutValue(const Standard_Real theValue,
- const Standard_Integer theRow,
- const Standard_Integer theColumn)
-{
- if(theColumn > myNbColumns) SetNbColumns(theColumn);
-
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- myTable.Bind(anIndex, theValue);
-
- if(theRow > myNbRows) {
- while (myRows->Length() < theRow) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
- }
- myNbRows = theRow;
- }
-}
-
-Standard_Boolean SALOMEDS_TableOfRealAttribute::HasValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
-{
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- return myTable.IsBound(anIndex);
-}
-
-Standard_Real SALOMEDS_TableOfRealAttribute::GetValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
-{
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- if(myTable.IsBound(anIndex)) return myTable.Find(anIndex);
-
- Standard_Failure::Raise("Invalid cell index");
- return 0.;
-}
-
-const Standard_GUID& SALOMEDS_TableOfRealAttribute::ID() const
-{
- return GetID();
-}
-
-void SALOMEDS_TableOfRealAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Standard_Integer anIndex;
- Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(with);
-
- myTable.Clear();
- myCols->Clear();
- myRows->Clear();
-
- myTable = aTable->myTable;
- myNbRows = aTable->myNbRows;
- myNbColumns = aTable->myNbColumns;
- myTitle = aTable->myTitle;
-
- for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
- myRows->Append(aTable->GetRowTitle(anIndex));
-
- for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++)
- myCols->Append(aTable->GetColumnTitle(anIndex));
-}
-
-Handle(TDF_Attribute) SALOMEDS_TableOfRealAttribute::NewEmpty() const
-{
- return new SALOMEDS_TableOfRealAttribute();
-}
-
-void SALOMEDS_TableOfRealAttribute::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
-{
- Standard_Integer anIndex;
- Handle(SALOMEDS_TableOfRealAttribute) aTable = Handle(SALOMEDS_TableOfRealAttribute)::DownCast(into);
-
- aTable->myTable.Clear();
- aTable->myCols->Clear();
- aTable->myRows->Clear();
-
- aTable->myTable = myTable;
- aTable->myTitle = myTitle;
- aTable->myNbRows = myNbRows;
- aTable->myNbColumns = myNbColumns;
-
- for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
- aTable->myRows->Append(GetRowTitle(anIndex));
- for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++)
- aTable->myCols->Append(GetColumnTitle(anIndex));
-}
-
-
-Handle_TColStd_HSequenceOfInteger SALOMEDS_TableOfRealAttribute::GetSetRowIndices(const Standard_Integer theRow)
-{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
-
- Standard_Integer i, aShift = myNbColumns*(theRow-1);
- for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift + i)) aSeq->Append(i);
- }
-
- return aSeq;
-}
-
-Handle_TColStd_HSequenceOfInteger SALOMEDS_TableOfRealAttribute::GetSetColumnIndices(const Standard_Integer theColumn)
-{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
-
- Standard_Integer i, anIndex;
- for(i = 1; i <= myNbRows; i++) {
- anIndex = myNbColumns*(i-1)+theColumn;
- if(myTable.IsBound(anIndex)) aSeq->Append(i);
- }
-
- return aSeq;
-}
-
-
-
-void SALOMEDS_TableOfRealAttribute::ConvertToString(ostrstream& theStream)
-{
- int i, j, l;
-
-
- //Title
- l = myTitle.Length();
- theStream << l << "\n";
- for(i=1; i<=l; i++)
- theStream << myTitle.Value(i) << "\n";
-
- //Nb rows
- theStream << myNbRows << "\n";
-
- //Rows titles
- for(i=1; i<=myNbRows; i++) {
- l = myRows->Value(i).Length();
- theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myRows->Value(i).Value(j) << "\n";
- }
-
- //Nb columns
- theStream << myNbColumns << "\n";
-
- //Columns titles
- for(i=1; i<=myNbColumns; i++) {
- l = myCols->Value(i).Length();
- theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myCols->Value(i).Value(j) << "\n";
- }
-
- //Store the table values
- l = myTable.Extent();
- theStream << l << "\n";
- char *aBuffer = new char[128];
- TColStd_DataMapIteratorOfDataMapOfIntegerReal anIterator(myTable);
- for(; anIterator.More(); anIterator.Next()) {
- theStream << anIterator.Key() << "\n";
- sprintf(aBuffer, "%.64e", anIterator.Value());
- theStream << aBuffer << "\n";
- }
-
- delete []aBuffer;
-
- return;
-}
-
-bool SALOMEDS_TableOfRealAttribute::RestoreFromString(istrstream& theStream)
-{
- Backup();
-
- int i, j, l;
-
- Standard_ExtCharacter anExtChar;
- TCollection_ExtendedString aStr;
-
- //Title
- theStream >> l;
-
- myTitle = TCollection_ExtendedString(l, 0);
- for(i=1; i<=l; i++) {
- theStream >> anExtChar;
- myTitle.SetValue(i, anExtChar);
- }
-
- //Nb rows
- theStream >> myNbRows;
-
- //Rows titles
- myRows->Clear();
- for(i=1; i<=myNbRows; i++) {
- theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
- theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
- }
- myRows->Append(aStr);
- }
-
- //Nb columns
- theStream >> myNbColumns;
-
- //Columns titles
- myCols->Clear();
- for(i=1; i<=myNbColumns; i++) {
- theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
- theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
- }
- myCols->Append(aStr);
- }
-
- //Restore the table values
- theStream >> l;
- myTable.Clear();
- for(i=1; i<=l; i++) {
- Standard_Integer aKey;
- Standard_Real aValue;
- theStream >> aKey;
- theStream >> aValue;
- myTable.Bind(aKey, aValue);
- }
-
- return true;
-}
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_TableOfRealAttribute.hxx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_TableOfRealAttribute_HeaderFile
-#define _SALOMEDS_TableOfRealAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_TableOfRealAttribute_HeaderFile
-#include <Handle_SALOMEDS_TableOfRealAttribute.hxx>
-#endif
-
-#ifndef _TColStd_SequenceOfTransient_HeaderFile
-#include <TColStd_SequenceOfTransient.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile
-#include <Handle_TColStd_HSequenceOfExtendedString.hxx>
-#endif
-
-#ifndef _TColStd_DataMapOfIntegerReal_HeaderFile
-#include <TColStd_DataMapOfIntegerReal.hxx>
-#endif
-
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-
-#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile
-#include <Handle_TColStd_HSequenceOfInteger.hxx>
-#endif
-
-#ifndef TColStd_HSequenceOfInteger_HeaderFile
-#include <TColStd_HSequenceOfInteger.hxx>
-#endif
-
-#ifndef _Handle_TColStd_HSequenceOfReal_HeaderFile
-#include <Handle_TColStd_HSequenceOfReal.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class TColStd_HSequenceOfExtendedString;
-class Standard_GUID;
-class TDF_Label;
-class TCollection_ExtendedString;
-class TColStd_HSequenceOfReal;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-#include <strstream>
-
-class SALOMEDS_TableOfRealAttribute : public TDF_Attribute {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_TableOfRealAttribute Set(const TDF_Label& label) ;
-Standard_EXPORT SALOMEDS_TableOfRealAttribute();
-Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns);
-Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetTitle() const;
-Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfReal)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfReal GetRowData(const Standard_Integer theRow) ;
-Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const;
-Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfReal)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfReal GetColumnData(const Standard_Integer theColumn) ;
-Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const;
-Standard_EXPORT Standard_Integer GetNbRows() const;
-Standard_EXPORT Standard_Integer GetNbColumns() const;
-
-Standard_EXPORT void PutValue(const Standard_Real theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Real GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow);
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn);
-
-Standard_EXPORT void ConvertToString(ostrstream& theStream);
-Standard_EXPORT bool RestoreFromString(istrstream& theStream);
-
-Standard_EXPORT ~SALOMEDS_TableOfRealAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TableOfRealAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-TColStd_DataMapOfIntegerReal myTable;
-TCollection_ExtendedString myTitle;
-Handle_TColStd_HSequenceOfExtendedString myRows;
-Handle_TColStd_HSequenceOfExtendedString myCols;
-Standard_Integer myNbRows;
-Standard_Integer myNbColumns;
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_TableOfRealAttribute.ixx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#include <SALOMEDS_TableOfRealAttribute.jxx>
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_TableOfRealAttribute::~SALOMEDS_TableOfRealAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_TableOfRealAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TableOfRealAttribute",
- sizeof(SALOMEDS_TableOfRealAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_TableOfRealAttribute) Handle(SALOMEDS_TableOfRealAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_TableOfRealAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TableOfRealAttribute))) {
- _anOtherObject = Handle(SALOMEDS_TableOfRealAttribute)((Handle(SALOMEDS_TableOfRealAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_TableOfRealAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_TableOfRealAttribute) ;
-}
-Standard_Boolean SALOMEDS_TableOfRealAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_TableOfRealAttribute) == AType || TDF_Attribute::IsKind(AType));
-}
-Handle_SALOMEDS_TableOfRealAttribute::~Handle_SALOMEDS_TableOfRealAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_TableOfRealAttribute.jxx
-// Author : Michael Ponikarov
-// Module : SALOME
-// $Header$
-
-#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#endif
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TColStd_HSequenceOfReal_HeaderFile
-#include <TColStd_HSequenceOfReal.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_TableOfRealAttribute_HeaderFile
-#include <SALOMEDS_TableOfRealAttribute.hxx>
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_TableOfStringAttribute.cxx
-// Author : Sergey Ruin
-// Module : SALOME
-
-#include <SALOMEDS_TableOfStringAttribute.ixx>
-#include <Standard_Failure.hxx>
-#include <SALOMEDS_DataMapIteratorOfDataMapOfIntegerString.hxx>
-
-#include <string>
-#include <stdio.h>
-using namespace std;
-
-const Standard_GUID& SALOMEDS_TableOfStringAttribute::GetID()
-{
- static Standard_GUID SALOMEDS_TableOfStringAttributeID ("128371A4-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_TableOfStringAttributeID;
-}
-
-Handle(SALOMEDS_TableOfStringAttribute) SALOMEDS_TableOfStringAttribute::Set(const TDF_Label& label)
-{
- Handle(SALOMEDS_TableOfStringAttribute) anAttr;
- if (!label.FindAttribute(SALOMEDS_TableOfStringAttribute::GetID(),anAttr)) {
- anAttr = new SALOMEDS_TableOfStringAttribute();
- label.AddAttribute(anAttr);
- }
- return anAttr;
-}
-
-SALOMEDS_TableOfStringAttribute::SALOMEDS_TableOfStringAttribute() {
- myRows = new TColStd_HSequenceOfExtendedString();
- myCols = new TColStd_HSequenceOfExtendedString();
- myNbRows = 0;
- myNbColumns = 0;
-}
-
-void SALOMEDS_TableOfStringAttribute::SetNbColumns(const Standard_Integer theNbColumns)
-{
- Backup();
-
- SALOMEDS_DataMapOfIntegerString aMap;
- aMap = myTable;
- myTable.Clear();
-
- SALOMEDS_DataMapIteratorOfDataMapOfIntegerString anIterator(aMap);
- for(; anIterator.More(); anIterator.Next()) {
- int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
- int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
- if(aCol == 0) { aCol = myNbColumns; aRow--; }
- if(aCol > theNbColumns) continue;
- int aKey = (aRow-1)*theNbColumns+aCol;
- myTable.Bind(aKey, anIterator.Value());
- }
-
- myNbColumns = theNbColumns;
-
- while (myCols->Length() < myNbColumns) { // append empty columns titles
- myCols->Append(TCollection_ExtendedString(""));
- }
-}
-
-void SALOMEDS_TableOfStringAttribute::SetTitle(const TCollection_ExtendedString& theTitle) {
- Backup();
- myTitle = theTitle;
-}
-
-TCollection_ExtendedString SALOMEDS_TableOfStringAttribute::GetTitle() const {
- return myTitle;
-}
-
-void SALOMEDS_TableOfStringAttribute::SetRowData(const Standard_Integer theRow,
- const Handle(TColStd_HSequenceOfExtendedString)& theData)
-{
- if(theData->Length() > myNbColumns) SetNbColumns(theData->Length());
-
- Backup();
-
- while (myRows->Length() < theRow) { // append new row titles
- myRows->Append(TCollection_ExtendedString(""));
- }
-
- Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length();
- for(i = 1; i <= aLength; i++) {
- myTable.Bind(aShift + i, theData->Value(i));
- }
-
- if(theRow > myNbRows) myNbRows = theRow;
-}
-
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDS_TableOfStringAttribute::GetRowData(const Standard_Integer theRow)
-{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString();
- Standard_Integer i, aShift = (theRow-1)*myNbColumns;
- for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift+i))
- aSeq->Append(myTable.Find(aShift+i));
- else
- aSeq->Append(0.);
- }
-
- return aSeq;
-}
-
-void SALOMEDS_TableOfStringAttribute::SetRowTitle(const Standard_Integer theRow,
- const TCollection_ExtendedString& theTitle) {
- Backup();
- myRows->SetValue(theRow,theTitle);
-}
-
-TCollection_ExtendedString SALOMEDS_TableOfStringAttribute::GetRowTitle(const Standard_Integer theRow) const {
- return myRows->Value(theRow);
-}
-
-
-void SALOMEDS_TableOfStringAttribute::SetColumnData(const Standard_Integer theColumn,
- const Handle(TColStd_HSequenceOfExtendedString)& theData)
-{
- if(theColumn > myNbColumns) SetNbColumns(theColumn);
-
- Backup();
-
- Standard_Integer i, aLength = theData->Length();
- for(i = 1; i <= aLength; i++) {
- myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i));
- }
-
- if(aLength > myNbRows) {
- myNbRows = aLength;
- while (myRows->Length() < myNbRows) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
- }
- }
-}
-
-
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDS_TableOfStringAttribute::GetColumnData(const Standard_Integer theColumn)
-{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
-
- Standard_Integer i, anIndex;
- for(i = 1; i <= myNbRows; i++) {
- anIndex = myNbColumns*(i-1) + theColumn;
- if(myTable.IsBound(anIndex))
- aSeq->Append(myTable.Find(anIndex));
- else
- aSeq->Append(0.);
- }
-
- return aSeq;
-}
-
-void SALOMEDS_TableOfStringAttribute::SetColumnTitle(const Standard_Integer theColumn,
- const TCollection_ExtendedString& theTitle) {
- Backup();
- while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString(""));
- myCols->SetValue(theColumn,theTitle);
-}
-
-TCollection_ExtendedString SALOMEDS_TableOfStringAttribute::GetColumnTitle(const Standard_Integer theColumn) const {
- if(myCols.IsNull()) return "";
- if(myCols->Length() < theColumn) return "";
- return myCols->Value(theColumn);
-}
-
-
-Standard_Integer SALOMEDS_TableOfStringAttribute::GetNbRows() const
-{
- return myNbRows;
-}
-
-Standard_Integer SALOMEDS_TableOfStringAttribute::GetNbColumns() const
-{
- return myNbColumns;
-}
-
-void SALOMEDS_TableOfStringAttribute::PutValue(const TCollection_ExtendedString& theValue,
- const Standard_Integer theRow,
- const Standard_Integer theColumn)
-{
- if(theColumn > myNbColumns) SetNbColumns(theColumn);
-
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- myTable.Bind(anIndex, theValue);
-
- if(theRow > myNbRows) {
- while (myRows->Length() < theRow) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
- }
- myNbRows = theRow;
- }
-}
-
-Standard_Boolean SALOMEDS_TableOfStringAttribute::HasValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
-{
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- return myTable.IsBound(anIndex);
-}
-
-TCollection_ExtendedString SALOMEDS_TableOfStringAttribute::GetValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
-{
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- if(myTable.IsBound(anIndex)) return myTable.Find(anIndex);
-
- Standard_Failure::Raise("Invalid cell index");
- return 0.;
-}
-
-const Standard_GUID& SALOMEDS_TableOfStringAttribute::ID() const
-{
- return GetID();
-}
-
-void SALOMEDS_TableOfStringAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Standard_Integer anIndex;
- Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(with);
-
- myTable.Clear();
- myCols->Clear();
- myRows->Clear();
-
- myTable = aTable->myTable;
- myNbRows = aTable->myNbRows;
- myNbColumns = aTable->myNbColumns;
- myTitle = aTable->myTitle;
-
- for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
- myRows->Append(aTable->GetRowTitle(anIndex));
-
- for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++)
- myCols->Append(aTable->GetColumnTitle(anIndex));
-}
-
-Handle(TDF_Attribute) SALOMEDS_TableOfStringAttribute::NewEmpty() const
-{
- return new SALOMEDS_TableOfStringAttribute();
-}
-
-void SALOMEDS_TableOfStringAttribute::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
-{
- Standard_Integer anIndex;
- Handle(SALOMEDS_TableOfStringAttribute) aTable = Handle(SALOMEDS_TableOfStringAttribute)::DownCast(into);
-
- aTable->myTable.Clear();
- aTable->myCols->Clear();
- aTable->myRows->Clear();
-
- aTable->myTable = myTable;
- aTable->myTitle = myTitle;
- aTable->myNbRows = myNbRows;
- aTable->myNbColumns = myNbColumns;
-
- for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
- aTable->myRows->Append(GetRowTitle(anIndex));
- for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++)
- aTable->myCols->Append(GetColumnTitle(anIndex));
-}
-
-
-Handle_TColStd_HSequenceOfInteger SALOMEDS_TableOfStringAttribute::GetSetRowIndices(const Standard_Integer theRow)
-{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
-
- Standard_Integer i, aShift = myNbColumns*(theRow-1);
- for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift + i)) aSeq->Append(i);
- }
-
- return aSeq;
-}
-
-Handle_TColStd_HSequenceOfInteger SALOMEDS_TableOfStringAttribute::GetSetColumnIndices(const Standard_Integer theColumn)
-{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
-
- Standard_Integer i, anIndex;
- for(i = 1; i <= myNbRows; i++) {
- anIndex = myNbColumns*(i-1)+theColumn;
- if(myTable.IsBound(anIndex)) aSeq->Append(i);
- }
-
- return aSeq;
-}
-
-
-
-void SALOMEDS_TableOfStringAttribute::ConvertToString(ostrstream& theStream)
-{
- int i, j, l;
-
- //Title
- l = myTitle.Length();
- theStream << l << "\n";
- for(i=1; i<=l; i++)
- theStream << myTitle.Value(i) << "\n";
-
- //Nb rows
- theStream << myNbRows << "\n";
-
- //Rows titles
- for(i=1; i<=myNbRows; i++) {
- l = myRows->Value(i).Length();
- theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myRows->Value(i).Value(j) << "\n";
- }
-
- //Nb columns
- theStream << myNbColumns << "\n";
-
- //Columns titles
- for(i=1; i<=myNbColumns; i++) {
- l = myCols->Value(i).Length();
- theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myCols->Value(i).Value(j) << "\n";
- }
-
- //Store the table values
- l = myTable.Extent();
- theStream << l << "\n";
- SALOMEDS_DataMapIteratorOfDataMapOfIntegerString anIterator(myTable);
- for(; anIterator.More(); anIterator.Next()) {
- if (anIterator.Value().Length()) { // check empty string in the value table
- theStream << anIterator.Key() << "\n";
- unsigned long aValueSize = anIterator.Value().Length();
- theStream<<aValueSize << "\n";
- theStream.write((TCollection_AsciiString(anIterator.Value()).ToCString()),aValueSize);
- theStream<<"\n";
- } else { // write index only of kind: "0key"; "05", for an example
- theStream << "0" << anIterator.Key() << "\n";
- }
- }
- return;
-}
-
-bool SALOMEDS_TableOfStringAttribute::RestoreFromString(istrstream& theStream)
-{
- Backup();
-
- theStream.seekg(0, ios::end);
- long aSize = theStream.tellg();
- theStream.seekg(0, ios::beg);
-
- int i, j, l;
- char *aValueString = new char[aSize];
-
- Standard_ExtCharacter anExtChar;
- TCollection_ExtendedString aStr;
-
- //Title
- theStream >> l;
-
- myTitle = TCollection_ExtendedString(l, 0);
- for(i=1; i<=l; i++) {
- theStream >> anExtChar;
- myTitle.SetValue(i, anExtChar);
- }
-
- //Nb rows
- theStream >> myNbRows;
-
- //Rows titles
- myRows->Clear();
- for(i=1; i<=myNbRows; i++) {
- theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
- theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
- }
- myRows->Append(aStr);
- }
-
- //Nb columns
- theStream >> myNbColumns;
-
- //Columns titles
- myCols->Clear();
- for(i=1; i<=myNbColumns; i++) {
- theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
- theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
- }
- myCols->Append(aStr);
- }
-
- //Restore the table values
- TCollection_AsciiString aValue;
- theStream >> l;
- myTable.Clear();
- theStream.getline(aValueString,aSize,'\n');
- for(i=1; i<=l; i++) {
- Standard_Integer aKey;
-
- theStream.getline(aValueString,aSize,'\n');
- aValue = aValueString;
- aKey = aValue.IntegerValue();
- if (aValue.Value(1) == '0')
- aValue = "";
- else {
- unsigned long aValueSize;
- theStream >> aValueSize;
- theStream.read(aValueString, 1); // an '\n' omitting
- theStream.read(aValueString, aValueSize);
- theStream.read(aValueString, 1); // an '\n' omitting
- aValue = aValueString;
- }
- myTable.Bind(aKey, aValue);
- }
- delete(aValueString);
- return true;
-}
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_TableOfStringAttribute.hxx
-// Author : Sergey Ruin
-// Module : SALOME
-
-#ifndef _SALOMEDS_TableOfStringAttribute_HeaderFile
-#define _SALOMEDS_TableOfStringAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_TableOfStringAttribute_HeaderFile
-#include <Handle_SALOMEDS_TableOfStringAttribute.hxx>
-#endif
-
-#ifndef _TColStd_SequenceOfTransient_HeaderFile
-#include <TColStd_SequenceOfTransient.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile
-#include <Handle_TColStd_HSequenceOfExtendedString.hxx>
-#endif
-
-#ifndef _SALOMEDS_DataMapOfIntegerString_HeaderFile
-#include <SALOMEDS_DataMapOfIntegerString.hxx>
-#endif
-
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-
-#ifndef _Handle_TColStd_HSequenceOfInteger_HeaderFile
-#include <Handle_TColStd_HSequenceOfInteger.hxx>
-#endif
-
-#ifndef TColStd_HSequenceOfInteger_HeaderFile
-#include <TColStd_HSequenceOfInteger.hxx>
-#endif
-
-#ifndef _Handle_TColStd_HSequenceOfExtendedString_HeaderFile
-#include <Handle_TColStd_HSequenceOfExtendedString.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class TColStd_HSequenceOfExtendedString;
-class Standard_GUID;
-class TDF_Label;
-class TCollection_ExtendedString;
-class TColStd_HSequenceOfExtendedString;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-#include <strstream>
-
-class SALOMEDS_TableOfStringAttribute : public TDF_Attribute {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_TableOfStringAttribute Set(const TDF_Label& label) ;
-Standard_EXPORT SALOMEDS_TableOfStringAttribute();
-Standard_EXPORT void SetNbColumns(const Standard_Integer theNbColumns);
-Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetTitle() const;
-Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfExtendedString)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetRowData(const Standard_Integer theRow) ;
-Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const;
-Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfExtendedString)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetColumnData(const Standard_Integer theColumn) ;
-Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const;
-Standard_EXPORT Standard_Integer GetNbRows() const;
-Standard_EXPORT Standard_Integer GetNbColumns() const;
-
-Standard_EXPORT void PutValue(const TCollection_ExtendedString& theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT TCollection_ExtendedString GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow);
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn);
-
-Standard_EXPORT void ConvertToString(ostrstream& theStream);
-Standard_EXPORT bool RestoreFromString(istrstream& theStream);
-
-Standard_EXPORT ~SALOMEDS_TableOfStringAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TableOfStringAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-SALOMEDS_DataMapOfIntegerString myTable;
-TCollection_ExtendedString myTitle;
-Handle_TColStd_HSequenceOfExtendedString myRows;
-Handle_TColStd_HSequenceOfExtendedString myCols;
-Standard_Integer myNbRows;
-Standard_Integer myNbColumns;
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_TableOfStringAttribute.ixx
-// Author : Sergey Ruin
-// Module : SALOME
-
-#include <SALOMEDS_TableOfStringAttribute.jxx>
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_TableOfStringAttribute::~SALOMEDS_TableOfStringAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_TableOfStringAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDF_Attribute);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TableOfStringAttribute",
- sizeof(SALOMEDS_TableOfStringAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_TableOfStringAttribute) Handle(SALOMEDS_TableOfStringAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_TableOfStringAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TableOfStringAttribute))) {
- _anOtherObject = Handle(SALOMEDS_TableOfStringAttribute)((Handle(SALOMEDS_TableOfStringAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_TableOfStringAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_TableOfStringAttribute) ;
-}
-Standard_Boolean SALOMEDS_TableOfStringAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_TableOfStringAttribute) == AType || TDF_Attribute::IsKind(AType));
-}
-Handle_SALOMEDS_TableOfStringAttribute::~Handle_SALOMEDS_TableOfStringAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : SALOMEDS_TableOfStringAttribute.jxx
-// Author : Sergey Ruin
-// Module : SALOME
-
-#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#endif
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TCollection_ExtendedString_HeaderFile
-#include <TCollection_ExtendedString.hxx>
-#endif
-#ifndef _TColStd_HSequenceOfExtendedString_HeaderFile
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_TableOfStringAttribute_HeaderFile
-#include <SALOMEDS_TableOfStringAttribute.hxx>
-#endif
+++ /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
-
--- File : SALOMEDS_TargetAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class TargetAttribute from SALOMEDS inherits Relation from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- RelocationTable from TDF,
- LabelList from TDF
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- Set (myclass; label : Label from TDF)
- returns TargetAttribute from SALOMEDS;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable TargetAttribute from SALOMEDS;
-
- Append(me: mutable; theReferencedObject : mutable Label form TDF);
- Get(me; theReferencedObjects : mutable : LabelList from TDF);
- Remove(me: mutable; theReferencedObject : mutable Label form TDF);
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end TargetAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_TargetAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_TargetAttribute.ixx"
-#include <TDF_Reference.hxx>
-#include <TDF_ListIteratorOfAttributeList.hxx>
-#include "utilities.h"
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_TargetAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_TargetAttributeID ("12837197-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_TargetAttributeID;
-}
-
-
-
-//=======================================================================
-//function : Set
-//purpose :
-//=======================================================================
-
-Handle(SALOMEDS_TargetAttribute) SALOMEDS_TargetAttribute::Set (const TDF_Label& L)
-{
- Handle(SALOMEDS_TargetAttribute) A;
- if (!L.FindAttribute(SALOMEDS_TargetAttribute::GetID(),A)) {
- A = new SALOMEDS_TargetAttribute();
- L.AddAttribute(A);
- }
- return A;
-}
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_TargetAttribute::SALOMEDS_TargetAttribute()
-{}
-
-//=======================================================================
-//function : Append
-//purpose :
-//=======================================================================
-
-void SALOMEDS_TargetAttribute::Append(TDF_Label& theReferencedObject) {
- Backup();
- Handle(TDF_Reference) aReference;
- if (theReferencedObject.FindAttribute(TDF_Reference::GetID(),aReference)) {
- TDF_ListIteratorOfAttributeList anIter(GetVariables());
- for(;anIter.More();anIter.Next()) if(anIter.Value()->Label() == theReferencedObject) return; //BugID: PAL6192
- GetVariables().Append(aReference);
- } else {
- MESSAGE("SALOMEDS_TargetAttribute::Append: can't append referenced object");
- }
-}
-
-//=======================================================================
-//function : Get
-//purpose :
-//=======================================================================
-void SALOMEDS_TargetAttribute::Get(TDF_LabelList& theReferencedObjects) {
- theReferencedObjects.Clear();
- TDF_ListIteratorOfAttributeList anIter(GetVariables());
- for(;anIter.More();anIter.Next()) {
- theReferencedObjects.Append(anIter.Value()->Label());
- }
-}
-
-//=======================================================================
-//function : Remove
-//purpose :
-//=======================================================================
-void SALOMEDS_TargetAttribute::Remove(TDF_Label& theReferencedObject) {
- Backup();
- TDF_ListIteratorOfAttributeList anIter(GetVariables());
- for(;anIter.More();anIter.Next()) {
- if (anIter.Value()->Label() == theReferencedObject) {
- GetVariables().Remove(anIter);
- return;
- }
- }
- MESSAGE("SALOMEDS_TargetAttribute::Remove: nothing to remove");
-}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_TargetAttribute::ID () const { return GetID(); }
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_TargetAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_TargetAttribute_HeaderFile
-#define _SALOMEDS_TargetAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_TargetAttribute_HeaderFile
-#include <Handle_SALOMEDS_TargetAttribute.hxx>
-#endif
-
-#include <TDataStd_Relation.hxx>
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-#ifndef _TDF_LabelList_HeaderFile
-#include <TDF_LabelList.hxx>
-#endif
-#ifndef _Handle_TDF_Reference_HeaderFile
-#include <Handle_TDF_Reference.hxx>
-#endif
-class Standard_GUID;
-class TDF_Label;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_TargetAttribute : public TDataStd_Relation {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDS_TargetAttribute Set(const TDF_Label& label) ;
-Standard_EXPORT SALOMEDS_TargetAttribute();
-Standard_EXPORT void SALOMEDS_TargetAttribute::Append(TDF_Label& theReferencedObject);
-Standard_EXPORT void SALOMEDS_TargetAttribute::Get(TDF_LabelList& theReferencedObjects);
-Standard_EXPORT void SALOMEDS_TargetAttribute::Remove(TDF_Label& theReferencedObject);
-Standard_EXPORT const Standard_GUID& ID() const;
-
-// Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-// Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-// Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-
-Standard_EXPORT ~SALOMEDS_TargetAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TargetAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_TargetAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_TargetAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_TargetAttribute::~SALOMEDS_TargetAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_TargetAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Relation);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Relation);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TargetAttribute",
- sizeof(SALOMEDS_TargetAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_TargetAttribute) Handle(SALOMEDS_TargetAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_TargetAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TargetAttribute))) {
- _anOtherObject = Handle(SALOMEDS_TargetAttribute)((Handle(SALOMEDS_TargetAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_TargetAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_TargetAttribute) ;
-}
-Standard_Boolean SALOMEDS_TargetAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_TargetAttribute) == AType || TDataStd_Relation::IsKind(AType));
-}
-Handle_SALOMEDS_TargetAttribute::~Handle_SALOMEDS_TargetAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_TargetAttribute.jxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Label_HeaderFile
-#include <TDF_Label.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_TargetAttribute_HeaderFile
-#include "SALOMEDS_TargetAttribute.hxx"
-#endif
+++ /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
---
---
--- File : SALOMEDS_TextColorAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class TextColorAttribute from SALOMEDS inherits RealArray from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- ExtendedString from TCollection,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable TextColorAttribute from SALOMEDS;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end TextColorAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_TextColorAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_TextColorAttribute.ixx"
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_TextColorAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_TextColorAttributeID ("12837189-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_TextColorAttributeID;
-}
-
-
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_TextColorAttribute::SALOMEDS_TextColorAttribute()
-{Init(1,3);}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_TextColorAttribute::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_TextColorAttribute::NewEmpty () const
-{
- return new SALOMEDS_TextColorAttribute();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_TextColorAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Handle(TColStd_HArray1OfReal) s = Handle(TDataStd_RealArray)::DownCast (with)->Array ();
- TDataStd_RealArray::ChangeArray(s);
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_TextColorAttribute::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
-{
- Handle(TDataStd_RealArray)::DownCast (into)->ChangeArray (Array());
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_TextColorAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_TextColorAttribute_HeaderFile
-#define _SALOMEDS_TextColorAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_TextColorAttribute_HeaderFile
-#include <Handle_SALOMEDS_TextColorAttribute.hxx>
-#endif
-
-#ifndef _TDataStd_RealArray_HeaderFile
-#include <TDataStd_RealArray.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class Standard_GUID;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_TextColorAttribute : public TDataStd_RealArray {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT SALOMEDS_TextColorAttribute();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_TextColorAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TextColorAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_TextColorAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_TextColorAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_TextColorAttribute::~SALOMEDS_TextColorAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_TextColorAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_RealArray);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_RealArray);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TextColorAttribute",
- sizeof(SALOMEDS_TextColorAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_TextColorAttribute) Handle(SALOMEDS_TextColorAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_TextColorAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TextColorAttribute))) {
- _anOtherObject = Handle(SALOMEDS_TextColorAttribute)((Handle(SALOMEDS_TextColorAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_TextColorAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_TextColorAttribute) ;
-}
-Standard_Boolean SALOMEDS_TextColorAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_TextColorAttribute) == AType || TDataStd_RealArray::IsKind(AType));
-}
-Handle_SALOMEDS_TextColorAttribute::~Handle_SALOMEDS_TextColorAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_TextColorAttribute.jxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_TextColorAttribute_HeaderFile
-#include "SALOMEDS_TextColorAttribute.hxx"
-#endif
+++ /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
---
--- File : SALOMEDS_TextHighlightColorAttribute.cdl
--- Author : Yves FRICAUD
--- Module : SALOME
-
-class TextHighlightColorAttribute from SALOMEDS inherits RealArray from TDataStd
-
- ---Purpose:
-
-
-uses Attribute from TDF,
- Label from TDF,
- GUID from Standard,
- ExtendedString from TCollection,
- DataSet from TDF,
- RelocationTable from TDF,
- AttributeSequence from TDF,
- Data from TDF,
- Comment from TDataStd
-
-
-is
-
-
- ---Purpose: class methods
- -- =============
-
- GetID (myclass)
- ---C++: return const &
- returns GUID from Standard;
-
- ---Purpose: Comment methods
- -- ============
-
- Create
- returns mutable TextHighlightColorAttribute from SALOMEDS;
-
- ID (me)
- ---C++: return const &
- returns GUID from Standard;
-
- Restore (me: mutable; with : Attribute from TDF);
-
- NewEmpty (me)
- returns mutable Attribute from TDF;
-
- Paste (me; into : mutable Attribute from TDF;
- RT : mutable RelocationTable from TDF);
-
-end TextHighlightColorAttribute;
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_TextHighlightColorAttribute.cxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_TextHighlightColorAttribute.ixx"
-using namespace std;
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_TextHighlightColorAttribute::GetID ()
-{
- static Standard_GUID SALOMEDS_TextHighlightColorAttributeID ("12837190-8F52-11d6-A8A3-0001021E8C7F");
- return SALOMEDS_TextHighlightColorAttributeID;
-}
-
-
-
-//=======================================================================
-//function : constructor
-//purpose :
-//=======================================================================
-SALOMEDS_TextHighlightColorAttribute::SALOMEDS_TextHighlightColorAttribute()
-{Init(1,3);}
-
-//=======================================================================
-//function : ID
-//purpose :
-//=======================================================================
-
-const Standard_GUID& SALOMEDS_TextHighlightColorAttribute::ID () const { return GetID(); }
-
-
-//=======================================================================
-//function : NewEmpty
-//purpose :
-//=======================================================================
-
-Handle(TDF_Attribute) SALOMEDS_TextHighlightColorAttribute::NewEmpty () const
-{
- return new SALOMEDS_TextHighlightColorAttribute();
-}
-
-//=======================================================================
-//function : Restore
-//purpose :
-//=======================================================================
-
-void SALOMEDS_TextHighlightColorAttribute::Restore(const Handle(TDF_Attribute)& with)
-{
- Handle(TColStd_HArray1OfReal) s = Handle(TDataStd_RealArray)::DownCast (with)->Array ();
- TDataStd_RealArray::ChangeArray(s);
- return;
-}
-
-//=======================================================================
-//function : Paste
-//purpose :
-//=======================================================================
-
-void SALOMEDS_TextHighlightColorAttribute::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& ) const
-{
- Handle(TDataStd_RealArray)::DownCast (into)->ChangeArray (Array());
-}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_TextHighlightColorAttribute.hxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _SALOMEDS_TextHighlightColorAttribute_HeaderFile
-#define _SALOMEDS_TextHighlightColorAttribute_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_SALOMEDS_TextHighlightColorAttribute_HeaderFile
-#include <Handle_SALOMEDS_TextHighlightColorAttribute.hxx>
-#endif
-
-#ifndef _TDataStd_RealArray_HeaderFile
-#include <TDataStd_RealArray.hxx>
-#endif
-#ifndef _Handle_TDF_Attribute_HeaderFile
-#include <Handle_TDF_Attribute.hxx>
-#endif
-#ifndef _Handle_TDF_RelocationTable_HeaderFile
-#include <Handle_TDF_RelocationTable.hxx>
-#endif
-class Standard_GUID;
-class TDF_Attribute;
-class TDF_RelocationTable;
-
-
-class SALOMEDS_TextHighlightColorAttribute : public TDataStd_RealArray {
-
-public:
-
- inline void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-// inline void operator delete(void *anAddress, size_t size)
-// {
-// if (anAddress) Standard::Free((Standard_Address&)anAddress,size);
-// }
- // Methods PUBLIC
- //
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT SALOMEDS_TextHighlightColorAttribute();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT ~SALOMEDS_TextHighlightColorAttribute();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_TextHighlightColorAttribute_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-
-
-};
-
-
-
-
-
-// other inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_TextHighlightColorAttribute.ixx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#include "SALOMEDS_TextHighlightColorAttribute.jxx"
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-SALOMEDS_TextHighlightColorAttribute::~SALOMEDS_TextHighlightColorAttribute() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& SALOMEDS_TextHighlightColorAttribute_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_RealArray);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_RealArray);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient);
- if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_TextHighlightColorAttribute",
- sizeof(SALOMEDS_TextHighlightColorAttribute),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(SALOMEDS_TextHighlightColorAttribute) Handle(SALOMEDS_TextHighlightColorAttribute)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(SALOMEDS_TextHighlightColorAttribute) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_TextHighlightColorAttribute))) {
- _anOtherObject = Handle(SALOMEDS_TextHighlightColorAttribute)((Handle(SALOMEDS_TextHighlightColorAttribute)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& SALOMEDS_TextHighlightColorAttribute::DynamicType() const
-{
- return STANDARD_TYPE(SALOMEDS_TextHighlightColorAttribute) ;
-}
-Standard_Boolean SALOMEDS_TextHighlightColorAttribute::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(SALOMEDS_TextHighlightColorAttribute) == AType || TDataStd_RealArray::IsKind(AType));
-}
-Handle_SALOMEDS_TextHighlightColorAttribute::~Handle_SALOMEDS_TextHighlightColorAttribute() {}
-
+++ /dev/null
-// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
-//
-// 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 : SALOMEDS_TextHighlightColorAttribute.jxx
-// Author : Yves FRICAUD
-// Module : SALOME
-// $Header$
-
-#ifndef _Standard_GUID_HeaderFile
-#include <Standard_GUID.hxx>
-#endif
-#ifndef _TDF_Attribute_HeaderFile
-#include <TDF_Attribute.hxx>
-#endif
-#ifndef _TDF_RelocationTable_HeaderFile
-#include <TDF_RelocationTable.hxx>
-#endif
-#ifndef _SALOMEDS_TextHighlightColorAttribute_HeaderFile
-#include "SALOMEDS_TextHighlightColorAttribute.hxx"
-#endif
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_UseCaseIterator.hxx"
-#include <TCollection_AsciiString.hxx>
#include <string>
using namespace std;
-SALOMEDS_UseCaseBuilder::SALOMEDS_UseCaseBuilder(const Handle(SALOMEDSImpl_UseCaseBuilder)& theBuilder)
+SALOMEDS_UseCaseBuilder::SALOMEDS_UseCaseBuilder(SALOMEDSImpl_UseCaseBuilder* theBuilder)
{
_isLocal = true;
_local_impl = theBuilder;
SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = _local_impl->Append(obj->GetLocalImpl());
+ ret = _local_impl->Append(*(obj->GetLocalImpl()));
}
else ret = _corba_impl->Append(obj->GetCORBAImpl());
return ret;
SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = _local_impl->Remove(obj->GetLocalImpl());
+ ret = _local_impl->Remove(*(obj->GetLocalImpl()));
}
else ret = _corba_impl->Remove(obj->GetCORBAImpl());
return ret;
SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = _local_impl->AppendTo(father->GetLocalImpl(), obj->GetLocalImpl());
+ ret = _local_impl->AppendTo(*(father->GetLocalImpl()), *(obj->GetLocalImpl()));
}
else ret = _corba_impl->AppendTo(father->GetCORBAImpl(), obj->GetCORBAImpl());
return ret;
SALOMEDS_SObject* next = dynamic_cast<SALOMEDS_SObject*>(theNext.get());
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = _local_impl->InsertBefore(first->GetLocalImpl(), next->GetLocalImpl());
+ ret = _local_impl->InsertBefore(*(first->GetLocalImpl()), *(next->GetLocalImpl()));
}
else ret = _corba_impl->InsertBefore(first->GetCORBAImpl(), next->GetCORBAImpl());
return ret;
SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = _local_impl->SetCurrentObject(obj->GetLocalImpl());
+ ret = _local_impl->SetCurrentObject(*(obj->GetLocalImpl()));
}
else ret = _corba_impl->SetCurrentObject(obj->GetCORBAImpl());
return ret;
SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = _local_impl->HasChildren(obj->GetLocalImpl());
+ ret = _local_impl->HasChildren(*(obj->GetLocalImpl()));
}
else ret = _corba_impl->HasChildren(obj->GetCORBAImpl());
return ret;
SALOMEDS_SObject* obj = dynamic_cast<SALOMEDS_SObject*>(theObject.get());
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = _local_impl->IsUseCase(obj->GetLocalImpl());
+ ret = _local_impl->IsUseCase(*(obj->GetLocalImpl()));
}
else ret = _corba_impl->IsUseCase(obj->GetCORBAImpl());
return ret;
bool ret;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = _local_impl->SetName((char*)theName.c_str());
+ ret = _local_impl->SetName(theName);
}
else ret = _corba_impl->SetName((char*)theName.c_str());
return ret;
std::string aName;
if (_isLocal) {
SALOMEDS::Locker lock;
- aName = _local_impl->GetName().ToCString();
+ aName = _local_impl->GetName();
}
else aName = _corba_impl->GetName();
return aName;
SALOMEDS_SObject* obj = NULL;
if (_isLocal) {
SALOMEDS::Locker lock;
- obj = new SALOMEDS_SObject(_local_impl->AddUseCase((char*)theName.c_str()));
+ obj = new SALOMEDS_SObject(_local_impl->AddUseCase(theName));
}
else obj = new SALOMEDS_SObject(_corba_impl->AddUseCase((char*)theName.c_str()));
return _PTR(SObject)(obj);
if (_isLocal) {
SALOMEDS::Locker lock;
if(obj)
- it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(obj->GetLocalImpl()));
- else
- it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(NULL));
+ it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(*(obj->GetLocalImpl())));
+ else
+ it = new SALOMEDS_UseCaseIterator(_local_impl->GetUseCaseIterator(SALOMEDSImpl_SObject()));
}
else {
if(obj)
private:
bool _isLocal;
- Handle(SALOMEDSImpl_UseCaseBuilder) _local_impl;
- SALOMEDS::UseCaseBuilder_var _corba_impl;
+ SALOMEDSImpl_UseCaseBuilder* _local_impl;
+ SALOMEDS::UseCaseBuilder_var _corba_impl;
public:
- SALOMEDS_UseCaseBuilder(const Handle(SALOMEDSImpl_UseCaseBuilder)& theBuilder);
+ SALOMEDS_UseCaseBuilder(SALOMEDSImpl_UseCaseBuilder* theBuilder);
SALOMEDS_UseCaseBuilder(SALOMEDS::UseCaseBuilder_ptr theBuilder);
~SALOMEDS_UseCaseBuilder();
* Purpose :
*/
//============================================================================
-SALOMEDS_UseCaseBuilder_i::SALOMEDS_UseCaseBuilder_i(const Handle(SALOMEDSImpl_UseCaseBuilder)& theImpl,
+SALOMEDS_UseCaseBuilder_i::SALOMEDS_UseCaseBuilder_i(SALOMEDSImpl_UseCaseBuilder* theImpl,
CORBA::ORB_ptr orb)
{
_orb = CORBA::ORB::_duplicate(orb);
CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Append(SALOMEDS::SObject_ptr theObject)
{
SALOMEDS::Locker lock;
- if(_impl.IsNull() || theObject->_is_nil()) return 0;
+ if(!_impl || theObject->_is_nil()) return 0;
return _impl->Append(_impl->GetSObject(theObject->GetID()));
}
CORBA::Boolean SALOMEDS_UseCaseBuilder_i::Remove(SALOMEDS::SObject_ptr theObject)
{
SALOMEDS::Locker lock;
- if(_impl.IsNull() || theObject->_is_nil()) return 0;
+ if(!_impl || theObject->_is_nil()) return 0;
return _impl->Remove(_impl->GetSObject(theObject->GetID()));
}
SALOMEDS::SObject_ptr theObject)
{
SALOMEDS::Locker lock;
- if(_impl.IsNull() || theFather->_is_nil() || theObject->_is_nil()) return 0;
+ if(!_impl || theFather->_is_nil() || theObject->_is_nil()) return 0;
return _impl->AppendTo(_impl->GetSObject(theFather->GetID()), _impl->GetSObject(theObject->GetID()));
}
SALOMEDS::SObject_ptr theNext)
{
SALOMEDS::Locker lock;
- if(_impl.IsNull() || theFirst->_is_nil() || theNext->_is_nil()) return 0;
+ if(!_impl || theFirst->_is_nil() || theNext->_is_nil()) return 0;
return _impl->InsertBefore(_impl->GetSObject(theFirst->GetID()), _impl->GetSObject(theNext->GetID()));
}
CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetCurrentObject(SALOMEDS::SObject_ptr theObject)
{
SALOMEDS::Locker lock;
- if(_impl.IsNull() || theObject->_is_nil()) return 0;
+ if(!_impl || theObject->_is_nil()) return 0;
return _impl->SetCurrentObject(_impl->GetSObject(theObject->GetID()));
}
CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetRootCurrent()
{
SALOMEDS::Locker lock;
- if(_impl.IsNull()) return 0;
+ if(!_impl) return 0;
return _impl->SetRootCurrent();
}
CORBA::Boolean SALOMEDS_UseCaseBuilder_i::HasChildren(SALOMEDS::SObject_ptr theObject)
{
SALOMEDS::Locker lock;
- if(_impl.IsNull()) return 0;
+ if(!_impl) return 0;
return _impl->HasChildren(_impl->GetSObject(theObject->GetID()));
}
CORBA::Boolean SALOMEDS_UseCaseBuilder_i::SetName(const char* theName)
{
SALOMEDS::Locker lock;
- if(_impl.IsNull()) return 0;
+ if(!_impl) return 0;
return _impl->SetName((char*)theName);
}
{
SALOMEDS::Locker lock;
- if(_impl.IsNull()) return NULL;
- Handle(SALOMEDSImpl_SObject) aSO = _impl->GetCurrentObject();
+ if(!_impl) return NULL;
+ SALOMEDSImpl_SObject aSO = _impl->GetCurrentObject();
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
return so._retn();
}
char* SALOMEDS_UseCaseBuilder_i::GetName()
{
SALOMEDS::Locker lock;
- return CORBA::string_dup(_impl->GetName().ToCString());
+ return CORBA::string_dup(_impl->GetName().c_str());
}
//============================================================================
{
SALOMEDS::Locker lock;
- if(_impl.IsNull() || theObject->_is_nil()) return false;
+ if(!_impl || theObject->_is_nil()) return false;
return _impl->IsUseCase(_impl->GetSObject(theObject->GetID()));
}
{
SALOMEDS::Locker lock;
- if(_impl.IsNull()) return SALOMEDS::SObject::_nil();
- Handle(SALOMEDSImpl_SObject) aSO = _impl->AddUseCase((char*)theName);
+ if(!_impl) return SALOMEDS::SObject::_nil();
+ SALOMEDSImpl_SObject aSO = _impl->AddUseCase((char*)theName);
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
return so._retn();
}
{
SALOMEDS::Locker lock;
- if(_impl.IsNull()) return SALOMEDS::UseCaseIterator::_nil();
- Handle(SALOMEDSImpl_UseCaseIterator) anItr;
+ if(!_impl) return SALOMEDS::UseCaseIterator::_nil();
+ SALOMEDSImpl_UseCaseIterator anItr;
if(!CORBA::is_nil(theObject)) anItr = _impl->GetUseCaseIterator(_impl->GetSObject(theObject->GetID()));
- else anItr = _impl->GetUseCaseIterator(NULL);
+ else anItr = _impl->GetUseCaseIterator(SALOMEDSImpl_SObject());
SALOMEDS_UseCaseIterator_i* aServant = new SALOMEDS_UseCaseIterator_i(anItr, _orb);
SALOMEDS::UseCaseIterator_var anIterator = SALOMEDS::UseCaseIterator::_narrow(aServant->_this());
return anIterator._retn();
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
#include <SALOME_GenericObj_i.hh>
-// Cascade headers
-#include <Standard_GUID.hxx>
#include <stdio.h>
#include "SALOMEDSImpl_UseCaseIterator.hxx"
{
private:
- CORBA::ORB_ptr _orb;
- Handle(SALOMEDSImpl_UseCaseBuilder) _impl;
+ CORBA::ORB_ptr _orb;
+ SALOMEDSImpl_UseCaseBuilder* _impl;
public:
//! standard constructor
- SALOMEDS_UseCaseBuilder_i(const Handle(SALOMEDSImpl_UseCaseBuilder)& theDocument,
+ SALOMEDS_UseCaseBuilder_i(SALOMEDSImpl_UseCaseBuilder* theDocument,
CORBA::ORB_ptr);
//! standard destructor
using namespace std;
-SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(const Handle(SALOMEDSImpl_UseCaseIterator)& theIterator)
+SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(const SALOMEDSImpl_UseCaseIterator& theIterator)
{
_isLocal = true;
- _local_impl = theIterator;
+ _local_impl = theIterator.GetPersistentCopy();
_corba_impl = SALOMEDS::UseCaseIterator::_nil();
}
SALOMEDS_UseCaseIterator::SALOMEDS_UseCaseIterator(SALOMEDS::UseCaseIterator_ptr theIterator)
{
_isLocal = false;
- _local_impl = NULL;
_corba_impl = SALOMEDS::UseCaseIterator::_duplicate(theIterator);
}
SALOMEDS_UseCaseIterator::~SALOMEDS_UseCaseIterator()
{
if(!_isLocal) _corba_impl->Destroy();
+ else if(_local_impl) delete _local_impl;
}
void SALOMEDS_UseCaseIterator::Init(bool theAllLevels)
{
if (_isLocal) {
SALOMEDS::Locker lock;
- _local_impl->Init(theAllLevels);
+ if(_local_impl) _local_impl->Init(theAllLevels);
}
else _corba_impl->Init(theAllLevels);
}
bool SALOMEDS_UseCaseIterator::More()
{
- bool ret;
+ bool ret = false;
if (_isLocal) {
SALOMEDS::Locker lock;
- ret = _local_impl->More();
+ if(_local_impl) ret = _local_impl->More();
}
else ret = _corba_impl->More();
return ret;
{
if (_isLocal) {
SALOMEDS::Locker lock;
- _local_impl->Next();
+ if(_local_impl) _local_impl->Next();
}
else _corba_impl->Next();
}
_PTR(SObject) SALOMEDS_UseCaseIterator::Value()
{
- SALOMEDS_SObject* aSO;
+ SALOMEDS_SObject* aSO = NULL;
if (_isLocal) {
SALOMEDS::Locker lock;
- aSO = new SALOMEDS_SObject(_local_impl->Value());
+ if(_local_impl) aSO = new SALOMEDS_SObject(_local_impl->Value());
}
else aSO = new SALOMEDS_SObject(_corba_impl->Value());
return _PTR(SObject)(aSO);
{
private:
bool _isLocal;
- Handle(SALOMEDSImpl_UseCaseIterator) _local_impl;
- SALOMEDS::UseCaseIterator_var _corba_impl;
+ SALOMEDSImpl_UseCaseIterator* _local_impl;
+ SALOMEDS::UseCaseIterator_var _corba_impl;
public:
- SALOMEDS_UseCaseIterator(const Handle(SALOMEDSImpl_UseCaseIterator)& theIterator);
+ SALOMEDS_UseCaseIterator(const SALOMEDSImpl_UseCaseIterator& theIterator);
SALOMEDS_UseCaseIterator(SALOMEDS::UseCaseIterator_ptr theIterator);
~SALOMEDS_UseCaseIterator();
* Purpose :
*/
//============================================================================
-SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const Handle(SALOMEDSImpl_UseCaseIterator)& theImpl,
+SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const SALOMEDSImpl_UseCaseIterator& theImpl,
CORBA::ORB_ptr orb)
{
_orb = CORBA::ORB::_duplicate(orb);
- _impl = theImpl;
+ _impl = theImpl.GetPersistentCopy();
}
//============================================================================
//============================================================================
SALOMEDS_UseCaseIterator_i::~SALOMEDS_UseCaseIterator_i()
{
+ if(_impl) delete _impl;
}
//============================================================================
void SALOMEDS_UseCaseIterator_i::Init(CORBA::Boolean allLevels)
{
SALOMEDS::Locker lock;
- _impl->Init(allLevels);
+ if(_impl) _impl->Init(allLevels);
}
//============================================================================
CORBA::Boolean SALOMEDS_UseCaseIterator_i::More()
{
SALOMEDS::Locker lock;
+ if(!_impl) return false;
return _impl->More();
}
void SALOMEDS_UseCaseIterator_i::Next()
{
SALOMEDS::Locker lock;
- _impl->Next();
+ if(_impl) _impl->Next();
}
SALOMEDS::SObject_ptr SALOMEDS_UseCaseIterator_i::Value()
{
SALOMEDS::Locker lock;
- Handle(SALOMEDSImpl_SObject) aSO = _impl->Value();
+ if(!_impl) return SALOMEDS::SObject::_nil();
+ SALOMEDSImpl_SObject aSO = _impl->Value();
SALOMEDS::SObject_var so = SALOMEDS_SObject_i::New (aSO, _orb);
return so._retn();
}
{
private:
CORBA::ORB_ptr _orb;
- Handle(SALOMEDSImpl_UseCaseIterator) _impl;
+ SALOMEDSImpl_UseCaseIterator* _impl;
public:
//! standard constructor
- SALOMEDS_UseCaseIterator_i(const Handle(SALOMEDSImpl_UseCaseIterator)& theImpl,
+ SALOMEDS_UseCaseIterator_i(const SALOMEDSImpl_UseCaseIterator& theImpl,
CORBA::ORB_ptr);
//! standard destructor
return self._ComponentDataType
def Save(self, theComponent, theURL, isMultiFile):
- return NULL
+ return ""
def SaveASCII(self, theComponent, theURL, isMultiFile):
return self.Save(theComponent, theURL, isMultiFile)
return 1
def PublishInStudy(self, theStudy, theSObject, theObject, theName):
- return NULL
+ return None
def CanCopy(self, theObject):
return 0
-I$(srcdir)/$(RPATH)/LifeCycleCORBA \
-I$(srcdir)/$(RPATH)/SALOMEDS \
-I$(srcdir)/$(RPATH)/SALOMEDSClient \
- -I$(srcdir)/$(RPATH)/SALOMEDSImpl -I$(srcdir)/$(RPATH)/SALOMEDSImpl/Test \
+ -I$(srcdir)/$(RPATH)/DF \
+ -I$(srcdir)/$(RPATH)/SALOMEDSImpl -I$(srcdir)/$(RPATH)/SALOMEDSImpl/Test \
-I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
- @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \
- @CORBA_CXXFLAGS@ @CORBA_INCLUDES@
+ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @BOOST_CPPFLAGS@
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
$(RPATH)/SALOMELocalTrace/libSALOMELocalTrace.la \
$(RPATH)/SALOMETraceCollector/Test/libSALOMETraceCollectorTest.la \
$(RPATH)/SALOMEDSImpl/Test/libSALOMEDSImplTest.la \
+ $(RPATH)/DF/libDF.la \
$(RPATH)/SALOMEDSImpl/libSalomeDSImpl.la \
$(RPATH)/SALOMEDSClient/libSalomeDSClient.la \
$(RPATH)/SALOMEDS/libSalomeDS.la \
bin_PROGRAMS = TestSALOMEDS
dist_TestSALOMEDS_SOURCES = TestSALOMEDS.cxx
TestSALOMEDS_CPPFLAGS = $(COMMON_CPPFLAGS)
-TestSALOMEDS_LDADD = \
- libSALOMEDSTest.la ../libSalomeDS.la \
- $(RPATH)/NamingService/Test/libNamingServiceTest.la \
- $(COMMON_LIBS)
+TestSALOMEDS_LDADD = libSALOMEDSTest.la
#include "SALOMEDS_SObject.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <Standard_GUID.hxx>
-
using namespace std;
// ============================================================================
void SALOMEDSTest::setUp()
{
- int argc = 1;\r
- char* argv[] = {""};\r
+ int argc = 1;
+ char* argv[] = {""};
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
void SALOMEDSTest_Embedded::setUp()
{
- int argc = 1;\r
- char* argv[] = {""};\r
+ int argc = 1;
+ char* argv[] = {""};
ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
CPPUNIT_TEST_SUITE( SALOMEDSTest );
//Attributes' tests
-
+
CPPUNIT_TEST( testAttributeComment );
CPPUNIT_TEST( testAttributeDrawable );
CPPUNIT_TEST( testAttributeExpandable );
CPPUNIT_TEST( testAttributeLocalID );
CPPUNIT_TEST( testAttributeName );
CPPUNIT_TEST( testAttributeOpened );
- CPPUNIT_TEST( testAttributeParameter );
+ CPPUNIT_TEST( testAttributeParameter );
CPPUNIT_TEST( testAttributePersistentRef );
CPPUNIT_TEST( testAttributePixMap );
CPPUNIT_TEST( testAttributePythonObject );
CPPUNIT_TEST( testAttributeSequenceOfInteger );
CPPUNIT_TEST( testAttributeSequenceOfReal );
CPPUNIT_TEST( testAttributeStudyProperties );
- CPPUNIT_TEST( testAttributeTableOfInteger );
- CPPUNIT_TEST( testAttributeTableOfReal );
+ CPPUNIT_TEST( testAttributeTableOfInteger );
+ CPPUNIT_TEST( testAttributeTableOfReal );
CPPUNIT_TEST( testAttributeTableOfString );
CPPUNIT_TEST( testAttributeTarget );
CPPUNIT_TEST( testAttributeTextColor );
CPPUNIT_TEST( testSComponent );
CPPUNIT_TEST( testSComponentIterator );
CPPUNIT_TEST( testSObject );
- CPPUNIT_TEST( testStudy );
+ CPPUNIT_TEST( testStudy );
CPPUNIT_TEST( testStudyBuilder );
CPPUNIT_TEST( testStudyManager );
CPPUNIT_TEST( testUseCase );
CPPUNIT_TEST_SUITE( SALOMEDSTest_Embedded );
//Attributes' tests
-
+
CPPUNIT_TEST( testAttributeComment );
CPPUNIT_TEST( testAttributeDrawable );
CPPUNIT_TEST( testAttributeExpandable );
CPPUNIT_TEST( testAttributeParameter );
CPPUNIT_TEST( testAttributePersistentRef );
CPPUNIT_TEST( testAttributePixMap );
- CPPUNIT_TEST( testAttributePythonObject );
+ CPPUNIT_TEST( testAttributePythonObject );
CPPUNIT_TEST( testAttributeReal );
CPPUNIT_TEST( testAttributeSelectable );
CPPUNIT_TEST( testAttributeSequenceOfInteger );
CPPUNIT_TEST( testAttributeSequenceOfReal );
CPPUNIT_TEST( testAttributeStudyProperties );
- CPPUNIT_TEST( testAttributeTableOfInteger );
+ CPPUNIT_TEST( testAttributeTableOfInteger );
CPPUNIT_TEST( testAttributeTableOfReal );
CPPUNIT_TEST( testAttributeTableOfString );
CPPUNIT_TEST( testAttributeTarget );
CPPUNIT_TEST( testAttributeTreeNode );
CPPUNIT_TEST( testAttributeUserID );
CPPUNIT_TEST( testChildIterator );
- CPPUNIT_TEST( testSComponent );
+ CPPUNIT_TEST( testSComponent );
CPPUNIT_TEST( testSComponentIterator );
CPPUNIT_TEST( testSObject );
CPPUNIT_TEST( testStudy );
- CPPUNIT_TEST( testStudyBuilder );
+ CPPUNIT_TEST( testStudyBuilder );
+ CPPUNIT_TEST( testChildIterator );
CPPUNIT_TEST( testStudyManager );
CPPUNIT_TEST( testUseCase );
-
-
+
CPPUNIT_TEST_SUITE_END();
public:
//Check method IsExpandable
bool isExpandable = _attr->IsExpandable();
- CPPUNIT_ASSERT(!isExpandable);
+ CPPUNIT_ASSERT(isExpandable);
//Check method SetExpandable
- _attr->SetExpandable(true);
-
- CPPUNIT_ASSERT(_attr->IsExpandable());
-
_attr->SetExpandable(false);
CPPUNIT_ASSERT(!_attr->IsExpandable());
+ _attr->SetExpandable(true);
+
+ CPPUNIT_ASSERT(_attr->IsExpandable());
+
sm->Close(study);
}
//Check method IsSelectable
bool isSelectable = _attr->IsSelectable();
- CPPUNIT_ASSERT(!isSelectable);
+ CPPUNIT_ASSERT(isSelectable);
//Check method SetSelectable
- _attr->SetSelectable(true);
-
- CPPUNIT_ASSERT(_attr->IsSelectable());
-
_attr->SetSelectable(false);
CPPUNIT_ASSERT(!_attr->IsSelectable());
+ _attr->SetSelectable(true);
+
+ CPPUNIT_ASSERT(_attr->IsSelectable());
+
sm->Close(study);
}
vector<int> v = _attr->CorbaSequence();
CPPUNIT_ASSERT(v.size() == 3);
+
for(int i = 0; i<v.size(); i++)
CPPUNIT_ASSERT((i+1) == v[i]);
//Check the attribute creation
CPPUNIT_ASSERT(_attr);
-/*
+
//Check method SetTitle
_attr->SetTitle("Table_1");
vector<int> rs = _attr->GetRowSetIndices(1);
CPPUNIT_ASSERT(rs.size() == 1 && rs[0] == 1);
-*/
+
_attr->PutValue(32, 2,2);
CPPUNIT_ASSERT(_attr->HasValue(2, 2));
-/*
+
vector<string> rowTitles;
rowTitles.push_back("title1");
rowTitles.push_back("title2");
//Check method SetRowTitles
_attr->SetRowTitles(rowTitles);
-
+
//Check method SetRowTitle
_attr->SetRowTitle(1, "new_title");
//Check method GetColumnTitles
vector<string> ct = _attr->GetColumnTitles();
-
CPPUNIT_ASSERT(ct.size() == 2 && ct[0] == "new_title" && ct[1] == "title2");
-*/
vector<string> rowUnits;
rowUnits.push_back("unit1");
//Check method SetRowUnits
_attr->SetRowUnits(rowUnits);
-/*
-
//Check method SetRowUnit
_attr->SetRowUnit(1, "new_unit");
_attr->AddColumn(data);
+
CPPUNIT_ASSERT(_attr->GetNbColumns() == 3);
//Check method GetColumn
data2 = _attr->GetColumn(3);
CPPUNIT_ASSERT(data2.size() == 3 && data2[0] == 11 && data2[1] == -22 && data2[2] == -33);
-*/
+
sm->Close(study);
}
CPPUNIT_ASSERT(rt.size() == 2 && rt[0] == "new_title" && rt[1] == "title2");
-
vector<string> colTitles;
colTitles.push_back("title1");
colTitles.push_back("title2");
CPPUNIT_ASSERT(color.B == color2.B);
- sm->Close(study);
+ sm->Close(study);
}
CPPUNIT_ASSERT(isRaised);
_attr->Append(_attr2);
-
+
//Check method HasNext
CPPUNIT_ASSERT(_attr1->HasNext());
CPPUNIT_ASSERT(_attr2->GetPrevious()->Label() == _attr1->Label());
//Check method Depth
- CPPUNIT_ASSERT(_attr->Depth() == 0 && _attr1->Depth() == 1);
+ CPPUNIT_ASSERT(_attr->Depth() == 1 && _attr1->Depth() == 2);
//Check method IsRoot
CPPUNIT_ASSERT(_attr->IsRoot());
//Check method Prepend
_attr->Prepend(_attr2);
+
CPPUNIT_ASSERT(_attr->GetFirst()->Label() == _attr2->Label());
//Check possibility to Prepend to itself
//Try to create the attribute with given TreeID
string value = "0e1c36e6-1111-4d90-ab3b-18a14310e648";
- _PTR(AttributeTreeNode) _attr_guid = studyBuilder->FindOrCreateAttribute(so, "AttributeTreeNode"+value);
+ _PTR(AttributeTreeNode) _attr_guid = studyBuilder->FindOrCreateAttribute(so, "AttributeTreeNodeGUID"+value);
CPPUNIT_ASSERT(_attr_guid && _attr_guid->GetTreeID() == value);
-
- //Try to set invalid GUID
- isRaised = false;
- try {
- _attr->SetTreeID("invalid guid");
- }
- catch(...) {
- isRaised = true;
- }
- CPPUNIT_ASSERT(isRaised);
-
+
sm->Close(study);
}
#undef SALOMEDS_ALL_TESTS
value = "0e1c36e6-379b-4d90-ab3b-18a14310e648";
_PTR(AttributeUserID) _attr2 = studyBuilder->FindOrCreateAttribute(so, "AttributeUserID"+value);
CPPUNIT_ASSERT(_attr2 && _attr2->Value() == value);
-
- //Try to set invalid GUID
- bool isRaised = false;
- try {
- _attr->SetValue("invalid guid");
- }
- catch(...) {
- isRaised = true;
- }
- CPPUNIT_ASSERT(isRaised);
-
-
+
sm->Close(study);
}
//Check that there are two SObject under so
CPPUNIT_ASSERT(count == 2);
-
+
sm->Close(study);
}
//Check method GetAllAttributes
vector< _PTR(GenericAttribute) > v = so->GetAllAttributes();
+
CPPUNIT_ASSERT(v.size() == 5); //+AttributeTarget +AttributeTreeNode
//Check method GetName
//Check method NewComponentIterator
_PTR(SComponentIterator) componentIterator = study->NewComponentIterator();
+
CPPUNIT_ASSERT(componentIterator);
//Check method GetTransientReference
isException = true;
}
CPPUNIT_ASSERT(!isException);
-
}
_PTR(AttributeName) an3 = studyBuilder->FindOrCreateAttribute(so3, "AttributeName");
CPPUNIT_ASSERT(an3);
- cout << endl << "########## 1" << endl;
-
//Try to create attribute with invalid type
CPPUNIT_ASSERT(!studyBuilder->FindOrCreateAttribute(so3, "invalid type"));
- cout << endl << "########## 2" << endl;
-
//Check method FindAttribute
_PTR(GenericAttribute) ga;
CPPUNIT_ASSERT(studyBuilder->FindAttribute(so3, ga, "AttributeName"));
- cout << endl << "########## 3" << endl;
-
//Try to find attribute with invalid type
CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so3, ga, "invalid type"));
- cout << endl << "########## 4" << endl;
-
//Check method RemoveObject
studyBuilder->RemoveObject(so3);
CPPUNIT_ASSERT(!studyBuilder->FindAttribute(so3, ga, "AttributeName"));
//Check method SetGUID and IsGUID
string value = "0e1c36e6-379b-4d90-ab3b-17a14310e648";
studyBuilder->SetGUID(so1, value);
- CPPUNIT_ASSERT(studyBuilder->IsGUID(so1, value));
- //Try to set invalid GUID
- isRaised = false;
- try {
- studyBuilder->SetGUID(so1, "invalid GUID");
- }
- catch(...) {
- isRaised = true;
- }
- CPPUNIT_ASSERT(isRaised);
+ CPPUNIT_ASSERT(studyBuilder->IsGUID(so1, value));
+/* Not implemented
//Check method UndoLimit (set/get)
studyBuilder->UndoLimit(10);
CPPUNIT_ASSERT(studyBuilder->UndoLimit() == 10);
-
- //Check transactions methods: NewCommand, CommitCommand, AbortCommand,
- //HasOpenedCommand, Undo, Redo, GetAvailableUndos, GetAvailableRedos
- _PTR(SObject) so4 = studyBuilder->NewObject(sco3);
- CPPUNIT_ASSERT(so4);
- studyBuilder->NewCommand();
- CPPUNIT_ASSERT(studyBuilder->HasOpenCommand());
- _PTR(AttributeName) an4 = studyBuilder->FindOrCreateAttribute(so4, "AttributeName");
- CPPUNIT_ASSERT(an4);
- an4->SetValue("command1");
- studyBuilder->CommitCommand();
- CPPUNIT_ASSERT(!studyBuilder->HasOpenCommand());
- studyBuilder->NewCommand();
- an4->SetValue("command2");
- studyBuilder->AbortCommand();
- CPPUNIT_ASSERT(an4->Value() == "command1");
- studyBuilder->NewCommand();
- an4->SetValue("command2");
- studyBuilder->CommitCommand();
- studyBuilder->Undo();
- CPPUNIT_ASSERT(an4->Value() == "command1");
- CPPUNIT_ASSERT(studyBuilder->GetAvailableRedos());
- studyBuilder->Redo();
- CPPUNIT_ASSERT(an4->Value() == "command2");
- CPPUNIT_ASSERT(studyBuilder->GetAvailableUndos());
+*/
//Check method SetName
studyBuilder->SetName(so1, "new name");
//Check method LoadWith
_PTR(Study) study2 = sm->NewStudy("Study2");
-
+
SALOME_NamingService NS(_orb);
- CORBA::Object_var obj = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("SuperVisionContainer", "SUPERV");
+ CORBA::Object_var obj = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("FactoryServer", "SMESH");
CPPUNIT_ASSERT(!CORBA::is_nil(obj));
- MESSAGE("Created a new GEOM component");
+ MESSAGE("Created a new SMESH component");
SALOMEDS::Driver_var drv = SALOMEDS::Driver::_narrow(obj);
CPPUNIT_ASSERT(!CORBA::is_nil(drv));
+
_PTR(StudyBuilder) sb2 = study2->NewBuilder();
- _PTR(SComponent) sco = sb2->NewComponent("SUPERV");
+ _PTR(SComponent) sco = sb2->NewComponent("SMESH");
+
ior = _orb->object_to_string(drv);
sb2->DefineComponentInstance(sco, ior);
_PTR(Study) study3 = sm->Open("srn_SALOMEDS_UnitTests.hdf");
_PTR(StudyBuilder) sb3 = study3->NewBuilder();
- _PTR(SComponent) aComp = study3->FindComponent("SUPERV");
+ _PTR(SComponent) aComp = study3->FindComponent("SMESH");
CPPUNIT_ASSERT(aComp);
- CORBA::Object_var obj2 = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("SuperVisionContainer", "SUPERV");
+ CORBA::Object_var obj2 = SALOME_LifeCycleCORBA(&NS).FindOrLoad_Component("FactoryServer", "SMESH");
CPPUNIT_ASSERT(!CORBA::is_nil(obj2));
SALOMEDS::Driver_var drv2 = SALOMEDS::Driver::_narrow(obj2);
ior = _orb->object_to_string(drv2);
isRaised = false;
try {
+ //getchar();
sb3->LoadWith(aComp, ior);
}
catch(...) {
isRaised = true;
}
+
CPPUNIT_ASSERT(!isRaised);
ior = "";
isRaised = true;
}
+
CPPUNIT_ASSERT(!isRaised);
_PTR(SObject) so5 = study3->FindObjectByPath("/Component/Dir1");
CPPUNIT_ASSERT(so5);
}
CPPUNIT_ASSERT(isRaised);
- sm->Close(study3);
+ sm->Close(study3);
}
CPPUNIT_ASSERT(sm->Copy(so1));
-
CPPUNIT_ASSERT(!sm->CanPaste(so1)); //The father component has no IOR
_PTR(SObject) so1_2 = sb1->NewObject(sco1);
CPPUNIT_ASSERT(na2 && na2->Value() == "Some name");
-
//Check method SaveAs
sm->SaveAs("srn_UnitTest_Save.hdf", study1, false);
string url = study1->URL();
string soID = so3->GetID();
_PTR(AttributeName) na3 = sb3->FindOrCreateAttribute(so3, "AttributeName");
CPPUNIT_ASSERT(na3);
+
na3->SetValue("Saved study");
+
// Save and close the study
sm->Save(study1_opened, false);
+
sm->Close(study1_opened);
// Open saved study and find the created SObject with AttributeName, then compare the stored string
_PTR(Study) study2_opened = sm->Open("srn_UnitTest_Save.hdf");
+
system("rm -f srn_UnitTest_Save.hdf");
+
CPPUNIT_ASSERT(study2_opened);
+
_PTR(SObject) so4 = study2_opened->CreateObjectID(soID);
_PTR(StudyBuilder) sb4 = study2_opened->NewBuilder();
_PTR(AttributeName) na4 = sb4->FindOrCreateAttribute(so4, "AttributeName");
CPPUNIT_ASSERT(na4 && na4->Value() == "Saved study"); //Compare the value of restored attribute with string that has to be saved.
-
//Check method SaveAsASCII
sm->SaveAsASCII("srn_UnitTest_SaveASCII.hdf", study2_opened, false);
url = study2_opened->URL();
sm->Close(study2_opened);
+
_PTR(Study) study3_opened = sm->Open("srn_UnitTest_SaveASCII.hdf"); //Contains Test component
system("rm -f srn_UnitTest_SaveASCII.hdf");
CPPUNIT_ASSERT(study3_opened);
#include "SALOMEDSImplTest.hxx"
#include "SALOMEDSTest.hxx"
-#include <TCollection_AsciiString.hxx>
-
// --- Registers the fixture into the 'registry'
CPPUNIT_TEST_SUITE_REGISTRATION( SALOMEDSTest );
string kernel_root = getenv("KERNEL_ROOT_DIR");
CPPUNIT_ASSERT(!kernel_root.empty());
kernel_root+="/share/salome/resources/kernel";
- setenv("CSF_PluginDefaults", kernel_root.c_str(), 1);
- setenv("CSF_SALOMEDS_ResourcesDefaults", kernel_root.c_str(), 1);
CORBA::Object_var poaObj = orb->resolve_initial_references("RootPOA");
if(!CORBA::is_nil(poaObj)) {
virtual bool IsSaved() = 0;
virtual void IsSaved(bool save) = 0;
virtual bool IsModified() = 0;
+ virtual void Modified() = 0;
virtual std::string URL() = 0;
virtual void URL(const std::string& url) = 0;
virtual int StudyId() = 0;
SALOMEDSImpl_StudyBuilder.hxx \
SALOMEDSImpl_Study.hxx \
SALOMEDSImpl_StudyManager.hxx \
- SALOMEDSImpl_OCAFApplication.hxx \
SALOMEDSImpl_ChildNodeIterator.hxx \
SALOMEDSImpl_IParameters.hxx \
SALOMEDSImpl_TMPFile.hxx
# This local variable defines the list of CPPFLAGS common to all target in this package.
COMMON_CPPFLAGS=\
- @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \
-I$(srcdir)/../Basics \
-I$(srcdir)/../SALOMELocalTrace \
-I$(srcdir)/../HDFPersist \
- @HDF5_INCLUDES@
+ -I$(srcdir)/../DF \
+ @HDF5_INCLUDES@ \
+ @BOOST_CPPFLAGS@
# This flag is used to resolve the dependencies of OCC libraries.
LDXMUFLAGS = -L/usr/X11R6/lib@LIB_LOCATION_SUFFIX@ -lXmu
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
../HDFPersist/libSalomeHDFPersist.la \
- @CAS_OCAF@ \
+ ../DF/libDF.la \
@HDF5_LIBS@ \
$(LDXMUFLAGS)
SALOMEDSImpl_SObject.cxx \
SALOMEDSImpl_SComponent.cxx \
SALOMEDSImpl_ChildIterator.cxx \
- SALOMEDSImpl_OCAFApplication.cxx \
SALOMEDSImpl_AttributeIOR.cxx \
SALOMEDSImpl_AttributeExternalFileDef.cxx \
SALOMEDSImpl_AttributeFileType.cxx \
SALOMEDSImpl_ChildNodeIterator.hxx \
SALOMEDSImpl_Driver.hxx \
SALOMEDSImpl_GenericAttribute.hxx \
- SALOMEDSImpl_OCAFApplication.hxx \
SALOMEDSImpl_SComponent.hxx \
SALOMEDSImpl_SComponentIterator.hxx \
SALOMEDSImpl_SObject.hxx \
using namespace std;
#endif
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeComment::GetID ()
+const std::string& SALOMEDSImpl_AttributeComment::GetID ()
{
- static Standard_GUID CommentID ("7AF2F7CC-1CA2-4476-BE95-8ACC996BC7B9");
+ static std::string CommentID ("7AF2F7CC-1CA2-4476-BE95-8ACC996BC7B9");
return CommentID;
}
-Handle(SALOMEDSImpl_AttributeComment) SALOMEDSImpl_AttributeComment::Set (const TDF_Label& L,
- const TCollection_ExtendedString& Val)
+SALOMEDSImpl_AttributeComment* SALOMEDSImpl_AttributeComment::Set (const DF_Label& L,
+ const std::string& Val)
{
- Handle(SALOMEDSImpl_AttributeComment) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), A)) {
+ SALOMEDSImpl_AttributeComment* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeComment*)L.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) {
A = new SALOMEDSImpl_AttributeComment();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeComment::SetValue (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributeComment::SetValue (const string& S)
{
CheckLocked();
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeComment::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeComment::ID () const { return GetID(); }
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeComment::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeComment::NewEmpty () const
{
return new SALOMEDSImpl_AttributeComment();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeComment::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeComment::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributeComment)::DownCast (with)->Value ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributeComment*>(with)->Value ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeComment::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeComment::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeComment)::DownCast (into)->SetValue(myString);
+ dynamic_cast<SALOMEDSImpl_AttributeComment*>(into)->SetValue(myString);
}
#ifndef _SALOMEDSImpl_AttributeComment_HeaderFile
#define _SALOMEDSImpl_AttributeComment_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
-#include <Standard_GUID.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeComment, SALOMEDSImpl_GenericAttribute )
+#include <string>
class SALOMEDSImpl_AttributeComment : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeComment() :SALOMEDSImpl_GenericAttribute("AttributeComment") {}
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeComment) Set(const TDF_Label& L, const TCollection_ExtendedString& Val);
-Standard_EXPORT void SetValue (const TCollection_ExtendedString& S);
-Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
+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; }
-Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) 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_AttributeComment() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeComment )
};
#endif
using namespace std;
#endif
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeDrawable::GetID ()
+const std::string& SALOMEDSImpl_AttributeDrawable::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeDrawableID ("12837184-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeDrawableID ("12837184-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeDrawableID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeDrawable) SALOMEDSImpl_AttributeDrawable::Set (const TDF_Label& L,
- const Standard_Integer value)
+SALOMEDSImpl_AttributeDrawable* SALOMEDSImpl_AttributeDrawable::Set (const DF_Label& L,
+ const int value)
{
- Handle(SALOMEDSImpl_AttributeDrawable) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeDrawable::GetID(),A)) {
+ SALOMEDSImpl_AttributeDrawable* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeDrawable*)L.FindAttribute(SALOMEDSImpl_AttributeDrawable::GetID()))) {
A = new SALOMEDSImpl_AttributeDrawable();
L.AddAttribute(A);
}
//function : SetDrawable
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeDrawable::SetDrawable(const Standard_Integer theValue)
+void SALOMEDSImpl_AttributeDrawable::SetDrawable(const int theValue)
{
CheckLocked();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeDrawable::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeDrawable::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeDrawable::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeDrawable::NewEmpty () const
{
return new SALOMEDSImpl_AttributeDrawable();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeDrawable::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeDrawable::Restore(DF_Attribute* with)
{
- myValue = Handle(SALOMEDSImpl_AttributeDrawable)::DownCast (with)->IsDrawable ();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeDrawable*>(with)->IsDrawable ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeDrawable::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeDrawable::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeDrawable)::DownCast (into)->SetDrawable (myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeDrawable*>(into)->SetDrawable (myValue);
}
#ifndef _SALOMEDSImpl_AttributeDrawable_HeaderFile
#define _SALOMEDSImpl_AttributeDrawable_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_GUID.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeDrawable, SALOMEDSImpl_GenericAttribute )
-
-
class SALOMEDSImpl_AttributeDrawable : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+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 Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeDrawable Set(const TDF_Label& label,const Standard_Integer value) ;
+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 Standard_Integer theValue);
-Standard_EXPORT Standard_Integer IsDrawable() const { return myValue; }
+Standard_EXPORT void SetDrawable(const int theValue);
+Standard_EXPORT int IsDrawable() const { return myValue; }
Standard_EXPORT SALOMEDSImpl_AttributeDrawable();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) 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_AttributeDrawable() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeDrawable )
-
};
#endif
using namespace std;
#endif
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeExpandable::GetID ()
+const std::string& SALOMEDSImpl_AttributeExpandable::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeExpandableID ("12837185-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeExpandableID ("12837185-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeExpandableID;
}
//function : Set
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeExpandable) SALOMEDSImpl_AttributeExpandable::Set (const TDF_Label& L,
- const Standard_Integer value)
+SALOMEDSImpl_AttributeExpandable* SALOMEDSImpl_AttributeExpandable::Set (const DF_Label& L,
+ const int value)
{
- Handle(SALOMEDSImpl_AttributeExpandable) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeExpandable::GetID(),A)) {
+ SALOMEDSImpl_AttributeExpandable* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeExpandable*)L.FindAttribute(SALOMEDSImpl_AttributeExpandable::GetID()))) {
A = new SALOMEDSImpl_AttributeExpandable();
L.AddAttribute(A);
}
//function : SetExpandable
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeExpandable::SetExpandable(const Standard_Integer theValue)
+void SALOMEDSImpl_AttributeExpandable::SetExpandable(const int theValue)
{
CheckLocked();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeExpandable::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeExpandable::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeExpandable::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeExpandable::NewEmpty () const
{
return new SALOMEDSImpl_AttributeExpandable();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeExpandable::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeExpandable::Restore(DF_Attribute* with)
{
- myValue = Handle(SALOMEDSImpl_AttributeExpandable)::DownCast (with)->IsExpandable ();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeExpandable*>(with)->IsExpandable ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeExpandable::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeExpandable::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeExpandable)::DownCast (into)->SetExpandable (myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeExpandable*>(into)->SetExpandable (myValue);
}
#ifndef _SALOMEDSImpl_AttributeExpandable_HeaderFile
#define _SALOMEDSImpl_AttributeExpandable_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_GUID.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeExpandable, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeExpandable : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+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 Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeExpandable Set(const TDF_Label& label,const Standard_Integer value) ;
+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 Standard_Integer value);
+Standard_EXPORT void SetExpandable(const int value);
Standard_EXPORT int IsExpandable() const { return myValue; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) 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_AttributeExpandable() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeExpandable )
};
#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::GetID ()
+const std::string& SALOMEDSImpl_AttributeExternalFileDef::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE");
+ static std::string SALOMEDSImpl_AttributeExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE");
return SALOMEDSImpl_AttributeExternalFileDefID;
}
//function : Set
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeExternalFileDef)
-SALOMEDSImpl_AttributeExternalFileDef::Set (const TDF_Label& L, const TCollection_ExtendedString& S)
+SALOMEDSImpl_AttributeExternalFileDef*
+SALOMEDSImpl_AttributeExternalFileDef::Set (const DF_Label& L, const std::string& S)
{
- Handle(SALOMEDSImpl_AttributeExternalFileDef) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeExternalFileDef::GetID(),A)) {
+ SALOMEDSImpl_AttributeExternalFileDef* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeExternalFileDef*)L.FindAttribute(SALOMEDSImpl_AttributeExternalFileDef::GetID()))) {
A = new SALOMEDSImpl_AttributeExternalFileDef();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributeExternalFileDef::SetValue (const std::string& S)
{
CheckLocked();
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeExternalFileDef::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeExternalFileDef::ID () const { return GetID(); }
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeExternalFileDef::NewEmpty () const
{
return new SALOMEDSImpl_AttributeExternalFileDef();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeExternalFileDef::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeExternalFileDef::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast (with)->Value ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributeExternalFileDef*>(with)->Value ();
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeExternalFileDef::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeExternalFileDef::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeExternalFileDef) anAttr = Handle(SALOMEDSImpl_AttributeExternalFileDef)::DownCast(into);
+ SALOMEDSImpl_AttributeExternalFileDef* anAttr = dynamic_cast<SALOMEDSImpl_AttributeExternalFileDef*>(into);
anAttr->SetValue(myString);
}
#ifndef _SALOMEDSImpl_AttributeExternalFileDef_HeaderFile
#define _SALOMEDSImpl_AttributeExternalFileDef_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_ExtendedString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeExternalFileDef, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeExternalFileDef : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeExternalFileDef Set(const TDF_Label& label,
- const TCollection_ExtendedString& Name);
+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 TCollection_ExtendedString& value);
-Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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 TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeExternalFileDef )
};
#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeFileType, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeFileType, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeFileType::GetID ()
+const std::string& SALOMEDSImpl_AttributeFileType::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeFileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340");
+ static std::string SALOMEDSImpl_AttributeFileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340");
return SALOMEDSImpl_AttributeFileTypeID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeFileType) SALOMEDSImpl_AttributeFileType::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S)
+SALOMEDSImpl_AttributeFileType* SALOMEDSImpl_AttributeFileType::Set (const DF_Label& L,
+ const std::string& S)
{
- Handle(SALOMEDSImpl_AttributeFileType) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeFileType::GetID(),A)) {
+ SALOMEDSImpl_AttributeFileType* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeFileType*)L.FindAttribute(SALOMEDSImpl_AttributeFileType::GetID()))) {
A = new SALOMEDSImpl_AttributeFileType();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeFileType::SetValue (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributeFileType::SetValue (const std::string& S)
{
CheckLocked();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeFileType::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeFileType::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeFileType::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeFileType::NewEmpty () const
{
return new SALOMEDSImpl_AttributeFileType();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeFileType::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeFileType::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributeFileType)::DownCast (with)->Value ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributeFileType*>(with)->Value ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeFileType::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeFileType::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeFileType)::DownCast (into)->SetValue (myString);
+ dynamic_cast<SALOMEDSImpl_AttributeFileType*>(into)->SetValue (myString);
}
#ifndef _SALOMEDSImpl_AttributeFileType_HeaderFile
#define _SALOMEDSImpl_AttributeFileType_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <Standard_GUID.hxx>
-#include <TCollection_ExtendedString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeFileType, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeFileType : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeFileType Set(const TDF_Label& label,
- const TCollection_ExtendedString& Name) ;
+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 TCollection_ExtendedString& value);
-Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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 TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeFileType )
};
// Module : SALOME
#include "SALOMEDSImpl_AttributeFlags.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
have only two states (0 and 1).
*/
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : SALOMEDSImpl_AttributeFlags::GetID
//purpose : Get GUID of this attribute
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeFlags::GetID ()
+const std::string& SALOMEDSImpl_AttributeFlags::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeFlagsID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" );
+ static std::string SALOMEDSImpl_AttributeFlagsID( "866EEC9F-A517-4cb4-88E6-E208DB8FC96F" );
return SALOMEDSImpl_AttributeFlagsID;
}
//function : SALOMEDSImpl_AttributeFlags::Set
//purpose : Set value of the attribute
//=======================================================================
-Handle(SALOMEDSImpl_AttributeFlags) SALOMEDSImpl_AttributeFlags::Set(const TDF_Label& L,
- const Standard_Integer value )
+SALOMEDSImpl_AttributeFlags* SALOMEDSImpl_AttributeFlags::Set(const DF_Label& L,
+ const int value )
{
- Handle(SALOMEDSImpl_AttributeFlags) A;
- if ( !L.FindAttribute(SALOMEDSImpl_AttributeFlags::GetID(),A ) )
+ SALOMEDSImpl_AttributeFlags* A = NULL;
+ if ( !(A=(SALOMEDSImpl_AttributeFlags*)L.FindAttribute(SALOMEDSImpl_AttributeFlags::GetID())) )
{
A = new SALOMEDSImpl_AttributeFlags();
L.AddAttribute( A );
//function : SALOMEDSImpl_AttributeFlags::ID
//purpose : Get GUID of this attribute
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeFlags::ID () const
+const std::string& SALOMEDSImpl_AttributeFlags::ID () const
{
return GetID();
}
//purpose : Create new empty attribute
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeFlags::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeFlags::NewEmpty () const
{
return new SALOMEDSImpl_AttributeFlags();
}
//function : SALOMEDSImpl_AttributeFlags::Restore
//purpose : Assign given value to the attribute
//=======================================================================
-void SALOMEDSImpl_AttributeFlags::Restore( const Handle(TDF_Attribute)& with )
+void SALOMEDSImpl_AttributeFlags::Restore( DF_Attribute* with )
{
- myValue = Handle(SALOMEDSImpl_AttributeFlags)::DownCast( with )->Get();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeFlags*>( with )->Get();
return;
}
//function : SALOMEDSImpl_AttributeFlags::Paste
//purpose : Assign internal value to the given attribute
//=======================================================================
-void SALOMEDSImpl_AttributeFlags::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT ) const
+void SALOMEDSImpl_AttributeFlags::Paste( DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeFlags)::DownCast( into )->Set( myValue );
+ dynamic_cast<SALOMEDSImpl_AttributeFlags*>( into )->Set( myValue );
}
//=======================================================================
//function : SALOMEDSImpl_AttributeFlags::Set
//purpose : Set value
//=======================================================================
-void SALOMEDSImpl_AttributeFlags::Set( const Standard_Integer v )
+void SALOMEDSImpl_AttributeFlags::Set( const int v )
{
Backup();
myValue=v;
//function : SALOMEDSImpl_AttributeFlags::Get
//purpose : GetValue
//=======================================================================
-Standard_Integer SALOMEDSImpl_AttributeFlags::Get() const
+int SALOMEDSImpl_AttributeFlags::Get() const
{
return myValue;
}
#ifndef SALOMEDSImpl_AttributeFlags_HeaderFile
#define SALOMEDSImpl_AttributeFlags_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
/*
Class : SALOMEDSImpl_AttributeFlags
Description : This class is intended for storing different object attributes that
have only two states (0 and 1).
*/
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeFlags, SALOMEDSImpl_GenericAttribute )
-
#ifndef WNT
class Standard_EXPORT SALOMEDSImpl_AttributeFlags : public SALOMEDSImpl_GenericAttribute
#else
#endif
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeFlags) Set(const TDF_Label&, const Standard_Integer );
+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 virtual ~SALOMEDSImpl_AttributeFlags();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore( const Handle(TDF_Attribute)& with );
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste( const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT ) const;
-Standard_EXPORT void Set( const Standard_Integer );
-Standard_EXPORT Standard_Integer Get() 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 void Set( const int );
+Standard_EXPORT int Get() const;
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeFlags )
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributeGraphic.hxx"
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
+#include "DF_Attribute.hxx"
+
+using namespace std;
/*
Class : SALOMEDSImpl_AttributeGraphic
graphic representation of objects in dirrent views
*/
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeGraphic, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeGraphic, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose : Get GUID of this attribute
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeGraphic::GetID()
+const std::string& SALOMEDSImpl_AttributeGraphic::GetID()
{
- static Standard_GUID SALOMEDSImpl_AttributeGraphicID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" );
+ static std::string SALOMEDSImpl_AttributeGraphicID( "F17AE8F0-E354-4d6f-8E42-38385C36E67E" );
return SALOMEDSImpl_AttributeGraphicID;
}
//function : SetVisibility
//purpose : Set visibility of object in given view
//=======================================================================
-void SALOMEDSImpl_AttributeGraphic::SetVisibility(const Standard_Integer theViewId,
- const Standard_Boolean theValue )
+void SALOMEDSImpl_AttributeGraphic::SetVisibility(const int theViewId,
+ const bool theValue )
{
- if ( myVisibility.IsBound( theViewId ) && myVisibility( theViewId ) == theValue )
+ if ( myVisibility.find( theViewId ) != myVisibility.end() && myVisibility[theViewId] == theValue )
return;
Backup();
- if ( myVisibility.IsBound( theViewId ) )
- myVisibility.ChangeFind( theViewId ) = theValue ? 1 : 0;
- else
- myVisibility.Bind( theViewId, theValue ? 1 : 0 );
+ myVisibility[ theViewId ] = theValue ? 1 : 0;
}
//function : Get
//purpose : Get visibility of object in given view
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeGraphic::GetVisibility(const Standard_Integer theViewId ) const
+bool SALOMEDSImpl_AttributeGraphic::GetVisibility(const int theViewId )
{
- return myVisibility.IsBound( theViewId ) ? myVisibility( theViewId ) : false;
+ bool isVisible = false;
+ if(myVisibility.find( theViewId )!=myVisibility.end())
+ isVisible = (bool)myVisibility[theViewId];
+ else
+ isVisible = false;
+
+ return isVisible;
}
//function : ID
//purpose : Get GUID of this attribute
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeGraphic::ID () const
+const std::string& SALOMEDSImpl_AttributeGraphic::ID () const
{
return GetID();
}
//function : NewEmpty
//purpose : Create new empty attribute
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeGraphic::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeGraphic::NewEmpty () const
{
return new SALOMEDSImpl_AttributeGraphic ();
}
//function : SetVisibility
//purpose : Set visibility of object in all views
//=======================================================================
-void SALOMEDSImpl_AttributeGraphic::SetVisibility( const TColStd_DataMapOfIntegerInteger& theMap )
+void SALOMEDSImpl_AttributeGraphic::SetVisibility( const map<int, int>& theMap )
{
myVisibility = theMap;
}
//function : SetVisibility
//purpose : Get visibility of object in all views
//=======================================================================
-const TColStd_DataMapOfIntegerInteger& SALOMEDSImpl_AttributeGraphic::GetVisibility()
+const map<int, int>& SALOMEDSImpl_AttributeGraphic::GetVisibility()
{
return myVisibility;
}
//function : Restore
//purpose : Restore value of attribute with value of theWith one
//=======================================================================
-void SALOMEDSImpl_AttributeGraphic::Restore( const Handle(TDF_Attribute)& theWith )
+void SALOMEDSImpl_AttributeGraphic::Restore( DF_Attribute* theWith )
{
- Handle(SALOMEDSImpl_AttributeGraphic) anAttr =
- Handle(SALOMEDSImpl_AttributeGraphic)::DownCast( theWith );
+ SALOMEDSImpl_AttributeGraphic* anAttr =
+ dynamic_cast<SALOMEDSImpl_AttributeGraphic*>( theWith );
- if ( !anAttr.IsNull() )
+ if ( anAttr )
SetVisibility( anAttr->GetVisibility() );
}
//function : Paste
//purpose : Paste value of current attribute to the value of entry one
//=======================================================================
-void SALOMEDSImpl_AttributeGraphic::Paste( const Handle(TDF_Attribute)& theInto,
- const Handle(TDF_RelocationTable)& ) const
+void SALOMEDSImpl_AttributeGraphic::Paste( DF_Attribute* theInto)
{
- Handle(SALOMEDSImpl_AttributeGraphic) anAttr =
- Handle(SALOMEDSImpl_AttributeGraphic)::DownCast( theInto );
+ SALOMEDSImpl_AttributeGraphic* anAttr =
+ dynamic_cast<SALOMEDSImpl_AttributeGraphic*>( theInto );
- if ( !anAttr.IsNull() )
+ if ( anAttr )
anAttr->SetVisibility( myVisibility );
}
-//=======================================================================
-//function : Dump
-//purpose : Dump
-//=======================================================================
-Standard_OStream& SALOMEDSImpl_AttributeGraphic::Dump( Standard_OStream& anOS ) const
-{
- anOS << "Visibility of object:" << endl;
- TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIter( myVisibility );
- for ( ; anIter.More(); anIter.Next() )
- {
- char str[ 100 ];
-
- if ( GetVisibility( anIter.Key() ) )
- sprintf( str, "Viewer ID = 0x%X State = VISIBLE\n", anIter.Key() );
- else
- sprintf( str, "Viewer ID = 0x%X State = INVISIBLE\n", anIter.Key() );
-
- anOS << str;
- }
-
- anOS << "Integer";
- return anOS;
-}
-
#ifndef SALOMEDSImpl_AttributeGraphic_HeaderFile
#define SALOMEDSImpl_AttributeGraphic_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
+#include <map>
/*
Class : SALOMEDSImpl_AttributeGraphic
graphic representation of objects in dirrent views
*/
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeGraphic, SALOMEDSImpl_GenericAttribute)
-
-
-
#ifndef WNT
class Standard_EXPORT SALOMEDSImpl_AttributeGraphic : public SALOMEDSImpl_GenericAttribute
#else
Standard_EXPORT SALOMEDSImpl_AttributeGraphic();
Standard_EXPORT ~SALOMEDSImpl_AttributeGraphic();
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT void SetVisibility( const Standard_Integer,
- const Standard_Boolean );
-Standard_EXPORT Standard_Boolean GetVisibility( const Standard_Integer ) const;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore( const Handle(TDF_Attribute)& theWith );
-Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
-Standard_EXPORT void Paste( const Handle(TDF_Attribute)& theInto,
- const Handle(TDF_RelocationTable)& ) const;
-Standard_EXPORT virtual Standard_OStream& Dump( Standard_OStream& anOS ) const;
+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);
-Standard_EXPORT void SetVisibility( const TColStd_DataMapOfIntegerInteger& );
+Standard_EXPORT void SetVisibility( const std::map<int, int>& );
-Standard_EXPORT const TColStd_DataMapOfIntegerInteger& GetVisibility();
+Standard_EXPORT const std::map<int, int>& GetVisibility();
private:
- TColStd_DataMapOfIntegerInteger myVisibility;
+ std::map<int, int> myVisibility;
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeGraphic )
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributeIOR.hxx"
-#include <TCollection_AsciiString.hxx>
#include "SALOMEDSImpl_Study.hxx"
-#include <Standard_GUID.hxx>
#ifndef WNT
using namespace std;
#endif
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
-
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeIOR::GetID ()
+const std::string& SALOMEDSImpl_AttributeIOR::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03");
+ static std::string SALOMEDSImpl_AttributeIORID ("92888E01-7074-11d5-A690-0800369C8A03");
return SALOMEDSImpl_AttributeIORID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeIOR) SALOMEDSImpl_AttributeIOR::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S)
+SALOMEDSImpl_AttributeIOR* SALOMEDSImpl_AttributeIOR::Set (const DF_Label& L,
+ const std::string& S)
{
- Handle(SALOMEDSImpl_AttributeIOR) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),A)) {
+ SALOMEDSImpl_AttributeIOR* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeIOR*)L.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
A = new SALOMEDSImpl_AttributeIOR();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeIOR::SetValue(const TCollection_ExtendedString& theValue)
+void SALOMEDSImpl_AttributeIOR::SetValue(const std::string& theValue)
{
CheckLocked();
- Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(Label());
- aStudy->AddCreatedPostponed(theValue);
- aStudy->AddPostponed(theValue);
+ SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(Label());
Backup();
myString = theValue;
SALOMEDSImpl_Study::IORUpdated(this);
-
- //SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
-TCollection_ExtendedString SALOMEDSImpl_AttributeIOR::Value() const
+std::string SALOMEDSImpl_AttributeIOR::Value() const
{
return myString;
}
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeIOR::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeIOR::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeIOR::NewEmpty () const
{
return new SALOMEDSImpl_AttributeIOR();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeIOR::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeIOR::Restore( DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributeIOR)::DownCast (with)->Value();
+ myString = dynamic_cast<SALOMEDSImpl_AttributeIOR*>(with)->Value();
return;
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeIOR::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeIOR::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeIOR)::DownCast (into)->SetValue(myString);
+ dynamic_cast<SALOMEDSImpl_AttributeIOR*>(into)->SetValue(myString);
}
#ifndef _SALOMEDSImpl_AttributeIOR_HeaderFile
#define _SALOMEDSImpl_AttributeIOR_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeIOR, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeIOR : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeIOR Set(const TDF_Label& label,
- const TCollection_ExtendedString& string);
+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 Standard_GUID& ID() const;
-Standard_EXPORT void SetValue(const TCollection_ExtendedString& theValue);
-Standard_EXPORT TCollection_ExtendedString Value() const ;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeIOR )
};
#endif
using namespace std;
#endif
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute)
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute )
-
+#include <stdlib.h>
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeInteger::GetID ()
+const std::string& SALOMEDSImpl_AttributeInteger::GetID ()
{
- static Standard_GUID IntegerID ("8CC3E213-C9B4-47e4-8496-DD5E62E22018");
+ static std::string IntegerID ("8CC3E213-C9B4-47e4-8496-DD5E62E22018");
return IntegerID;
}
-Handle(SALOMEDSImpl_AttributeInteger) SALOMEDSImpl_AttributeInteger::Set (const TDF_Label& L, Standard_Integer Val)
+SALOMEDSImpl_AttributeInteger* SALOMEDSImpl_AttributeInteger::Set (const DF_Label& L, int Val)
{
- Handle(SALOMEDSImpl_AttributeInteger) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), A)) {
+ SALOMEDSImpl_AttributeInteger* A = NULL;
+ if (!(A = (SALOMEDSImpl_AttributeInteger*)L.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) {
A = new SALOMEDSImpl_AttributeInteger();
L.AddAttribute(A);
}
return A;
}
+//=======================================================================
+//function : Value
+//purpose :
+//=======================================================================
+int SALOMEDSImpl_AttributeInteger::Value() const
+{
+ return myValue;
+}
+
//=======================================================================
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeInteger::SetValue(const Standard_Integer v)
+void SALOMEDSImpl_AttributeInteger::SetValue(const int v)
{
if(myValue == v) return;
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeInteger::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeInteger::ID () const { return GetID(); }
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeInteger::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeInteger::NewEmpty () const
{
return new SALOMEDSImpl_AttributeInteger();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeInteger::Restore(const Handle(TDF_Attribute)& With)
+void SALOMEDSImpl_AttributeInteger::Restore(DF_Attribute* With)
{
- myValue = Handle(SALOMEDSImpl_AttributeInteger)::DownCast (With)->Value();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeInteger*>(With)->Value();
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeInteger::Paste (const Handle(TDF_Attribute)& Into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeInteger::Paste (DF_Attribute* Into)
{
- Handle(SALOMEDSImpl_AttributeInteger)::DownCast(Into)->SetValue(myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeInteger*>(Into)->SetValue(myValue);
}
+
+//=======================================================================
+//function : Save
+//purpose :
+//=======================================================================
+string SALOMEDSImpl_AttributeInteger::Save()
+{
+ char buffer[128];
+ sprintf(buffer, "%d", myValue);
+ return string(buffer);
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeInteger::Load(const string& theValue)
+{
+ myValue = atoi(theValue.c_str());
+}
#ifndef _SALOMEDSImpl_AttributeInteger_HeaderFile
#define _SALOMEDSImpl_AttributeInteger_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeInteger, SALOMEDSImpl_GenericAttribute )
-
-
class SALOMEDSImpl_AttributeInteger : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeInteger():SALOMEDSImpl_GenericAttribute("AttributeInteger") {}
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeInteger) Set (const TDF_Label& L, Standard_Integer Val);
-Standard_EXPORT void SetValue(const Standard_Integer theVal);
-Standard_EXPORT Standard_Integer Value() const { return myValue; }
-Standard_EXPORT virtual TCollection_AsciiString Save() { return TCollection_AsciiString(myValue); }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myValue = theValue.IntegerValue(); }
-
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeInteger )
-
};
#endif
#include "SALOMEDSImpl_AttributeLocalID.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeLocalID::GetID ()
+const std::string& SALOMEDSImpl_AttributeLocalID::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeLocalID ("12837196-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeLocalID ("12837196-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeLocalID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeLocalID) SALOMEDSImpl_AttributeLocalID::Set (const TDF_Label& L,
- const Standard_Integer value)
+SALOMEDSImpl_AttributeLocalID* SALOMEDSImpl_AttributeLocalID::Set (const DF_Label& L,
+ const int value)
{
- Handle(SALOMEDSImpl_AttributeLocalID) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(),A)) {
+ SALOMEDSImpl_AttributeLocalID* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeLocalID*)L.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) {
A = new SALOMEDSImpl_AttributeLocalID();
L.AddAttribute(A);
}
//function : Set
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeLocalID::SetValue(const Standard_Integer theValue)
+void SALOMEDSImpl_AttributeLocalID::SetValue(const int theValue)
{
CheckLocked();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeLocalID::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeLocalID::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeLocalID::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeLocalID::NewEmpty () const
{
return new SALOMEDSImpl_AttributeLocalID();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeLocalID::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeLocalID::Restore(DF_Attribute* with)
{
- myValue = Handle(SALOMEDSImpl_AttributeLocalID)::DownCast (with)->Value();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeLocalID*>(with)->Value();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeLocalID::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeLocalID::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeLocalID)::DownCast (into)->SetValue(myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeLocalID*>(into)->SetValue(myValue);
+}
+
+//=======================================================================
+//function : Save
+//purpose :
+//=======================================================================
+string SALOMEDSImpl_AttributeLocalID::Save()
+{
+ char buffer[128];
+ sprintf(buffer, "%d", myValue);
+ return string(buffer);
}
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeLocalID::Load(const string& theValue)
+{
+ myValue = atoi(theValue.c_str());
+}
#ifndef _SALOMEDSImpl_AttributeLocalID_HeaderFile
#define _SALOMEDSImpl_AttributeLocalID_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeLocalID, SALOMEDSImpl_GenericAttribute )
-
-
-
class SALOMEDSImpl_AttributeLocalID : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return TCollection_AsciiString(myValue); }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myValue = theValue.IntegerValue(); }
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string& theValue);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeLocalID Set(const TDF_Label& label,const Standard_Integer value) ;
-Standard_EXPORT void SetValue(const Standard_Integer value);
-Standard_EXPORT Standard_Integer Value() const { return myValue; }
+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 Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) 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*);
Standard_EXPORT ~SALOMEDSImpl_AttributeLocalID() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeLocalID )
};
#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeName, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeName, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeName::GetID ()
+const std::string& SALOMEDSImpl_AttributeName::GetID ()
{
- static Standard_GUID NameID ("8650000D-63A0-4651-B621-CC95C9308598");
+ static std::string NameID ("8650000D-63A0-4651-B621-CC95C9308598");
return NameID;
}
-Handle(SALOMEDSImpl_AttributeName) SALOMEDSImpl_AttributeName::Set (const TDF_Label& L,
- const TCollection_ExtendedString& Val)
+SALOMEDSImpl_AttributeName* SALOMEDSImpl_AttributeName::Set (const DF_Label& L,
+ const std::string& Val)
{
- Handle(SALOMEDSImpl_AttributeName) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), A)) {
+ SALOMEDSImpl_AttributeName* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeName*)L.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
A = new SALOMEDSImpl_AttributeName();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeName::SetValue (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributeName::SetValue (const std::string& S)
{
CheckLocked();
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeName::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeName::ID () const { return GetID(); }
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeName::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeName::NewEmpty () const
{
return new SALOMEDSImpl_AttributeName();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeName::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeName::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributeName)::DownCast (with)->Value ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributeName*>(with)->Value ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeName::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeName::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeName)::DownCast (into)->SetValue(myString);
+ dynamic_cast<SALOMEDSImpl_AttributeName*>(into)->SetValue(myString);
}
#ifndef _SALOMEDSImpl_AttributeName_HeaderFile
#define _SALOMEDSImpl_AttributeName_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeName, SALOMEDSImpl_GenericAttribute )
-
-
class SALOMEDSImpl_AttributeName : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeName():SALOMEDSImpl_GenericAttribute("AttributeName") {}
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeName) Set (const TDF_Label& L, const TCollection_ExtendedString& Val);
-Standard_EXPORT void SetValue(const TCollection_ExtendedString& theVal);
-Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
+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; }
-Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) 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_AttributeName() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeName )
};
#endif
#include "SALOMEDSImpl_AttributeOpened.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeOpened, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeOpened, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeOpened::GetID ()
+const std::string& SALOMEDSImpl_AttributeOpened::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeOpenedID ("12837186-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeOpenedID ("12837186-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeOpenedID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeOpened) SALOMEDSImpl_AttributeOpened::Set (const TDF_Label& L,
- const Standard_Integer value)
+SALOMEDSImpl_AttributeOpened* SALOMEDSImpl_AttributeOpened::Set (const DF_Label& L,
+ const int value)
{
- Handle(SALOMEDSImpl_AttributeOpened) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeOpened::GetID(),A)) {
+ SALOMEDSImpl_AttributeOpened* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeOpened*)L.FindAttribute(SALOMEDSImpl_AttributeOpened::GetID()))) {
A = new SALOMEDSImpl_AttributeOpened();
L.AddAttribute(A);
}
//function : SetOpened
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeOpened::SetOpened(const Standard_Integer theValue)
+void SALOMEDSImpl_AttributeOpened::SetOpened(const int theValue)
{
Backup();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeOpened::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeOpened::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeOpened::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeOpened::NewEmpty () const
{
return new SALOMEDSImpl_AttributeOpened();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeOpened::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeOpened::Restore(DF_Attribute* with)
{
- myValue = Handle(SALOMEDSImpl_AttributeOpened)::DownCast (with)->IsOpened ();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeOpened*>(with)->IsOpened ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeOpened::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeOpened::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeOpened)::DownCast (into)->SetOpened (myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeOpened*>(into)->SetOpened (myValue);
}
#ifndef _SALOMEDSImpl_AttributeOpened_HeaderFile
#define _SALOMEDSImpl_AttributeOpened_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeOpened, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeOpened : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+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 Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeOpened Set(const TDF_Label& label,const Standard_Integer value) ;
+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 Standard_Integer value);
+Standard_EXPORT void SetOpened(const int value);
Standard_EXPORT int IsOpened() const { return myValue; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) 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_AttributeOpened() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeOpened )
};
#endif
#include "SALOMEDSImpl_AttributeParameter.hxx"
-#include <Standard_Failure.hxx>
#include <stdio.h>
#include <stdlib.h>
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute )
-
-
// Purpose: Each character in the string is replaced by 3 characters: '%' and hex number
// of the character (2 characters)
string convertString(const string& S)
* Purpose : Returns GUID of the attribute
*/
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeParameter::GetID ()
+const std::string& SALOMEDSImpl_AttributeParameter::GetID ()
{
- static Standard_GUID ParemeterID ("BA75F3A1-E40B-46b8-8D24-B1D3C3BB1A8C");
+ static std::string ParemeterID ("BA75F3A1-E40B-46b8-8D24-B1D3C3BB1A8C");
return ParemeterID;
}
* Purpose : Adds an attribute to the label
*/
//=======================================================================
-Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::Set (const TDF_Label& L)
+SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_AttributeParameter::Set (const DF_Label& L)
{
- Handle(SALOMEDSImpl_AttributeParameter) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID(), A)) {
+ SALOMEDSImpl_AttributeParameter* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeParameter*)L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID()))) {
A = new SALOMEDSImpl_AttributeParameter();
L.AddAttribute(A);
}
//=======================================================================
int SALOMEDSImpl_AttributeParameter::GetInt(const string& theID)
{
- if(!IsSet(theID, PT_INTEGER)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_INTEGER)) throw DFexception("Invalid ID");
return _ints[theID];
}
//=======================================================================
double SALOMEDSImpl_AttributeParameter::GetReal(const string& theID)
{
- if(!IsSet(theID, PT_REAL)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_REAL)) throw DFexception("Invalid ID");
return _reals[theID];
}
//=======================================================================
string SALOMEDSImpl_AttributeParameter::GetString(const string& theID)
{
- if(!IsSet(theID, PT_STRING)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_STRING)) throw DFexception("Invalid ID");
return _strings[theID];
}
//=======================================================================
bool SALOMEDSImpl_AttributeParameter::GetBool(const string& theID)
{
- if(!IsSet(theID, PT_BOOLEAN)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_BOOLEAN)) throw DFexception("Invalid ID");
return _bools[theID];
}
//=======================================================================
vector<double> SALOMEDSImpl_AttributeParameter::GetRealArray(const string& theID)
{
- if(!IsSet(theID, PT_REALARRAY)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_REALARRAY)) throw DFexception("Invalid ID");
return _realarrays[theID];
}
//=======================================================================
vector<int> SALOMEDSImpl_AttributeParameter::GetIntArray(const string& theID)
{
- if(!IsSet(theID, PT_INTARRAY)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_INTARRAY)) throw DFexception("Invalid ID");
return _intarrays[theID];
}
//=======================================================================
vector<string> SALOMEDSImpl_AttributeParameter::GetStrArray(const string& theID)
{
- if(!IsSet(theID, PT_STRARRAY)) Standard_Failure::Raise("Invalid ID");
+ if(!IsSet(theID, PT_STRARRAY)) throw DFexception("Invalid ID");
return _strarrays[theID];
}
* Purpose : Returns a father attribute for this attribute
*/
//=======================================================================
-Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::GetFather()
+SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_AttributeParameter::GetFather()
{
- Handle(SALOMEDSImpl_AttributeParameter) aFather;
- TDF_Label L = Label();
+ SALOMEDSImpl_AttributeParameter* aFather;
+ DF_Label L = Label();
if(L.IsRoot()) return aFather;
while(!L.IsRoot()) {
L = L.Father();
- if(L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID(), aFather)) break;
+ if((aFather=(SALOMEDSImpl_AttributeParameter*)L.FindAttribute(SALOMEDSImpl_AttributeParameter::GetID()))) break;
}
return aFather;
//=======================================================================
bool SALOMEDSImpl_AttributeParameter::HasFather()
{
- TDF_Label L = Label();
+ DF_Label L = Label();
if(L.IsRoot()) return false;
while(!L.IsRoot()) {
L = L.Father();
* Purpose : Rteurns an GUID of the attribute
*/
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeParameter::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeParameter::ID () const { return GetID(); }
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeParameter::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeParameter::NewEmpty () const
{
return new SALOMEDSImpl_AttributeParameter();
}
* Purpose : Restors the content of the attribute from another
*/
//=======================================================================
-void SALOMEDSImpl_AttributeParameter::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeParameter::Restore(DF_Attribute* with)
{
- Handle(SALOMEDSImpl_AttributeParameter) A = Handle(SALOMEDSImpl_AttributeParameter)::DownCast (with);
+ SALOMEDSImpl_AttributeParameter* A = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(with);
_ints.clear();
_reals.clear();
_bools.clear();
* Purpose : Pastes the content of attribute to another
*/
//=======================================================================
-void SALOMEDSImpl_AttributeParameter::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeParameter::Paste (DF_Attribute* into)
{
into->Restore(this);
}
* Purpose : Saves a content of the attribute as a string
*/
//=======================================================================
-TCollection_AsciiString SALOMEDSImpl_AttributeParameter::Save()
+string SALOMEDSImpl_AttributeParameter::Save()
{
ostrstream buffer;
char *tmpBuffer = new char[255];
delete tmpBuffer;
- TCollection_AsciiString AS((char*)buffer.rdbuf()->str());
+ string AS((char*)buffer.rdbuf()->str());
return AS;
}
* Purpose : Restores the attribute from the string
*/
//=======================================================================
-void SALOMEDSImpl_AttributeParameter::Load(const TCollection_AsciiString& theValue)
+void SALOMEDSImpl_AttributeParameter::Load(const string& theValue)
{
Backup();
_realarrays.clear();
_intarrays.clear();
- istrstream buffer(theValue.ToCString(), strlen(theValue.ToCString()));
+ istrstream buffer(theValue.c_str(), theValue.size());
int size, val, ival;
double val2;
#ifndef _SALOMEDSImpl_AttributeParameter_HeaderFile
#define _SALOMEDSImpl_AttributeParameter_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include <vector>
#include <string>
#include <map>
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeParameter, SALOMEDSImpl_GenericAttribute )
-
enum Parameter_Types {PT_INTEGER, PT_REAL, PT_BOOLEAN, PT_STRING, PT_REALARRAY, PT_INTARRAY, PT_STRARRAY};
/*!
private:
- std::map<std::string, int> _ints;
- std::map<std::string, double> _reals;
- std::map<std::string, std::string> _strings;
- std::map<std::string, bool> _bools;
- std::map< std::string, vector<double> > _realarrays;
- std::map< std::string, vector<int> > _intarrays;
- std::map< std::string, vector<std::string> > _strarrays;
+ std::map<std::string, int> _ints;
+ std::map<std::string, double> _reals;
+ std::map<std::string, std::string> _strings;
+ std::map<std::string, bool> _bools;
+ std::map< std::string, std::vector<double> > _realarrays;
+ std::map< std::string, std::vector<int> > _intarrays;
+ std::map< std::string, std::vector<std::string> > _strarrays;
public:
- Standard_EXPORT static const Standard_GUID& GetID() ;
+ Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeParameter():SALOMEDSImpl_GenericAttribute("AttributeParameter") {}
- Standard_EXPORT static Handle(SALOMEDSImpl_AttributeParameter) Set (const TDF_Label& L);
+ Standard_EXPORT static SALOMEDSImpl_AttributeParameter* Set (const DF_Label& L);
Standard_EXPORT void SetInt(const std::string& theID, const int& theValue);
Standard_EXPORT bool RemoveID(const std::string& theID, const Parameter_Types theType);
- Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetFather();
+ Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetFather();
Standard_EXPORT bool HasFather();
Standard_EXPORT bool IsRoot();
Standard_EXPORT void Clear();
- Standard_EXPORT virtual TCollection_AsciiString Save();
- Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue);
+ Standard_EXPORT virtual std::string Save();
+ Standard_EXPORT virtual void Load(const std::string& theValue);
- Standard_EXPORT const Standard_GUID& ID() const;
- Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
- Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
- Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) 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_AttributeParameter() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeParameter )
};
#endif
#include "SALOMEDSImpl_AttributePersistentRef.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePersistentRef, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePersistentRef, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributePersistentRef::GetID ()
+const std::string& SALOMEDSImpl_AttributePersistentRef::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributePersistentRefID ("92888E06-7074-11d5-A690-0800369C8A03");
+ static std::string SALOMEDSImpl_AttributePersistentRefID ("92888E06-7074-11d5-A690-0800369C8A03");
return SALOMEDSImpl_AttributePersistentRefID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributePersistentRef) SALOMEDSImpl_AttributePersistentRef::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S)
+SALOMEDSImpl_AttributePersistentRef* SALOMEDSImpl_AttributePersistentRef::Set (const DF_Label& L,
+ const std::string& S)
{
- Handle(SALOMEDSImpl_AttributePersistentRef) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),A)) {
+ SALOMEDSImpl_AttributePersistentRef* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributePersistentRef*)L.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
A = new SALOMEDSImpl_AttributePersistentRef();
L.AddAttribute(A);
}
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributePersistentRef::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributePersistentRef::ID () const { return GetID(); }
//=======================================================================
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributePersistentRef::SetValue (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributePersistentRef::SetValue (const std::string& S)
{
CheckLocked();
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributePersistentRef::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributePersistentRef::NewEmpty () const
{
return new SALOMEDSImpl_AttributePersistentRef();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributePersistentRef::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributePersistentRef::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast (with)->Value ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributePersistentRef*>(with)->Value ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributePersistentRef::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributePersistentRef::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributePersistentRef)::DownCast (into)->SetValue(myString);
+ dynamic_cast<SALOMEDSImpl_AttributePersistentRef*>(into)->SetValue(myString);
}
#ifndef _SALOMEDSImpl_AttributePersistentRef_HeaderFile
#define _SALOMEDSImpl_AttributePersistentRef_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributePersistentRef, SALOMEDSImpl_GenericAttribute )
class SALOMEDSImpl_AttributePersistentRef : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributePersistentRef Set(const TDF_Label& label,
- const TCollection_ExtendedString& string) ;
+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 Standard_GUID& ID() const;
-Standard_EXPORT void SetValue(const TCollection_ExtendedString& value);
-Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePersistentRef )
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributePixMap.hxx"
-#include <TCollection_ExtendedString.hxx>
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributePixMap::GetID ()
+const std::string& SALOMEDSImpl_AttributePixMap::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributePixMapID ("12837187-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributePixMapID ("12837187-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributePixMapID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributePixMap) SALOMEDSImpl_AttributePixMap::Set (const TDF_Label& L,
- const TCollection_ExtendedString& S)
+SALOMEDSImpl_AttributePixMap* SALOMEDSImpl_AttributePixMap::Set (const DF_Label& L,
+ const std::string& S)
{
- Handle(SALOMEDSImpl_AttributePixMap) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributePixMap::GetID(),A)) {
+ SALOMEDSImpl_AttributePixMap* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributePixMap*)L.FindAttribute(SALOMEDSImpl_AttributePixMap::GetID()))) {
A = new SALOMEDSImpl_AttributePixMap();
L.AddAttribute(A);
}
//function : SetPixMap
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributePixMap::SetPixMap (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributePixMap::SetPixMap (const std::string& S)
{
CheckLocked();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributePixMap::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributePixMap::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributePixMap::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributePixMap::NewEmpty () const
{
return new SALOMEDSImpl_AttributePixMap();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributePixMap::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributePixMap::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributePixMap)::DownCast (with)->GetPixMap ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributePixMap*>(with)->GetPixMap ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributePixMap::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributePixMap::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributePixMap)::DownCast (into)->SetPixMap (myString);
+ dynamic_cast<SALOMEDSImpl_AttributePixMap*>(into)->SetPixMap (myString);
}
#ifndef _SALOMEDSImpl_AttributePixMap_HeaderFile
#define _SALOMEDSImpl_AttributePixMap_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributePixMap, SALOMEDSImpl_GenericAttribute )
-
-
-
class SALOMEDSImpl_AttributePixMap : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT virtual void Load(const std::string& theValue) { myString = theValue; }
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributePixMap Set(const TDF_Label& label,
- const TCollection_ExtendedString& string) ;
+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 Standard_GUID& ID() const;
-Standard_EXPORT void SetPixMap(const TCollection_ExtendedString& value);
-Standard_EXPORT TCollection_ExtendedString GetPixMap() const { return myString; }
-Standard_EXPORT Standard_Boolean HasPixMap() const { return (myString != "None"); }
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePixMap )
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributePythonObject.hxx"
-#include <Standard_GUID.hxx>
-#include <string>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute )
-
-const Standard_GUID& SALOMEDSImpl_AttributePythonObject::GetID()
+const std::string& SALOMEDSImpl_AttributePythonObject::GetID()
{
- static Standard_GUID SALOMEDSImpl_AttributePythonObjectID ("128371A3-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributePythonObjectID ("128371A3-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributePythonObjectID;
}
-Handle(SALOMEDSImpl_AttributePythonObject) SALOMEDSImpl_AttributePythonObject::Set(const TDF_Label& label)
+SALOMEDSImpl_AttributePythonObject* SALOMEDSImpl_AttributePythonObject::Set(const DF_Label& label)
{
- Handle(SALOMEDSImpl_AttributePythonObject) anAttr;
- if (!label.FindAttribute(SALOMEDSImpl_AttributePythonObject::GetID(),anAttr)) {
- anAttr = new SALOMEDSImpl_AttributePythonObject();
- label.AddAttribute(anAttr);
+ SALOMEDSImpl_AttributePythonObject* A = NULL;
+ if (!(A = (SALOMEDSImpl_AttributePythonObject*)label.FindAttribute(SALOMEDSImpl_AttributePythonObject::GetID()))) {
+ A = new SALOMEDSImpl_AttributePythonObject();
+ label.AddAttribute(A);
}
- return anAttr;
+ return A;
}
SALOMEDSImpl_AttributePythonObject::SALOMEDSImpl_AttributePythonObject()
:SALOMEDSImpl_GenericAttribute("AttributePythonObject")
{
+ myIsScript = false;
}
-void SALOMEDSImpl_AttributePythonObject::SetObject(const TCollection_AsciiString& theSequence,
+void SALOMEDSImpl_AttributePythonObject::SetObject(const string& theSequence,
const bool theScript)
{
CheckLocked();
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_AsciiString SALOMEDSImpl_AttributePythonObject::GetObject() const
+string SALOMEDSImpl_AttributePythonObject::GetObject() const
{
return mySequence;
}
int SALOMEDSImpl_AttributePythonObject::GetLength() const
{
- return mySequence.Length();
+ return mySequence.size();
}
-const Standard_GUID& SALOMEDSImpl_AttributePythonObject::ID() const
+const std::string& SALOMEDSImpl_AttributePythonObject::ID() const
{
return GetID();
}
-void SALOMEDSImpl_AttributePythonObject::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributePythonObject::Restore(DF_Attribute* with)
{
- Handle(SALOMEDSImpl_AttributePythonObject) anObj = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(with);
+ SALOMEDSImpl_AttributePythonObject* anObj = dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(with);
SetObject(anObj->GetObject(),anObj->IsScript());
}
-Handle(TDF_Attribute) SALOMEDSImpl_AttributePythonObject::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributePythonObject::NewEmpty() const
{
return new SALOMEDSImpl_AttributePythonObject();
}
-void SALOMEDSImpl_AttributePythonObject::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
+void SALOMEDSImpl_AttributePythonObject::Paste(DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributePythonObject) anObj = Handle(SALOMEDSImpl_AttributePythonObject)::DownCast(into);
+ SALOMEDSImpl_AttributePythonObject* anObj = dynamic_cast<SALOMEDSImpl_AttributePythonObject*>(into);
anObj->SetObject(GetObject(),IsScript());
}
-TCollection_AsciiString SALOMEDSImpl_AttributePythonObject::Save()
+string SALOMEDSImpl_AttributePythonObject::Save()
{
- TCollection_AsciiString aString = GetObject();
- TCollection_AsciiString aResult = IsScript()?'s':'n';
+ string aString = GetObject();
+ string aResult = IsScript()?"s":"n";
aResult += aString;
return aResult;
}
-void SALOMEDSImpl_AttributePythonObject::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributePythonObject::Load(const string& value)
{
- char* aString = value.ToCString();
+ char* aString = (char*)value.c_str();
SetObject(aString + 1, aString[0]=='s');
}
#ifndef _SALOMEDSImpl_AttributePythonObject_HeaderFile
#define _SALOMEDSImpl_AttributePythonObject_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributePythonObject, SALOMEDSImpl_GenericAttribute )
-
#ifdef GetObject
#undef GetObject
#endif
{
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributePythonObject Set(const TDF_Label& label) ;
+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 TCollection_AsciiString& theSequence, const bool theScript) ;
-Standard_EXPORT TCollection_AsciiString GetObject() const;
+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 Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) 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() {}
private:
-TCollection_AsciiString mySequence;
+std::string mySequence;
bool myIsScript;
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributePythonObject )
-
};
#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute )
+#include <stdlib.h>
+
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeReal::GetID ()
+const std::string& SALOMEDSImpl_AttributeReal::GetID ()
{
- static Standard_GUID realID ("1D1992F0-56F4-46b4-8065-CDEA68061CAB");
+ static std::string realID ("1D1992F0-56F4-46b4-8065-CDEA68061CAB");
return realID;
}
-Handle(SALOMEDSImpl_AttributeReal) SALOMEDSImpl_AttributeReal::Set (const TDF_Label& L, const Standard_Real Val)
+SALOMEDSImpl_AttributeReal* SALOMEDSImpl_AttributeReal::Set (const DF_Label& L, const double& Val)
{
- Handle(SALOMEDSImpl_AttributeReal) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeReal::GetID(), A)) {
+ SALOMEDSImpl_AttributeReal* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeReal*)L.FindAttribute(SALOMEDSImpl_AttributeReal::GetID()))) {
A = new SALOMEDSImpl_AttributeReal();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeReal::SetValue(const Standard_Real v)
+void SALOMEDSImpl_AttributeReal::SetValue(const double& v)
{
CheckLocked();
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeReal::ID () const
+const std::string& SALOMEDSImpl_AttributeReal::ID () const
{
return GetID();
}
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeReal::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeReal::NewEmpty () const
{
return new SALOMEDSImpl_AttributeReal();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeReal::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeReal::Restore(DF_Attribute* with)
{
- myValue = Handle(SALOMEDSImpl_AttributeReal)::DownCast (with)->Value ();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeReal*>(with)->Value ();
}
//=======================================================================
//function : Paste
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeReal::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeReal::Paste (DF_Attribute* into)
+{
+ dynamic_cast<SALOMEDSImpl_AttributeReal*>(into)->SetValue(myValue);
+}
+
+//=======================================================================
+//function : Save
+//purpose :
+//=======================================================================
+string SALOMEDSImpl_AttributeReal::Save()
+{
+ char buffer[255];
+ sprintf(buffer, "%.64e", myValue);
+ return string(buffer);
+}
+
+//=======================================================================
+//function : Load
+//purpose :
+//=======================================================================
+void SALOMEDSImpl_AttributeReal::Load(const string& theValue)
{
- Handle(SALOMEDSImpl_AttributeReal)::DownCast (into)->SetValue(myValue);
+ myValue = atof(theValue.c_str());
}
#ifndef _SALOMEDSImpl_AttributeReal_HeaderFile
#define _SALOMEDSImpl_AttributeReal_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeReal, SALOMEDSImpl_GenericAttribute )
-
-
class SALOMEDSImpl_AttributeReal : public SALOMEDSImpl_GenericAttribute
{
private:
- Standard_Real myValue;
+ double myValue;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeReal():SALOMEDSImpl_GenericAttribute("AttributeReal") {}
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeReal) Set (const TDF_Label& L, const Standard_Real Val);
-Standard_EXPORT void SetValue(const Standard_Real theVal);
-Standard_EXPORT Standard_Real Value() const { return myValue; }
-Standard_EXPORT virtual TCollection_AsciiString Save() { return TCollection_AsciiString(myValue); }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myValue = theValue.RealValue(); }
-
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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);
+
+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() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeReal )
-
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributeReference.hxx"
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_RelocationTable.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute )
-
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeReference::GetID ()
+const std::string& SALOMEDSImpl_AttributeReference::GetID ()
{
- static Standard_GUID refID ("D913E0B3-0A9F-4ea6-9480-18A9B72D9D86");
+ static std::string refID ("D913E0B3-0A9F-4ea6-9480-18A9B72D9D86");
return refID;
}
-Handle(SALOMEDSImpl_AttributeReference) SALOMEDSImpl_AttributeReference::Set(const TDF_Label& theLabel,
- const TDF_Label& theRefLabel)
+SALOMEDSImpl_AttributeReference* SALOMEDSImpl_AttributeReference::Set(const DF_Label& theLabel,
+ const DF_Label& theRefLabel)
{
- Handle(SALOMEDSImpl_AttributeReference) A;
- if (!theLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), A)) {
+ SALOMEDSImpl_AttributeReference* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeReference*)theLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
A = new SALOMEDSImpl_AttributeReference();
theLabel.AddAttribute(A);
}
//function : Set
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeReference::Set(const TDF_Label& Origin)
+void SALOMEDSImpl_AttributeReference::Set(const DF_Label& Origin)
{
CheckLocked();
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeReference::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeReference::ID () const { return GetID(); }
-TCollection_AsciiString SALOMEDSImpl_AttributeReference::Save()
+string SALOMEDSImpl_AttributeReference::Save()
{
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(myLabel, anEntry);
- return anEntry;
+ return myLabel.Entry();
}
-void SALOMEDSImpl_AttributeReference::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeReference::Load(const string& value)
{
- TDF_Label aLabel;
- TDF_Tool::Label(Label().Data(), value, aLabel);
- myLabel = aLabel;
+ myLabel = DF_Label::Label(Label(), value, true);
}
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeReference::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeReference::NewEmpty () const
{
return new SALOMEDSImpl_AttributeReference();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeReference::Restore(const Handle(TDF_Attribute)& With)
+void SALOMEDSImpl_AttributeReference::Restore(DF_Attribute* With)
{
- myLabel = Handle(SALOMEDSImpl_AttributeReference)::DownCast (With)->Get ();
+ myLabel = dynamic_cast<SALOMEDSImpl_AttributeReference*>(With)->Get ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeReference::Paste (const Handle(TDF_Attribute)& Into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeReference::Paste (DF_Attribute* Into)
{
- TDF_Label tLab;
- if (!myLabel.IsNull()) {
- if (!RT->HasRelocation(myLabel,tLab)) tLab = myLabel;
- }
- Handle(SALOMEDSImpl_AttributeReference)::DownCast(Into)->Set(tLab);
+ dynamic_cast<SALOMEDSImpl_AttributeReference*>(Into)->Set(myLabel);
}
#ifndef _SALOMEDSImpl_AttributeReference_HeaderFile
#define _SALOMEDSImpl_AttributeReference_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeReference, SALOMEDSImpl_GenericAttribute )
-
-
-
class SALOMEDSImpl_AttributeReference : public SALOMEDSImpl_GenericAttribute
{
private:
- TDF_Label myLabel;
+ DF_Label myLabel;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeReference():SALOMEDSImpl_GenericAttribute("AttributeReference") {}
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeReference) Set(const TDF_Label& theLabel, const TDF_Label& theRefLabel);
-Standard_EXPORT void Set(const TDF_Label& theLabel);
-Standard_EXPORT TDF_Label Get() const { return myLabel; }
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue);
+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);
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) 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_AttributeReference() {}
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeReference )
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributeSelectable.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeSelectable, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeSelectable, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeSelectable::GetID ()
+const std::string& SALOMEDSImpl_AttributeSelectable::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeSelectableID ("12837188-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeSelectableID ("12837188-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeSelectableID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeSelectable) SALOMEDSImpl_AttributeSelectable::Set (const TDF_Label& L,
- const Standard_Integer value)
+SALOMEDSImpl_AttributeSelectable* SALOMEDSImpl_AttributeSelectable::Set (const DF_Label& L,
+ const int value)
{
- Handle(SALOMEDSImpl_AttributeSelectable) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeSelectable::GetID(),A)) {
+ SALOMEDSImpl_AttributeSelectable* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeSelectable*)L.FindAttribute(SALOMEDSImpl_AttributeSelectable::GetID()))) {
A = new SALOMEDSImpl_AttributeSelectable();
L.AddAttribute(A);
}
//function : SetSelectable
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSelectable::SetSelectable(const Standard_Integer theValue)
+void SALOMEDSImpl_AttributeSelectable::SetSelectable(const int theValue)
{
Backup();
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeSelectable::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeSelectable::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeSelectable::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeSelectable::NewEmpty () const
{
return new SALOMEDSImpl_AttributeSelectable();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSelectable::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeSelectable::Restore(DF_Attribute* with)
{
- myValue = Handle(SALOMEDSImpl_AttributeSelectable)::DownCast (with)->IsSelectable ();
+ myValue = dynamic_cast<SALOMEDSImpl_AttributeSelectable*>(with)->IsSelectable ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSelectable::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeSelectable::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeSelectable)::DownCast (into)->SetSelectable (myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeSelectable*>(into)->SetSelectable (myValue);
}
#ifndef _SALOMEDSImpl_AttributeSelectable_HeaderFile
#define _SALOMEDSImpl_AttributeSelectable_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeSelectable, SALOMEDSImpl_GenericAttribute )
-
-
-
class SALOMEDSImpl_AttributeSelectable : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_Integer myValue;
+int myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save() { return (myValue == 0)?(char*)"0":(char*)"1"; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { (theValue == "0")?myValue=0:myValue=1; }
+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 Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSelectable Set(const TDF_Label& label,const Standard_Integer value) ;
+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 Standard_Integer value);
-Standard_EXPORT Standard_Integer IsSelectable() const { return myValue; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeDrawable )
-
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributeSequenceOfInteger.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfInteger, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeSequenceOfInteger, SALOMEDSImpl_GenericAttribute )
-
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::GetID ()
+const std::string& SALOMEDSImpl_AttributeSequenceOfInteger::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeSequenceOfIntegerID ("12837182-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeSequenceOfIntegerID ("12837182-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeSequenceOfIntegerID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeSequenceOfInteger) SALOMEDSImpl_AttributeSequenceOfInteger::Set (const TDF_Label& L)
+SALOMEDSImpl_AttributeSequenceOfInteger* SALOMEDSImpl_AttributeSequenceOfInteger::Set (const DF_Label& L)
{
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfInteger::GetID(),A)) {
+ SALOMEDSImpl_AttributeSequenceOfInteger* A = NULL;
+ if (!(A = (SALOMEDSImpl_AttributeSequenceOfInteger*)L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfInteger::GetID()))) {
A = new SALOMEDSImpl_AttributeSequenceOfInteger();
L.AddAttribute(A);
}
//=======================================================================
SALOMEDSImpl_AttributeSequenceOfInteger::SALOMEDSImpl_AttributeSequenceOfInteger()
:SALOMEDSImpl_GenericAttribute("AttributeSequenceOfInteger")
-{
- myValue = new TColStd_HSequenceOfInteger();
-}
+{}
//=======================================================================
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfInteger::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeSequenceOfInteger::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfInteger::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeSequenceOfInteger::NewEmpty () const
{
return new SALOMEDSImpl_AttributeSequenceOfInteger();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSequenceOfInteger::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeSequenceOfInteger::Restore(DF_Attribute* with)
{
- Standard_Integer i;
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger) anSeq = Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast(with);
- if(!anSeq->myValue.IsNull()) {
- myValue = new TColStd_HSequenceOfInteger();
- Standard_Integer Len = anSeq->Length();
- for(i = 1; i<=Len; i++) Add(anSeq->Value(i));
- }
- else
- myValue.Nullify();
- return;
+ SALOMEDSImpl_AttributeSequenceOfInteger* anSeq = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(with);
+ myValue.clear();
+ for(int i = 0, len = anSeq->Length(); i<len; i++)
+ myValue.push_back(anSeq->myValue[i]);
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSequenceOfInteger::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& ) const
+void SALOMEDSImpl_AttributeSequenceOfInteger::Paste (DF_Attribute* into)
{
- if(!myValue.IsNull()) {
- Handle(SALOMEDSImpl_AttributeSequenceOfInteger)::DownCast (into)->Assign(myValue);
- }
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfInteger*>(into)->Assign(myValue);
}
-void SALOMEDSImpl_AttributeSequenceOfInteger::Assign(const Handle(TColStd_HSequenceOfInteger)& other)
+void SALOMEDSImpl_AttributeSequenceOfInteger::Assign(const vector<int>& other)
{
CheckLocked();
Backup();
- if (myValue.IsNull()) myValue = new TColStd_HSequenceOfInteger;
- myValue->ChangeSequence() = other->Sequence();
+ myValue = other;
+
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeSequenceOfInteger::ChangeValue(const Standard_Integer Index,const Standard_Integer Value)
+void SALOMEDSImpl_AttributeSequenceOfInteger::ChangeValue(const int Index,const int Value)
{
CheckLocked();
Backup();
- if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range");
+ if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range");
- myValue->SetValue(Index, Value);
+ myValue[Index-1] = Value;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeSequenceOfInteger::Add(const Standard_Integer Value)
+void SALOMEDSImpl_AttributeSequenceOfInteger::Add(const int Value)
{
CheckLocked();
Backup();
- myValue->Append(Value);
+ myValue.push_back(Value);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeSequenceOfInteger::Remove(const Standard_Integer Index)
+void SALOMEDSImpl_AttributeSequenceOfInteger::Remove(const int Index)
{
CheckLocked();
Backup();
- if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range");
+ if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range");
+
+ typedef vector<int>::iterator VI;
+ int i = 1;
+ for(VI p = myValue.begin(); p!=myValue.end(); p++, i++) {
+ if(i == Index) {
+ myValue.erase(p);
+ break;
+ }
+ }
- myValue->Remove(Index);
-
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Standard_Integer SALOMEDSImpl_AttributeSequenceOfInteger::Length()
+int SALOMEDSImpl_AttributeSequenceOfInteger::Length()
{
- return myValue->Length();
+ return myValue.size();
}
-Standard_Integer SALOMEDSImpl_AttributeSequenceOfInteger::Value(const Standard_Integer Index)
+int SALOMEDSImpl_AttributeSequenceOfInteger::Value(const int Index)
{
- if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range");
+ if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range");
- return myValue->Value(Index);
+ return myValue[Index-1];
}
-TCollection_AsciiString SALOMEDSImpl_AttributeSequenceOfInteger::Save()
+string SALOMEDSImpl_AttributeSequenceOfInteger::Save()
{
- Standard_Integer aLength = Length();
+ int aLength = Length();
char* aResult = new char[aLength * 25];
aResult[0] = 0;
- Standard_Integer aPosition = 0;
+ int aPosition = 0;
for (int i = 1; i <= aLength; i++) {
sprintf(aResult + aPosition , "%d ", Value(i));
aPosition += strlen(aResult + aPosition);
}
- TCollection_AsciiString ret(aResult);
+ string ret(aResult);
delete aResult;
return ret;
}
-void SALOMEDSImpl_AttributeSequenceOfInteger::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeSequenceOfInteger::Load(const string& value)
{
- Handle(TColStd_HSequenceOfInteger) CasCadeSeq = new TColStd_HSequenceOfInteger;
-
- char* aCopy = value.ToCString();
+ char* aCopy = (char*)value.c_str();
char* adr = strtok(aCopy, " ");
while (adr) {
int l = atol(adr);
- CasCadeSeq->Append(l);
+ Add(l);
adr = strtok(NULL, " ");
}
- Assign(CasCadeSeq);
}
#ifndef _SALOMEDSImpl_AttributeSequenceOfInteger_HeaderFile
#define _SALOMEDSImpl_AttributeSequenceOfInteger_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <vector>
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfInteger, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeSequenceOfInteger : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSequenceOfInteger Set(const TDF_Label& label) ;
+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 Handle(TColStd_HSequenceOfInteger)& other) ;
-Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Integer Value) ;
-Standard_EXPORT void Add(const Standard_Integer value) ;
-Standard_EXPORT Standard_Integer Value(const Standard_Integer Index) ;
-Standard_EXPORT void Remove(const Standard_Integer Index) ;
-Standard_EXPORT Standard_Integer Length() ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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; }
private:
-
-Handle_TColStd_HSequenceOfInteger myValue;
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeSequenceOfInteger )
-
+std::vector<int> myValue;
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_AttributeSequenceOfReal.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfReal, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeSequenceOfReal, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::GetID ()
+const std::string& SALOMEDSImpl_AttributeSequenceOfReal::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeSequenceOfRealID ("12837183-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeSequenceOfRealID ("12837183-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeSequenceOfRealID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeSequenceOfReal) SALOMEDSImpl_AttributeSequenceOfReal::Set (const TDF_Label& L)
+SALOMEDSImpl_AttributeSequenceOfReal* SALOMEDSImpl_AttributeSequenceOfReal::Set (const DF_Label& L)
{
- Handle(SALOMEDSImpl_AttributeSequenceOfReal) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfReal::GetID(),A)) {
+ SALOMEDSImpl_AttributeSequenceOfReal* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeSequenceOfReal*)L.FindAttribute(SALOMEDSImpl_AttributeSequenceOfReal::GetID()))) {
A = new SALOMEDSImpl_AttributeSequenceOfReal();
L.AddAttribute(A);
}
SALOMEDSImpl_AttributeSequenceOfReal::SALOMEDSImpl_AttributeSequenceOfReal()
:SALOMEDSImpl_GenericAttribute("AttributeSequenceOfReal")
{
- myValue = new TColStd_HSequenceOfReal();
+ myValue.clear();
}
//=======================================================================
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeSequenceOfReal::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeSequenceOfReal::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeSequenceOfReal::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeSequenceOfReal::NewEmpty () const
{
return new SALOMEDSImpl_AttributeSequenceOfReal();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSequenceOfReal::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeSequenceOfReal::Restore(DF_Attribute* with)
{
- Standard_Integer i;
- Handle(SALOMEDSImpl_AttributeSequenceOfReal) anSeq = Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast(with);
- if(!anSeq->myValue.IsNull()) {
- myValue = new TColStd_HSequenceOfReal();
- Standard_Integer Len = anSeq->Length();
- for(i = 1; i<=Len; i++) Add(anSeq->Value(i));
- }
- else
- myValue.Nullify();
+ SALOMEDSImpl_AttributeSequenceOfReal* anSeq = dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(with);
+ myValue.clear();
+ for(int i = 0, len = anSeq->Length(); i<len; i++)
+ myValue.push_back(anSeq->myValue[i]);
return;
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeSequenceOfReal::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& ) const
+void SALOMEDSImpl_AttributeSequenceOfReal::Paste (DF_Attribute* into)
{
- if(!myValue.IsNull()) {
- Handle(SALOMEDSImpl_AttributeSequenceOfReal)::DownCast (into)->Assign(myValue);
- }
+ dynamic_cast<SALOMEDSImpl_AttributeSequenceOfReal*>(into)->Assign(myValue);
}
-void SALOMEDSImpl_AttributeSequenceOfReal::Assign(const Handle(TColStd_HSequenceOfReal)& other)
+void SALOMEDSImpl_AttributeSequenceOfReal::Assign(const vector<double>& other)
{
CheckLocked();
Backup();
- if (myValue.IsNull()) myValue = new TColStd_HSequenceOfReal;
- myValue->ChangeSequence() = other->Sequence();
+ myValue = other;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeSequenceOfReal::ChangeValue(const Standard_Integer Index,const Standard_Real Value)
+void SALOMEDSImpl_AttributeSequenceOfReal::ChangeValue(const int Index,const double& Value)
{
CheckLocked();
Backup();
- if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range");
+ if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range");
- myValue->SetValue(Index, Value);
+ myValue[Index-1] = Value;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeSequenceOfReal::Add(const Standard_Real Value)
+void SALOMEDSImpl_AttributeSequenceOfReal::Add(const double& Value)
{
CheckLocked();
Backup();
- myValue->Append(Value);
+ myValue.push_back(Value);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeSequenceOfReal::Remove(const Standard_Integer Index)
+void SALOMEDSImpl_AttributeSequenceOfReal::Remove(const int Index)
{
CheckLocked();
Backup();
- if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range");
+ if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range");
- myValue->Remove(Index);
-
- SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
+ typedef vector<double>::iterator VI;
+ int i = 1;
+ for(VI p = myValue.begin(); p!=myValue.end(); p++, i++) {
+ if(i == Index) {
+ myValue.erase(p);
+ break;
+ }
+ }
+
+ SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Standard_Integer SALOMEDSImpl_AttributeSequenceOfReal::Length()
+int SALOMEDSImpl_AttributeSequenceOfReal::Length()
{
- return myValue->Length();
+ return myValue.size();
}
-Standard_Real SALOMEDSImpl_AttributeSequenceOfReal::Value(const Standard_Integer Index)
+double SALOMEDSImpl_AttributeSequenceOfReal::Value(const int Index)
{
- if(Index <= 0 || Index > myValue->Length()) Standard_Failure::Raise("Out of range");
- return myValue->Value(Index);
+ if(Index <= 0 || Index > myValue.size()) throw DFexception("Out of range");
+ return myValue[Index-1];
}
-TCollection_AsciiString SALOMEDSImpl_AttributeSequenceOfReal::Save()
+string SALOMEDSImpl_AttributeSequenceOfReal::Save()
{
- Standard_Integer aLength = Length();
- char* aResult = new char[aLength * 25];
+ int aLength = Length();
+ char* aResult = new char[aLength * 127];
aResult[0] = 0;
- Standard_Integer aPosition = 0;
+ int aPosition = 0;
for (int i = 1; i <= aLength; i++) {
- sprintf(aResult + aPosition , "%f ", Value(i));
+ sprintf(aResult + aPosition , "%.64e ", Value(i));
aPosition += strlen(aResult + aPosition);
}
- TCollection_AsciiString ret(aResult);
+ string ret(aResult);
delete aResult;
return ret;
}
-void SALOMEDSImpl_AttributeSequenceOfReal::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeSequenceOfReal::Load(const string& value)
{
- Handle(TColStd_HSequenceOfReal) CasCadeSeq = new TColStd_HSequenceOfReal;
- char* aCopy = value.ToCString();
+ char* aCopy = (char*)value.c_str();
char* adr = strtok(aCopy, " ");
char *err = NULL;
while (adr) {
- Standard_Real r = strtod(adr, &err);
- CasCadeSeq->Append(r);
+ double r = strtod(adr, &err);
+ Add(r);
adr = strtok(NULL, " ");
}
- Assign(CasCadeSeq);
}
#ifndef _SALOMEDSImpl_AttributeSequenceOfReal_HeaderFile
#define _SALOMEDSImpl_AttributeSequenceOfReal_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TColStd_HSequenceOfReal.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
+#include <vector>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeSequenceOfReal, SALOMEDSImpl_GenericAttribute )
class SALOMEDSImpl_AttributeSequenceOfReal : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT virtual void Load(const std::string&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeSequenceOfReal Set(const TDF_Label& label) ;
+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 Handle(TColStd_HSequenceOfReal)& other) ;
-Standard_EXPORT void ChangeValue(const Standard_Integer Index,const Standard_Real Value) ;
-Standard_EXPORT void Add(const Standard_Real Value) ;
-Standard_EXPORT Standard_Real Value(const Standard_Integer Index) ;
-Standard_EXPORT void Remove(const Standard_Integer Index) ;
-Standard_EXPORT Standard_Integer Length() ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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; }
private:
-Handle_TColStd_HSequenceOfReal myValue;
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeSequenceOfReal )
+std::vector<double> myValue;
};
using namespace std;
#endif
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeString::GetID ()
+const std::string& SALOMEDSImpl_AttributeString::GetID ()
{
- static Standard_GUID CommentID ("1808A12F-AD0E-4a6a-B58A-395DCF469FE9");
+ static std::string CommentID ("1808A12F-AD0E-4a6a-B58A-395DCF469FE9");
return CommentID;
}
-Handle(SALOMEDSImpl_AttributeString) SALOMEDSImpl_AttributeString::Set (const TDF_Label& L,
- const TCollection_ExtendedString& Val)
+SALOMEDSImpl_AttributeString* SALOMEDSImpl_AttributeString::Set (const DF_Label& L,
+ const std::string& Val)
{
- Handle(SALOMEDSImpl_AttributeString) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeString::GetID(), A)) {
+ SALOMEDSImpl_AttributeString* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeString*)L.FindAttribute(SALOMEDSImpl_AttributeString::GetID()))) {
A = new SALOMEDSImpl_AttributeString();
L.AddAttribute(A);
}
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeString::SetValue (const TCollection_ExtendedString& S)
+void SALOMEDSImpl_AttributeString::SetValue (const std::string& S)
{
CheckLocked();
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeString::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeString::ID () const { return GetID(); }
//=======================================================================
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeString::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeString::NewEmpty () const
{
return new SALOMEDSImpl_AttributeString();
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeString::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeString::Restore(DF_Attribute* with)
{
- myString = Handle(SALOMEDSImpl_AttributeString)::DownCast (with)->Value ();
+ myString = dynamic_cast<SALOMEDSImpl_AttributeString*>(with)->Value ();
}
//=======================================================================
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeString::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeString::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeString)::DownCast (into)->SetValue(myString);
+ dynamic_cast<SALOMEDSImpl_AttributeString*>(into)->SetValue(myString);
}
#ifndef _SALOMEDSImpl_AttributeString_HeaderFile
#define _SALOMEDSImpl_AttributeString_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TDF_Label.hxx>
-#include <Standard_GUID.hxx>
+#include "DF_Attribute.hxx"
+#include <string>
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeString, SALOMEDSImpl_GenericAttribute )
class SALOMEDSImpl_AttributeString : public SALOMEDSImpl_GenericAttribute
{
private:
- TCollection_ExtendedString myString;
+ std::string myString;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static const std::string& GetID() ;
Standard_EXPORT SALOMEDSImpl_AttributeString() :SALOMEDSImpl_GenericAttribute("AttributeString") {}
-Standard_EXPORT static Handle(SALOMEDSImpl_AttributeString) Set(const TDF_Label& L, const TCollection_ExtendedString& Val);
-Standard_EXPORT void SetValue (const TCollection_ExtendedString& S);
-Standard_EXPORT TCollection_ExtendedString Value() const { return myString; }
-
-Standard_EXPORT virtual TCollection_AsciiString Save() { return myString; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString& theValue) { myString = theValue; }
+Standard_EXPORT static SALOMEDSImpl_AttributeString* 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; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT virtual std::string Save() { return myString; }
+Standard_EXPORT 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);
Standard_EXPORT ~SALOMEDSImpl_AttributeString() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeString )
};
#endif
// Module : SALOME
#include <SALOMEDSImpl_AttributeStudyProperties.hxx>
-#include <Standard_GUID.hxx>
-#include <TCollection_ExtendedString.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute )
-const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::GetID()
+const std::string& SALOMEDSImpl_AttributeStudyProperties::GetID()
{
- static Standard_GUID SALOMEDSImpl_AttributeStudyPropertiesID ("128371A2-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeStudyPropertiesID ("128371A2-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeStudyPropertiesID;
}
-Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_AttributeStudyProperties::Set(const TDF_Label& label)
+SALOMEDSImpl_AttributeStudyProperties* SALOMEDSImpl_AttributeStudyProperties::Set(const DF_Label& label)
{
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
- if (!label.FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(),anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeStudyProperties();
- label.AddAttribute(anAttr);
+ SALOMEDSImpl_AttributeStudyProperties* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeStudyProperties*)label.FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID()))) {
+ A = new SALOMEDSImpl_AttributeStudyProperties();
+ label.AddAttribute(A);
}
- return anAttr;
+ return A;
}
SALOMEDSImpl_AttributeStudyProperties::SALOMEDSImpl_AttributeStudyProperties()
:SALOMEDSImpl_GenericAttribute("AttributeStudyProperties")
{
- myLocked = Standard_False;
- myLockChanged = Standard_False;
+ myLocked = false;
+ myLockChanged = false;
Init();
}
void SALOMEDSImpl_AttributeStudyProperties::Init()
{
- myUserName = new TColStd_HSequenceOfExtendedString();
- myMinute = new TColStd_HSequenceOfInteger();
- myHour = new TColStd_HSequenceOfInteger();
- myDay = new TColStd_HSequenceOfInteger();
- myMonth = new TColStd_HSequenceOfInteger();
- myYear = new TColStd_HSequenceOfInteger();
-// myModified = 0;
+ myUserName.clear();
+ myMinute.clear();
+ myHour.clear();
+ myDay.clear();
+ myMonth.clear();
+ myYear.clear();
myMode = 0; // none
}
-void SALOMEDSImpl_AttributeStudyProperties::SetModification(const TCollection_ExtendedString& theUserName,
- const Standard_Integer theMinute,
- const Standard_Integer theHour,
- const Standard_Integer theDay,
- const Standard_Integer theMonth,
- const Standard_Integer theYear)
+void SALOMEDSImpl_AttributeStudyProperties::SetModification(const std::string& theUserName,
+ const int theMinute,
+ const int theHour,
+ const int theDay,
+ const int theMonth,
+ const int theYear)
{
if (theMinute<0 || theMinute>60 || theHour<0 || theHour>24 ||
theDay<0 || theDay>31 || theMonth<0 || theMonth>12)
CheckLocked();
Backup();
- myUserName->Append(theUserName);
- myMinute->Append(theMinute);
- myHour->Append(theHour);
- myDay->Append(theDay);
- myMonth->Append(theMonth);
- myYear->Append(theYear);
+ myUserName.push_back(theUserName);
+ myMinute.push_back(theMinute);
+ myHour.push_back(theHour);
+ myDay.push_back(theDay);
+ myMonth.push_back(theMonth);
+ myYear.push_back(theYear);
}
void SALOMEDSImpl_AttributeStudyProperties::GetModifications
- (Handle(TColStd_HSequenceOfExtendedString)& theUserNames,
- Handle(TColStd_HSequenceOfInteger)& theMinutes,
- Handle(TColStd_HSequenceOfInteger)& theHours,
- Handle(TColStd_HSequenceOfInteger)& theDays,
- Handle(TColStd_HSequenceOfInteger)& theMonths,
- Handle(TColStd_HSequenceOfInteger)& theYears) const
+ (vector<string>& theUserNames,
+ vector<int>& theMinutes,
+ vector<int>& theHours,
+ vector<int>& theDays,
+ vector<int>& theMonths,
+ vector<int>& theYears) const
{
theUserNames = myUserName;
theMinutes = myMinute;
theYears = myYear;
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const
+std::string SALOMEDSImpl_AttributeStudyProperties::GetCreatorName() const
{
- if (myUserName->Length() == 0)
- return TCollection_ExtendedString("");
- return myUserName->Value(1);
+ if (myUserName.size() == 0)
+ return std::string("");
+ return myUserName[0];
}
-Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::GetCreationDate
- (Standard_Integer& theMinute,
- Standard_Integer& theHour,
- Standard_Integer& theDay,
- Standard_Integer& theMonth,
- Standard_Integer& theYear) const
+bool SALOMEDSImpl_AttributeStudyProperties::GetCreationDate
+ (int& theMinute,
+ int& theHour,
+ int& theDay,
+ int& theMonth,
+ int& theYear) const
{
- if (myMinute->Length() != 0) {
- theMinute = myMinute->Value(1);
- theHour = myHour->Value(1);
- theDay = myDay->Value(1);
- theMonth = myMonth->Value(1);
- theYear = myYear->Value(1);
- return Standard_True;
+ if (myMinute.size() != 0) {
+ theMinute = myMinute[0];
+ theHour = myHour[0];
+ theDay = myDay[0];
+ theMonth = myMonth[0];
+ theYear = myYear[0];
+ return true;
}
- return Standard_False;
+ return false;
}
-void SALOMEDSImpl_AttributeStudyProperties::ChangeCreatorName(const TCollection_ExtendedString& theName)
+void SALOMEDSImpl_AttributeStudyProperties::ChangeCreatorName(const std::string& theName)
{
- if (myUserName->Length() > 0) {
+ if (myUserName.size() > 0) {
CheckLocked();
Backup();
- myUserName->SetValue(1, theName);
+ myUserName[0] = theName;
}
}
-void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const Standard_Integer theMode)
+void SALOMEDSImpl_AttributeStudyProperties::SetCreationMode(const int theMode)
{
CheckLocked();
Backup();
myMode = theMode;
}
-Standard_Integer SALOMEDSImpl_AttributeStudyProperties::GetCreationMode() const
+int SALOMEDSImpl_AttributeStudyProperties::GetCreationMode() const
{
return myMode;
}
-void SALOMEDSImpl_AttributeStudyProperties::SetModified(const Standard_Integer theModified)
+void SALOMEDSImpl_AttributeStudyProperties::SetModified(const int theModified)
{
myModified = theModified;
}
-Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsModified() const
+bool SALOMEDSImpl_AttributeStudyProperties::IsModified() const
{
return (myModified != 0);
}
-Standard_Integer SALOMEDSImpl_AttributeStudyProperties::GetModified() const
+int SALOMEDSImpl_AttributeStudyProperties::GetModified() const
{
return myModified;
}
-void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const Standard_Boolean theLocked)
+void SALOMEDSImpl_AttributeStudyProperties::SetLocked(const bool theLocked)
{
// Backup();
if (myLocked != theLocked) {
- myLockChanged = Standard_True;
+ myLockChanged = true;
myLocked = theLocked;
}
}
-Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsLocked() const
+bool SALOMEDSImpl_AttributeStudyProperties::IsLocked() const
{
return myLocked;
}
-Standard_Boolean SALOMEDSImpl_AttributeStudyProperties::IsLockChanged(const Standard_Boolean theErase) {
- if (!myLockChanged) return Standard_False;
- if (theErase) myLockChanged = Standard_False;
- return Standard_True;
+bool SALOMEDSImpl_AttributeStudyProperties::IsLockChanged(const bool theErase) {
+ if (!myLockChanged) return false;
+ if (theErase) myLockChanged = false;
+ return true;
}
-const Standard_GUID& SALOMEDSImpl_AttributeStudyProperties::ID() const
+const std::string& SALOMEDSImpl_AttributeStudyProperties::ID() const
{
return GetID();
}
-void SALOMEDSImpl_AttributeStudyProperties::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeStudyProperties::Restore(DF_Attribute* with)
{
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(with);
+ SALOMEDSImpl_AttributeStudyProperties* aProp =
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(with);
+
Init();
- Standard_Integer i;
- Handle(TColStd_HSequenceOfExtendedString) aNames;
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ vector<string> aNames;
+ vector<int> aMinutes, aHours, aDays, aMonths, aYears;
aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
- for (i = aNames->Length(); i > 0; i--) {
- myUserName->Prepend(aNames->Value(i));
- myMinute->Prepend(aMinutes->Value(i));
- myHour->Prepend(aHours->Value(i));
- myDay->Prepend(aDays->Value(i));
- myMonth->Prepend(aMonths->Value(i));
- myYear->Prepend(aYears->Value(i));
+ for (int i = 0, len = aNames.size(); i < len; i++) {
+ myUserName.push_back(aNames[i]);
+ myMinute.push_back(aMinutes[i]);
+ myHour.push_back(aHours[i]);
+ myDay.push_back(aDays[i]);
+ myMonth.push_back(aMonths[i]);
+ myYear.push_back(aYears[i]);
}
myMode = aProp->GetCreationMode();
// myModified = aProp->GetModified();
// myLocked = aProp->IsLocked();
}
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeStudyProperties::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributeStudyProperties::NewEmpty() const
{
return new SALOMEDSImpl_AttributeStudyProperties();
}
-void SALOMEDSImpl_AttributeStudyProperties::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
+void SALOMEDSImpl_AttributeStudyProperties::Paste(DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp =
- Handle(SALOMEDSImpl_AttributeStudyProperties)::DownCast(into);
+ SALOMEDSImpl_AttributeStudyProperties* aProp =
+ dynamic_cast<SALOMEDSImpl_AttributeStudyProperties*>(into);
aProp->Init();
- Standard_Integer i;
- for(i = 1; i <= myUserName->Length(); i++) {
- aProp->SetModification(myUserName->Value(i),
- myMinute->Value(i), myHour->Value(i),
- myDay->Value(i), myMonth->Value(i), myYear->Value(i));
+ int i;
+ for(i = 0; i < myUserName.size(); i++) {
+ aProp->SetModification(myUserName[i],
+ myMinute[i], myHour[i],
+ myDay[i], myMonth[i], myYear[i]);
}
aProp->SetCreationMode(myMode);
}
-TCollection_AsciiString SALOMEDSImpl_AttributeStudyProperties::Save()
+string SALOMEDSImpl_AttributeStudyProperties::Save()
{
- Handle(TColStd_HSequenceOfExtendedString) aNames;
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ vector<string> aNames;
+ vector<int> aMinutes, aHours, aDays, aMonths, aYears;
GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
int aLength, anIndex;
- for (aLength = 0, anIndex = aNames->Length(); anIndex > 0; anIndex--)
- aLength += aNames->Value(anIndex).Length() + 1;
+ for (aLength = 0, anIndex = aNames.size()-1; anIndex >= 0; anIndex--)
+ aLength += aNames[anIndex].size() + 1;
- char* aProperty = new char[3 + aLength + 12 * aNames->Length()];
+ char* aProperty = new char[3 + aLength + 12 * aNames.size()];
char crMode = (char)GetCreationMode();
sprintf(aProperty,"%c%c", crMode, IsLocked()?'l':'u');
- aLength = aNames->Length();
+ aLength = aNames.size();
int a = 2;
- for (anIndex = 1; anIndex <= aLength; anIndex++) {
+ for (anIndex = 0; anIndex < aLength; anIndex++) {
sprintf(&(aProperty[a]),"%2d%2d%2d%2d%4d%s",
- (int)(aMinutes->Value(anIndex)),
- (int)(aHours->Value(anIndex)),
- (int)(aDays->Value(anIndex)),
- (int)(aMonths->Value(anIndex)),
- (int)(aYears->Value(anIndex)),
- (char*)(TCollection_AsciiString(aNames->Value(anIndex)).ToCString()));
+ (int)(aMinutes[anIndex]),
+ (int)(aHours[anIndex]),
+ (int)(aDays[anIndex]),
+ (int)(aMonths[anIndex]),
+ (int)(aYears[anIndex]),
+ (char*)(aNames[anIndex].c_str()));
a = strlen(aProperty);
aProperty[a++] = 1;
}
aProperty[a] = 0;
- TCollection_AsciiString prop(aProperty);
+ string prop(aProperty);
delete aProperty;
return prop;
}
-void SALOMEDSImpl_AttributeStudyProperties::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeStudyProperties::Load(const string& value)
{
- char* aCopy = value.ToCString();
+ char* aCopy = (char*)value.c_str();
int crMode = (int)aCopy[0];
SetCreationMode(crMode);
int anIndex;
- for (anIndex = 2; anIndex + 2 < value.Length() ;) {
+ for (anIndex = 2; anIndex + 2 < value.size() ;) {
char str[10];
- Standard_Integer aMinute, aHour, aDay, aMonth, aYear;
+ int aMinute, aHour, aDay, aMonth, aYear;
str[0] = aCopy[anIndex++];
str[1] = aCopy[anIndex++];
str[2] = 0;
anIndex += aNameSize + 1;
}
if (aCopy[1] == 'l') {
- SetLocked(Standard_True);
+ SetLocked(true);
}
SetModified(0);
}
#ifndef _SALOMEDSImpl_AttributeStudyProperties_HeaderFile
#define _SALOMEDSImpl_AttributeStudyProperties_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
+#include <vector>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeStudyProperties, SALOMEDSImpl_GenericAttribute )
-
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-
class SALOMEDSImpl_AttributeStudyProperties : public SALOMEDSImpl_GenericAttribute
{
public:
Standard_EXPORT SALOMEDSImpl_AttributeStudyProperties();
Standard_EXPORT ~SALOMEDSImpl_AttributeStudyProperties() {}
-Standard_EXPORT static const Standard_GUID& GetID();
-Standard_EXPORT const Standard_GUID& ID() const;
+Standard_EXPORT static const std::string& GetID();
+Standard_EXPORT const std::string& ID() const;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeStudyProperties Set(const TDF_Label& label);
+Standard_EXPORT static SALOMEDSImpl_AttributeStudyProperties* Set(const DF_Label& label);
Standard_EXPORT void Init();
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-
-Standard_EXPORT void SetModification(const TCollection_ExtendedString& theUserName,
- const Standard_Integer theMinute,
- const Standard_Integer theHour,
- const Standard_Integer theDay,
- const Standard_Integer theMonth,
- const Standard_Integer theYear);
-Standard_EXPORT void GetModifications(Handle(TColStd_HSequenceOfExtendedString)& theUserNames,
- Handle(TColStd_HSequenceOfInteger)& theMinutes,
- Handle(TColStd_HSequenceOfInteger)& theHours,
- Handle(TColStd_HSequenceOfInteger)& theDays,
- Handle(TColStd_HSequenceOfInteger)& theMonths,
- Handle(TColStd_HSequenceOfInteger)& theYears) const;
-
-Standard_EXPORT TCollection_ExtendedString GetCreatorName() const;
-Standard_EXPORT Standard_Boolean GetCreationDate(Standard_Integer& theMinute,
- Standard_Integer& theHour,
- Standard_Integer& theDay,
- Standard_Integer& theMonth,
- Standard_Integer& theYear) const;
-
-Standard_EXPORT void ChangeCreatorName(const TCollection_ExtendedString& theUserName);
-
-Standard_EXPORT void SetCreationMode(const Standard_Integer theMode);
-Standard_EXPORT Standard_Integer GetCreationMode() const;
-
-Standard_EXPORT void SetModified(const Standard_Integer theModified);
-Standard_EXPORT Standard_Boolean IsModified() const;
-Standard_EXPORT Standard_Integer GetModified() const;
-
-Standard_EXPORT void SetLocked(const Standard_Boolean theLocked);
-Standard_EXPORT Standard_Boolean IsLocked() const;
-Standard_EXPORT Standard_Boolean IsLockChanged(const Standard_Boolean theErase);
-
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with);
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const;
+Standard_EXPORT virtual std::string Save();
+Standard_EXPORT 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;
+
+Standard_EXPORT std::string GetCreatorName() const;
+Standard_EXPORT bool GetCreationDate(int& theMinute,
+ int& theHour,
+ int& theDay,
+ int& theMonth,
+ int& theYear) const;
+
+Standard_EXPORT void ChangeCreatorName(const std::string& theUserName);
+
+Standard_EXPORT void SetCreationMode(const int theMode);
+Standard_EXPORT int GetCreationMode() const;
+
+Standard_EXPORT void SetModified(const int theModified);
+Standard_EXPORT bool IsModified() const;
+Standard_EXPORT int GetModified() const;
+
+Standard_EXPORT void SetLocked(const bool theLocked);
+Standard_EXPORT bool IsLocked() const;
+Standard_EXPORT 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);
private:
-Handle_TColStd_HSequenceOfExtendedString myUserName;
-Handle_TColStd_HSequenceOfInteger myMinute;
-Handle_TColStd_HSequenceOfInteger myHour;
-Handle_TColStd_HSequenceOfInteger myDay;
-Handle_TColStd_HSequenceOfInteger myMonth;
-Handle_TColStd_HSequenceOfInteger myYear;
-Standard_Integer myMode;
-Standard_Integer myModified;
-Standard_Boolean myLocked;
-Standard_Boolean myLockChanged;
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeStudyProperties )
+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;
};
// Author : Michael Ponikarov
// Module : SALOME
-#include <SALOMEDSImpl_AttributeTableOfInteger.hxx>
-#include <Standard_Failure.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
-#include <Standard_GUID.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
+#include "SALOMEDSImpl_AttributeTableOfInteger.hxx"
+#include <strstream>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute )
-
#define SEPARATOR '\1'
+typedef map<int, int>::const_iterator MI;
-static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString)
+static std::string getUnit(std::string theString)
{
- TCollection_ExtendedString aString(theString);
- int aPos = aString.Search(SEPARATOR);
- if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString();
- return aString.Split(aPos);
+ std::string aString(theString);
+ int aPos = aString.find(SEPARATOR);
+ if(aPos <= 0 || aPos == aString.size() ) return std::string();
+ return aString.substr(aPos+1, aString.size());
}
-static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString)
+static std::string getTitle(std::string theString)
{
- TCollection_ExtendedString aString(theString);
- int aPos = aString.Search(SEPARATOR);
+ std::string aString(theString);
+ int aPos = aString.find(SEPARATOR);
if(aPos < 1) return aString;
- if(aPos == 1) return TCollection_ExtendedString();
- aString.Split(aPos-1);
- return aString;
+ if(aPos == 0) return std::string();
+ return aString.substr(0, aPos);
}
-const Standard_GUID& SALOMEDSImpl_AttributeTableOfInteger::GetID()
+const std::string& SALOMEDSImpl_AttributeTableOfInteger::GetID()
{
- static Standard_GUID SALOMEDSImpl_AttributeTableOfIntegerID ("128371A0-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeTableOfIntegerID ("128371A0-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeTableOfIntegerID;
}
-Handle(SALOMEDSImpl_AttributeTableOfInteger) SALOMEDSImpl_AttributeTableOfInteger::Set(const TDF_Label& label)
+SALOMEDSImpl_AttributeTableOfInteger* SALOMEDSImpl_AttributeTableOfInteger::Set(const DF_Label& label)
{
- Handle(SALOMEDSImpl_AttributeTableOfInteger) anAttr;
- if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfInteger::GetID(),anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeTableOfInteger();
- label.AddAttribute(anAttr);
+ SALOMEDSImpl_AttributeTableOfInteger* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeTableOfInteger*)label.FindAttribute(SALOMEDSImpl_AttributeTableOfInteger::GetID()))) {
+ A = new SALOMEDSImpl_AttributeTableOfInteger();
+ label.AddAttribute(A);
}
- return anAttr;
+ return A;
}
SALOMEDSImpl_AttributeTableOfInteger::SALOMEDSImpl_AttributeTableOfInteger()
:SALOMEDSImpl_GenericAttribute("AttributeTableOfInteger")
{
- myRows = new TColStd_HSequenceOfExtendedString();
- myCols = new TColStd_HSequenceOfExtendedString();
myNbRows = 0;
myNbColumns = 0;
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetNbColumns(const Standard_Integer theNbColumns)
+void SALOMEDSImpl_AttributeTableOfInteger::SetNbColumns(const int theNbColumns)
{
CheckLocked();
Backup();
- TColStd_DataMapOfIntegerInteger aMap;
+ map<int, int> aMap;
aMap = myTable;
- myTable.Clear();
+ myTable.clear();
- TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIterator(aMap);
- for(; anIterator.More(); anIterator.Next()) {
- int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
- int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
+
+ for(MI p = aMap.begin(); p != aMap.end(); p++) {
+ int aRow = (int)(p->first/myNbColumns) + 1;
+ int aCol = (int)(p->first - myNbColumns*(aRow-1));
if(aCol == 0) { aCol = myNbColumns; aRow--; }
if(aCol > theNbColumns) continue;
int aKey = (aRow-1)*theNbColumns+aCol;
- myTable.Bind(aKey, anIterator.Value());
+ myTable[aKey] = p->second;
}
myNbColumns = theNbColumns;
- while (myCols->Length() < myNbColumns) { // append empty columns titles
- myCols->Append(TCollection_ExtendedString(""));
+ while (myCols.size() < myNbColumns) { // append empty columns titles
+ myCols.push_back(std::string(""));
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetTitle(const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfInteger::SetTitle(const std::string& theTitle)
{
CheckLocked();
Backup();
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetTitle() const
+std::string SALOMEDSImpl_AttributeTableOfInteger::GetTitle() const
{
return myTitle;
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const Standard_Integer theRow,
- const Handle(TColStd_HSequenceOfInteger)& theData)
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowData(const int theRow,
+ const vector<int>& theData)
{
CheckLocked();
- if(theData->Length() > myNbColumns) SetNbColumns(theData->Length());
+ if(theData.size() > myNbColumns) SetNbColumns(theData.size());
Backup();
- while (myRows->Length() < theRow) { // append new row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < theRow) { // append new row titles
+ myRows.push_back(std::string(""));
}
- Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length();
+ int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
- myTable.Bind(aShift + i, theData->Value(i));
+ myTable[aShift + i] = theData[i-1];
}
if(theRow > myNbRows) myNbRows = theRow;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfInteger) SALOMEDSImpl_AttributeTableOfInteger::GetRowData(const Standard_Integer theRow)
+vector<int> SALOMEDSImpl_AttributeTableOfInteger::GetRowData(const int theRow)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger();
- Standard_Integer i, aShift = (theRow-1)*myNbColumns;
+ vector<int> aSeq;
+ int i, aShift = (theRow-1)*myNbColumns;
for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift+i))
- aSeq->Append(myTable.Find(aShift+i));
+ if(myTable.find(aShift+i) != myTable.end())
+ aSeq.push_back(myTable[aShift+i]);
else
- aSeq->Append(0);
+ aSeq.push_back(0);
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitle(const Standard_Integer theRow,
- const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitle(const int theRow,
+ const std::string& theTitle)
{
CheckLocked();
Backup();
- TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow);
- if(aUnit.Length()>0) {
+ string aTitle(theTitle), aUnit = GetRowUnit(theRow);
+ if(aUnit.size()>0) {
aTitle += SEPARATOR;
aTitle += aUnit;
}
- myRows->SetValue(theRow, aTitle);
+ myRows[theRow-1] = aTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnit(const Standard_Integer theRow,
- const TCollection_ExtendedString& theUnit)
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnit(const int theRow,
+ const std::string& theUnit)
{
CheckLocked();
Backup();
- TCollection_ExtendedString aTitle = GetRowTitle(theRow);
+ std::string aTitle = GetRowTitle(theRow);
aTitle += SEPARATOR;
aTitle += theUnit;
- myRows->SetValue(theRow, aTitle);
+ myRows[theRow-1] = aTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits)
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowUnits(const vector<string>& theUnits)
{
- if (theUnits->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
- int aLength = theUnits->Length(), i;
- for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits->Value(i));
+ if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows");
+ int aLength = theUnits.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetRowUnits()
+vector<string> SALOMEDSImpl_AttributeTableOfInteger::GetRowUnits()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myRows->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(getUnit(myRows->Value(i)));
+ vector<string> aSeq;
+ int aLength = myRows.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(getUnit(myRows[i]));
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+void SALOMEDSImpl_AttributeTableOfInteger::SetRowTitles(const vector<string>& theTitles)
{
- if (theTitles->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
- int aLength = theTitles->Length(), i;
- for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles->Value(i));
+ if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows");
+ int aLength = theTitles.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetRowTitles()
+vector<string> SALOMEDSImpl_AttributeTableOfInteger::GetRowTitles()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myRows->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(getTitle(myRows->Value(i)));
+ vector<string> aSeq;
+ int aLength = myRows.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(getTitle(myRows[i]));
return aSeq;
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetRowTitle(const Standard_Integer theRow) const
+std::string SALOMEDSImpl_AttributeTableOfInteger::GetRowTitle(const int theRow) const
{
- return getTitle(myRows->Value(theRow));
+ return getTitle(myRows[theRow-1]);
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetRowUnit(const Standard_Integer theRow) const
+std::string SALOMEDSImpl_AttributeTableOfInteger::GetRowUnit(const int theRow) const
{
- return getUnit(myRows->Value(theRow));
+ return getUnit(myRows[theRow-1]);
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetColumnData(const Standard_Integer theColumn,
- const Handle(TColStd_HSequenceOfInteger)& theData)
+void SALOMEDSImpl_AttributeTableOfInteger::SetColumnData(const int theColumn,
+ const vector<int>& theData)
{
CheckLocked();
if(theColumn > myNbColumns) SetNbColumns(theColumn);
Backup();
- Standard_Integer i, aLength = theData->Length();
+ int i, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
- myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i));
+ myTable[myNbColumns*(i-1)+theColumn] = theData[i-1];
}
if(aLength > myNbRows) {
myNbRows = aLength;
- while (myRows->Length() < myNbRows) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < myNbRows) { // append empty row titles
+ myRows.push_back(std::string(""));
}
}
}
-Handle(TColStd_HSequenceOfInteger) SALOMEDSImpl_AttributeTableOfInteger::GetColumnData(const Standard_Integer theColumn)
+vector<int> SALOMEDSImpl_AttributeTableOfInteger::GetColumnData(const int theColumn)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
-
- Standard_Integer i, anIndex;
+ vector<int> aSeq;
+ int i, anIndex;
for(i = 1; i <= myNbRows; i++) {
anIndex = myNbColumns*(i-1) + theColumn;
- if(myTable.IsBound(anIndex))
- aSeq->Append(myTable.Find(anIndex));
+ if(myTable.find(anIndex) != myTable.end())
+ aSeq.push_back(myTable[anIndex]);
else
- aSeq->Append(0);
+ aSeq.push_back(0);
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitle(const Standard_Integer theColumn,
- const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitle(const int theColumn,
+ const std::string& theTitle)
{
CheckLocked();
Backup();
- while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString(""));
- myCols->SetValue(theColumn,theTitle);
+ while(myCols.size() < theColumn) myCols.push_back(std::string(""));
+ myCols[theColumn-1] = theTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitle(const Standard_Integer theColumn) const
+std::string SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitle(const int theColumn) const
{
- if(myCols.IsNull()) return "";
- if(myCols->Length() < theColumn) return "";
- return myCols->Value(theColumn);
+ if(myCols.empty()) return "";
+ if(myCols.size() < theColumn) return "";
+ return myCols[theColumn-1];
}
-void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+void SALOMEDSImpl_AttributeTableOfInteger::SetColumnTitles(const vector<string>& theTitles)
{
- if (theTitles->Length() != myNbColumns) Standard_Failure::Raise("Invalid number of columns");
- int aLength = theTitles->Length(), i;
- for(i = 1; i <= aLength; i++) myCols->SetValue(i, theTitles->Value(i));
+ if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns");
+ int aLength = theTitles.size(), i;
+ for(i = 0; i < aLength; i++) myCols[i] = theTitles[i];
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitles()
+vector<string> SALOMEDSImpl_AttributeTableOfInteger::GetColumnTitles()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myCols->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(myCols->Value(i));
+ vector<string> aSeq;
+ int aLength = myCols.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(myCols[i]);
return aSeq;
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfInteger::GetNbRows() const
+int SALOMEDSImpl_AttributeTableOfInteger::GetNbRows() const
{
return myNbRows;
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfInteger::GetNbColumns() const
+int SALOMEDSImpl_AttributeTableOfInteger::GetNbColumns() const
{
return myNbColumns;
}
-void SALOMEDSImpl_AttributeTableOfInteger::PutValue(const Standard_Integer theValue,
- const Standard_Integer theRow,
- const Standard_Integer theColumn)
+void SALOMEDSImpl_AttributeTableOfInteger::PutValue(const int theValue,
+ const int theRow,
+ const int theColumn)
{
CheckLocked();
if(theColumn > myNbColumns) SetNbColumns(theColumn);
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- myTable.Bind(anIndex, theValue);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ myTable[anIndex] = theValue;
if(theRow > myNbRows) {
- while (myRows->Length() < theRow) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < theRow) { // append empty row titles
+ myRows.push_back(std::string(""));
}
myNbRows = theRow;
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Standard_Boolean SALOMEDSImpl_AttributeTableOfInteger::HasValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
+bool SALOMEDSImpl_AttributeTableOfInteger::HasValue(const int theRow,
+ const int theColumn)
{
- if(theRow > myNbRows || theRow < 1) return Standard_False;
- if(theColumn > myNbColumns || theColumn < 1) return Standard_False;
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- return myTable.IsBound(anIndex);
+ if(theRow > myNbRows || theRow < 1) return false;
+ if(theColumn > myNbColumns || theColumn < 1) return false;
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ return (myTable.find(anIndex) != myTable.end());
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfInteger::GetValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
+int SALOMEDSImpl_AttributeTableOfInteger::GetValue(const int theRow,
+ const int theColumn)
{
- if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index");
- if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index");
+ if(theRow > myNbRows || theRow < 1) throw DFexception("Invalid cell index");
+ if(theColumn > myNbColumns || theColumn < 1) DFexception("Invalid cell index");
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- if(myTable.IsBound(anIndex)) return myTable.Find(anIndex);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ if(myTable.find(anIndex) != myTable.end()) return myTable[anIndex];
- Standard_Failure::Raise("Invalid cell index");
+ throw DFexception("Invalid cell index");
return 0;
}
-const Standard_GUID& SALOMEDSImpl_AttributeTableOfInteger::ID() const
+const std::string& SALOMEDSImpl_AttributeTableOfInteger::ID() const
{
return GetID();
}
-void SALOMEDSImpl_AttributeTableOfInteger::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeTableOfInteger::Restore(DF_Attribute* with)
{
- Standard_Integer anIndex;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(with);
+ int anIndex;
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(with);
+ if(!aTable) throw DFexception("Can't Restore from a null attribute");
- myTable.Clear();
- myCols->Clear();
- myRows->Clear();
+ myTable.clear();
+ myCols.clear();
+ myRows.clear();
myTable = aTable->myTable;
myNbRows = aTable->myNbRows;
myTitle = aTable->myTitle;
for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
- myRows->Append(aTable->GetRowTitle(anIndex));
+ myRows.push_back(aTable->GetRowTitle(anIndex));
for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++)
- myCols->Append(aTable->GetColumnTitle(anIndex));
+ myCols.push_back(aTable->GetColumnTitle(anIndex));
}
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfInteger::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributeTableOfInteger::NewEmpty() const
{
return new SALOMEDSImpl_AttributeTableOfInteger();
}
-void SALOMEDSImpl_AttributeTableOfInteger::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
+void SALOMEDSImpl_AttributeTableOfInteger::Paste(DF_Attribute* into)
{
- Standard_Integer anIndex;
- Handle(SALOMEDSImpl_AttributeTableOfInteger) aTable = Handle(SALOMEDSImpl_AttributeTableOfInteger)::DownCast(into);
+ int anIndex;
+ SALOMEDSImpl_AttributeTableOfInteger* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfInteger*>(into);
+ if(!aTable) throw DFexception("Can't Paste into a null attribute");
- aTable->myTable.Clear();
- aTable->myCols->Clear();
- aTable->myRows->Clear();
+ aTable->myTable.clear();
+ aTable->myCols.clear();
+ aTable->myRows.clear();
aTable->myTable = myTable;
aTable->myTitle = myTitle;
aTable->myNbColumns = myNbColumns;
for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
- aTable->myRows->Append(GetRowTitle(anIndex));
+ aTable->myRows.push_back(GetRowTitle(anIndex));
for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++)
- aTable->myCols->Append(GetColumnTitle(anIndex));
+ aTable->myCols.push_back(GetColumnTitle(anIndex));
}
-Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfInteger::GetSetRowIndices(const Standard_Integer theRow)
+vector<int> SALOMEDSImpl_AttributeTableOfInteger::GetSetRowIndices(const int theRow)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ vector<int> aSeq;
- Standard_Integer i, aShift = myNbColumns*(theRow-1);
+ int i, aShift = myNbColumns*(theRow-1);
for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift + i)) aSeq->Append(i);
+ if(myTable.find(aShift + i) != myTable.end()) aSeq.push_back(i);
}
return aSeq;
}
-Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfInteger::GetSetColumnIndices(const Standard_Integer theColumn)
+vector<int> SALOMEDSImpl_AttributeTableOfInteger::GetSetColumnIndices(const int theColumn)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ vector<int> aSeq;
- Standard_Integer i, anIndex;
+ int i, anIndex;
for(i = 1; i <= myNbRows; i++) {
anIndex = myNbColumns*(i-1)+theColumn;
- if(myTable.IsBound(anIndex)) aSeq->Append(i);
+ if(myTable.find(anIndex) != myTable.end()) aSeq.push_back(i);
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfInteger::ConvertToString(ostrstream& theStream)
+string SALOMEDSImpl_AttributeTableOfInteger::Save()
{
+ ostrstream theStream;
int i, j, l;
theStream.precision(64);
//Title
- l = myTitle.Length();
+ l = myTitle.size();
theStream << l << "\n";
- for(i=1; i<=l; i++)
- theStream << myTitle.Value(i) << "\n";
+ for(i=0; i<l; i++)
+ theStream << myTitle[i] << "\n";
//Nb rows
theStream << myNbRows << "\n";
//Rows titles
- for(i=1; i<=myNbRows; i++) {
- l = myRows->Value(i).Length();
+ for(i=0; i<myNbRows; i++) {
+ l = myRows[i].size();
theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myRows->Value(i).Value(j) << "\n";
+ for(j=0; j<l; j++)
+ theStream << myRows[i][j] << "\n";
}
//Nb columns
theStream << myNbColumns << "\n";
//Columns titles
- for(i=1; i<=myNbColumns; i++) {
- l = myCols->Value(i).Length();
+ for(i=0; i<myNbColumns; i++) {
+ l = myCols[i].size();
theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myCols->Value(i).Value(j) << "\n";
+ for(j=0; j<l; j++)
+ theStream << myCols[i][j] << "\n";
}
//Store the table values
- l = myTable.Extent();
+ l = myTable.size();
theStream << l << "\n";
- TColStd_DataMapIteratorOfDataMapOfIntegerInteger anIterator(myTable);
- for(; anIterator.More(); anIterator.Next()) {
- theStream << anIterator.Key() << "\n";
- theStream << anIterator.Value() << "\n";
+ for(MI p = myTable.begin(); p != myTable.end(); p++) {
+ theStream << p->first << "\n";
+ theStream << p->second << "\n";
}
- return;
+ string aString((char*)theStream.rdbuf()->str());
+ return aString;
}
-bool SALOMEDSImpl_AttributeTableOfInteger::RestoreFromString(istrstream& theStream)
+void SALOMEDSImpl_AttributeTableOfInteger::Load(const string& value)
{
+ istrstream theStream(value.c_str(), strlen(value.c_str()));
Backup();
int i, j, l;
- Standard_ExtCharacter anExtChar;
- TCollection_ExtendedString aStr;
+ char anExtChar;
+ std::string aStr;
//Title
theStream >> l;
- myTitle = TCollection_ExtendedString(l, 0);
- for(i=1; i<=l; i++) {
+ myTitle = std::string(l, 0);
+ for(i=0; i<l; i++) {
theStream >> anExtChar;
- myTitle.SetValue(i, anExtChar);
+ myTitle[i] = anExtChar;
}
//Nb rows
theStream >> myNbRows;
//Rows titles
- myRows->Clear();
+ myRows.clear();
for(i=1; i<=myNbRows; i++) {
theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
+ aStr = std::string(l,0);
+ for(j=0; j<l; j++) {
theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
+ aStr[j] = anExtChar;
}
- myRows->Append(aStr);
+ myRows.push_back(aStr);
}
//Nb columns
theStream >> myNbColumns;
//Columns titles
- myCols->Clear();
+ myCols.clear();
for(i=1; i<=myNbColumns; i++) {
theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
+ aStr = std::string(l,0);
+ for(j=0; j<l; j++) {
theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
+ aStr[j] = anExtChar;
}
- myCols->Append(aStr);
+ myCols.push_back(aStr);
}
//Restore the table values
theStream >> l;
- myTable.Clear();
+ myTable.clear();
for(i=1; i<=l; i++) {
int aKey, aValue;
theStream >> aKey;
theStream >> aValue;
- myTable.Bind(aKey, aValue);
+ myTable[aKey] = aValue;
}
-
- return true;
-}
-
-
-TCollection_AsciiString SALOMEDSImpl_AttributeTableOfInteger::Save()
-{
- ostrstream ostr;
- ConvertToString(ostr);
- TCollection_AsciiString aString((char*)ostr.rdbuf()->str());
- return aString;
-}
-
-void SALOMEDSImpl_AttributeTableOfInteger::Load(const TCollection_AsciiString& value)
-{
- istrstream aStream(value.ToCString(), strlen(value.ToCString()));
- RestoreFromString(aStream);
}
#ifndef _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile
#define _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
+#include <string>
+#include <vector>
+#include <map>
-#include <TColStd_SequenceOfTransient.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <Handle_TColStd_HSequenceOfExtendedString.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <strstream>
-#include <TCollection_AsciiString.hxx>
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfInteger, SALOMEDSImpl_GenericAttribute )
class SALOMEDSImpl_AttributeTableOfInteger : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTableOfInteger Set(const TDF_Label& label) ;
+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 Standard_Integer theNbColumns);
-Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetTitle() const;
-Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfInteger)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetRowData(const Standard_Integer theRow) ;
-Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT void SetRowUnit(const Standard_Integer theRow,const TCollection_ExtendedString& theUnit) ;
-Standard_EXPORT TCollection_ExtendedString GetRowUnit(const Standard_Integer theRow) const;
-Standard_EXPORT void SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) ;
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowUnits();
-Standard_EXPORT void SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) ;
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowTitles();
-Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const;
-Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfInteger)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetColumnData(const Standard_Integer theColumn) ;
-Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const;
-Standard_EXPORT void SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles);
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetColumnTitles();
-Standard_EXPORT Standard_Integer GetNbRows() const;
-Standard_EXPORT Standard_Integer GetNbColumns() const;
-
-Standard_EXPORT void PutValue(const Standard_Integer theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Integer GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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;
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow);
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn);
+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);
-Standard_EXPORT void ConvertToString(ostrstream& theStream);
-Standard_EXPORT bool RestoreFromString(istrstream& theStream);
+Standard_EXPORT std::vector<int> GetSetRowIndices(const int theRow);
+Standard_EXPORT std::vector<int> GetSetColumnIndices(const int theColumn);
Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfInteger() {}
private:
-TColStd_DataMapOfIntegerInteger myTable;
-TCollection_ExtendedString myTitle;
-Handle_TColStd_HSequenceOfExtendedString myRows;
-Handle_TColStd_HSequenceOfExtendedString myCols;
-Standard_Integer myNbRows;
-Standard_Integer myNbColumns;
+std::map<int, int> myTable;
+std::string myTitle;
+std::vector<std::string> myRows;
+std::vector<std::string> myCols;
+int myNbRows;
+int myNbColumns;
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTableOfInteger )
};
#endif
// Author : Michael Ponikarov
// Module : SALOME
-#include <SALOMEDSImpl_AttributeTableOfReal.hxx>
-#include <Standard_Failure.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerReal.hxx>
-#include <Standard_GUID.hxx>
+#include "SALOMEDSImpl_AttributeTableOfReal.hxx"
#include <stdio.h>
-#include <TColStd_HSequenceOfExtendedString.hxx>
+#include <strstream>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfReal, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfReal, SALOMEDSImpl_GenericAttribute )
-
#define SEPARATOR '\1'
-static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString)
+typedef map<int, double>::const_iterator MI;
+
+static std::string getUnit(std::string theString)
{
- TCollection_ExtendedString aString(theString);
- int aPos = aString.Search(SEPARATOR);
- if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString();
- return aString.Split(aPos);
+ std::string aString(theString);
+ int aPos = aString.find(SEPARATOR);
+ if(aPos <= 0 || aPos == aString.size() ) return std::string();
+ return aString.substr(aPos+1, aString.size());
}
-static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString)
+static std::string getTitle(std::string theString)
{
- TCollection_ExtendedString aString(theString);
- int aPos = aString.Search(SEPARATOR);
- if(aPos < 1) return aString;
- if(aPos == 1) return TCollection_ExtendedString();
- aString.Split(aPos-1);
- return aString;
+ std::string aString(theString);
+ int aPos = aString.find(SEPARATOR);
+ if(aPos < 0) return aString;
+ if(aPos == 0) return std::string();
+ return aString.substr(0, aPos);
}
-const Standard_GUID& SALOMEDSImpl_AttributeTableOfReal::GetID()
+const std::string& SALOMEDSImpl_AttributeTableOfReal::GetID()
{
- static Standard_GUID SALOMEDSImpl_AttributeTableOfRealID ("128371A1-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeTableOfRealID ("128371A1-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeTableOfRealID;
}
-Handle(SALOMEDSImpl_AttributeTableOfReal) SALOMEDSImpl_AttributeTableOfReal::Set(const TDF_Label& label)
+SALOMEDSImpl_AttributeTableOfReal* SALOMEDSImpl_AttributeTableOfReal::Set(const DF_Label& label)
{
- Handle(SALOMEDSImpl_AttributeTableOfReal) anAttr;
- if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfReal::GetID(),anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeTableOfReal();
- label.AddAttribute(anAttr);
+ SALOMEDSImpl_AttributeTableOfReal* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeTableOfReal*)label.FindAttribute(SALOMEDSImpl_AttributeTableOfReal::GetID()))) {
+ A = new SALOMEDSImpl_AttributeTableOfReal();
+ label.AddAttribute(A);
}
- return anAttr;
+ return A;
}
SALOMEDSImpl_AttributeTableOfReal::SALOMEDSImpl_AttributeTableOfReal()
:SALOMEDSImpl_GenericAttribute("AttributeTableOfReal")
{
- myRows = new TColStd_HSequenceOfExtendedString();
- myCols = new TColStd_HSequenceOfExtendedString();
myNbRows = 0;
myNbColumns = 0;
}
-void SALOMEDSImpl_AttributeTableOfReal::SetNbColumns(const Standard_Integer theNbColumns)
+void SALOMEDSImpl_AttributeTableOfReal::SetNbColumns(const int theNbColumns)
{
CheckLocked();
Backup();
- TColStd_DataMapOfIntegerReal aMap;
+ map<int, double> aMap;
aMap = myTable;
- myTable.Clear();
+ myTable.clear();
- TColStd_DataMapIteratorOfDataMapOfIntegerReal anIterator(aMap);
- for(; anIterator.More(); anIterator.Next()) {
- int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
- int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
+ for(MI p = aMap.begin(); p != aMap.end(); p++) {
+ int aRow = (int)(p->first/myNbColumns) + 1;
+ int aCol = (int)(p->first - myNbColumns*(aRow-1));
if(aCol == 0) { aCol = myNbColumns; aRow--; }
if(aCol > theNbColumns) continue;
int aKey = (aRow-1)*theNbColumns+aCol;
- myTable.Bind(aKey, anIterator.Value());
+ myTable[aKey] = p->second;
}
myNbColumns = theNbColumns;
- while (myCols->Length() < myNbColumns) { // append empty columns titles
- myCols->Append(TCollection_ExtendedString(""));
+ while (myCols.size() < myNbColumns) { // append empty columns titles
+ myCols.push_back(string(""));
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfReal::SetTitle(const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfReal::SetTitle(const std::string& theTitle)
{
CheckLocked();
Backup();
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetTitle() const
+std::string SALOMEDSImpl_AttributeTableOfReal::GetTitle() const
{
return myTitle;
}
-void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const Standard_Integer theRow,
- const Handle(TColStd_HSequenceOfReal)& theData)
+void SALOMEDSImpl_AttributeTableOfReal::SetRowData(const int theRow,
+ const vector<double>& theData)
{
CheckLocked();
- if(theData->Length() > myNbColumns) SetNbColumns(theData->Length());
+ if(theData.size() > myNbColumns) SetNbColumns(theData.size());
Backup();
- while (myRows->Length() < theRow) { // append new row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < theRow) { // append new row titles
+ myRows.push_back(std::string(""));
}
- Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length();
+ int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
- myTable.Bind(aShift + i, theData->Value(i));
+ myTable[aShift + i] = theData[i-1];
}
if(theRow > myNbRows) myNbRows = theRow;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfReal) SALOMEDSImpl_AttributeTableOfReal::GetRowData(const Standard_Integer theRow)
+vector<double> SALOMEDSImpl_AttributeTableOfReal::GetRowData(const int theRow)
{
- Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal();
- Standard_Integer i, aShift = (theRow-1)*myNbColumns;
+ vector<double> aSeq;
+ int i, aShift = (theRow-1)*myNbColumns;
for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift+i))
- aSeq->Append(myTable.Find(aShift+i));
+ if(myTable.find(aShift+i) != myTable.end())
+ aSeq.push_back(myTable[aShift+i]);
else
- aSeq->Append(0.);
+ aSeq.push_back(0.);
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfReal::SetRowTitle(const Standard_Integer theRow,
- const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfReal::SetRowTitle(const int theRow,
+ const std::string& theTitle)
{
CheckLocked();
Backup();
- TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow);
- if(aUnit.Length()>0) {
+ std::string aTitle(theTitle), aUnit = GetRowUnit(theRow);
+ if(aUnit.size()>0) {
aTitle += SEPARATOR;
aTitle += aUnit;
}
- myRows->SetValue(theRow, aTitle);
+ myRows[theRow-1] = aTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfReal::SetRowUnit(const Standard_Integer theRow,
- const TCollection_ExtendedString& theUnit)
+void SALOMEDSImpl_AttributeTableOfReal::SetRowUnit(const int theRow,
+ const std::string& theUnit)
{
CheckLocked();
Backup();
- TCollection_ExtendedString aTitle = GetRowTitle(theRow);
+ std::string aTitle = GetRowTitle(theRow);
aTitle += SEPARATOR;
aTitle += theUnit;
-
- myRows->SetValue(theRow, aTitle);
+
+ myRows[theRow-1] = aTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfReal::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits)
+void SALOMEDSImpl_AttributeTableOfReal::SetRowUnits(const vector<string>& theUnits)
{
- if (theUnits->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
- int aLength = theUnits->Length(), i;
- for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits->Value(i));
+ if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows");
+ int aLength = theUnits.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetRowUnits()
+vector<string> SALOMEDSImpl_AttributeTableOfReal::GetRowUnits()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myRows->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(getUnit(myRows->Value(i)));
+ vector<string> aSeq;
+ int aLength = myRows.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(getUnit(myRows[i]));
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfReal::SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+void SALOMEDSImpl_AttributeTableOfReal::SetRowTitles(const vector<string>& theTitles)
{
- if (theTitles->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
- int aLength = theTitles->Length(), i;
- for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles->Value(i));
+ if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows");
+ int aLength = theTitles.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetRowTitles()
+vector<string> SALOMEDSImpl_AttributeTableOfReal::GetRowTitles()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myRows->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(getTitle(myRows->Value(i)));
+ vector<string> aSeq;
+ int aLength = myRows.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(getTitle(myRows[i]));
return aSeq;
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetRowTitle(const Standard_Integer theRow) const
+std::string SALOMEDSImpl_AttributeTableOfReal::GetRowTitle(const int theRow) const
{
- return getTitle(myRows->Value(theRow));
+ return getTitle(myRows[theRow-1]);
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetRowUnit(const Standard_Integer theRow) const
+std::string SALOMEDSImpl_AttributeTableOfReal::GetRowUnit(const int theRow) const
{
- return getUnit(myRows->Value(theRow));
+ return getUnit(myRows[theRow-1]);
}
-void SALOMEDSImpl_AttributeTableOfReal::SetColumnData(const Standard_Integer theColumn,
- const Handle(TColStd_HSequenceOfReal)& theData)
+void SALOMEDSImpl_AttributeTableOfReal::SetColumnData(const int theColumn,
+ const vector<double>& theData)
{
CheckLocked();
if(theColumn > myNbColumns) SetNbColumns(theColumn);
Backup();
- Standard_Integer i, aLength = theData->Length();
+ int i, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
- myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i));
+ myTable[myNbColumns*(i-1)+theColumn] = theData[i-1];
}
if(aLength > myNbRows) {
myNbRows = aLength;
- while (myRows->Length() < myNbRows) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < myNbRows) { // append empty row titles
+ myRows.push_back(string(""));
}
}
}
-Handle(TColStd_HSequenceOfReal) SALOMEDSImpl_AttributeTableOfReal::GetColumnData(const Standard_Integer theColumn)
+vector<double> SALOMEDSImpl_AttributeTableOfReal::GetColumnData(const int theColumn)
{
- Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal;
+ vector<double> aSeq;
- Standard_Integer i, anIndex;
+ int i, anIndex;
for(i = 1; i <= myNbRows; i++) {
anIndex = myNbColumns*(i-1) + theColumn;
- if(myTable.IsBound(anIndex))
- aSeq->Append(myTable.Find(anIndex));
+ if(myTable.find(anIndex) != myTable.end())
+ aSeq.push_back(myTable[anIndex]);
else
- aSeq->Append(0.);
+ aSeq.push_back(0.);
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitle(const Standard_Integer theColumn,
- const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitle(const int theColumn,
+ const std::string& theTitle)
{
CheckLocked();
Backup();
- while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString(""));
- myCols->SetValue(theColumn,theTitle);
-
+ while(myCols.size() < theColumn) myCols.push_back(std::string(""));
+ myCols[theColumn-1] = theTitle;
+
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfReal::GetColumnTitle(const Standard_Integer theColumn) const
+std::string SALOMEDSImpl_AttributeTableOfReal::GetColumnTitle(const int theColumn) const
{
- if(myCols.IsNull()) return "";
- if(myCols->Length() < theColumn) return "";
- return myCols->Value(theColumn);
+ if(myCols.empty()) return "";
+ if(myCols.size() < theColumn) return "";
+ return myCols[theColumn-1];
}
-void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+void SALOMEDSImpl_AttributeTableOfReal::SetColumnTitles(const vector<string>& theTitles)
{
- if (theTitles->Length() != myNbColumns) Standard_Failure::Raise("Invalid number of columns");
- int aLength = theTitles->Length(), i;
- for(i = 1; i <= aLength; i++) myCols->SetValue(i, theTitles->Value(i));
+ if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns");
+ int aLength = theTitles.size(), i;
+ for(i = 0; i < aLength; i++) myCols[i] = theTitles[i];
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfReal::GetColumnTitles()
+vector<string> SALOMEDSImpl_AttributeTableOfReal::GetColumnTitles()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myCols->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(myCols->Value(i));
+ vector<string> aSeq;
+ int aLength = myCols.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(myCols[i]);
return aSeq;
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfReal::GetNbRows() const
+int SALOMEDSImpl_AttributeTableOfReal::GetNbRows() const
{
return myNbRows;
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfReal::GetNbColumns() const
+int SALOMEDSImpl_AttributeTableOfReal::GetNbColumns() const
{
return myNbColumns;
}
-void SALOMEDSImpl_AttributeTableOfReal::PutValue(const Standard_Real theValue,
- const Standard_Integer theRow,
- const Standard_Integer theColumn)
+void SALOMEDSImpl_AttributeTableOfReal::PutValue(const double& theValue,
+ const int theRow,
+ const int theColumn)
{
CheckLocked();
if(theColumn > myNbColumns) SetNbColumns(theColumn);
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- myTable.Bind(anIndex, theValue);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ myTable[anIndex] = theValue;
if(theRow > myNbRows) {
- while (myRows->Length() < theRow) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < theRow) { // append empty row titles
+ myRows.push_back(std::string(""));
}
myNbRows = theRow;
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Standard_Boolean SALOMEDSImpl_AttributeTableOfReal::HasValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
+bool SALOMEDSImpl_AttributeTableOfReal::HasValue(const int theRow,
+ const int theColumn)
{
- if(theRow > myNbRows || theRow < 1) return Standard_False;
- if(theColumn > myNbColumns || theColumn < 1) return Standard_False;
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- return myTable.IsBound(anIndex);
+ if(theRow > myNbRows || theRow < 1) return false;
+ if(theColumn > myNbColumns || theColumn < 1) return false;
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ return (myTable.find(anIndex) != myTable.end());
}
-Standard_Real SALOMEDSImpl_AttributeTableOfReal::GetValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
+double SALOMEDSImpl_AttributeTableOfReal::GetValue(const int theRow,
+ const int theColumn)
{
- if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index");
- if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index");
+ if(theRow > myNbRows || theRow < 1) throw DFexception("Invalid cell index");
+ if(theColumn > myNbColumns || theColumn < 1) throw DFexception("Invalid cell index");
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- if(myTable.IsBound(anIndex)) return myTable.Find(anIndex);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ if(myTable.find(anIndex) != myTable.end()) return myTable[anIndex];
- Standard_Failure::Raise("Invalid cell index");
+ throw DFexception("Invalid cell index");
return 0.;
}
-const Standard_GUID& SALOMEDSImpl_AttributeTableOfReal::ID() const
+const std::string& SALOMEDSImpl_AttributeTableOfReal::ID() const
{
return GetID();
}
-void SALOMEDSImpl_AttributeTableOfReal::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeTableOfReal::Restore(DF_Attribute* with)
{
- Standard_Integer anIndex;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(with);
+ int anIndex;
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(with);
+ if(!aTable) throw DFexception("Can't Restore from a null attribute");
- myTable.Clear();
- myCols->Clear();
- myRows->Clear();
+ myTable.clear();
+ myCols.clear();
+ myRows.clear();
myTable = aTable->myTable;
myNbRows = aTable->myNbRows;
myTitle = aTable->myTitle;
for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
- myRows->Append(aTable->GetRowTitle(anIndex));
+ myRows.push_back(aTable->GetRowTitle(anIndex));
for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++)
- myCols->Append(aTable->GetColumnTitle(anIndex));
+ myCols.push_back(aTable->GetColumnTitle(anIndex));
}
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfReal::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributeTableOfReal::NewEmpty() const
{
return new SALOMEDSImpl_AttributeTableOfReal();
}
-void SALOMEDSImpl_AttributeTableOfReal::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
+void SALOMEDSImpl_AttributeTableOfReal::Paste(DF_Attribute* into)
{
- Standard_Integer anIndex;
- Handle(SALOMEDSImpl_AttributeTableOfReal) aTable = Handle(SALOMEDSImpl_AttributeTableOfReal)::DownCast(into);
+ int anIndex;
+ SALOMEDSImpl_AttributeTableOfReal* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfReal*>(into);
+ if(!aTable) throw DFexception("Can't Paste into a null attribute");
- aTable->myTable.Clear();
- aTable->myCols->Clear();
- aTable->myRows->Clear();
+ aTable->myTable.clear();
+ aTable->myCols.clear();
+ aTable->myRows.clear();
aTable->myTable = myTable;
aTable->myTitle = myTitle;
aTable->myNbColumns = myNbColumns;
for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
- aTable->myRows->Append(GetRowTitle(anIndex));
+ aTable->myRows.push_back(GetRowTitle(anIndex));
for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++)
- aTable->myCols->Append(GetColumnTitle(anIndex));
+ aTable->myCols.push_back(GetColumnTitle(anIndex));
}
-Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfReal::GetSetRowIndices(const Standard_Integer theRow)
+vector<int> SALOMEDSImpl_AttributeTableOfReal::GetSetRowIndices(const int theRow)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ vector<int> aSeq;
- Standard_Integer i, aShift = myNbColumns*(theRow-1);
+ int i, aShift = myNbColumns*(theRow-1);
for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift + i)) aSeq->Append(i);
+ if(myTable.find(aShift + i) != myTable.end()) aSeq.push_back(i);
}
return aSeq;
}
-Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfReal::GetSetColumnIndices(const Standard_Integer theColumn)
+vector<int> SALOMEDSImpl_AttributeTableOfReal::GetSetColumnIndices(const int theColumn)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ vector<int> aSeq;
- Standard_Integer i, anIndex;
+ int i, anIndex;
for(i = 1; i <= myNbRows; i++) {
anIndex = myNbColumns*(i-1)+theColumn;
- if(myTable.IsBound(anIndex)) aSeq->Append(i);
+ if(myTable.find(anIndex) != myTable.end()) aSeq.push_back(i);
}
return aSeq;
}
-
-
-void SALOMEDSImpl_AttributeTableOfReal::ConvertToString(ostrstream& theStream)
+string SALOMEDSImpl_AttributeTableOfReal::Save()
{
+ ostrstream theStream;
int i, j, l;
-
//Title
- l = myTitle.Length();
+ l = myTitle.size();
theStream << l << "\n";
- for(i=1; i<=l; i++)
- theStream << myTitle.Value(i) << "\n";
+ for(i=0; i<l; i++)
+ theStream << myTitle[i] << "\n";
//Nb rows
theStream << myNbRows << "\n";
//Rows titles
- for(i=1; i<=myNbRows; i++) {
- l = myRows->Value(i).Length();
+ for(i=0; i<myNbRows; i++) {
+ l = myRows[i].size();
theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myRows->Value(i).Value(j) << "\n";
+ for(j=0; j<l; j++)
+ theStream << myRows[i][j] << "\n";
}
//Nb columns
theStream << myNbColumns << "\n";
//Columns titles
- for(i=1; i<=myNbColumns; i++) {
- l = myCols->Value(i).Length();
+ for(i=0; i<myNbColumns; i++) {
+ l = myCols[i].size();
theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myCols->Value(i).Value(j) << "\n";
+ for(j=0; j<l; j++)
+ theStream << myCols[i][j] << "\n";
}
//Store the table values
- l = myTable.Extent();
+ l = myTable.size();
theStream << l << "\n";
char *aBuffer = new char[128];
- TColStd_DataMapIteratorOfDataMapOfIntegerReal anIterator(myTable);
- for(; anIterator.More(); anIterator.Next()) {
- theStream << anIterator.Key() << "\n";
- sprintf(aBuffer, "%.64e", anIterator.Value());
+ for(MI p = myTable.begin(); p != myTable.end(); p++) {
+ theStream << p->first << "\n";
+ sprintf(aBuffer, "%.64e", p->second);
theStream << aBuffer << "\n";
}
delete []aBuffer;
-
- return;
+ string aString((char*)theStream.rdbuf()->str());
+ return aString;
}
-bool SALOMEDSImpl_AttributeTableOfReal::RestoreFromString(istrstream& theStream)
+void SALOMEDSImpl_AttributeTableOfReal::Load(const string& value)
{
+ istrstream theStream(value.c_str(), strlen(value.c_str()));
Backup();
int i, j, l;
- Standard_ExtCharacter anExtChar;
- TCollection_ExtendedString aStr;
+ char anExtChar;
+ std::string aStr;
//Title
theStream >> l;
- myTitle = TCollection_ExtendedString(l, 0);
- for(i=1; i<=l; i++) {
+ myTitle = std::string(l, 0);
+ for(i=0; i<l; i++) {
theStream >> anExtChar;
- myTitle.SetValue(i, anExtChar);
+ myTitle[i] = anExtChar;
}
//Nb rows
theStream >> myNbRows;
//Rows titles
- myRows->Clear();
+ myRows.clear();
for(i=1; i<=myNbRows; i++) {
theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
+ aStr = std::string(l,0);
+ for(j=0; j<l; j++) {
theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
+ aStr[j] = anExtChar;
}
- myRows->Append(aStr);
+ myRows.push_back(aStr);
}
//Nb columns
theStream >> myNbColumns;
//Columns titles
- myCols->Clear();
+ myCols.clear();
for(i=1; i<=myNbColumns; i++) {
theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
+ aStr = std::string(l,0);
+ for(j=0; j<l; j++) {
theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
+ aStr[j] = anExtChar;
}
- myCols->Append(aStr);
+ myCols.push_back(aStr);
}
//Restore the table values
theStream >> l;
- myTable.Clear();
+ myTable.clear();
for(i=1; i<=l; i++) {
- Standard_Integer aKey;
- Standard_Real aValue;
+ int aKey;
+ double aValue;
theStream >> aKey;
theStream >> aValue;
- myTable.Bind(aKey, aValue);
+ myTable[aKey] = aValue;
}
- return true;
-}
-
-TCollection_AsciiString SALOMEDSImpl_AttributeTableOfReal::Save()
-{
- ostrstream ostr;
- ConvertToString(ostr);
- TCollection_AsciiString aString((char*)ostr.rdbuf()->str());
- return aString;
-}
-
-void SALOMEDSImpl_AttributeTableOfReal::Load(const TCollection_AsciiString& value)
-{
- istrstream aStream(value.ToCString(), strlen(value.ToCString()));
- RestoreFromString(aStream);
}
#ifndef _SALOMEDSImpl_AttributeTableOfReal_HeaderFile
#define _SALOMEDSImpl_AttributeTableOfReal_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfReal, SALOMEDSImpl_GenericAttribute )
-
-#include <TColStd_SequenceOfTransient.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <TColStd_DataMapOfIntegerReal.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TColStd_HSequenceOfReal.hxx>
-
-#include <strstream>
-#include <TCollection_AsciiString.hxx>
+#include <string>
+#include <vector>
+#include <map>
class SALOMEDSImpl_AttributeTableOfReal : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTableOfReal Set(const TDF_Label& label) ;
+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 Standard_Integer theNbColumns);
-Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetTitle() const;
-Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfReal)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfReal GetRowData(const Standard_Integer theRow) ;
-Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT void SetRowUnit(const Standard_Integer theRow,const TCollection_ExtendedString& theUnit) ;
-Standard_EXPORT TCollection_ExtendedString GetRowUnit(const Standard_Integer theRow) const;
-Standard_EXPORT void SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) ;
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowUnits();
-Standard_EXPORT void SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) ;
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowTitles();
-Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const;
-Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfReal)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfReal GetColumnData(const Standard_Integer theColumn) ;
-Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT void SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles);
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetColumnTitles();
-Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const;
-Standard_EXPORT Standard_Integer GetNbRows() const;
-Standard_EXPORT Standard_Integer GetNbColumns() const;
-
-Standard_EXPORT void PutValue(const Standard_Real theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Real GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow);
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn);
-
-Standard_EXPORT void ConvertToString(ostrstream& theStream);
-Standard_EXPORT bool RestoreFromString(istrstream& theStream);
+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;
+
+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);
+
+Standard_EXPORT std::vector<int> GetSetRowIndices(const int theRow);
+Standard_EXPORT std::vector<int> GetSetColumnIndices(const int theColumn);
Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfReal() {}
private:
-TColStd_DataMapOfIntegerReal myTable;
-TCollection_ExtendedString myTitle;
-Handle_TColStd_HSequenceOfExtendedString myRows;
-Handle_TColStd_HSequenceOfExtendedString myCols;
-Standard_Integer myNbRows;
-Standard_Integer myNbColumns;
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTableOfReal )
+std::map<int, double> myTable;
+std::string myTitle;
+std::vector<std::string> myRows;
+std::vector<std::string> myCols;
+int myNbRows;
+int myNbColumns;
};
// Module : SALOME
#include <SALOMEDSImpl_AttributeTableOfString.hxx>
-#include <Standard_Failure.hxx>
-#include <Standard_GUID.hxx>
#include <stdio.h>
-#include <TColStd_HSequenceOfExtendedString.hxx>
+#include <stdlib.h>
+#include <strstream>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute )
-
-typedef NCollection_DataMap<Standard_Integer, TCollection_ExtendedString>::Iterator DataMapIterator;
-
#define SEPARATOR '\1'
-static TCollection_ExtendedString getUnit(TCollection_ExtendedString theString)
+typedef map<int, string>::const_iterator MI;
+
+static std::string getUnit(std::string theString)
{
- TCollection_ExtendedString aString(theString);
- int aPos = aString.Search(SEPARATOR);
- if(aPos <= 0 || aPos == aString.Length() ) return TCollection_ExtendedString();
- return aString.Split(aPos);
+ std::string aString(theString);
+ int aPos = aString.find(SEPARATOR);
+ if(aPos <= 0 || aPos == aString.size() ) return std::string();
+ return aString.substr(aPos+1, aString.size());
}
-static TCollection_ExtendedString getTitle(TCollection_ExtendedString theString)
+static std::string getTitle(std::string theString)
{
- TCollection_ExtendedString aString(theString);
- int aPos = aString.Search(SEPARATOR);
+ std::string aString(theString);
+ int aPos = aString.find(SEPARATOR);
if(aPos < 1) return aString;
- if(aPos == 1) return TCollection_ExtendedString();
- aString.Split(aPos-1);
- return aString;
+ if(aPos == 0) return std::string();
+ return aString.substr(0, aPos);
}
-const Standard_GUID& SALOMEDSImpl_AttributeTableOfString::GetID()
+const std::string& SALOMEDSImpl_AttributeTableOfString::GetID()
{
- static Standard_GUID SALOMEDSImpl_AttributeTableOfStringID ("128371A4-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeTableOfStringID ("128371A4-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeTableOfStringID;
}
-Handle(SALOMEDSImpl_AttributeTableOfString) SALOMEDSImpl_AttributeTableOfString::Set(const TDF_Label& label)
+SALOMEDSImpl_AttributeTableOfString* SALOMEDSImpl_AttributeTableOfString::Set(const DF_Label& label)
{
- Handle(SALOMEDSImpl_AttributeTableOfString) anAttr;
- if (!label.FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID(),anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeTableOfString();
- label.AddAttribute(anAttr);
+ SALOMEDSImpl_AttributeTableOfString* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeTableOfString*)label.FindAttribute(SALOMEDSImpl_AttributeTableOfString::GetID()))) {
+ A = new SALOMEDSImpl_AttributeTableOfString();
+ label.AddAttribute(A);
}
- return anAttr;
+ return A;
}
SALOMEDSImpl_AttributeTableOfString::SALOMEDSImpl_AttributeTableOfString()
:SALOMEDSImpl_GenericAttribute("AttributeTableOfString")
{
- myRows = new TColStd_HSequenceOfExtendedString();
- myCols = new TColStd_HSequenceOfExtendedString();
myNbRows = 0;
myNbColumns = 0;
}
-void SALOMEDSImpl_AttributeTableOfString::SetNbColumns(const Standard_Integer theNbColumns)
+void SALOMEDSImpl_AttributeTableOfString::SetNbColumns(const int theNbColumns)
{
CheckLocked();
Backup();
- DataMapOfIntegerString aMap;
+ map<int, string> aMap;
aMap = myTable;
- myTable.Clear();
+ myTable.clear();
- DataMapIterator anIterator(aMap);
- for(; anIterator.More(); anIterator.Next()) {
- int aRow = (int)(anIterator.Key()/myNbColumns) + 1;
- int aCol = (int)(anIterator.Key() - myNbColumns*(aRow-1));
+ for(MI p = aMap.begin(); p!=aMap.end(); p++) {
+ int aRow = (int)(p->first/myNbColumns) + 1;
+ int aCol = (int)(p->first - myNbColumns*(aRow-1));
if(aCol == 0) { aCol = myNbColumns; aRow--; }
if(aCol > theNbColumns) continue;
int aKey = (aRow-1)*theNbColumns+aCol;
- myTable.Bind(aKey, anIterator.Value());
+ myTable[aKey] = p->second;
}
myNbColumns = theNbColumns;
- while (myCols->Length() < myNbColumns) { // append empty columns titles
- myCols->Append(TCollection_ExtendedString(""));
+ while (myCols.size() < myNbColumns) { // append empty columns titles
+ myCols.push_back(std::string(""));
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfString::SetRowTitle(const Standard_Integer theRow,
- const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfString::SetRowTitle(const int theRow,
+ const std::string& theTitle)
{
CheckLocked();
Backup();
- TCollection_ExtendedString aTitle(theTitle), aUnit = GetRowUnit(theRow);
- if(aUnit.Length()>0) {
+ std::string aTitle(theTitle), aUnit = GetRowUnit(theRow);
+ if(aUnit.size()>0) {
aTitle += SEPARATOR;
aTitle += aUnit;
}
- myRows->SetValue(theRow, aTitle);
+ myRows[theRow-1] = aTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfString::SetRowUnit(const Standard_Integer theRow,
- const TCollection_ExtendedString& theUnit)
+void SALOMEDSImpl_AttributeTableOfString::SetRowUnit(const int theRow,
+ const std::string& theUnit)
{
CheckLocked();
Backup();
- TCollection_ExtendedString aTitle = GetRowTitle(theRow);
+ std::string aTitle = GetRowTitle(theRow);
aTitle += SEPARATOR;
aTitle += theUnit;
- myRows->SetValue(theRow, aTitle);
+ myRows[theRow-1] = aTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfString::SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits)
+void SALOMEDSImpl_AttributeTableOfString::SetRowUnits(const vector<string>& theUnits)
{
- if (theUnits->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
- int aLength = theUnits->Length(), i;
- for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits->Value(i));
+ if (theUnits.size() != GetNbRows()) throw DFexception("Invalid number of rows");
+ int aLength = theUnits.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowUnit(i, theUnits[i-1]);
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowUnits()
+vector<string> SALOMEDSImpl_AttributeTableOfString::GetRowUnits()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myRows->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(getUnit(myRows->Value(i)));
+ vector<string> aSeq;
+ int aLength = myRows.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(getUnit(myRows[i]));
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfString::SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+void SALOMEDSImpl_AttributeTableOfString::SetRowTitles(const vector<string>& theTitles)
{
- if (theTitles->Length() != GetNbRows()) Standard_Failure::Raise("Invalid number of rows");
- int aLength = theTitles->Length(), i;
- for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles->Value(i));
+ if (theTitles.size() != GetNbRows()) throw DFexception("Invalid number of rows");
+ int aLength = theTitles.size(), i;
+ for(i = 1; i <= aLength; i++) SetRowTitle(i, theTitles[i-1]);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowTitles()
+vector<string> SALOMEDSImpl_AttributeTableOfString::GetRowTitles()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myRows->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(getTitle(myRows->Value(i)));
+ vector<string> aSeq;
+ int aLength = myRows.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(getTitle(myRows[i]));
return aSeq;
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetRowTitle(const Standard_Integer theRow) const
+std::string SALOMEDSImpl_AttributeTableOfString::GetRowTitle(const int theRow) const
{
- return getTitle(myRows->Value(theRow));
+ return getTitle(myRows[theRow-1]);
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetRowUnit(const Standard_Integer theRow) const
+std::string SALOMEDSImpl_AttributeTableOfString::GetRowUnit(const int theRow) const
{
- return getUnit(myRows->Value(theRow));
+ return getUnit(myRows[theRow-1]);
}
-void SALOMEDSImpl_AttributeTableOfString::SetRowData(const Standard_Integer theRow,
- const Handle(TColStd_HSequenceOfExtendedString)& theData)
+void SALOMEDSImpl_AttributeTableOfString::SetRowData(const int theRow,
+ const vector<string>& theData)
{
CheckLocked();
- if(theData->Length() > myNbColumns) SetNbColumns(theData->Length());
+ if(theData.size() > myNbColumns) SetNbColumns(theData.size());
Backup();
- while (myRows->Length() < theRow) { // append new row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < theRow) { // append new row titles
+ myRows.push_back(std::string(""));
}
- Standard_Integer i, aShift = (theRow-1)*myNbColumns, aLength = theData->Length();
+ int i, aShift = (theRow-1)*myNbColumns, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
- myTable.Bind(aShift + i, theData->Value(i));
+ myTable[aShift + i] = theData[i-1];
}
if(theRow > myNbRows) myNbRows = theRow;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-void SALOMEDSImpl_AttributeTableOfString::SetTitle(const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfString::SetTitle(const std::string& theTitle)
{
CheckLocked();
Backup();
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetTitle() const
+std::string SALOMEDSImpl_AttributeTableOfString::GetTitle() const
{
return myTitle;
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetRowData(const Standard_Integer theRow)
+vector<string> SALOMEDSImpl_AttributeTableOfString::GetRowData(const int theRow)
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString();
- Standard_Integer i, aShift = (theRow-1)*myNbColumns;
+ vector<string> aSeq;
+ int i, aShift = (theRow-1)*myNbColumns;
for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift+i))
- aSeq->Append(myTable.Find(aShift+i));
+ if(myTable.find(aShift+i) != myTable.end())
+ aSeq.push_back(myTable[aShift+i]);
else
- aSeq->Append(0.);
+ aSeq.push_back("");
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfString::SetColumnData(const Standard_Integer theColumn,
- const Handle(TColStd_HSequenceOfExtendedString)& theData)
+void SALOMEDSImpl_AttributeTableOfString::SetColumnData(const int theColumn,
+ const vector<string>& theData)
{
CheckLocked();
if(theColumn > myNbColumns) SetNbColumns(theColumn);
Backup();
- Standard_Integer i, aLength = theData->Length();
+ int i, aLength = theData.size();
for(i = 1; i <= aLength; i++) {
- myTable.Bind(myNbColumns*(i-1)+theColumn, theData->Value(i));
+ myTable[myNbColumns*(i-1)+theColumn] = theData[i-1];
}
if(aLength > myNbRows) {
myNbRows = aLength;
- while (myRows->Length() < myNbRows) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < myNbRows) { // append empty row titles
+ myRows.push_back(std::string(""));
}
}
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetColumnData(const Standard_Integer theColumn)
+vector<string> SALOMEDSImpl_AttributeTableOfString::GetColumnData(const int theColumn)
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
+ vector<string> aSeq;
- Standard_Integer i, anIndex;
+ int i, anIndex;
for(i = 1; i <= myNbRows; i++) {
anIndex = myNbColumns*(i-1) + theColumn;
- if(myTable.IsBound(anIndex))
- aSeq->Append(myTable.Find(anIndex));
+ if(myTable.find(anIndex) != myTable.end())
+ aSeq.push_back(myTable[anIndex]);
else
- aSeq->Append(0.);
+ aSeq.push_back("");
}
return aSeq;
}
-void SALOMEDSImpl_AttributeTableOfString::SetColumnTitle(const Standard_Integer theColumn,
- const TCollection_ExtendedString& theTitle)
+void SALOMEDSImpl_AttributeTableOfString::SetColumnTitle(const int theColumn,
+ const std::string& theTitle)
{
CheckLocked();
Backup();
- while(myCols->Length() < theColumn) myCols->Append(TCollection_ExtendedString(""));
- myCols->SetValue(theColumn,theTitle);
+ while(myCols.size() < theColumn) myCols.push_back(std::string(""));
+ myCols[theColumn-1] = theTitle;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetColumnTitle(const Standard_Integer theColumn) const
+std::string SALOMEDSImpl_AttributeTableOfString::GetColumnTitle(const int theColumn) const
{
- if(myCols.IsNull()) return "";
- if(myCols->Length() < theColumn) return "";
- return myCols->Value(theColumn);
+ if(myCols.empty()) return "";
+ if(myCols.size() < theColumn) return "";
+ return myCols[theColumn-1];
}
-void SALOMEDSImpl_AttributeTableOfString::SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles)
+void SALOMEDSImpl_AttributeTableOfString::SetColumnTitles(const vector<string>& theTitles)
{
- if (theTitles->Length() != myNbColumns) Standard_Failure::Raise("Invalid number of columns");
- int aLength = theTitles->Length(), i;
- for(i = 1; i <= aLength; i++) myCols->SetValue(i, theTitles->Value(i));
+ if (theTitles.size() != myNbColumns) throw DFexception("Invalid number of columns");
+ int aLength = theTitles.size(), i;
+ for(i = 0; i < aLength; i++) myCols[i] = theTitles[i];
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Handle(TColStd_HSequenceOfExtendedString) SALOMEDSImpl_AttributeTableOfString::GetColumnTitles()
+vector<string> SALOMEDSImpl_AttributeTableOfString::GetColumnTitles()
{
- Handle(TColStd_HSequenceOfExtendedString) aSeq = new TColStd_HSequenceOfExtendedString;
- int aLength = myCols->Length(), i;
- for(i=1; i<=aLength; i++) aSeq->Append(myCols->Value(i));
+ vector<string> aSeq;
+ int aLength = myCols.size(), i;
+ for(i=0; i<aLength; i++) aSeq.push_back(myCols[i]);
return aSeq;
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfString::GetNbRows() const
+int SALOMEDSImpl_AttributeTableOfString::GetNbRows() const
{
return myNbRows;
}
-Standard_Integer SALOMEDSImpl_AttributeTableOfString::GetNbColumns() const
+int SALOMEDSImpl_AttributeTableOfString::GetNbColumns() const
{
return myNbColumns;
}
-void SALOMEDSImpl_AttributeTableOfString::PutValue(const TCollection_ExtendedString& theValue,
- const Standard_Integer theRow,
- const Standard_Integer theColumn)
+void SALOMEDSImpl_AttributeTableOfString::PutValue(const std::string& theValue,
+ const int theRow,
+ const int theColumn)
{
CheckLocked();
if(theColumn > myNbColumns) SetNbColumns(theColumn);
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- myTable.Bind(anIndex, theValue);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ myTable[anIndex] = theValue;
if(theRow > myNbRows) {
- while (myRows->Length() < theRow) { // append empty row titles
- myRows->Append(TCollection_ExtendedString(""));
+ while (myRows.size() < theRow) { // append empty row titles
+ myRows.push_back(std::string(""));
}
myNbRows = theRow;
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
-Standard_Boolean SALOMEDSImpl_AttributeTableOfString::HasValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
+bool SALOMEDSImpl_AttributeTableOfString::HasValue(const int theRow,
+ const int theColumn)
{
- if(theRow > myNbRows || theRow < 1) return Standard_False;
- if(theColumn > myNbColumns || theColumn < 1) return Standard_False;
+ if(theRow > myNbRows || theRow < 1) return false;
+ if(theColumn > myNbColumns || theColumn < 1) return false;
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- return myTable.IsBound(anIndex);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ return (myTable.find(anIndex) != myTable.end());
}
-TCollection_ExtendedString SALOMEDSImpl_AttributeTableOfString::GetValue(const Standard_Integer theRow,
- const Standard_Integer theColumn)
+std::string SALOMEDSImpl_AttributeTableOfString::GetValue(const int theRow,
+ const int theColumn)
{
- if(theRow > myNbRows || theRow < 1) Standard_Failure::Raise("Invalid cell index");
- if(theColumn > myNbColumns || theColumn < 1) Standard_Failure::Raise("Invalid cell index");
+ if(theRow > myNbRows || theRow < 1) throw DFexception("Invalid cell index");
+ if(theColumn > myNbColumns || theColumn < 1) throw DFexception("Invalid cell index");
- Standard_Integer anIndex = (theRow-1)*myNbColumns + theColumn;
- if(myTable.IsBound(anIndex)) return myTable.Find(anIndex);
+ int anIndex = (theRow-1)*myNbColumns + theColumn;
+ if(myTable.find(anIndex) != myTable.end()) return myTable[anIndex];
- Standard_Failure::Raise("Invalid cell index");
- return 0.;
+ throw DFexception("Invalid cell index");
+ return "";
}
-const Standard_GUID& SALOMEDSImpl_AttributeTableOfString::ID() const
+const std::string& SALOMEDSImpl_AttributeTableOfString::ID() const
{
return GetID();
}
-void SALOMEDSImpl_AttributeTableOfString::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeTableOfString::Restore(DF_Attribute* with)
{
- Standard_Integer anIndex;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(with);
+ int anIndex;
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(with);
- myTable.Clear();
- myCols->Clear();
- myRows->Clear();
+ myTable.clear();
+ myCols.clear();
+ myRows.clear();
myTable = aTable->myTable;
myNbRows = aTable->myNbRows;
myTitle = aTable->myTitle;
for(anIndex = 1; anIndex <= aTable->GetNbRows();anIndex++)
- myRows->Append(aTable->GetRowTitle(anIndex));
+ myRows.push_back(aTable->GetRowTitle(anIndex));
for(anIndex = 1; anIndex <= aTable->GetNbColumns(); anIndex++)
- myCols->Append(aTable->GetColumnTitle(anIndex));
+ myCols.push_back(aTable->GetColumnTitle(anIndex));
}
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTableOfString::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributeTableOfString::NewEmpty() const
{
return new SALOMEDSImpl_AttributeTableOfString();
}
-void SALOMEDSImpl_AttributeTableOfString::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)&) const
+void SALOMEDSImpl_AttributeTableOfString::Paste(DF_Attribute* into)
{
- Standard_Integer anIndex;
- Handle(SALOMEDSImpl_AttributeTableOfString) aTable = Handle(SALOMEDSImpl_AttributeTableOfString)::DownCast(into);
+ int anIndex;
+ SALOMEDSImpl_AttributeTableOfString* aTable = dynamic_cast<SALOMEDSImpl_AttributeTableOfString*>(into);
- aTable->myTable.Clear();
- aTable->myCols->Clear();
- aTable->myRows->Clear();
+ aTable->myTable.clear();
+ aTable->myCols.clear();
+ aTable->myRows.clear();
aTable->myTable = myTable;
aTable->myTitle = myTitle;
aTable->myNbColumns = myNbColumns;
for(anIndex = 1; anIndex <= GetNbRows();anIndex++)
- aTable->myRows->Append(GetRowTitle(anIndex));
+ aTable->myRows.push_back(GetRowTitle(anIndex));
for(anIndex = 1; anIndex <= GetNbColumns(); anIndex++)
- aTable->myCols->Append(GetColumnTitle(anIndex));
+ aTable->myCols.push_back(GetColumnTitle(anIndex));
}
-Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfString::GetSetRowIndices(const Standard_Integer theRow)
+vector<int> SALOMEDSImpl_AttributeTableOfString::GetSetRowIndices(const int theRow)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ vector<int> aSeq;
- Standard_Integer i, aShift = myNbColumns*(theRow-1);
+ int i, aShift = myNbColumns*(theRow-1);
for(i = 1; i <= myNbColumns; i++) {
- if(myTable.IsBound(aShift + i)) aSeq->Append(i);
+ if(myTable.find(aShift + i) != myTable.end()) aSeq.push_back(i);
}
return aSeq;
}
-Handle_TColStd_HSequenceOfInteger SALOMEDSImpl_AttributeTableOfString::GetSetColumnIndices(const Standard_Integer theColumn)
+vector<int> SALOMEDSImpl_AttributeTableOfString::GetSetColumnIndices(const int theColumn)
{
- Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ vector<int> aSeq;
- Standard_Integer i, anIndex;
+ int i, anIndex;
for(i = 1; i <= myNbRows; i++) {
anIndex = myNbColumns*(i-1)+theColumn;
- if(myTable.IsBound(anIndex)) aSeq->Append(i);
+ if(myTable.find(anIndex) != myTable.end()) aSeq.push_back(i);
}
return aSeq;
-void SALOMEDSImpl_AttributeTableOfString::ConvertToString(ostrstream& theStream)
+string SALOMEDSImpl_AttributeTableOfString::Save()
{
+ ostrstream theStream;
int i, j, l;
//Title
- l = myTitle.Length();
+ l = myTitle.size();
theStream << l << "\n";
- for(i=1; i<=l; i++)
- theStream << myTitle.Value(i) << "\n";
+ for(i=0; i<l; i++)
+ theStream << myTitle[i] << "\n";
//Nb rows
theStream << myNbRows << "\n";
//Rows titles
- for(i=1; i<=myNbRows; i++) {
- l = myRows->Value(i).Length();
+ for(i=0; i<myNbRows; i++) {
+ l = myRows[i].size();
theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myRows->Value(i).Value(j) << "\n";
+ for(j=0; j<l; j++)
+ theStream << myRows[i][j] << "\n";
}
//Nb columns
theStream << myNbColumns << "\n";
//Columns titles
- for(i=1; i<=myNbColumns; i++) {
- l = myCols->Value(i).Length();
+ for(i=0; i<myNbColumns; i++) {
+ l = myCols[i].size();
theStream << l << "\n";
- for(j=1; j<=l; j++)
- theStream << myCols->Value(i).Value(j) << "\n";
+ for(j=0; j<l; j++)
+ theStream << myCols[i][j] << "\n";
}
//Store the table values
- l = myTable.Extent();
+ l = myTable.size();
theStream << l << "\n";
- DataMapIterator anIterator(myTable);
- for(; anIterator.More(); anIterator.Next()) {
- if (anIterator.Value().Length()) { // check empty string in the value table
- theStream << anIterator.Key() << "\n";
- unsigned long aValueSize = anIterator.Value().Length();
+ for(MI p = myTable.begin(); p!=myTable.end(); p++) {
+ if (p->second.size()) { // check empty string in the value table
+ theStream << p->first << "\n";
+ unsigned long aValueSize = p->second.size();
theStream<<aValueSize << "\n";
- theStream.write((TCollection_AsciiString(anIterator.Value()).ToCString()),aValueSize);
+ theStream.write(p->second.c_str(),aValueSize);
theStream<<"\n";
} else { // write index only of kind: "0key"; "05", for an example
- theStream << "0" << anIterator.Key() << "\n";
+ theStream << "0" << p->first << "\n";
}
}
- return;
+ string aString((char*)theStream.rdbuf()->str());
+ return aString;
}
-bool SALOMEDSImpl_AttributeTableOfString::RestoreFromString(istrstream& theStream)
+void SALOMEDSImpl_AttributeTableOfString::Load(const string& value)
{
+ istrstream theStream(value.c_str(), strlen(value.c_str()));
Backup();
theStream.seekg(0, ios::end);
int i, j, l;
char *aValueString = new char[aSize];
- Standard_ExtCharacter anExtChar;
- TCollection_ExtendedString aStr;
+ char anExtChar;
+ std::string aStr;
//Title
theStream >> l;
- myTitle = TCollection_ExtendedString(l, 0);
- for(i=1; i<=l; i++) {
+ myTitle = std::string(l, 0);
+ for(i=0; i<l; i++) {
theStream >> anExtChar;
- myTitle.SetValue(i, anExtChar);
+ myTitle[i] = anExtChar;
}
//Nb rows
theStream >> myNbRows;
//Rows titles
- myRows->Clear();
- for(i=1; i<=myNbRows; i++) {
+ myRows.clear();
+ for(i=0; i<myNbRows; i++) {
theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
+ aStr = std::string(l,0);
+ for(j=0; j<l; j++) {
theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
+ aStr[j] = anExtChar;
}
- myRows->Append(aStr);
+ myRows.push_back(aStr);
}
//Nb columns
theStream >> myNbColumns;
//Columns titles
- myCols->Clear();
- for(i=1; i<=myNbColumns; i++) {
+ myCols.clear();
+ for(i=0; i<myNbColumns; i++) {
theStream >> l;
- aStr = TCollection_ExtendedString(l,0);
- for(j=1; j<=l; j++) {
+ aStr = std::string(l,0);
+ for(j=0; j<l; j++) {
theStream >> anExtChar;
- aStr.SetValue(j, anExtChar);
+ aStr[j] = anExtChar;
}
- myCols->Append(aStr);
+ myCols.push_back(aStr);
}
//Restore the table values
- TCollection_AsciiString aValue;
+ string aValue;
theStream >> l;
- myTable.Clear();
+ myTable.clear();
theStream.getline(aValueString,aSize,'\n');
for(i=1; i<=l; i++) {
- Standard_Integer aKey;
+ int aKey;
theStream.getline(aValueString,aSize,'\n');
aValue = aValueString;
- aKey = aValue.IntegerValue();
- if (aValue.Value(1) == '0')
+ aKey = atoi(aValue.c_str());
+ if (aValue[0] == '0')
aValue = "";
else {
unsigned long aValueSize;
theStream.read(aValueString, 1); // an '\n' omitting
aValue = aValueString;
}
- myTable.Bind(aKey, aValue);
+ myTable[aKey] = aValue;
}
delete(aValueString);
- return true;
-}
-
-TCollection_AsciiString SALOMEDSImpl_AttributeTableOfString::Save()
-{
- ostrstream ostr;
- ConvertToString(ostr);
- TCollection_AsciiString aString((char*)ostr.rdbuf()->str());
- return aString;
-}
-
-void SALOMEDSImpl_AttributeTableOfString::Load(const TCollection_AsciiString& value)
-{
- istrstream aStream(value.ToCString(), strlen(value.ToCString()));
- RestoreFromString(aStream);
}
#ifndef _SALOMEDSImpl_AttributeTableOfString_HeaderFile
#define _SALOMEDSImpl_AttributeTableOfString_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <Standard.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_Attribute.hxx>
+#include "DF_Label.hxx"
+#include "DF_Attribute.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTableOfString, SALOMEDSImpl_GenericAttribute )
-
-#include <TColStd_SequenceOfTransient.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <NCollection_DataMap.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <strstream>
-
-typedef NCollection_DataMap <Standard_Integer, TCollection_ExtendedString> DataMapOfIntegerString;
+#include <string>
+#include <vector>
+#include <map>
class SALOMEDSImpl_AttributeTableOfString : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTableOfString Set(const TDF_Label& label) ;
+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 Standard_Integer theNbColumns);
-Standard_EXPORT void SetTitle(const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetTitle() const;
-Standard_EXPORT void SetRowData(const Standard_Integer theRow,const Handle(TColStd_HSequenceOfExtendedString)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetRowData(const Standard_Integer theRow) ;
-Standard_EXPORT void SetRowTitle(const Standard_Integer theRow,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT void SetRowUnit(const Standard_Integer theRow,const TCollection_ExtendedString& theUnit) ;
-Standard_EXPORT TCollection_ExtendedString GetRowUnit(const Standard_Integer theRow) const;
-Standard_EXPORT void SetRowUnits(const Handle(TColStd_HSequenceOfExtendedString)& theUnits) ;
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowUnits();
-Standard_EXPORT void SetRowTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles) ;
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetRowTitles();
-Standard_EXPORT TCollection_ExtendedString GetRowTitle(const Standard_Integer theRow) const;
-Standard_EXPORT void SetColumnData(const Standard_Integer theColumn,const Handle(TColStd_HSequenceOfExtendedString)& theData) ;
-Standard_EXPORT Handle_TColStd_HSequenceOfExtendedString GetColumnData(const Standard_Integer theColumn) ;
-Standard_EXPORT void SetColumnTitle(const Standard_Integer theColumn,const TCollection_ExtendedString& theTitle) ;
-Standard_EXPORT TCollection_ExtendedString GetColumnTitle(const Standard_Integer theColumn) const;
-Standard_EXPORT void SetColumnTitles(const Handle(TColStd_HSequenceOfExtendedString)& theTitles);
-Standard_EXPORT Handle(TColStd_HSequenceOfExtendedString) GetColumnTitles();
-Standard_EXPORT Standard_Integer GetNbRows() const;
-Standard_EXPORT Standard_Integer GetNbColumns() const;
-
-Standard_EXPORT void PutValue(const TCollection_ExtendedString& theValue,const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT Standard_Boolean HasValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT TCollection_ExtendedString GetValue(const Standard_Integer theRow,const Standard_Integer theColumn) ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetRowIndices(const Standard_Integer theRow);
-Standard_EXPORT Handle_TColStd_HSequenceOfInteger GetSetColumnIndices(const Standard_Integer theColumn);
-
-Standard_EXPORT void ConvertToString(ostrstream& theStream);
-Standard_EXPORT bool RestoreFromString(istrstream& theStream);
+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;
+
+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);
+
+Standard_EXPORT std::vector<int> GetSetRowIndices(const int theRow);
+Standard_EXPORT std::vector<int> GetSetColumnIndices(const int theColumn);
Standard_EXPORT ~SALOMEDSImpl_AttributeTableOfString() {}
private:
-DataMapOfIntegerString myTable;
-TCollection_ExtendedString myTitle;
-Handle_TColStd_HSequenceOfExtendedString myRows;
-Handle_TColStd_HSequenceOfExtendedString myCols;
-Standard_Integer myNbRows;
-Standard_Integer myNbColumns;
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTableOfString )
+std::map<int, std::string> myTable;
+std::string myTitle;
+std::vector<std::string> myRows;
+std::vector<std::string> myCols;
+int myNbRows;
+int myNbColumns;
};
#include "SALOMEDSImpl_AttributeTarget.hxx"
#include "SALOMEDSImpl_AttributeReference.hxx"
#include "SALOMEDSImpl_Study.hxx"
-#include <TDF_RelocationTable.hxx>
-#include <TDF_ListIteratorOfAttributeList.hxx>
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTarget, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTarget, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTarget::GetID ()
+const std::string& SALOMEDSImpl_AttributeTarget::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeTargetID ("12837197-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeTargetID ("12837197-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeTargetID;
}
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_AttributeTarget) SALOMEDSImpl_AttributeTarget::Set (const TDF_Label& L)
+SALOMEDSImpl_AttributeTarget* SALOMEDSImpl_AttributeTarget::Set (const DF_Label& L)
{
- Handle(SALOMEDSImpl_AttributeTarget) A;
- if (!L.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),A)) {
+ SALOMEDSImpl_AttributeTarget* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeTarget*)L.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) {
A = new SALOMEDSImpl_AttributeTarget();
L.AddAttribute(A);
}
{
}
-void SALOMEDSImpl_AttributeTarget::SetRelation(const TCollection_ExtendedString& theRelation)
+void SALOMEDSImpl_AttributeTarget::SetRelation(const std::string& theRelation)
{
CheckLocked();
if(myRelation == theRelation) return;
//function : Add
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTarget::Add(const Handle(SALOMEDSImpl_SObject)& theSO)
+void SALOMEDSImpl_AttributeTarget::Add(const SALOMEDSImpl_SObject& theSO)
{
Backup();
- TDF_Label aRefLabel = theSO->GetLabel();
- Handle(SALOMEDSImpl_AttributeReference) aReference;
- if (aRefLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(),aReference)) {
- TDF_ListIteratorOfAttributeList anIter(GetVariables());
- for(;anIter.More();anIter.Next()) if(anIter.Value()->Label() == aRefLabel) return; //BugID: PAL6192
- GetVariables().Append(aReference);
+ DF_Label aRefLabel = theSO.GetLabel();
+ SALOMEDSImpl_AttributeReference* aReference;
+ if ((aReference=(SALOMEDSImpl_AttributeReference*)aRefLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
+ for(int i = 0, len = myVariables.size(); i<len; i++) if(myVariables[i]->Label() == aRefLabel) return; //BugID: PAL6192
+ myVariables.push_back(aReference);
}
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
//function : Get
//purpose :
//=======================================================================
-Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_AttributeTarget::Get()
+vector<SALOMEDSImpl_SObject> SALOMEDSImpl_AttributeTarget::Get()
{
- Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+ vector<SALOMEDSImpl_SObject> aSeq;
+
+ for(int i = 0, len = myVariables.size(); i<len; i++)
+ aSeq.push_back( SALOMEDSImpl_Study::SObject(myVariables[i]->Label()));
- TDF_ListIteratorOfAttributeList anIter(GetVariables());
- for(;anIter.More();anIter.Next()) {
- const TDF_Label& aLabel = anIter.Value()->Label();
- aSeq->Append( SALOMEDSImpl_Study::SObject(aLabel));
- }
return aSeq;
}
//function : Remove
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTarget::Remove(const Handle(SALOMEDSImpl_SObject)& theSO)
+void SALOMEDSImpl_AttributeTarget::Remove(const SALOMEDSImpl_SObject& theSO)
{
Backup();
- TDF_Label aRefLabel = theSO->GetLabel();
- TDF_ListIteratorOfAttributeList anIter(GetVariables());
- for(;anIter.More();anIter.Next()) {
- if (anIter.Value()->Label() == aRefLabel) {
- GetVariables().Remove(anIter);
- return;
- }
- }
+ DF_Label aRefLabel = theSO.GetLabel();
+
+ vector<DF_Attribute*> va;
+ for(int i = 0, len = myVariables.size(); i<len; i++) {
+ DF_Label L = myVariables[i]->Label();
+ if(myVariables[i]->Label() == aRefLabel) continue;
+ va.push_back(myVariables[i]);
+ }
+
+ myVariables.clear();
+ myVariables = va;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTarget::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeTarget::ID () const { return GetID(); }
//=======================================================================
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTarget::Restore(const Handle(TDF_Attribute)& With)
+void SALOMEDSImpl_AttributeTarget::Restore(DF_Attribute* With)
{
- Handle(SALOMEDSImpl_AttributeTarget) REL = Handle(SALOMEDSImpl_AttributeTarget)::DownCast (With);
+ SALOMEDSImpl_AttributeTarget* REL = dynamic_cast<SALOMEDSImpl_AttributeTarget*>(With);
myRelation = REL->GetRelation();
- Handle(SALOMEDSImpl_AttributeReference) V;
- myVariables.Clear();
- for (TDF_ListIteratorOfAttributeList it (REL->GetVariables()); it.More(); it.Next()) {
- V = Handle(SALOMEDSImpl_AttributeReference)::DownCast(it.Value());
- myVariables.Append(V);
+ myVariables.clear();
+ for (int i = 0, len = REL->myVariables.size(); i<len; i++) {
+ myVariables.push_back(REL->myVariables[i]);
}
}
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTarget::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributeTarget::NewEmpty() const
{
return new SALOMEDSImpl_AttributeTarget();
}
//function : Paste
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTarget::Paste(const Handle(TDF_Attribute)& Into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeTarget::Paste(DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeTarget) REL = Handle(SALOMEDSImpl_AttributeTarget)::DownCast (Into);
+ SALOMEDSImpl_AttributeTarget* REL = dynamic_cast<SALOMEDSImpl_AttributeTarget*>(into);
REL->SetRelation(myRelation);
- Handle(SALOMEDSImpl_AttributeReference) V1,V2;
- for (TDF_ListIteratorOfAttributeList it (myVariables); it.More(); it.Next()) {
- V1 = Handle(SALOMEDSImpl_AttributeReference)::DownCast(it.Value());
- RT->HasRelocation (V1,V2);
- REL->GetVariables().Append(V2);
- }
+ REL->myVariables.clear();
+ for (int i = 0, len = myVariables.size(); i<len; i++) {
+ REL->myVariables.push_back(myVariables[i]);
+ }
}
#ifndef _SALOMEDSImpl_AttributeTarget_HeaderFile
#define _SALOMEDSImpl_AttributeTarget_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_LabelList.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_AttributeList.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
#include "SALOMEDSImpl_SObject.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTarget, SALOMEDSImpl_GenericAttribute )
-
-
class SALOMEDSImpl_AttributeTarget : public SALOMEDSImpl_GenericAttribute
{
private:
-TCollection_ExtendedString myRelation;
-TDF_AttributeList myVariables;
+std::string myRelation;
+std::vector<DF_Attribute*> myVariables;
public:
-Standard_EXPORT static const Standard_GUID& GetID() ;
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTarget Set(const TDF_Label& label) ;
+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 Handle(SALOMEDSImpl_SObject)& theSO);
-Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Get();
-Standard_EXPORT void Remove(const Handle(SALOMEDSImpl_SObject)& theSO);
-Standard_EXPORT TCollection_ExtendedString GetRelation() { return myRelation; }
-Standard_EXPORT void SetRelation(const TCollection_ExtendedString& theRelation);
-Standard_EXPORT TDF_AttributeList& GetVariables() { return myVariables; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTarget )
-
};
#endif
#include "SALOMEDSImpl_AttributeTextColor.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextColor, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTextColor, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTextColor::GetID ()
+const std::string& SALOMEDSImpl_AttributeTextColor::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeTextColorID ("12837189-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeTextColorID ("12837189-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeTextColorID;
}
SALOMEDSImpl_AttributeTextColor::SALOMEDSImpl_AttributeTextColor()
:SALOMEDSImpl_GenericAttribute("AttributeTextColor")
{
- myValue = new TColStd_HArray1OfReal(1, 3, 0.);
+ myValue.clear();
+ myValue.push_back(0.);
+ myValue.push_back(0.);
+ myValue.push_back(0.);
}
//=======================================================================
//function : SetTextColor
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextColor::SetTextColor(const Standard_Real R, const Standard_Real G, const Standard_Real B)
+void SALOMEDSImpl_AttributeTextColor::SetTextColor(const double& R, const double& G, const double& B)
{
CheckLocked();
- if(myValue.IsNull()) return;
+
Backup();
- myValue->SetValue(1, R);
- myValue->SetValue(2, G);
- myValue->SetValue(3, B);
+ myValue[0] = R;
+ myValue[1] = G;
+ myValue[2] = B;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//function : TextColor
//purpose :
//=======================================================================
-Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextColor::TextColor()
+vector<double> SALOMEDSImpl_AttributeTextColor::TextColor()
{
return myValue;
}
//function : ChangeArray
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextColor::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray)
+void SALOMEDSImpl_AttributeTextColor::ChangeArray(const vector<double>& newArray)
{
Backup();
- for(int i = 1; i <= 3; i++)
- myValue->SetValue(i, newArray->Value(i));
+ for(int i = 0; i < 3; i++)
+ myValue[i] = newArray[i];
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTextColor::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeTextColor::ID () const { return GetID(); }
//=======================================================================
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextColor::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeTextColor::NewEmpty () const
{
return new SALOMEDSImpl_AttributeTextColor();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextColor::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeTextColor::Restore(DF_Attribute* with)
{
- Handle(TColStd_HArray1OfReal) s = Handle(SALOMEDSImpl_AttributeTextColor)::DownCast (with)->TextColor ();
- ChangeArray(s);
+ ChangeArray( dynamic_cast<SALOMEDSImpl_AttributeTextColor*>(with)->TextColor ());
return;
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextColor::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeTextColor::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeTextColor)::DownCast (into)->ChangeArray (myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeTextColor*>(into)->ChangeArray (myValue);
}
-TCollection_AsciiString SALOMEDSImpl_AttributeTextColor::Save()
+string SALOMEDSImpl_AttributeTextColor::Save()
{
char *Val = new char[75];
- sprintf(Val, "%f %f %f", (float)myValue->Value(1),
- (float)myValue->Value(2),
- (float)myValue->Value(3));
- TCollection_AsciiString ret(Val);
+ sprintf(Val, "%f %f %f", (float)myValue[0],
+ (float)myValue[1],
+ (float)myValue[2]);
+ string ret(Val);
delete Val;
return ret;
}
-void SALOMEDSImpl_AttributeTextColor::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeTextColor::Load(const string& value)
{
float r, g, b;
- sscanf(value.ToCString(), "%f %f %f", &r, &g, &b);
- myValue->SetValue(1, r);
- myValue->SetValue(2, g);
- myValue->SetValue(3, b);
+ sscanf(value.c_str(), "%f %f %f", &r, &g, &b);
+ myValue[0] = r;
+ myValue[1] = g;
+ myValue[2] = b;
}
#ifndef _SALOMEDSImpl_AttributeTextColor_HeaderFile
#define _SALOMEDSImpl_AttributeTextColor_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TColStd_HArray1OfReal.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
+#include <vector>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextColor, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeTextColor : public SALOMEDSImpl_GenericAttribute
{
private:
- Handle(TColStd_HArray1OfReal) myValue;
+ std::vector<double> myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
+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 Standard_GUID& ID() const;
-Standard_EXPORT void SetTextColor(const Standard_Real R, const Standard_Real G, const Standard_Real B);
-Standard_EXPORT Handle(TColStd_HArray1OfReal) TextColor();
-Standard_EXPORT void ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray);
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTextColor )
};
#endif
#include "SALOMEDSImpl_AttributeTextHighlightColor.hxx"
-#include <Standard_GUID.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextHighlightColor, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTextHighlightColor, SALOMEDSImpl_GenericAttribute )
-
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTextHighlightColor::GetID ()
+const std::string& SALOMEDSImpl_AttributeTextHighlightColor::GetID ()
{
- static Standard_GUID SALOMEDSImpl_AttributeTextHighlightColorID ("12837190-8F52-11d6-A8A3-0001021E8C7F");
+ static std::string SALOMEDSImpl_AttributeTextHighlightColorID ("12837190-8F52-11d6-A8A3-0001021E8C7F");
return SALOMEDSImpl_AttributeTextHighlightColorID;
}
SALOMEDSImpl_AttributeTextHighlightColor::SALOMEDSImpl_AttributeTextHighlightColor()
:SALOMEDSImpl_GenericAttribute("AttributeTextHighlightColor")
{
- myValue = new TColStd_HArray1OfReal(1, 3, 0.);
+ myValue.clear();
+ myValue.push_back(0.0);
+ myValue.push_back(0.0);
+ myValue.push_back(0.0);
}
//=======================================================================
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTextHighlightColor::ID () const { return GetID(); }
+const std::string& SALOMEDSImpl_AttributeTextHighlightColor::ID () const { return GetID(); }
//=======================================================================
//function : SetTextHighlightColor
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextHighlightColor::SetTextHighlightColor(const Standard_Real R,
- const Standard_Real G,
- const Standard_Real B)
+void SALOMEDSImpl_AttributeTextHighlightColor::SetTextHighlightColor(const double& R,
+ const double& G,
+ const double& B)
{
CheckLocked();
- if(myValue.IsNull()) return;
Backup();
- myValue->SetValue(1, R);
- myValue->SetValue(2, G);
- myValue->SetValue(3, B);
+ myValue[0] = R;
+ myValue[1] = G;
+ myValue[2] = B;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//function : TextHighlightColor
//purpose :
//=======================================================================
-Handle(TColStd_HArray1OfReal) SALOMEDSImpl_AttributeTextHighlightColor::TextHighlightColor()
+vector<double> SALOMEDSImpl_AttributeTextHighlightColor::TextHighlightColor()
{
return myValue;
}
//function : ChangeArray
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray)
+void SALOMEDSImpl_AttributeTextHighlightColor::ChangeArray(const vector<double>& newArray)
{
Backup();
- for(int i = 1; i <= 3; i++)
- myValue->SetValue(i, newArray->Value(i));
+ for(int i = 0; i < 3; i++)
+ myValue[i] = newArray[i];
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeTextHighlightColor::NewEmpty () const
{
return new SALOMEDSImpl_AttributeTextHighlightColor();
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextHighlightColor::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeTextHighlightColor::Restore(DF_Attribute* with)
{
- Handle(TColStd_HArray1OfReal) s = Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast (with)->TextHighlightColor ();
- ChangeArray(s);
+ ChangeArray(dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(with)->TextHighlightColor());;
return;
}
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTextHighlightColor::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& ) const
+void SALOMEDSImpl_AttributeTextHighlightColor::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeTextHighlightColor)::DownCast (into)->ChangeArray (myValue);
+ dynamic_cast<SALOMEDSImpl_AttributeTextHighlightColor*>(into)->ChangeArray (myValue);
}
-TCollection_AsciiString SALOMEDSImpl_AttributeTextHighlightColor::Save()
+string SALOMEDSImpl_AttributeTextHighlightColor::Save()
{
char *Val = new char[75];
- sprintf(Val, "%f %f %f", (float)myValue->Value(1),
- (float)myValue->Value(2),
- (float)myValue->Value(3));
- TCollection_AsciiString ret(Val);
+ sprintf(Val, "%f %f %f", (float)myValue[0],
+ (float)myValue[1],
+ (float)myValue[2]);
+ string ret(Val);
delete Val;
return ret;
}
-void SALOMEDSImpl_AttributeTextHighlightColor::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeTextHighlightColor::Load(const string& value)
{
float r, g, b;
- sscanf(value.ToCString(), "%f %f %f", &r, &g, &b);
- myValue->SetValue(1, r);
- myValue->SetValue(2, g);
- myValue->SetValue(3, b);
+ sscanf(value.c_str(), "%f %f %f", &r, &g, &b);
+ myValue[0] = r;
+ myValue[1] = g;
+ myValue[2] = b;
}
#ifndef _SALOMEDSImpl_AttributeTextHighlightColor_HeaderFile
#define _SALOMEDSImpl_AttributeTextHighlightColor_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TColStd_HArray1OfReal.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
+#include <vector>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTextHighlightColor, SALOMEDSImpl_GenericAttribute )
class SALOMEDSImpl_AttributeTextHighlightColor : public SALOMEDSImpl_GenericAttribute
{
private:
- Handle(TColStd_HArray1OfReal) myValue;
+ std::vector<double> myValue;
public:
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-Standard_EXPORT static const Standard_GUID& GetID() ;
+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 Standard_Real R, const Standard_Real G, const Standard_Real B);
-Standard_EXPORT Handle(TColStd_HArray1OfReal) TextHighlightColor();
-Standard_EXPORT void ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray);
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
+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() {}
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeTextHighlightColor )
};
#endif
#include "SALOMEDSImpl_AttributeTreeNode.hxx"
-#include <Standard_DomainError.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_DataSet.hxx>
-#include <TDF_RelocationTable.hxx>
-#include <TCollection_AsciiString.hxx>
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute )
-
-static char* Entry(const TDF_Label& theLabel)
+const std::string& SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID()
{
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theLabel, anEntry);
- return anEntry.ToCString();
-}
-
-const Standard_GUID& SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID()
-{
- static Standard_GUID TreeNodeID ("0E1C36E6-379B-4d90-AC37-17A14310E648");
+ static std::string TreeNodeID ("0E1C36E6-379B-4d90-AC37-17A14310E648");
return TreeNodeID;
}
{}
-Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Set (const TDF_Label& L, const Standard_GUID& ID)
+SALOMEDSImpl_AttributeTreeNode* SALOMEDSImpl_AttributeTreeNode::Set (const DF_Label& L, const std::string& ID)
{
- Handle(SALOMEDSImpl_AttributeTreeNode) TN;
+ SALOMEDSImpl_AttributeTreeNode* TN = NULL;
- if (!L.FindAttribute(ID,TN)) {
+ if (!(TN=(SALOMEDSImpl_AttributeTreeNode*)L.FindAttribute(ID))) {
TN = new SALOMEDSImpl_AttributeTreeNode ();
TN->SetTreeID(ID);
L.AddAttribute(TN);
//TreeNode : ID
//purpose : Returns GUID of the TreeNode
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeTreeNode::ID() const
+const std::string& SALOMEDSImpl_AttributeTreeNode::ID() const
{
return myTreeID;
}
//function : Append
//purpose : Add <TN> as last child of me
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Append (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN)
+bool SALOMEDSImpl_AttributeTreeNode::Append (SALOMEDSImpl_AttributeTreeNode* TN)
{
CheckLocked();
- if (!(TN->ID() == myTreeID) )
- Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Append : uncompatible GUID");
+ if (!(TN->ID() == myTreeID)) throw DFexception("SALOMEDSImpl_AttributeTreeNode::Append : uncompatible GUID");
- if(TN->Label() == Label())
- Standard_Failure::Raise("Attempt of self linking");
+ if(TN->Label() == Label()) throw DFexception("Attempt of self linking");
- Handle(SALOMEDSImpl_AttributeTreeNode) bid;
- TN->SetNext(bid); // Deconnects from next.
+ TN->SetNext(NULL); // Deconnects from next.
// Find the last
if (!HasFirst()) {
SetFirst(TN);
- TN->SetPrevious(bid); // Deconnects from previous.
+ TN->SetPrevious(NULL); // Deconnects from previous.
}
else {
- Handle(SALOMEDSImpl_AttributeTreeNode) Last = GetFirst();
- while (Last->HasNext()) {
+ SALOMEDSImpl_AttributeTreeNode* Last = GetFirst();
+ while (Last && Last->HasNext()) {
Last = Last->GetNext();
}
Last->SetNext(TN);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
- return !TN.IsNull();
+ return (TN);
}
//=======================================================================
//function : Prepend
//purpose : Add <TN> as first child of me
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Prepend (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN)
+bool SALOMEDSImpl_AttributeTreeNode::Prepend (SALOMEDSImpl_AttributeTreeNode* TN)
{
CheckLocked();
- if (!(TN->ID() == myTreeID) )
- Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::Prepend : uncompatible GUID");
+ if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::Prepend : uncompatible GUID");
- if(TN->Label() == Label())
- Standard_Failure::Raise("Attempt of self linking");
+ if(TN->Label() == Label()) throw DFexception("Attempt of self linking");
- Handle(SALOMEDSImpl_AttributeTreeNode) bid;
- TN->SetPrevious(bid);
+ TN->SetPrevious(NULL);
if (HasFirst()) {
TN->SetNext(GetFirst());
GetFirst()->SetPrevious(TN);
}
else {
- TN->SetNext(bid);
+ TN->SetNext(NULL);
}
TN->SetFather(this);
SetFirst(TN);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
- return !TN.IsNull();
+ return (TN);
}
//function : InsertBefore
//purpose : Inserts the TreeNode <TN> before me
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertBefore (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN)
+bool SALOMEDSImpl_AttributeTreeNode::InsertBefore (SALOMEDSImpl_AttributeTreeNode* TN)
{
CheckLocked();
- if (!(TN->ID() == myTreeID) )
- Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertBefore : uncompatible GUID");
+ if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::InsertBefore : uncompatible GUID");
- if(TN->Label() == Label())
- Standard_Failure::Raise("Attempt of self linking");
+ if(TN->Label() == Label()) throw DFexception("Attempt of self linking");
TN->SetFather(GetFather());
TN->SetPrevious(GetPrevious());
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
- return !TN.IsNull();
+ return (TN);
}
//=======================================================================
//function : InsertAfter
//purpose : Inserts the TreeNode <TN> after me
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::InsertAfter (const Handle(SALOMEDSImpl_AttributeTreeNode)& TN)
+bool SALOMEDSImpl_AttributeTreeNode::InsertAfter (SALOMEDSImpl_AttributeTreeNode* TN)
{
CheckLocked();
- if(TN->Label() == Label())
- Standard_Failure::Raise("Attempt of self linking");
+ if(TN->Label() == Label()) throw DFexception("Attempt of self linking");
- if (!(TN->ID() == myTreeID) )
- Standard_DomainError::Raise("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID");
+ if (!(TN->ID() == myTreeID) ) throw DFexception("SALOMEDSImpl_AttributeTreeNode::InsertAfter : uncompatible GUID");
TN->SetFather(GetFather());
TN->SetPrevious(this);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
- return !TN.IsNull();
+ return (TN);
}
//=======================================================================
//function : Remove
//purpose : Removees the function from the function tree
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::Remove ()
+bool SALOMEDSImpl_AttributeTreeNode::Remove ()
{
CheckLocked();
- if (IsRoot()) return Standard_True;
+ if (IsRoot()) return true;
- Handle(SALOMEDSImpl_AttributeTreeNode) bid;
if (!HasPrevious())
GetFather()->SetFirst(GetNext());
else
if (HasNext()) {
if (HasPrevious()) GetNext()->SetPrevious(GetPrevious());
- else GetNext()->SetPrevious(bid);
+ else GetNext()->SetPrevious(NULL);
}
else {
- if (HasPrevious()) GetPrevious()->SetNext(bid);
+ if (HasPrevious()) GetPrevious()->SetNext(NULL);
}
if (GetFather()->HasFirst()) {
- if (Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(this) == GetFather()->GetFirst()) {
+ if (this == GetFather()->GetFirst()) {
if (HasNext()) {
GetFather()->SetFirst(GetNext());
}
- else GetFather()->SetFirst(bid);
+ else GetFather()->SetFirst(NULL);
}
}
- SetFather(bid);
- SetNext(bid);
- SetPrevious(bid);
+ SetFather(NULL);
+ SetNext(NULL);
+ SetPrevious(NULL);
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
- return Standard_True;
+ return true;
}
//=======================================================================
//function : Depth
//purpose :
//=======================================================================
-Standard_Integer SALOMEDSImpl_AttributeTreeNode::Depth () const
+int SALOMEDSImpl_AttributeTreeNode::Depth () const
{
- Standard_Integer depth = 0;
- Handle(SALOMEDSImpl_AttributeTreeNode) current = this;
- while (current->HasFather()) {
+ int depth = 0;
+ SALOMEDSImpl_AttributeTreeNode* current = (SALOMEDSImpl_AttributeTreeNode*)this;
+ while (current) {
depth++;
current = current->GetFather();
}
//purpose : Finds or creates a TreeNode attribute with explicit ID
// : a driver for it
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::SetTreeID (const Standard_GUID& explicitID)
+void SALOMEDSImpl_AttributeTreeNode::SetTreeID (const std::string& explicitID)
{
myTreeID = explicitID;
//function : IsAscendant
//purpose :
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsAscendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const
+bool SALOMEDSImpl_AttributeTreeNode::IsAscendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const
{
return ofTN->IsDescendant(this);
}
//purpose :
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsDescendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const
+bool SALOMEDSImpl_AttributeTreeNode::IsDescendant (const SALOMEDSImpl_AttributeTreeNode* ofTN) const
{
- Handle(SALOMEDSImpl_AttributeTreeNode) current = this;
- while (current->HasFather()) {
- if (current->GetFather() == ofTN) return Standard_True;
+ SALOMEDSImpl_AttributeTreeNode* current = (SALOMEDSImpl_AttributeTreeNode*)this;
+ while (current) {
+ if (current->GetFather() == ofTN) return true;
current = current->GetFather();
}
- return Standard_False;
+ return false;
}
//=======================================================================
//purpose :
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsFather (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const
+bool SALOMEDSImpl_AttributeTreeNode::IsFather (const SALOMEDSImpl_AttributeTreeNode* ofTN) const
{
return (ofTN->GetFather() == this);
}
//purpose :
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsChild (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const
+bool SALOMEDSImpl_AttributeTreeNode::IsChild (const SALOMEDSImpl_AttributeTreeNode* ofTN) const
{
return (myFather == ofTN);
}
//purpose : Returns Standard_True if the TreeNode is not attached to a
// TreeNode tree or hasn't an Father.
//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::IsRoot() const
+bool SALOMEDSImpl_AttributeTreeNode::IsRoot() const
{
- if (myFather.IsNull() &&
- myPrevious.IsNull() &&
- myNext.IsNull())
- return Standard_True;
- return Standard_False;
+ if (!myFather && !myPrevious && !myNext)
+ return true;
+ return false;
}
//=======================================================================
//TreeNode : Root
//purpose : Returns the TreeNode which has no Father
//=======================================================================
-Handle(SALOMEDSImpl_AttributeTreeNode) SALOMEDSImpl_AttributeTreeNode::Root() const
+SALOMEDSImpl_AttributeTreeNode* SALOMEDSImpl_AttributeTreeNode::Root() const
{
- Handle(SALOMEDSImpl_AttributeTreeNode) O = this;
- while (O->HasFather())
+ SALOMEDSImpl_AttributeTreeNode* O = (SALOMEDSImpl_AttributeTreeNode*)this;
+ while (O && O->HasFather())
O = O->GetFather();
return O;
}
//TreeNode : SetFather
//purpose : Sets the TreeNode F as Father of me
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::SetFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& F)
+void SALOMEDSImpl_AttributeTreeNode::SetFather(const SALOMEDSImpl_AttributeTreeNode* F)
{
CheckLocked();
Backup();
- myFather = F;
+ myFather = (SALOMEDSImpl_AttributeTreeNode*)F;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//TreeNode : SetNext
//purpose : Sets the TreeNode F next to me
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::SetNext(const Handle(SALOMEDSImpl_AttributeTreeNode)& F)
+void SALOMEDSImpl_AttributeTreeNode::SetNext(const SALOMEDSImpl_AttributeTreeNode* F)
{
CheckLocked();
Backup();
- myNext = F;
+ myNext = (SALOMEDSImpl_AttributeTreeNode*)F;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//TreeNode : SetPrevious
//purpose : Sets the TreeNode F previous to me
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::SetPrevious(const Handle(SALOMEDSImpl_AttributeTreeNode)& F)
+void SALOMEDSImpl_AttributeTreeNode::SetPrevious(const SALOMEDSImpl_AttributeTreeNode* F)
{
CheckLocked();
Backup();
- myPrevious = F;
+ myPrevious = (SALOMEDSImpl_AttributeTreeNode*)F;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//TreeNode : SetFirst
//purpose : Sets the TreeNode F as first in the TreeNode tree
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::SetFirst(const Handle(SALOMEDSImpl_AttributeTreeNode)& F)
+void SALOMEDSImpl_AttributeTreeNode::SetFirst(const SALOMEDSImpl_AttributeTreeNode* F)
{
CheckLocked();
Backup();
- myFirst = F;
+ myFirst = (SALOMEDSImpl_AttributeTreeNode*)F;
SetModifyFlag(); //SRN: Mark the study as being modified, so it could be saved
}
//=======================================================================
//TreeNode : AfterAddition
//purpose : Connects the TreeNode to the tree.
-// Backuped attribute must stay disconnected
//=======================================================================
void SALOMEDSImpl_AttributeTreeNode::AfterAddition()
{
- if (!IsBackuped()) {
- if (!myPrevious.IsNull()) {
- myPrevious->SetNext(this);
- }
- else if (!myFather.IsNull()) {
- myFather->SetFirst(this);
- }
- if (!myNext.IsNull())
- myNext->SetPrevious(this);
+ if (myPrevious) {
+ myPrevious->SetNext(this);
+ }
+ else if (myFather) {
+ myFather->SetFirst(this);
+ }
+ if (myNext) {
+ myNext->SetPrevious(this);
}
}
//=======================================================================
//TreeNode : BeforeForget
//purpose : Disconnect the TreeNode from the tree.
-// Backuped attribute is normaly not concerned by such an operation
//=======================================================================
void SALOMEDSImpl_AttributeTreeNode::BeforeForget()
{
- if (!IsBackuped()) {
Remove();
while (HasFirst()) GetFirst()->Remove();
- }
-}
-
-//=======================================================================
-//TreeNode : AfterResume
-//purpose : Connects the TreeNode to the tree
-//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::AfterResume()
-{
- AfterAddition();
-}
-
-//=======================================================================
-//TreeNode : BeforeUndo
-//purpose : Disconnect the TreeNode from the tree.
-//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::BeforeUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
- const Standard_Boolean forceIt)
-{
- if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) BeforeForget(); // Disconnect.
- return Standard_True;
-}
-
-//=======================================================================
-//TreeNode : AfterUndo
-//purpose : Connect the TreeNode from the tree.
-//=======================================================================
-Standard_Boolean SALOMEDSImpl_AttributeTreeNode::AfterUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
- const Standard_Boolean forceIt)
-{
- if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnRemoval))) AfterAddition(); // Reconnect.
- return Standard_True;
}
//=======================================================================
//TreeNode : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::Restore(const Handle(TDF_Attribute)& other)
+void SALOMEDSImpl_AttributeTreeNode::Restore(DF_Attribute* other)
{
- Handle(SALOMEDSImpl_AttributeTreeNode) F = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(other);
+ SALOMEDSImpl_AttributeTreeNode* F = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(other);
myFather = F->myFather;
myPrevious = F->myPrevious;
myNext = F->myNext;
//purpose : Method for Copy mechanism
//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::Paste(const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeTreeNode::Paste(DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeTreeNode) intof = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(into);
- Handle(SALOMEDSImpl_AttributeTreeNode) func;
- if (!RT->HasRelocation(myFather, func) && RT->AfterRelocate()) {
- func.Nullify();
- }
- intof->SetFather(func);
- if (!RT->HasRelocation(myNext, func) && RT->AfterRelocate()) {
- func.Nullify();
- }
- intof->SetNext(func);
- if (!RT->HasRelocation(myPrevious, func) && RT->AfterRelocate()) {
- func.Nullify();
- }
- intof->SetPrevious(func);
- if (!RT->HasRelocation(myFirst, func) && RT->AfterRelocate()) {
- func.Nullify();
- }
-
- intof->SetFirst(func);
+ SALOMEDSImpl_AttributeTreeNode* intof = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(into);
+ intof->SetFather(myFather);
+ intof->SetNext(myNext);
+ intof->SetPrevious(myPrevious);
+ intof->SetFirst(myFirst);
intof->SetTreeID(myTreeID);
}
//purpose : Returns new empty TreeNode attribute
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeTreeNode::NewEmpty() const
+DF_Attribute* SALOMEDSImpl_AttributeTreeNode::NewEmpty() const
{
- Handle(SALOMEDSImpl_AttributeTreeNode) T = new SALOMEDSImpl_AttributeTreeNode();
+ SALOMEDSImpl_AttributeTreeNode* T = new SALOMEDSImpl_AttributeTreeNode();
T->SetTreeID(myTreeID);
return T;
}
-//=======================================================================
-//TreeNode : References
-//purpose : Collects the references
-//=======================================================================
-void SALOMEDSImpl_AttributeTreeNode::References(const Handle(TDF_DataSet)& aDataSet) const
-{
- Handle(SALOMEDSImpl_AttributeTreeNode) fct = myFirst;
- while (!fct.IsNull()) {
- aDataSet->AddAttribute(fct);
- fct = fct->myNext;
- }
-}
-
-TCollection_AsciiString SALOMEDSImpl_AttributeTreeNode::Type()
+string SALOMEDSImpl_AttributeTreeNode::Type()
{
- char* aNodeName = new char[60];
- char aGUID[40];
- ID().ToCString(aGUID);
- sprintf(aNodeName, "AttributeTreeNodeGUID%s",aGUID);
- TCollection_AsciiString ret(aNodeName);
+ char* aNodeName = new char[127];
+ sprintf(aNodeName, "AttributeTreeNodeGUID%s", ID().c_str());
+ string ret(aNodeName);
delete aNodeName;
return ret;
}
-TCollection_AsciiString SALOMEDSImpl_AttributeTreeNode::Save()
+string SALOMEDSImpl_AttributeTreeNode::Save()
{
- TCollection_AsciiString aFather, aPrevious, aNext, aFirst;
+ string aFather, aPrevious, aNext, aFirst;
- if (HasFather()) aFather = Entry(GetFather()->Label()); else aFather = "!";
- if (HasPrevious()) aPrevious = Entry(GetPrevious()->Label()); else aPrevious = "!";
- if (HasNext()) aNext = Entry(GetNext()->Label()); else aNext = "!";
- if (HasFirst()) aFirst = Entry(GetFirst()->Label()); else aFirst = "!";
+ if (HasFather()) aFather = GetFather()->Label().Entry(); else aFather = "!";
+ if (HasPrevious()) aPrevious = GetPrevious()->Label().Entry(); else aPrevious = "!";
+ if (HasNext()) aNext = GetNext()->Label().Entry(); else aNext = "!";
+ if (HasFirst()) aFirst = GetFirst()->Label().Entry(); else aFirst = "!";
int aLength = 4;
- aLength += aFather.Length() + aPrevious.Length() + aNext.Length() + aFirst.Length();
+ aLength += aFather.size() + aPrevious.size() + aNext.size() + aFirst.size();
char* aResult = new char[aLength];
- sprintf(aResult, "%s %s %s %s", aFather.ToCString(), aPrevious.ToCString(), aNext.ToCString(), aFirst.ToCString());
- TCollection_AsciiString ret(aResult);
+ sprintf(aResult, "%s %s %s %s", aFather.c_str(), aPrevious.c_str(), aNext.c_str(), aFirst.c_str());
+ string ret(aResult);
delete aResult;
return ret;
}
-void SALOMEDSImpl_AttributeTreeNode::Load(const TCollection_AsciiString& value)
+void SALOMEDSImpl_AttributeTreeNode::Load(const string& value)
{
- Handle(TDF_Data) DF = Label().Data();
-
- char* aCopy = (char*)value.ToCString();
+ char* aCopy = (char*)value.c_str();
char* adr = strtok(aCopy, " ");
- TDF_Label aLabel;
- Handle(SALOMEDSImpl_AttributeTreeNode) aDepNode;
+ DF_Label aLabel;
+ SALOMEDSImpl_AttributeTreeNode* aDepNode = NULL;
if (adr && adr[0] != '!') {
- TDF_Tool::Label(DF, adr, aLabel, 1);
- if (!aLabel.FindAttribute(ID(), aDepNode))
+ aLabel = DF_Label::Label(Label(), adr, true);
+ if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID())))
aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID());
SetFather(aDepNode);
adr = strtok(NULL, " ");
if (adr && adr[0] != '!') {
- TDF_Tool::Label(DF, adr, aLabel, 1);
- if (!aLabel.FindAttribute(ID(), aDepNode))
+ aLabel = DF_Label::Label(Label(), adr, true);
+ if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID())))
aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID());
SetPrevious(aDepNode);
}
adr = strtok(NULL, " ");
if (adr && adr[0] != '!') {
- TDF_Tool::Label(DF, adr, aLabel, 1);
- if (!aLabel.FindAttribute(ID(), aDepNode))
+ aLabel = DF_Label::Label(Label(), adr, true);
+ if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID())))
aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID());
SetNext(aDepNode);
}
adr = strtok(NULL, " ");
if (adr && adr[0] != '!') {
- TDF_Tool::Label(DF, adr, aLabel, 1);
- if (!aLabel.FindAttribute(ID(), aDepNode))
+ aLabel = DF_Label::Label(Label(), adr, true);
+ if (!(aDepNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(ID())))
aDepNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, ID());
SetFirst(aDepNode);
}
#ifndef _SALOMEDSImpl_AttributeTreeNode_HeaderFile
#define _SALOMEDSImpl_AttributeTreeNode_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_AttributeDelta.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle_TDF_DataSet;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-class SALOMEDSImpl_ChildNodeIterator;
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeTreeNode, SALOMEDSImpl_GenericAttribute )
-
class SALOMEDSImpl_AttributeTreeNode : public SALOMEDSImpl_GenericAttribute
{
public:
-Standard_EXPORT const static Standard_GUID& GetDefaultTreeID();
-Standard_EXPORT static Handle_SALOMEDSImpl_AttributeTreeNode Set(const TDF_Label& L, const Standard_GUID& ID);
+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 Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT void SetPrevious(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT void SetNext(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT void SetFirst(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT void SetTreeID(const Standard_GUID& value);
-
-Standard_EXPORT Standard_Boolean Append(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT Standard_Boolean Prepend(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT Standard_Boolean Remove();
-Standard_EXPORT Standard_Boolean InsertBefore(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-Standard_EXPORT Standard_Boolean InsertAfter(const Handle(SALOMEDSImpl_AttributeTreeNode)& value);
-
-Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetFather() { return myFather; }
-Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetPrevious() { return myPrevious; }
-Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetNext() { return myNext; }
-Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) GetFirst() { return myFirst; }
-
-Standard_EXPORT Standard_Boolean HasFather() { return (!myFather.IsNull()); }
-Standard_EXPORT Standard_Boolean HasPrevious() { return (!myPrevious.IsNull()); }
-Standard_EXPORT Standard_Boolean HasNext() {return (!myNext.IsNull()); }
-Standard_EXPORT Standard_Boolean HasFirst() { return (!myFirst.IsNull()); }
-Standard_EXPORT const Standard_GUID& GetTreeID() { return ID(); }
-Standard_EXPORT Standard_Integer Depth() const;
-Standard_EXPORT Standard_Boolean IsRoot() const ;
-Standard_EXPORT Handle(SALOMEDSImpl_AttributeTreeNode) Root() const;
-Standard_EXPORT Standard_Boolean IsAscendant (const Handle(SALOMEDSImpl_AttributeTreeNode)& ofTN) const;
-Standard_EXPORT Standard_Boolean IsDescendant(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const;
-Standard_EXPORT Standard_Boolean IsFather(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const;
-Standard_EXPORT Standard_Boolean IsChild(const Handle(SALOMEDSImpl_AttributeTreeNode)& value) const;
-
-Standard_EXPORT virtual TCollection_AsciiString Save();
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&);
-Standard_EXPORT virtual TCollection_AsciiString Type();
-
-Standard_EXPORT virtual void AfterAddition() ;
-Standard_EXPORT virtual void BeforeForget() ;
-Standard_EXPORT virtual void AfterResume() ;
-Standard_EXPORT virtual Standard_Boolean BeforeUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
- const Standard_Boolean forceIt = Standard_False) ;
-Standard_EXPORT virtual Standard_Boolean AfterUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
- const Standard_Boolean forceIt = Standard_False) ;
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const;
-Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
-Standard_EXPORT void References(const Handle(TDF_DataSet)& aDataSet) const;
-Standard_EXPORT ~SALOMEDSImpl_AttributeTreeNode() {}
-
-public:
- DEFINE_STANDARD_RTTI( 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();
private:
-Standard_GUID myTreeID;
-Handle(SALOMEDSImpl_AttributeTreeNode) myFather;
-Handle(SALOMEDSImpl_AttributeTreeNode) myPrevious;
-Handle(SALOMEDSImpl_AttributeTreeNode) myNext;
-Handle(SALOMEDSImpl_AttributeTreeNode) myFirst;
+std::string myTreeID;
+SALOMEDSImpl_AttributeTreeNode* myFather;
+SALOMEDSImpl_AttributeTreeNode* myPrevious;
+SALOMEDSImpl_AttributeTreeNode* myNext;
+SALOMEDSImpl_AttributeTreeNode* myFirst;
friend class SALOMEDSImpl_ChildNodeIterator;
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_AttributeUserID, SALOMEDSImpl_GenericAttribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_AttributeUserID, SALOMEDSImpl_GenericAttribute )
-
-Handle(SALOMEDSImpl_AttributeUserID) SALOMEDSImpl_AttributeUserID::Set (const TDF_Label& L, const Standard_GUID& ID)
+SALOMEDSImpl_AttributeUserID* SALOMEDSImpl_AttributeUserID::Set (const DF_Label& L, const std::string& ID)
{
- Handle(SALOMEDSImpl_AttributeUserID) A;
- if (!L.FindAttribute(ID, A)) {
+ SALOMEDSImpl_AttributeUserID* A = NULL;
+ if (!(A=(SALOMEDSImpl_AttributeUserID*)L.FindAttribute(ID))) {
A = new SALOMEDSImpl_AttributeUserID();
A->SetValue(ID);
L.AddAttribute(A);
//function : ID
//purpose :
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_AttributeUserID::ID() const
+const std::string& SALOMEDSImpl_AttributeUserID::ID() const
{ return myID; }
//function : SetValue
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeUserID::SetValue( const Standard_GUID& guid)
+void SALOMEDSImpl_AttributeUserID::SetValue( const std::string& guid)
{
CheckLocked();
if(myID == guid) return;
//function : NewEmpty
//purpose :
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_AttributeUserID::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_AttributeUserID::NewEmpty () const
{
- Handle(SALOMEDSImpl_AttributeUserID) A = new SALOMEDSImpl_AttributeUserID();
+ SALOMEDSImpl_AttributeUserID* A = new SALOMEDSImpl_AttributeUserID();
A->SetValue(myID);
return A;
}
//function : Restore
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeUserID::Restore(const Handle(TDF_Attribute)& with)
+void SALOMEDSImpl_AttributeUserID::Restore(DF_Attribute* with)
{
- Handle(SALOMEDSImpl_AttributeUserID) A = Handle(SALOMEDSImpl_AttributeUserID)::DownCast(with);
+ SALOMEDSImpl_AttributeUserID* A = dynamic_cast<SALOMEDSImpl_AttributeUserID*>(with);
SetValue( A->ID() );
}
//function : Paste
//purpose :
//=======================================================================
-void SALOMEDSImpl_AttributeUserID::Paste (const Handle(TDF_Attribute)& into,
- const Handle(TDF_RelocationTable)& RT) const
+void SALOMEDSImpl_AttributeUserID::Paste (DF_Attribute* into)
{
- Handle(SALOMEDSImpl_AttributeUserID) A = Handle(SALOMEDSImpl_AttributeUserID)::DownCast(into);
+ SALOMEDSImpl_AttributeUserID* A = dynamic_cast<SALOMEDSImpl_AttributeUserID*>(into);
A->SetValue( myID );
}
-TCollection_AsciiString SALOMEDSImpl_AttributeUserID::Type()
+string SALOMEDSImpl_AttributeUserID::Type()
{
- char* aUAttrName = new char[60];
- char aGUID[40];
- ID().ToCString(aGUID);
- sprintf(aUAttrName, "AttributeUserID_%s",aGUID);
+ char* aUAttrName = new char[127];
+ sprintf(aUAttrName, "AttributeUserID_%s",ID().c_str());
- TCollection_AsciiString ret(aUAttrName);
+ string ret(aUAttrName);
delete aUAttrName;
return ret;
#ifndef _SALOMEDSImpl_AttributeUserID_HeaderFile
#define _SALOMEDSImpl_AttributeUserID_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include <string>
#include "SALOMEDSImpl_GenericAttribute.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_AttributeUserID, SALOMEDSImpl_GenericAttribute )
class SALOMEDSImpl_AttributeUserID : public SALOMEDSImpl_GenericAttribute
{
private:
-Standard_GUID myID;
+std::string myID;
public:
SALOMEDSImpl_AttributeUserID():SALOMEDSImpl_GenericAttribute("AttributeUserID") {}
-static Handle(SALOMEDSImpl_AttributeUserID) Set (const TDF_Label& L, const Standard_GUID& ID);
-static const Standard_GUID& DefaultID()
+static SALOMEDSImpl_AttributeUserID* Set (const DF_Label& L, const std::string& ID);
+static const std::string& DefaultID()
{
- static Standard_GUID SALOMEDSImpl_DefaultUserAttributeID ("FFFFFFFF-D9CD-11d6-945D-1050DA506788");
+ static std::string SALOMEDSImpl_DefaultUserAttributeID ("FFFFFFFF-D9CD-11d6-945D-1050DA506788");
return SALOMEDSImpl_DefaultUserAttributeID;
}
-Standard_EXPORT const Standard_GUID& Value() const { return ID(); }
-Standard_EXPORT void SetValue(const Standard_GUID& value);
+Standard_EXPORT const std::string& Value() const { return ID(); }
+Standard_EXPORT void SetValue(const std::string& value);
-Standard_EXPORT virtual TCollection_AsciiString Type();
+Standard_EXPORT virtual std::string Type();
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ;
-Standard_EXPORT Handle_TDF_Attribute NewEmpty() const;
-Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) 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_AttributeUserID() {}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_AttributeUserID )
-
};
#endif
if(theType == "AttributeTableOfString") return SALOMEDSImpl_AttributeTableOfString::GetID(); \
if(theType == "AttributeStudyProperties") return SALOMEDSImpl_AttributeStudyProperties::GetID(); \
if(theType == "AttributePythonObject") return SALOMEDSImpl_AttributePythonObject::GetID(); \
- if(theType == "AttributeUserID") return Standard_GUID("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); \
+ if(theType == "AttributeUserID") return std::string("FFFFFFFF-D9CD-11d6-945D-1050DA506788"); \
if(theType == "AttributeExternalFileDef") return SALOMEDSImpl_AttributeExternalFileDef::GetID(); \
if(theType == "AttributeFileType") return SALOMEDSImpl_AttributeFileType::GetID(); \
if(theType == "AttributeFlags") return SALOMEDSImpl_AttributeFlags::GetID(); \
if(theType == "AttributeString") return SALOMEDSImpl_AttributeString::GetID();
-#define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \
- Handle(SALOMEDSImpl_##ClassName) anAttr; \
- if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \
+#define __FindOrCreateAttributeLocked(ClassName) if (strcmp(aTypeOfAttribute.c_str(), #ClassName) == 0) { \
+ SALOMEDSImpl_##ClassName* anAttr; \
+ if (!(anAttr=(SALOMEDSImpl_##ClassName*)Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID()))) { \
CheckLocked(); \
anAttr = new SALOMEDSImpl_##ClassName; \
Lab.AddAttribute(anAttr); \
return anAttr; \
}
-#define __FindOrCreateAttribute(ClassName) if (strcmp(aTypeOfAttribute.ToCString(), #ClassName) == 0) { \
- Handle(SALOMEDSImpl_##ClassName) anAttr; \
- if (!Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID(), anAttr)) { \
+#define __FindOrCreateAttribute(ClassName) if (strcmp(aTypeOfAttribute.c_str(), #ClassName) == 0) { \
+ SALOMEDSImpl_##ClassName* anAttr; \
+ if (!(anAttr=(SALOMEDSImpl_##ClassName*)Lab.FindAttribute(SALOMEDSImpl_##ClassName::GetID()))) { \
anAttr = new SALOMEDSImpl_##ClassName; \
Lab.AddAttribute(anAttr); \
} \
#include "SALOMEDSImpl_Callback.hxx"
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Callback, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Callback, MMgt_TShared )
#ifndef __SALOMEDSIMPL_CALLBACK_H__
#define __SALOMEDSIMPL_CALLBACK_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Callback, MMgt_TShared )
#include "SALOMEDSImpl_UseCaseBuilder.hxx"
-class SALOMEDSImpl_Callback : public MMgt_TShared
+class SALOMEDSImpl_Callback
{
private:
- Handle(SALOMEDSImpl_UseCaseBuilder) _builder;
+ SALOMEDSImpl_UseCaseBuilder* _builder;
public:
- SALOMEDSImpl_Callback(const Handle(SALOMEDSImpl_UseCaseBuilder)& builder)
+ SALOMEDSImpl_Callback(SALOMEDSImpl_UseCaseBuilder* builder)
{
_builder = builder;
}
- virtual void OnAddSObject(Handle(SALOMEDSImpl_SObject) theObject)
+ virtual void OnAddSObject(const SALOMEDSImpl_SObject& theObject)
{
- if(_builder != NULL && theObject != NULL) _builder->Append(theObject);
+ if(_builder != NULL && theObject) _builder->Append(theObject);
}
- virtual void OnRemoveSObject(Handle(SALOMEDSImpl_SObject) theObject)
+ virtual void OnRemoveSObject(const SALOMEDSImpl_SObject& theObject)
{
- if(_builder != NULL && theObject != NULL) _builder->Remove(theObject);
+ if(_builder != NULL && theObject) _builder->Remove(theObject);
}
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_Callback )
-
};
#endif
// Author : Sergey RUIN
// Module : SALOME
-
#include "SALOMEDSImpl_ChildIterator.hxx"
#include "SALOMEDSImpl_Study.hxx"
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_ChildIterator, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_ChildIterator, MMgt_TShared )
-
-SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const Handle(SALOMEDSImpl_SObject)& theSO)
+SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const SALOMEDSImpl_SObject& theSO)
{
_so = theSO;
- _it = TDF_ChildIterator(_so->GetLabel());
+ _it = DF_ChildIterator(_so.GetLabel());
}
-SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const TDF_Label& theLabel)
+SALOMEDSImpl_ChildIterator::SALOMEDSImpl_ChildIterator(const DF_Label& theLabel)
{
_so = SALOMEDSImpl_Study::SObject(theLabel);
- _it = TDF_ChildIterator(theLabel);
+ _it = DF_ChildIterator(theLabel);
}
void SALOMEDSImpl_ChildIterator::Init()
{
- _it.Initialize(_so->GetLabel(), Standard_False);
+ if(_so) _it.Init(_so.GetLabel(), false);
}
-void SALOMEDSImpl_ChildIterator::Init(const TDF_Label& theLabel)
+void SALOMEDSImpl_ChildIterator::Init(const DF_Label& theLabel)
{
- _it.Initialize(theLabel, Standard_False);
+ _it.Init(theLabel, false);
}
void SALOMEDSImpl_ChildIterator::InitEx(bool theAllLevels)
{
- _it.Initialize(_so->GetLabel(), theAllLevels);
+ if(_so) _it.Init(_so.GetLabel(), theAllLevels);
}
-void SALOMEDSImpl_ChildIterator::InitEx(const TDF_Label& theLabel, bool theAllLevels)
+void SALOMEDSImpl_ChildIterator::InitEx(const DF_Label& theLabel, bool theAllLevels)
{
- _it.Initialize(theLabel, theAllLevels);
+ _it.Init(theLabel, theAllLevels);
}
bool SALOMEDSImpl_ChildIterator::More()
_it.Next();
}
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_ChildIterator::Value()
+SALOMEDSImpl_SObject SALOMEDSImpl_ChildIterator::Value()
{
+ if(!_so) return SALOMEDSImpl_SObject();
return SALOMEDSImpl_Study::SObject(_it.Value());
}
-TDF_Label SALOMEDSImpl_ChildIterator::Label()
+DF_Label SALOMEDSImpl_ChildIterator::Label()
{
return _it.Value();
}
+
+SALOMEDSImpl_ChildIterator* SALOMEDSImpl_ChildIterator::GetPersistentCopy() const
+{
+ SALOMEDSImpl_ChildIterator* itr = new SALOMEDSImpl_ChildIterator();
+ itr->_it = _it;
+ itr->_so = _so;
+ return itr;
+}
+
#ifndef __SALOMEDSImpl_CHILDITERATOR_H__
#define __SALOMEDSImpl_CHILDITERATOR_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_ChildIterator, MMgt_TShared )
#include "SALOMEDSImpl_SObject.hxx"
-#include "TDF_ChildIterator.hxx"
-#include "TDF_Label.hxx"
+#include "DF_ChildIterator.hxx"
+#include "DF_Label.hxx"
-class SALOMEDSImpl_ChildIterator: public MMgt_TShared
+class SALOMEDSImpl_ChildIterator
{
private:
- TDF_ChildIterator _it;
- Handle(SALOMEDSImpl_SObject) _so;
+ DF_ChildIterator _it;
+ SALOMEDSImpl_SObject _so;
public:
- Standard_EXPORT SALOMEDSImpl_ChildIterator(const Handle(SALOMEDSImpl_SObject)& theSO);
- Standard_EXPORT SALOMEDSImpl_ChildIterator(const TDF_Label& theLabel);
+ 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 TDF_Label& theLabel);
+ Standard_EXPORT virtual void Init(const DF_Label& theLabel);
Standard_EXPORT virtual void InitEx(bool theAllLevels);
- Standard_EXPORT virtual void InitEx(const TDF_Label& theLabel, 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 Handle(SALOMEDSImpl_SObject) Value();
- Standard_EXPORT virtual TDF_Label Label();
+ Standard_EXPORT virtual SALOMEDSImpl_SObject Value();
+ Standard_EXPORT virtual DF_Label Label();
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_SObject )
+ Standard_EXPORT SALOMEDSImpl_ChildIterator* GetPersistentCopy() const;
};
#endif
#define ChildNodeIterator_UpToBrother \
{ \
- while (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \
+ while (myNode && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \
myNode = myNode->myFather; \
- if (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \
+ if (myNode && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \
myNode = myNode->myNext; \
else \
myNode = NULL; \
//purpose :
//=======================================================================
-SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode,
- const Standard_Boolean allLevels)
+SALOMEDSImpl_ChildNodeIterator::SALOMEDSImpl_ChildNodeIterator (const SALOMEDSImpl_AttributeTreeNode* aNode,
+ const bool allLevels)
: myNode(aNode->myFirst),
myFirstLevel(allLevels ? aNode->Depth() : -1)
{}
//purpose :
//=======================================================================
-void SALOMEDSImpl_ChildNodeIterator::Initialize(const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode,
- const Standard_Boolean allLevels)
+void SALOMEDSImpl_ChildNodeIterator::Initialize(const SALOMEDSImpl_AttributeTreeNode* aNode,
+ const bool allLevels)
{
myNode = aNode->myFirst;
myFirstLevel = allLevels ? aNode->Depth() : -1;
#ifndef _SALOMEDSImpl_ChildNodeIterator_HeaderFile
#define _SALOMEDSImpl_ChildNodeIterator_HeaderFile
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-
#include "SALOMEDSImpl_AttributeTreeNode.hxx"
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
class SALOMEDSImpl_ChildNodeIterator
{
public:
Standard_EXPORT SALOMEDSImpl_ChildNodeIterator();
-Standard_EXPORT SALOMEDSImpl_ChildNodeIterator(const Handle(SALOMEDSImpl_AttributeTreeNode)& aTreeNode,
- const Standard_Boolean allLevels = Standard_False);
-Standard_EXPORT void Initialize(const Handle(SALOMEDSImpl_AttributeTreeNode)& aTreeNode,
- const Standard_Boolean allLevels = Standard_False) ;
-Standard_EXPORT Standard_Boolean More() const { return !myNode.IsNull(); }
+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 Handle_SALOMEDSImpl_AttributeTreeNode Value() const { return myNode; }
+Standard_EXPORT SALOMEDSImpl_AttributeTreeNode* Value() const { return myNode; }
private:
-Handle_SALOMEDSImpl_AttributeTreeNode myNode;
-Standard_Integer myFirstLevel;
+SALOMEDSImpl_AttributeTreeNode* myNode;
+int myFirstLevel;
};
#ifndef __SALOMEDSIMPL_DRIVER_H__
#define __SALOMEDSIMPL_DRIVER_H__
-#include <TCollection_AsciiString.hxx>
+#include <string>
#include <SALOMEDSImpl_SComponent.hxx>
#include <SALOMEDSImpl_SObject.hxx>
#include <SALOMEDSImpl_TMPFile.hxx>
{
public:
- virtual TCollection_AsciiString GetIOR() = 0;
+ virtual std::string GetIOR() = 0;
- virtual Handle(SALOMEDSImpl_TMPFile) Save(const Handle(SALOMEDSImpl_SComponent)& theComponent,
- const TCollection_AsciiString& theURL,
- long& theStreamLength,
- bool isMultiFile) = 0;
+ virtual SALOMEDSImpl_TMPFile* Save(const SALOMEDSImpl_SComponent& theComponent,
+ const std::string& theURL,
+ long& theStreamLength,
+ bool isMultiFile) = 0;
- virtual Handle(SALOMEDSImpl_TMPFile) SaveASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
- const TCollection_AsciiString& theURL,
- long& theStreamLength,
- bool isMultiFile) = 0;
+ virtual SALOMEDSImpl_TMPFile* SaveASCII(const SALOMEDSImpl_SComponent& theComponent,
+ const std::string& theURL,
+ long& theStreamLength,
+ bool isMultiFile) = 0;
- virtual bool Load(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ virtual bool Load(const SALOMEDSImpl_SComponent& theComponent,
const unsigned char* theStream,
const long theStreamLength,
- const TCollection_AsciiString& theURL,
+ const std::string& theURL,
bool isMultiFile) = 0;
- virtual bool LoadASCII(const Handle(SALOMEDSImpl_SComponent)& theComponent,
+ virtual bool LoadASCII(const SALOMEDSImpl_SComponent& theComponent,
const unsigned char* theStream,
const long theStreamLength,
- const TCollection_AsciiString& theURL,
+ const std::string& theURL,
bool isMultiFile) = 0;
- virtual void Close(const Handle(SALOMEDSImpl_SComponent)& theComponent) = 0;
+ virtual void Close(const SALOMEDSImpl_SComponent& theComponent) = 0;
- virtual TCollection_AsciiString ComponentDataType() = 0;
+ virtual std::string ComponentDataType() = 0;
- virtual TCollection_AsciiString IORToLocalPersistentID(const Handle(SALOMEDSImpl_SObject)& theSObject,
- const TCollection_AsciiString& IORString,
+ virtual std::string IORToLocalPersistentID(const SALOMEDSImpl_SObject& theSObject,
+ const std::string& IORString,
bool isMultiFile,
bool isASCII) = 0;
- virtual TCollection_AsciiString LocalPersistentIDToIOR(const Handle(SALOMEDSImpl_SObject)& theSObject,
- const TCollection_AsciiString& aLocalPersistentID,
+ virtual std::string LocalPersistentIDToIOR(const SALOMEDSImpl_SObject& theSObject,
+ const std::string& aLocalPersistentID,
bool isMultiFile,
bool isASCII) = 0;
- virtual bool CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject) = 0;
+ virtual bool CanCopy(const SALOMEDSImpl_SObject& theObject) = 0;
- virtual Handle(SALOMEDSImpl_TMPFile) CopyFrom(const Handle(SALOMEDSImpl_SObject)& theObject,
- int& theObjectID,
- long& theStreamLength) = 0;
+ virtual SALOMEDSImpl_TMPFile* CopyFrom(const SALOMEDSImpl_SObject& theObject,
+ int& theObjectID,
+ long& theStreamLength) = 0;
- virtual bool CanPaste(const TCollection_AsciiString& theComponentName, int theObjectID) = 0;
+ virtual bool CanPaste(const std::string& theComponentName, int theObjectID) = 0;
- virtual TCollection_AsciiString PasteInto(const unsigned char* theStream,
+ virtual std::string PasteInto(const unsigned char* theStream,
const long theStreamLength,
int theObjectID,
- const Handle(SALOMEDSImpl_SObject)& theObject) = 0;
+ const SALOMEDSImpl_SObject& theObject) = 0;
- virtual Handle(SALOMEDSImpl_TMPFile) DumpPython(const Handle(SALOMEDSImpl_Study)& theStudy,
- bool isPublished,
- bool& isValidScript,
- long& theStreamLength) = 0;
+ virtual SALOMEDSImpl_TMPFile* DumpPython(SALOMEDSImpl_Study* theStudy,
+ bool isPublished,
+ bool& isValidScript,
+ long& theStreamLength) = 0;
};
class SALOMEDSImpl_DriverFactory
{
public:
- virtual SALOMEDSImpl_Driver* GetDriverByType(const TCollection_AsciiString& theComponentType) = 0;
+ virtual SALOMEDSImpl_Driver* GetDriverByType(const std::string& theComponentType) = 0;
- virtual SALOMEDSImpl_Driver* GetDriverByIOR(const TCollection_AsciiString& theIOR) = 0;
+ virtual SALOMEDSImpl_Driver* GetDriverByIOR(const std::string& theIOR) = 0;
};
#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_GenericAttribute, TDF_Attribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_GenericAttribute, TDF_Attribute )
-
-char* SALOMEDSImpl_GenericAttribute::Impl_GetType(const Handle(TDF_Attribute)& theAttr)
+char* SALOMEDSImpl_GenericAttribute::Impl_GetType(DF_Attribute* theAttr)
{
- Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr);
- return ga->Type().ToCString();
+ SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
+ return (char*)ga->Type().c_str();
}
-char* SALOMEDSImpl_GenericAttribute::Impl_GetClassType(const Handle(TDF_Attribute)& theAttr)
+char* SALOMEDSImpl_GenericAttribute::Impl_GetClassType(DF_Attribute* theAttr)
{
- Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr);
- return ga->GetClassType().ToCString();
+ SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
+ return (char*)ga->GetClassType().c_str();
}
-void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(const Handle(TDF_Attribute)& theAttr)
+void SALOMEDSImpl_GenericAttribute::Impl_CheckLocked(DF_Attribute* theAttr)
{
- Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(theAttr);
+ SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(theAttr);
ga->CheckLocked();
}
-TCollection_AsciiString SALOMEDSImpl_GenericAttribute::Type()
+string SALOMEDSImpl_GenericAttribute::Type()
{
return _type;
}
void SALOMEDSImpl_GenericAttribute::CheckLocked()
{
- TDF_Label aLabel = Label();
+ DF_Label aLabel = Label();
if(aLabel.IsNull()) return;
- Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
- if(aStudy.IsNull() || aStudy->NewBuilder()->HasOpenCommand()) return;
+ SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
+ if(!aStudy) return;
if(aStudy->IsLocked()) {
aStudy->_errorCode = "LockProtection";
throw LockProtection("LockProtection");
}
}
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_GenericAttribute::GetSObject()
+SALOMEDSImpl_SObject SALOMEDSImpl_GenericAttribute::GetSObject()
{
- TDF_Label aLabel = Label();
- if(aLabel.IsNull()) return NULL;
+ SALOMEDSImpl_SObject so;
+ DF_Label aLabel = Label();
+ if(aLabel.IsNull()) return so;
return SALOMEDSImpl_Study::SObject(aLabel);
}
void SALOMEDSImpl_GenericAttribute::SetModifyFlag()
{
- TDF_Label aLabel = Label();
+ DF_Label aLabel = Label();
if(aLabel.IsNull()) return;
- Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
- if(!aStudy.IsNull()) aStudy->Modify();
+ SALOMEDSImpl_Study* aStudy = SALOMEDSImpl_Study::GetStudy(aLabel);
+ if(aStudy) aStudy->Modify();
}
#ifndef _GENERICIMPL_ATTRIBUTE_HXX_
#define _GENERICIMPL_ATTRIBUTE_HXX_
-#include <TDF_Label.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
+#include "DF_Label.hxx"
+#include "DF_Attribute.hxx"
+#include <string>
#include "SALOMEDSImpl_SObject.hxx"
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
-
-
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_GenericAttribute, TDF_Attribute )
-
-class SALOMEDSImpl_GenericAttribute: public TDF_Attribute
+class SALOMEDSImpl_GenericAttribute: public DF_Attribute
{
protected:
- TCollection_AsciiString _type; //This field must be filled in each attribute that inherits from this class.
+ std::string _type; //This field must be filled in each attribute that inherits from this class.
public:
-Standard_EXPORT SALOMEDSImpl_GenericAttribute(const TCollection_AsciiString& theType)
+Standard_EXPORT SALOMEDSImpl_GenericAttribute(const std::string& theType)
:_type(theType)
{}
-Standard_EXPORT virtual TCollection_AsciiString Save() { return ""; }
-Standard_EXPORT virtual void Load(const TCollection_AsciiString&) {}
-Standard_EXPORT virtual TCollection_AsciiString Type();
+Standard_EXPORT virtual std::string Type();
Standard_EXPORT virtual void CheckLocked();
-Standard_EXPORT TCollection_AsciiString GetClassType() { return _type; }
-Standard_EXPORT Handle(SALOMEDSImpl_SObject) GetSObject();
+Standard_EXPORT std::string GetClassType() { return _type; }
+Standard_EXPORT SALOMEDSImpl_SObject GetSObject();
Standard_EXPORT void SetModifyFlag();
-Standard_EXPORT static char* Impl_GetType(const Handle(TDF_Attribute)& theAttr);
-Standard_EXPORT static char* Impl_GetClassType(const Handle(TDF_Attribute)& theAttr);
-Standard_EXPORT static void Impl_CheckLocked(const Handle(TDF_Attribute)& theAttr);
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_GenericAttribute )
+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);
};
#include "SALOMEDSImpl_IParameters.hxx"
#include <utilities.h>
-#include <TCollection_AsciiString.hxx>
-
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_ChildIterator.hxx"
/*!
Constructor
*/
-SALOMEDSImpl_IParameters::SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap)
+SALOMEDSImpl_IParameters::SALOMEDSImpl_IParameters(SALOMEDSImpl_AttributeParameter* ap)
{
- if(ap.IsNull()) return;
+ if(!ap) return;
_ap = ap;
- Handle(SALOMEDSImpl_SObject) so = _ap->GetSObject();
- _study = so->GetStudy();
+ SALOMEDSImpl_SObject so = _ap->GetSObject();
+ _study = so.GetStudy();
}
SALOMEDSImpl_IParameters::~SALOMEDSImpl_IParameters()
int SALOMEDSImpl_IParameters::append(const string& listName, const string& value)
{
- if(_ap.IsNull()) return -1;
+ if(!_ap) return -1;
vector<string> v;
if(!_ap->IsSet(listName, PT_STRARRAY)) {
if(!_ap->IsSet(_AP_LISTS_LIST_, PT_STRARRAY)) _ap->SetStrArray(_AP_LISTS_LIST_, v);
int SALOMEDSImpl_IParameters::nbValues(const string& listName)
{
- if(_ap.IsNull()) return -1;
+ if(!_ap) return -1;
if(!_ap->IsSet(listName, PT_STRARRAY)) return 0;
vector<string> v = _ap->GetStrArray(listName);
return v.size();
vector<string> SALOMEDSImpl_IParameters::getValues(const string& listName)
{
vector<string> v;
- if(_ap.IsNull()) return v;
+ if(!_ap) return v;
if(!_ap->IsSet(listName, PT_STRARRAY)) return v;
return _ap->GetStrArray(listName);
}
string SALOMEDSImpl_IParameters::getValue(const string& listName, int index)
{
- if(_ap.IsNull()) return "";
+ if(!_ap) return "";
if(!_ap->IsSet(listName, PT_STRARRAY)) return "";
vector<string> v = _ap->GetStrArray(listName);
if(index >= v.size()) return "";
void SALOMEDSImpl_IParameters::setParameter(const string& entry, const string& parameterName, const string& value)
{
- if(_ap.IsNull()) return;
+ if(!_ap) return;
vector<string> v;
if(!_ap->IsSet(entry, PT_STRARRAY)) {
append(_AP_ENTRIES_LIST_, entry); //Add the entry to the internal list of entries
string SALOMEDSImpl_IParameters::getParameter(const string& entry, const string& parameterName)
{
- if(_ap.IsNull()) return "";
+ if(!_ap) return "";
if(!_ap->IsSet(entry, PT_STRARRAY)) return "";
vector<string> v = _ap->GetStrArray(entry);
int length = v.size();
vector<string> SALOMEDSImpl_IParameters::getAllParameterNames(const string& entry)
{
vector<string> v, names;
- if(_ap.IsNull()) return v;
+ if(!_ap) return v;
if(!_ap->IsSet(entry, PT_STRARRAY)) return v;
v = _ap->GetStrArray(entry);
int length = v.size();
vector<string> SALOMEDSImpl_IParameters::getAllParameterValues(const string& entry)
{
vector<string> v, values;
- if(_ap.IsNull()) return v;
+ if(!_ap) return v;
if(!_ap->IsSet(entry, PT_STRARRAY)) return v;
v = _ap->GetStrArray(entry);
int length = v.size();
int SALOMEDSImpl_IParameters::getNbParameters(const string& entry)
{
- if(_ap.IsNull()) return -1;
+ if(!_ap) return -1;
if(!_ap->IsSet(entry, PT_STRARRAY)) return -1;
return _ap->GetStrArray(entry).size()/2;
}
vector<string> SALOMEDSImpl_IParameters::getEntries()
{
vector<string> v;
- if(_ap.IsNull()) return v;
+ if(!_ap) return v;
if(!_ap->IsSet(_AP_ENTRIES_LIST_, PT_STRARRAY)) return v;
return _ap->GetStrArray(_AP_ENTRIES_LIST_);
}
void SALOMEDSImpl_IParameters::setProperty(const string& name, const std::string& value)
{
- if(_ap.IsNull()) return;
+ if(!_ap) return;
if(!_ap->IsSet(name, PT_STRING)) {
append(_AP_PROPERTIES_LIST_, name); //Add the property to the internal list of properties
}
string SALOMEDSImpl_IParameters::getProperty(const string& name)
{
- if(_ap.IsNull()) return "";
+ if(!_ap) return "";
if(!_ap->IsSet(name, PT_STRING)) return "";
return _ap->GetString(name);
}
vector<string> SALOMEDSImpl_IParameters::getProperties()
{
vector<string> v;
- if(_ap.IsNull()) return v;
+ if(!_ap) return v;
if(!_ap->IsSet(_AP_PROPERTIES_LIST_, PT_STRARRAY)) return v;
return _ap->GetStrArray(_AP_PROPERTIES_LIST_);
}
{
if(!_study) return entry;
int pos = entry.rfind("_");
- if(pos < 0 || pos >= entry.length()) return entry;
+ if(pos < 0 || pos >= entry.size()) return entry;
string compName(entry, 0, pos), compID, tail(entry, pos+1, entry.length()-1);
if(_compNames.find(compName) == _compNames.end()) {
- Handle(SALOMEDSImpl_SObject) so = _study->FindComponent((char*)compName.c_str());
- if(so.IsNull()) return entry;
- compID = so->GetID().ToCString();
+ SALOMEDSImpl_SObject so = _study->FindComponent(compName);
+ if(!so) return entry;
+ compID = so.GetID();
_compNames[compName] = compID;
}
else compID = _compNames[compName];
}
-bool SALOMEDSImpl_IParameters::isDumpPython(const Handle(SALOMEDSImpl_Study)& study, const string& theID)
+bool SALOMEDSImpl_IParameters::isDumpPython(SALOMEDSImpl_Study* study, const string& theID)
{
string anID;
if(theID == "") anID = getDefaultVisualComponent();
else anID = theID;
- Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetCommonParameters((char*)anID.c_str(), 0);
- if(ap.IsNull()) return false;
+ SALOMEDSImpl_AttributeParameter* ap = study->GetCommonParameters((char*)anID.c_str(), 0);
+ if(!ap) return false;
if(!ap->IsSet(_AP_DUMP_PYTHON_, PT_BOOLEAN)) return false;
return (bool)ap->GetBool(_AP_DUMP_PYTHON_);
}
-int SALOMEDSImpl_IParameters::getLastSavePoint(const Handle(SALOMEDSImpl_Study)& study, const string& theID)
+int SALOMEDSImpl_IParameters::getLastSavePoint(SALOMEDSImpl_Study* study, const string& theID)
{
string anID;
if(theID == "") anID = getDefaultVisualComponent();
else anID = theID;
- Handle(SALOMEDSImpl_SObject) so = study->FindComponent((char*)anID.c_str());
- if(so.IsNull()) return -1;
+ SALOMEDSImpl_SObject so = study->FindComponent(anID);
+ if(!so) return -1;
- Handle(SALOMEDSImpl_StudyBuilder) builder = study->NewBuilder();
- Handle(SALOMEDSImpl_ChildIterator) anIter ( study->NewChildIterator( so ) );
+ SALOMEDSImpl_StudyBuilder* builder = study->NewBuilder();
+ SALOMEDSImpl_ChildIterator anIter = study->NewChildIterator( so );
int tag = -1;
- for(; anIter->More(); anIter->Next())
+ for(; anIter.More(); anIter.Next())
{
- Handle(SALOMEDSImpl_SObject) val( anIter->Value() );
- Handle(SALOMEDSImpl_GenericAttribute) genAttr;
- if(builder->FindAttribute(val, genAttr, "AttributeParameter")) tag = val->Tag();
+ SALOMEDSImpl_SObject val( anIter.Value() );
+ DF_Attribute* genAttr;
+ if(builder->FindAttribute(val, genAttr, "AttributeParameter")) tag = val.Tag();
}
return tag;
-string SALOMEDSImpl_IParameters::getStudyScript(const Handle(SALOMEDSImpl_Study)& study, int savePoint, const std::string& theID)
+string SALOMEDSImpl_IParameters::getStudyScript(SALOMEDSImpl_Study* study, int savePoint, const std::string& theID)
{
string anID;
if(theID == "") anID = getDefaultVisualComponent();
else anID = theID;
- Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetCommonParameters((char*)anID.c_str(), savePoint);
+ SALOMEDSImpl_AttributeParameter* ap = study->GetCommonParameters((char*)anID.c_str(), savePoint);
SALOMEDSImpl_IParameters ip(ap);
string dump("");
return dump;
}
-string SALOMEDSImpl_IParameters::getDefaultScript(const Handle(SALOMEDSImpl_Study)& study,
- const string& moduleName,
- const string& shift,
- const string& theID)
+string SALOMEDSImpl_IParameters::getDefaultScript(SALOMEDSImpl_Study* study,
+ const string& moduleName,
+ const string& shift,
+ const string& theID)
{
string anID;
if(theID == "") anID = getDefaultVisualComponent();
SALOMEDSImpl_IParameters ip = SALOMEDSImpl_IParameters(study->GetCommonParameters(anID.c_str(), savePoint));
if(!isDumpPython(study)) return dump;
- Handle(SALOMEDSImpl_AttributeParameter) ap = study->GetModuleParameters(anID.c_str(), moduleName.c_str(), savePoint);
+ SALOMEDSImpl_AttributeParameter* ap = study->GetModuleParameters(anID.c_str(), moduleName.c_str(), savePoint);
ip = SALOMEDSImpl_IParameters(ap);
vector<string> names = ip.getAllParameterNames(v[i]);
vector<string> values = ip.getAllParameterValues(v[i]);
string decodedEntry = ip.decodeEntry(v[i]);
- Handle(SALOMEDSImpl_SObject) so = study->FindObjectID((char*)decodedEntry.c_str());
+ SALOMEDSImpl_SObject so = study->FindObjectID(decodedEntry);
string so_name("");
- if(!so.IsNull()) so_name = so->GetName().ToCString();
+ if(so) so_name = so.GetName();
dump += shift + "# set up entry " + v[i] +" ("+so_name+")" + " parameters" + "\n";
for(int j = 0; j < names.size() && j < values.size(); j++)
dump += shift + "ipar.setParameter(\"" + v[i] + "\", \"" + names[j] + "\", \"" + values[j] + "\")\n";
class Standard_EXPORT SALOMEDSImpl_IParameters
{
public:
- SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap);
+ SALOMEDSImpl_IParameters(SALOMEDSImpl_AttributeParameter* ap);
virtual ~SALOMEDSImpl_IParameters();
/*!
Returns whether there is the dumping visual parameters
*/
- static bool isDumpPython(const Handle(SALOMEDSImpl_Study)& study, const string& theID = "");
+ static bool isDumpPython(SALOMEDSImpl_Study* study, const std::string& theID = "");
/*!
Returns an ID of the last save point
*/
- static int getLastSavePoint(const Handle(SALOMEDSImpl_Study)& study, const std::string& theID = "");
+ static int getLastSavePoint(SALOMEDSImpl_Study* study, const std::string& theID = "");
/*!
Returns a Python script for the study, which sets up visual parameters
*/
- static std::string getStudyScript(const Handle(SALOMEDSImpl_Study)& study, int savePoint, const std::string& theID = "");
+ 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
*/
- static std::string getDefaultScript(const Handle(SALOMEDSImpl_Study)& study,
+ static std::string getDefaultScript(SALOMEDSImpl_Study* study,
const std::string& moduleName,
const std::string& shift,
const std::string& theID = "");
static std::string getDefaultVisualComponent();
private:
- Handle(SALOMEDSImpl_AttributeParameter) _ap;
- Handle(SALOMEDSImpl_Study) _study;
+ SALOMEDSImpl_AttributeParameter* _ap;
+ SALOMEDSImpl_Study* _study;
std::map<std::string, std::string> _compNames;
};
+++ /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
-//
-// File : SALOMEDSImpl_OCAFApplication.cxx
-// Author : Sergey RUIN
-// Module : SALOME
-
-#include "SALOMEDSImpl_OCAFApplication.hxx"
-
-using namespace std;
-
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_OCAFApplication, TDocStd_Application )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_OCAFApplication, TDocStd_Application )
-
-//=======================================================================
-//function : SALOMEDSImpl_OCAFApplication
-//purpose :
-//=======================================================================
-
-SALOMEDSImpl_OCAFApplication::SALOMEDSImpl_OCAFApplication()
-{
-}
-
-
-//=======================================================================
-//function : Formats
-//purpose :
-//=======================================================================
-
-void SALOMEDSImpl_OCAFApplication::Formats(TColStd_SequenceOfExtendedString& Formats)
-{
- Formats.Append(TCollection_ExtendedString ("SALOME_STUDY"));
-}
-
-
-//=======================================================================
-//function : ResourcesName
-//purpose :
-//=======================================================================
-
-Standard_CString SALOMEDSImpl_OCAFApplication::ResourcesName()
-{
- return Standard_CString ("SALOMEDSImpl_Resources");
-}
-
-
-
-
-
+++ /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
-//
-// File : SALOMEDSImpl_OCAFApplication.hxx
-// Author : Sergey RUIN
-// Module : SALOME
-
-#ifndef _SALOMEDSImpl_OCAFApplication_HeaderFile
-#define _SALOMEDSImpl_OCAFApplication_HeaderFile
-
-
-//Handle definition
-#include <TDocStd_Application.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_OCAFApplication, TDocStd_Application)
-
-#include <Standard_CString.hxx>
-#include <TColStd_SequenceOfExtendedString.hxx>
-
-
-class SALOMEDSImpl_OCAFApplication : public TDocStd_Application {
-
-public:
-
-Standard_EXPORT SALOMEDSImpl_OCAFApplication();
-Standard_EXPORT virtual void Formats(TColStd_SequenceOfExtendedString& Formats) ;
-Standard_EXPORT Standard_CString ResourcesName() ;
-Standard_EXPORT ~SALOMEDSImpl_OCAFApplication() {}
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_OCAFApplication )
-
-};
-
-#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
+//============================================================================
+/*! Function : Empty constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent()
+{
+}
+
+//============================================================================
+/*! Function : Copy constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const SALOMEDSImpl_SComponent& theSCO)
+{
+ _lab = theSCO._lab;
+ _value = theSCO._value;
+ _type = theSCO._type;
+ _name = theSCO._name;
+}
//============================================================================
/*! Function : constructor
* Purpose :
*/
//============================================================================
-SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const TDF_Label& theLabel)
+SALOMEDSImpl_SComponent::SALOMEDSImpl_SComponent(const DF_Label& theLabel)
:SALOMEDSImpl_SObject(theLabel)
{
}
*/
//============================================================================
SALOMEDSImpl_SComponent::~SALOMEDSImpl_SComponent()
-{}
+{
+}
//============================================================================
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_SComponent::ComponentDataType()
+string SALOMEDSImpl_SComponent::ComponentDataType()
{
- TCollection_AsciiString res = "";
- Handle(SALOMEDSImpl_AttributeComment) type;
- if ( _lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(),type) ) {
+ string res = "";
+ SALOMEDSImpl_AttributeComment* type;
+ if ( (type = (SALOMEDSImpl_AttributeComment*)_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID())) ) {
res = type->Value();
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_SComponent::ComponentIOR(TCollection_AsciiString& IOR)
+bool SALOMEDSImpl_SComponent::ComponentIOR(string& IOR)
{
- Handle(SALOMEDSImpl_AttributeIOR) ior;
- if (!_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),ior) )
+ SALOMEDSImpl_AttributeIOR* ior;
+ if (!(ior = (SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID())) )
return false;
IOR = ior->Value();
return true;
}
-
+
//============================================================================
/*! Function : IsA
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_SComponent::IsA(const TDF_Label& theLabel)
+bool SALOMEDSImpl_SComponent::IsA(const DF_Label& theLabel)
{
// scomponent must contain comment and belong to the 2th depth label
if ( theLabel.IsAttribute(SALOMEDSImpl_AttributeComment::GetID()) && theLabel.Depth() == 2) {
}
return false;
}
+
+//============================================================================
+/*! Function : GetPersistentCopy
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SComponent* SALOMEDSImpl_SComponent::GetPersistentCopy() const
+{
+ SALOMEDSImpl_SComponent* sco = new SALOMEDSImpl_SComponent;
+ sco->_lab = _lab;
+ sco->_name = _name;
+ sco->_type = _type;
+ sco->_value = _value;
+ return sco;
+}
//SALOMEDSImpl headers
#include "SALOMEDSImpl_SObject.hxx"
-//Handle definition
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_SComponent, SALOMEDSImpl_SObject )
-
// std C++ headers
#include <iostream>
+#include <string>
// Cascade headers
-#include <TDF_Label.hxx>
-#include <SALOMEDSImpl_SObject.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Tool.hxx>
+#include "DF_Label.hxx"
+#include "SALOMEDSImpl_SObject.hxx"
#include <stdio.h>
-class SALOMEDSImpl_SComponent : public SALOMEDSImpl_SObject
+class SALOMEDSImpl_SComponent : public virtual SALOMEDSImpl_SObject
{
public:
- SALOMEDSImpl_SComponent(const TDF_Label& lab);
+ Standard_EXPORT SALOMEDSImpl_SComponent();
+ Standard_EXPORT SALOMEDSImpl_SComponent(const SALOMEDSImpl_SComponent& theSCO);
+ Standard_EXPORT SALOMEDSImpl_SComponent(const DF_Label& lab);
- ~SALOMEDSImpl_SComponent();
+ Standard_EXPORT ~SALOMEDSImpl_SComponent();
- virtual TCollection_AsciiString ComponentDataType();
- virtual bool ComponentIOR(TCollection_AsciiString& theID);
- static bool IsA(const TDF_Label& theLabel);
+ Standard_EXPORT virtual std::string ComponentDataType();
+ Standard_EXPORT virtual bool ComponentIOR(std::string& theID);
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_SComponent )
+ Standard_EXPORT static bool IsA(const DF_Label& theLabel);
+
+ Standard_EXPORT SALOMEDSImpl_SComponent* GetPersistentCopy() const;
};
#endif
*/
//============================================================================
-SALOMEDSImpl_SComponentIterator::SALOMEDSImpl_SComponentIterator(const Handle(TDocStd_Document)& theDocument)
+SALOMEDSImpl_SComponentIterator::SALOMEDSImpl_SComponentIterator(DF_Document* theDocument)
{
_lab = theDocument->Main();
- _it.Initialize (_lab);
+ _it.Init (_lab);
}
//============================================================================
//============================================================================
void SALOMEDSImpl_SComponentIterator::Init()
{
- _it.Initialize (_lab);
+ _it.Init (_lab);
}
//============================================================================
{
if (!_it.More())
return false;
- TDF_Label L = _it.Value();
- if (SALOMEDSImpl_SComponent::IsA(L))
- return true;
-
- return _it.More();
+ DF_Label L = _it.Value();
+ return SALOMEDSImpl_SComponent::IsA(L);
}
- //============================================================================
+//============================================================================
/*! Function : Next
*/
//============================================================================
*
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SComponentIterator::Value()
+SALOMEDSImpl_SComponent SALOMEDSImpl_SComponentIterator::Value()
{
return SALOMEDSImpl_Study::SComponent(_it.Value());
}
+//============================================================================
+/*! Function : GetPersistentCopy
+ */
+//============================================================================
+SALOMEDSImpl_SComponentIterator* SALOMEDSImpl_SComponentIterator::GetPersistentCopy() const
+{
+ SALOMEDSImpl_SComponentIterator* itr = new SALOMEDSImpl_SComponentIterator();
+ itr->_lab = _lab;
+ itr->_it = _it;
+
+ return itr;
+}
#include "SALOMEDSImpl_SComponent.hxx"
// Cascade headers
-#include <TDocStd_Document.hxx>
-#include <TDF_ChildIterator.hxx>
-#include <TDF_Label.hxx>
+#include "DF_ChildIterator.hxx"
+#include "DF_Label.hxx"
+#include "DF_Document.hxx"
#include <stdio.h>
class Standard_EXPORT SALOMEDSImpl_SComponentIterator
{
private:
- TDF_ChildIterator _it;
- TDF_Label _lab;
+ DF_ChildIterator _it;
+ DF_Label _lab;
public:
SALOMEDSImpl_SComponentIterator() {};
- SALOMEDSImpl_SComponentIterator(const Handle(TDocStd_Document)& theDocument);
+ SALOMEDSImpl_SComponentIterator(DF_Document* theDocument);
~SALOMEDSImpl_SComponentIterator() {};
virtual void Init();
virtual bool More();
virtual void Next();
- virtual Handle(SALOMEDSImpl_SComponent) Value();
+ virtual SALOMEDSImpl_SComponent Value();
+
+ SALOMEDSImpl_SComponentIterator* GetPersistentCopy() const;
};
#endif
using namespace std;
-#include <TDF_AttributeIterator.hxx>
#include <map>
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_SObject, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_SObject, MMgt_TShared )
+//============================================================================
+/*! Function : empty constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SObject::SALOMEDSImpl_SObject()
+{
+}
+
+//============================================================================
+/*! Function : copy constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const SALOMEDSImpl_SObject& theSObject)
+{
+ _lab = theSObject._lab;
+ _value = theSObject._value;
+ _type = theSObject._type;
+ _name = theSObject._name;
+
+}
+
//============================================================================
/*! Function : constructor
* Purpose :
*/
//============================================================================
-SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const TDF_Label& theLabel)
+SALOMEDSImpl_SObject::SALOMEDSImpl_SObject(const DF_Label& theLabel)
:_lab(theLabel)
{
_value = "";
*/
//============================================================================
SALOMEDSImpl_SObject::~SALOMEDSImpl_SObject()
-{}
+{
+}
//============================================================================
/*! Function : GetID
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_SObject::GetID()
+string SALOMEDSImpl_SObject::GetID() const
{
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry (_lab,anEntry);
- return anEntry;
+ return _lab.Entry();
}
//============================================================================
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SObject::GetFatherComponent()
+SALOMEDSImpl_SComponent SALOMEDSImpl_SObject::GetFatherComponent() const
{
- TDF_Label LF = _lab;
+ SALOMEDSImpl_SComponent sco;
+ DF_Label LF = _lab;
while (!SALOMEDSImpl_SComponent::IsA(LF) && !LF.IsRoot()) {
LF = LF.Father();
}
- if(LF.IsRoot()) return NULL;
+ if(LF.IsRoot()) return sco;
return GetStudy()->GetSComponent(LF);
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_SObject::GetFather()
+SALOMEDSImpl_SObject SALOMEDSImpl_SObject::GetFather() const
{
return GetStudy()->GetSObject(_lab.Father());
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_Study) SALOMEDSImpl_SObject::GetStudy()
+SALOMEDSImpl_Study* SALOMEDSImpl_SObject::GetStudy() const
{
return SALOMEDSImpl_Study::GetStudy(_lab);
}
* Purpose : Find attribute of given type on this SObject
*/
//============================================================================
-bool SALOMEDSImpl_SObject::FindAttribute(Handle(TDF_Attribute)& theAttribute,
- const TCollection_AsciiString& theTypeOfAttribute)
+bool SALOMEDSImpl_SObject::FindAttribute(DF_Attribute*& theAttribute,
+ const string& theTypeOfAttribute) const
{
- if(_lab.IsNull()) return Standard_False;
- Standard_GUID aGUID = GetGUID(theTypeOfAttribute);
- if (_lab.FindAttribute(aGUID, theAttribute)) return Standard_True;
- return Standard_False;
+ if(_lab.IsNull()) return false;
+ std::string aGUID = GetGUID(theTypeOfAttribute);
+ if ((theAttribute = _lab.FindAttribute(aGUID))) return true;
+ return false;
}
* Purpose : Returns list of all attributes for this sobject
*/
//============================================================================
-Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_SObject::GetAllAttributes()
+vector<DF_Attribute*> SALOMEDSImpl_SObject::GetAllAttributes() const
{
- Standard_Integer NumAttr = _lab.NbAttributes();
- Handle(TColStd_HSequenceOfTransient) SeqOfAttr = new TColStd_HSequenceOfTransient();
- Handle(SALOMEDSImpl_GenericAttribute) anAttr;
- if (NumAttr != 0) {
- for(TDF_AttributeIterator iter(_lab);iter.More();iter.Next()) {
- anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(iter.Value());
- if(!anAttr.IsNull() && anAttr->Type() != "AttributeReference")
- SeqOfAttr->Append(anAttr);
- }
+ vector<DF_Attribute*> va1, va = _lab.GetAttributes();
+ for(int i = 0, len = va.size(); i<len; i++) {
+ SALOMEDSImpl_GenericAttribute* ga = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(va[i]);
+ if(ga && ga->Type() != string("AttributeReference"))
+ va1.push_back(va[i]);
}
- return SeqOfAttr;
+
+ return va1;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_SObject::ReferencedObject(Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_SObject::ReferencedObject(SALOMEDSImpl_SObject& theObject) const
{
- Handle(SALOMEDSImpl_AttributeReference) Ref;
- if (!_lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(),Ref))
+ SALOMEDSImpl_AttributeReference* Ref;
+ if (!(Ref=(SALOMEDSImpl_AttributeReference*)_lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID())))
return false;
theObject = GetStudy()->GetSObject(Ref->Get());
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_SObject::FindSubObject(int theTag, Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_SObject::FindSubObject(int theTag, SALOMEDSImpl_SObject& theObject)
{
- TDF_Label L = _lab.FindChild(theTag, false);
+ DF_Label L = _lab.FindChild(theTag, false);
if (L.IsNull()) return false;
theObject = GetStudy()->GetSObject(L);
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_SObject::GetName()
+string SALOMEDSImpl_SObject::GetName() const
{
- TCollection_AsciiString aStr = "";
- Handle(SALOMEDSImpl_AttributeName) aName;
- if (_lab.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) {
- aStr = aName->Value();
+ string aStr = "";
+ SALOMEDSImpl_AttributeName* aName;
+ if ((aName=(SALOMEDSImpl_AttributeName*)_lab.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
+ aStr =aName->Value();
}
return aStr;
}
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_SObject::GetComment()
+string SALOMEDSImpl_SObject::GetComment() const
{
- TCollection_AsciiString aStr = "";
- Handle(SALOMEDSImpl_AttributeComment) aComment;
- if (_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComment)) {
+ string aStr = "";
+ SALOMEDSImpl_AttributeComment* aComment;
+ if ((aComment=(SALOMEDSImpl_AttributeComment*)_lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) {
aStr = aComment->Value();
}
return aStr;
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_SObject::GetIOR()
+string SALOMEDSImpl_SObject::GetIOR() const
{
- TCollection_AsciiString aStr = "";
- Handle(SALOMEDSImpl_AttributeIOR) anIOR;
- if (_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anIOR)) {
- aStr = anIOR->Value();
+ string aStr = "";
+ SALOMEDSImpl_AttributeIOR* anIOR;
+ if ((anIOR=(SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ aStr = dynamic_cast<SALOMEDSImpl_AttributeIOR*>(anIOR)->Value();
}
return aStr;
}
-Standard_GUID SALOMEDSImpl_SObject::GetGUID(const TCollection_AsciiString& theType)
+std::string SALOMEDSImpl_SObject::GetGUID(const string& theType)
{
__AttributeTypeToGUIDForSObject
- if (strncmp(theType.ToCString(), "AttributeTreeNodeGUID",21) == 0) {
- const char* aCType = theType.ToCString();
- char* aGUIDString = new char[40];
- sprintf(aGUIDString, &(aCType[21]));
- Standard_GUID aGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
- delete(aGUIDString);
- return aGUID;
+ if (strncmp(theType.c_str(), "AttributeTreeNodeGUID",21) == 0) {
+ return theType.substr(21, theType.size());
}
- return Standard_GUID();
+ return "";
}
+//============================================================================
+/*! Function : SALOMEDSImpl_SComponent
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SObject::operator SALOMEDSImpl_SComponent() const
+{
+ SALOMEDSImpl_SComponent sco;
+ sco._lab = _lab;
+ sco._name = _name;
+ sco._type = _type;
+ sco._value = _value;
+ return sco;
+}
+
+//============================================================================
+/*! Function : GetPersistentCopy
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_SObject* SALOMEDSImpl_SObject::GetPersistentCopy() const
+{
+ SALOMEDSImpl_SObject* so = new SALOMEDSImpl_SObject;
+ so->_lab = _lab;
+ so->_name = _name;
+ so->_type = _type;
+ so->_value = _value;
+ return so;
+}
+
+//============================================================================
+/*! Function : IsComponent
+ * Purpose :
+ */
+//============================================================================
+bool SALOMEDSImpl_SObject::IsComponent() const
+{
+ return SALOMEDSImpl_SComponent::IsA(_lab);
+}
#ifndef __SALOMEDSIMPL_SOBJECT_H__
#define __SALOMEDSIMPL_SOBJECT_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_SObject, MMgt_TShared )
+#include "DF_Label.hxx"
+#include "DF_Attribute.hxx"
+#include <string>
+#include <vector>
class SALOMEDSImpl_SComponent;
-class Handle_SALOMEDSImpl_SComponent;
class SALOMEDSImpl_Study;
-class Handle_SALOMEDSImpl_Study;
-// Cascade headers
-#include <TDF_Label.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-
-class SALOMEDSImpl_SObject : public MMgt_TShared
+class SALOMEDSImpl_SObject
{
protected:
- TDF_Label _lab;
- TCollection_AsciiString _name;
- TCollection_AsciiString _value;
- TCollection_AsciiString _type;
+ DF_Label _lab;
+ std::string _name;
+ std::string _value;
+ std::string _type;
public:
- Standard_EXPORT SALOMEDSImpl_SObject(const TDF_Label& theLabel);
- Standard_EXPORT ~SALOMEDSImpl_SObject();
+ 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 TCollection_AsciiString GetID();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) GetFatherComponent();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetFather() ;
- Standard_EXPORT virtual bool FindAttribute(Handle(TDF_Attribute)& theAttribute, const TCollection_AsciiString& theTypeOfAttribute);
- Standard_EXPORT virtual bool ReferencedObject(Handle(SALOMEDSImpl_SObject)& theObject) ;
- Standard_EXPORT virtual bool FindSubObject(int theTag, Handle(SALOMEDSImpl_SObject)& theObject);
+ 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 Handle(SALOMEDSImpl_Study) GetStudy() ;
- Standard_EXPORT virtual TCollection_AsciiString Name() { return _name; }
- Standard_EXPORT virtual void Name(const TCollection_AsciiString& theName) { _name = theName; }
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) GetAllAttributes();
+ 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;
- Standard_EXPORT virtual TCollection_AsciiString GetName();
- Standard_EXPORT virtual TCollection_AsciiString GetComment();
- Standard_EXPORT virtual TCollection_AsciiString GetIOR();
+ Standard_EXPORT virtual std::string GetName() const ;
+ Standard_EXPORT virtual std::string GetComment() const;
+ Standard_EXPORT virtual std::string GetIOR() const;
- Standard_EXPORT virtual int Tag() { return _lab.Tag(); }
- Standard_EXPORT virtual int Depth() { return _lab.Depth(); }
+ Standard_EXPORT virtual int Tag() const { return _lab.Tag(); }
+ Standard_EXPORT virtual int Depth() const { return _lab.Depth(); }
- Standard_EXPORT virtual TDF_Label GetLabel() { return _lab; }
+ Standard_EXPORT virtual DF_Label GetLabel() const { return _lab; }
- Standard_EXPORT static Standard_GUID GetGUID(const TCollection_AsciiString& theTypeOfAttribute);
+ Standard_EXPORT bool IsNull() const { return _lab.IsNull(); }
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_SObject )
+ Standard_EXPORT bool IsComponent() const;
+
+ Standard_EXPORT operator SALOMEDSImpl_SComponent() const;
+
+ Standard_EXPORT operator bool () const { return !IsNull(); }
+
+ Standard_EXPORT SALOMEDSImpl_SObject* GetPersistentCopy() const;
+
+ Standard_EXPORT static std::string GetGUID(const std::string& theTypeOfAttribute);
+
+
};
#endif
using namespace std;
-#include <TColStd_SequenceOfExtendedString.hxx>
-#include <TCollection_ExtendedString.hxx>
-
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TDocStd_Application.hxx>
-#include <TDocStd_Owner.hxx>
-#include <TDF_LabelList.hxx>
-#include <TDF_ListIteratorOfLabelList.hxx>
-#include <CDM_Document.hxx>
-#include <CDM_Application.hxx>
-#include <TDF_ChildIDIterator.hxx>
-#include <TDF_ChildIterator.hxx>
-#include <TDF_AttributeIterator.hxx>
+#include "DF_Application.hxx"
+#include "DF_ChildIterator.hxx"
#include "SALOMEDSImpl_ChildNodeIterator.hxx"
#include "SALOMEDSImpl_Attributes.hxx"
#include "SALOMEDSImpl_Tool.hxx"
#include "SALOMEDSImpl_IParameters.hxx"
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_Study, MMgt_TShared )
+#include <fstream>
#define DIRECTORYID 16661
#define FILELOCALID 26662
#define FILEID "FILE: "
+
//============================================================================
/*! Function : SALOMEDSImpl_Study
* Purpose : SALOMEDSImpl_Study constructor
*/
//============================================================================
-SALOMEDSImpl_Study::SALOMEDSImpl_Study(const Handle(TDocStd_Document)& doc,
- const TCollection_AsciiString& study_name)
+SALOMEDSImpl_Study::SALOMEDSImpl_Study(const DF_Document* doc,
+ const string& study_name)
{
- doc->SetUndoLimit(1); // mpv (IPAL9237): if there is no undo limit, operations mechanism couldn't work
_name = study_name;
- _doc = doc;
+ _doc = (DF_Document*)doc;
_Saved = false ;
_URL = "";
_StudyId = -1;
- _autoFill = true;
- myNbPostponed.Append(0);
- myNbUndos = 0;
+ _autoFill = false;
_errorCode = "";
_useCaseBuilder = new SALOMEDSImpl_UseCaseBuilder(_doc);
_builder = new SALOMEDSImpl_StudyBuilder(this);
_cb = new SALOMEDSImpl_Callback(_useCaseBuilder);
//Put on the root label a StudyHandle attribute to store the address of this object
- //It will be used to retrieve the study object by TDF_Label that belongs to the study
+ //It will be used to retrieve the study object by DF_Label that belongs to the study
SALOMEDSImpl_StudyHandle::Set(_doc->Main().Root(), this);
- _lockers = new TColStd_HSequenceOfAsciiString();
}
* Purpose : Get persistent reference of study (idem URL())
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetPersistentReference()
+string SALOMEDSImpl_Study::GetPersistentReference()
{
_errorCode = "";
return URL();
}
//============================================================================
/*! Function : GetTransientReference
- * Purpose : Get IOR of the Study (registred in OCAF document in doc->Root)
+ * Purpose : Get IOR of the Study (registred in Document in doc->Root)
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetTransientReference()
+string SALOMEDSImpl_Study::GetTransientReference()
{
_errorCode = "";
- TCollection_AsciiString IOR = "";
+ string IOR = "";
- Handle(SALOMEDSImpl_AttributeIOR) Att;
- TDF_Label _lab = _doc->GetData()->Root();
- if (_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(),Att)) {
+ SALOMEDSImpl_AttributeIOR* Att;
+ DF_Label _lab = _doc->Root();
+ if ((Att=(SALOMEDSImpl_AttributeIOR*)_lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
IOR = Att->Value();
}
else {
return IOR;
}
-void SALOMEDSImpl_Study::SetTransientReference(const TCollection_AsciiString& theIOR)
+void SALOMEDSImpl_Study::SetTransientReference(const string& theIOR)
{
_errorCode = "";
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
+ SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties();
int aLocked = aProp->IsLocked();
- if (aLocked) aProp->SetLocked(Standard_False);
+ if (aLocked) aProp->SetLocked(false);
// Assign the value of the IOR in the study->root
SALOMEDSImpl_AttributeIOR::Set(_doc->Main().Root(), theIOR);
- if (aLocked) aProp->SetLocked(Standard_True);
+ if (aLocked) aProp->SetLocked(true);
}
//============================================================================
bool SALOMEDSImpl_Study::IsEmpty()
{
_errorCode = "";
- if (_doc.IsNull()) return true;
+ if (!_doc) return true;
return _doc->IsEmpty();
}
* Purpose : Find a Component with ComponentDataType = aComponentName
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponent (const TCollection_AsciiString& aComponentName)
+SALOMEDSImpl_SComponent SALOMEDSImpl_Study::FindComponent (const string& aComponentName)
{
_errorCode = "";
bool _find = false;
- TCollection_AsciiString name;
+ string name;
SALOMEDSImpl_SComponentIterator itcomp = NewComponentIterator();
- Handle(SALOMEDSImpl_SComponent) compo;
+ SALOMEDSImpl_SComponent compo;
for (; itcomp.More(); itcomp.Next()) {
- Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value();
- name = SC->ComponentDataType();
+ SALOMEDSImpl_SComponent SC = itcomp.Value();
+ name = SC.ComponentDataType();
if(aComponentName == name) {
_find = true;
return SC;
if(!_find)
{
_errorCode = "No component was found";
- return NULL;
+ return compo;
}
return compo;
}
* Purpose : Find a Component from it's ID
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::FindComponentID(const TCollection_AsciiString& aComponentID)
+SALOMEDSImpl_SComponent SALOMEDSImpl_Study::FindComponentID(const string& aComponentID)
{
_errorCode = "";
// Iterate on each components defined in the study
// Get the component ID and compare with aComponentID
bool _find = false;
- TCollection_AsciiString ID;
- Handle(SALOMEDSImpl_SComponent) compo;
+ string ID;
+ SALOMEDSImpl_SComponent compo;
SALOMEDSImpl_SComponentIterator itcomp = NewComponentIterator();
for (; itcomp.More(); itcomp.Next()) {
- Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value();
- ID = SC->GetID();
+ SALOMEDSImpl_SComponent SC = itcomp.Value();
+ ID = SC.GetID();
if(aComponentID == ID)
{
// ComponentID found
if(!_find)
{
_errorCode = "No component was found";
- compo = NULL;
+ compo = compo;
}
return compo;
* Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObject(const TCollection_AsciiString& anObjectName)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObject(const string& anObjectName)
{
_errorCode = "";
// After testing the component name, iterate in all objects defined under
// components (function _FindObject)
bool _find = false;
- Handle(SALOMEDSImpl_SObject) RefSO = NULL;
+ SALOMEDSImpl_SObject RefSO;
SALOMEDSImpl_SComponentIterator it = NewComponentIterator();
for (; it.More();it.Next()){
if(!_find)
{
- Handle(SALOMEDSImpl_SComponent) SC = it.Value();
- if (SC->GetName() == anObjectName)
+ SALOMEDSImpl_SComponent SC = it.Value();
+ if (SC.GetName() == anObjectName)
{
_find = true;
RefSO = SC;
if (!_find) RefSO = _FindObject(SC, anObjectName, _find);
}
}
- if(RefSO.IsNull()) _errorCode = "No object was found";
+ if(!RefSO) _errorCode = "No object was found";
return RefSO;
}
* Purpose : Find an Object with ID = anObjectID
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectID(const TCollection_AsciiString& anObjectID)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectID(const string& anObjectID)
{
_errorCode = "";
-
- // Convert aSO->GetID in TDF_Label.
- TDF_Label Lab;
- TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab);
+ SALOMEDSImpl_SObject so;
+
+ // Convert aSO->GetID in DF_Label.
+ DF_Label Lab = DF_Label::Label(_doc->Main(), anObjectID, false);
if (Lab.IsNull()) {
_errorCode = "No label was found by ID";
- return NULL;
+ return so;
}
return GetSObject(Lab);
* Purpose : Creates an Object with ID = anObjectID
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::CreateObjectID(const TCollection_AsciiString& anObjectID)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::CreateObjectID(const string& anObjectID)
{
_errorCode = "";
+ SALOMEDSImpl_SObject so;
- // Convert aSO->GetID in TDF_Label.
- TDF_Label Lab;
- TDF_Tool::Label(_doc->Main().Data(), anObjectID, Lab, Standard_True);
+ // Convert aSO->GetID in DF_Label.
+ DF_Label Lab = DF_Label::Label(_doc->Main(), anObjectID, true);
if (Lab.IsNull()) {
_errorCode = "Can not create a label";
- return NULL;
+ return so;
}
return GetSObject(Lab);
* : with ComponentDataType = aComponentName
*/
//============================================================================
-Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindObjectByName(const TCollection_AsciiString& anObjectName,
- const TCollection_AsciiString& aComponentName)
+vector<SALOMEDSImpl_SObject> SALOMEDSImpl_Study::FindObjectByName(const string& anObjectName,
+ const string& aComponentName)
{
_errorCode = "";
- Handle(TColStd_HSequenceOfTransient) listSO = new TColStd_HSequenceOfTransient();
+ vector<SALOMEDSImpl_SObject> listSO;
- Handle(SALOMEDSImpl_SComponent) compo = FindComponent(aComponentName) ;
- if ( compo.IsNull() ) {
+ SALOMEDSImpl_SComponent compo = FindComponent(aComponentName) ;
+ if ( !compo ) {
_errorCode = "Can not find the component";
return listSO;
}
// Iterate on each object and subobject of the component
// If objectName is found add it to the list of SObjects
- TCollection_AsciiString childName ;
+ string childName ;
- TCollection_AsciiString compoId = compo->GetID();
- Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(compo);
- for ( ; it->More(); it->Next() ) {
+ string compoId = compo.GetID();
+ SALOMEDSImpl_ChildIterator it = NewChildIterator(compo);
+ for ( ; it.More(); it.Next() ) {
- Handle(SALOMEDSImpl_SObject) CSO = it->Value();
- if ( CSO->GetName() == anObjectName ) {
+ SALOMEDSImpl_SObject CSO = it.Value();
+ if ( CSO.GetName() == anObjectName ) {
/* add to list */
- listSO->Append(CSO) ;
+ listSO.push_back(CSO) ;
}
/* looks also for eventual children */
bool found = false ;
CSO = _FindObject( CSO, anObjectName, found ) ;
if( found) {
- listSO->Append(CSO) ;
+ listSO.push_back(CSO) ;
}
}
* Purpose : Find an Object with IOR = anObjectIOR
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectIOR(const TCollection_AsciiString& anObjectIOR)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectIOR(const string& anObjectIOR)
{
_errorCode = "";
- Handle(SALOMEDSImpl_SObject) aResult = NULL;
+ SALOMEDSImpl_SObject aResult ;
// searching in the datamap for optimization
- if (myIORLabels.IsBound(anObjectIOR)) {
- aResult = GetSObject(myIORLabels.Find(anObjectIOR));
+ if (myIORLabels.find(anObjectIOR) != myIORLabels.end()) {
+ aResult = GetSObject(myIORLabels[anObjectIOR]);
// 11 oct 2002: forbidden attributes must be checked here
- if (!aResult->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID()))
- myIORLabels.UnBind(anObjectIOR);
+ if (!aResult.GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID())) {
+ myIORLabels.erase(anObjectIOR);
+ aResult = SALOMEDSImpl_SObject();
+ }
}
- if(aResult.IsNull()) _errorCode = "No object was found";
+ if(!aResult) _errorCode = "No object was found";
return aResult;
}
* Purpose : Find an Object by its path = thePath
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::FindObjectByPath(const TCollection_AsciiString& thePath)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::FindObjectByPath(const string& thePath)
{
_errorCode = "";
- TCollection_AsciiString aPath(thePath), aToken;
- Handle(SALOMEDSImpl_SObject) aSO = NULL;
- int i = 1, aLength = aPath.Length();
+ string aPath(thePath), aToken;
+ SALOMEDSImpl_SObject aSO;
+ int aLength = aPath.size();
bool isRelative = false;
if(aLength == 0) { //Empty path - return the current context
return GetSObject(_current);
}
- if(aPath.Value(1) != '/') //Relative path
+ if(aPath[0] != '/') //Relative path
isRelative = true;
- TDF_ChildIterator anIterator;
- TDF_Label aLabel;
- Handle(SALOMEDSImpl_AttributeName) anAttr;
+ DF_ChildIterator anIterator;
+ DF_Label aLabel;
+ SALOMEDSImpl_AttributeName* anAttr;
if(isRelative) {
- if(_current.IsNull()) return NULL;
- anIterator.Initialize(_current, Standard_False);
+ if(_current.IsNull()) return aSO;
+ anIterator.Init(_current, false);
}
else {
- if(aPath.Length() == 1 && aPath.Value(1) == '/') { //Root
+ if(aPath.size() == 1 && aPath[0] == '/') { //Root
return GetSObject(_doc->Main());
}
- anIterator.Initialize(_doc->Main(), Standard_False);
+ anIterator.Init(_doc->Main(), false);
}
- while(i <= aLength) {
+ vector<string> vs = SALOMEDSImpl_Tool::splitString(aPath, '/');
+ for(int i = 0, len = vs.size(); i<len; i++) {
- aToken = aPath.Token("/", i);
- if(aToken.Length() == 0) break;
+ aToken = vs[i];
+ if(aToken.size() == 0) break;
for ( ; anIterator.More(); anIterator.Next() ) {
aLabel = anIterator.Value();
- if(aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr)) {
+ if((anAttr=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
if(anAttr->Value() == aToken) {
- aToken = aPath.Token("/", i+1); //Check if it was the last part of the path
- if(aToken.Length() == 0) { //The searched label is found (no part of the path is left)
+ if(i == (len-1)) { //The searched label is found (no part of the path is left)
return GetSObject(aLabel);
}
- anIterator.Initialize(aLabel, Standard_False);
+ anIterator.Init(aLabel, false);
break;
}
}
}
- i++;
}
- if(aSO.IsNull()) _errorCode = "No object was found";
+ if(!aSO) _errorCode = "No object was found";
return aSO;
}
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject)
+string SALOMEDSImpl_Study::GetObjectPath(const SALOMEDSImpl_SObject& theObject)
{
_errorCode = "";
- TCollection_AsciiString aPath("");
- if(theObject.IsNull()) {
+ string aPath("");
+ if(!theObject) {
_errorCode = "Null object";
- return aPath.ToCString();
+ return aPath;
}
- TCollection_AsciiString aName = theObject->GetName();
- if(!aName.IsEmpty() && aName != "" ) {
- TCollection_AsciiString aValue((char*)aName.ToCString());
- aValue.Prepend("/");
+ string aName = theObject.GetName();
+ if(!aName.empty() && aName != "" ) {
+ string aValue("/");
+ aValue+=aName;
aValue += aPath;
aPath = aValue;
- Handle(SALOMEDSImpl_SObject) aFather = theObject->GetFather();
- if(!aFather.IsNull()) {
- aName = aFather->GetName();
- if(!aName.IsEmpty() && aName != "") {
- aValue = (char*)GetObjectPath(aFather).ToCString();
+ SALOMEDSImpl_SObject aFather = theObject.GetFather();
+ if(aFather) {
+ aName = aFather.GetName();
+ if(!aName.empty() && aName != "") {
+ aValue = GetObjectPath(aFather);
aPath = aValue + aPath;
}
}
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetObjectPathByIOR(const TCollection_AsciiString& theIOR)
+string SALOMEDSImpl_Study::GetObjectPathByIOR(const string& theIOR)
{
_errorCode = "";
- TCollection_AsciiString aPath;
- Handle(SALOMEDSImpl_SObject) so = FindObjectIOR(theIOR);
- if(so.IsNull()) {
+ string aPath;
+ SALOMEDSImpl_SObject so = FindObjectIOR(theIOR);
+ if(!so) {
_errorCode = "No SObject was found by IOR";
return aPath;
}
* Purpose : Sets the current context
*/
//============================================================================
-bool SALOMEDSImpl_Study::SetContext(const TCollection_AsciiString& thePath)
+bool SALOMEDSImpl_Study::SetContext(const string& thePath)
{
_errorCode = "";
- if(thePath.IsEmpty()) {
+ if(thePath.empty()) {
_errorCode = "InvalidPath";
return false;
}
- TCollection_AsciiString aPath(thePath), aContext("");
+ string aPath(thePath), aContext("");
bool isInvalid = false;
- Handle(SALOMEDSImpl_SObject) aSO;
+ SALOMEDSImpl_SObject aSO;
- if(aPath.Value(1) != '/') { //Relative path
+ if(aPath[0] != '/') { //Relative path
aContext = GetContext();
aContext += '/';
aContext += aPath;
aContext = aPath;
try {
- aSO = FindObjectByPath(aContext.ToCString());
+ aSO = FindObjectByPath(aContext);
}
catch( ... ) {
isInvalid = true;
}
- if(isInvalid || aSO.IsNull()) {
+ if(isInvalid || !aSO) {
_errorCode = "InvalidContext";
return false;
}
- TDF_Label aLabel = aSO->GetLabel();
+ DF_Label aLabel = aSO.GetLabel();
if(aLabel.IsNull()) {
_errorCode = "InvalidContext";
return false;
* Purpose : Gets the current context
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetContext()
+string SALOMEDSImpl_Study::GetContext()
{
_errorCode = "";
_errorCode = "InvaidContext";
return "";
}
- Handle(SALOMEDSImpl_SObject) so = GetSObject(_current);
+ SALOMEDSImpl_SObject so = GetSObject(_current);
return GetObjectPath(so);
}
* Purpose : method to get all object names in the given context (or in the current context, if 'theContext' is empty)
*/
//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetObjectNames(const TCollection_AsciiString& theContext)
+vector<string> SALOMEDSImpl_Study::GetObjectNames(const string& theContext)
{
_errorCode = "";
- Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
- TDF_Label aLabel;
- if (theContext.IsEmpty()) {
+ vector<string> aResultSeq;
+ DF_Label aLabel;
+ if (theContext.empty()) {
aLabel = _current;
} else {
- TDF_Label aTmp = _current;
+ DF_Label aTmp = _current;
SetContext(theContext);
aLabel = _current;
_current = aTmp;
return aResultSeq;
}
- TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels
+ DF_ChildIterator anIter (aLabel, true); // iterate all subchildren at all sublevels
for (; anIter.More(); anIter.Next()) {
- TDF_Label aLabel = anIter.Value();
- Handle(SALOMEDSImpl_AttributeName) aName;
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) aResultSeq->Append(aName->Value());
+ DF_Label aLabel = anIter.Value();
+ SALOMEDSImpl_AttributeName* aName;
+ if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
+ aResultSeq.push_back(aName->Value());
}
return aResultSeq;
* Purpose : method to get all directory names in the given context (or in the current context, if 'theContext' is empty)
*/
//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetDirectoryNames(const TCollection_AsciiString& theContext)
+vector<string> SALOMEDSImpl_Study::GetDirectoryNames(const string& theContext)
{
_errorCode = "";
- Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
- TDF_Label aLabel;
- if (theContext.IsEmpty()) {
+ vector<string> aResultSeq;
+ DF_Label aLabel;
+ if (theContext.empty()) {
aLabel = _current;
} else {
- TDF_Label aTmp = _current;
+ DF_Label aTmp = _current;
SetContext(theContext);
aLabel = _current;
_current = aTmp;
return aResultSeq;
}
- TDF_ChildIterator anIter (aLabel, Standard_True); // iterate first-level children at all sublevels
+ DF_ChildIterator anIter (aLabel, true); // iterate first-level children at all sublevels
for (; anIter.More(); anIter.Next()) {
- TDF_Label aLabel = anIter.Value();
- Handle(SALOMEDSImpl_AttributeLocalID) anID;
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) {
+ DF_Label aLabel = anIter.Value();
+ SALOMEDSImpl_AttributeLocalID* anID;
+ if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) {
if (anID->Value() == DIRECTORYID) {
- Handle(SALOMEDSImpl_AttributeName) aName;
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) {
- aResultSeq->Append(aName->Value());
+ SALOMEDSImpl_AttributeName* aName;
+ if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
+ aResultSeq.push_back(aName->Value());
}
}
}
* Purpose : method to get all file names in the given context (or in the current context, if 'theContext' is empty)
*/
//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetFileNames(const TCollection_AsciiString& theContext)
+vector<string> SALOMEDSImpl_Study::GetFileNames(const string& theContext)
{
_errorCode = "";
- Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
- TDF_Label aLabel;
- if (theContext.IsEmpty()) {
+ vector<string> aResultSeq;
+ DF_Label aLabel;
+ if (theContext.empty()) {
aLabel = _current;
} else {
- TDF_Label aTmp = _current;
+ DF_Label aTmp = _current;
SetContext(theContext);
aLabel = _current;
_current = aTmp;
return aResultSeq;
}
- TDF_ChildIterator anIter (aLabel, Standard_True); // iterate all subchildren at all sublevels
+ DF_ChildIterator anIter (aLabel, true); // iterate all subchildren at all sublevels
for (; anIter.More(); anIter.Next()) {
- TDF_Label aLabel = anIter.Value();
- Handle(SALOMEDSImpl_AttributeLocalID) anID;
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID)) {
+ DF_Label aLabel = anIter.Value();
+ SALOMEDSImpl_AttributeLocalID* anID;
+ if ((anID=(SALOMEDSImpl_AttributeLocalID*)aLabel.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID()))) {
if (anID->Value() == FILELOCALID) {
- Handle(SALOMEDSImpl_AttributePersistentRef) aName;
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(), aName)) {
- TCollection_ExtendedString aFileName = aName->Value();
- if (aFileName.Length() > 0)
- aResultSeq->Append(aFileName.Split(strlen(FILEID)));
+ SALOMEDSImpl_AttributePersistentRef* aName;
+ if ((aName=(SALOMEDSImpl_AttributePersistentRef*)aLabel.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
+ std::string aFileName = aName->Value();
+ if (aFileName.size() > 0)
+ aResultSeq.push_back(aFileName.substr(strlen(FILEID), aFileName.size()));
}
}
}
* Purpose : method to get all components names
*/
//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetComponentNames(const TCollection_AsciiString& theContext)
+vector<string> SALOMEDSImpl_Study::GetComponentNames(const string& theContext)
{
_errorCode = "";
- Handle(TColStd_HSequenceOfAsciiString) aResultSeq = new TColStd_HSequenceOfAsciiString;
- TDF_ChildIterator anIter(_doc->Main(), Standard_False); // iterate all subchildren at first level
+ vector<string> aResultSeq;
+ DF_ChildIterator anIter(_doc->Main(), false); // iterate all subchildren at first level
for(; anIter.More(); anIter.Next()) {
- TDF_Label aLabel = anIter.Value();
- Handle(SALOMEDSImpl_AttributeName) aName;
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) aResultSeq->Append(aName->Value());
+ DF_Label aLabel = anIter.Value();
+ SALOMEDSImpl_AttributeName* aName;
+ if ((aName=(SALOMEDSImpl_AttributeName*)aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
+ aResultSeq.push_back(aName->Value());
}
return aResultSeq;
* Purpose : Create a ChildIterator from an SObject
*/
//============================================================================
-Handle(SALOMEDSImpl_ChildIterator) SALOMEDSImpl_Study::NewChildIterator(const Handle(SALOMEDSImpl_SObject)& aSO)
+SALOMEDSImpl_ChildIterator SALOMEDSImpl_Study::NewChildIterator(const SALOMEDSImpl_SObject& aSO)
{
_errorCode = "";
- return new SALOMEDSImpl_ChildIterator(aSO);
+ return SALOMEDSImpl_ChildIterator(aSO);
}
* Purpose : Create a StudyBuilder
*/
//============================================================================
-Handle(SALOMEDSImpl_StudyBuilder) SALOMEDSImpl_Study::NewBuilder()
+SALOMEDSImpl_StudyBuilder* SALOMEDSImpl_Study::NewBuilder()
{
_errorCode = "";
if(_autoFill) {
* Purpose : get study name
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::Name()
+string SALOMEDSImpl_Study::Name()
{
_errorCode = "";
return _name;
* Purpose : set study name
*/
//============================================================================
-void SALOMEDSImpl_Study::Name(const TCollection_AsciiString& name)
+void SALOMEDSImpl_Study::Name(const string& name)
{
_errorCode = "";
_name = name;
{
_errorCode = "";
_Saved = save;
- if(save) _doc->UnModify();
+ if(save) _doc->SetModified(false);
}
//============================================================================
* Purpose : get URL of the study (persistent reference of the study)
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::URL()
+string SALOMEDSImpl_Study::URL()
{
_errorCode = "";
return _URL;
* Purpose : set URL of the study (persistent reference of the study)
*/
//============================================================================
-void SALOMEDSImpl_Study::URL(const TCollection_AsciiString& url)
+void SALOMEDSImpl_Study::URL(const string& url)
{
_errorCode = "";
_URL = url;
/*jfa: Now name of SALOMEDS study will correspond to name of SalomeApp study
- TCollection_AsciiString tmp(_URL);
+ string tmp(_URL);
char *aName = (char*)tmp.ToCString();
char *adr = strtok(aName, "/");
* Purpose : Find an Object with SALOMEDSImpl_Name = anObjectName
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::_FindObject(const Handle(SALOMEDSImpl_SObject)& SO,
- const TCollection_AsciiString& theObjectName,
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::_FindObject(const SALOMEDSImpl_SObject& SO,
+ const string& theObjectName,
bool& _find)
{
- if(SO.IsNull()) return NULL;
+ SALOMEDSImpl_SObject RefSO;
+ if(!SO) return RefSO;
// Iterate on each objects and subobjects of the component
// If objectName find, stop the loop and get the object reference
- Handle(SALOMEDSImpl_SObject) RefSO;
- Handle(SALOMEDSImpl_AttributeName) anAttr;
+ SALOMEDSImpl_AttributeName* anAttr;
- TCollection_AsciiString soid = SO->GetID();
- TDF_ChildIterator it(SO->GetLabel());
+ string soid = SO.GetID();
+ DF_ChildIterator it(SO.GetLabel());
for (; it.More(); it.Next()){
if(!_find)
{
- if (it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID(), anAttr))
+ if ((anAttr=(SALOMEDSImpl_AttributeName*)it.Value().FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
{
- TCollection_AsciiString Val(anAttr->Value());
+ string Val(anAttr->Value());
if (Val == theObjectName)
{
RefSO = GetSObject(it.Value());
* Purpose : Find an Object with SALOMEDSImpl_IOR = anObjectIOR
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject)
-SALOMEDSImpl_Study::_FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO,
- const TCollection_AsciiString& theObjectIOR,
+SALOMEDSImpl_SObject
+SALOMEDSImpl_Study::_FindObjectIOR(const SALOMEDSImpl_SObject& SO,
+ const string& theObjectIOR,
bool& _find)
{
- if(SO.IsNull()) return NULL;
+ SALOMEDSImpl_SObject RefSO, aSO;
+ if(!SO) return RefSO;
// Iterate on each objects and subobjects of the component
// If objectName find, stop the loop and get the object reference
- Handle(SALOMEDSImpl_SObject) RefSO, aSO;
- Handle(SALOMEDSImpl_AttributeIOR) anAttr;
+ SALOMEDSImpl_AttributeIOR* anAttr;
- TDF_ChildIterator it(SO->GetLabel());
+ DF_ChildIterator it(SO.GetLabel());
for (; it.More();it.Next()){
if(!_find)
{
- if (it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
+ if ((anAttr=(SALOMEDSImpl_AttributeIOR*)it.Value().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID())))
{
- TCollection_AsciiString Val(anAttr->Value());
+ string Val(anAttr->Value());
if (Val == theObjectIOR)
{
RefSO = GetSObject(it.Value());
_StudyId = id;
}
-void SALOMEDSImpl_Study::UpdateIORLabelMap(const TCollection_AsciiString& anIOR,const TCollection_AsciiString& anEntry)
+void SALOMEDSImpl_Study::UpdateIORLabelMap(const string& anIOR,const string& anEntry)
{
_errorCode = "";
- TDF_Label aLabel;
- char* anEn = (char*)anEntry.ToCString();
- char* IOR = (char*)anIOR.ToCString();
- TDF_Tool::Label(_doc->GetData(),anEn, aLabel, Standard_True);
- if (myIORLabels.IsBound(TCollection_ExtendedString(IOR))) myIORLabels.UnBind(TCollection_ExtendedString(IOR));
- myIORLabels.Bind(TCollection_ExtendedString(IOR), aLabel);
+ DF_Label aLabel = DF_Label::Label(_doc->Main(), anEntry, true);
+ if (myIORLabels.find(anIOR) != myIORLabels.end()) myIORLabels.erase(anIOR);
+ myIORLabels[anIOR] = aLabel;
}
-Handle(SALOMEDSImpl_Study) SALOMEDSImpl_Study::GetStudy(const TDF_Label& theLabel)
+SALOMEDSImpl_Study* SALOMEDSImpl_Study::GetStudy(const DF_Label& theLabel)
{
- Handle(SALOMEDSImpl_StudyHandle) Att;
- if (theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID(),Att)) {
- return Att->GetHandle();
+ SALOMEDSImpl_StudyHandle* Att;
+ if ((Att=(SALOMEDSImpl_StudyHandle*)theLabel.Root().FindAttribute(SALOMEDSImpl_StudyHandle::GetID()))) {
+ return Att->Get();
}
return NULL;
}
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::SObject(const TDF_Label& theLabel)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::SObject(const DF_Label& theLabel)
{
return GetStudy(theLabel)->GetSObject(theLabel);
}
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::SComponent(const TDF_Label& theLabel)
+SALOMEDSImpl_SComponent SALOMEDSImpl_Study::SComponent(const DF_Label& theLabel)
{
return GetStudy(theLabel)->GetSComponent(theLabel);
}
-void SALOMEDSImpl_Study::IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute)
+void SALOMEDSImpl_Study::IORUpdated(const SALOMEDSImpl_AttributeIOR* theAttribute)
{
- TCollection_AsciiString aString;
- TDF_Tool::Entry(theAttribute->Label(), aString);
+ string aString = theAttribute->Label().Entry();
GetStudy(theAttribute->Label())->UpdateIORLabelMap(theAttribute->Value(), aString);
}
-Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_Study::FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject)
+vector<SALOMEDSImpl_SObject> SALOMEDSImpl_Study::FindDependances(const SALOMEDSImpl_SObject& anObject)
{
_errorCode = "";
- Handle(TColStd_HSequenceOfTransient) aSeq;
+ vector<SALOMEDSImpl_SObject> aSeq;
- Handle(SALOMEDSImpl_AttributeTarget) aTarget;
- if (anObject->GetLabel().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget)) {
+ SALOMEDSImpl_AttributeTarget* aTarget;
+ if ((aTarget=(SALOMEDSImpl_AttributeTarget*)anObject.GetLabel().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) {
return aTarget->Get();
}
}
-Handle(SALOMEDSImpl_AttributeStudyProperties) SALOMEDSImpl_Study::GetProperties()
+SALOMEDSImpl_AttributeStudyProperties* SALOMEDSImpl_Study::GetProperties()
{
_errorCode = "";
return SALOMEDSImpl_AttributeStudyProperties::Set(_doc->Main());
}
-TCollection_AsciiString SALOMEDSImpl_Study::GetLastModificationDate()
+string SALOMEDSImpl_Study::GetLastModificationDate()
{
_errorCode = "";
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
+ SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties();
- Handle(TColStd_HSequenceOfExtendedString) aNames;
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ vector<string> aNames;
+ vector<int> aMinutes, aHours, aDays, aMonths, aYears;
aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
- int aLastIndex = aNames->Length();
+ int aLastIndex = aNames.size()-1;
char aResult[20];
sprintf(aResult, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
- (int)(aDays->Value(aLastIndex)),(int)(aMonths->Value(aLastIndex)), (int)(aYears->Value(aLastIndex)),
- (int)(aHours->Value(aLastIndex)), (int)(aMinutes->Value(aLastIndex)));
- TCollection_AsciiString aResStr (aResult);
+ (int)(aDays[aLastIndex]),(int)(aMonths[aLastIndex]), (int)(aYears[aLastIndex]),
+ (int)(aHours[aLastIndex]), (int)(aMinutes[aLastIndex]));
+ string aResStr (aResult);
return aResStr;
}
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetModificationsDate()
+vector<string> SALOMEDSImpl_Study::GetModificationsDate()
{
_errorCode = "";
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = GetProperties();
+ SALOMEDSImpl_AttributeStudyProperties* aProp = GetProperties();
- Handle(TColStd_HSequenceOfExtendedString) aNames;
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ vector<string> aNames;
+ vector<int> aMinutes, aHours, aDays, aMonths, aYears;
aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
- int anIndex, aLength = aNames->Length();
- Handle(TColStd_HSequenceOfAsciiString) aDates = new TColStd_HSequenceOfAsciiString;
+ int anIndex, aLength = aNames.size();
+ vector<string> aDates;
- for (anIndex = 2; anIndex <= aLength; anIndex++) {
+ for (anIndex = 1; anIndex < aLength; anIndex++) {
char aDate[20];
sprintf(aDate, "%2.2d/%2.2d/%4.4d %2.2d:%2.2d",
- (int)(aDays->Value(anIndex)), (int)(aMonths->Value(anIndex)), (int)(aYears->Value(anIndex)),
- (int)(aHours->Value(anIndex)), (int)(aMinutes->Value(anIndex)));
- aDates->Append(aDate);
+ (int)(aDays[anIndex]), (int)(aMonths[anIndex]), (int)(aYears[anIndex]),
+ (int)(aHours[anIndex]), (int)(aMinutes[anIndex]));
+ aDates.push_back(aDate);
}
return aDates;
}
* Purpose : Returns a UseCase builder
*/
//============================================================================
-Handle(SALOMEDSImpl_UseCaseBuilder) SALOMEDSImpl_Study::GetUseCaseBuilder()
+SALOMEDSImpl_UseCaseBuilder* SALOMEDSImpl_Study::GetUseCaseBuilder()
{
_errorCode = "";
return _useCaseBuilder;
void SALOMEDSImpl_Study::Close()
{
_errorCode = "";
- Handle(TDocStd_Application) anApp = Handle(TDocStd_Application)::DownCast(_doc->Application());
- if(!anApp.IsNull()) anApp->Close(_doc);
- _doc.Nullify();
- _mapOfSO.Clear();
- _mapOfSCO.Clear();
-}
-
-//============================================================================
-/*! Function : AddPostponed
- * Purpose :
- */
- //============================================================================
-void SALOMEDSImpl_Study::AddPostponed(const TCollection_AsciiString& theIOR)
-{
- _errorCode = "";
- if (!NewBuilder()->HasOpenCommand()) return;
- TCollection_AsciiString anIOR(theIOR);
- anIOR.Prepend("d");
- myPostponedIORs.Append(anIOR); // add prefix: deleted
- myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
-}
-
-//============================================================================
-/*! Function : AddCreatedPostponed
- * Purpose :
- */
- //============================================================================
-void SALOMEDSImpl_Study::AddCreatedPostponed(const TCollection_AsciiString& theIOR)
-{
- _errorCode = "";
- if (!NewBuilder()->HasOpenCommand()) return;
- TCollection_AsciiString anIOR(theIOR);
- anIOR.Prepend("c");
- myPostponedIORs.Append(anIOR); // add prefix: created
- myNbPostponed.SetValue(myNbPostponed.Length(), myNbPostponed.Last() + 1);
-}
-
-//============================================================================
-/*! Function : RemovePostponed
- * Purpose :
- */
-//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::RemovePostponed(const int theUndoLimit)
-{
- _errorCode = "";
-
- int anIndex;
- int anOld;
-
- int aUndoLimit = theUndoLimit;
- if (theUndoLimit < 0) aUndoLimit = 0;
-
- Handle(TColStd_HSequenceOfAsciiString) aSeq = new TColStd_HSequenceOfAsciiString;
-
- if (myNbUndos > 0) { // remove undone
- anOld = 0;
- for(anIndex = 1; anIndex < myNbPostponed.Length() - myNbUndos; anIndex++)
- anOld += myNbPostponed(anIndex);
- int aNew = myPostponedIORs.Length() - myNbPostponed.Last();
-
- for(anIndex = anOld + 1; anIndex <= aNew; anIndex++) {
- TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
- if (anIOR.Value(1) == 'c') {
- aSeq->Append(anIOR.Split(1).ToCString());
- }
- }
- if (anOld < aNew) myPostponedIORs.Remove(anOld + 1, aNew);
- if (myNbPostponed.Length() > 0) myNbPostponed.Remove(myNbPostponed.Length() - myNbUndos, myNbPostponed.Length() - 1);
-
- myNbUndos = 0;
- }
-
- if (myNbPostponed.Length() > aUndoLimit) { // remove objects, that can not be undone
- anOld = 0;
- for(anIndex = myNbPostponed.Length() - aUndoLimit; anIndex >= 1; anIndex--)
- anOld += myNbPostponed(anIndex);
- for(anIndex = 1; anIndex <= anOld; anIndex++) {
- TCollection_AsciiString anIOR = myPostponedIORs(anIndex);
- if (anIOR.Value(1) == 'd') {
- aSeq->Append(anIOR.Split(1).ToCString());
- }
- }
- if (anOld > 0) myPostponedIORs.Remove(1, anOld);
- myNbPostponed.Remove(1, myNbPostponed.Length() - aUndoLimit);
- }
-
- if (theUndoLimit == -1) { // remove all IORs from the study on the study close
- TDF_ChildIDIterator anIter(_doc->GetData()->Root(), SALOMEDSImpl_AttributeIOR::GetID(), Standard_True);
- for(; anIter.More(); anIter.Next()) {
- Handle(SALOMEDSImpl_AttributeIOR) anAttr = Handle(SALOMEDSImpl_AttributeIOR)::DownCast(anIter.Value());
- aSeq->Append(anAttr->Value());
- }
- } else myNbPostponed.Append(0);
-
- return aSeq;
-}
-
-//============================================================================
-/*! Function : UndoPostponed
- * Purpose :
- */
-//============================================================================
-void SALOMEDSImpl_Study::UndoPostponed(const int theWay)
-{
- _errorCode = "";
-
- myNbUndos += theWay;
- // remove current postponed
- if (myNbPostponed.Last() > 0)
- myPostponedIORs.Remove(myPostponedIORs.Length() - myNbPostponed.Last() + 1, myPostponedIORs.Length());
- myNbPostponed(myNbPostponed.Length()) = 0;
+ _doc->GetApplication()->Close(_doc);
+ _doc = NULL;
+ _mapOfSO.clear();
+ _mapOfSCO.clear();
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TCollection_AsciiString& theEntry)
+SALOMEDSImpl_SComponent SALOMEDSImpl_Study::GetSComponent(const string& theEntry)
{
- Handle(SALOMEDSImpl_SComponent) aSCO;
- if(_mapOfSCO.IsBound(theEntry))
- aSCO = Handle(SALOMEDSImpl_SComponent)::DownCast(_mapOfSCO.Find(theEntry));
+ SALOMEDSImpl_SComponent aSCO;
+ if(_mapOfSCO.find(theEntry) != _mapOfSCO.end())
+ aSCO = _mapOfSCO[theEntry];
else {
- TDF_Label aLabel;
- TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
- aSCO = new SALOMEDSImpl_SComponent(aLabel);
- _mapOfSCO.Bind(theEntry, aSCO);
+ DF_Label aLabel = DF_Label::Label(_doc->Main(), theEntry);
+ aSCO = SALOMEDSImpl_SComponent(aLabel);
+ _mapOfSCO[theEntry] = aSCO;
}
return aSCO;
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_Study::GetSComponent(const TDF_Label& theLabel)
+SALOMEDSImpl_SComponent SALOMEDSImpl_Study::GetSComponent(const DF_Label& theLabel)
{
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theLabel, anEntry);
- return GetSComponent(anEntry);
+ return SALOMEDSImpl_SComponent(theLabel);
}
//============================================================================
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TCollection_AsciiString& theEntry)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::GetSObject(const string& theEntry)
{
- Handle(SALOMEDSImpl_SObject) aSO;
- if(_mapOfSO.IsBound(theEntry))
- aSO = Handle(SALOMEDSImpl_SObject)::DownCast(_mapOfSO.Find(theEntry));
+ SALOMEDSImpl_SObject aSO;
+ if(_mapOfSO.find(theEntry) != _mapOfSO.end())
+ aSO = _mapOfSO[theEntry];
else {
- TDF_Label aLabel;
- TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
- aSO = new SALOMEDSImpl_SObject(aLabel);
- _mapOfSO.Bind(theEntry, aSO);
+ DF_Label aLabel = DF_Label::Label(_doc->Main(), theEntry);
+ aSO = SALOMEDSImpl_SObject(aLabel);
+ _mapOfSO[theEntry] = aSO;
}
return aSO;
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_Study::GetSObject(const TDF_Label& theLabel)
+SALOMEDSImpl_SObject SALOMEDSImpl_Study::GetSObject(const DF_Label& theLabel)
{
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theLabel, anEntry);
- return GetSObject(anEntry);
+ return SALOMEDSImpl_SObject(theLabel);
}
//============================================================================
* Purpose :
*/
//============================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_Study::GetAttribute(const TCollection_AsciiString& theEntry,
- const TCollection_AsciiString& theType)
+DF_Attribute* SALOMEDSImpl_Study::GetAttribute(const string& theEntry,
+ const string& theType)
{
- Handle(SALOMEDSImpl_SObject) aSO = GetSObject(theEntry);
- Handle(TDF_Attribute) anAttr;
- aSO->FindAttribute(anAttr, theType);
+ SALOMEDSImpl_SObject aSO = GetSObject(theEntry);
+ DF_Attribute* anAttr;
+ aSO.FindAttribute(anAttr, theType);
return anAttr;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath,
- const TCollection_AsciiString& theBaseName,
+bool SALOMEDSImpl_Study::DumpStudy(const string& thePath,
+ const string& theBaseName,
bool isPublished,
SALOMEDSImpl_DriverFactory* theFactory)
{
return false;
}
- TColStd_SequenceOfExtendedString aSeq;
- TCollection_AsciiString aCompType, aFactoryType;
+ vector<string> aSeq;
+ string aCompType, aFactoryType;
//Build a list of all components in the Study
SALOMEDSImpl_SComponentIterator itcomponent = NewComponentIterator();
for (; itcomponent.More(); itcomponent.Next()) {
- Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value();
- aCompType = sco->ComponentDataType();
+ SALOMEDSImpl_SComponent sco = itcomponent.Value();
+ aCompType = sco.ComponentDataType();
//GEOM and MED are independent components
if (aCompType == "GEOM" || aCompType == "MED")
- aSeq.Prepend(TCollection_ExtendedString(aCompType));
+ aSeq.insert(aSeq.begin(), aCompType);
else
- aSeq.Append(TCollection_ExtendedString(aCompType));
+ aSeq.push_back(aCompType);
}
#ifdef WIN32
- TCollection_AsciiString aFileName =
- thePath + TCollection_AsciiString("\\") + theBaseName + TCollection_AsciiString(".py");
+ string aFileName =
+ thePath + string("\\") + theBaseName + string(".py");
#else
- TCollection_AsciiString aFileName =
- thePath + TCollection_AsciiString("/") + theBaseName + TCollection_AsciiString(".py");
+ string aFileName =
+ thePath + string("/") + theBaseName + string(".py");
#endif
//Create a file that will contain a main Study script
fstream fp;
- fp.open(aFileName.ToCString(), ios::out);
+ fp.open(aFileName.c_str(), ios::out);
#ifdef WIN32
bool isOpened = fp.is_open();
#endif
if(!isOpened) {
- _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName;
+ _errorCode = string("Can't create a file ")+aFileName;
return false;
}
- TCollection_AsciiString aBatchModeScript = "salome";
+ string aBatchModeScript = "salome";
//Output to the main Study script required Python modules import,
//set sys.path and add a creation of the study.
- fp << GetDumpStudyComment().ToCString() << endl << endl;
+ fp << GetDumpStudyComment() << endl << endl;
fp << "import sys" << endl;
fp << "import " << aBatchModeScript << endl << endl;
}
- Handle(TColStd_HSequenceOfAsciiString) aSeqOfFileNames = new TColStd_HSequenceOfAsciiString;
+ vector<string> aSeqOfFileNames;
//Iterate all components and create the componponents specific scripts.
bool isOk = true;
- int aLength = aSeq.Length();
+ int aLength = aSeq.size();
for(int i = 1; i <= aLength; i++) {
- aCompType = aSeq.Value(i);
- Handle(SALOMEDSImpl_SComponent) sco = FindComponent(aCompType);
+ aCompType = aSeq[i-1];
+ SALOMEDSImpl_SComponent sco = FindComponent(aCompType);
SALOMEDSImpl_Driver* aDriver = NULL;
// if there is an associated Engine call its method for saving
- TCollection_AsciiString IOREngine;
+ string IOREngine;
try {
- if (!sco->ComponentIOR(IOREngine)) {
- if (!aCompType.IsEmpty()) {
+ if (!sco.ComponentIOR(IOREngine)) {
+ if (!aCompType.empty()) {
aDriver = theFactory->GetDriverByType(aCompType);
if (aDriver != NULL) {
- Handle(SALOMEDSImpl_StudyBuilder) SB = NewBuilder();
+ SALOMEDSImpl_StudyBuilder* SB = NewBuilder();
if(!SB->LoadWith(sco, aDriver)) {
_errorCode = SB->GetErrorCode();
return false;
bool isValidScript;
long aStreamLength = 0;
- Handle(SALOMEDSImpl_TMPFile) aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength);
+ SALOMEDSImpl_TMPFile* aStream = aDriver->DumpPython(this, isPublished, isValidScript, aStreamLength);
if ( !isValidScript )
isOk = false;
//Create a file that will contain the component specific script
fstream fp2;
#ifdef WIN32
- aFileName=thePath+TCollection_AsciiString("\\");
+ aFileName=thePath+string("\\");
#else
- aFileName=thePath+TCollection_AsciiString("/");
+ aFileName=thePath+string("/");
#endif
- TCollection_AsciiString aScriptName;
+ string aScriptName;
aScriptName += theBaseName;
aScriptName += "_";
aScriptName += aCompType;
- aFileName += aScriptName+ TCollection_AsciiString(".py");
- aSeqOfFileNames->Append(aFileName);
+ aFileName += aScriptName+ string(".py");
+ aSeqOfFileNames.push_back(aFileName);
- fp2.open(aFileName.ToCString(), ios::out);
+ fp2.open(aFileName.c_str(), ios::out);
#ifdef WIN32
isOpened = fp2.is_open();
#endif
if(!isOpened) {
- _errorCode = TCollection_AsciiString("Can't create a file ")+aFileName;
+ _errorCode = string("Can't create a file ")+aFileName;
SALOMEDSImpl_Tool::RemoveTemporaryFiles(thePath, aSeqOfFileNames, false);
return false;
}
fp2 << aStream->Data();
fp2.close();
+ if(aStream) delete aStream;
+
//Add to the main script a call to RebuildData of the generated by the component the Python script
fp << "import " << aScriptName << endl;
fp << aScriptName << ".RebuildData(" << aBatchModeScript << ".myStudy)" << endl;
//purpose : return a header comment for a DumpStudy script
//=======================================================================
-TCollection_AsciiString SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName)
+string SALOMEDSImpl_Study::GetDumpStudyComment(const char* theComponentName)
{
- TCollection_AsciiString txt
+ string txt
("### This file is generated by SALOME automatically by dump python functionality");
if ( theComponentName )
- txt += TCollection_AsciiString(" of ") + (char*) theComponentName + " component";
+ txt += string(" of ") + (char*) theComponentName + " component";
return txt;
}
-void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO,
+void dumpSO(const SALOMEDSImpl_SObject& theSO,
fstream& fp,
- const TCollection_AsciiString& Tab,
- const Handle(SALOMEDSImpl_Study) theStudy);
+ const string& Tab,
+ SALOMEDSImpl_Study* theStudy);
+
//============================================================================
/*! Function : dump
* Purpose :
*/
//============================================================================
-void SALOMEDSImpl_Study::dump(const TCollection_AsciiString& theFileName)
+void SALOMEDSImpl_Study::dump(const string& theFileName)
{
//Create a file that will contain a main Study script
fstream fp;
- fp.open(theFileName.ToCString(), ios::out);
+ fp.open(theFileName.c_str(), ios::out);
#ifdef WIN32
bool isOpened = fp.is_open();
#endif
if(!isOpened) {
- _errorCode = TCollection_AsciiString("Can't create a file ")+theFileName;
+ _errorCode = string("Can't create a file ")+theFileName;
cout << "### SALOMEDSImpl_Study::dump Error: " << _errorCode << endl;
return;
}
- Handle(SALOMEDSImpl_SObject) aSO = FindObjectID("0:1");
+ SALOMEDSImpl_SObject aSO = FindObjectID("0:1");
fp << "0:1" << endl;
- Handle(SALOMEDSImpl_ChildIterator) Itr = NewChildIterator(aSO);
- TCollection_AsciiString aTab(" ");
- for(; Itr->More(); Itr->Next()) {
- dumpSO(Itr->Value(), fp, aTab, this);
+ SALOMEDSImpl_ChildIterator Itr = NewChildIterator(aSO);
+ string aTab(" ");
+ for(; Itr.More(); Itr.Next()) {
+ dumpSO(Itr.Value(), fp, aTab, this);
}
fp.close();
}
-void dumpSO(const Handle(SALOMEDSImpl_SObject)& theSO,
+void dumpSO(const SALOMEDSImpl_SObject& theSO,
fstream& fp,
- const TCollection_AsciiString& Tab,
- const Handle(SALOMEDSImpl_Study) theStudy)
+ const string& Tab,
+ SALOMEDSImpl_Study* theStudy)
{
- TCollection_AsciiString aTab(Tab), anID(theSO->GetID());
+ string aTab(Tab), anID(theSO.GetID());
fp << aTab << anID << endl;
- TDF_AttributeIterator anItr(theSO->GetLabel());
- for(; anItr.More(); anItr.Next()) {
- Handle(SALOMEDSImpl_GenericAttribute) anAttr = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anItr.Value());
+ vector<DF_Attribute*> attribs = theSO.GetLabel().GetAttributes();
+ for(int i = 0; i<attribs.size(); i++) {
+ SALOMEDSImpl_GenericAttribute* anAttr = dynamic_cast<SALOMEDSImpl_GenericAttribute*>(attribs[i]);
- if(anAttr.IsNull()) {
- fp << Tab << " -- " << anItr.Value()->DynamicType();
+ if(!anAttr) {
continue;
}
- TCollection_AsciiString aType = anAttr->GetClassType();
+ string aType = anAttr->GetClassType();
fp << Tab << " -- " << aType;
- if(aType == "AttributeReal") {
- fp << " : " << Handle(SALOMEDSImpl_AttributeReal)::DownCast(anAttr)->Value();
+ if(aType == string("AttributeReal")) {
+ fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeReal*>(anAttr)->Value();
}
- else if(aType == "AttributeInteger") {
- fp << " : " << Handle(SALOMEDSImpl_AttributeInteger)::DownCast(anAttr)->Value();
+ else if(aType == string("AttributeInteger")) {
+ fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeInteger*>(anAttr)->Value();
}
- else if(aType == "AttributeName") {
- fp << " : " << Handle(SALOMEDSImpl_AttributeName)::DownCast(anAttr)->Value();
+ else if(aType == string("AttributeName")) {
+ fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeName*>(anAttr)->Value();
}
- else if(aType == "AttributeComment") {
- fp << " : " << Handle(SALOMEDSImpl_AttributeComment)::DownCast(anAttr)->Value();
+ else if(aType == string("AttributeComment")) {
+ fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeComment*>(anAttr)->Value();
}
- else if(aType == "AttributeReference") {
- fp << " : " << Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr)->Save();
+ else if(aType == string("AttributeReference")) {
+ fp << " : " << dynamic_cast<SALOMEDSImpl_AttributeReference*>(anAttr)->Save();
}
fp << endl;
}
- Handle(SALOMEDSImpl_ChildIterator) Itr = theStudy->NewChildIterator(theSO);
- TCollection_AsciiString aNewTab(" ");
+ SALOMEDSImpl_ChildIterator Itr = theStudy->NewChildIterator(theSO);
+ string aNewTab(" ");
aNewTab+=aTab;
- for(; Itr->More(); Itr->Next()) {
- dumpSO(Itr->Value(), fp, aNewTab, theStudy);
+ for(; Itr.More(); Itr.Next()) {
+ dumpSO(Itr.Value(), fp, aNewTab, theStudy);
}
return;
void SALOMEDSImpl_Study::Modify()
{
_errorCode = "";
- _doc->Modify();
+ _doc->SetModified(true);
}
//============================================================================
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint)
+SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint)
{
if (theSavePoint < 0) return NULL;
- Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder();
- Handle(SALOMEDSImpl_SObject) so = FindComponent((char*)theID);
- if (so.IsNull()) so = builder->NewComponent((char*)theID);
- Handle(SALOMEDSImpl_AttributeParameter) attParam;
+ SALOMEDSImpl_StudyBuilder* builder = NewBuilder();
+ SALOMEDSImpl_SObject so = FindComponent((char*)theID);
+ if (!so) so = builder->NewComponent((char*)theID);
+ SALOMEDSImpl_AttributeParameter* attParam = NULL;
if (theSavePoint > 0) { // Try to find SObject that contains attribute parameter ...
- TDF_Label savePointLabel = so->GetLabel().FindChild( theSavePoint, /*create=*/0 );
+ DF_Label savePointLabel = so.GetLabel().FindChild( theSavePoint, /*create=*/0 );
if ( !savePointLabel.IsNull() )
so = GetSObject( savePointLabel );
else // ... if it does not exist - create a new one
so = builder->NewObjectToTag( so, theSavePoint );
}
- if (!so.IsNull()) {
- builder->FindAttribute(so, attParam, "AttributeParameter");
- if ( attParam.IsNull() ) { // first call of GetCommonParameters on "Interface Applicative" component
- Handle(TDF_Attribute) att = builder->FindOrCreateAttribute(so, "AttributeParameter");
- attParam = Handle(SALOMEDSImpl_AttributeParameter)::DownCast( att );
+ DF_Attribute* A;
+ if (so) {
+ builder->FindAttribute(so, A, "AttributeParameter");
+ if ( !A ) { // first call of GetCommonParameters on "Interface Applicative" component
+ A = builder->FindOrCreateAttribute(so, "AttributeParameter");
}
+ attParam = dynamic_cast<SALOMEDSImpl_AttributeParameter*>( A );
}
return attParam;
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetModuleParameters(const char* theID,
- const char* theModuleName,
- int theSavePoint)
+SALOMEDSImpl_AttributeParameter* SALOMEDSImpl_Study::GetModuleParameters(const char* theID,
+ const char* theModuleName,
+ int theSavePoint)
{
if(theSavePoint <= 0) return NULL;
- Handle(SALOMEDSImpl_AttributeParameter) main_ap = GetCommonParameters(theID, theSavePoint);
- Handle(SALOMEDSImpl_SObject) main_so = main_ap->GetSObject();
- Handle(SALOMEDSImpl_AttributeParameter) par;
+ SALOMEDSImpl_AttributeParameter* main_ap = GetCommonParameters(theID, theSavePoint);
+ SALOMEDSImpl_SObject main_so = main_ap->GetSObject();
+ SALOMEDSImpl_AttributeParameter* par = NULL;
- Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(main_so);
+ SALOMEDSImpl_ChildIterator it = NewChildIterator(main_so);
string moduleName(theModuleName);
- for(; it->More(); it->Next()) {
- Handle(SALOMEDSImpl_SObject) so(it->Value());
- Handle(SALOMEDSImpl_GenericAttribute) ga;
- if(so->FindAttribute(ga, "AttributeParameter")) {
- par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(ga);
+ for(; it.More(); it.Next()) {
+ SALOMEDSImpl_SObject so(it.Value());
+ if((par=(SALOMEDSImpl_AttributeParameter*)so.GetLabel().FindAttribute(SALOMEDSImpl_AttributeParameter::GetID()))) {
if(!par->IsSet("AP_MODULE_NAME", (Parameter_Types)3)) continue; //3 -> PT_STRING
if(par->GetString("AP_MODULE_NAME") == moduleName) return par;
}
}
- Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder();
- Handle(SALOMEDSImpl_SObject) so = builder->NewObject(main_so);
- par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(builder->FindOrCreateAttribute(so, "AttributeParameter"));
+ SALOMEDSImpl_StudyBuilder* builder = NewBuilder();
+ SALOMEDSImpl_SObject so = builder->NewObject(main_so);
+ par = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(builder->FindOrCreateAttribute(so, "AttributeParameter"));
par->SetString("AP_MODULE_NAME", moduleName);
return par;
}
//============================================================================
void SALOMEDSImpl_Study::SetStudyLock(const char* theLockerID)
{
- _lockers->Append(TCollection_AsciiString((char*)theLockerID));
+ _lockers.push_back(theLockerID);
}
//============================================================================
//============================================================================
bool SALOMEDSImpl_Study::IsStudyLocked()
{
- return (_lockers->Length() > 0);
+ return (_lockers.size() > 0);
}
//============================================================================
//============================================================================
void SALOMEDSImpl_Study::UnLockStudy(const char* theLockerID)
{
- int length = _lockers->Length(), pos = -1;
- TCollection_AsciiString id((char*)theLockerID);
- for(int i = 1; i<=length; i++) {
- if(id == _lockers->Value(i)) {
- pos = i;
+ vector<string>::iterator vsI = _lockers.begin();
+ int length = _lockers.size();
+ bool isFound = false;
+ string id(theLockerID);
+ for(int i = 0; i<length; i++, vsI++) {
+ if(id == _lockers[i]) {
+ isFound = true;;
break;
}
}
- if(pos > 0) _lockers->Remove(pos);
+ if(isFound) _lockers.erase(vsI);
}
//============================================================================
* Purpose :
*/
//============================================================================
-Handle(TColStd_HSequenceOfAsciiString) SALOMEDSImpl_Study::GetLockerID()
+vector<string> SALOMEDSImpl_Study::GetLockerID()
{
return _lockers;
}
_builder->SetOnRemoveSObject(NULL);
}
}
+
+//============================================================================
+/*! Function : GetIORs
+ * Purpose :
+ */
+//============================================================================
+vector<string> SALOMEDSImpl_Study::GetIORs()
+{
+ vector<string> anIORs;
+ map<string, DF_Label>::const_iterator MI;
+ for(MI = myIORLabels.begin(); MI!=myIORLabels.end(); MI++)
+ anIORs.push_back(MI->first);
+
+ return anIORs;
+}
#ifndef __SALOMEDSIMPL_STUDY_I_H__
#define __SALOMEDSIMPL_STUDY_I_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared )
-
// std C++ headers
#include <iostream>
+#include <string>
+#include <vector>
+#include <map>
// Cascade headers
-#include <TDocStd_Document.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_Label.hxx>
+#include "DF_Document.hxx"
+#include "DF_Label.hxx"
#include <stdio.h>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <NCollection_DataMap.hxx>
//SALOMEDSImpl headers
#include "SALOMEDSImpl_SComponentIterator.hxx"
class SALOMEDSImpl_StudyManager;
class SALOMEDSImpl_GenericAttribute;
-typedef NCollection_DataMap <TCollection_AsciiString, Handle_Standard_Transient> DataMapOfAsciiStringTransient;
-typedef NCollection_DataMap <TCollection_AsciiString, TDF_Label> DataMapAsciiStringLabel;
-class SALOMEDSImpl_Study : public MMgt_TShared
+class SALOMEDSImpl_Study
{
private:
- TCollection_AsciiString _name;
- Handle(TDocStd_Document) _doc; // OCAF Document
+ std::string _name;
+ DF_Document* _doc; // Document
bool _Saved; // True if the Study is saved
- TCollection_AsciiString _URL; //URL of the persistent reference of the study
+ std::string _URL; //URL of the persistent reference of the study
int _StudyId;
- TDF_Label _current;
+ DF_Label _current;
bool _autoFill;
- TCollection_AsciiString _errorCode;
- Handle(TColStd_HSequenceOfAsciiString) _lockers;
- Handle(SALOMEDSImpl_Callback) _cb;
- Handle(SALOMEDSImpl_StudyBuilder) _builder;
- Handle(SALOMEDSImpl_UseCaseBuilder) _useCaseBuilder;
-
- DataMapOfAsciiStringTransient _mapOfSO;
- DataMapOfAsciiStringTransient _mapOfSCO;
-
- // data structures for postponed destroying of object functionality
- TColStd_SequenceOfAsciiString myPostponedIORs; // ordered set of IORs
- TColStd_SequenceOfInteger myNbPostponed; // number of IOR in the each transaction
- int myNbUndos; // number of current Undos, made by user
- DataMapAsciiStringLabel myIORLabels;
+ std::string _errorCode;
+ std::vector<std::string> _lockers;
+ SALOMEDSImpl_Callback* _cb;
+ SALOMEDSImpl_StudyBuilder* _builder;
+ SALOMEDSImpl_UseCaseBuilder* _useCaseBuilder;
+
+ std::map<std::string, SALOMEDSImpl_SObject> _mapOfSO;
+ std::map<std::string, SALOMEDSImpl_SComponent> _mapOfSCO;
+ std::map<std::string, DF_Label> myIORLabels;
- Handle(SALOMEDSImpl_SObject) _FindObject(const Handle(SALOMEDSImpl_SObject)& SO,
- const TCollection_AsciiString& anObjectName,
- bool& _find);
+ SALOMEDSImpl_SObject _FindObject(const SALOMEDSImpl_SObject& SO,
+ const std::string& anObjectName,
+ bool& _find);
- Handle(SALOMEDSImpl_SObject) _FindObjectIOR(const Handle(SALOMEDSImpl_SObject)& SO,
- const TCollection_AsciiString& anObjectIOR,
- bool& _find);
+ SALOMEDSImpl_SObject _FindObjectIOR(const SALOMEDSImpl_SObject& SO,
+ const std::string& anObjectIOR,
+ bool& _find);
public:
- Standard_EXPORT static Handle(SALOMEDSImpl_Study) GetStudy(const TDF_Label& theLabel);
- Standard_EXPORT static Handle(SALOMEDSImpl_SObject) SObject(const TDF_Label& theLabel);
- Standard_EXPORT static Handle(SALOMEDSImpl_SComponent) SComponent(const TDF_Label& theLabel);
- Standard_EXPORT static void IORUpdated(const Handle(SALOMEDSImpl_AttributeIOR)& theAttribute);
+ 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);
//! standard constructor
- Standard_EXPORT SALOMEDSImpl_Study(const Handle(TDocStd_Document)&, const TCollection_AsciiString& study_name);
+ Standard_EXPORT SALOMEDSImpl_Study(const DF_Document*, const std::string& study_name);
//! standard destructor
Standard_EXPORT virtual ~SALOMEDSImpl_Study();
//! method to Get persistent reference of study (idem URL())
- Standard_EXPORT virtual TCollection_AsciiString GetPersistentReference();
+ Standard_EXPORT virtual std::string GetPersistentReference();
//! method to Get transient reference of study
- Standard_EXPORT virtual TCollection_AsciiString GetTransientReference();
+ Standard_EXPORT virtual std::string GetTransientReference();
- Standard_EXPORT virtual void SetTransientReference(const TCollection_AsciiString& theIOR);
+ Standard_EXPORT virtual void SetTransientReference(const std::string& theIOR);
//! method to detect if a study is empty
Standard_EXPORT virtual bool IsEmpty();
//! method to Find a Component with ComponentDataType = aComponentName
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) FindComponent (const TCollection_AsciiString& aComponentName);
+ Standard_EXPORT virtual SALOMEDSImpl_SComponent FindComponent (const std::string& aComponentName);
//! method to Find a Component Find a Component from it's ID
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) FindComponentID(const TCollection_AsciiString& aComponentID);
+ Standard_EXPORT virtual SALOMEDSImpl_SComponent FindComponentID(const std::string& aComponentID);
//! method to Find an Object with SALOMEDSImpl::Name = anObjectName
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObject(const TCollection_AsciiString& anObjectName);
+ Standard_EXPORT 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 Handle(TColStd_HSequenceOfTransient) FindObjectByName( const TCollection_AsciiString& anObjectName,
- const TCollection_AsciiString& aComponentName ) ;
+ Standard_EXPORT 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 Handle(SALOMEDSImpl_SObject) FindObjectID(const TCollection_AsciiString& anObjectID);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectID(const std::string& anObjectID);
//! method to Create an Object with ID = anObjectID
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) CreateObjectID(const TCollection_AsciiString& anObjectID);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject CreateObjectID(const std::string& anObjectID);
//! method to Find an Object with ID = anObjectIOR
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectIOR(const TCollection_AsciiString& anObjectIOR);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectIOR(const std::string& anObjectIOR);
//! method to Find an Object by its path
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) FindObjectByPath(const TCollection_AsciiString& thePath);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject FindObjectByPath(const std::string& thePath);
//! method to get a path of SObject
- Standard_EXPORT virtual TCollection_AsciiString GetObjectPath(const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual std::string GetObjectPath(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT TCollection_AsciiString GetObjectPathByIOR(const TCollection_AsciiString& theIOR);
+ Standard_EXPORT std::string GetObjectPathByIOR(const std::string& theIOR);
//! method to set a context: root ('/') is UserData component
- Standard_EXPORT virtual bool SetContext(const TCollection_AsciiString& thePath);
+ Standard_EXPORT virtual bool SetContext(const std::string& thePath);
//! method to get a context
- Standard_EXPORT virtual TCollection_AsciiString GetContext();
+ Standard_EXPORT 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 Handle(TColStd_HSequenceOfAsciiString) GetObjectNames(const TCollection_AsciiString& theContext);
+ Standard_EXPORT 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 Handle(TColStd_HSequenceOfAsciiString) GetDirectoryNames(const TCollection_AsciiString& theContext);
+ Standard_EXPORT 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 Handle(TColStd_HSequenceOfAsciiString) GetFileNames(const TCollection_AsciiString& theContext);
+ Standard_EXPORT virtual std::vector<std::string> GetFileNames(const std::string& theContext);
//! method to get all components names
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetComponentNames(const TCollection_AsciiString& theContext);
+ Standard_EXPORT virtual std::vector<std::string> GetComponentNames(const std::string& theContext);
//! method to Create a ChildIterator from an SObject
- Standard_EXPORT virtual Handle(SALOMEDSImpl_ChildIterator) NewChildIterator(const Handle(SALOMEDSImpl_SObject)& aSO);
+ Standard_EXPORT virtual SALOMEDSImpl_ChildIterator NewChildIterator(const SALOMEDSImpl_SObject& aSO);
//! method to Create a SComponentIterator
Standard_EXPORT virtual SALOMEDSImpl_SComponentIterator NewComponentIterator();
//! method to Create a StudyBuilder
- Standard_EXPORT virtual Handle(SALOMEDSImpl_StudyBuilder) NewBuilder();
+ Standard_EXPORT virtual SALOMEDSImpl_StudyBuilder* NewBuilder();
//! method to get study name
- Standard_EXPORT virtual TCollection_AsciiString Name();
+ Standard_EXPORT virtual std::string Name();
//! method to set study name
- Standard_EXPORT virtual void Name(const TCollection_AsciiString& name);
+ Standard_EXPORT virtual void Name(const std::string& name);
//! method to get if study has been saved
Standard_EXPORT virtual bool IsSaved();
Standard_EXPORT virtual bool IsModified();
//! method to get URL of the study (idem GetPersistentReference)
- Standard_EXPORT virtual TCollection_AsciiString URL();
+ Standard_EXPORT virtual std::string URL();
//! method to set URL of the study
- Standard_EXPORT virtual void URL(const TCollection_AsciiString& url);
+ Standard_EXPORT virtual void URL(const std::string& url);
Standard_EXPORT virtual bool IsLocked();
Standard_EXPORT virtual void StudyId(int id);
- Standard_EXPORT virtual void UpdateIORLabelMap(const TCollection_AsciiString& anIOR, const TCollection_AsciiString& aLabel);
+ Standard_EXPORT virtual void UpdateIORLabelMap(const std::string& anIOR, const std::string& aLabel);
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) FindDependances(const Handle(SALOMEDSImpl_SObject)& anObject);
+ Standard_EXPORT virtual std::vector<SALOMEDSImpl_SObject> FindDependances(const SALOMEDSImpl_SObject& anObject);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_AttributeStudyProperties) GetProperties();
+ Standard_EXPORT virtual SALOMEDSImpl_AttributeStudyProperties* GetProperties();
- Standard_EXPORT virtual TCollection_AsciiString GetLastModificationDate();
+ Standard_EXPORT virtual std::string GetLastModificationDate();
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) GetModificationsDate();
+ Standard_EXPORT virtual std::vector<std::string> GetModificationsDate();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_UseCaseBuilder) GetUseCaseBuilder();
+ Standard_EXPORT virtual SALOMEDSImpl_UseCaseBuilder* GetUseCaseBuilder();
Standard_EXPORT virtual void Close();
Standard_EXPORT void EnableUseCaseAutoFilling(bool isEnabled);
- // postponed destroying of object functionality
- Standard_EXPORT virtual void AddPostponed(const TCollection_AsciiString& theIOR);
-
- Standard_EXPORT virtual void AddCreatedPostponed(const TCollection_AsciiString& theIOR);
-
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfAsciiString) RemovePostponed(const int theUndoLimit);
- // removes postponed IORs of old transaction
- // if theUndoLimit==0, removes all
- Standard_EXPORT virtual void UndoPostponed(const int theWay); // theWay = 1: resurrect objects,
- // theWay = -1: get back to the list of postponed
-
-
- Standard_EXPORT virtual TCollection_AsciiString GetErrorCode() { return _errorCode; }
+ Standard_EXPORT virtual std::string GetErrorCode() { return _errorCode; }
Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) GetSComponent(const TCollection_AsciiString& theEntry);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) GetSComponent(const TDF_Label& theLabel);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetSObject(const TCollection_AsciiString& theEntry);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetSObject(const TDF_Label& theEntryLabel);
- Standard_EXPORT virtual Handle(TDF_Attribute) GetAttribute(const TCollection_AsciiString& theEntry,
- const TCollection_AsciiString& theType);
+ 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,
+ const std::string& theType);
Standard_EXPORT virtual bool HasCurrentContext() { return !_current.IsNull(); }
- Standard_EXPORT virtual bool DumpStudy(const TCollection_AsciiString& thePath,
- const TCollection_AsciiString& theBaseName,
+ Standard_EXPORT virtual bool DumpStudy(const std::string& thePath,
+ const std::string& theBaseName,
bool isPublished,
SALOMEDSImpl_DriverFactory* theFactory);
- Standard_EXPORT static TCollection_AsciiString GetDumpStudyComment(const char* theComponentName = 0);
+ Standard_EXPORT static std::string GetDumpStudyComment(const char* theComponentName = 0);
- Standard_EXPORT virtual Handle(TDocStd_Document) GetDocument() { return _doc; }
+ Standard_EXPORT 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 TCollection_AsciiString& theFileName);
+ Standard_EXPORT void dump(const std::string& theFileName);
//This method marks the study as being modified
Standard_EXPORT void Modify();
- Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetCommonParameters(const char* theID, int theSavePoint);
+ Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetCommonParameters(const char* theID, int theSavePoint);
- Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetModuleParameters(const char* theID,
+ Standard_EXPORT SALOMEDSImpl_AttributeParameter* GetModuleParameters(const char* theID,
const char* theModuleName,
int theSavePoint);
Standard_EXPORT void UnLockStudy(const char* theLockerID);
//Returns an ID of the study locker
- Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetLockerID();
+ Standard_EXPORT std::vector<std::string> GetLockerID();
//Returns a callback
- Standard_EXPORT Handle(SALOMEDSImpl_Callback) GetCallback() { return _cb; }
+ Standard_EXPORT SALOMEDSImpl_Callback* GetCallback() { return _cb; }
+ //Returns a list of IOR's stored in the study
+ Standard_EXPORT std::vector<std::string> GetIORs();
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_Study )
friend class SALOMEDSImpl_StudyManager;
friend class SALOMEDSImpl_GenericAttribute;
#include "SALOMEDSImpl_Attributes.hxx"
-
-using namespace std;
-
#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDSImpl_StudyBuilder.hxx"
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_SComponent.hxx"
#include "SALOMEDSImpl_Tool.hxx"
+#include "SALOMEDSImpl_ChildNodeIterator.hxx"
-#include <SALOMEDSImpl_ChildNodeIterator.hxx>
-
-#include <TDF_ChildIterator.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_ListIteratorOfAttributeList.hxx>
-
-#include <OSD_Path.hxx>
+#include "DF_ChildIterator.hxx"
+#include "DF_Label.hxx"
#include <HDFOI.hxx>
#include <stdlib.h>
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyBuilder, MMgt_TShared )
+using namespace std;
#define USE_CASE_LABEL_TAG 2
#define DIRECTORYID 16661
#define FILELOCALID 26662
-static void Translate_persistentID_to_IOR(TDF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII);
+static void Translate_persistentID_to_IOR(DF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII);
//============================================================================
/*! Function : constructor
* Purpose :
*/
//============================================================================
-SALOMEDSImpl_StudyBuilder::SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner)
+SALOMEDSImpl_StudyBuilder::SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner)
{
_errorCode = "";
- _study = theOwner;
- _doc = Handle(SALOMEDSImpl_Study)::DownCast(theOwner)->GetDocument();
+ _callbackOnAdd=NULL;
+ _callbackOnRemove = NULL;
+ _study = (SALOMEDSImpl_Study*)theOwner;
+ _doc = _study->GetDocument();
}
//============================================================================
* Purpose : Create a new component (Scomponent)
*/
//============================================================================
-Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_StudyBuilder::NewComponent(const TCollection_AsciiString& DataType)
+SALOMEDSImpl_SComponent SALOMEDSImpl_StudyBuilder::NewComponent(const string& DataType)
{
_errorCode = "";
CheckLocked();
- if(DataType.Length() == 0) return 0;
+ SALOMEDSImpl_SComponent sco;
+
+ if(DataType.size() == 0) return sco;
//Always create component under main label.
- TDF_Label L = _doc->Main();
+ DF_Label L = _doc->Main();
- int imax = 0;
- for (TDF_ChildIterator it(L); it.More(); it.Next()) {
- if (it.Value().Tag() > imax)
- imax = it.Value().Tag();
- }
- imax++;
- TDF_Label NL = L.FindChild(imax);
+ DF_Label NL = L.NewChild();
SALOMEDSImpl_AttributeComment::Set(NL, DataType);
- Handle(SALOMEDSImpl_SComponent) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSComponent (NL);
+ SALOMEDSImpl_SComponent so = _study->GetSComponent (NL);
- if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so);
+ if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so);
- _doc->Modify();
+ _doc->SetModified(true);
return so;
}
* Purpose : Add IOR attribute of a Scomponent
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::DefineComponentInstance(const Handle(SALOMEDSImpl_SComponent)& aComponent,
- const TCollection_AsciiString& IOR)
+bool SALOMEDSImpl_StudyBuilder::DefineComponentInstance(const SALOMEDSImpl_SComponent& aComponent,
+ const string& IOR)
{
_errorCode = "";
CheckLocked();
- if(aComponent.IsNull() || IOR.IsEmpty()) {
+ if(!aComponent || IOR.empty()) {
_errorCode = "Invalid arguments";
return false;
}
//add IOR definition
- SALOMEDSImpl_AttributeIOR::Set(aComponent->GetLabel(), IOR);
-
- //_doc->Modify();
+ SALOMEDSImpl_AttributeIOR::Set(aComponent.GetLabel(), IOR);
return true;
}
* Purpose : Delete a Scomponent
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent)
+bool SALOMEDSImpl_StudyBuilder::RemoveComponent(const SALOMEDSImpl_SComponent& aComponent)
{
_errorCode = "";
CheckLocked();
* Purpose : Create a new SObject
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject)
+SALOMEDSImpl_SObject SALOMEDSImpl_StudyBuilder::NewObject(const SALOMEDSImpl_SObject& theFatherObject)
{
- _errorCode = "";
+ _errorCode = "";
CheckLocked();
//Find label of father
- TDF_Label Lab = theFatherObject->GetLabel();
+ DF_Label Lab = theFatherObject.GetLabel();
//Create a new label
- int imax = 0;
- for (TDF_ChildIterator it(Lab); it.More(); it.Next()) {
- if (it.Value().Tag() > imax)
- imax = it.Value().Tag();
- }
- imax++;
- TDF_Label NewLab = Lab.FindChild(imax);
+ DF_Label NewLab = Lab.NewChild();
- Handle(SALOMEDSImpl_SObject) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSObject(NewLab);
- if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so);
+ SALOMEDSImpl_SObject so = _study->GetSObject(NewLab);
+ if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so);
- _doc->Modify();
+ _doc->SetModified(true);
return so;
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyBuilder::NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject,
- const int theTag)
+SALOMEDSImpl_SObject SALOMEDSImpl_StudyBuilder::NewObjectToTag(const SALOMEDSImpl_SObject& theFatherObject,
+ const int theTag)
{
_errorCode = "";
CheckLocked();
//Find label of father
- TDF_Label Lab = theFatherObject->GetLabel();
+ DF_Label Lab = theFatherObject.GetLabel();
//Create or find label
- TDF_Label NewLab = Lab.FindChild(theTag, 1);
+ DF_Label NewLab = Lab.FindChild(theTag, 1);
- Handle(SALOMEDSImpl_SObject) so = Handle(SALOMEDSImpl_Study)::DownCast(_study)->GetSObject(NewLab);
+ SALOMEDSImpl_SObject so = _study->GetSObject(NewLab);
- if(!_callbackOnAdd.IsNull()) _callbackOnAdd->OnAddSObject(so);
+ if(_callbackOnAdd) _callbackOnAdd->OnAddSObject(so);
- _doc->Modify();
+ _doc->SetModified(true);
return so;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::RemoveObject(const Handle(SALOMEDSImpl_SObject)& anObject)
+bool SALOMEDSImpl_StudyBuilder::RemoveObject(const SALOMEDSImpl_SObject& anObject)
{
_errorCode = "";
CheckLocked();
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Null object";
return false;
}
- if(!_callbackOnRemove.IsNull()) _callbackOnRemove->OnRemoveSObject(anObject);
+ if(_callbackOnRemove) _callbackOnRemove->OnRemoveSObject(anObject);
- TDF_Label Lab = anObject->GetLabel();
+ DF_Label Lab = anObject.GetLabel();
- Handle(SALOMEDSImpl_AttributeReference) aReference;
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aReference)) {
- Handle(SALOMEDSImpl_AttributeTarget) aTarget;
- if (aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),aTarget))
+ SALOMEDSImpl_AttributeReference* aReference = NULL;
+ if ((aReference=(SALOMEDSImpl_AttributeReference*)Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
+ SALOMEDSImpl_AttributeTarget* aTarget = NULL;
+ if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID())))
aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab));
}
- Handle(SALOMEDSImpl_AttributeIOR) anAttr; // postponed removing of CORBA objects
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(TCollection_AsciiString(anAttr->Value()).ToCString());
+ SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map
+ if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ }
Lab.ForgetAllAttributes();
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const Handle(SALOMEDSImpl_SObject)& anObject)
+bool SALOMEDSImpl_StudyBuilder::RemoveObjectWithChildren(const SALOMEDSImpl_SObject& anObject)
{
_errorCode = "";
CheckLocked();
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Null object";
return false;
}
- if(!_callbackOnRemove.IsNull()) _callbackOnRemove->OnRemoveSObject(anObject);
+ if(_callbackOnRemove) _callbackOnRemove->OnRemoveSObject(anObject);
- TDF_Label Lab = anObject->GetLabel();
+ DF_Label Lab = anObject.GetLabel();
- Handle(SALOMEDSImpl_AttributeReference) aReference;
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aReference)) {
- Handle(SALOMEDSImpl_AttributeTarget) aTarget;
- if (aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),aTarget))
+ SALOMEDSImpl_AttributeReference* aReference = NULL;
+ if ((aReference=(SALOMEDSImpl_AttributeReference*)Lab.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
+ SALOMEDSImpl_AttributeTarget* aTarget = NULL;
+ if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID())))
aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab));
}
- Handle(SALOMEDSImpl_AttributeIOR) anAttr; // postponed removing of CORBA objects
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(TCollection_AsciiString(anAttr->Value()).ToCString());
+ SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map
+ if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ }
- TDF_ChildIterator it(Lab, Standard_True);
+ DF_ChildIterator it(Lab, true);
for(;it.More();it.Next()) {
- TDF_Label aLabel = it.Value();
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aReference)) {
- Handle(SALOMEDSImpl_AttributeTarget) aTarget;
- if (aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(),aTarget))
+ DF_Label aLabel = it.Value();
+ if ((aReference=(SALOMEDSImpl_AttributeReference*)aLabel.FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
+ SALOMEDSImpl_AttributeTarget* aTarget = NULL;
+ if ((aTarget=(SALOMEDSImpl_AttributeTarget*)aReference->Get().FindAttribute(SALOMEDSImpl_AttributeTarget::GetID())))
aTarget->Remove(SALOMEDSImpl_Study::SObject(aLabel));
}
- Handle(SALOMEDSImpl_AttributeIOR) anAttr; // postponed removing of CORBA objects
- if (aLabel.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(TCollection_AsciiString(anAttr->Value()).ToCString());
+ SALOMEDSImpl_AttributeIOR* anAttr = NULL; //Remove from IORLabel map
+ if ((anAttr=(SALOMEDSImpl_AttributeIOR*)aLabel.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ }
}
- Lab.ForgetAllAttributes(Standard_True);
+ Lab.ForgetAllAttributes(true);
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::LoadWith(const Handle(SALOMEDSImpl_SComponent)& anSCO,
+bool SALOMEDSImpl_StudyBuilder::LoadWith(const SALOMEDSImpl_SComponent& anSCO,
SALOMEDSImpl_Driver* aDriver)
{
_errorCode = "";
- TDF_Label Lab = anSCO->GetLabel();
- Handle(SALOMEDSImpl_AttributePersistentRef) Att;
+ DF_Label Lab = anSCO.GetLabel();
+ SALOMEDSImpl_AttributePersistentRef* Att = NULL;
//Find the current Url of the study
- if (_doc->Main().FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),Att)) {
- int aLocked = anSCO->GetStudy()->GetProperties()->IsLocked();
- if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(false);
+ if ((Att=(SALOMEDSImpl_AttributePersistentRef*)_doc->Main().FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
+ int aLocked = _study->GetProperties()->IsLocked();
+ if (aLocked) _study->GetProperties()->SetLocked(false);
- TCollection_ExtendedString Res(Att->Value());
- TCollection_AsciiString aHDFPath(Res);
+ std::string Res(Att->Value());
+ string aHDFPath(Res);
- Handle(SALOMEDSImpl_AttributeComment) type;
- TCollection_ExtendedString DataType;
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(),type))
+ SALOMEDSImpl_AttributeComment* type = NULL;
+ std::string DataType;
+ if ((type=(SALOMEDSImpl_AttributeComment*)Lab.FindAttribute(SALOMEDSImpl_AttributeComment::GetID())))
DataType = type->Value();
// associate the driver to the SComponent
}
// mpv 06.03.2003: SAL1927 - if component data if already loaded, it is not necessary to do it again
- Handle(SALOMEDSImpl_AttributeIOR) attrIOR;
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), attrIOR)) {
- if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
+ SALOMEDSImpl_AttributeIOR* attrIOR = NULL;
+ if ((attrIOR=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ if (aLocked) _study->GetProperties()->SetLocked(true);
return true;
}
DefineComponentInstance (anSCO, aDriver->GetIOR());
- TCollection_AsciiString aHDFUrl;
+ string aHDFUrl;
bool isASCII = false;
- if (HDFascii::isASCII(aHDFPath.ToCString())) {
+ if (HDFascii::isASCII(aHDFPath.c_str())) {
isASCII = true;
- aHDFUrl = HDFascii::ConvertFromASCIIToHDF(aHDFPath.ToCString());
+ aHDFUrl = HDFascii::ConvertFromASCIIToHDF(aHDFPath.c_str());
aHDFUrl += "hdf_from_ascii.hdf";
} else {
aHDFUrl = aHDFPath;
}
//Open the Study HDF file
- HDFfile *hdf_file = new HDFfile(aHDFUrl.ToCString());
+ HDFfile *hdf_file = new HDFfile((char*)aHDFUrl.c_str());
char aMultifileState[2];
char ASCIIfileState[2];
try {
- TCollection_AsciiString scoid = anSCO->GetID();
+ string scoid = anSCO.GetID();
hdf_file->OpenOnDisk(HDF_RDONLY);
HDFgroup *hdf_group = new HDFgroup("DATACOMPONENT",hdf_file);
hdf_group->OpenOnDisk();
- HDFgroup *hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group);
+ HDFgroup *hdf_sco_group = new HDFgroup((char*)scoid.c_str(), hdf_group);
hdf_sco_group->OpenOnDisk();
unsigned char* aStreamFile = NULL;
ascii_hdf_dataset->OpenOnDisk();
ascii_hdf_dataset->ReadFromDisk(ASCIIfileState);
- // set path without file name from URL
- //int aFileNameSize = Res.Length();
- //char* aDir = new char[aFileNameSize];
- //memcpy(aDir, TCollection_AsciiString(Res).ToCString(), aFileNameSize);
- //for(int aCounter = aFileNameSize-1; aCounter>=0; aCounter--)
- //if (aDir[aCounter] == '/') {
- // aDir[aCounter+1] = 0;
- // break;
- //}
- // Above code was working wrong for paths without '/' inside.
- TCollection_AsciiString aDir = SALOMEDSImpl_Tool::GetDirFromPath(Res);
+ string aDir = SALOMEDSImpl_Tool::GetDirFromPath(Res);
bool aResult = (ASCIIfileState[0]=='A')?
- aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir.ToCString(), aMultifileState[0]=='M'):
- aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir.ToCString(), aMultifileState[0]=='M');
+ aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir.c_str(), aMultifileState[0]=='M'):
+ aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir.c_str(), aMultifileState[0]=='M');
if(aStreamFile != NULL) delete []aStreamFile;
delete hdf_file;
if (isASCII) {
- Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
- aFilesToRemove->Append("hdf_from_ascii.hdf");
+ vector<string> aFilesToRemove;
+ aFilesToRemove.push_back("hdf_from_ascii.hdf");
SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl),
aFilesToRemove, true);
}
delete hdf_file;
if (isASCII) {
- Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
- aFilesToRemove->Append(aHDFUrl);
+ vector<string> aFilesToRemove;
+ aFilesToRemove.push_back(aHDFUrl);
SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
}
- if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
+ if (aLocked) _study->GetProperties()->SetLocked(true);
_errorCode = "No persistent file";
return false;
}
return false;
}
- if (aLocked) anSCO->GetStudy()->GetProperties()->SetLocked(true);
+ if (aLocked) _study->GetProperties()->SetLocked(true);
} else {
_errorCode = "No persistent file";
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::Load(const Handle(SALOMEDSImpl_SObject)& sco)
+bool SALOMEDSImpl_StudyBuilder::Load(const SALOMEDSImpl_SObject& sco)
{
_errorCode = "Not implemented";
return false;
* existing one
*/
//============================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
- const TCollection_AsciiString& aTypeOfAttribute)
+DF_Attribute* SALOMEDSImpl_StudyBuilder::FindOrCreateAttribute(const SALOMEDSImpl_SObject& anObject,
+ const string& aTypeOfAttribute)
{
_errorCode = "";
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Invalid arguments";
return NULL;
}
- TDF_Label Lab = anObject->GetLabel();
+ DF_Label Lab = anObject.GetLabel();
if(Lab.IsNull()) {
_errorCode = "Null label";
return NULL;
}
- _doc->Modify();
+ _doc->SetModified(true);
//The macro adds all necessary checks for standardly behaiving attributes
__FindOrCreateAttributeForBuilder
//Add checks for TreeNode and UserID attributes
- if (strncmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode",17) == 0 ) {
+ if (strncmp(aTypeOfAttribute.c_str(), "AttributeTreeNode",17) == 0 ) {
- Standard_GUID aTreeNodeGUID;
- if (strcmp(aTypeOfAttribute.ToCString(), "AttributeTreeNode") == 0) {
+ string aTreeNodeGUID;
+ if (strcmp(aTypeOfAttribute.c_str(), "AttributeTreeNode") == 0) {
aTreeNodeGUID = SALOMEDSImpl_AttributeTreeNode::GetDefaultTreeID();
} else {
- char* aGUIDString = new char[41];
- char* aType = (char*)aTypeOfAttribute.ToCString();
- sprintf(aGUIDString, &(aType[17]));
- if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) {
- delete(aGUIDString);
- return NULL;
- }
- aTreeNodeGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
- delete(aGUIDString);
+ aTreeNodeGUID = aTypeOfAttribute.substr(21, aTypeOfAttribute.size()); // create tree node GUID by name
}
- Handle(SALOMEDSImpl_AttributeTreeNode) anAttr;
- if (!Lab.FindAttribute(aTreeNodeGUID, anAttr)) {
+ SALOMEDSImpl_AttributeTreeNode* anAttr = NULL;
+ if (!(anAttr=(SALOMEDSImpl_AttributeTreeNode*)Lab.FindAttribute(aTreeNodeGUID))) {
CheckLocked();
anAttr = SALOMEDSImpl_AttributeTreeNode::Set(Lab, aTreeNodeGUID);
}
return anAttr;
}
- if (strncmp(aTypeOfAttribute.ToCString(), "AttributeUserID",15) == 0 ) {
- Standard_GUID aUserGUID;
- if (strcmp(aTypeOfAttribute.ToCString(), "AttributeUserID") == 0) {
+ if (strncmp(aTypeOfAttribute.c_str(), "AttributeUserID",15) == 0 ) {
+ std::string aUserGUID;
+ if (strcmp(aTypeOfAttribute.c_str(), "AttributeUserID") == 0) {
aUserGUID = SALOMEDSImpl_AttributeUserID::DefaultID();
} else {
- char* aGUIDString = new char[41];
- char* aType = (char*)aTypeOfAttribute.ToCString();
- sprintf(aGUIDString, &(aType[15]));
- if(!Standard_GUID::CheckGUIDFormat(aGUIDString)) {
- delete(aGUIDString);
- return NULL;
- }
- aUserGUID = Standard_GUID(aGUIDString); // create tree node GUID by name
- delete(aGUIDString);
+ aUserGUID = aTypeOfAttribute.substr(15, aTypeOfAttribute.size()); // create tree node GUID by name
}
- Handle(SALOMEDSImpl_AttributeUserID) anAttr;
- if (!Lab.FindAttribute(SALOMEDSImpl_AttributeUserID::DefaultID(), anAttr)) {
+ SALOMEDSImpl_AttributeUserID* anAttr = NULL;
+ if (!(anAttr=(SALOMEDSImpl_AttributeUserID*)Lab.FindAttribute(aUserGUID))) {
CheckLocked();
anAttr = SALOMEDSImpl_AttributeUserID::Set(Lab, aUserGUID);
}
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::FindAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
- Handle(TDF_Attribute)& anAttribute,
- const TCollection_AsciiString& aTypeOfAttribute)
+bool SALOMEDSImpl_StudyBuilder::FindAttribute(const SALOMEDSImpl_SObject& anObject,
+ DF_Attribute*& anAttribute,
+ const string& aTypeOfAttribute)
{
_errorCode = "";
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Invalid arguments";
return false;
}
- TDF_Label Lab = anObject->GetLabel();
- if (Lab.FindAttribute(SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute), anAttribute)) {
+ DF_Label Lab = anObject.GetLabel();
+ if ((anAttribute=Lab.FindAttribute(SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute)))) {
// commented out because NO MODIFICATION is done to attributes when calling FindAttribute()
// _doc->Modify();
- return Standard_True;
+ return true;
}
- return Standard_False;
+ return false;
}
//============================================================================
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
- const TCollection_AsciiString& aTypeOfAttribute)
+bool SALOMEDSImpl_StudyBuilder::RemoveAttribute(const SALOMEDSImpl_SObject& anObject,
+ const string& aTypeOfAttribute)
{
_errorCode = "";
CheckLocked();
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Invalid arguments";
return false;
}
- TDF_Label Lab = anObject->GetLabel();
+ DF_Label Lab = anObject.GetLabel();
- if (aTypeOfAttribute == "AttributeIOR") { // postponed removing of CORBA objects
- Handle(SALOMEDSImpl_AttributeIOR) anAttr;
- if (Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), anAttr))
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->AddPostponed(anAttr->Value());
+ if (aTypeOfAttribute == string("AttributeIOR")) { // Remove from IORLabel map
+ SALOMEDSImpl_AttributeIOR* anAttr = NULL;
+ if ((anAttr=(SALOMEDSImpl_AttributeIOR*)Lab.FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
+ }
}
Lab.ForgetAttribute (SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute));
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::Addreference(const Handle(SALOMEDSImpl_SObject)& me,
- const Handle(SALOMEDSImpl_SObject)& theReferencedObject)
+bool SALOMEDSImpl_StudyBuilder::Addreference(const SALOMEDSImpl_SObject& me,
+ const SALOMEDSImpl_SObject& theReferencedObject)
{
_errorCode = "";
- if(me.IsNull() || theReferencedObject.IsNull()) {
+ if(!me || !theReferencedObject) {
_errorCode = "Invalid arguments";
return false;
}
CheckLocked();
- TDF_Label Lab = me->GetLabel();
- TDF_Label RefLab = theReferencedObject->GetLabel();
+ DF_Label Lab = me.GetLabel();
+ DF_Label RefLab = theReferencedObject.GetLabel();
SALOMEDSImpl_AttributeReference::Set(Lab,RefLab);
SALOMEDSImpl_AttributeTarget::Set(RefLab)->Add(SALOMEDSImpl_Study::SObject(Lab));
- if(!_callbackOnRemove.IsNull() && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me);
+ if(_callbackOnRemove && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::RemoveReference(const Handle(SALOMEDSImpl_SObject)& me)
+bool SALOMEDSImpl_StudyBuilder::RemoveReference(const SALOMEDSImpl_SObject& me)
{
_errorCode = "";
- Handle(SALOMEDSImpl_SObject) theReferencedObject;
- if(!me->ReferencedObject(theReferencedObject)) return false; //No reference is found
-
+ SALOMEDSImpl_SObject theReferencedObject;
+
+ if(!me.ReferencedObject(theReferencedObject)) return false; //No reference is found
+
CheckLocked();
- TDF_Label Lab = me->GetLabel();
-
- Lab.ForgetAttribute(SALOMEDSImpl_AttributeReference::GetID());
+ DF_Label Lab = me.GetLabel();
//SRN: 30 Aug, 2004 : fix from Ecole l'ete version
- TDF_Label RefLab = theReferencedObject->GetLabel();
+ DF_Label RefLab = theReferencedObject.GetLabel();
- Handle(SALOMEDSImpl_AttributeTarget) aTarget;
- if(RefLab.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID(), aTarget))
+ SALOMEDSImpl_AttributeTarget* aTarget = NULL;
+ if((aTarget=(SALOMEDSImpl_AttributeTarget*)RefLab.FindAttribute(SALOMEDSImpl_AttributeTarget::GetID()))) {
aTarget->Remove(SALOMEDSImpl_Study::SObject(Lab));
+ }
+
+ Lab.ForgetAttribute(SALOMEDSImpl_AttributeReference::GetID());
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose : adds a new directory with a path = thePath
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::AddDirectory(const TCollection_AsciiString& thePath)
+bool SALOMEDSImpl_StudyBuilder::AddDirectory(const string& thePath)
{
_errorCode = "";
CheckLocked();
- if(thePath.IsEmpty() || thePath == "") {
+ if(thePath.empty()) {
_errorCode = "Invalid path";
return false;
}
- TCollection_AsciiString aPath(thePath), aContext(""), aFatherPath;
- TDF_Label aLabel;
- Handle(SALOMEDSImpl_Study) aStudy = SALOMEDSImpl_Study::GetStudy(_doc->Main());
- Handle(SALOMEDSImpl_SObject) anObject;
+ string aPath(thePath), aContext(""), aFatherPath;
+ DF_Label aLabel;
+ SALOMEDSImpl_SObject anObject;
try {
- anObject = aStudy->FindObjectByPath(thePath); //Check if the directory already exists
+ anObject = _study->FindObjectByPath(thePath); //Check if the directory already exists
}
catch(...) { }
- if(!anObject.IsNull()) {
+ if(anObject) {
_errorCode = "StudyNameAlreadyUsed";
return false;
}
- if(aPath.Value(1) != '/') { //Relative path
- aPath.Prepend('/');
- aPath = aStudy->GetContext() + aPath;
+ if(aPath[0] != '/') { //Relative path
+ aPath.insert(aPath.begin(), '/');
+ aPath = _study->GetContext() + aPath;
}
- TCollection_AsciiString aToken = aPath.Token("/", 1);
- if(aToken.Length() == 0) aFatherPath = "/";
-
- int i = 1;
- while(aToken.Length() != 0) {
- if(aPath.Token("/", i+1).Length() > 0) {
+ vector<string> vs = SALOMEDSImpl_Tool::splitString(aPath, '/');
+ if(vs.size() == 1)
+ aFatherPath = "/";
+ else {
+ for(int i = 0, len = vs.size()-1; i<len; i++) {
aFatherPath += "/";
- aFatherPath += aToken;
+ aFatherPath += vs[i];
}
- aToken = aPath.Token("/", ++i);
}
- anObject.Nullify();
try {
- anObject = aStudy->FindObjectByPath(aFatherPath); //Check if the father directory exists
+ anObject = _study->FindObjectByPath(aFatherPath); //Check if the father directory exists
}
catch(...) { ; }
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "StudyInvalidDirectory";
return false;
}
- Handle(SALOMEDSImpl_SObject) aNewObject = NewObject(anObject);
- aLabel = aNewObject->GetLabel();
+ SALOMEDSImpl_SObject aNewObject = NewObject(anObject);
+ aLabel = aNewObject.GetLabel();
if(aLabel.IsNull()) {
_errorCode = "StudyInvalidComponent";
return false;
}
- SALOMEDSImpl_AttributeName::Set(aLabel, aPath.Token("/", i-1));
+ SALOMEDSImpl_AttributeName::Set(aLabel, vs.back());
//Set LocalID attribute to identify the directory object
- Handle(SALOMEDSImpl_AttributeLocalID) aLocalID = SALOMEDSImpl_AttributeLocalID::Set(aLabel, DIRECTORYID);
+ SALOMEDSImpl_AttributeLocalID::Set(aLabel, DIRECTORYID);
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::SetGUID(const Handle(SALOMEDSImpl_SObject)& anObject,
- const TCollection_AsciiString& theGUID)
+bool SALOMEDSImpl_StudyBuilder::SetGUID(const SALOMEDSImpl_SObject& anObject,
+ const string& theGUID)
{
_errorCode = "";
CheckLocked();
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Invalid arguments";
return false;
}
- TDF_Label aLabel = anObject->GetLabel();
- SALOMEDSImpl_AttributeUserID::Set(aLabel, theGUID.ToCString());
+ DF_Label aLabel = anObject.GetLabel();
+ SALOMEDSImpl_AttributeUserID::Set(aLabel, theGUID);
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::IsGUID(const Handle(SALOMEDSImpl_SObject)& anObject,
- const TCollection_AsciiString& theGUID)
+bool SALOMEDSImpl_StudyBuilder::IsGUID(const SALOMEDSImpl_SObject& anObject,
+ const string& theGUID)
{
_errorCode = "";
- if(anObject.IsNull()) {
+ if(!anObject) {
_errorCode = "Invalid arguments";
return false;
}
- TDF_Label aLabel = anObject->GetLabel();
- return aLabel.IsAttribute(theGUID.ToCString());
+ DF_Label aLabel = anObject.GetLabel();
+ return aLabel.IsAttribute(theGUID);
}
void SALOMEDSImpl_StudyBuilder::NewCommand()
{
_errorCode = "";
+
// mpv: for SAL2114 - unset "lock changed" flag at the operation start
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
- if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeStudyProperties;
- _doc->Main().AddAttribute(anAttr);
- }
- anAttr->IsLockChanged(true);
-
- _doc->NewCommand();
+ _study->GetProperties()->IsLockChanged(true);
+
+ //Not implemented
}
//============================================================================
void SALOMEDSImpl_StudyBuilder::CommitCommand()
{
_errorCode = "";
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
- if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeStudyProperties;
- _doc->Main().AddAttribute(anAttr);
- }
+ SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties();
if (anAttr->IsLocked() && !anAttr->IsLockChanged(true)) {
- AbortCommand();
_errorCode = "LockProtection";
throw LockProtection("LockProtection");
} else {
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->RemovePostponed(_doc->GetUndoLimit());
-
int aModif = anAttr->GetModified();
if (aModif < 0) aModif = 1000; // if user make undo and then - new transaction "modify" will never be zero
anAttr->SetModified(aModif+1);
- _doc->CommitCommand();
}
- _doc->Modify();
+
+ //Not implemented
+ _doc->SetModified(true);
}
//============================================================================
bool SALOMEDSImpl_StudyBuilder::HasOpenCommand()
{
_errorCode = "";
- return _doc->HasOpenCommand();
+
+ //Not implememnted
+ return false;
}
//============================================================================
void SALOMEDSImpl_StudyBuilder::AbortCommand()
{
_errorCode = "";
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(0);
-
- _doc->AbortCommand();
+ //Not implemented
}
//============================================================================
//============================================================================
void SALOMEDSImpl_StudyBuilder::Undo()
{
+ //Not implemented
_errorCode = "";
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
- if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeStudyProperties;
- _doc->Main().AddAttribute(anAttr);
- }
+ SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties();
if (anAttr->IsLocked()) {
_errorCode = "LockProtection";
throw LockProtection("LockProtection");
} else {
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(1);
- _doc->Undo();
anAttr->SetModified(anAttr->GetModified()-1);
}
- _doc->Modify();
+ _doc->SetModified(true);
}
//============================================================================
void SALOMEDSImpl_StudyBuilder::Redo()
{
_errorCode = "";
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
- if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeStudyProperties;
- _doc->Main().AddAttribute(anAttr);
- }
-
+ SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties();
if (anAttr->IsLocked()) {
_errorCode = "LockProtection";
throw LockProtection("LockProtection");
} else {
- _doc->Redo();
- SALOMEDSImpl_Study::GetStudy(_doc->Main())->UndoPostponed(-1);
anAttr->SetModified(anAttr->GetModified()+1);
}
-
- _doc->Modify();
+
+ //Not implemented
+
+ _doc->SetModified(true);
}
//============================================================================
bool SALOMEDSImpl_StudyBuilder::GetAvailableUndos()
{
_errorCode = "";
- return _doc->GetAvailableUndos();
+ return false;
}
//============================================================================
bool SALOMEDSImpl_StudyBuilder::GetAvailableRedos()
{
_errorCode = "";
- return _doc->GetAvailableRedos();
+ return false;
}
//============================================================================
int SALOMEDSImpl_StudyBuilder::UndoLimit()
{
_errorCode = "";
- return _doc->GetUndoLimit();
+ return 1;
}
//============================================================================
{
_errorCode = "";
CheckLocked();
- _doc->SetUndoLimit (n);
+ //Not implemented
}
//============================================================================
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_Callback)
-SALOMEDSImpl_StudyBuilder::SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& theCallback)
+SALOMEDSImpl_Callback*
+SALOMEDSImpl_StudyBuilder::SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback)
{
_errorCode = "";
- Handle(SALOMEDSImpl_Callback) aRet = _callbackOnAdd;
- _callbackOnAdd = theCallback;
+ SALOMEDSImpl_Callback* aRet = _callbackOnAdd;
+ _callbackOnAdd = (SALOMEDSImpl_Callback*)theCallback;
return aRet;
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_Callback)
-SALOMEDSImpl_StudyBuilder::SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback)& theCallback)
+SALOMEDSImpl_Callback*
+SALOMEDSImpl_StudyBuilder::SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback)
{
_errorCode = "";
- Handle(SALOMEDSImpl_Callback) aRet = _callbackOnRemove;
- _callbackOnRemove = theCallback;
+ SALOMEDSImpl_Callback* aRet = _callbackOnRemove;
+ _callbackOnRemove = (SALOMEDSImpl_Callback*)theCallback;
return aRet;
}
void SALOMEDSImpl_StudyBuilder::CheckLocked()
{
_errorCode = "";
- if (_doc->HasOpenCommand()) return;
- Handle(SALOMEDSImpl_AttributeStudyProperties) anAttr;
- if (!_doc->Main().FindAttribute(SALOMEDSImpl_AttributeStudyProperties::GetID(), anAttr)) {
- anAttr = new SALOMEDSImpl_AttributeStudyProperties;
- _doc->Main().AddAttribute(anAttr);
- }
+ if (HasOpenCommand()) return;
+ SALOMEDSImpl_AttributeStudyProperties* anAttr = _study->GetProperties();
if (anAttr->IsLocked()) {
_errorCode = "LockProtection";
throw LockProtection("LockProtection");
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::SetName(const Handle(SALOMEDSImpl_SObject)& theSO,
- const TCollection_AsciiString& theValue)
+bool SALOMEDSImpl_StudyBuilder::SetName(const SALOMEDSImpl_SObject& theSO,
+ const string& theValue)
{
_errorCode = "";
CheckLocked();
- if(theSO.IsNull()) {
+ if(!theSO) {
_errorCode = "Invalid arguments";
return false;
}
- SALOMEDSImpl_AttributeName::Set(theSO->GetLabel(), theValue);
+ SALOMEDSImpl_AttributeName::Set(theSO.GetLabel(), theValue);
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::SetComment(const Handle(SALOMEDSImpl_SObject)& theSO,
- const TCollection_AsciiString& theValue)
+bool SALOMEDSImpl_StudyBuilder::SetComment(const SALOMEDSImpl_SObject& theSO,
+ const string& theValue)
{
_errorCode = "";
CheckLocked();
- if(theSO.IsNull()) {
+ if(!theSO) {
_errorCode = "Invalid arguments";
return false;
}
- SALOMEDSImpl_AttributeComment::Set(theSO->GetLabel(), theValue);
+ SALOMEDSImpl_AttributeComment::Set(theSO.GetLabel(), theValue);
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyBuilder::SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO,
- const TCollection_AsciiString& theValue)
+bool SALOMEDSImpl_StudyBuilder::SetIOR(const SALOMEDSImpl_SObject& theSO,
+ const string& theValue)
{
_errorCode = "";
CheckLocked();
- if(theSO.IsNull()) {
+ if(!theSO) {
_errorCode = "Invalid arguments";
return false;
}
- SALOMEDSImpl_AttributeIOR::Set(theSO->GetLabel(), theValue);
+ SALOMEDSImpl_AttributeIOR::Set(theSO.GetLabel(), theValue);
- _doc->Modify();
+ _doc->SetModified(true);
return true;
}
* Purpose :
*/
//============================================================================
-static void Translate_persistentID_to_IOR(TDF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII)
+static void Translate_persistentID_to_IOR(DF_Label& Lab, SALOMEDSImpl_Driver* driver, bool isMultiFile, bool isASCII)
{
if(driver == NULL) return;
- TDF_ChildIterator itchild (Lab);
+ DF_ChildIterator itchild (Lab);
for (; itchild.More(); itchild.Next()) {
- TDF_Label current = itchild.Value();
- Handle(SALOMEDSImpl_AttributePersistentRef) Att;
- if (current.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID(),Att)) {
-
- Handle(SALOMEDSImpl_AttributeLocalID) anID;
- if (current.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID(), anID))
- if (anID->Value() == FILELOCALID) continue; //SRN: This attribute store a file name, skip it
-
- TCollection_AsciiString persist_ref(Att->Value());
- Handle(SALOMEDSImpl_SObject) so = SALOMEDSImpl_Study::SObject(current);
- TCollection_AsciiString ior_string = driver->LocalPersistentIDToIOR(so,
- persist_ref,
- isMultiFile,
- isASCII);
+ DF_Label current = itchild.Value();
+ SALOMEDSImpl_AttributePersistentRef* Att = NULL;
+ if ((Att=(SALOMEDSImpl_AttributePersistentRef*)current.FindAttribute(SALOMEDSImpl_AttributePersistentRef::GetID()))) {
+
+ SALOMEDSImpl_AttributeLocalID* anID = NULL;
+ if ((anID=(SALOMEDSImpl_AttributeLocalID*)current.FindAttribute(SALOMEDSImpl_AttributeLocalID::GetID())))
+ if (anID->Value() == FILELOCALID) continue; //SRN: This attribute store a file name, skip it
+
+ string persist_ref = Att->Value();
+ SALOMEDSImpl_SObject so = SALOMEDSImpl_Study::SObject(current);
+ string ior_string = driver->LocalPersistentIDToIOR(so,
+ persist_ref,
+ isMultiFile,
+ isASCII);
SALOMEDSImpl_AttributeIOR::Set (current, ior_string);
}
#ifndef __SALOMEDSImpl_STUDYBUILDER_H__
#define __SALOMEDSImpl_STUDYBUILDER_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared )
-
// std C++ headers
#include <iostream>
-
-// Cascade header
-#include <TCollection_AsciiString.hxx>
-#include <TDocStd_Document.hxx>
+#include <string>
+#include <vector>
#include "SALOMEDSImpl_Callback.hxx"
#include "SALOMEDSImpl_Driver.hxx"
-class SALOMEDSImpl_StudyBuilder : public MMgt_TShared
+class SALOMEDSImpl_Study;
+
+class SALOMEDSImpl_StudyBuilder
{
private:
- Handle(TDocStd_Document) _doc;
- Handle(Standard_Transient) _study;
- Handle(SALOMEDSImpl_Callback) _callbackOnAdd;
- Handle(SALOMEDSImpl_Callback) _callbackOnRemove;
- TCollection_AsciiString _errorCode;
+ DF_Document* _doc;
+ SALOMEDSImpl_Study* _study;
+ SALOMEDSImpl_Callback* _callbackOnAdd;
+ SALOMEDSImpl_Callback* _callbackOnRemove;
+ std::string _errorCode;
public:
- Standard_EXPORT SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner);
+ Standard_EXPORT SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner);
Standard_EXPORT ~SALOMEDSImpl_StudyBuilder();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) NewComponent(const TCollection_AsciiString& ComponentDataType);
+ Standard_EXPORT virtual SALOMEDSImpl_SComponent NewComponent(const std::string& ComponentDataType);
- Standard_EXPORT virtual bool DefineComponentInstance (const Handle(SALOMEDSImpl_SComponent)&, const TCollection_AsciiString& ComponentIOR);
+ Standard_EXPORT virtual bool DefineComponentInstance (const SALOMEDSImpl_SComponent&, const std::string& ComponentIOR);
- Standard_EXPORT virtual bool RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent);
+ Standard_EXPORT virtual bool RemoveComponent(const SALOMEDSImpl_SComponent& aComponent);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject NewObject(const SALOMEDSImpl_SObject& theFatherObject);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject,
- const int theTag);
+ Standard_EXPORT 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 TCollection_AsciiString& thePath);
+ Standard_EXPORT virtual bool AddDirectory(const std::string& thePath);
- Standard_EXPORT virtual bool LoadWith(const Handle(SALOMEDSImpl_SComponent)& sco, SALOMEDSImpl_Driver* Engine);
- Standard_EXPORT virtual bool Load(const Handle(SALOMEDSImpl_SObject)& sco);
+ Standard_EXPORT virtual bool LoadWith(const SALOMEDSImpl_SComponent& sco, SALOMEDSImpl_Driver* Engine);
+ Standard_EXPORT virtual bool Load(const SALOMEDSImpl_SObject& sco);
- Standard_EXPORT virtual bool RemoveObject(const Handle(SALOMEDSImpl_SObject)& anObject);
- Standard_EXPORT virtual bool RemoveObjectWithChildren(const Handle(SALOMEDSImpl_SObject)& anObject);
+ Standard_EXPORT virtual bool RemoveObject(const SALOMEDSImpl_SObject& anObject);
+ Standard_EXPORT virtual bool RemoveObjectWithChildren(const SALOMEDSImpl_SObject& anObject);
- Standard_EXPORT virtual Handle(TDF_Attribute) FindOrCreateAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
- const TCollection_AsciiString& aTypeOfAttribute);
- Standard_EXPORT virtual bool FindAttribute(const Handle(SALOMEDSImpl_SObject)& anObject,
- Handle(TDF_Attribute)& anAttribute,
- const TCollection_AsciiString& aTypeOfAttribute);
+ 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);
- Standard_EXPORT virtual bool RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& aTypeOfAttribute);
+ Standard_EXPORT virtual bool RemoveAttribute(const SALOMEDSImpl_SObject& anObject, const std::string& aTypeOfAttribute);
- Standard_EXPORT virtual bool Addreference(const Handle(SALOMEDSImpl_SObject)& me,
- const Handle(SALOMEDSImpl_SObject)& thereferencedObject);
+ Standard_EXPORT virtual bool Addreference(const SALOMEDSImpl_SObject& me,
+ const SALOMEDSImpl_SObject& thereferencedObject);
- Standard_EXPORT virtual bool RemoveReference(const Handle(SALOMEDSImpl_SObject)& me);
+ Standard_EXPORT virtual bool RemoveReference(const SALOMEDSImpl_SObject& me);
- Standard_EXPORT virtual bool SetGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID);
- Standard_EXPORT virtual bool IsGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID);
+ 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);
Standard_EXPORT virtual void NewCommand();
Standard_EXPORT virtual void CommitCommand();
Standard_EXPORT void CheckLocked();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& theCallback);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback)& theCallback);
+ Standard_EXPORT virtual SALOMEDSImpl_Callback* SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback);
+ Standard_EXPORT virtual SALOMEDSImpl_Callback* SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback);
- Standard_EXPORT virtual bool SetName(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
+ Standard_EXPORT virtual bool SetName(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
- Standard_EXPORT virtual bool SetComment(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
+ Standard_EXPORT virtual bool SetComment(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
- Standard_EXPORT virtual bool SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
+ Standard_EXPORT virtual bool SetIOR(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
- Standard_EXPORT virtual TCollection_AsciiString GetErrorCode() { return _errorCode; }
+ Standard_EXPORT virtual std::string GetErrorCode() { return _errorCode; }
Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
- Standard_EXPORT virtual Handle(Standard_Transient) GetOwner() { return _study; }
-
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyBuilder )
+ Standard_EXPORT virtual SALOMEDSImpl_Study* GetOwner() { return _study; }
};
#endif
// Module : SALOME
#include "SALOMEDSImpl_StudyHandle.hxx"
-#include <TDF_Attribute.hxx>
-#include <Standard_GUID.hxx>
/*
Class : SALOMEDSImpl_StudyHandle
graphic representation of objects in dirrent views
*/
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyHandle, TDF_Attribute )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyHandle, TDF_Attribute )
//=======================================================================
//function : GetID
//purpose : Get GUID of this attribute
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_StudyHandle::GetID()
+const std::string& SALOMEDSImpl_StudyHandle::GetID()
{
- static Standard_GUID SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" );
+ static std::string SALOMEDSImpl_StudyHandleID( "050C9555-4BA8-49bf-8F1C-086F0469A40B" );
return SALOMEDSImpl_StudyHandleID;
}
//=======================================================================
SALOMEDSImpl_StudyHandle::SALOMEDSImpl_StudyHandle()
{
- myHandle.Nullify();
+ myHandle = NULL;
}
//=======================================================================
//function : Set
//purpose :
//=======================================================================
-Handle(SALOMEDSImpl_StudyHandle) SALOMEDSImpl_StudyHandle::Set(const TDF_Label& theLabel,
- const Handle(SALOMEDSImpl_Study)& theStudy)
+SALOMEDSImpl_StudyHandle* SALOMEDSImpl_StudyHandle::Set(const DF_Label& theLabel,
+ SALOMEDSImpl_Study* theStudy)
{
- Handle(SALOMEDSImpl_StudyHandle) A;
- if (!theLabel.FindAttribute(GetID(), A)) {
- A = new SALOMEDSImpl_StudyHandle();
+ SALOMEDSImpl_StudyHandle* A = NULL;
+ if (!(A=(SALOMEDSImpl_StudyHandle*)theLabel.FindAttribute(GetID()))) {
+ A = new SALOMEDSImpl_StudyHandle;
theLabel.AddAttribute(A);
}
- A->SetHandle(theStudy);
+ A->Set(theStudy);
return A;
}
//function : ID
//purpose : Get GUID of this attribute
//=======================================================================
-const Standard_GUID& SALOMEDSImpl_StudyHandle::ID () const
+const std::string& SALOMEDSImpl_StudyHandle::ID () const
{
return GetID();
}
//function : NewEmpty
//purpose : Create new empty attribute
//=======================================================================
-Handle(TDF_Attribute) SALOMEDSImpl_StudyHandle::NewEmpty () const
+DF_Attribute* SALOMEDSImpl_StudyHandle::NewEmpty () const
{
return new SALOMEDSImpl_StudyHandle ();
}
//function : Restore
//purpose : Restore value of attribute with value of theWith one
//=======================================================================
-void SALOMEDSImpl_StudyHandle::Restore( const Handle(TDF_Attribute)& theWith )
+void SALOMEDSImpl_StudyHandle::Restore( DF_Attribute* theWith )
{
- Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theWith );
- if ( !anAttr.IsNull() ) SetHandle( anAttr->GetHandle() );
+ SALOMEDSImpl_StudyHandle* anAttr = dynamic_cast<SALOMEDSImpl_StudyHandle*>( theWith );
+ if ( anAttr ) Set ( anAttr->Get() );
}
//=======================================================================
//function : Paste
//purpose : Paste value of current attribute to the value of entry one
//=======================================================================
-void SALOMEDSImpl_StudyHandle::Paste( const Handle(TDF_Attribute)& theInto,
- const Handle(TDF_RelocationTable)& ) const
+void SALOMEDSImpl_StudyHandle::Paste( DF_Attribute* theInto)
{
- Handle(SALOMEDSImpl_StudyHandle) anAttr = Handle(SALOMEDSImpl_StudyHandle)::DownCast( theInto );
- if ( !anAttr.IsNull() ) anAttr->SetHandle( myHandle );
+ SALOMEDSImpl_StudyHandle* anAttr = dynamic_cast<SALOMEDSImpl_StudyHandle*>( theInto );
+ if ( anAttr ) anAttr->Set ( myHandle );
}
#ifndef SALOMEDSImpl_StudyHandle_HeaderFile
#define SALOMEDSImpl_StudyHandle_HeaderFile
-#include <Standard_DefineHandle.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-
-class Standard_GUID;
-class Handle(TDF_Attribute);
-class Handle(TDF_RelocationTable);
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
/*
Class : SALOMEDSImpl_StudyHandle
Description : PRIVATE: This class is intended for storing of the study handle
*/
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyHandle, TDF_Attribute )
-
#include "SALOMEDSImpl_Study.hxx"
#ifndef WNT
-class Standard_EXPORT SALOMEDSImpl_StudyHandle : public TDF_Attribute
+class Standard_EXPORT SALOMEDSImpl_StudyHandle : public DF_Attribute
#else
-class SALOMEDSImpl_StudyHandle : public TDF_Attribute
+class SALOMEDSImpl_StudyHandle : public DF_Attribute
#endif
{
public:
Standard_EXPORT SALOMEDSImpl_StudyHandle();
-Standard_EXPORT ~SALOMEDSImpl_StudyHandle() { myHandle.Nullify(); }
+Standard_EXPORT ~SALOMEDSImpl_StudyHandle() {; }
-Standard_EXPORT static Handle(SALOMEDSImpl_StudyHandle) Set(const TDF_Label& theLabel, const Handle(SALOMEDSImpl_Study)& theStudy);
-Standard_EXPORT static const Standard_GUID& GetID() ;
+Standard_EXPORT static SALOMEDSImpl_StudyHandle* Set(const DF_Label& theLabel, SALOMEDSImpl_Study* theStudy);
+Standard_EXPORT static const std::string& GetID() ;
-Standard_EXPORT void SetHandle(const Handle(SALOMEDSImpl_Study)& theStudy) { myHandle = theStudy; }
-Standard_EXPORT Handle(SALOMEDSImpl_Study) GetHandle() { return myHandle; }
-Standard_EXPORT const Standard_GUID& ID() const;
-Standard_EXPORT void Restore( const Handle(TDF_Attribute)& theWith );
-Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
-Standard_EXPORT void Paste( const Handle(TDF_Attribute)& theInto,
- const Handle(TDF_RelocationTable)& ) const;
+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);
private:
- Handle(SALOMEDSImpl_Study) myHandle;
+ SALOMEDSImpl_Study* myHandle;
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyHandle )
};
#endif
#include "SALOMEDSImpl_StudyManager.hxx"
-#include <CDF_Session.hxx>
-#include <CDF_DirectoryIterator.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_RelocationTable.hxx>
-#include <TDF_ChildIterator.hxx>
-#include <TDF_AttributeIterator.hxx>
-#include <TColStd_HSequenceOfReal.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <TColStd_HArray1OfCharacter.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TColStd_HSequenceOfExtendedString.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <OSD_Process.hxx>
-#include <Quantity_Date.hxx>
+#include "DF_ChildIterator.hxx"
#include "HDFexplorer.hxx"
#include "SALOMEDSImpl_Attributes.hxx"
#include "SALOMEDSImpl_Tool.hxx"
#include "SALOMEDSImpl_SComponent.hxx"
+#include "SALOMEDSImpl_GenericAttribute.hxx"
#include <map>
#include "HDFOI.hxx"
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_StudyManager, MMgt_TShared )
-
#define USE_CASE_LABEL_ID "0:2"
-static void SaveAttributes(Handle(SALOMEDSImpl_SObject) SO, HDFgroup *hdf_group_sobject);
-static void ReadAttributes(const Handle(SALOMEDSImpl_Study)&, const Handle(SALOMEDSImpl_SObject)&, HDFdataset* );
-static void BuildTree (const Handle(SALOMEDSImpl_Study)&, HDFgroup*);
-static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)&,
+static void SaveAttributes(const SALOMEDSImpl_SObject& SO, HDFgroup *hdf_group_sobject);
+static void ReadAttributes(SALOMEDSImpl_Study*, const SALOMEDSImpl_SObject&, HDFdataset* );
+static void BuildTree (SALOMEDSImpl_Study*, HDFgroup*);
+static void Translate_IOR_to_persistentID (const SALOMEDSImpl_SObject&,
SALOMEDSImpl_Driver*, bool isMultiFile, bool isASCII);
//============================================================================
SALOMEDSImpl_StudyManager::SALOMEDSImpl_StudyManager()
{
_errorCode = "";
- _OCAFApp = new SALOMEDSImpl_OCAFApplication();
+ _appli = new DF_Application();
_IDcounter = 0;
- _OCAFApp->NewDocument("SALOME_STUDY", _clipboard);
+ _clipboard = _appli->NewDocument("SALOME_STUDY");
}
//============================================================================
//============================================================================
SALOMEDSImpl_StudyManager::~SALOMEDSImpl_StudyManager()
{
- // Destroy OCAF application
- _OCAFApp.Nullify();
+ // Destroy application
+ delete _appli;
}
* Purpose : Create a New Study of name study_name
*/
//==================================================T==========================
-Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::NewStudy(const TCollection_AsciiString& study_name)
+SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::NewStudy(const string& study_name)
{
_errorCode = "";
- Handle(TDocStd_Document) Doc;
- _OCAFApp->NewDocument("SALOME_STUDY",Doc);
+ DF_Document* Doc = _appli->NewDocument("SALOME_STUDY");
- Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, study_name);
+ SALOMEDSImpl_Study* Study = new SALOMEDSImpl_Study(Doc, study_name);
_IDcounter++;
Study->StudyId( _IDcounter );
// set Study properties
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = Study->GetProperties();
- OSD_Process aProcess;
- Quantity_Date aDate = aProcess.SystemDate();
- aProp->SetModification(aProcess.UserName().ToCString(),
- aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year());
+ SALOMEDSImpl_AttributeStudyProperties* aProp = Study->GetProperties();
+
+ int month=0,day=0,year=0,hh=0,mn=0,ss=0;
+ SALOMEDSImpl_Tool::GetSystemDate(year, month, day, hh, mn, ss);
+ aProp->SetModification(SALOMEDSImpl_Tool::GetUserName(),
+ mn, hh, day, month, year);
aProp->SetCreationMode(1); //"from scratch"
return Study;
* Purpose : Open a Study from it's persistent reference
*/
//============================================================================
-Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::Open(const TCollection_AsciiString& aUrl)
+SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::Open(const string& aUrl)
{
_errorCode = "";
HDFgroup *hdf_group_study_structure =0;
char* aC_HDFUrl;
- TCollection_AsciiString aHDFUrl;
+ string aHDFUrl;
bool isASCII = false;
- if (HDFascii::isASCII(aUrl.ToCString())) {
+ if (HDFascii::isASCII(aUrl.c_str())) {
isASCII = true;
- char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.ToCString());
+ char* aResultPath = HDFascii::ConvertFromASCIIToHDF(aUrl.c_str());
aC_HDFUrl = new char[strlen(aResultPath) + 19];
sprintf(aC_HDFUrl, "%shdf_from_ascii.hdf", aResultPath);
delete(aResultPath);
aHDFUrl = aUrl;
}
- hdf_file = new HDFfile((char*)aHDFUrl.ToCString());
+
+ hdf_file = new HDFfile((char*)aHDFUrl.c_str());
try {
hdf_file->OpenOnDisk(HDF_RDONLY);// mpv: was RDWR, but opened file can be write-protected too
}
// char eStr[strlen(aUrl.ToCString())+17];
//#else
char *eStr;
- eStr = new char[strlen(aUrl.ToCString())+17];
+ eStr = new char[strlen(aUrl.c_str())+17];
//#endif
- sprintf(eStr,"Can't open file %s",aUrl.ToCString());
+ sprintf(eStr,"Can't open file %s",aUrl.c_str());
//#ifdef WNT
delete [] eStr;
//#endif
- _errorCode = TCollection_AsciiString(eStr);
+ _errorCode = string(eStr);
return NULL;
}
// Temporary aStudyUrl in place of study name
- Handle(TDocStd_Document) Doc;
- _OCAFApp->NewDocument("SALOME_STUDY",Doc);
+ DF_Document* Doc = _appli->NewDocument("SALOME_STUDY");
- Handle(SALOMEDSImpl_Study) Study = new SALOMEDSImpl_Study(Doc, aUrl);
+ SALOMEDSImpl_Study* Study = new SALOMEDSImpl_Study(Doc, aUrl);
_IDcounter++;
Study->StudyId( _IDcounter );
return Study;
}
- //Create the Structure of the OCAF Document
+ //Create the Structure of the Document
hdf_group_study_structure = new HDFgroup("STUDY_STRUCTURE",hdf_file);
- Handle(TDF_Data) DF = Doc->GetData();
try {
BuildTree (Study, hdf_group_study_structure);
}
//#ifndef WNT
// char eStr[strlen(aUrl.ToCString())+17];
//#else
- char *eStr = new char [strlen(aUrl.ToCString())+17];
+ char *eStr = new char [strlen(aUrl.c_str())+17];
//#endif
- sprintf(eStr,"Can't open file %s", aUrl.ToCString());
- _errorCode = TCollection_AsciiString(eStr);
+ sprintf(eStr,"Can't open file %s", aUrl.c_str());
+ _errorCode = string(eStr);
return NULL;
}
hdf_file->CloseOnDisk();
if (isASCII) {
- Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString;
- aFilesToRemove->Append("hdf_from_ascii.hdf");
+ vector<string> aFilesToRemove;
+ aFilesToRemove.push_back("hdf_from_ascii.hdf");
SALOMEDSImpl_Tool::RemoveTemporaryFiles(SALOMEDSImpl_Tool::GetDirFromPath(aHDFUrl), aFilesToRemove, true);
}
*/
//============================================================================
-void SALOMEDSImpl_StudyManager::Close(const Handle(SALOMEDSImpl_Study)& aStudy)
+void SALOMEDSImpl_StudyManager::Close(SALOMEDSImpl_Study* aStudy)
{
_errorCode = "";
- if(aStudy.IsNull()) {
+ if(!aStudy) {
_errorCode = "Study is null";
return;
}
* Purpose : Save a Study to it's persistent reference
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::Save(const Handle(SALOMEDSImpl_Study)& aStudy,
+bool SALOMEDSImpl_StudyManager::Save(SALOMEDSImpl_Study* aStudy,
SALOMEDSImpl_DriverFactory* aFactory,
bool theMultiFile)
{
_errorCode = "";
- TCollection_AsciiString url = aStudy->URL();
- if (url.IsEmpty()) {
+ string url = aStudy->URL();
+ if (url.empty()) {
_errorCode = "No path specified to save the study. Nothing done";
return false;
}
return false;
}
-bool SALOMEDSImpl_StudyManager::SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy,
+bool SALOMEDSImpl_StudyManager::SaveASCII(SALOMEDSImpl_Study* aStudy,
SALOMEDSImpl_DriverFactory* aFactory,
bool theMultiFile)
{
_errorCode = "";
- TCollection_AsciiString url = aStudy->URL();
- if (url.IsEmpty()) {
+ string url = aStudy->URL();
+ if (url.empty()) {
_errorCode = "No path specified to save the study. Nothing done";
return false;
}
* Purpose : Save a study to the persistent reference aUrl
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::SaveAs(const TCollection_AsciiString& aUrl,
- const Handle(SALOMEDSImpl_Study)& aStudy,
+bool SALOMEDSImpl_StudyManager::SaveAs(const string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
SALOMEDSImpl_DriverFactory* aFactory,
bool theMultiFile)
{
return Impl_SaveAs(aUrl,aStudy, aFactory, theMultiFile, false);
}
-bool SALOMEDSImpl_StudyManager::SaveAsASCII(const TCollection_AsciiString& aUrl,
- const Handle(SALOMEDSImpl_Study)& aStudy,
+bool SALOMEDSImpl_StudyManager::SaveAsASCII(const string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
SALOMEDSImpl_DriverFactory* aFactory,
bool theMultiFile)
{
* Purpose : Get name list of open studies in the session
*/
//============================================================================
-Handle(TColStd_HSequenceOfTransient) SALOMEDSImpl_StudyManager::GetOpenStudies()
+vector<SALOMEDSImpl_Study*> SALOMEDSImpl_StudyManager::GetOpenStudies()
{
_errorCode = "";
- Handle(TColStd_HSequenceOfTransient) aList = new TColStd_HSequenceOfTransient;
+ vector<SALOMEDSImpl_Study*> aList;
- int nbDocs = _OCAFApp->NbDocuments();
+ int nbDocs = _appli->NbDocuments();
if(nbDocs == 0) {
_errorCode = "No active study in this session";
return aList;
}
else {
- Handle(SALOMEDSImpl_Study) aStudy;
- Handle(CDF_Session) S = CDF_Session::CurrentSession();
- CDF_DirectoryIterator it (S->Directory());
- for (;it.MoreDocument();it.NextDocument()) {
- Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document());
+ SALOMEDSImpl_Study* aStudy;
+ vector<int> ids = _appli->GetDocumentIDs();
+ for (int i = 0, len = ids.size(); i<len; i++) {
+ DF_Document* D = _appli->GetDocument(ids[i]);
if(D == _clipboard) continue;
aStudy = SALOMEDSImpl_Study::GetStudy(D->Main());
- if(aStudy.IsNull()) continue;
- aList->Append(aStudy);
+ if(!aStudy) continue;
+ aList.push_back(aStudy);
}
}
* Purpose : Get a study from its name
*/
//============================================================================
-Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByName
- (const TCollection_AsciiString& aStudyName)
+SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::GetStudyByName
+ (const string& aStudyName)
{
_errorCode = "";
- int nbDocs = _OCAFApp->NbDocuments();
+ int nbDocs = _appli->NbDocuments();
if (nbDocs == 0) {
_errorCode = "No active study in this session";
return NULL;
}
else {
- Handle(SALOMEDSImpl_Study) aStudy;
- Handle(CDF_Session) S = CDF_Session::CurrentSession();
- CDF_DirectoryIterator it (S->Directory());
- for (; it.MoreDocument(); it.NextDocument()) {
- Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document());
- if (D == _clipboard) continue;
- aStudy = SALOMEDSImpl_Study::GetStudy(D->Main());
- if (aStudy.IsNull()) continue;
- if (aStudy->Name() == aStudyName) return aStudy;
+ vector<SALOMEDSImpl_Study*> studies = GetOpenStudies();
+ for (int i = 0, len = studies.size(); i<len; i++) {
+ if (studies[i]->Name() == aStudyName) return studies[i];
}
}
- _errorCode = TCollection_AsciiString("Found no study with the name ") + aStudyName;
+ _errorCode = string("Found no study with the name ") + aStudyName;
return NULL;
}
* Purpose : Get a study from its ID
*/
//============================================================================
-Handle(SALOMEDSImpl_Study) SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID)
+SALOMEDSImpl_Study* SALOMEDSImpl_StudyManager::GetStudyByID(int aStudyID)
{
_errorCode = "";
- int nbDocs = _OCAFApp->NbDocuments();
+ int nbDocs = _appli->NbDocuments();
if (nbDocs == 0) {
_errorCode = "No active study in this session";
return NULL;
}
else {
- Handle(SALOMEDSImpl_Study) aStudy;
- Handle(CDF_Session) S = CDF_Session::CurrentSession();
- CDF_DirectoryIterator it (S->Directory());
- for (; it.MoreDocument(); it.NextDocument()) {
- Handle(TDocStd_Document) D = Handle(TDocStd_Document)::DownCast(it.Document());
- if (D == _clipboard) continue;
- aStudy = SALOMEDSImpl_Study::GetStudy(D->Main());
- if (aStudy.IsNull()) continue;
- if (aStudy->StudyId() == aStudyID) return aStudy;
+ vector<SALOMEDSImpl_Study*> studies = GetOpenStudies();
+ for (int i = 0, len = studies.size(); i<len; i++) {
+ if (studies[i]->StudyId() == aStudyID) return studies[i];
}
}
* Purpose : save the study properties in HDF file
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy,
+bool SALOMEDSImpl_StudyManager::Impl_SaveProperties(SALOMEDSImpl_Study* aStudy,
HDFgroup *hdf_group)
{
_errorCode = "";
hdf_int32 name_len;
// add modifications list (user and date of save)
- Handle(SALOMEDSImpl_AttributeStudyProperties) aProp = aStudy->GetProperties();
- Handle(SALOMEDSImpl_StudyBuilder) SB= aStudy->NewBuilder();
+ SALOMEDSImpl_AttributeStudyProperties* aProp = aStudy->GetProperties();
int aLocked = aProp->IsLocked();
- if (aLocked) aProp->SetLocked(Standard_False);
+ if (aLocked) aProp->SetLocked(false);
- OSD_Process aProcess;
- Quantity_Date aDate = aProcess.SystemDate();
- aProp->SetModification(aProcess.UserName().ToCString(),
- aDate.Minute(), aDate.Hour(), aDate.Day(), aDate.Month(), aDate.Year());
+ int month=0,day=0,year=0,hh=0,mn=0,ss=0;
+ SALOMEDSImpl_Tool::GetSystemDate(year, month, day, hh, mn, ss);
+ aProp->SetModification(SALOMEDSImpl_Tool::GetUserName(),
+ mn, hh, day, month, year);
- if (aLocked) aProp->SetLocked(Standard_True);
+ if (aLocked) aProp->SetLocked(true);
- Handle(TColStd_HSequenceOfExtendedString) aNames;
- Handle(TColStd_HSequenceOfInteger) aMinutes, aHours, aDays, aMonths, aYears;
+ vector<string> aNames;
+ vector<int> aMinutes, aHours, aDays, aMonths, aYears;
aProp->GetModifications(aNames, aMinutes, aHours, aDays, aMonths, aYears);
int aLength = 0, anIndex, i;
- for(i=1; i<=aNames->Length(); i++)
- aLength += aNames->Value(i).Length() + 1;
+ for(i=1; i<=aNames.size(); i++)
+ aLength += aNames[i-1].size() + 1;
//string length: 1 byte = locked flag, 1 byte = modified flag, (12 + name length + 1) for each name and date, "zero" byte
- char* aProperty = new char[3 + aLength + 12 * aNames->Length()];
+ char* aProperty = new char[3 + aLength + 12 * aNames.size()];
sprintf(aProperty,"%c%c", (char)aProp->GetCreationMode(), (aProp->IsLocked())?'l':'u');
- aLength = aNames->Length();
+ aLength = aNames.size();
int a = 2;
- for(anIndex = 1; anIndex <= aLength; anIndex++) {
+ for(anIndex = 0; anIndex<aLength; anIndex++) {
sprintf(&(aProperty[a]),"%2d%2d%2d%2d%4d%s",
- (int)(aMinutes->Value(anIndex)),
- (int)(aHours->Value(anIndex)),
- (int)(aDays->Value(anIndex)),
- (int)(aMonths->Value(anIndex)),
- (int)(aYears->Value(anIndex)),
- TCollection_AsciiString(aNames->Value(anIndex)).ToCString());
+ (int)(aMinutes[anIndex]),
+ (int)(aHours[anIndex]),
+ (int)(aDays[anIndex]),
+ (int)(aMonths[anIndex]),
+ (int)(aYears[anIndex]),
+ aNames[anIndex].c_str());
a = strlen(aProperty);
aProperty[a++] = 1;
}
* Purpose : save the study in HDF file
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const TCollection_AsciiString& aUrl,
- const Handle(SALOMEDSImpl_Study)& aStudy,
+bool SALOMEDSImpl_StudyManager::Impl_SaveAs(const string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
SALOMEDSImpl_DriverFactory* aFactory,
bool theMultiFile,
bool theASCII)
// HDF File will be composed of differents part :
// * For each ComponentDataType, all data created by the component
// Informations in data group hdf_group_datacomponent
- // * Study Structure -> Exactly what is contained in OCAF document
+ // * Study Structure -> Exactly what is contained in Document
// Informations in data group hdf_group_study_structure
_errorCode = "";
hdf_int32 name_len = 0;
char *component_name = 0;
+ if(!aStudy) {
+ _errorCode = "Study is null";
+ return false;
+ }
+
int aLocked = aStudy->GetProperties()->IsLocked();
if (aLocked) aStudy->GetProperties()->SetLocked(false);
- Handle(SALOMEDSImpl_StudyBuilder) SB= aStudy->NewBuilder();
+ SALOMEDSImpl_StudyBuilder* SB= aStudy->NewBuilder();
map<string, SALOMEDSImpl_Driver*> aMapTypeDriver;
- if(aStudy.IsNull()) {
- _errorCode = "Study is null";
- return false;
- }
-
try
{
// mpv 15.12.2003: for saving components we have to load all data from all modules
SALOMEDSImpl_SComponentIterator itcomponent1 = aStudy->NewComponentIterator();
for (; itcomponent1.More(); itcomponent1.Next())
{
- Handle(SALOMEDSImpl_SComponent) sco = itcomponent1.Value();
-
+ SALOMEDSImpl_SComponent sco = itcomponent1.Value();
// if there is an associated Engine call its method for saving
- TCollection_AsciiString IOREngine;
+ string IOREngine;
try {
- if (!sco->ComponentIOR(IOREngine)) {
- TCollection_AsciiString aCompType = sco->GetComment();
- if (!aCompType.IsEmpty()) {
+ if (!sco.ComponentIOR(IOREngine)) {
+ string aCompType = sco.GetComment();
+ if (!aCompType.empty()) {
SALOMEDSImpl_Driver* aDriver = aFactory->GetDriverByType(aCompType);
- aMapTypeDriver[aCompType.ToCString()] = aDriver;
+ aMapTypeDriver[aCompType] = aDriver;
if (aDriver != NULL) {
if(!SB->LoadWith(sco, aDriver)) {
}
}
- TCollection_AsciiString anOldName = aStudy->Name();
+ string anOldName = aStudy->Name();
aStudy->URL(aUrl);
// To change for Save
// Do not have to do a new file but just a Open??? Rewrite all informations after erasing evrything??
- hdf_file = new HDFfile(aUrl.ToCString());
+ hdf_file = new HDFfile((char*)aUrl.c_str());
hdf_file->CreateOnDisk();
//-----------------------------------------------------------------------
for (; itcomponent.More(); itcomponent.Next())
{
- Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value();
+ SALOMEDSImpl_SComponent sco = itcomponent.Value();
- TCollection_AsciiString scoid = sco->GetID();
- hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group_datacomponent);
+ string scoid = sco.GetID();
+ hdf_sco_group = new HDFgroup((char*)scoid.c_str(), hdf_group_datacomponent);
hdf_sco_group->CreateOnDisk();
- TCollection_AsciiString componentDataType = sco->ComponentDataType();
- TCollection_AsciiString IOREngine;
- if (sco->ComponentIOR(IOREngine))
+ string componentDataType = sco.ComponentDataType();
+ string IOREngine;
+ if (sco.ComponentIOR(IOREngine))
{
SALOMEDSImpl_Driver* Engine = NULL;
- if(aMapTypeDriver.find(componentDataType.ToCString()) != aMapTypeDriver.end()) {
+ if(aMapTypeDriver.find(componentDataType) != aMapTypeDriver.end()) {
// we have found the associated engine to write the data
- Engine = aMapTypeDriver[componentDataType.ToCString()];
+ Engine = aMapTypeDriver[componentDataType];
}
else {
Engine = aFactory->GetDriverByIOR(IOREngine);
if (Engine != NULL)
{
- Handle(SALOMEDSImpl_TMPFile) aStream;
- long length;
+ SALOMEDSImpl_TMPFile* aStream = NULL;
+ long length = 0;
if (theASCII) aStream = Engine->SaveASCII(sco,
SALOMEDSImpl_Tool::GetDirFromPath(aUrl),
length,
theMultiFile);
HDFdataset *hdf_dataset;
- hdf_size aHDFSize[1];
+ hdf_size aHDFSize[1];
if(length > 0) { //The component saved some auxiliary files, then put them into HDF file
aHDFSize[0] = length;
hdf_dataset->CloseOnDisk();
}
+ if(aStream) delete aStream;
+
// store multifile state
aHDFSize[0] = 2;
hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1);
SALOMEDSImpl_SComponentIterator itcomp = aStudy->NewComponentIterator();
for (; itcomp.More(); itcomp.Next())
{
- Handle(SALOMEDSImpl_SComponent) SC = itcomp.Value();
- TCollection_AsciiString scid = SC->GetID();
- hdf_sco_group2 = new HDFgroup(scid.ToCString(), hdf_group_study_structure);
+ SALOMEDSImpl_SComponent SC = itcomp.Value();
+ string scid = SC.GetID();
+ hdf_sco_group2 = new HDFgroup((char*)scid.c_str(), hdf_group_study_structure);
hdf_sco_group2->CreateOnDisk();
SaveAttributes(SC, hdf_sco_group2);
// ComponentDataType treatment
- component_name = SC->ComponentDataType().ToCString();
+ component_name = (char*)SC.ComponentDataType().c_str();
name_len = (hdf_int32)strlen(component_name);
size[0] = name_len +1 ;
hdf_dataset = new HDFdataset("COMPONENTDATATYPE",hdf_sco_group2,HDF_STRING,size,1);
hdf_sco_group2->CloseOnDisk();
hdf_sco_group2=0; // will be deleted by hdf_group_study_structure destructor
}
-
//-----------------------------------------------------------------------
//4 - Write the Study UseCases Structure
//-----------------------------------------------------------------------
- Handle(SALOMEDSImpl_SObject) aSO = aStudy->FindObjectID(USE_CASE_LABEL_ID);
- if (!aSO.IsNull()) {
+ SALOMEDSImpl_SObject aSO = aStudy->FindObjectID(USE_CASE_LABEL_ID);
+ if (aSO) {
HDFgroup *hdf_soo_group = new HDFgroup(USE_CASE_LABEL_ID,hdf_group_study_structure);
hdf_soo_group->CreateOnDisk();
SaveAttributes(aSO, hdf_soo_group);
//-----------------------------------------------------------------------
//5 - Write the Study Properties
//-----------------------------------------------------------------------
- name_len = (hdf_int32) aStudy->Name().Length();
+ name_len = (hdf_int32) aStudy->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 = aStudy->Name().ToCString();
+ char* studid = (char*)aStudy->Name().c_str();
hdf_dataset->WriteOnDisk(studid);
hdf_dataset->CloseOnDisk();
hdf_dataset=0; // will be deleted by hdf_group_study_structure destructor
Impl_SaveProperties(aStudy, hdf_group_study_structure);
-
hdf_group_study_structure->CloseOnDisk();
hdf_file->CloseOnDisk();
return false;
}
if (theASCII) { // save file in ASCII format
- HDFascii::ConvertFromHDFToASCII(aUrl.ToCString(), true);
+ HDFascii::ConvertFromHDFToASCII(aUrl.c_str(), true);
}
return true;
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const Handle(SALOMEDSImpl_SObject)& SC,
+bool SALOMEDSImpl_StudyManager::Impl_SaveObject(const SALOMEDSImpl_SObject& SC,
HDFgroup *hdf_group_datatype)
{
_errorCode = "";
HDFgroup *hdf_group_sobject = 0;
- TDF_ChildIterator itchild(SC->GetLabel());
+ DF_ChildIterator itchild(SC.GetLabel());
for (; itchild.More(); itchild.Next())
{
// mpv: don't save empty labels
- TDF_AttributeIterator AI1(itchild.Value());
- if (!AI1.More()) { //No attributes on the label
- TDF_ChildIterator subchild(SC->GetLabel());
+ vector<DF_Attribute*> attr = itchild.Value().GetAttributes();
+ if (attr.size() == 0) { //No attributes on the label
+ DF_ChildIterator subchild(itchild.Value());
if (!subchild.More()) {
continue;
}
- subchild.Initialize(SC->GetLabel(), true);
+ subchild.Init(itchild.Value(), true);
bool anEmpty = true;
for (; subchild.More() && anEmpty; subchild.Next()) {
- TDF_AttributeIterator AI2(subchild.Value());
- if (AI2.More()) anEmpty = false; //There are attributes on the child label
+ vector<DF_Attribute*> attr2 = subchild.Value().GetAttributes();
+ if (attr2.size()) {
+ anEmpty = false; //There are attributes on the child label
+ break;
+ }
}
if (anEmpty) continue;
}
- Handle(SALOMEDSImpl_SObject) SO = SALOMEDSImpl_Study::SObject(itchild.Value());
+ SALOMEDSImpl_SObject SO = SALOMEDSImpl_Study::SObject(itchild.Value());
- char* scoid = (char*) SO->GetID().ToCString();
+ char* scoid = (char*) SO.GetID().c_str();
hdf_group_sobject = new HDFgroup(scoid, hdf_group_datatype);
hdf_group_sobject->CreateOnDisk();
SaveAttributes(SO, hdf_group_sobject);
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_StudyManager::Impl_SubstituteSlash(const TCollection_AsciiString& aUrl)
+string SALOMEDSImpl_StudyManager::Impl_SubstituteSlash(const string& aUrl)
{
_errorCode = "";
- TCollection_ExtendedString theUrl(aUrl);
- Standard_ExtCharacter val1 = ToExtCharacter('/');
- Standard_ExtCharacter val2 = ToExtCharacter(':');
- theUrl.ChangeAll(val1,val2);
+ std::string theUrl(aUrl);
+ for(int i = 0; i<theUrl.size(); i++)
+ if(theUrl[i] == '/') theUrl[i] = ':';
return theUrl;
}
* Purpose :
*/
//============================================================================
-Handle(TDocStd_Document) SALOMEDSImpl_StudyManager::GetDocumentOfStudy(const Handle(SALOMEDSImpl_Study)& theStudy)
+DF_Document* SALOMEDSImpl_StudyManager::GetDocumentOfStudy(SALOMEDSImpl_Study* theStudy)
{
_errorCode = "";
return theStudy->_doc;
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::CanCopy(const Handle(SALOMEDSImpl_SObject)& theObject,
+bool SALOMEDSImpl_StudyManager::CanCopy(const SALOMEDSImpl_SObject& theObject,
SALOMEDSImpl_Driver* theEngine)
{
_errorCode = "";
- Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent();
- if (aComponent.IsNull()) return false;
- if (aComponent->GetLabel() == theObject->GetLabel()) return false;
- TCollection_AsciiString IOREngine;
- if (!aComponent->ComponentIOR(IOREngine)) return false;
+ SALOMEDSImpl_SComponent aComponent = theObject.GetFatherComponent();
+ if (!aComponent) return false;
+ if (aComponent.GetLabel() == theObject.GetLabel()) return false;
+ string IOREngine;
+ if (!aComponent.ComponentIOR(IOREngine)) return false;
if (theEngine == NULL) return false;
return theEngine->CanCopy(theObject);
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::CopyLabel(const Handle(SALOMEDSImpl_Study)& theSourceStudy,
+bool SALOMEDSImpl_StudyManager::CopyLabel(SALOMEDSImpl_Study* theSourceStudy,
SALOMEDSImpl_Driver* theEngine,
- const Standard_Integer theSourceStartDepth,
- const TDF_Label& theSource,
- const TDF_Label& theDestinationMain)
+ const int theSourceStartDepth,
+ const DF_Label& theSource,
+ const DF_Label& theDestinationMain)
{
_errorCode = "";
int a;
- TDF_Label aTargetLabel = theDestinationMain;
- TDF_Label aAuxTargetLabel = theDestinationMain.Father().FindChild(2);
+ DF_Label aTargetLabel = theDestinationMain;
+ DF_Label aAuxTargetLabel = theDestinationMain.Father().FindChild(2);
for(a = theSource.Depth() - theSourceStartDepth; a > 0 ; a--) {
- TDF_Label aSourceLabel = theSource;
+ DF_Label aSourceLabel = theSource;
for(int aNbFather = 1; aNbFather < a; aNbFather++) aSourceLabel = aSourceLabel.Father();
aTargetLabel = aTargetLabel.FindChild(aSourceLabel.Tag());
aAuxTargetLabel = aAuxTargetLabel.FindChild(aSourceLabel.Tag());
}
// iterate attributes
- TDF_AttributeIterator anAttrIterator(theSource);
- Handle(TDF_RelocationTable) aRT = new TDF_RelocationTable();
- for(; anAttrIterator.More(); anAttrIterator.Next()) {
- Handle(TDF_Attribute) anAttr = anAttrIterator.Value();
- if (!Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(anAttr).IsNull()) continue; // never copy tree node attribute
- if (!Handle(SALOMEDSImpl_AttributeTarget)::DownCast(anAttr).IsNull()) continue; // and target attribute
-
- if (!Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr).IsNull()) { // reference copied as Comment in aux tree
- TDF_Label aReferenced = Handle(SALOMEDSImpl_AttributeReference)::DownCast(anAttr)->Get();
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(aReferenced, anEntry);
+ vector<DF_Attribute*> attrList = theSource.GetAttributes();
+ for(int i = 0, len = attrList.size(); i<len; i++) {
+ DF_Attribute* anAttr = attrList[i];
+ string type = SALOMEDSImpl_GenericAttribute::Impl_GetType(anAttr);
+ if (type.substr(0, 17) == string("AttributeTreeNode")) continue; // never copy tree node attribute
+ if (type == string("AttributeTarget")) continue; // and target attribute
+
+ if (type == string("AttributeReference")) { // reference copied as Comment in aux tree
+ DF_Label aReferenced = dynamic_cast<SALOMEDSImpl_AttributeReference*>(anAttr)->Get();
+ string anEntry = aReferenced.Entry();
// store the value of name attribute of referenced label
- Handle(SALOMEDSImpl_AttributeName) aNameAttribute;
- if (aReferenced.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttribute)) {
+ SALOMEDSImpl_AttributeName* aNameAttribute;
+ if ((aNameAttribute=(SALOMEDSImpl_AttributeName*)aReferenced.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
anEntry += " ";
anEntry += aNameAttribute->Value();
}
- SALOMEDSImpl_AttributeComment::Set(aAuxTargetLabel, TCollection_ExtendedString(anEntry));
+ SALOMEDSImpl_AttributeComment::Set(aAuxTargetLabel, anEntry);
continue;
}
- if (!Handle(SALOMEDSImpl_AttributeIOR)::DownCast(anAttr).IsNull()) { // IOR => ID and TMPFile of Engine
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theSource, anEntry);
- Handle(SALOMEDSImpl_SObject) aSO = theSourceStudy->FindObjectID(anEntry.ToCString());
+ if (type == string("AttributeIOR")) { // IOR => ID and TMPFile of Engine
+ string anEntry = theSource.Entry();
+ SALOMEDSImpl_SObject aSO = theSourceStudy->FindObjectID(anEntry);
int anObjID;
long aLen;
- Handle(SALOMEDSImpl_TMPFile) aStream = theEngine->CopyFrom(aSO, anObjID, aLen);
- TCollection_ExtendedString aResStr("");
+ SALOMEDSImpl_TMPFile* aStream = theEngine->CopyFrom(aSO, anObjID, aLen);
+ string aResStr("");
for(a = 0; a < aLen; a++) {
- aResStr += TCollection_ExtendedString(ToExtCharacter(Standard_Character(aStream->Get(a))));
+ aResStr += (char)(aStream->Get(a));
}
+
+ if(aStream) delete aStream;
+
SALOMEDSImpl_AttributeInteger::Set(aAuxTargetLabel, anObjID);
SALOMEDSImpl_AttributeName::Set(aAuxTargetLabel, aResStr);
continue;
}
- Handle(TDF_Attribute) aNewAttribute = anAttr->NewEmpty();
+ DF_Attribute* aNewAttribute = anAttr->NewEmpty();
aTargetLabel.AddAttribute(aNewAttribute);
- anAttr->Paste(aNewAttribute, aRT);
+ anAttr->Paste(aNewAttribute);
}
return true;
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::Copy(const Handle(SALOMEDSImpl_SObject)& theObject,
+bool SALOMEDSImpl_StudyManager::Copy(const SALOMEDSImpl_SObject& theObject,
SALOMEDSImpl_Driver* theEngine)
{
_errorCode = "";
// adoptation for alliances datamodel copy: without IOR attributes !!!
bool aStructureOnly; // copy only SObjects and attributes without component help
- aStructureOnly = !theObject->GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID());
+ aStructureOnly = !theObject.GetLabel().IsAttribute(SALOMEDSImpl_AttributeIOR::GetID());
// get component-engine
- Handle(SALOMEDSImpl_Study) aStudy = theObject->GetStudy();
+ SALOMEDSImpl_Study* aStudy = theObject.GetStudy();
// CAF document of current study usage
- Handle(TDocStd_Document) aDocument = GetDocumentOfStudy(aStudy);
- if (aDocument.IsNull()) {
- _errorCode = "OCAF document is null";
+ DF_Document* aDocument = GetDocumentOfStudy(aStudy);
+ if (!aDocument) {
+ _errorCode = "Document is null";
return false;
}
//Clear the clipboard
- _clipboard->Main().Root().ForgetAllAttributes(Standard_True);
- _OCAFApp->Close(_clipboard);
- Handle(TDocStd_Document) aDoc;
- _OCAFApp->NewDocument("SALOME_STUDY", aDoc);
- _clipboard = aDoc;
+ _clipboard->Main().Root().ForgetAllAttributes(true);
+ _appli->Close(_clipboard);
+ _clipboard = _appli->NewDocument("SALOME_STUDY");
// set component data type to the name attribute of root label
if (!aStructureOnly) {
SALOMEDSImpl_AttributeComment::Set(_clipboard->Main().Root(),
- TCollection_ExtendedString(theEngine->ComponentDataType()));
+ theEngine->ComponentDataType());
}
// set to the Root label integer attribute: study id
SALOMEDSImpl_AttributeInteger::Set(_clipboard->Main().Root(), aStudy->StudyId());
// iterate all theObject's label children
- TDF_Label aStartLabel = theObject->GetLabel();
- Standard_Integer aSourceStartDepth = aStartLabel.Depth();
+ DF_Label aStartLabel = theObject.GetLabel();
+ int aSourceStartDepth = aStartLabel.Depth();
// copy main source label
CopyLabel(aStudy, theEngine, aSourceStartDepth, aStartLabel, _clipboard->Main());
// copy all subchildren of the main source label (all levels)
- TDF_ChildIterator anIterator(aStartLabel, Standard_True);
+ DF_ChildIterator anIterator(aStartLabel, true);
for(; anIterator.More(); anIterator.Next()) {
CopyLabel(aStudy, theEngine, aSourceStartDepth, anIterator.Value(), _clipboard->Main());
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_StudyManager::CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject,
+bool SALOMEDSImpl_StudyManager::CanPaste(const SALOMEDSImpl_SObject& theObject,
SALOMEDSImpl_Driver* theEngine)
{
_errorCode = "";
- if (_clipboard.IsNull()) {
+ if (!_clipboard) {
_errorCode = "Clipboard is null";
return false;
}
- Handle(SALOMEDSImpl_AttributeComment) aCompName;
- if (!_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aCompName)) {
+ SALOMEDSImpl_AttributeComment* aCompName = NULL;
+ if (!(aCompName=(SALOMEDSImpl_AttributeComment*)_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) {
_errorCode = "Clipboard has no component type";
return false;
}
- Handle(SALOMEDSImpl_AttributeInteger) anObjID;
- if (!_clipboard->Main().Father().FindChild(2).FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anObjID)) {
+ SALOMEDSImpl_AttributeInteger* anObjID;
+ if (!(anObjID=(SALOMEDSImpl_AttributeInteger*)_clipboard->Main().Father().FindChild(2).FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) {
_errorCode = "Clipboard has no object id";
return false;
}
- Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent();
- if (aComponent.IsNull()) {
+ SALOMEDSImpl_SComponent aComponent = theObject.GetFatherComponent();
+ if (!aComponent) {
_errorCode = "Object doesn't belong to component";
return false;
}
- TCollection_AsciiString IOREngine;
- if (!aComponent->ComponentIOR(IOREngine)) {
+ string IOREngine;
+ if (!aComponent.ComponentIOR(IOREngine)) {
_errorCode = "component has no IOR";
return false;
}
* Purpose :
*/
//============================================================================
-TDF_Label SALOMEDSImpl_StudyManager::PasteLabel(const Handle(SALOMEDSImpl_Study)& theDestinationStudy,
- SALOMEDSImpl_Driver* theEngine,
- const TDF_Label& theSource,
- const TDF_Label& theDestinationStart,
- const int theCopiedStudyID,
- const bool isFirstElement)
+DF_Label SALOMEDSImpl_StudyManager::PasteLabel(SALOMEDSImpl_Study* theDestinationStudy,
+ SALOMEDSImpl_Driver* theEngine,
+ const DF_Label& theSource,
+ const DF_Label& theDestinationStart,
+ const int theCopiedStudyID,
+ const bool isFirstElement)
{
_errorCode = "";
// get corresponding source, target and auxiliary labels
- TDF_Label aTargetLabel = theDestinationStart;
+ DF_Label aTargetLabel = theDestinationStart;
- TDF_Label aAuxSourceLabel = theSource.Root().FindChild(2);
+ DF_Label aAuxSourceLabel = theSource.Root().FindChild(2);
int a;
if (!isFirstElement) {
for(a = theSource.Depth() - 1; a > 0 ; a--) {
- TDF_Label aSourceLabel = theSource;
+ DF_Label aSourceLabel = theSource;
for(int aNbFather = 1; aNbFather < a; aNbFather++) aSourceLabel = aSourceLabel.Father();
aTargetLabel = aTargetLabel.FindChild(aSourceLabel.Tag());
aAuxSourceLabel = aAuxSourceLabel.FindChild(aSourceLabel.Tag());
}
// check auxiliary label for TMPFile => IOR
- Handle(SALOMEDSImpl_AttributeName) aNameAttribute;
- if (aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttribute)) {
- Handle(SALOMEDSImpl_AttributeInteger) anObjID;
-
- aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anObjID);
- Handle(SALOMEDSImpl_AttributeComment) aComponentName;
- theSource.Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComponentName);
- TCollection_AsciiString aCompName = aComponentName->Value();
+ SALOMEDSImpl_AttributeName* aNameAttribute = NULL;
+ if ((aNameAttribute=(SALOMEDSImpl_AttributeName*)aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) {
+ SALOMEDSImpl_AttributeInteger* anObjID = (SALOMEDSImpl_AttributeInteger*)aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeInteger::GetID());
+ SALOMEDSImpl_AttributeComment* aComponentName = (SALOMEDSImpl_AttributeComment*)theSource.Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID());
+ string aCompName = aComponentName->Value();
if (theEngine->CanPaste(aCompName, anObjID->Value())) {
- TCollection_ExtendedString aTMPStr = aNameAttribute->Value();
- int aLen = aTMPStr.Length();
+ std::string aTMPStr = aNameAttribute->Value();
+ int aLen = aTMPStr.size();
unsigned char* aStream = NULL;
if(aLen > 0) {
aStream = new unsigned char[aLen+10];
for(a = 0; a < aLen; a++) {
- aStream[a] = ToCharacter(aTMPStr.Value(a+1));
+ aStream[a] = aTMPStr[a];
}
}
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(aTargetLabel, anEntry);
- Handle(SALOMEDSImpl_SObject) aPastedSO = theDestinationStudy->FindObjectID(anEntry);
+ string anEntry = aTargetLabel.Entry();
+ SALOMEDSImpl_SObject aPastedSO = theDestinationStudy->FindObjectID(anEntry);
if (isFirstElement) {
- TCollection_AsciiString aDestEntry = theEngine->PasteInto(aStream,
- aLen,
- anObjID->Value(),
- aPastedSO->GetFatherComponent());
- TDF_Tool::Label(theDestinationStart.Data(), aDestEntry, aTargetLabel);
+ string aDestEntry = theEngine->PasteInto(aStream,
+ aLen,
+ anObjID->Value(),
+ aPastedSO.GetFatherComponent());
+ aTargetLabel = DF_Label::Label(theDestinationStart, aDestEntry);
} else
theEngine->PasteInto(aStream, aLen, anObjID->Value(), aPastedSO);
}
// iterate attributes
- TDF_AttributeIterator anAttrIterator(theSource);
- Handle(TDF_RelocationTable) aRT = new TDF_RelocationTable();
- for(; anAttrIterator.More(); anAttrIterator.Next()) {
- Handle(TDF_Attribute) anAttr = anAttrIterator.Value();
- if (aTargetLabel.FindAttribute(anAttr->ID(), anAttr)) {
+ vector<DF_Attribute*> attrList = theSource.GetAttributes();
+ for(int i = 0, len = attrList.size(); i<len; i++) {
+ DF_Attribute* anAttr = attrList[i];
+ if (aTargetLabel.FindAttribute(anAttr->ID())) {
aTargetLabel.ForgetAttribute(anAttr->ID());
- anAttr = anAttrIterator.Value();
}
- Handle(TDF_Attribute) aNewAttribute = anAttr->NewEmpty();
+ DF_Attribute* aNewAttribute = anAttr->NewEmpty();
aTargetLabel.AddAttribute(aNewAttribute);
- anAttr->Paste(aNewAttribute, aRT);
+ anAttr->Paste(aNewAttribute);
}
// check auxiliary label for Comment => reference or name attribute of the referenced object
- Handle(SALOMEDSImpl_AttributeComment) aCommentAttribute;
- if (aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aCommentAttribute)) {
- char * anEntry = new char[aCommentAttribute->Value().Length() + 1];
- strcpy(anEntry, TCollection_AsciiString(aCommentAttribute->Value()).ToCString());
+ SALOMEDSImpl_AttributeComment* aCommentAttribute = NULL;
+ if ((aCommentAttribute=(SALOMEDSImpl_AttributeComment*)aAuxSourceLabel.FindAttribute(SALOMEDSImpl_AttributeComment::GetID()))) {
+ char * anEntry = new char[aCommentAttribute->Value().size() + 1];
+ strcpy(anEntry, string(aCommentAttribute->Value()).c_str());
char* aNameStart = strchr(anEntry, ' ');
if (aNameStart) {
*aNameStart = '\0';
aNameStart++;
}
if (theCopiedStudyID == theDestinationStudy->StudyId()) { // if copy to the same study, reanimate reference
- TDF_Label aRefLabel;
- TDF_Tool::Label(aTargetLabel.Data(), anEntry, aRefLabel);
+ DF_Label aRefLabel = DF_Label::Label(aTargetLabel, anEntry);
SALOMEDSImpl_AttributeReference::Set(aTargetLabel, aRefLabel);
// target attributes structure support
SALOMEDSImpl_AttributeTarget::Set(aRefLabel)->Add(SALOMEDSImpl_Study::SObject(aTargetLabel));
} else {
if (aNameStart) SALOMEDSImpl_AttributeName::Set(aTargetLabel, aNameStart);
- else SALOMEDSImpl_AttributeName::Set(aTargetLabel, TCollection_ExtendedString("Reference to:")+anEntry);
+ else SALOMEDSImpl_AttributeName::Set(aTargetLabel, std::string("Reference to:")+anEntry);
}
delete [] anEntry;
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_StudyManager::Paste(const Handle(SALOMEDSImpl_SObject)& theObject,
- SALOMEDSImpl_Driver* theEngine)
+SALOMEDSImpl_SObject SALOMEDSImpl_StudyManager::Paste(const SALOMEDSImpl_SObject& theObject,
+ SALOMEDSImpl_Driver* theEngine)
{
_errorCode = "";
- Handle(SALOMEDSImpl_Study) aStudy = theObject->GetStudy();
+ SALOMEDSImpl_SObject so;
+ SALOMEDSImpl_Study* aStudy = theObject.GetStudy();
// if study is locked, then paste can't be done
if (aStudy->GetProperties()->IsLocked()) {
}
// if there is no component name, then paste only SObjects and attributes: without component help
- Handle(SALOMEDSImpl_AttributeComment) aComponentName;
- bool aStructureOnly = !_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID(), aComponentName);
+ SALOMEDSImpl_AttributeComment* aComponentName = NULL;
+ bool aStructureOnly = !(aComponentName=(SALOMEDSImpl_AttributeComment*)_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeComment::GetID()));
// get copied study ID
- Handle(SALOMEDSImpl_AttributeInteger) aStudyIDAttribute;
- if (!_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), aStudyIDAttribute)) {
+ SALOMEDSImpl_AttributeInteger* aStudyIDAttribute = NULL;
+ if (!(aStudyIDAttribute=(SALOMEDSImpl_AttributeInteger*)_clipboard->Main().Root().FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) {
_errorCode = "No study ID was found";
- return NULL;
+ return so;
}
int aCStudyID = aStudyIDAttribute->Value();
// CAF document of current study usage
- Handle(TDocStd_Document) aDocument = GetDocumentOfStudy(aStudy);
- if (aDocument.IsNull()) {
- _errorCode = "OCAF document is null";
- return NULL;
+ DF_Document* aDocument = GetDocumentOfStudy(aStudy);
+ if (!aDocument) {
+ _errorCode = "Document is null";
+ return so;
}
- Handle(SALOMEDSImpl_SComponent) aComponent = theObject->GetFatherComponent();
+ SALOMEDSImpl_SComponent aComponent = theObject.GetFatherComponent();
// fill root inserted SObject
- TDF_Label aStartLabel;
+ DF_Label aStartLabel;
if (aStructureOnly) {
- TDF_Label anObjectLabel;
- TDF_Tool::Label(aDocument->GetData(), theObject->GetID(), anObjectLabel);
+ DF_Label anObjectLabel = DF_Label::Label(aDocument->Main(), theObject.GetID());
aStartLabel = PasteLabel(aStudy, theEngine, _clipboard->Main(), anObjectLabel, aCStudyID, false);
} else {
- TDF_Label aComponentLabel;
- TDF_Tool::Label(aDocument->GetData(), aComponent->GetID(), aComponentLabel);
+ DF_Label aComponentLabel = DF_Label::Label(aDocument->Main(), aComponent.GetID());
aStartLabel = PasteLabel(aStudy, theEngine, _clipboard->Main(), aComponentLabel, aCStudyID, true);
}
// paste all sublebels
- TDF_ChildIterator anIterator(_clipboard->Main(), Standard_True);
+ DF_ChildIterator anIterator(_clipboard->Main(), true);
for(; anIterator.More(); anIterator.Next()) {
PasteLabel(aStudy, theEngine, anIterator.Value(), aStartLabel, aCStudyID, false);
}
* Purpose : Save attributes for object
*/
//============================================================================
-static void SaveAttributes(Handle(SALOMEDSImpl_SObject) aSO, HDFgroup *hdf_group_sobject)
+static void SaveAttributes(const SALOMEDSImpl_SObject& aSO, HDFgroup *hdf_group_sobject)
{
hdf_size size[1];
- TDF_AttributeIterator Itr(aSO->GetLabel());
- Handle(TDF_Attribute) anAttr;
- for(; Itr.More(); Itr.Next()) {
- anAttr = Itr.Value();
+ vector<DF_Attribute*> attrList = aSO.GetLabel().GetAttributes();
+ DF_Attribute* anAttr = NULL;
+ for(int i = 0, len = attrList.size(); i<len; i++) {
+ anAttr = attrList[i];
//The following attributes are not supposed to be written to the file
- if(anAttr->DynamicType() == STANDARD_TYPE(SALOMEDSImpl_AttributeIOR)) continue; //IOR attribute is not saved
- Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anAttr);
- TCollection_AsciiString aSaveStr = ga->Save();
- //cout << "Saving: " << aSO->GetID() << " "<< ga->Type() << " value: " << aSaveStr << endl;
- size[0] = (hdf_int32) strlen(aSaveStr.ToCString()) + 1;
- HDFdataset *hdf_dataset = new HDFdataset((char*)ga->Type().ToCString(), hdf_group_sobject,HDF_STRING,size,1);
+ string type = SALOMEDSImpl_GenericAttribute::Impl_GetType(anAttr);
+ if(type == string("AttributeIOR")) continue; //IOR attribute is not saved
+ string aSaveStr =anAttr->Save();
+ //cout << "Saving: " << aSO.GetID() << " type: "<< type<<"|" << endl;
+ size[0] = (hdf_int32) strlen(aSaveStr.c_str()) + 1;
+ HDFdataset *hdf_dataset = new HDFdataset((char*)type.c_str(), hdf_group_sobject, HDF_STRING,size, 1);
hdf_dataset->CreateOnDisk();
- hdf_dataset->WriteOnDisk((char*)aSaveStr.ToCString());
+ hdf_dataset->WriteOnDisk((char*)aSaveStr.c_str());
hdf_dataset->CloseOnDisk();
hdf_dataset=0; //will be deleted by hdf_sco_group destructor
}
//===========================================================================
//Function : ReadAttributes
//===========================================================================
-static void ReadAttributes(const Handle(SALOMEDSImpl_Study)& theStudy,
- const Handle(SALOMEDSImpl_SObject)& aSO,
+static void ReadAttributes(SALOMEDSImpl_Study* theStudy,
+ const SALOMEDSImpl_SObject& aSO,
HDFdataset* hdf_dataset)
{
hdf_dataset->OpenOnDisk();
- Handle(TDF_Attribute) anAttr;
-
+ DF_Attribute* anAttr = NULL;
char* current_string = new char[hdf_dataset->GetSize()+1];
hdf_dataset->ReadFromDisk(current_string);
-
+ //cout << "Reading attr type = " << hdf_dataset->GetName() << " SO = " << aSO.GetID() << endl;
if (!strcmp(hdf_dataset->GetName(),"COMPONENTDATATYPE")) {
anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, "AttributeComment");
} else if (!strcmp(hdf_dataset->GetName(),"AttributeReference") ||
anAttr = theStudy->NewBuilder()->FindOrCreateAttribute(aSO, hdf_dataset->GetName());
}
- if (!anAttr.IsNull()) {
-
- Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(anAttr);
- ga->Load(current_string);
- //cout << "Reading: " << aSO->GetID() << " "<< ga->Type() << " value: " << current_string << endl;
+ if (anAttr) {
+ anAttr->Load(current_string);
}
delete(current_string);
//============================================================================
//Function : BuildlTree
//============================================================================
-static void BuildTree (const Handle(SALOMEDSImpl_Study)& theStudy, HDFgroup* hdf_current_group)
+static void BuildTree (SALOMEDSImpl_Study* theStudy, HDFgroup* hdf_current_group)
{
hdf_current_group->OpenOnDisk();
- Handle(SALOMEDSImpl_SObject) aSO;
+ SALOMEDSImpl_SObject aSO;
char* Entry = hdf_current_group->GetName();
if (strcmp(Entry,"STUDY_STRUCTURE") == 0) {
aSO = theStudy->CreateObjectID("0:1");
}
char name[HDF_NAME_MAX_LEN+1];
- Standard_Integer nbsons = hdf_current_group->nInternalObjects();
- for (Standard_Integer i=0; i<nbsons; i++) {
+ int nbsons = hdf_current_group->nInternalObjects();
+ for (int i=0; i<nbsons; i++) {
hdf_current_group->InternalObjectIndentify(i,name);
if (strncmp(name, "INTERNAL_COMPLEX",16) == 0) continue;
hdf_object_type type = hdf_current_group->InternalObjectType(name);
//============================================================================
//Function : Translate_IOR_to_persistentID
//============================================================================
-static void Translate_IOR_to_persistentID (const Handle(SALOMEDSImpl_SObject)& so,
+static void Translate_IOR_to_persistentID (const SALOMEDSImpl_SObject& so,
SALOMEDSImpl_Driver* engine,
bool isMultiFile,
bool isASCII)
{
- TDF_ChildIterator itchild(so->GetLabel());
- TCollection_AsciiString ior_string, persistent_string, curid;
+ DF_ChildIterator itchild(so.GetLabel());
+ string ior_string, persistent_string, curid;
for (; itchild.More(); itchild.Next()) {
- Handle(SALOMEDSImpl_SObject) current = SALOMEDSImpl_Study::SObject(itchild.Value());
- Handle(SALOMEDSImpl_AttributeIOR) IOR;
- if (current->GetLabel().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID(), IOR)) {
+ SALOMEDSImpl_SObject current = SALOMEDSImpl_Study::SObject(itchild.Value());
+ SALOMEDSImpl_AttributeIOR* IOR = NULL;
+ if ((IOR=(SALOMEDSImpl_AttributeIOR*)current.GetLabel().FindAttribute(SALOMEDSImpl_AttributeIOR::GetID()))) {
ior_string = IOR->Value();
persistent_string = engine->IORToLocalPersistentID (current, ior_string, isMultiFile, isASCII);
- SALOMEDSImpl_AttributePersistentRef::Set(current->GetLabel(), persistent_string);
+ SALOMEDSImpl_AttributePersistentRef::Set(current.GetLabel(), persistent_string);
}
Translate_IOR_to_persistentID (current, engine, isMultiFile, isASCII);
}
}
+
#ifndef __SALOMEDSImpl_STUDYMANAGER_I_H__
#define __SALOMEDSImpl_STUDYMANAGER_I_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyManager, MMgt_TShared )
-
// std C++ headers
#include <strstream>
+#include <string>
+#include <vector>
-// Cascade headers
-#include "SALOMEDSImpl_OCAFApplication.hxx"
+#include "DF_Application.hxx"
#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_Driver.hxx"
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TDocStd_Document.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include "DF_Document.hxx"
class HDFgroup;
-class SALOMEDSImpl_StudyManager : public MMgt_TShared
+class SALOMEDSImpl_StudyManager
{
private:
- Handle (SALOMEDSImpl_OCAFApplication) _OCAFApp;
- int _IDcounter;
- Handle(TDocStd_Document) _clipboard;
- TCollection_AsciiString _errorCode;
+ DF_Application* _appli;
+ int _IDcounter;
+ DF_Document* _clipboard;
+ std::string _errorCode;
public:
Standard_EXPORT virtual ~SALOMEDSImpl_StudyManager();
//! method to Create a New Study of name study_name
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) NewStudy(const TCollection_AsciiString& study_name);
+ Standard_EXPORT virtual SALOMEDSImpl_Study* NewStudy(const std::string& study_name);
//! method to Open a Study from it's persistent reference
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) Open(const TCollection_AsciiString& aStudyUrl);
+ Standard_EXPORT virtual SALOMEDSImpl_Study* Open(const std::string& aStudyUrl);
//! method to close a Study
- Standard_EXPORT virtual void Close(const Handle(SALOMEDSImpl_Study)& aStudy);
+ Standard_EXPORT virtual void Close(SALOMEDSImpl_Study* aStudy);
//! method to save a Study
- Standard_EXPORT virtual bool Save(const Handle(SALOMEDSImpl_Study)& aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
+ Standard_EXPORT virtual bool Save(SALOMEDSImpl_Study* aStudy, SALOMEDSImpl_DriverFactory* aFactory, bool theMultiFile);
- Standard_EXPORT virtual bool SaveASCII(const Handle(SALOMEDSImpl_Study)& aStudy,
- SALOMEDSImpl_DriverFactory* aFactory,
- bool theMultiFile);
+ Standard_EXPORT 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 TCollection_AsciiString& aUrl,
- const Handle(SALOMEDSImpl_Study)& aStudy,
- SALOMEDSImpl_DriverFactory* aFactory,
- bool theMultiFile);
+ Standard_EXPORT virtual bool SaveAs(const std::string& aUrl,
+ SALOMEDSImpl_Study* aStudy,
+ SALOMEDSImpl_DriverFactory* aFactory,
+ bool theMultiFile);
- Standard_EXPORT virtual bool SaveAsASCII(const TCollection_AsciiString& aUrl,
- const Handle(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);
//! method to Get name list of open studies in the session
- Standard_EXPORT virtual Handle(TColStd_HSequenceOfTransient) GetOpenStudies();
+ Standard_EXPORT virtual std::vector<SALOMEDSImpl_Study*> GetOpenStudies();
//! method to get a Study from it's name
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByName(const TCollection_AsciiString& aStudyName) ;
+ Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudyByName(const std::string& aStudyName) ;
//! method to get a Study from it's ID
- Standard_EXPORT virtual Handle(SALOMEDSImpl_Study) GetStudyByID(int aStudyID) ;
+ Standard_EXPORT virtual SALOMEDSImpl_Study* GetStudyByID(int aStudyID) ;
- Standard_EXPORT Handle(TDocStd_Document) GetDocumentOfStudy(const Handle(SALOMEDSImpl_Study)& theStudy);
+ Standard_EXPORT DF_Document* GetDocumentOfStudy(SALOMEDSImpl_Study* theStudy);
- Standard_EXPORT Handle(TDocStd_Document) GetClipboard() { return _clipboard; }
+ Standard_EXPORT DF_Document* GetClipboard() { return _clipboard; }
- Standard_EXPORT bool CopyLabel(const Handle(SALOMEDSImpl_Study)& theSourceStudy,
- SALOMEDSImpl_Driver* theEngine,
- const int theSourceStartDepth,
- const TDF_Label& theSource,
- const TDF_Label& theDestinationMain);
-
- Standard_EXPORT TDF_Label PasteLabel(const Handle(SALOMEDSImpl_Study)& theDestinationStudy,
- SALOMEDSImpl_Driver* theEngine,
- const TDF_Label& theSource,
- const TDF_Label& theDestinationStart,
- const int theCopiedStudyID,
- const bool isFirstElement);
+ 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 Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
- Standard_EXPORT virtual bool Copy(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
- Standard_EXPORT virtual bool CanPaste(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) Paste(const Handle(SALOMEDSImpl_SObject)& theObject, SALOMEDSImpl_Driver* Engine);
+ 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);
// _SaveAs private function called by Save and SaveAs
- Standard_EXPORT virtual bool Impl_SaveAs(const TCollection_AsciiString& aUrl,
- const Handle(SALOMEDSImpl_Study)& aStudy,
- SALOMEDSImpl_DriverFactory* aFactory,
- bool theMultiFile,
- bool theASCII);
+ Standard_EXPORT 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 Handle(SALOMEDSImpl_SObject)& SC, HDFgroup *hdf_group_datatype);
+ Standard_EXPORT virtual bool Impl_SaveObject(const SALOMEDSImpl_SObject& SC, HDFgroup *hdf_group_datatype);
// _SubstituteSlash function called by Open and GetStudyByName
- Standard_EXPORT virtual TCollection_AsciiString Impl_SubstituteSlash(const TCollection_AsciiString& aUrl);
+ Standard_EXPORT virtual std::string Impl_SubstituteSlash(const std::string& aUrl);
- Standard_EXPORT virtual bool Impl_SaveProperties(const Handle(SALOMEDSImpl_Study)& aStudy, HDFgroup *hdf_group);
+ Standard_EXPORT virtual bool Impl_SaveProperties(SALOMEDSImpl_Study* aStudy, HDFgroup *hdf_group);
- Standard_EXPORT TCollection_AsciiString GetErrorCode() { return _errorCode; }
+ Standard_EXPORT std::string GetErrorCode() { return _errorCode; }
Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyManager )
-
};
#endif
#include "SALOMEDSImpl_TMPFile.hxx"
-#include <Handle_Standard_Type.hxx>
-#include <Standard_Transient.hxx>
-
-
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_TMPFile, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_TMPFile, MMgt_TShared )
-
SALOMEDSImpl_TMPFile::TOctet*
SALOMEDSImpl_TMPFile
::Data()
#ifndef __SALOMEDSIMPL_TMPFILE_H__
#define __SALOMEDSIMPL_TMPFILE_H__
-//Handle definition
-#include <MMgt_TShared.hxx>
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
+#include "DF_definitions.hxx"
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_TMPFile, MMgt_TShared );
-
-
-struct SALOMEDSImpl_TMPFile : public MMgt_TShared
+struct SALOMEDSImpl_TMPFile
{
typedef unsigned char TOctet;
+ //typedef unsigned int size_t;
Standard_EXPORT virtual size_t Size() = 0;
Standard_EXPORT virtual TOctet* Data();
Standard_EXPORT virtual TOctet& Get(size_t) = 0;
-
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_TMPFile );
};
#include <stdio.h>
#include <iostream>
#include <fstream>
-#include <OSD_Path.hxx>
-#include <OSD_File.hxx>
-#include <OSD_Directory.hxx>
-#include <OSD_Process.hxx>
-#include <OSD_Directory.hxx>
-#include <OSD_Protection.hxx>
-#include <OSD_SingleProtection.hxx>
-#include <OSD_FileIterator.hxx>
+
#ifndef WNT
#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <pwd.h>
+#include <unistd.h>
#else
#include <time.h>
+#include <lmcons.h>
#endif
+
#include <stdlib.h>
using namespace std;
+
+bool Exists(const string thePath)
+{
+#ifdef WNT
+ 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 : GetTempDir
// purpose : Return a temp directory to store created files like "/tmp/sub_dir/"
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Tool::GetTmpDir()
+string SALOMEDSImpl_Tool::GetTmpDir()
{
//Find a temporary directory to store a file
- TCollection_AsciiString aTmpDir;
+ string aTmpDir;
char *Tmp_dir = getenv("SALOME_TMP_DIR");
if(Tmp_dir != NULL) {
- aTmpDir = TCollection_AsciiString(Tmp_dir);
+ aTmpDir = string(Tmp_dir);
#ifdef WIN32
- if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
+ if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\';
#else
- if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
+ if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/';
#endif
}
else {
#ifdef WIN32
- aTmpDir = TCollection_AsciiString("C:\\");
+ aTmpDir = string("C:\\");
#else
- aTmpDir = TCollection_AsciiString("/tmp/");
+ aTmpDir = string("/tmp/");
#endif
}
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
- TCollection_AsciiString aSubDir(aRND);
- if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876");
+ 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(Exists(aDir)) {
+ for(aRND = 0; Exists(aDir); aRND++) {
+ sprintf(buffer, "%d", aRND);
+ aDir = aTmpDir+buffer; //Build a unique directory name
+ }
+ }
+
#ifdef WIN32
- if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
+ if(aDir[aTmpDir.size()-1] != '\\') aDir+='\\';
#else
- if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
+ if(aDir[aTmpDir.size()-1] != '/') aDir+='/';
#endif
- OSD_Path aPath(aTmpDir);
- OSD_Directory aDir(aPath);
-
- for(aRND = 0; aDir.Exists(); aRND++) {
- aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name
- aPath = OSD_Path(aTmpDir);
- aDir = OSD_Directory(aPath);
- }
- OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX);
- aDir.Build(aProtection);
+#ifdef WNT
+ CreateDirectory(aDir.c_str(), NULL);
+#else
+ mkdir(aDir.c_str(), 0x1ff);
+#endif
- return aTmpDir;
+ return aDir;
}
//============================================================================
// function : RemoveTemporaryFiles
// purpose : Removes files listed in theFileList
//============================================================================
-void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const TCollection_AsciiString& theDirectory,
- const Handle(TColStd_HSequenceOfAsciiString)& theFiles,
+void SALOMEDSImpl_Tool::RemoveTemporaryFiles(const string& theDirectory,
+ const vector<string>& theFiles,
const bool IsDirDeleted)
{
- TCollection_AsciiString aDirName = theDirectory;
+ string aDirName = theDirectory;
- int i, aLength = theFiles->Length();
+ int i, aLength = theFiles.size();
for(i=1; i<=aLength; i++) {
- TCollection_AsciiString aFile(aDirName);
- aFile += theFiles->Value(i);
- OSD_Path anOSDPath(aFile);
- OSD_File anOSDFile(anOSDPath);
- if(!anOSDFile.Exists()) continue;
-
- OSD_Protection aProtection = anOSDFile.Protection();
- aProtection.SetUser(OSD_RW);
- anOSDFile.SetProtection(aProtection);
-
- anOSDFile.Remove();
+ string aFile(aDirName);
+ aFile += theFiles[i-1];
+ if(!Exists(aFile)) continue;
+
+#ifdef WNT
+ DeleteFile(aFile.c_str());
+#else
+ unlink(aFile.c_str());
+#endif
}
if(IsDirDeleted) {
- OSD_Path aPath(aDirName);
- OSD_Directory aDir(aPath);
- OSD_FileIterator anIterator(aPath, '*');
-
- if(aDir.Exists() && !anIterator.More()) aDir.Remove();
+ if(Exists(aDirName)) {
+#ifdef WNT
+ RemoveDirectory(aDireName.c_str());
+#else
+ rmdir(aDirName.c_str());
+#endif
+ }
}
}
// function : GetNameFromPath
// purpose : Returns the name by the path
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Tool::GetNameFromPath(const TCollection_AsciiString& thePath) {
- if (thePath.IsEmpty()) return "";
- OSD_Path aPath = OSD_Path(thePath);
- TCollection_AsciiString aNameString(aPath.Name());
- return aNameString;
+string SALOMEDSImpl_Tool::GetNameFromPath(const string& thePath) {
+ if (thePath.empty()) return "";
+ int pos = thePath.rfind('/');
+ if(pos > 0) return thePath.substr(pos+1, thePath.size());
+ pos = thePath.rfind('\\');
+ if(pos > 0) return thePath.substr(pos+1, thePath.size());
+ pos = thePath.rfind('|');
+ if(pos > 0) return thePath.substr(pos+1, thePath.size());
+ return thePath;
}
//============================================================================
// function : GetDirFromPath
// purpose : Returns the dir by the path
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_Tool::GetDirFromPath(const TCollection_AsciiString& thePath) {
- if (thePath.IsEmpty()) return "";
- OSD_Path aPath = OSD_Path(thePath);
- TCollection_AsciiString aDirString;
- /*Unix platform don't use <disk> assignment in <path> string
- but we must to add it for WNT case*/
- TCollection_AsciiString disk = aPath.Disk();
- if(disk.Length()) aDirString.AssignCat(disk);
- aDirString.AssignCat(aPath.Trek());
- aDirString.ChangeAll('|','/');
- return aDirString;
+string SALOMEDSImpl_Tool::GetDirFromPath(const string& thePath) {
+ if (thePath.empty()) return "";
+
+ int pos = thePath.rfind('/');
+ string path;
+ if(pos > 0) {
+ path = thePath.substr(0, pos+1);
+ }
+ if(path.empty()) {
+ pos = thePath.rfind('\\');
+ if(pos > 0) path = thePath.substr(0, pos+1);
+ }
+ if(path.empty()) {
+ pos = thePath.rfind('|');
+ if(pos > 0) path = thePath.substr(0, pos+1);
+ }
+ if(path.empty()) {
+ path = thePath+"/";
+ }
+
+#ifdef WNT //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++)
+ if(path[i] == '|') path[i] = '/';
+ return path;
+}
+
+//============================================================================
+// function :
+// purpose : The functions returns a list of substring of initial string
+// divided by given separator
+//============================================================================
+vector<string> SALOMEDSImpl_Tool::splitString(const string& theValue, char separator)
+{
+ vector<string> vs;
+ if(theValue[0] == separator && theValue.size() == 1) return vs;
+ int pos = theValue.find(separator);
+ if(pos < 0) {
+ vs.push_back(theValue);
+ return vs;
+ }
+
+ string s = theValue;
+ if(s[0] == separator) s = s.substr(1, s.size());
+ while((pos = s.find(separator)) >= 0) {
+ vs.push_back(s.substr(0, pos));
+ s = s.substr(pos+1, s.size());
+ }
+
+ if(!s.empty() && s[0] != separator) vs.push_back(s);
+ return vs;
}
+void SALOMEDSImpl_Tool::GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds)
+{
+#ifdef WNT
+ SYSTEMTIME st;
+ GetLocalTime ( &st );
+ month = st.wMonth;
+ day = st.wDay;
+ year = st.wYear;
+ hours = st.wHour;
+ minutes = st.wMinute;
+ seconds = st.wSecond;
+#else
+ struct tm transfert;
+ struct timeval tval;
+ struct timezone tzone;
+ int status;
+
+ status = gettimeofday( &tval, &tzone );
+ memcpy(&transfert, localtime((time_t *)&tval.tv_sec), sizeof(tm));
+
+ month = transfert.tm_mon + 1;
+ day = transfert.tm_mday;
+ year = transfert.tm_year + 1900;
+ hours = transfert.tm_hour;
+ minutes = transfert.tm_min ;
+ seconds = transfert.tm_sec ;
+#endif
+}
+string SALOMEDSImpl_Tool::GetUserName()
+{
+#ifdef WNT
+ char* pBuff = new char[UNLEN + 1];
+ DWORD dwSize = UNLEN + 1;
+ string retVal;
+ GetUserName ( pBuff, &dwSize );
+ string theTmpUserName(pBuff,(int)dwSize -1 );
+ retVal = theTmpUserName;
+ delete [] pBuff;
+ return retVal;
+#else
+ struct passwd *infos;
+ infos = getpwuid(getuid());
+ return string(infos->pw_name);
+#endif
+}
#ifndef __SALOMEDSIMPL_TOOL_H__
#define __SALOMEDSIMPL_TOOL_H__
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Label.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
+#include <string>
+#include <vector>
+#include "DF_Label.hxx"
class SALOMEDSImpl_Tool
{
// 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
- static TCollection_AsciiString GetTmpDir();
+ static std::string GetTmpDir();
// Removes files which are in <theDirectory>, the files for deletion are listed in <theFiles>
// if <IsDirDeleted> is true <theDirectory> is also deleted if it is empty
- static void RemoveTemporaryFiles(const TCollection_AsciiString& theDirectory,
- const Handle(TColStd_HSequenceOfAsciiString)& theFiles,
+ static void RemoveTemporaryFiles(const std::string& theDirectory,
+ const std::vector<std::string>& theFiles,
const bool IsDirDeleted);
// Returns the name by the path
// for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "doc1"
- static TCollection_AsciiString GetNameFromPath(const TCollection_AsciiString& thePath);
+ static std::string GetNameFromPath(const std::string& thePath);
// Returns the directory by the path
// for an example: if thePath = "/tmp/aaa/doc1.hdf" the function returns "/tmp/aaa"
- static TCollection_AsciiString GetDirFromPath(const TCollection_AsciiString& thePath);
+ static std::string GetDirFromPath(const std::string& thePath);
+
+ //The functions returns a list of substring of initial string divided by given separator
+ static std::vector<std::string> splitString(const std::string& theValue, char separator);
+
+ //Returns a system date
+ static void GetSystemDate(int& year, int& month, int& day, int& hours, int& minutes, int& seconds);
+
+ //Returns a name of the user
+ static std::string GetUserName();
};
#endif
#include "SALOMEDSImpl_Study.hxx"
#include "SALOMEDSImpl_Attributes.hxx"
-#include <TDF_Label.hxx>
-#include <TDF_Tool.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_AttributeList.hxx>
-#include <TDF_ListIteratorOfAttributeList.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_ChildIterator.hxx>
+#include "DF_ChildIterator.hxx"
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared )
-
-
#define USE_CASE_LABEL_TAG 2
#define USE_CASE_GUID "AA43BB12-D9CD-11d6-945D-0050DA506788"
* Purpose :
*/
//============================================================================
-SALOMEDSImpl_UseCaseBuilder::SALOMEDSImpl_UseCaseBuilder(const Handle(TDocStd_Document)& theDocument)
+SALOMEDSImpl_UseCaseBuilder::SALOMEDSImpl_UseCaseBuilder(DF_Document* theDocument)
:_doc(theDocument)
{
- if(_doc.IsNull()) return;
+ if(!_doc) return;
- TDF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases
- if(!aLabel.FindAttribute(Standard_GUID(USE_CASE_GUID), _root)) {
- _root = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, Standard_GUID(USE_CASE_GUID));
+ DF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases
+ if(!(_root = (SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(std::string(USE_CASE_GUID)))) {
+ _root = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, std::string(USE_CASE_GUID));
}
- Handle(SALOMEDSImpl_AttributeReference) aRef;
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ SALOMEDSImpl_AttributeReference* aRef = NULL;
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
}
- Handle(SALOMEDSImpl_AttributeName) aNameAttr;
- if(!aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttr)) {
- aNameAttr = SALOMEDSImpl_AttributeName::Set(aLabel, "Use cases");
+ if(!aLabel.FindAttribute(SALOMEDSImpl_AttributeName::GetID())) {
+ SALOMEDSImpl_AttributeName::Set(aLabel, "Use cases");
}
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::Append(const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_UseCaseBuilder::Append(const SALOMEDSImpl_SObject& theObject)
{
- if(_root.IsNull() || theObject.IsNull()) return false;
+ if(!_root || !theObject) return false;
- TDF_Label aLabel = theObject->GetLabel();
+ DF_Label aLabel = theObject.GetLabel();
if(aLabel.IsNull()) return false;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode, aCurrentNode;
+ SALOMEDSImpl_AttributeTreeNode* aNode = NULL;
+ SALOMEDSImpl_AttributeTreeNode* aCurrentNode = NULL;
aNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, _root->ID());
aNode->Remove();
- Handle(SALOMEDSImpl_AttributeReference) aRef;
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ SALOMEDSImpl_AttributeReference* aRef;
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
}
- TDF_Label aCurrent = aRef->Get();
- if(aCurrent.IsNull() || !aCurrent.FindAttribute(_root->ID(), aCurrentNode))
+ DF_Label aCurrent = aRef->Get();
+ if(aCurrent.IsNull() || !(aCurrentNode=(SALOMEDSImpl_AttributeTreeNode*)aCurrent.FindAttribute(_root->ID())))
aCurrentNode = _root;
aCurrentNode->Append(aNode);
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::Remove(const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_UseCaseBuilder::Remove(const SALOMEDSImpl_SObject& theObject)
{
- if(_root.IsNull() || theObject.IsNull()) return false;
+ if(!_root || !theObject) return false;
- TDF_Label aLabel = theObject->GetLabel();
+ DF_Label aLabel = theObject.GetLabel();
if(aLabel.IsNull()) return false;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode;
- if(!aLabel.FindAttribute(_root->ID(), aNode)) return false;
+ SALOMEDSImpl_AttributeTreeNode* aNode = NULL;
+ if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false;
aNode->Remove();
- TDF_AttributeList aList;
- aList.Append(aNode);
+ vector<DF_Attribute*> aList;
+ aList.push_back(aNode);
- Handle(SALOMEDSImpl_AttributeReference) aRef;
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ SALOMEDSImpl_AttributeReference* aRef = NULL;
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
}
- TDF_Label aCurrent = aRef->Get();
- SALOMEDSImpl_ChildNodeIterator aChildItr(aNode, Standard_True);
+ DF_Label aCurrent = aRef->Get();
+
+ SALOMEDSImpl_ChildNodeIterator aChildItr(aNode, true);
for(; aChildItr.More(); aChildItr.Next())
- aList.Append(aChildItr.Value());
+ aList.push_back(aChildItr.Value());
- TDF_ListIteratorOfAttributeList anIterator(aList);
- for(; anIterator.More(); anIterator.Next()) {
- if(anIterator.Value()->Label() == aCurrent) { //The current node is removed
+ for(int i = 0, len = aList.size(); i<len; i++) {
+ if(aList[i]->Label() == aCurrent) { //The current node is removed
aRef->Set(_root->Label()); //Reset the current node to the root
}
- anIterator.Value()->Label().ForgetAttribute(_root->ID());
+ aList[i]->Label().ForgetAttribute(_root->ID());
}
return true;
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const Handle(SALOMEDSImpl_SObject)& theFather,
- const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_UseCaseBuilder::AppendTo(const SALOMEDSImpl_SObject& theFather,
+ const SALOMEDSImpl_SObject& theObject)
{
- if(_root.IsNull() || theFather.IsNull() || theObject.IsNull()) return false;
+ if(!_root || !theFather || !theObject) return false;
- TDF_Label aFatherLabel = theFather->GetLabel(), aLabel = theObject->GetLabel();
+ DF_Label aFatherLabel = theFather.GetLabel(), aLabel = theObject.GetLabel();
if(aFatherLabel == aLabel) return false;
- Handle(SALOMEDSImpl_AttributeTreeNode) aFather, aNode;
+ SALOMEDSImpl_AttributeTreeNode *aFather = false, *aNode = false;
if(aFatherLabel.IsNull()) return false;
- if(!aFatherLabel.FindAttribute(_root->ID(), aFather)) return false;
+ if(!(aFather=(SALOMEDSImpl_AttributeTreeNode*)aFatherLabel.FindAttribute(_root->ID()))) return false;
if(aLabel.IsNull()) return false;
- if(!aLabel.FindAttribute(_root->ID(), aNode)) {
+ if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) {
aNode = SALOMEDSImpl_AttributeTreeNode::Set(aLabel, _root->ID());
}
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const Handle(SALOMEDSImpl_SObject)& theFirst,
- const Handle(SALOMEDSImpl_SObject)& theNext)
+bool SALOMEDSImpl_UseCaseBuilder::InsertBefore(const SALOMEDSImpl_SObject& theFirst,
+ const SALOMEDSImpl_SObject& theNext)
{
- if(_root.IsNull() || theFirst.IsNull() || theNext.IsNull()) return false;
+ if(!_root || !theFirst || !theNext) return false;
- TDF_Label aFirstLabel = theFirst->GetLabel(), aLabel= theNext->GetLabel();
+ DF_Label aFirstLabel = theFirst.GetLabel(), aLabel= theNext.GetLabel();
if(aFirstLabel == aLabel) return false;
- Handle(SALOMEDSImpl_AttributeTreeNode) aFirstNode, aNode;
+ SALOMEDSImpl_AttributeTreeNode *aFirstNode = NULL, *aNode = NULL;
if(aFirstLabel.IsNull()) return false;
- if(aFirstLabel.FindAttribute(_root->ID(), aFirstNode)) {
+ if((aFirstNode=(SALOMEDSImpl_AttributeTreeNode*)aFirstLabel.FindAttribute(_root->ID()))) {
aFirstNode->Remove();
aFirstLabel.ForgetAttribute(aFirstNode->ID());
}
aFirstNode = SALOMEDSImpl_AttributeTreeNode::Set(aFirstLabel, _root->ID());
if(aLabel.IsNull()) return false;
- if(!aLabel.FindAttribute(_root->ID(), aNode)) return false;
+ if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false;
aFirstNode->Remove();
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::SetCurrentObject(const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_UseCaseBuilder::SetCurrentObject(const SALOMEDSImpl_SObject& theObject)
{
- if(_root.IsNull() || theObject.IsNull()) return false;
+ if(!_root || !theObject) return false;
- TDF_Label aLabel = theObject->GetLabel();
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode;
+ DF_Label aLabel = theObject.GetLabel();
+ SALOMEDSImpl_AttributeTreeNode* aNode = NULL;
if(aLabel.IsNull()) return false;
- if(!aLabel.FindAttribute(_root->ID(), aNode)) return false;
-
+ if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false;
- Handle(SALOMEDSImpl_AttributeReference) aRef;
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ SALOMEDSImpl_AttributeReference* aRef = NULL;
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), aNode->Label());
}
//============================================================================
bool SALOMEDSImpl_UseCaseBuilder::SetRootCurrent()
{
- if(_root.IsNull()) return false;
+ if(!_root) return false;
- Handle(SALOMEDSImpl_AttributeReference) aRef;
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef))
+ SALOMEDSImpl_AttributeReference* aRef = NULL;
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID())))
aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
aRef->Set(_root->Label());
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::HasChildren(const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_UseCaseBuilder::HasChildren(const SALOMEDSImpl_SObject& theObject)
{
- if(_root.IsNull()) return false;
+ if(!_root) return false;
- TDF_Label aLabel;
- if (theObject.IsNull()) aLabel = _root->Label();
+ DF_Label aLabel;
+ if (!theObject) aLabel = _root->Label();
else
- aLabel = theObject->GetLabel();
+ aLabel = theObject.GetLabel();
if(aLabel.IsNull()) return false;
- Handle(SALOMEDSImpl_AttributeTreeNode) aNode;
- if(!aLabel.FindAttribute(_root->ID(), aNode)) return false;
-
- return !(aNode->GetFirst().IsNull());
+ SALOMEDSImpl_AttributeTreeNode* aNode = NULL;
+ if(!(aNode=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(_root->ID()))) return false;
+
+ return (aNode->GetFirst());
}
//============================================================================
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::SetName(const TCollection_AsciiString& theName) {
- if(_root.IsNull()) return false;
+bool SALOMEDSImpl_UseCaseBuilder::SetName(const string& theName) {
+ if(!_root) return false;
- Handle(SALOMEDSImpl_AttributeName) aNameAttrib;
+ SALOMEDSImpl_AttributeName* aNameAttrib = NULL;
- if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aNameAttrib))
+ if (!(aNameAttrib=(SALOMEDSImpl_AttributeName*)_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID())))
aNameAttrib = SALOMEDSImpl_AttributeName::Set(_root->Label(), theName);
- else
- aNameAttrib->SetValue(theName);
+
+ aNameAttrib->SetValue(theName);
return true;
}
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::GetCurrentObject()
+SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::GetCurrentObject()
{
- if(_root.IsNull()) return NULL;
+ SALOMEDSImpl_SObject so;
+ if(!_root) return so;
- Handle(SALOMEDSImpl_AttributeReference) aRef;
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ SALOMEDSImpl_AttributeReference* aRef = NULL;
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
aRef = SALOMEDSImpl_AttributeReference::Set(_root->Label(), _root->Label());
}
- TDF_Label aCurrent = aRef->Get();
- if(aCurrent.IsNull()) return NULL;
+
+ DF_Label aCurrent = aRef->Get();
+ if(aCurrent.IsNull()) return so;
return SALOMEDSImpl_Study::SObject(aCurrent);
}
* Purpose :
*/
//============================================================================
-TCollection_AsciiString SALOMEDSImpl_UseCaseBuilder::GetName()
+string SALOMEDSImpl_UseCaseBuilder::GetName()
{
- TCollection_AsciiString aString;
- if(_root.IsNull()) return aString;
+ string aString;
+ if(!_root) return aString;
- Handle(SALOMEDSImpl_AttributeName) aName;
- if (!_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID(), aName)) return aString;
- aString = TCollection_AsciiString(aName->Value());
- return aString;
+ SALOMEDSImpl_AttributeName* aName = NULL;
+ if (!(aName=(SALOMEDSImpl_AttributeName*)_root->FindAttribute(SALOMEDSImpl_AttributeName::GetID()))) return aString;
+ return aName->Value();
}
//============================================================================
* Purpose :
*/
//============================================================================
-bool SALOMEDSImpl_UseCaseBuilder::IsUseCase(const Handle(SALOMEDSImpl_SObject)& theObject)
+bool SALOMEDSImpl_UseCaseBuilder::IsUseCase(const SALOMEDSImpl_SObject& theObject)
{
- if(theObject.IsNull()) return false;
- TDF_Label aFather, aLabel = theObject->GetLabel();
+ if(!theObject) return false;
+ DF_Label aFather, aLabel = theObject.GetLabel();
aFather = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG);
if(aLabel.Father() == aFather) return true;
return false;
* Purpose :
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::AddUseCase(const TCollection_AsciiString& theName)
+SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::AddUseCase(const string& theName)
{
- Standard_GUID aBasicGUID(USE_CASE_GUID);
+ string aBasicGUID(USE_CASE_GUID);
//Create a use cases structure if it not exists
- Handle(SALOMEDSImpl_AttributeTreeNode) aFatherNode, aNode;
- Handle(SALOMEDSImpl_AttributeInteger) anInteger;
- Handle(SALOMEDSImpl_AttributeReference) aRef;
+ SALOMEDSImpl_AttributeTreeNode *aFatherNode = NULL, *aNode = NULL;
+ SALOMEDSImpl_AttributeInteger* anInteger = NULL;
+ SALOMEDSImpl_AttributeReference* aRef = NULL;
- TDF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG);
+ DF_Label aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG);
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID(), aRef)) {
+ if(!(aRef=(SALOMEDSImpl_AttributeReference*)_root->FindAttribute(SALOMEDSImpl_AttributeReference::GetID()))) {
aRef = SALOMEDSImpl_AttributeReference::Set(aLabel, aLabel);
}
- if(!aRef->Get().FindAttribute(aBasicGUID, aFatherNode)) {
+ if(!(aFatherNode=(SALOMEDSImpl_AttributeTreeNode*)aRef->Get().FindAttribute(aBasicGUID))) {
aFatherNode = SALOMEDSImpl_AttributeTreeNode::Set(aRef->Get(), aBasicGUID);
}
- if(!_root->FindAttribute(SALOMEDSImpl_AttributeInteger::GetID(), anInteger)) {
+ if(!(anInteger=(SALOMEDSImpl_AttributeInteger*)_root->FindAttribute(SALOMEDSImpl_AttributeInteger::GetID()))) {
anInteger = SALOMEDSImpl_AttributeInteger::Set(aLabel, 0);
- }
+ }
//Create a new use case
anInteger->SetValue(anInteger->Value()+1);
- TDF_Label aChild = aLabel.FindChild(anInteger->Value());
+ DF_Label aChild = aLabel.FindChild(anInteger->Value());
aNode = SALOMEDSImpl_AttributeTreeNode::Set(aChild, aBasicGUID);
aNode->Remove();
aFatherNode->Append(aNode);
* Purpose : Creates a new UseCase iterator, if anObject is null all use cases are iterated
*/
//============================================================================
-Handle(SALOMEDSImpl_UseCaseIterator)
-SALOMEDSImpl_UseCaseBuilder::GetUseCaseIterator(const Handle(SALOMEDSImpl_SObject)& theObject)
+SALOMEDSImpl_UseCaseIterator
+SALOMEDSImpl_UseCaseBuilder::GetUseCaseIterator(const SALOMEDSImpl_SObject& theObject)
{
- TDF_Label aLabel;
+ DF_Label aLabel;
- if(!theObject.IsNull()) {
- aLabel = theObject->GetLabel(); //Iterate only sub tree in the use case
+ if(theObject) {
+ aLabel = theObject.GetLabel(); //Iterate only sub tree in the use case
}
else {
aLabel = _doc->Main().Root().FindChild(USE_CASE_LABEL_TAG); //Iterate all use cases
}
- return new SALOMEDSImpl_UseCaseIterator(aLabel, USE_CASE_GUID, false);
+ return SALOMEDSImpl_UseCaseIterator(aLabel, USE_CASE_GUID, false);
}
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseBuilder::GetSObject(const TCollection_AsciiString& theEntry)
+SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseBuilder::GetSObject(const string& theEntry)
{
- TDF_Label aLabel;
- TDF_Tool::Label(_doc->GetData(), theEntry, aLabel);
- return SALOMEDSImpl_Study::SObject(aLabel);
+ DF_Label L = DF_Label::Label(_root->Label(), theEntry);
+ return SALOMEDSImpl_Study::SObject(L);
}
#ifndef __SALOMEDSIMPL_USECaseBuilder_H__
#define __SALOMEDSIMPL_USECaseBuilder_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_UseCaseBuilder, MMgt_TShared )
-
-// Cascade headers
-#include <SALOMEDSImpl_AttributeTreeNode.hxx>
-#include <TDocStd_Document.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_GUID.hxx>
+#include <string>
+#include "DF_Document.hxx"
+#include "DF_Label.hxx"
+#include "SALOMEDSImpl_AttributeTreeNode.hxx"
#include "SALOMEDSImpl_UseCaseIterator.hxx"
-class SALOMEDSImpl_UseCaseBuilder : public MMgt_TShared
+class SALOMEDSImpl_UseCaseBuilder
{
private:
- Handle(SALOMEDSImpl_AttributeTreeNode) _root;
- Handle(TDocStd_Document) _doc;
+ SALOMEDSImpl_AttributeTreeNode* _root;
+ DF_Document* _doc;
public:
//! standard constructor
- Standard_EXPORT SALOMEDSImpl_UseCaseBuilder(const Handle(TDocStd_Document)& theDocument);
+ Standard_EXPORT SALOMEDSImpl_UseCaseBuilder(DF_Document* theDocument);
//! standard destructor
Standard_EXPORT ~SALOMEDSImpl_UseCaseBuilder();
- Standard_EXPORT virtual bool Append(const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual bool Append(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool Remove(const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual bool Remove(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool AppendTo(const Handle(SALOMEDSImpl_SObject)& theFather, const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual bool AppendTo(const SALOMEDSImpl_SObject& theFather, const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool InsertBefore(const Handle(SALOMEDSImpl_SObject)& theFirst, const Handle(SALOMEDSImpl_SObject)& theNext);
+ Standard_EXPORT virtual bool InsertBefore(const SALOMEDSImpl_SObject& theFirst, const SALOMEDSImpl_SObject& theNext);
- Standard_EXPORT virtual bool SetCurrentObject(const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual bool SetCurrentObject(const SALOMEDSImpl_SObject& theObject);
Standard_EXPORT virtual bool SetRootCurrent();
- Standard_EXPORT virtual bool HasChildren(const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual bool HasChildren(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool IsUseCase(const Handle(SALOMEDSImpl_SObject)& theObject);
+ Standard_EXPORT virtual bool IsUseCase(const SALOMEDSImpl_SObject& theObject);
- Standard_EXPORT virtual bool SetName(const TCollection_AsciiString& theName);
+ Standard_EXPORT virtual bool SetName(const std::string& theName);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) GetCurrentObject();
+ Standard_EXPORT virtual SALOMEDSImpl_SObject GetCurrentObject();
- Standard_EXPORT virtual TCollection_AsciiString GetName();
+ Standard_EXPORT virtual std::string GetName();
- Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) AddUseCase(const TCollection_AsciiString& theName);
+ Standard_EXPORT virtual SALOMEDSImpl_SObject AddUseCase(const std::string& theName);
- Standard_EXPORT virtual Handle(SALOMEDSImpl_UseCaseIterator) GetUseCaseIterator(const Handle(SALOMEDSImpl_SObject)& anObject);
+ Standard_EXPORT virtual SALOMEDSImpl_UseCaseIterator GetUseCaseIterator(const SALOMEDSImpl_SObject& anObject);
- Standard_EXPORT Handle(SALOMEDSImpl_SObject) GetSObject(const TCollection_AsciiString& theEntry);
+ Standard_EXPORT SALOMEDSImpl_SObject GetSObject(const std::string& theEntry);
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_UseCaseBuilder )
};
#endif
using namespace std;
-IMPLEMENT_STANDARD_HANDLE( SALOMEDSImpl_UseCaseIterator, MMgt_TShared )
-IMPLEMENT_STANDARD_RTTIEXT( SALOMEDSImpl_UseCaseIterator, MMgt_TShared )
+//============================================================================
+/*! Function : empty constructor
+ * Purpose :
+ */
+//============================================================================
+SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator()
+{
+ _node = NULL;
+}
+
//============================================================================
/*! Function : constructor
* Purpose :
*/
//============================================================================
-SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator(const TDF_Label& theLabel,
- const Standard_GUID& theGUID,
+SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator(const DF_Label& theLabel,
+ const string& theGUID,
const bool allLevels)
:_guid(theGUID), _levels(allLevels)
{
- if(theLabel.FindAttribute(_guid, _node)) {
+ if((_node = (SALOMEDSImpl_AttributeTreeNode*)theLabel.FindAttribute(_guid))) {
_it.Initialize (_node, _levels);
}
}
return _it.More();
}
- //============================================================================
+//============================================================================
/*! Function : Next
*
*/
*/
//============================================================================
-Handle(SALOMEDSImpl_SObject) SALOMEDSImpl_UseCaseIterator::Value()
+SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseIterator::Value()
{
- TDF_Label L = _it.Value()->Label();
+ DF_Label L = _it.Value()->Label();
return SALOMEDSImpl_Study::SObject(L);
}
+//============================================================================
+/*! Function : GetPersistentCopy
+ *
+ */
+//============================================================================
+SALOMEDSImpl_UseCaseIterator* SALOMEDSImpl_UseCaseIterator::GetPersistentCopy() const
+{
+ SALOMEDSImpl_UseCaseIterator* itr = new SALOMEDSImpl_UseCaseIterator();
+ itr->_it = _it;
+ itr->_node = _node;
+ itr->_guid = _guid;
+ itr->_levels = _levels;
+
+ return itr;
+}
#ifndef __SALOMEDSIMPL_USECASEITERATOR_H__
#define __SALOMEDSIMPL_USECASEITERATOR_H__
-//Handle definition
-#include <Handle_MMgt_TShared.hxx>
-#include <Standard_DefineHandle.hxx>
-DEFINE_STANDARD_HANDLE( SALOMEDSImpl_UseCaseIterator, MMgt_TShared )
-
#include "SALOMEDSImpl_SObject.hxx"
+#include "DF_ChildIterator.hxx"
+#include "SALOMEDSImpl_ChildNodeIterator.hxx"
-// Cascade headers
-#include <TDF_ChildIterator.hxx>
-#include <SALOMEDSImpl_ChildNodeIterator.hxx>
-#include <Standard_GUID.hxx>
+#include <string>
-class SALOMEDSImpl_UseCaseIterator : public MMgt_TShared
+class Standard_EXPORT SALOMEDSImpl_UseCaseIterator
{
private:
- Standard_GUID _guid;
+ std::string _guid;
bool _levels;
- Handle(SALOMEDSImpl_AttributeTreeNode) _node;
+ SALOMEDSImpl_AttributeTreeNode* _node;
SALOMEDSImpl_ChildNodeIterator _it;
public:
+ SALOMEDSImpl_UseCaseIterator();
+
//! standard constructor
- SALOMEDSImpl_UseCaseIterator(const TDF_Label& theLabel,
- const Standard_GUID& theGUID,
+ SALOMEDSImpl_UseCaseIterator(const DF_Label& theLabel,
+ const std::string& theGUID,
const bool allLevels);
//! standard destructor
virtual void Init(bool);
virtual bool More();
virtual void Next();
- virtual Handle(SALOMEDSImpl_SObject) Value();
+ virtual SALOMEDSImpl_SObject Value();
-public:
- DEFINE_STANDARD_RTTI( SALOMEDSImpl_UseCaseIterator )
+ SALOMEDSImpl_UseCaseIterator* GetPersistentCopy() const;
};
#endif
-I$(srcdir)/$(RPATH)/Utils -I$(srcdir)/$(RPATH)/Utils/Test \
-I$(srcdir)/$(RPATH)/ResourcesManager \
-I$(srcdir)/$(RPATH)/LifeCycleCORBA \
+ -I$(srcdir)/$(RPATH)/DF \
-I$(srcdir)/$(RPATH)/SALOMEDSImpl \
-I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
- @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@
# This local variable defines the list of dependant libraries common to all target in this package.
$(RPATH)/SALOMELocalTrace/Test/libSALOMELocalTraceTest.la \
$(RPATH)/SALOMELocalTrace/libSALOMELocalTrace.la \
$(RPATH)/SALOMETraceCollector/Test/libSALOMETraceCollectorTest.la \
+ $(RPATH)/DF/libDF.la \
$(RPATH)/SALOMEDSImpl/libSalomeDSImpl.la \
$(top_builddir)/idl/libSalomeIDLKernel.la
#include "SALOMEDSImpl_StudyBuilder.hxx"
#include "SALOMEDSImpl_GenericAttribute.hxx"
-#include <TCollection_AsciiString.hxx>
-
using namespace std;
// ============================================================================
void SALOMEDSImplTest::setUp()
{
- TCollection_AsciiString kernel(getenv("KERNEL_ROOT_DIR"));
- TCollection_AsciiString subPath("/share/salome/resources/kernel");
- TCollection_AsciiString csf_var = (kernel+subPath);
- setenv("CSF_PluginDefaults", csf_var.ToCString(), 0);
- setenv("CSF_SALOMEDS_ResourcesDefaults", csf_var.ToCString(), 0);
}
// ============================================================================
// ============================================================================
void SALOMEDSImplTest::testAttributeParameter()
{
- Handle(SALOMEDSImpl_StudyManager) sm = new SALOMEDSImpl_StudyManager();
- Handle(SALOMEDSImpl_Study) study = sm->NewStudy("Test");
- Handle(SALOMEDSImpl_AttributeParameter) _ap = study->GetCommonParameters("TestComp", 0);
+ SALOMEDSImpl_StudyManager* sm = new SALOMEDSImpl_StudyManager();
+ SALOMEDSImpl_Study* study = sm->NewStudy("Test");
+ SALOMEDSImpl_AttributeParameter* _ap = study->GetCommonParameters("TestComp", 0);
- CPPUNIT_ASSERT(!_ap.IsNull());
+ CPPUNIT_ASSERT(_ap);
_ap->SetInt("IntValue", 1);
CPPUNIT_ASSERT(_ap->IsSet("IntValue", PT_INTEGER));
#include <stdio.h>
#include <iostream>
#include <vector>
+#include <string>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDocStd_Document.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_Tool.hxx>
+#include "DF_Document.hxx"
+#include "DF_Attribute.hxx"
+#include "DF_Label.hxx"
+#include "DF_ChildIterator.hxx"
#include "SALOMEDSImpl_Attributes.hxx"
#include "SALOMEDSImpl_StudyManager.hxx"
#include "SALOMEDSImpl_SObject.hxx"
#include "SALOMEDSImpl_SComponent.hxx"
#include "SALOMEDSImpl_AttributeParameter.hxx"
+#include "SALOMEDSImpl_UseCaseBuilder.hxx"
+#include "SALOMEDSImpl_UseCaseIterator.hxx"
//#include "SALOMEDSImpl_.hxx"
+using namespace std;
+
int main (int argc, char * argv[])
{
cout << "Test started " << endl;
- Handle(SALOMEDSImpl_StudyManager) aSM = new SALOMEDSImpl_StudyManager();
+ SALOMEDSImpl_StudyManager* aSM = new SALOMEDSImpl_StudyManager();
cout << "Manager is created " << endl;
- Handle(SALOMEDSImpl_Study) aStudy = aSM->NewStudy("SRN");
+ SALOMEDSImpl_Study* aStudy = aSM->NewStudy("SRN");
cout << "Study with id = " << aStudy->StudyId() << " is created " << endl;
cout << "Check the study lock, locking" << endl;
aStudy->SetStudyLock("SRN");
cout << "Is study locked = " << aStudy->IsStudyLocked() << endl;
- cout << "Get study locker : " << aStudy->GetLockerID() << endl;
+ vector<string> ids = aStudy->GetLockerID();
+ for(int i = 0; i<ids.size(); i++)
+ cout << "Get study locker : " << ids[i] << endl;
aStudy->UnLockStudy("SRN");
cout << "Is study locked = " << aStudy->IsStudyLocked() << endl;
- Handle(SALOMEDSImpl_StudyBuilder) aBuilder = aStudy->NewBuilder();
+ SALOMEDSImpl_StudyBuilder* aBuilder = aStudy->NewBuilder();
cout << "StudyBuilder is created " << endl;
- Handle(SALOMEDSImpl_SComponent) aSC = aBuilder->NewComponent("TEST");
- cout << "New component with type " << aSC->ComponentDataType() << " is created " << endl;
- Handle(SALOMEDSImpl_SObject) aSO = aBuilder->NewObject(aSC);
- cout << "New SObject with ID = " << aSO->GetID() << " is created" << endl;
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(aSO->GetLabel(), anEntry);
- cout << "An entry of newly created SO is " << anEntry << endl;
- Handle(SALOMEDSImpl_AttributeIOR) aIORA = SALOMEDSImpl_AttributeIOR::Set(aSO->GetLabel(), "ior1234");
- cout << "New AttributeIOR is created, it contains " << aIORA->Value() << endl;
- Handle(SALOMEDSImpl_GenericAttribute) ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aIORA);
- cout << "Attribute has type: " << ga->Type() << " and value: " << ga->Save() << endl;
+ SALOMEDSImpl_SComponent aSC = aBuilder->NewComponent("TEST");
+ cout << "New component with type " << aSC.ComponentDataType() << " is created " << endl;
+ SALOMEDSImpl_SObject aSO = aBuilder->NewObject(aSC);
+ cout << "New SObject with ID = " << aSO.GetID() << " is created" << endl;
+ cout << "An entry of newly created SO is " << aSO.GetLabel().Entry() << endl;
+ SALOMEDSImpl_AttributeIOR* aIORA = SALOMEDSImpl_AttributeIOR::Set(aSO.GetLabel(), "ior1234");
+ cout << "New AttributeIOR is created, it contains " << dynamic_cast<SALOMEDSImpl_AttributeIOR*>(aIORA)->Value() << endl;
+ cout << "Attribute has type: " << aIORA->Type() << " and value: " << aIORA->Save() << endl;
cout << "Just another way to create an attribute: official one :) " << endl;
- Handle(TDF_Attribute) aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeName");
- Handle(SALOMEDSImpl_AttributeName) aRN = Handle(SALOMEDSImpl_AttributeName)::DownCast(aTDFAttr);
+ cout << "Is SO null : " << aSO.IsNull()<< endl;
+ DF_Attribute* aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeName");
+ SALOMEDSImpl_AttributeName* aRN = dynamic_cast<SALOMEDSImpl_AttributeName*>(aTDFAttr);
aRN->SetValue("name_attribute");
cout << " The type = " << aRN->Type() << endl;
- ga = Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aRN);
- cout << "Attribute has type: " << ga->Type() << " and value: " << ga->Save() << endl;
+ cout << "Attribute has type: " << aRN->Type() << " and value: " << aRN->Save() << endl;
cout << "Check GetObjectPath: " << aStudy->GetObjectPath(aSO) << endl;
- Handle(SALOMEDSImpl_SObject) aSubSO = aBuilder->NewObject(aSO);
+ SALOMEDSImpl_SObject aSubSO = aBuilder->NewObject(aSO);
aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeIOR");
- Handle(SALOMEDSImpl_AttributeIOR) aIOR2 = Handle(SALOMEDSImpl_AttributeIOR)::DownCast(aTDFAttr);
+ SALOMEDSImpl_AttributeIOR* aIOR2 = dynamic_cast<SALOMEDSImpl_AttributeIOR*>(aTDFAttr);
aIOR2->SetValue("some ior");
aBuilder->Addreference(aSubSO, aSO);
- Handle(SALOMEDSImpl_SObject) aRefObject;
- aSubSO->ReferencedObject(aRefObject);
- cout << "Check reference : ReferencedObject is " << aRefObject->GetID() << endl;
+ SALOMEDSImpl_SObject aRefObject;
+ aSubSO.ReferencedObject(aRefObject);
+ cout << "Check reference : ReferencedObject is " << aRefObject.GetID() << endl;
cout << "Check : Remove object: " << endl;
aBuilder->RemoveObject(aSubSO);
cout << "Remove: done" << endl;
+ cout << "Try invalid attribute creation" << endl;
+ aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "invalid type");
+ cout << "Address of created attribute : " << aTDFAttr << endl;
+
+ cout << "Check AttributeUserID" << endl;
+
+ aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeUserID");
+ if(aTDFAttr) {
+ cout << "Attribute UserID was created succesfully : id = " << dynamic_cast<SALOMEDSImpl_AttributeUserID*>(aTDFAttr)->Value() << endl;
+ }
+ else cout << "Can't create AttributeUserID" << endl;
+
+ string id = "0e1c36e6-379b-4d90-ab3b-17a14310e648";
+ dynamic_cast<SALOMEDSImpl_AttributeUserID*>(aTDFAttr)->SetValue(id);
+ cout << "SetValue id = " << dynamic_cast<SALOMEDSImpl_AttributeUserID*>(aTDFAttr)->Value() << endl;
+
+ string id2 = "0e1c36e6-379b-4d90-ab3b-18a14310e648";
+ aTDFAttr = aBuilder->FindOrCreateAttribute(aSubSO, "AttributeUserID"+id2);
+ if(aTDFAttr) {
+ cout << "Attribute UserID was created succesfully : id = " << dynamic_cast<SALOMEDSImpl_AttributeUserID*>(aTDFAttr)->Value() << endl;
+ }
+ else cout << "Can't create AttributeUserID" << endl;
+
cout << "Check AttributeTreeNode " << endl;
aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeTreeNode");
- cout << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aTDFAttr)->Type() << endl;
+ cout << dynamic_cast<SALOMEDSImpl_GenericAttribute*>(aTDFAttr)->Type() << endl;
cout << "Check AttributeTreeNode : done " << endl;
aTDFAttr = aBuilder->FindOrCreateAttribute(aSO, "AttributeParameter");
- cout << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aTDFAttr)->Type() << endl;
+ cout << dynamic_cast<SALOMEDSImpl_GenericAttribute*>(aTDFAttr)->Type() << endl;
cout << "Check the attributes on SObject" << endl;
- Handle(TColStd_HSequenceOfTransient) aSeq = aSO->GetAllAttributes();
- for(int i = 1; i <= aSeq->Length(); i++)
- cout << "Found: " << Handle(SALOMEDSImpl_GenericAttribute)::DownCast(aSeq->Value(i))->Type() << endl;
+ vector<DF_Attribute*> aSeq = aSO.GetAllAttributes();
+ for(int i = 0; i < aSeq.size(); i++)
+ cout << "Found: " << dynamic_cast<SALOMEDSImpl_GenericAttribute*>(aSeq[i])->Type() << endl;
+ cout << "Check UseCase" << endl;
+ SALOMEDSImpl_UseCaseBuilder* ucb = aStudy->GetUseCaseBuilder();
+ ucb->AddUseCase("use_case1");
+ ucb->AddUseCase("use_case2");
+ SALOMEDSImpl_UseCaseIterator ucitr = ucb->GetUseCaseIterator(SALOMEDSImpl_SObject());
+ ucitr.Init(false);
+ cout << "More? : " << ucitr.More() << endl;
cout << "Check AttributeParameter " << endl;
- Handle(SALOMEDSImpl_AttributeParameter) AP = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(aTDFAttr);
+ SALOMEDSImpl_AttributeParameter* AP = dynamic_cast<SALOMEDSImpl_AttributeParameter*>(aTDFAttr);
cout << "AttributeParameter with type : " << AP->Type() << endl;
cout << "IsSet for string: " << AP->IsSet("1", PT_STRING) << " value : " << AP->GetString("1") << endl;
/*
for(int i = 2; i < 5; i++) {
- TCollection_AsciiString s((double)(1.0/i));
+ string s((double)(1.0/i));
cout << "Setting for " << i << " value : " << s << endl;
AP->SetString(i, s);
}
vs.push_back("world!");
AP->SetStrArray("3", vs);
- TCollection_AsciiString as = AP->Save();
+ string as = AP->Save();
cout << "AS = " << as << endl;
AP->Load(as);
cout << "Check AttributeParameter : done" << endl;
+
+ SALOMEDSImpl_SComponent tst = aBuilder->NewComponent("TEST2");
+ aSO = aBuilder->NewObject(tst);
+ SALOMEDSImpl_SObject ss = aBuilder->NewObjectToTag(aSO, 3);
+ aBuilder->NewObjectToTag(ss, 1);
+ aBuilder->NewObjectToTag(ss, 3);
+ SALOMEDSImpl_SObject ss2 = aBuilder->NewObjectToTag(aSO, 2);
+ aBuilder->NewObjectToTag(ss, 2);
+
+ SALOMEDSImpl_ChildIterator ci=aStudy->NewChildIterator(tst);
+ for(ci.InitEx(true); ci.More(); ci.Next())
+ cout << "######## " << ci.Value().GetID() << endl;
+
+ DF_ChildIterator dci(tst.GetLabel(), true);
+ for(; dci.More(); dci.Next())
+ cout << "###### DF: " << dci.Value().Entry() << endl;
+
cout << "Test finished " << endl;
return 0;
}
#define TRACE_BUFFER_SIZE 256 // number of entries in circular buffer
// must be power of 2
-#define MAX_TRACE_LENGTH 256 // messages are truncated at this size
+#define MAX_TRACE_LENGTH 1024 // messages are truncated at this size
#include <pthread.h>
#include <semaphore.h>
int ret = pthread_join(*_threadId, NULL);
if (ret) cerr << "error close LocalTraceCollector : "<< ret << endl;
else DEVTRACE("LocalTraceCollector destruction OK");
+ delete _threadId;
_threadId = 0;
_threadToClose = 0;
}
import sys, os,signal,string,commands
import runSalome
+import setenv
# get SALOME environment :
# here we need KERNEL_ROOT_DIR, PATH, LD_LIBRARY_PATH
-args, modules_list, modules_root_dir = runSalome.get_config()
-runSalome.set_env(args, modules_list, modules_root_dir)
+args, modules_list, modules_root_dir = setenv.get_config()
+setenv.set_env(args, modules_list, modules_root_dir)
# execute Unit Test
#error INFOS_COMPILATION already defined
#endif
-#ifdef _DEBUG_
+#if defined(_DEBUG_) || defined(_DEBUG)
// --- the following MACROS are useful at debug time
-I$(top_builddir)/salome_adm/unix \
-I$(top_builddir)/idl \
@CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \
- @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ \
@HDF5_INCLUDES@ \
@BOOST_CPPFLAGS@
# This local variable defines the list of dependant libraries common to all target in this package.
COMMON_LIBS =\
../Utils/libOpUtil.la \
- $(top_builddir)/idl/libSalomeIDLKernel.la\
- @CAS_KERNEL@
+ $(top_builddir)/idl/libSalomeIDLKernel.la
#
# ===============================================================
#include "utilities.h"
-#include <TCollection_AsciiString.hxx>
-
-#include <OSD_Path.hxx>
-#include <OSD_File.hxx>
-#include <OSD_Directory.hxx>
-#include <OSD_Process.hxx>
-#include <OSD_Directory.hxx>
-#include <OSD_Protection.hxx>
-#include <OSD_SingleProtection.hxx>
-#include <OSD_FileIterator.hxx>
-
#ifndef WNT
-#include <stdio.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <iostream.h>
#include <fstream.h>
-#include <sys/time.h>
+#include <pwd.h>
+#include <unistd.h>
#else
+#include <time.h>
+#include <lmcons.h>
#endif
+
#include <stdlib.h>
#include <SALOMEconfig.h>
using namespace std;
+bool Exists(const string thePath)
+{
+#ifdef WNT
+ 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 : GetTempDir
// purpose : Return a temp directory to store created files like "/tmp/sub_dir/"
{
//Find a temporary directory to store a file
- TCollection_AsciiString aTmpDir;
+ string aTmpDir = "";
char *Tmp_dir = getenv("SALOME_TMP_DIR");
if(Tmp_dir != NULL) {
- aTmpDir = TCollection_AsciiString(Tmp_dir);
+ aTmpDir = string(Tmp_dir);
#ifdef WIN32
- if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
+ if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\';
#else
- if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
+ if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/';
#endif
}
else {
#ifdef WIN32
- aTmpDir = TCollection_AsciiString("C:\\");
+ aTmpDir = string("C:\\");
#else
- aTmpDir = TCollection_AsciiString("/tmp/");
+ aTmpDir = string("/tmp/");
#endif
}
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
- TCollection_AsciiString aSubDir(aRND);
- if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876");
+ 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(Exists(aDir)) {
+ for(aRND = 0; Exists(aDir); aRND++) {
+ sprintf(buffer, "%d", aRND);
+ aDir = aTmpDir+buffer; //Build a unique directory name
+ }
+ }
+
#ifdef WIN32
- if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\';
+ if(aDir[aDir.size()-1] != '\\') aDir+='\\';
#else
- if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/';
+ if(aDir[aTmpDir.size()-1] != '/') aDir+='/';
#endif
- OSD_Path aPath(aTmpDir);
- OSD_Directory aDir(aPath);
-
- for(aRND = 0; aDir.Exists(); aRND++) {
- aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name
- aPath = OSD_Path(aTmpDir);
- aDir = OSD_Directory(aPath);
- }
- MESSAGE("#### TMP" << aTmpDir.ToCString());
-
- //OSD_Protection aProtection(OSD_RW, OSD_RWX, OSD_RX, OSD_RX);
- OSD_Protection aProtection(OSD_RWXD, OSD_RWX, OSD_RX, OSD_RX );
- aDir.Build(aProtection);
+#ifdef WNT
+ CreateDirectory(aDir.c_str(), NULL);
+#else
+ mkdir(aDir.c_str(), 0x1ff);
+#endif
- return aTmpDir.ToCString();
+ return aDir;
}
//============================================================================
const SALOMEDS::ListOfFileNames& theFiles,
const bool IsDirDeleted)
{
- TCollection_AsciiString aDirName(const_cast<char*>(theDirectory.c_str()));
+ string aDirName = theDirectory;
int i, aLength = theFiles.length();
- for(i=0; i<aLength; i++) {
- TCollection_AsciiString aFile(aDirName);
-// aFile += (char*)theFiles[i];
- aFile += (char*)theFiles[i].in();
- OSD_Path anOSDPath(aFile);
- OSD_File anOSDFile(anOSDPath);
- if(!anOSDFile.Exists()) continue;
-
- OSD_Protection aProtection = anOSDFile.Protection();
- aProtection.SetUser(OSD_RWD);
- //aProtection.SetSystem(OSD_RW);
- anOSDFile.SetProtection(aProtection);
-
- anOSDFile.Remove();
+ for(i=1; i<=aLength; i++) {
+ string aFile(aDirName);
+ aFile += theFiles[i-1];
+ if(!Exists(aFile)) continue;
+
+#ifdef WNT
+ DeleteFile(aFile.c_str());
+#else
+ unlink(aFile.c_str());
+#endif
}
if(IsDirDeleted) {
- OSD_Path aPath(aDirName);
- OSD_Directory aDir(aPath);
- OSD_FileIterator* anIterator = new OSD_FileIterator(aPath, '*');
-
- if(aDir.Exists() && !anIterator->More())
- {
- delete anIterator;
- aDir.Remove();
- }
+ if(Exists(aDirName)) {
+#ifdef WNT
+ RemoveDirectory(aDireName.c_str());
+#else
+ rmdir(aDirName.c_str());
+#endif
+ }
}
}
return (new SALOMEDS::TMPFile);
//Get a temporary directory for saved a file
- TCollection_AsciiString aTmpDir(const_cast<char*>(theFromDirectory.c_str()));
+ string aTmpDir = theFromDirectory;
long aBufferSize = 0;
long aCurrentPos;
//Check if the file exists
if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero
- TCollection_AsciiString aFullPath = aTmpDir + const_cast<char*>(theFiles[i].in());
- OSD_Path anOSDPath(aFullPath);
- OSD_File anOSDFile(anOSDPath);
- if(!anOSDFile.Exists()) continue;
+ string aFullPath = aTmpDir + const_cast<char*>(theFiles[i].in());
+ if(!Exists(aFullPath)) continue;
#ifdef WNT
- ifstream aFile(aFullPath.ToCString(), ios::binary);
+ ifstream aFile(aFullPath.c_str(), ios::binary);
#else
- ifstream aFile(aFullPath.ToCString());
+ ifstream aFile(aFullPath.c_str());
#endif
aFile.seekg(0, ios::end);
aFileSize[i] = aFile.tellg();
for(i=0; i<aLength; i++) {
ifstream *aFile;
if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true
- TCollection_AsciiString aFullPath = aTmpDir + const_cast<char*>(theFiles[i].in());
- OSD_Path anOSDPath(aFullPath);
- OSD_File anOSDFile(anOSDPath);
- if(!anOSDFile.Exists()) continue;
+ string aFullPath = aTmpDir + const_cast<char*>(theFiles[i].in());
+ if(!Exists(aFullPath)) continue;
#ifdef WNT
- aFile = new ifstream(aFullPath.ToCString(), ios::binary);
+ aFile = new ifstream(aFullPath.c_str(), ios::binary);
#else
- aFile = new ifstream(aFullPath.ToCString());
+ aFile = new ifstream(aFullPath.c_str());
#endif
}
//Initialize 4 bytes of the buffer by 0
return aFiles;
//Get a temporary directory for saving a file
- TCollection_AsciiString aTmpDir(const_cast<char*>(theToDirectory.c_str()));
+ string aTmpDir = theToDirectory;
unsigned char *aBuffer = (unsigned char*)theStream.NP_data();
memcpy(&aFileSize, (aBuffer + aCurrentPos), ((sizeof(long) > 8) ? 8 : sizeof(long)));
aCurrentPos += 8;
- TCollection_AsciiString aFullPath = aTmpDir + aFileName;
+ string aFullPath = aTmpDir + aFileName;
#ifdef WNT
- ofstream aFile(aFullPath.ToCString(), ios::binary);
+ ofstream aFile(aFullPath.c_str(), ios::binary);
#else
- ofstream aFile(aFullPath.ToCString());
+ ofstream aFile(aFullPath.c_str());
#endif
aFile.write((char *)(aBuffer+aCurrentPos), aFileSize);
aFile.close();
// purpose : Returns the name by the path
//============================================================================
std::string SALOMEDS_Tool::GetNameFromPath(const std::string& thePath) {
- if(thePath == "")
- return "";
- OSD_Path aPath = OSD_Path(TCollection_AsciiString(const_cast<char*>(thePath.c_str())));
- TCollection_AsciiString aNameString(aPath.Name());
- return aNameString.ToCString();
+ if (thePath.empty()) return "";
+ string aPath = thePath;
+ bool isFound = false;
+ int pos = aPath.rfind('/');
+ if(pos > 0) {
+ aPath = aPath.substr(pos+1, aPath.size());
+ isFound = true;
+ }
+ if(!isFound) {
+ pos = aPath.rfind('\\');
+ if(pos > 0) {
+ aPath = aPath.substr(pos+1, aPath.size());
+ isFound = true;
+ }
+ }
+ if(!isFound) {
+ pos = aPath.rfind('|');
+ if(pos > 0) aPath = aPath.substr(pos+1, aPath.size());
+ }
+
+ pos = aPath.rfind('.');
+ if(pos > 0) aPath = aPath.substr(0, pos); //Remove extension
+
+ return aPath;
}
//============================================================================
// purpose : Returns the dir by the path
//============================================================================
std::string SALOMEDS_Tool::GetDirFromPath(const std::string& thePath) {
- if(thePath == "")
- return "";
- OSD_Path aPath = OSD_Path(TCollection_AsciiString(const_cast<char*>(thePath.c_str())));
- TCollection_AsciiString aDirString(aPath.Trek());
- aDirString.ChangeAll('|','/');
- return aDirString.ToCString();
+ if (thePath.empty()) return "";
+
+ int pos = thePath.rfind('/');
+ string path;
+ if(pos > 0) {
+ path = thePath.substr(0, pos+1);
+ }
+ if(path.empty()) {
+ pos = thePath.rfind('\\');
+ if(pos > 0) path = thePath.substr(0, pos+1);
+ }
+ if(path.empty()) {
+ pos = thePath.rfind('|');
+ if(pos > 0) path = thePath.substr(0, pos+1);
+ }
+ if(path.empty()) {
+ path = thePath+"/";
+ }
+
+#ifdef WNT //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++)
+ if(path[i] == '|') path[i] = '/';
+ return path;
}
//=======================================================================
bin_PROGRAMS = TestContainer TestLogger
TestContainer_SOURCES = TestContainer.cxx
TestContainer_CPPFLAGS = $(COMMON_CPPFLAGS)
-TestContainer_LDADD = $(COMMON_LIBS) libSalomeTestComponentEngine.la
+TestContainer_LDADD = libSalomeTestComponentEngine.la
TestLogger_SOURCES = TestLogger.cxx
TestLogger_CPPFLAGS = $(COMMON_CPPFLAGS)
-TestLogger_LDADD = $(COMMON_LIBS) libSalomeTestComponentEngine.la
+TestLogger_LDADD = libSalomeTestComponentEngine.la
import sys, os,signal,string,commands
import runSalome
+import setenv
import orbmodule
import TestKiller
# get SALOME environment :
-args, modules_list, modules_root_dir = runSalome.get_config()
-runSalome.set_env(args, modules_list, modules_root_dir)
+args, modules_list, modules_root_dir = setenv.get_config()
+setenv.set_env(args, modules_list, modules_root_dir)
# set environment for trace in logger
# (with file, servers may be killed before the write to the file...)
# launch container manager server
-myCmServer = runSalome.ContainerManagerServer(args)
+myCmServer = runSalome.LauncherServer(args)
myCmServer.setpath(modules_list,modules_root_dir)
myCmServer.run()
-clt.waitNS("/ContainerManager")
+clt.waitNS("/SalomeLauncher")
# execute Unit Test
# kill containers created by the Container Manager
import Engines
-containerManager = clt.waitNS("/ContainerManager",Engines.ContainerManager)
-containerManager.Shutdown()
+launcher = clt.waitNS("/SalomeLauncher",Engines.SalomeLauncher)
+launcher.Shutdown()
# kill Test process
if ( ! CORBA::is_nil( _orb ) )
{
//std::cerr << "appel _orb->destroy()" << std::endl;
- _orb->destroy() ;
+ try {
+ _orb->destroy() ;
+ }
+ catch(...) {
+ MESSAGE("Caught CORBA::Exception.");
+ }
//std::cerr << "retour _orb->destroy()" << std::endl;
}
}
try
{
#if OMNIORB_VERSION >= 4
- const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } };
- _orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ;
+ _orb = CORBA::ORB_init( argc, argv, "omniORB4" ) ;
#else
- _orb = CORBA::ORB_init( argc , argv ) ;
- //set GIOP message size equal to 50Mb for transferring brep shapes as
- //sequence of bytes using C++ streams
- omniORB::MaxMessageSize(100*1024*1024);
+ _orb = CORBA::ORB_init( argc, argv, "omniORB3" ) ;
#endif
}
catch( const CORBA::Exception &ex )