| /** |
| * Copyright (c) 2020-2021 Robert Bosch GmbH. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Robert Bosch GmbH - initial API and implementation |
| */ |
| |
| package org.eclipse.app4mc.slg.ros2.transformers |
| |
| import com.google.inject.Inject |
| import com.google.inject.Singleton |
| import org.eclipse.app4mc.amalthea.model.InterProcessStimulus |
| import org.eclipse.app4mc.slg.commons.m2t.transformers.SynteticTransformer |
| import org.eclipse.app4mc.slg.ros2.generators.RosIpStimulusTranslationunit |
| import org.eclipse.app4mc.transformation.util.OutputBuffer |
| |
| @Singleton |
| class RosInterProcessStimulusTransformer extends SynteticTransformer<RosIpStimulusTranslationunit> { |
| |
| @Inject OutputBuffer outputBuffer |
| |
| RosIpStimulusTranslationunit ipUnit |
| |
| def RosIpStimulusTranslationunit transform(InterProcessStimulus ip) { |
| ipUnit = new RosIpStimulusTranslationunit(outputBuffer, ip) |
| outputBuffer.appendTo("OTHER", ipUnit.makeFilePath.toString(), "CMakeLists.txt") |
| outputBuffer.appendTo("OTHER", "services/" + ipUnit.moduleName + "/CMakeLists.txt", toCMake()) |
| outputBuffer.appendTo("OTHER", "services/" + ipUnit.moduleName + "/package.xml", toPackageXML()) |
| return ipUnit |
| } |
| |
| def String toPackageXML() ''' |
| <?xml version="1.0"?> |
| <?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> |
| <package format="3"> |
| <name>«ipUnit.moduleName»</name> |
| <version>0.0.0</version> |
| <description>TODO: Package description</description> |
| <maintainer email="fixedterm.Patrick.Will@de.bosch.com">wlp8fe</maintainer> |
| <license>TODO: License declaration</license> |
| |
| <build_depend>rosidl_default_generators</build_depend> |
| |
| <exec_depend>rosidl_default_runtime</exec_depend> |
| |
| <member_of_group>rosidl_interface_packages</member_of_group> |
| |
| <buildtool_depend>ament_cmake</buildtool_depend> |
| |
| <test_depend>ament_lint_auto</test_depend> |
| <test_depend>ament_lint_common</test_depend> |
| |
| <export> |
| <build_type>ament_cmake</build_type> |
| </export> |
| </package> |
| |
| |
| |
| ''' |
| |
| def String toCMake() ''' |
| |
| cmake_minimum_required(VERSION 3.5) |
| project(�ipUnit.moduleName�) |
| |
| |
| if(NOT CMAKE_C_STANDARD) |
| set(CMAKE_C_STANDARD 99) |
| endif() |
| |
| # Default to C++14 |
| if(NOT CMAKE_CXX_STANDARD) |
| set(CMAKE_CXX_STANDARD 14) |
| endif() |
| if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| |
| add_compile_options(-Wall -Wextra -Wpedantic) |
| endif() |
| find_package(ament_cmake REQUIRED) |
| |
| |
| find_package(rosidl_default_generators REQUIRED) |
| rosidl_generate_interfaces(${PROJECT_NAME} |
| "srv/�Utils.toIdlCompliantName(ipUnit.moduleName)�.srv" |
| ) |
| ament_package() |
| ''' |
| |
| override getCache() { |
| throw new UnsupportedOperationException("TODO: auto-generated method stub") |
| } |
| |
| } |