Salome HOME
Merge branch 'V8_0_0_BR'
[tools/yacsgen.git] / module_generator / pacocompo.py
index a767a66bc76bf2c9977a72ac195adc7b39b1e48e..7ccdb785037de4caff4fad5a0936d7e2df67bea1 100644 (file)
@@ -1,11 +1,11 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 *-
-# Copyright (C) 2009-2012  EDF R&D
+# Copyright (C) 2009-2015  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.
+# 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
@@ -32,6 +32,7 @@ from paco_tmpl import cxxFactoryDummy, cxxFactoryMpi, cxx_des_parallel_stream
 from paco_tmpl import hxxparallel_instream, hxxparallel_outstream, hxxinit_ok
 from paco_tmpl import hxxparallel_instream_init, hxxparallel_outstream_init, cxxService_connect
 from paco_tmpl import cxx_cons_service, cxx_cons_parallel_outstream, cxx_cons_parallel_instream
+from cata_tmpl import parallel_interface
 
 class PACOComponent(Component):
 
@@ -165,3 +166,29 @@ class PACOComponent(Component):
 
     return cxxfile
 
+  def getIdlServices(self):
+    services = []
+    for serv in self.services:
+      params = []
+      for name, typ in serv.inport:
+        if typ == "file":continue #files are not passed through IDL interface
+        params.append("in %s %s" % (idlTypes[typ], name))
+      for name, typ in serv.outport:
+        if typ == "file":continue #files are not passed through IDL interface
+        params.append("out %s %s" % (idlTypes[typ], name))
+      service = "    void %s(" % serv.name
+      service = service+",".join(params)+");"
+      services.append(service)
+    return services
+
+  def getIdlInterfaces(self):
+    services = self.getIdlServices()
+    return parallel_interface.substitute(component=self.name, services="\n".join(services))
+
+  def getIdlDefs(self):
+    idldefs = """
+#include "SALOME_PACOExtension.idl"
+"""
+    if self.interfacedefs:
+      idldefs = idldefs + self.interfacedefs
+    return idldefs