From: crouzet Date: Tue, 19 Oct 2010 14:03:08 +0000 (+0000) Subject: hxx2salome integration: X-Git-Tag: RELIQUAT_5x_15112010~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6f0d71f000b20d2cb7c7a16e0398aa151e890fca;p=tools%2Fyacsgen.git hxx2salome integration: ajout d'un membre ret à la classe Service pour gérer les service avec retour. pour les composants fais avec HXX2SALOMEComponent et utilisant des classes MEDMEM, ajout de l'héritage à SALOME_MED::MED_Gen_Driver --- diff --git a/module_generator/gener.py b/module_generator/gener.py index 131a181..fe88916 100644 --- a/module_generator/gener.py +++ b/module_generator/gener.py @@ -129,11 +129,12 @@ class Component(object): return {} class Service(object): - def __init__(self, name, inport=None, outport=None, instream=None, + def __init__(self, name, inport=None, outport=None, ret="void", instream=None, outstream=None, parallel_instream=None, parallel_outstream=None, body="", defs="", impl_type="sequential"): self.name = name self.inport = inport or [] self.outport = outport or [] + self.ret = ret self.instream = instream or [] self.outstream = outstream or [] self.parallel_instream = parallel_instream or [] @@ -276,7 +277,7 @@ AM_CFLAGS=$(SALOME_INCLUDES) -fexceptions modules = {} for compo in module.components: for serv in compo.services: - for name, typ in serv.inport + serv.outport: + for name, typ in serv.inport + serv.outport + [ ("return",serv.ret) ] : mod = moduleTypes[typ] if mod: get_dependent_modules(mod,modules) @@ -578,6 +579,8 @@ echo " Qt ..................... : $qt_ok" params = [] for name, typ in serv.outport: params.append(cataOutparam.substitute(name=name, type=typ)) + if serv.ret != "void" : + params.append(cataOutparam.substitute(name="return", type=serv.ret)) outparams = "\n".join(params) streams = [] for name, typ, dep in serv.instream: @@ -633,10 +636,18 @@ echo " Qt ..................... : $qt_ok" else: typ=idlTypes[typ] params.append("out %s %s" % (typ, name)) - service = " void %s(" % serv.name + service = " %s %s(" % (idlTypes[serv.ret],serv.name) service = service+",".join(params)+") raises (SALOME::SALOME_Exception);" services.append(service) - interfaces.append(interface.substitute(component=compo.name, services="\n".join(services))) + from hxxcompo import HXX2SALOMEComponent + if isinstance(compo,HXX2SALOMEComponent): + from hxx_tmpl import interfaceidlhxx + Inherited="" + if compo.use_medmem==True: + Inherited=", SALOME_MED::MED_Gen_Driver" + interfaces.append(interfaceidlhxx.substitute(component=compo.name,inherited=Inherited, services="\n".join(services))) + else: + interfaces.append(interface.substitute(component=compo.name, services="\n".join(services))) #build idl includes for SALOME modules idldefs=""