1 # Copyright (C) 2009-2024 EDF
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, or (at your option) any later version.
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
21 from string import Template
23 from module_generator.compat import Template,set
26 // this cxx file was generated by yacsgen
27 #include "${component}_i.hxx"
28 #include "${component}.hxx"
32 #include "SenderFactory.hxx"
33 #include "MultiCommException.hxx"
34 #include "ReceiverFactory.hxx"
35 #include "SALOME_Matrix_i.hxx"
36 #include "MatrixClient.hxx"
37 #include "Utils_CorbaException.hxx"
43 //=============================================================================
45 * standard constructor
47 //=============================================================================
48 ${component}_i::${component}_i(CORBA::ORB_ptr orb,
49 PortableServer::POA_ptr poa,
50 PortableServer::ObjectId * contId,
51 const char *instanceName,
52 const char *interfaceName) :
53 Engines_Component_i(orb, poa, contId, instanceName, interfaceName),${inheritedconstructor}cppCompo_(new ${component})
55 MESSAGE("activate object");
57 _id = _poa->activate_object(_thisObj);
60 ${component}_i::~${component}_i()
66 char* ${component}_i::ComponentDataType()
68 return CORBA::string_dup("${component}");
71 Engines::EngineComponent_ptr ${component}_i::GetComponentInstance()
73 return ${component}_Gen::_this();
78 PortableServer::ObjectId * ${component}Engine_factory(
80 PortableServer::POA_ptr poa,
81 PortableServer::ObjectId * contId,
82 const char *instanceName,
83 const char *interfaceName)
85 MESSAGE("PortableServer::ObjectId * ${component}Engine_factory()");
86 SCRUTE(interfaceName);
87 ${component}_i * my${component}
88 = new ${component}_i(orb, poa, contId, instanceName, interfaceName);
89 return my${component}->getId() ;
93 cxxCompo=Template(cxxCompo)
96 //this file was generated by yacsgen
97 #ifndef __${component}_hxx2salome__
98 #define __${component}_hxx2salome__
100 #include <SALOMEconfig.h>
101 #include CORBA_SERVER_HEADER(${module})
102 #include "SALOME_Component_i.hxx"
103 #include "SALOMEMultiComm.hxx"
104 #include <memory> // for std::auto_ptr
109 class ${component}; // forward declaration
111 class ${component}_i: ${inheritedclass}
112 public POA_${module}_ORB::${component}_Gen,
113 public Engines_Component_i
117 ${component}_i(CORBA::ORB_ptr orb,
118 PortableServer::POA_ptr poa,
119 PortableServer::ObjectId * contId,
120 const char *instanceName,
121 const char *interfaceName);
122 virtual ~${component}_i();
126 // (re)defined methods of Driver
127 virtual Engines::EngineComponent_ptr GetComponentInstance();
128 char* ComponentDataType();
131 std::auto_ptr<${component}> cppCompo_;
137 PortableServer::ObjectId * ${component}Engine_factory(
139 PortableServer::POA_ptr poa,
140 PortableServer::ObjectId * contId,
141 const char *instanceName,
142 const char *interfaceName);
147 hxxCompo=Template(hxxCompo)
150 ${ret} ${component}_i::${service}(${parameters}) throw (SALOME::SALOME_Exception)
152 beginService("${component}_i::${service}");
153 BEGIN_OF("${component}_i::${service}");
158 catch (std::exception& ex)
160 THROW_SALOME_CORBA_EXCEPTION( ex.what(), SALOME::INTERNAL_ERROR );
164 cxxService=Template(cxxService)
167 #, SALOME_MED::MED_Gen_Driver, SALOME::MultiCommClass
169 interface ${component}_Gen: ${inherited}
174 interfaceidlhxx=Template(interfaceidlhxx)
180 # CMakeLists.txt in src/<component>
181 # template parameters:
182 # module : module name
183 # component : component name
184 # componentlib : name of the target library
185 # includes : additional headers, separated by spaces or \n. can be empty
186 # libs : additional libraries
187 # find_libs : find_library commands
188 # target_properties : additional properties of the target
189 cmake_src_compo_hxx = """
191 # additional include directories
193 $${KERNEL_INCLUDE_DIRS}
194 $${OMNIORB_INCLUDE_DIR}
195 $${PROJECT_BINARY_DIR}
196 $${PROJECT_BINARY_DIR}/idl
200 # --- definitions ---
202 $${OMNIORB_DEFINITIONS}
205 # find additional libraries
208 # libraries to link to
210 $${OMNIORB_LIBRARIES}
211 $${KERNEL_SalomeIDLKernel}
213 $${KERNEL_SalomeContainer}
214 $${KERNEL_SalomeDSCContainer}
215 $${KERNEL_SalomeDSCSuperv}
216 $${KERNEL_SalomeDatastream}
217 $${KERNEL_SalomeDSCSupervBasic}
225 # header files / no moc processing
227 SET(${module}_HEADERS
234 SET(${module}_SOURCES
240 ADD_LIBRARY(${componentlib} $${${module}_SOURCES})
241 TARGET_LINK_LIBRARIES(${componentlib} $${_link_LIBRARIES} )
244 INSTALL(TARGETS ${componentlib} EXPORT $${PROJECT_NAME}TargetGroup DESTINATION $${SALOME_INSTALL_LIBS})
246 INSTALL(FILES $${${module}_HEADERS} DESTINATION $${SALOME_INSTALL_HEADERS})
248 cmake_src_compo_hxx = Template(cmake_src_compo_hxx)