Salome HOME
CCAR: split file __init__.py into several files : templates + implementation specific
[tools/yacsgen.git] / module_generator / cata_tmpl.py
1 try:
2   from string import Template
3 except:
4   from compat import Template,set
5
6 # CORBA idl
7
8 idl="""
9 #ifndef _${module}_IDL_
10 #define _${module}_IDL_
11
12 #include "DSC_Engines.idl"
13 #include "SALOME_Exception.idl"
14
15 module ${module}
16 {
17 typedef sequence<string> stringvec;
18 typedef sequence<double> dblevec;
19 typedef sequence<long> intvec;
20
21 ${interfaces}
22 };
23
24 #endif
25 """
26 idl=Template(idl)
27
28 interface="""
29   interface ${component}:Engines::Superv_Component
30   {
31 ${services}
32   };
33 """
34 interface=Template(interface)
35
36 idlMakefile="""
37 include $$(top_srcdir)/adm_local/make_common_starter.am
38
39 BUILT_SOURCES = ${module}SK.cc
40 IDL_FILES=${module}.idl
41
42 lib_LTLIBRARIES = lib${module}.la
43 salomeidl_DATA = $$(IDL_FILES)
44 salomepython_DATA = ${module}_idl.py
45 lib${module}_la_SOURCES      =
46 nodist_lib${module}_la_SOURCES = ${module}SK.cc
47 nodist_salomeinclude_HEADERS= ${module}.hh
48 lib${module}_la_CXXFLAGS     = -I.  $$(KERNEL_INCLUDES)
49 lib${module}_la_LIBADD     = $$(KERNEL_LIBS)
50 ##########################################################
51 %SK.cc %.hh : %.idl
52 \t$$(OMNIORB_IDL) -bcxx $$(IDLCXXFLAGS) $$(OMNIORB_IDLCXXFLAGS) $$(IDL_INCLUDES) $$<
53 %_idl.py : %.idl
54 \t$$(OMNIORB_IDL) -bpython $$(IDL_INCLUDES) $$<
55
56 CLEANFILES = *.hh *SK.cc *.py
57
58 clean-local:
59 \trm -rf ${module} ${module}__POA
60
61 install-data-local:
62 \t$${mkinstalldirs} $$(DESTDIR)$$(salomepythondir)
63 \tcp -R ${module} ${module}__POA $$(DESTDIR)$$(salomepythondir)
64
65 uninstall-local:
66 \trm -rf $$(DESTDIR)$$(salomepythondir)/${module}
67 \trm -rf $$(DESTDIR)$$(salomepythondir)/${module}__POA
68 """
69 idlMakefile=Template(idlMakefile)
70
71 #SALOME catalog
72
73 catalog="""<?xml version='1.0' encoding='us-ascii' ?>
74
75 <!-- XML component catalog -->
76 <begin-catalog>
77
78 <!-- Path prefix information -->
79
80 <path-prefix-list>
81 </path-prefix-list>
82
83 <!-- Commonly used types  -->
84 <type-list>
85   <objref name="pyobj" id="python:obj:1.0"/>
86 </type-list>
87
88 <!-- Component list -->
89 <component-list>
90 ${components}
91 </component-list>
92 </begin-catalog>
93 """
94 catalog=Template(catalog)
95
96 cataCompo="""
97   <component>
98         <!-- Component identification -->
99         <component-name>${component}</component-name>
100         <component-username>${component}</component-username>
101         <component-type>Data</component-type>
102         <component-author>${author}</component-author>
103         <component-version>1.0</component-version>
104         <component-comment></component-comment>
105         <component-multistudy>0</component-multistudy>
106         <component-impltype>${impltype}</component-impltype>
107         <component-implname>${implname}</component-implname>
108         <component-interface-list>
109             <component-interface-name>${component}</component-interface-name>
110             <component-interface-comment></component-interface-comment>
111             <component-service-list>
112 ${services}
113             </component-service-list>
114         </component-interface-list>
115   </component>"""
116 cataCompo=Template(cataCompo)
117
118 cataService="""                <component-service>
119                     <!-- service-identification -->
120                     <service-name>${service}</service-name>
121                     <service-author>${author}</service-author>
122                     <service-version>1.0</service-version>
123                     <service-comment></service-comment>
124                     <service-by-default>0</service-by-default>
125                     <!-- service-connexion -->
126                     <inParameter-list>
127 ${inparams}
128                     </inParameter-list>
129                     <outParameter-list>
130 ${outparams}
131                     </outParameter-list>
132                     <DataStream-list>
133 ${datastreams}
134                     </DataStream-list>
135                 </component-service>"""
136 cataService=Template(cataService)
137
138 cataInparam="""                        <inParameter>
139                           <inParameter-name>${name}</inParameter-name>
140                           <inParameter-type>${type}</inParameter-type>
141                        </inParameter>"""
142 cataInparam=Template(cataInparam)
143
144 cataOutparam="""                        <outParameter>
145                           <outParameter-name>${name}</outParameter-name>
146                           <outParameter-type>${type}</outParameter-type>
147                        </outParameter>"""
148 cataOutparam=Template(cataOutparam)
149
150 cataInStream="""                       <inParameter>
151                           <inParameter-name>${name}</inParameter-name>
152                           <inParameter-type>${type}</inParameter-type>
153                           <inParameter-dependency>${dep}</inParameter-dependency>
154                        </inParameter>"""
155 cataInStream=Template(cataInStream)
156
157 cataOutStream="""                       <outParameter>
158                           <outParameter-name>${name}</outParameter-name>
159                           <outParameter-type>${type}</outParameter-type>
160                           <outParameter-dependency>${dep}</outParameter-dependency>
161                        </outParameter>"""
162 cataOutStream=Template(cataOutStream)
163