]> SALOME platform Git repositories - tools/yacsgen.git/commitdiff
Salome HOME
CCAR: add basic types from KERNEL SALOME_TYPES module
authorcaremoli <caremoli>
Mon, 31 Jan 2011 16:26:01 +0000 (16:26 +0000)
committercaremoli <caremoli>
Mon, 31 Jan 2011 16:26:01 +0000 (16:26 +0000)
add 1 example types1 that uses these types
add 2 functions to module_generator package (add_type and add_module) to be
able to customize YACSGEN for non builtin modules

Examples/context.py
Examples/types1/Makefile [new file with mode: 0644]
Examples/types1/README.txt [new file with mode: 0644]
Examples/types1/components.py [new file with mode: 0644]
Examples/types1/coupling.xml [new file with mode: 0644]
Examples/types1/geom_coupling.xml [new file with mode: 0644]
module_generator/__init__.py
module_generator/cata_tmpl.py
module_generator/salomemodules.py
module_generator/yacstypes.py

index 35f4d868abcb51aa0a16488815b555b51e07f826..d1e63ad06502a642225ee27e7e4e964694059728 100644 (file)
@@ -23,12 +23,14 @@ sys.path.insert(0,"../..")
 KERNEL_ROOT_DIR=os.getenv("KERNEL_ROOT_DIR","/local/cchris/Salome/Install/KERNEL_V6")
 GUI_ROOT_DIR=os.getenv("GUI_ROOT_DIR","/local/cchris/Salome/Install/GUI_V6")
 YACS_ROOT_DIR=os.getenv("YACS_ROOT_DIR","/local/cchris/Salome/Install/YACS_V6")
+GEOM_ROOT_DIR=os.getenv("GEOM_ROOT_DIR","/local/cchris/Salome/Install/GEOM_V6")
 
 context={'update':1,
          "makeflags":"",
          "prerequisites":"/local/cchris/.packages.d/envSalome6main",
          "kernel":KERNEL_ROOT_DIR,
          "gui":GUI_ROOT_DIR,
+         "geom":GEOM_ROOT_DIR,
         }
 
 
diff --git a/Examples/types1/Makefile b/Examples/types1/Makefile
new file mode 100644 (file)
index 0000000..afdabd3
--- /dev/null
@@ -0,0 +1,21 @@
+#  Copyright (C) 2009-2010  EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+clean:
+       rm -rf *.o *.so module_SRC module_SRC.bak appli appli.bak install install.bak traceExec_proc
diff --git a/Examples/types1/README.txt b/Examples/types1/README.txt
new file mode 100644 (file)
index 0000000..7769282
--- /dev/null
@@ -0,0 +1,25 @@
+A test for several YACS types SALOME_TYPES and others
+=========================================================
+
+To build this example, modify the ../context.py file
+to take into account your configuration.
+
+1- your prerequisite file 
+2- your KERNEL_ROOT_DIR
+
+Then set the environment (including PYTHONPATH for YACSGEN, ../.. from here and execute components.py ::
+
+  source <your prerequisite file>
+  python components.py
+
+You should get a SALOME module in source form (module_SRC), its installation (install) and
+a SALOME application (appli) composed of modules KERNEL, GUI, YACS and the new module module.
+
+To run a coupling:
+
+ 1. start SALOME in background : ./appli/runAppli -t
+ 2. start a SALOME session : ./appli/runSession
+ 3. start YACS coupler with coupling file : driver coupling.xml
+ 4. examine output files in /tmp
+ 5. shutdown SALOME : shutdowSalome.py
+ 6. exit session : CTRL-D (or exit)
diff --git a/Examples/types1/components.py b/Examples/types1/components.py
new file mode 100644 (file)
index 0000000..550815a
--- /dev/null
@@ -0,0 +1,170 @@
+#  Copyright (C) 2009-2010  EDF R&D
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import os
+
+#import context from ..
+execfile("../context.py")
+
+from module_generator import Generator,Module,Service,CPPComponent,PYComponent,add_type,add_module
+
+#overload module GEOM definition
+idldefs="""
+#include "GEOM_Gen.idl"
+"""
+makefiledefs="""
+#module GEOM
+GEOM_IDL_INCLUDES = -I$(GEOM_ROOT_DIR)/idl/salome
+GEOM_INCLUDES= -I$(GEOM_ROOT_DIR)/include/salome
+GEOM_IDL_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome -lSalomeIDLGEOM
+GEOM_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome
+SALOME_LIBS += ${GEOM_LIBS}
+SALOME_IDL_LIBS += ${GEOM_IDL_LIBS}
+SALOME_INCLUDES += ${GEOM_INCLUDES}
+IDL_INCLUDES += ${GEOM_IDL_INCLUDES}
+"""
+configdefs="""
+if test "x${GEOM_ROOT_DIR}" != "x" && test -d ${GEOM_ROOT_DIR} ; then
+  AC_MSG_RESULT(Using GEOM installation in ${GEOM_ROOT_DIR})
+else
+  AC_MSG_ERROR([Cannot find module GEOM. Have you set GEOM_ROOT_DIR ?],1)
+fi
+"""
+add_module("GEOM",idldefs,makefiledefs,configdefs)
+
+#overload GEOM_Object definition
+add_type("GEOM_Object", "GEOM::GEOM_Object_ptr", "GEOM::GEOM_Object_out", "GEOM", "GEOM::GEOM_Object","GEOM::GEOM_Object_ptr")
+
+
+cwd=os.getcwd()
+
+defs="""
+"""
+
+body="""
+//inputs
+//Parameter
+std::cerr << "a: " << a.name << "=" << a.value << std::endl;
+
+//ParameterList
+for(CORBA::ULong i = 0;i<b.length();i++)
+  std::cerr << "b["<<i<<"]:"<<b[i].name <<"="<<b[i].value << std::endl;
+
+//Value
+for(CORBA::ULong i = 0;i<c.length();i++)
+  for(CORBA::ULong j = 0;j<c[i].length();j++)
+    std::cerr << "c["<<i<<"]["<< j<< "]="<<c[i][j] << std::endl;
+
+//VarList
+for(CORBA::ULong i = 0;i<d.length();i++)
+  std::cerr << "d["<<i<<"]="<<d[i] << std::endl;
+
+//ValueList
+for(CORBA::ULong i = 0;i<e.length();i++)
+  for(CORBA::ULong j = 0;j<e[i].length();j++)
+    for(CORBA::ULong k = 0;k<e[i][j].length();k++)
+      std::cerr << "e["<<i<<"]["<< j<< "]["<<k<<"]="<<e[i][j][k] << std::endl;
+
+//ParametricInput
+for(CORBA::ULong i = 0;i<f.inputVarList.length();i++)
+  std::cerr << "f.inputVarList["<<i<<"]="<<f.inputVarList[i] << std::endl;
+for(CORBA::ULong i = 0;i<f.outputVarList.length();i++)
+  std::cerr << "f.outputVarList["<<i<<"]="<<f.outputVarList[i] << std::endl;
+for(CORBA::ULong i = 0;i<f.inputValues.length();i++)
+  for(CORBA::ULong j = 0;j<f.inputValues[i].length();j++)
+    for(CORBA::ULong k = 0;k<f.inputValues[i][j].length();k++)
+      std::cerr << "f.inputValues["<<i<<"]["<< j<< "]["<<k<<"]="<<f.inputValues[i][j][k] << std::endl;
+for(CORBA::ULong i = 0;i<f.specificParameters.length();i++)
+  std::cerr << "f.specificParameters["<<i<<"]:"<<f.specificParameters[i].name <<"="<<f.specificParameters[i].value << std::endl;
+
+//ParametricOutput
+for(CORBA::ULong i = 0;i<g.outputValues.length();i++)
+  for(CORBA::ULong j = 0;j<g.outputValues[i].length();j++)
+    for(CORBA::ULong k = 0;k<g.outputValues[i][j].length();k++)
+      std::cerr << "g.outputValues["<<i<<"]["<< j<< "]["<<k<<"]="<<g.outputValues[i][j][k] << std::endl;
+
+//outputs
+//Parameter
+aa=new SALOME_TYPES::Parameter;
+aa->name=CORBA::string_dup(a.name);
+aa->value=CORBA::string_dup(a.value);
+std::cerr << "aa: " << aa->name << "=" << aa->value << std::endl;
+//ParameterList
+ab=new SALOME_TYPES::ParameterList;
+ac= new SALOME_TYPES::Value;
+ad= new SALOME_TYPES::VarList;
+ae= new SALOME_TYPES::ValueList;
+af= new SALOME_TYPES::ParametricInput;
+ag= new SALOME_TYPES::ParametricOutput;
+"""
+c1=CPPComponent("compo1",services=[
+          Service("s1",inport=[("a","SALOME_TYPES/Parameter"),("b","SALOME_TYPES/ParameterList"),("c","SALOME_TYPES/Value"),
+                               ("d","SALOME_TYPES/VarList"),("e","SALOME_TYPES/ValueList"),("f","SALOME_TYPES/ParametricInput"),
+                               ("g","SALOME_TYPES/ParametricOutput"),
+                              ],
+                       outport=[("aa","SALOME_TYPES/Parameter"),
+                                ("ab","SALOME_TYPES/ParameterList"),
+                                ("ac","SALOME_TYPES/Value"),
+                                ("ad","SALOME_TYPES/VarList"),("ae","SALOME_TYPES/ValueList"),("af","SALOME_TYPES/ParametricInput"),
+                                ("ag","SALOME_TYPES/ParametricOutput"),
+                               ],
+                       defs=defs,body=body,
+                 ),
+          Service("s2",inport=[("a","GEOM_Object"),],outport=[("aa","GEOM_Object"),],body="aa=GEOM::GEOM_Object::_duplicate(a);",),
+          ],
+         )
+
+pydefs="""import SALOME_TYPES"""
+
+pybody="""
+print a,b,c,d,e,f,g
+aa=SALOME_TYPES.Parameter(name="a",value="45.")
+ab=[]
+ac=[[1,2,3]]
+ad=["aaa","bbb"]
+ae=[[[1,2,3]]]
+af=SALOME_TYPES.ParametricInput(inputVarList=ad,outputVarList=ad, inputValues=[[[1,2,3]]],specificParameters=[])
+ag=SALOME_TYPES.ParametricOutput(outputValues=[[[1,2,3]]], specificOutputInfos=[], returnCode=1, errorMessage="error")
+print aa,ab,ac,ad,ae,af,ag
+"""
+c2=PYComponent("compo2",services=[
+          Service("s1",inport=[("a","SALOME_TYPES/Parameter"),("b","SALOME_TYPES/ParameterList"),("c","SALOME_TYPES/Value"),
+                               ("d","SALOME_TYPES/VarList"),("e","SALOME_TYPES/ValueList"),("f","SALOME_TYPES/ParametricInput"),
+                               ("g","SALOME_TYPES/ParametricOutput"),
+                              ],
+                       outport=[("aa","SALOME_TYPES/Parameter"),
+                                ("ab","SALOME_TYPES/ParameterList"),
+                                ("ac","SALOME_TYPES/Value"),
+                                ("ad","SALOME_TYPES/VarList"),("ae","SALOME_TYPES/ValueList"),("af","SALOME_TYPES/ParametricInput"),
+                                ("ag","SALOME_TYPES/ParametricOutput"),
+                               ],
+                       body=pybody,defs=pydefs,
+                 ),
+                                 ],
+              )
+
+
+g=Generator(Module("mymodule",components=[c1,c2],prefix="./install"),context)
+g.generate()
+g.bootstrap()
+g.configure()
+g.make()
+g.install()
+g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR, "GEOM":GEOM_ROOT_DIR})
+
diff --git a/Examples/types1/coupling.xml b/Examples/types1/coupling.xml
new file mode 100644 (file)
index 0000000..a850548
--- /dev/null
@@ -0,0 +1,364 @@
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="proc">
+   <property name="DefaultStudyID" value="1"/>
+   <objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <struct name="SALOME_TYPES/Parameter">
+      <member name="name" type="string"/>
+      <member name="value" type="string"/>
+   </struct>
+   <sequence name="SALOME_TYPES/ParameterList" content="SALOME_TYPES/Parameter"/>
+   <sequence name="SALOME_TYPES/VarList" content="string"/>
+   <type name="double" kind="double"/>
+   <sequence name="Value1D" content="double"/>
+   <sequence name="SALOME_TYPES/Value" content="Value1D"/>
+   <sequence name="SALOME_TYPES/ValueList" content="SALOME_TYPES/Value"/>
+   <struct name="SALOME_TYPES/ParametricInput">
+      <member name="inputVarList" type="SALOME_TYPES/VarList"/>
+      <member name="outputVarList" type="SALOME_TYPES/VarList"/>
+      <member name="inputValues" type="SALOME_TYPES/ValueList"/>
+      <member name="specificParameters" type="SALOME_TYPES/ParameterList"/>
+   </struct>
+   <type name="int" kind="int"/>
+   <struct name="SALOME_TYPES/ParametricOutput">
+      <member name="outputValues" type="SALOME_TYPES/ValueList"/>
+      <member name="specificOutputInfos" type="SALOME_TYPES/ParameterList"/>
+      <member name="returnCode" type="int"/>
+      <member name="errorMessage" type="string"/>
+   </struct>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <sequence name="intvec" content="int"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="stringvec" content="string"/>
+   <container name="A">
+   </container>
+   <container name="B">
+   </container>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="localhost"/>
+   </container>
+   <service name="s10">
+      <component>compo1</component>
+      <load container="A"/>
+      <method>s1</method>
+      <inport name="a" type="SALOME_TYPES/Parameter"/>
+      <inport name="b" type="SALOME_TYPES/ParameterList"/>
+      <inport name="c" type="SALOME_TYPES/Value"/>
+      <inport name="d" type="SALOME_TYPES/VarList"/>
+      <inport name="e" type="SALOME_TYPES/ValueList"/>
+      <inport name="f" type="SALOME_TYPES/ParametricInput"/>
+      <inport name="g" type="SALOME_TYPES/ParametricOutput"/>
+      <outport name="aa" type="SALOME_TYPES/Parameter"/>
+      <outport name="ab" type="SALOME_TYPES/ParameterList"/>
+      <outport name="ac" type="SALOME_TYPES/Value"/>
+      <outport name="ad" type="SALOME_TYPES/VarList"/>
+      <outport name="ae" type="SALOME_TYPES/ValueList"/>
+      <outport name="af" type="SALOME_TYPES/ParametricInput"/>
+      <outport name="ag" type="SALOME_TYPES/ParametricOutput"/>
+   </service>
+   <inline name="PyScript1">
+      <script><code><![CDATA[
+import SALOME_TYPES
+o2={"name":"x","value":"36."}
+#o2=SALOME_TYPES.Parameter("x","36.")
+#o3=[SALOME_TYPES.Parameter("x","36.")]
+o3=[{"name":"x","value":"36."}]
+o4=[[1,2,3]]
+o5=["toto","titi"]
+o6=[[[1,2,3]]]
+o7={"inputVarList":o5,"outputVarList":o5,
+"inputValues":o6,"specificParameters":o3}
+o8={"outputValues":o6,
+    "specificOutputInfos":o3,
+    "returnCode":1,
+    "errorMessage":"error"}
+]]></code></script>
+      <outport name="o2" type="SALOME_TYPES/Parameter"/>
+      <outport name="o3" type="SALOME_TYPES/ParameterList"/>
+      <outport name="o4" type="SALOME_TYPES/Value"/>
+      <outport name="o5" type="SALOME_TYPES/VarList"/>
+      <outport name="o6" type="SALOME_TYPES/ValueList"/>
+      <outport name="o7" type="SALOME_TYPES/ParametricInput"/>
+      <outport name="o8" type="SALOME_TYPES/ParametricOutput"/>
+   </inline>
+   <inline name="PyScript0">
+      <script><code><![CDATA[print i1
+print i2
+print i3
+print i4
+print i5
+print i6
+print i7
+]]></code></script>
+      <inport name="i1" type="SALOME_TYPES/Parameter"/>
+      <inport name="i2" type="SALOME_TYPES/ParameterList"/>
+      <inport name="i3" type="SALOME_TYPES/Value"/>
+      <inport name="i5" type="SALOME_TYPES/VarList"/>
+      <inport name="i4" type="SALOME_TYPES/ValueList"/>
+      <inport name="i6" type="SALOME_TYPES/ParametricInput"/>
+      <inport name="i7" type="SALOME_TYPES/ParametricOutput"/>
+   </inline>
+   <service name="s11">
+      <component>compo2</component>
+      <load container="B"/>
+      <method>s1</method>
+      <inport name="a" type="SALOME_TYPES/Parameter"/>
+      <inport name="b" type="SALOME_TYPES/ParameterList"/>
+      <inport name="c" type="SALOME_TYPES/Value"/>
+      <inport name="d" type="SALOME_TYPES/VarList"/>
+      <inport name="e" type="SALOME_TYPES/ValueList"/>
+      <inport name="f" type="SALOME_TYPES/ParametricInput"/>
+      <inport name="g" type="SALOME_TYPES/ParametricOutput"/>
+      <outport name="aa" type="SALOME_TYPES/Parameter"/>
+      <outport name="ab" type="SALOME_TYPES/ParameterList"/>
+      <outport name="ac" type="SALOME_TYPES/Value"/>
+      <outport name="ad" type="SALOME_TYPES/VarList"/>
+      <outport name="ae" type="SALOME_TYPES/ValueList"/>
+      <outport name="af" type="SALOME_TYPES/ParametricInput"/>
+      <outport name="ag" type="SALOME_TYPES/ParametricOutput"/>
+   </service>
+   <service name="s12">
+      <component>compo1</component>
+      <load container="A"/>
+      <method>s1</method>
+      <inport name="a" type="SALOME_TYPES/Parameter"/>
+      <inport name="b" type="SALOME_TYPES/ParameterList"/>
+      <inport name="c" type="SALOME_TYPES/Value"/>
+      <inport name="d" type="SALOME_TYPES/VarList"/>
+      <inport name="e" type="SALOME_TYPES/ValueList"/>
+      <inport name="f" type="SALOME_TYPES/ParametricInput"/>
+      <inport name="g" type="SALOME_TYPES/ParametricOutput"/>
+      <outport name="aa" type="SALOME_TYPES/Parameter"/>
+      <outport name="ab" type="SALOME_TYPES/ParameterList"/>
+      <outport name="ac" type="SALOME_TYPES/Value"/>
+      <outport name="ad" type="SALOME_TYPES/VarList"/>
+      <outport name="ae" type="SALOME_TYPES/ValueList"/>
+      <outport name="af" type="SALOME_TYPES/ParametricInput"/>
+      <outport name="ag" type="SALOME_TYPES/ParametricOutput"/>
+   </service>
+   <inline name="PyScript00">
+      <script><code><![CDATA[print i1
+print i2
+print i3
+print i4
+print i5
+print i6
+print i7
+]]></code></script>
+      <inport name="i1" type="SALOME_TYPES/Parameter"/>
+      <inport name="i2" type="SALOME_TYPES/ParameterList"/>
+      <inport name="i3" type="SALOME_TYPES/Value"/>
+      <inport name="i5" type="SALOME_TYPES/VarList"/>
+      <inport name="i4" type="SALOME_TYPES/ValueList"/>
+      <inport name="i6" type="SALOME_TYPES/ParametricInput"/>
+      <inport name="i7" type="SALOME_TYPES/ParametricOutput"/>
+   </inline>
+   <service name="s13">
+      <component>compo2</component>
+      <load container="A"/>
+      <method>s1</method>
+      <inport name="a" type="SALOME_TYPES/Parameter"/>
+      <inport name="b" type="SALOME_TYPES/ParameterList"/>
+      <inport name="c" type="SALOME_TYPES/Value"/>
+      <inport name="d" type="SALOME_TYPES/VarList"/>
+      <inport name="e" type="SALOME_TYPES/ValueList"/>
+      <inport name="f" type="SALOME_TYPES/ParametricInput"/>
+      <inport name="g" type="SALOME_TYPES/ParametricOutput"/>
+      <outport name="aa" type="SALOME_TYPES/Parameter"/>
+      <outport name="ab" type="SALOME_TYPES/ParameterList"/>
+      <outport name="ac" type="SALOME_TYPES/Value"/>
+      <outport name="ad" type="SALOME_TYPES/VarList"/>
+      <outport name="ae" type="SALOME_TYPES/ValueList"/>
+      <outport name="af" type="SALOME_TYPES/ParametricInput"/>
+      <outport name="ag" type="SALOME_TYPES/ParametricOutput"/>
+   </service>
+   <control> <fromnode>s10</fromnode> <tonode>s13</tonode> </control>
+   <control> <fromnode>s10</fromnode> <tonode>PyScript0</tonode> </control>
+   <control> <fromnode>PyScript1</fromnode> <tonode>s10</tonode> </control>
+   <control> <fromnode>PyScript1</fromnode> <tonode>s11</tonode> </control>
+   <control> <fromnode>s11</fromnode> <tonode>PyScript00</tonode> </control>
+   <control> <fromnode>s11</fromnode> <tonode>s12</tonode> </control>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>aa</fromport>
+      <tonode>s13</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>aa</fromport>
+      <tonode>PyScript0</tonode> <toport>i1</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>ab</fromport>
+      <tonode>PyScript0</tonode> <toport>i2</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>ab</fromport>
+      <tonode>s13</tonode> <toport>b</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>ac</fromport>
+      <tonode>s13</tonode> <toport>c</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>ac</fromport>
+      <tonode>PyScript0</tonode> <toport>i3</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>ad</fromport>
+      <tonode>s13</tonode> <toport>d</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>ad</fromport>
+      <tonode>PyScript0</tonode> <toport>i5</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>ae</fromport>
+      <tonode>PyScript0</tonode> <toport>i4</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>ae</fromport>
+      <tonode>s13</tonode> <toport>e</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>af</fromport>
+      <tonode>s13</tonode> <toport>f</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>af</fromport>
+      <tonode>PyScript0</tonode> <toport>i6</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>ag</fromport>
+      <tonode>s13</tonode> <toport>g</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s10</fromnode> <fromport>ag</fromport>
+      <tonode>PyScript0</tonode> <toport>i7</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o2</fromport>
+      <tonode>s11</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o2</fromport>
+      <tonode>s10</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o3</fromport>
+      <tonode>s11</tonode> <toport>b</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o3</fromport>
+      <tonode>s10</tonode> <toport>b</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o4</fromport>
+      <tonode>s11</tonode> <toport>c</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o4</fromport>
+      <tonode>s10</tonode> <toport>c</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o5</fromport>
+      <tonode>s10</tonode> <toport>d</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o5</fromport>
+      <tonode>s11</tonode> <toport>d</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o6</fromport>
+      <tonode>s11</tonode> <toport>e</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o6</fromport>
+      <tonode>s10</tonode> <toport>e</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o7</fromport>
+      <tonode>s10</tonode> <toport>f</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o7</fromport>
+      <tonode>s11</tonode> <toport>f</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o8</fromport>
+      <tonode>s11</tonode> <toport>g</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>PyScript1</fromnode> <fromport>o8</fromport>
+      <tonode>s10</tonode> <toport>g</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>aa</fromport>
+      <tonode>s12</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>aa</fromport>
+      <tonode>PyScript00</tonode> <toport>i1</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>ab</fromport>
+      <tonode>PyScript00</tonode> <toport>i2</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>ab</fromport>
+      <tonode>s12</tonode> <toport>b</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>ac</fromport>
+      <tonode>s12</tonode> <toport>c</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>ac</fromport>
+      <tonode>PyScript00</tonode> <toport>i3</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>ad</fromport>
+      <tonode>s12</tonode> <toport>d</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>ad</fromport>
+      <tonode>PyScript00</tonode> <toport>i5</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>ae</fromport>
+      <tonode>s12</tonode> <toport>e</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>ae</fromport>
+      <tonode>PyScript00</tonode> <toport>i4</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>af</fromport>
+      <tonode>s12</tonode> <toport>f</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>af</fromport>
+      <tonode>PyScript00</tonode> <toport>i6</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>ag</fromport>
+      <tonode>s12</tonode> <toport>g</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s11</fromnode> <fromport>ag</fromport>
+      <tonode>PyScript00</tonode> <toport>i7</toport>
+   </datalink>
+   <presentation name="s13" x="389.75" y="517.25" width="158" height="225" expanded="1" expx="389.75" expy="517.25" expWidth="158" expHeight="225" shownState="0"/>
+   <presentation name="PyScript1" x="1.75" y="396.25" width="158" height="225" expanded="1" expx="1.75" expy="396.25" expWidth="158" expHeight="225" shownState="0"/>
+   <presentation name="PyScript0" x="389.75" y="759.25" width="158" height="225" expanded="1" expx="389.75" expy="759.25" expWidth="158" expHeight="225" shownState="0"/>
+   <presentation name="s10" x="195.75" y="517.25" width="158" height="225" expanded="1" expx="195.75" expy="517.25" expWidth="158" expHeight="225" shownState="0"/>
+   <presentation name="s11" x="195.75" y="275.25" width="158" height="225" expanded="1" expx="195.75" expy="275.25" expWidth="158" expHeight="225" shownState="0"/>
+   <presentation name="PyScript00" x="389.75" y="33.25" width="158" height="225" expanded="1" expx="389.75" expy="33.25" expWidth="158" expHeight="225" shownState="0"/>
+   <presentation name="s12" x="389.75" y="275.25" width="158" height="225" expanded="1" expx="389.75" expy="275.25" expWidth="158" expHeight="225" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="551.75" height="988.25" expanded="1" expx="0" expy="0" expWidth="551.75" expHeight="988.25" shownState="0"/>
+</proc>
diff --git a/Examples/types1/geom_coupling.xml b/Examples/types1/geom_coupling.xml
new file mode 100644 (file)
index 0000000..b1e65dc
--- /dev/null
@@ -0,0 +1,93 @@
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="proc">
+   <property name="DefaultStudyID" value="1"/>
+   <objref name="CALCIUM_double" id="IDL:Ports/Calcium_Ports/Calcium_Double_Port:1.0"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <objref name="GEOM_Object" id="IDL:GEOM/GEOM_Object:1.0"/>
+   <struct name="SALOME_TYPES/Parameter">
+      <member name="name" type="string"/>
+      <member name="value" type="string"/>
+   </struct>
+   <sequence name="SALOME_TYPES/ParameterList" content="SALOME_TYPES/Parameter"/>
+   <sequence name="SALOME_TYPES/VarList" content="string"/>
+   <type name="double" kind="double"/>
+   <sequence name="Value1D" content="double"/>
+   <sequence name="SALOME_TYPES/Value" content="Value1D"/>
+   <sequence name="SALOME_TYPES/ValueList" content="SALOME_TYPES/Value"/>
+   <struct name="SALOME_TYPES/ParametricInput">
+      <member name="inputVarList" type="SALOME_TYPES/VarList"/>
+      <member name="outputVarList" type="SALOME_TYPES/VarList"/>
+      <member name="inputValues" type="SALOME_TYPES/ValueList"/>
+      <member name="specificParameters" type="SALOME_TYPES/ParameterList"/>
+   </struct>
+   <type name="int" kind="int"/>
+   <struct name="SALOME_TYPES/ParametricOutput">
+      <member name="outputValues" type="SALOME_TYPES/ValueList"/>
+      <member name="specificOutputInfos" type="SALOME_TYPES/ParameterList"/>
+      <member name="returnCode" type="int"/>
+      <member name="errorMessage" type="string"/>
+   </struct>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <sequence name="intvec" content="int"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="stringvec" content="string"/>
+   <container name="A">
+   </container>
+   <container name="B">
+   </container>
+   <container name="DefaultContainer">
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="localhost"/>
+   </container>
+   <service name="MakeBoxDXDYDZ0">
+      <component>GEOM_Superv</component>
+      <load container="DefaultContainer"/>
+      <method>MakeBoxDXDYDZ</method>
+      <inport name="theDX" type="double"/>
+      <inport name="theDY" type="double"/>
+      <inport name="theDZ" type="double"/>
+      <outport name="return" type="GEOM_Object"/>
+   </service>
+   <service name="s21">
+      <component>compo1</component>
+      <load container="DefaultContainer"/>
+      <method>s2</method>
+      <inport name="a" type="GEOM_Object"/>
+      <outport name="aa" type="GEOM_Object"/>
+   </service>
+   <outnode name="StudyOutNode2" kind="study">
+      <parameter name="i3" type="GEOM_Object" ref="/GEOM_Superv_1/Box_1"/>
+   </outnode>
+   <control> <fromnode>MakeBoxDXDYDZ0</fromnode> <tonode>s21</tonode> </control>
+   <control> <fromnode>s21</fromnode> <tonode>StudyOutNode2</tonode> </control>
+   <datalink control="false">
+      <fromnode>MakeBoxDXDYDZ0</fromnode> <fromport>return</fromport>
+      <tonode>s21</tonode> <toport>a</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>s21</fromnode> <fromport>aa</fromport>
+      <tonode>StudyOutNode2</tonode> <toport>i3</toport>
+   </datalink>
+   <parameter>
+      <tonode>MakeBoxDXDYDZ0</tonode><toport>theDX</toport>
+      <value><double>10</double></value>
+   </parameter>
+   <parameter>
+      <tonode>MakeBoxDXDYDZ0</tonode><toport>theDY</toport>
+      <value><double>10</double></value>
+   </parameter>
+   <parameter>
+      <tonode>MakeBoxDXDYDZ0</tonode><toport>theDZ</toport>
+      <value><double>10</double></value>
+   </parameter>
+   <presentation name="StudyOutNode2" x="389.75" y="60.25" width="158" height="63" expanded="1" expx="389.75" expy="60.25" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="s21" x="195.75" y="60.25" width="158" height="63" expanded="1" expx="195.75" expy="60.25" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="MakeBoxDXDYDZ0" x="1.75" y="33.25" width="158" height="117" expanded="1" expx="1.75" expy="33.25" expWidth="158" expHeight="117" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="551.75" height="154.25" expanded="1" expx="0" expy="0" expWidth="551.75" expHeight="154.25" shownState="0"/>
+</proc>
index e79531f531025971906ee273ff571b311a721613..695e2095e574f6ace6308bf8a3e3119e7c13c42d 100644 (file)
@@ -29,3 +29,5 @@ from pacocompo import PACOComponent
 from pycompo import PYComponent
 from astcompo import ASTERComponent
 from hxxcompo import HXX2SALOMEComponent
+from yacstypes import add_type
+from salomemodules import add_module
index c8feeffcd57b9a30256c1911798b402687e5d88d..c9ca28e5dce4dbc9ca8c349ce0425b56264aa29c 100644 (file)
@@ -33,6 +33,7 @@ idl="""
 #include "SALOME_PACOExtension.idl"
 #include "SALOME_Component.idl"
 #include "SALOME_Comm.idl"
+#include "SALOME_Parametric.idl"
 
 ${idldefs}
 
index bddf0f9f491364777c03f895265bca0a9d3d6097..d74d30030f6a2f686390b01b922538db275e7873 100644 (file)
 #######################################################################
 salome_modules={}
 
+def add_module(module,idldefs="",makefiledefs="",configdefs=""):
+  """ add a module configuration for other module than KERNEL
+
+       :param module: module name (GEOM, SMESH, VISU, ...)
+       :type module: string
+       :param idldefs:  definition instructions to add to idl files when using this module
+       :type idldefs: string
+       :param makefiledefs:  definition instructions to add to Makefile files when using this module
+       :type makefiledefs: string
+       :param configdefs:  instructions to add to configure file when using this module
+       :type configdefs: string
+  """
+  salome_modules[module]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs}
+
 #module GEOM
 idldefs="""
 #include "GEOM_Gen.idl"
@@ -44,8 +58,7 @@ else
   AC_MSG_ERROR([Cannot find module GEOM. Have you set GEOM_ROOT_DIR ?],1)
 fi
 """
-
-salome_modules["GEOM"]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs}
+add_module("GEOM",idldefs,makefiledefs,configdefs)
 
 #module MED
 idldefs="""
index 8aa90f1bad396ace6212c3ad7bb9814bcea94b8c..2d3f59a7f7a83d2faf318123cfc4f92aa7135cb0 100644 (file)
@@ -65,7 +65,7 @@ def corba_rtn_type(typ, module):
 ValidTypes = corbaTypes.keys()
 PyValidTypes = ValidTypes+["pyobj"]
 
-def add_type(typename, corbaType, corbaOutType, module, idltype, corbaRtnType):
+def add_type(typename, corbaType=None, corbaOutType=None, module="", idltype=None, corbaRtnType=None):
   """ add a data type YACS from other module than KERNEL to the list of available types
 
        :param typename: YACS data type name
@@ -81,11 +81,11 @@ def add_type(typename, corbaType, corbaOutType, module, idltype, corbaRtnType):
        :param corbaRtnType: representation for C++ CORBA return parameter
        :type corbaRtnType: string
   """
-  corbaTypes[typename] = corbaType
-  corbaOutTypes[typename] = corbaOutType
-  corbaRtnTypes[typename] = corbaRtnType
+  corbaTypes[typename] = corbaType or "const "+typename.replace("/","::")+"&"
+  corbaOutTypes[typename] = corbaOutType or typename.replace("/","::")+"_out"
+  corbaRtnTypes[typename] = corbaRtnType or typename.replace("/","::")+"*"
   moduleTypes[typename] = module
-  idlTypes[typename] = idltype
+  idlTypes[typename] = idltype or typename.replace("/","::")
   ValidTypes.append(typename)
   PyValidTypes.append(typename)
 
@@ -106,10 +106,24 @@ ValidStreamTypes = calciumTypes.keys()
 ValidParallelStreamTypes = DatastreamParallelTypes.keys()
 ValidDependencies = ("I", "T")
 
+#Add KERNEL YACS types : YACS name, c++ corba arg in, c++ corba arg out,defining module, repr corba idl, c++ corba return
 add_type("dataref", "const Engines::dataref&", "Engines::dataref_out", "", "dataref","Engines::dataref*")
+add_type("SALOME_TYPES/Parameter")
+add_type("SALOME_TYPES/ParameterList", "const SALOME_TYPES::ParameterList&", "SALOME_TYPES::ParameterList_out", "", "SALOME_TYPES::ParameterList","SALOME_TYPES::ParameterList*")
+add_type("SALOME_TYPES/Value", "const SALOME_TYPES::Value&", "SALOME_TYPES::Value_out", "", "SALOME_TYPES::Value","SALOME_TYPES::Value*")
+add_type("SALOME_TYPES/VarList", "const SALOME_TYPES::VarList&", "SALOME_TYPES::VarList_out", "", "SALOME_TYPES::VarList","SALOME_TYPES::VarList*")
+add_type("SALOME_TYPES/ValueList", "const SALOME_TYPES::ValueList&", "SALOME_TYPES::ValueList_out", "", "SALOME_TYPES::ValueList","SALOME_TYPES::ValueList*")
+add_type("SALOME_TYPES/ParametricInput", "const SALOME_TYPES::ParametricInput&", "SALOME_TYPES::ParametricInput_out", "", "SALOME_TYPES::ParametricInput","SALOME_TYPES::ParametricInput*")
+add_type("SALOME_TYPES/ParametricOutput", "const SALOME_TYPES::ParametricOutput&", "SALOME_TYPES::ParametricOutput_out", "", "SALOME_TYPES::ParametricOutput","SALOME_TYPES::ParametricOutput*")
+
+#Add GEOM YACS types
 add_type("GEOM_Object", "GEOM::GEOM_Object_ptr", "GEOM::GEOM_Object_out", "GEOM", "GEOM::GEOM_Object","GEOM::GEOM_Object_ptr")
+
+#Add SMESH YACS types
 add_type("SMESH_Mesh", "SMESH::SMESH_Mesh_ptr", "SMESH::SMESH_Mesh_out", "SMESH", "SMESH::SMESH_Mesh","SMESH::SMESH_Mesh_ptr")
 add_type("SMESH_Hypothesis", "SMESH::SMESH_Hypothesis_ptr", "SMESH::SMESH_Hypothesis_out", "SMESH", "SMESH::SMESH_Hypothesis", "SMESH::SMESH_Hypothesis_ptr")
+
+#Add MED YACS types
 add_type("SALOME_MED/MED", "SALOME_MED::MED_ptr", "SALOME_MED::MED_out", "MED", "SALOME_MED::MED", "SALOME_MED::MED_ptr")
 add_type("SALOME_MED/MESH", "SALOME_MED::MESH_ptr", "SALOME_MED::MESH_out", "MED", "SALOME_MED::MESH", "SALOME_MED::MESH_ptr")
 add_type("SALOME_MED/SUPPORT", "SALOME_MED::SUPPORT_ptr", "SALOME_MED::SUPPORT_out", "MED", "SALOME_MED::SUPPORT", "SALOME_MED::SUPPORT_ptr")