1 # Copyright (C) 2009-2012 EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #import context from ..
23 execfile("../context.py")
25 from module_generator import Generator,Module,Service,CPPComponent,PYComponent,add_type,add_module
27 #overload module GEOM definition
29 #include "GEOM_Gen.idl"
33 GEOM_IDL_INCLUDES = -I$(GEOM_ROOT_DIR)/idl/salome
34 GEOM_INCLUDES= -I$(GEOM_ROOT_DIR)/include/salome
35 GEOM_IDL_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome -lSalomeIDLGEOM
36 GEOM_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome
37 SALOME_LIBS += ${GEOM_LIBS}
38 SALOME_IDL_LIBS += ${GEOM_IDL_LIBS}
39 SALOME_INCLUDES += ${GEOM_INCLUDES}
40 IDL_INCLUDES += ${GEOM_IDL_INCLUDES}
43 if test "x${GEOM_ROOT_DIR}" != "x" && test -d ${GEOM_ROOT_DIR} ; then
44 AC_MSG_RESULT(Using GEOM installation in ${GEOM_ROOT_DIR})
46 AC_MSG_ERROR([Cannot find module GEOM. Have you set GEOM_ROOT_DIR ?],1)
49 add_module("GEOM",idldefs,makefiledefs,configdefs)
51 #overload GEOM_Object definition
52 add_type("GEOM_Object", "GEOM::GEOM_Object_ptr", "GEOM::GEOM_Object_out", "GEOM", "GEOM::GEOM_Object","GEOM::GEOM_Object_ptr")
63 std::cerr << "Parameter:" << std::endl;
64 std::cerr << "a: " << a.name << "=" << a.value << std::endl;
65 std::cerr << "" << std::endl;
68 std::cerr << "ParameterList:" << std::endl;
69 for(CORBA::ULong i = 0;i<b.length();i++)
70 std::cerr << "b["<<i<<"]:"<<b[i].name <<"="<<b[i].value << std::endl;
71 std::cerr << "" << std::endl;
74 std::cerr << "Variable:" << std::endl;
75 for(CORBA::ULong i = 0;i<c.length();i++)
76 std::cerr << "c["<<i<<"]="<<c[i] << std::endl;
77 std::cerr << "" << std::endl;
80 std::cerr << "VariableSequence:" << std::endl;
81 for(CORBA::ULong i = 0;i<d.length();i++)
82 for(CORBA::ULong j = 0;j<d[i].length();j++)
83 std::cerr << "d["<<i<<"]["<< j<< "]="<<d[i][j] << std::endl;
84 std::cerr << "" << std::endl;
87 std::cerr << "StateSequence:" << std::endl;
88 for(CORBA::ULong i = 0;i<d2.length();i++)
89 for(CORBA::ULong j = 0;j<d2[i].length();j++)
90 for(CORBA::ULong k = 0;k<d2[i][j].length();k++)
91 std::cerr << "d2["<<i<<"]["<< j<< "]["<<k<<"]="<<d2[i][j][k] << std::endl;
92 std::cerr << "" << std::endl;
95 std::cerr << "TimeSequence:" << std::endl;
96 for(CORBA::ULong i = 0;i<d3.length();i++)
97 for(CORBA::ULong j = 0;j<d3[i].length();j++)
98 for(CORBA::ULong k = 0;k<d3[i][j].length();k++)
99 for(CORBA::ULong l = 0;l<d3[i][j][k].length();l++)
100 std::cerr << "d3["<<i<<"]["<< j<< "]["<<k<<"]["<<l<<"]="<<d3[i][j][k][l] << std::endl;
101 std::cerr << "" << std::endl;
104 for(CORBA::ULong i = 0;i<f.inputVarList.length();i++)
105 std::cerr << "f.inputVarList["<<i<<"]="<<f.inputVarList[i] << std::endl;
106 for(CORBA::ULong i = 0;i<f.outputVarList.length();i++)
107 std::cerr << "f.outputVarList["<<i<<"]="<<f.outputVarList[i] << std::endl;
108 for(CORBA::ULong i = 0;i<f.inputValues.length();i++)
109 for(CORBA::ULong j = 0;j<f.inputValues[i].length();j++)
110 for(CORBA::ULong k = 0;k<f.inputValues[i][j].length();k++)
111 for(CORBA::ULong l = 0;l<f.inputValues[i][j][k].length();l++)
112 std::cerr << "f.inputValues["<<i<<"]["<< j<< "]["<<k<<"]["<<l<<"]="<<f.inputValues[i][j][k][l] << std::endl;
113 for(CORBA::ULong i = 0;i<f.specificParameters.length();i++)
114 std::cerr << "f.specificParameters["<<i<<"]:"<<f.specificParameters[i].name <<"="<<f.specificParameters[i].value << std::endl;
117 for(CORBA::ULong i = 0;i<g.outputValues.length();i++)
118 for(CORBA::ULong j = 0;j<g.outputValues[i].length();j++)
119 for(CORBA::ULong k = 0;k<g.outputValues[i][j].length();k++)
120 for(CORBA::ULong l = 0;l<g.outputValues[i][j][k].length();l++)
121 std::cerr << "g.outputValues["<<i<<"]["<< j<< "]["<<k<<"]["<<l<<"]="<<g.outputValues[i][j][k][l] << std::endl;
125 aa=new SALOME_TYPES::Parameter;
126 aa->name=CORBA::string_dup(a.name);
127 aa->value=CORBA::string_dup(a.value);
128 std::cerr << "aa: " << aa->name << "=" << aa->value << std::endl;
130 ab=new SALOME_TYPES::ParameterList;
131 ac= new SALOME_TYPES::Variable;
132 ad= new SALOME_TYPES::VariableSequence;
133 ad2= new SALOME_TYPES::StateSequence;
134 ad3= new SALOME_TYPES::TimeSequence;
135 ae= new SALOME_TYPES::VarList;
136 af= new SALOME_TYPES::ParametricInput;
137 ag= new SALOME_TYPES::ParametricOutput;
141 std::cerr << "service s2 C++ component" << std::endl;
142 aa=GEOM::GEOM_Object::_duplicate(a);
146 c1=CPPComponent("compo1",services=[
147 Service("s1",inport=[("a","SALOME_TYPES/Parameter"),
148 ("b","SALOME_TYPES/ParameterList"),
149 ("c","SALOME_TYPES/Variable"),
150 ("d","SALOME_TYPES/VariableSequence"),
151 ("d2","SALOME_TYPES/StateSequence"),
152 ("d3","SALOME_TYPES/TimeSequence"),
153 ("e","SALOME_TYPES/VarList"),
154 ("f","SALOME_TYPES/ParametricInput"),
155 ("g","SALOME_TYPES/ParametricOutput"),
157 outport=[("aa","SALOME_TYPES/Parameter"),
158 ("ab","SALOME_TYPES/ParameterList"),
159 ("ac","SALOME_TYPES/Variable"),
160 ("ad","SALOME_TYPES/VariableSequence"),
161 ("ad2","SALOME_TYPES/StateSequence"),
162 ("ad3","SALOME_TYPES/TimeSequence"),
163 ("ae","SALOME_TYPES/VarList"),
164 ("af","SALOME_TYPES/ParametricInput"),
165 ("ag","SALOME_TYPES/ParametricOutput"),
169 Service("s2",inport=[("a","GEOM_Object"),],outport=[("aa","GEOM_Object"),],body=s2body,),
173 pydefs="""import SALOME_TYPES"""
176 print a,b,c,d,d2,d3,e,f,g
177 aa=SALOME_TYPES.Parameter(name="a",value="45.")
184 af=SALOME_TYPES.ParametricInput(inputVarList=ae,outputVarList=ae, inputValues=[[[[1,2,3]]]],specificParameters=[])
185 ag=SALOME_TYPES.ParametricOutput(outputValues=[[[[1,2,3]]]], specificOutputInfos=[], returnCode=1, errorMessage="error")
186 print aa,ab,ac,ad,ad2,ad3,ae,af,ag
190 print "service s2 python component"
195 c2=PYComponent("compo2",services=[
196 Service("s1",inport=[("a","SALOME_TYPES/Parameter"),
197 ("b","SALOME_TYPES/ParameterList"),
198 ("c","SALOME_TYPES/Variable"),
199 ("d","SALOME_TYPES/VariableSequence"),
200 ("d2","SALOME_TYPES/StateSequence"),
201 ("d3","SALOME_TYPES/TimeSequence"),
202 ("e","SALOME_TYPES/VarList"),
203 ("f","SALOME_TYPES/ParametricInput"),
204 ("g","SALOME_TYPES/ParametricOutput"),
206 outport=[("aa","SALOME_TYPES/Parameter"),
207 ("ab","SALOME_TYPES/ParameterList"),
208 ("ac","SALOME_TYPES/Variable"),
209 ("ad","SALOME_TYPES/VariableSequence"),
210 ("ad2","SALOME_TYPES/StateSequence"),
211 ("ad3","SALOME_TYPES/TimeSequence"),
212 ("ae","SALOME_TYPES/VarList"),
213 ("af","SALOME_TYPES/ParametricInput"),
214 ("ag","SALOME_TYPES/ParametricOutput"),
216 body=pybody,defs=pydefs,
218 Service("s2",inport=[("a","GEOM_Object"),],outport=[("aa","GEOM_Object"),],body=s2pybody,),
223 g=Generator(Module("mymodule",components=[c1,c2],prefix="./install"),context)
229 g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR, "GEOM":GEOM_ROOT_DIR})