Salome HOME
Merge branch 'V9_2_2_BR'
[tools/yacsgen.git] / module_generator / cata_tmpl.py
index cce5dcfeaef508f68d833a856e2f4c3cb6edae75..32d9f7777fdeb32a1b1018e6113e4a4b1a3bd85e 100644 (file)
@@ -1,7 +1,26 @@
+# Copyright (C) 2009-2019  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, or (at your option) any later version.
+#
+# 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
+#
+
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 # CORBA idl
 
@@ -9,14 +28,18 @@ idl="""
 #ifndef _${module}_IDL_
 #define _${module}_IDL_
 
-#include "DSC_Engines.idl"
 #include "SALOME_Exception.idl"
+#include "SALOME_Component.idl"
+#include "SALOME_Comm.idl"
+
+${idldefs}
 
-module ${module}
+module ${module}_ORB
 {
 typedef sequence<string> stringvec;
 typedef sequence<double> dblevec;
 typedef sequence<long> intvec;
+typedef Engines::dataref dataref;
 
 ${interfaces}
 };
@@ -26,47 +49,58 @@ ${interfaces}
 idl=Template(idl)
 
 interface="""
-  interface ${component}:Engines::Superv_Component
+  interface ${component}:${inheritedinterface} Engines::Superv_Component
   {
 ${services}
   };
 """
 interface=Template(interface)
 
-idlMakefile="""
-include $$(top_srcdir)/adm_local/make_common_starter.am
-
-BUILT_SOURCES = ${module}SK.cc
-IDL_FILES=${module}.idl
-
-lib_LTLIBRARIES = lib${module}.la
-salomeidl_DATA = $$(IDL_FILES)
-salomepython_DATA = ${module}_idl.py
-lib${module}_la_SOURCES      =
-nodist_lib${module}_la_SOURCES = ${module}SK.cc
-nodist_salomeinclude_HEADERS= ${module}.hh
-lib${module}_la_CXXFLAGS     = -I.  $$(KERNEL_INCLUDES)
-lib${module}_la_LIBADD     = $$(KERNEL_LIBS)
-##########################################################
-%SK.cc %.hh : %.idl
-\t$$(OMNIORB_IDL) -bcxx $$(IDLCXXFLAGS) $$(OMNIORB_IDLCXXFLAGS) $$(IDL_INCLUDES) $$<
-%_idl.py : %.idl
-\t$$(OMNIORB_IDL) -bpython $$(IDL_INCLUDES) $$<
-
-CLEANFILES = *.hh *SK.cc *.py
-
-clean-local:
-\trm -rf ${module} ${module}__POA
-
-install-data-local:
-\t$${mkinstalldirs} $$(DESTDIR)$$(salomepythondir)
-\tcp -R ${module} ${module}__POA $$(DESTDIR)$$(salomepythondir)
-
-uninstall-local:
-\trm -rf $$(DESTDIR)$$(salomepythondir)/${module}
-\trm -rf $$(DESTDIR)$$(salomepythondir)/${module}__POA
+parallel_interface="""
+interface ${component} : Engines::Parallel_DSC
+  {
+${services}
+  };
+"""
+parallel_interface=Template(parallel_interface)
+
+xml="""\
+<?xml version="1.0"?>
+<!-- YACSGEN -->
+
+<PaCO_Interface_description>
+  <Module>
+    <Name>${module}_ORB</Name>
+${interfaces}
+  </Module>
+</PaCO_Interface_description>
 """
-idlMakefile=Template(idlMakefile)
+xml = Template(xml)
+
+xml_interface="""\
+    <Interface>
+      <Name>${component}</Name>
+${xml_services}
+    </Interface>"""
+xml_interface = Template(xml_interface)
+
+xml_service = """\
+      <Method>
+        <Name>${service_name}</Name>
+        <Type>distributed</Type>
+      </Method>"""
+xml_service = Template(xml_service)
+
+# PACO Part
+idlMakefilePaCO_BUILT_SOURCES = "${module}PaCO.cxx "
+idlMakefilePaCO_nodist_salomeinclude_HEADERS = "${module}PaCO.hxx "
+idlMakefilePaCO_BUILT_SOURCES = Template(idlMakefilePaCO_BUILT_SOURCES)
+idlMakefilePaCO_nodist_salomeinclude_HEADERS = Template(idlMakefilePaCO_nodist_salomeinclude_HEADERS)
+idlMakefilePACO_INCLUDES = "-I@PACOPATH@/idl"
+idlMakefilePACO_salomepython_DATA = "${module}PaCO_idl.py"
+idlMakefilePACO_salomepython_DATA = Template(idlMakefilePACO_salomepython_DATA)
+idlMakefilePACO_salomeidl_DATA = "${module}PaCO.idl"
+idlMakefilePACO_salomeidl_DATA = Template(idlMakefilePACO_salomeidl_DATA)
 
 #SALOME catalog
 
@@ -83,6 +117,7 @@ catalog="""<?xml version='1.0' encoding='us-ascii' ?>
 <!-- Commonly used types  -->
 <type-list>
   <objref name="pyobj" id="python:obj:1.0"/>
+  <objref name="file" id="file"/>
 </type-list>
 
 <!-- Component list -->
@@ -161,3 +196,14 @@ cataOutStream="""                       <outParameter>
                        </outParameter>"""
 cataOutStream=Template(cataOutStream)
 
+cataInParallelStream="""                       <inParameter>
+                          <inParameter-name>${name}</inParameter-name>
+                          <inParameter-type>${type}</inParameter-type>
+                       </inParameter>"""
+cataInParallelStream=Template(cataInParallelStream)
+
+cataOutParallelStream="""                       <outParameter>
+                          <outParameter-name>${name}</outParameter-name>
+                          <outParameter-type>${type}</outParameter-type>
+                       </outParameter>"""
+cataOutParallelStream=Template(cataOutParallelStream)