Commit 8e95f43a authored by Evgeny Kusmenko's avatar Evgeny Kusmenko
Browse files

Merge branch 'BreakingSymbolUpdate' into 'master'

Breaking symbol update

See merge request !7
parents 07a52abb ea354813
Pipeline #65249 passed with stages
in 1 minute and 13 seconds
......@@ -9,7 +9,7 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-roscpp-generator</artifactId>
<version>0.0.5-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
......@@ -17,10 +17,9 @@
<!-- .. SE-Libraries .................................................. -->
<se-commons.version>1.7.7</se-commons.version>
<Embedded-MontiArc-Math.version>0.0.19-SNAPSHOT</Embedded-MontiArc-Math.version>
<Embedded-montiarc-math-generator.version>0.0.22-SNAPSHOT</Embedded-montiarc-math-generator.version>
<Embedded-montiarc-math-rosmsg-generator.version>0.0.3-SNAPSHOT</Embedded-montiarc-math-rosmsg-generator.version>
<tagging.version>0.0.6</tagging.version>
<Embedded-MontiArc-Math.version>0.1.0-SNAPSHOT</Embedded-MontiArc-Math.version>
<Embedded-montiarc-math-rosmsg-generator.version>0.1.0-SNAPSHOT</Embedded-montiarc-math-rosmsg-generator.version>
<!-- .. Libraries .................................................. -->
<guava.version>18.0</guava.version>
<junit.version>4.12</junit.version>
......@@ -28,7 +27,6 @@
<yamlbeans.version>1.12</yamlbeans.version>
<!-- .. Plugins ....................................................... -->
<monticore.plugin>4.5.3-SNAPSHOT</monticore.plugin>
<assembly.plugin>2.5.4</assembly.plugin>
<compiler.plugin>3.3</compiler.plugin>
<source.plugin>2.4</source.plugin>
......@@ -49,23 +47,12 @@
<dependencies>
<dependency>
<groupId>de.monticore.lang</groupId>
<artifactId>Tagging</artifactId>
<version>${tagging.version}</version>
</dependency>
<dependency>
<groupId>de.se_rwth.commons</groupId>
<artifactId>se-commons-logging</artifactId>
<version>${se-commons.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-generator</artifactId>
<version>${Embedded-montiarc-math-generator.version}</version>
</dependency>
<dependency>
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-math-rosmsg-generator</artifactId>
......
package de.monticore.lang.monticar.generator.roscpp;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortSymbol;
import de.monticore.lang.monticar.generator.roscpp.helper.NameHelper;
public class DirectMsgConverter implements MsgConverter {
......@@ -18,7 +18,7 @@ public class DirectMsgConverter implements MsgConverter {
}
@Override
public String getConversion(PortSymbol portSymbol) {
public String getConversion(EMAPortSymbol portSymbol) {
return !isMsgToPort ? "." + msgField + " = component->" + NameHelper.getPortNameTargetLanguage(portSymbol) : "msg->" + msgField;
}
......
package de.monticore.lang.monticar.generator.roscpp;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.FileContent;
import de.monticore.lang.monticar.generator.cpp.BluePrintCPP;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.rosmsg.util.FileContent;
import de.monticore.lang.monticar.generator.roscpp.util.BluePrintCPP;
import de.monticore.lang.monticar.generator.roscpp.helper.FormatHelper;
import de.monticore.lang.monticar.generator.roscpp.helper.NameHelper;
import de.monticore.lang.monticar.generator.roscpp.helper.PrinterHelper;
......@@ -36,7 +36,7 @@ public class GeneratorRosCpp {
this.generationTargetPath = generationTargetPath;
}
public List<File> generateFiles(ExpandedComponentInstanceSymbol component, TaggingResolver symtab) throws IOException {
public List<File> generateFiles(EMAComponentInstanceSymbol component, TaggingResolver symtab) throws IOException {
List<FileContent> fileContents = generateStrings(component);
if (getGenerationTargetPath().charAt(getGenerationTargetPath().length() - 1) != '/') {
......@@ -66,7 +66,7 @@ public class GeneratorRosCpp {
return f;
}
public List<FileContent> generateStrings(ExpandedComponentInstanceSymbol component) {
public List<FileContent> generateStrings(EMAComponentInstanceSymbol component) {
List<FileContent> fileContents = new ArrayList<>();
fileContents.addAll(generateRosAdapter(component));
fileContents.stream()
......@@ -75,7 +75,7 @@ public class GeneratorRosCpp {
return fileContents;
}
private List<FileContent> generateRosAdapter(ExpandedComponentInstanceSymbol component) {
private List<FileContent> generateRosAdapter(EMAComponentInstanceSymbol component) {
List<FileContent> res = new ArrayList<>();
FileContent apdapter = new FileContent();
......
package de.monticore.lang.monticar.generator.roscpp;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.FileContent;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.generator.roscpp.helper.NameHelper;
import de.monticore.lang.monticar.generator.rosmsg.util.FileContent;
import java.util.ArrayList;
import java.util.List;
......@@ -23,7 +23,7 @@ public class LanguageUnitRosCMake {
"\n" +
"export(TARGETS <name> FILE <name>.cmake)";
FileContent generate(ExpandedComponentInstanceSymbol componentInstanceSymbol, List<String> additionalPackages) {
FileContent generate(EMAComponentInstanceSymbol componentInstanceSymbol, List<String> additionalPackages) {
FileContent fileContent = new FileContent();
fileContent.setFileName("CMakeLists.txt");
......
package de.monticore.lang.monticar.generator.roscpp;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.ros.RosConnectionSymbol;
import de.monticore.lang.monticar.generator.*;
import de.monticore.lang.monticar.generator.cpp.BluePrintCPP;
import de.monticore.lang.monticar.generator.roscpp.util.*;
import de.monticore.lang.monticar.generator.roscpp.helper.NameHelper;
import de.monticore.lang.monticar.generator.roscpp.helper.TagHelper;
import de.monticore.lang.monticar.generator.roscpp.instructions.*;
......@@ -29,7 +28,7 @@ public class LanguageUnitRosCppAdapter {
return additionalPackages;
}
public Optional<BluePrintCPP> generateBluePrint(ExpandedComponentInstanceSymbol componentSymbol) {
public Optional<BluePrintCPP> generateBluePrint(EMAComponentInstanceSymbol componentSymbol) {
BluePrintCPP currentBluePrint = null;
......@@ -37,8 +36,8 @@ public class LanguageUnitRosCppAdapter {
String name = NameHelper.getAdapterName(componentSymbol);
currentBluePrint = new BluePrintCPP(name);
List<PortSymbol> rosPorts = componentSymbol.getPortsList().stream()
.filter(PortSymbol::isRosPort)
List<EMAPortSymbol> rosPorts = componentSymbol.getPortInstanceList().stream()
.filter(EMAPortSymbol::isRosPort)
.collect(Collectors.toList());
generateFields(componentSymbol, rosPorts, currentBluePrint);
......@@ -54,7 +53,7 @@ public class LanguageUnitRosCppAdapter {
}
private void generateIncludes(ExpandedComponentInstanceSymbol componentSymbol, List<PortSymbol> rosPorts, BluePrintCPP currentBluePrint) {
private void generateIncludes(EMAComponentInstanceSymbol componentSymbol, List<EMAPortSymbol> rosPorts, BluePrintCPP currentBluePrint) {
currentBluePrint.addAdditionalIncludeString("<ros/ros.h>");
String compName = NameHelper.getComponentNameTargetLanguage(componentSymbol.getFullName());
currentBluePrint.addAdditionalIncludeString("\"" + compName + ".h\"");
......@@ -62,7 +61,7 @@ public class LanguageUnitRosCppAdapter {
//Add each msg include exactly once
rosPorts.stream()
.map(PortSymbol::getMiddlewareSymbol)
.map(EMAPortSymbol::getMiddlewareSymbol)
.map(Optional::get)
.map(mws -> (RosConnectionSymbol) mws)
.map(RosConnectionSymbol::getTopicType)
......@@ -78,7 +77,7 @@ public class LanguageUnitRosCppAdapter {
.forEach(currentBluePrint::addAdditionalIncludeString);
}
private void generatePublishMethods(List<PortSymbol> rosPorts, BluePrint currentBluePrint) {
private void generatePublishMethods(List<EMAPortSymbol> rosPorts, BluePrintCPP currentBluePrint) {
Map<String, Method> topicToMethod = new HashMap<>();
publishers.keySet().forEach(var -> {
......@@ -89,8 +88,8 @@ public class LanguageUnitRosCppAdapter {
});
rosPorts.stream()
.filter(PortSymbol::isOutgoing)
.sorted(Comparator.comparing(PortSymbol::getName))
.filter(EMAPortSymbol::isOutgoing)
.sorted(Comparator.comparing(EMAPortSymbol::getName))
.forEachOrdered(p -> {
RosConnectionSymbol rcs = (RosConnectionSymbol) p.getMiddlewareSymbol().get();
Method method = topicToMethod.get(rcs.getTopicName().get());
......@@ -119,13 +118,13 @@ public class LanguageUnitRosCppAdapter {
.replace("]", "_");
}
private void generateConstructor(String classname, BluePrint currentBluePrint) {
private void generateConstructor(String classname, BluePrintCPP currentBluePrint) {
Method constructorMethod = new Method(classname, "");
constructorMethod.addInstruction(new TargetCodeInstruction(""));
currentBluePrint.addMethod(constructorMethod);
}
public void generateInit(String classname, String componentName, BluePrint currentBluePrint) {
public void generateInit(String classname, String componentName, BluePrintCPP currentBluePrint) {
Method initMethod = new Method("init", "void");
Variable compPointer = new Variable();
......@@ -157,7 +156,7 @@ public class LanguageUnitRosCppAdapter {
currentBluePrint.addMethod(initMethod);
}
private void generateFields(ExpandedComponentInstanceSymbol symbol, List<PortSymbol> rosPorts, BluePrintCPP currBluePrint) {
private void generateFields(EMAComponentInstanceSymbol symbol, List<EMAPortSymbol> rosPorts, BluePrintCPP currBluePrint) {
currBluePrint.addDefineGenerics(symbol);
//component
Variable componentField = new Variable();
......@@ -171,7 +170,7 @@ public class LanguageUnitRosCppAdapter {
//subs
rosPorts.stream()
.filter(PortSymbol::isIncoming)
.filter(EMAPortSymbol::isIncoming)
.map(p -> (RosConnectionSymbol) p.getMiddlewareSymbol().get())
.forEach(rosConnectionSymbol -> {
String name = getTopicNameTargetLanguage(rosConnectionSymbol.getTopicName().get()).toLowerCase() + "Subscriber";
......@@ -187,7 +186,7 @@ public class LanguageUnitRosCppAdapter {
//pubs
rosPorts.stream()
.filter(PortSymbol::isOutgoing)
.filter(EMAPortSymbol::isOutgoing)
.map(p -> (RosConnectionSymbol) p.getMiddlewareSymbol().get())
.forEach(rosConnectionSymbol -> {
String name = getTopicNameTargetLanguage(rosConnectionSymbol.getTopicName().get()).toLowerCase() + "Publisher";
......@@ -204,7 +203,7 @@ public class LanguageUnitRosCppAdapter {
}
private void generateTick(BluePrint currentBluePrint) {
private void generateTick(BluePrintCPP currentBluePrint) {
Method tickMethod = new Method("tick", "void");
publishMethods.stream()
......@@ -223,13 +222,13 @@ public class LanguageUnitRosCppAdapter {
return rosConnectionSymbol.getTopicType().get().replace("/", "::");
}
private void generateCallbacks(List<PortSymbol> rosPorts, BluePrint currentBluePrint) {
private void generateCallbacks(List<EMAPortSymbol> rosPorts, BluePrintCPP currentBluePrint) {
Map<String, Method> uniqueMethods = new HashMap<>();
rosPorts.stream()
.filter(PortSymbol::isIncoming)
.filter(EMAPortSymbol::isIncoming)
.forEachOrdered(portSymbol -> {
RosConnectionSymbol rosCon = (RosConnectionSymbol) portSymbol.getMiddlewareSymbol().get();
if (!uniqueMethods.containsKey(rosCon.getTopicName().get())) {
......
package de.monticore.lang.monticar.generator.roscpp;
import com.google.common.collect.Sets;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortSymbol;
import de.monticore.lang.monticar.generator.roscpp.helper.NameHelper;
import java.util.Set;
......@@ -25,7 +25,7 @@ public class MethodMsgConverter implements MsgConverter {
}
@Override
public String getConversion(PortSymbol portSymbol) {
public String getConversion(EMAPortSymbol portSymbol) {
return isMsgToPort ? methodNameWithClass + "(msg)" : " = " + methodNameWithClass + "(component->" + (NameHelper.getPortNameTargetLanguage(portSymbol) + ")");
}
......
package de.monticore.lang.monticar.generator.roscpp;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortSymbol;
import java.util.Collections;
import java.util.Set;
......@@ -14,7 +14,7 @@ public interface MsgConverter {
return !isMsgToPort();
}
String getConversion(PortSymbol portSymbol);
String getConversion(EMAPortSymbol portSymbol);
default Set<String> getAdditionalIncludes() {
return Collections.emptySet();
......
package de.monticore.lang.monticar.generator.roscpp;
import com.google.common.base.Objects;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortSymbol;
import de.monticore.lang.monticar.generator.Method;
import de.monticore.lang.monticar.generator.Variable;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortSymbol;
import de.monticore.lang.monticar.generator.roscpp.util.Method;
import de.monticore.lang.monticar.generator.roscpp.util.Variable;
import java.util.HashMap;
import java.util.Map;
......@@ -14,7 +14,7 @@ public class ResolvedRosInterface {
private String type;
private String topic;
private String include;
private Map<PortSymbol, String> portToMsgField = new HashMap<>();
private Map<EMAPortSymbol, String> portToMsgField = new HashMap<>();
private Optional<Variable> publisherField = Optional.empty();
private Optional<Variable> subscriberField = Optional.empty();
private Optional<Method> publishMethod = Optional.empty();
......@@ -81,15 +81,15 @@ public class ResolvedRosInterface {
this.include = include;
}
public void addPort(PortSymbol portSymbol, String msgField) {
public void addPort(EMAPortSymbol portSymbol, String msgField) {
portToMsgField.put(portSymbol, msgField);
}
public Set<PortSymbol> getPorts() {
public Set<EMAPortSymbol> getPorts() {
return portToMsgField.keySet();
}
public String getMsgFieldForPort(PortSymbol portSymbol) {
public String getMsgFieldForPort(EMAPortSymbol portSymbol) {
return portToMsgField.get(portSymbol);
}
......
package de.monticore.lang.monticar.generator.roscpp;
import com.google.common.base.Objects;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import java.util.HashSet;
import java.util.Set;
//TODO: rename: not used as a Tag
public class ResolvedRosTag {
private ExpandedComponentInstanceSymbol component;
private EMAComponentInstanceSymbol component;
private Set<ResolvedRosInterface> subscriberInterfaces = new HashSet<>();
private Set<ResolvedRosInterface> publisherInterfaces = new HashSet<>();
public ResolvedRosTag(ExpandedComponentInstanceSymbol component) {
public ResolvedRosTag(EMAComponentInstanceSymbol component) {
this.component = component;
}
public ExpandedComponentInstanceSymbol getComponent() {
public EMAComponentInstanceSymbol getComponent() {
return component;
}
public void setComponent(ExpandedComponentInstanceSymbol component) {
public void setComponent(EMAComponentInstanceSymbol component) {
this.component = component;
}
......
package de.monticore.lang.monticar.generator.roscpp.helper;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortSymbol;
import de.monticore.lang.monticar.generator.rosmsg.RosMsg;
import de.se_rwth.commons.logging.Log;
......@@ -13,7 +13,7 @@ public class NameHelper {
private NameHelper() {
}
public static String getPortNameTargetLanguage(PortSymbol portSymbol) {
public static String getPortNameTargetLanguage(EMAPortSymbol portSymbol) {
//TODO: get from cpp generator for consistency?
if (portSymbol.isPartOfPortArray()) {
return getFixedArrayPortName(portSymbol);
......@@ -22,9 +22,9 @@ public class NameHelper {
}
}
public static String getFixedArrayPortName(PortSymbol portSymbol) {
public static String getFixedArrayPortName(EMAPortSymbol portSymbol) {
if (!portSymbol.isPartOfPortArray())
throw new IllegalArgumentException("PortSymbol " + portSymbol.getName() + " is not part of an array!");
throw new IllegalArgumentException("EMAPortSymbol " + portSymbol.getName() + " is not part of an array!");
return fixName(portSymbol.getName());
}
......@@ -52,7 +52,7 @@ public class NameHelper {
return shortName + "[" + cppIndex + "]" + rest;
}
public static String getAdapterName(ExpandedComponentInstanceSymbol componentInstanceSymbol) {
public static String getAdapterName(EMAComponentInstanceSymbol componentInstanceSymbol) {
return "RosAdapter_" + getComponentNameTargetLanguage(componentInstanceSymbol.getFullName());
}
......
package de.monticore.lang.monticar.generator.roscpp.helper;
import de.monticore.lang.monticar.generator.Instruction;
import de.monticore.lang.monticar.generator.Method;
import de.monticore.lang.monticar.generator.Variable;
import de.monticore.lang.monticar.generator.cpp.BluePrintCPP;
import de.monticore.lang.monticar.generator.roscpp.util.Instruction;
import de.monticore.lang.monticar.generator.roscpp.util.Method;
import de.monticore.lang.monticar.generator.roscpp.util.Variable;
import de.monticore.lang.monticar.generator.roscpp.util.BluePrintCPP;
import java.util.Comparator;
......
......@@ -2,8 +2,8 @@ package de.monticore.lang.monticar.generator.roscpp.helper;
import de.monticar.lang.monticar.generator.python.RosInterface;
import de.monticar.lang.monticar.generator.python.RosTag;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortSymbol;
import de.monticore.lang.monticar.generator.roscpp.ResolvedRosInterface;
import de.monticore.lang.monticar.generator.roscpp.ResolvedRosTag;
import de.monticore.symboltable.Scope;
......@@ -14,7 +14,7 @@ public class ResolveHelper {
}
//TODO: refactor
public static ResolvedRosInterface resolveRosInterface(RosInterface rosInterface, ExpandedComponentInstanceSymbol component, boolean isSubscriber) {
public static ResolvedRosInterface resolveRosInterface(RosInterface rosInterface, EMAComponentInstanceSymbol component, boolean isSubscriber) {
String includeString = rosInterface.type;
if (!includeString.contains("/")) {
throw new IllegalArgumentException("The ROS msg type has to be given in the form package/msgName!");
......@@ -23,7 +23,7 @@ public class ResolveHelper {
ResolvedRosInterface res = new ResolvedRosInterface(topicType, rosInterface.topic, includeString);
rosInterface.ports.keySet().forEach(portName -> {
PortSymbol tmpPort = component.getPort(portName).
EMAPortSymbol tmpPort = component.getPortInstance(portName).
orElseThrow(() -> new RuntimeException("Port " + component.getName() + "." + portName + " not found!"));
res.addPort(tmpPort, rosInterface.ports.get(portName));
......@@ -33,7 +33,7 @@ public class ResolveHelper {
public static ResolvedRosTag resolveRosTag(RosTag rosTag, Scope symtab) {
ExpandedComponentInstanceSymbol componentInstanceSymbol = symtab.<ExpandedComponentInstanceSymbol>resolve(rosTag.component, ExpandedComponentInstanceSymbol.KIND)
EMAComponentInstanceSymbol componentInstanceSymbol = symtab.<EMAComponentInstanceSymbol>resolve(rosTag.component, EMAComponentInstanceSymbol.KIND)
.orElseThrow(() -> new RuntimeException("Component " + rosTag.component + " could not be found!"));
ResolvedRosTag res = new ResolvedRosTag(componentInstanceSymbol);
......
package de.monticore.lang.monticar.generator.roscpp.helper;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.ros.RosConnectionSymbol;
import de.monticore.lang.monticar.generator.roscpp.GeneratorRosCpp;
import de.monticore.lang.tagging._symboltable.TagSymbol;
......@@ -20,9 +20,9 @@ public class TagHelper {
private TagHelper() {
}
public static Map<PortSymbol, RosConnectionSymbol> resolveTags(TaggingResolver taggingResolver, ExpandedComponentInstanceSymbol componentInstanceSymbol) {
Map<PortSymbol, RosConnectionSymbol> rosConnectionSymbols = new HashMap<>();
componentInstanceSymbol.getPortsList().forEach(p -> {
public static Map<EMAPortSymbol, RosConnectionSymbol> resolveTags(TaggingResolver taggingResolver, EMAComponentInstanceSymbol componentInstanceSymbol) {
Map<EMAPortSymbol, RosConnectionSymbol> rosConnectionSymbols = new HashMap<>();
componentInstanceSymbol.getPortInstanceList().forEach(p -> {
Collection<TagSymbol> tmpTags = taggingResolver.getTags(p, RosConnectionSymbol.KIND);
if (tmpTags.size() == 1) {
rosConnectionSymbols.put(p, (RosConnectionSymbol) tmpTags.iterator().next());
......@@ -32,16 +32,16 @@ public class TagHelper {
return rosConnectionSymbols;
}
public static List<File> resolveAndGenerate(GeneratorRosCpp generatorRosCpp, TaggingResolver taggingResolver, ExpandedComponentInstanceSymbol componentInstanceSymbol) throws IOException {
public static List<File> resolveAndGenerate(GeneratorRosCpp generatorRosCpp, TaggingResolver taggingResolver, EMAComponentInstanceSymbol componentInstanceSymbol) throws IOException {
resolveTags(taggingResolver, componentInstanceSymbol);
return generatorRosCpp.generateFiles(componentInstanceSymbol, taggingResolver);
}
public static boolean rosConnectionsValid(ExpandedComponentInstanceSymbol instanceSymbol) {
public static boolean rosConnectionsValid(EMAComponentInstanceSymbol instanceSymbol) {
AtomicBoolean result = new AtomicBoolean(true);
instanceSymbol.getPortsList().stream()
.filter(PortSymbol::isRosPort)
instanceSymbol.getPortInstanceList().stream()
.filter(EMAPortSymbol::isRosPort)
.forEach(p ->{
RosConnectionSymbol rosConnectionSymbol = (RosConnectionSymbol) p.getMiddlewareSymbol().get();
......
......@@ -2,8 +2,8 @@ package de.monticore.lang.monticar.generator.roscpp.helper;
import com.esotericsoftware.yamlbeans.YamlReader;
import de.monticar.lang.monticar.generator.python.RosTag;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.ros.RosConnectionSymbol;
import de.monticore.lang.monticar.generator.roscpp.GeneratorRosCpp;
import de.monticore.lang.monticar.generator.roscpp.ResolvedRosTag;
......@@ -48,7 +48,7 @@ public class YamlHelper {
}
private static void fixPortSyntax(RosTag rosTag, TaggingResolver symtab) {
ExpandedComponentInstanceSymbol component = symtab.<ExpandedComponentInstanceSymbol>resolve(rosTag.component, ExpandedComponentInstanceSymbol.KIND)
EMAComponentInstanceSymbol component = symtab.<EMAComponentInstanceSymbol>resolve(rosTag.component, EMAComponentInstanceSymbol.KIND)
.orElseThrow(() -> new RuntimeException("Component " + rosTag.component + " could not be found!"));
//[:] syntax
......@@ -69,7 +69,7 @@ public class YamlHelper {
});
}
private static Set<Pair<String, String>> fixPortWithColonSyntax(Map<String, String> portNameToMsgField, String portName, ExpandedComponentInstanceSymbol component) {
private static Set<Pair<String, String>> fixPortWithColonSyntax(Map<String, String> portNameToMsgField, String portName, EMAComponentInstanceSymbol component) {
assert (portName.contains("[:]"));
assert (portNameToMsgField.containsKey(portName));
......@@ -80,13 +80,13 @@ public class YamlHelper {
// portNameToMsgField.remove(portName);
int i = 1;
PortSymbol curPort = component.getPort(portName.replace("[:]", "[" + i + "]"))
EMAPortSymbol curPort = component.getPortInstance(portName.replace("[:]", "[" + i + "]"))
.orElseThrow(() -> new RuntimeException("No Ports matching " + portName + " found in component " + component.getName()));
while (curPort != null) {
String curMsgField = msgField.replace("[:]", "[" + i + "]");
res.add(new Pair<>(curPort.getName(), curMsgField));
i++;
curPort = component.getPort(portName.replace("[:]", "[" + i + "]")).orElse(null);
curPort = component.getPortInstance(portName.replace("[:]", "[" + i + "]")).orElse(null);
}
return res;
......
package de.monticore.lang.monticar.generator.roscpp.instructions;
import de.monticore.lang.monticar.generator.TargetCodeInstruction;
import de.monticore.lang.monticar.generator.Variable;
import de.monticore.lang.monticar.generator.roscpp.util.TargetCodeInstruction;
import de.monticore.lang.monticar.generator.roscpp.util.Variable;
import java.util.Objects;
......
package de.monticore.lang.monticar.generator.roscpp.instructions;
import de.monticore.lang.monticar.generator.Method;