Commit 998c4a13 authored by Markus Georg Bendel's avatar Markus Georg Bendel

Update AddPorts in AdapterModel

parent a648c72f
Pipeline #159895 passed with stages
in 3 minutes and 28 seconds
......@@ -23,6 +23,8 @@ public class GeneratorSomeIP {
// Create and fill model
SomeIPAdapterModel model = new SomeIPAdapterModel(component.getFullName());
model.addPorts(component.getPortInstanceList());
//Generate files and write to project
contents.add(SomeIPTemplates.generateSomeIPAdapterH(model));
files.add(new File("./target/generated-sources/SomeIPAdapter_"+model.getEscapedCompName()+".h"));
......
......@@ -6,6 +6,7 @@ import de.monticore.lang.embeddedmontiarc.tagging.middleware.someip.SomeIPConnec
import de.monticore.lang.embeddedmontiarc.tagging.middleware.someip.SomeIPConnectionSymbol.SomeIPConnectionKind;
import java.util.*;
import java.util.stream.Collectors;
// Used to fill .ftl files
......@@ -13,6 +14,8 @@ public class SomeIPAdapterModel {
private String compName;
private List<String> ports = new ArrayList<>();
private List<EMAPortInstanceSymbol> incoming = new ArrayList<>();
private List<EMAPortInstanceSymbol> outgoing = new ArrayList<>();
public SomeIPAdapterModel(String compName) {
this.compName = compName;
......@@ -29,6 +32,21 @@ public class SomeIPAdapterModel {
.replace(']', '_');
}
public List<EMAPortInstanceSymbol> getIncomingPorts() {
return incoming;
}
public List<EMAPortInstanceSymbol> getOutgoingPorts() {
return outgoing;
}
public void addPorts(Collection<EMAPortInstanceSymbol> ports) {
incoming.addAll(ports);
incoming = incoming.stream().filter(fc -> fc.isSomeIPPort()).filter(fc -> fc.isIncoming()).collect(Collectors.toList());
outgoing.addAll(ports);
outgoing = outgoing.stream().filter(fc -> fc.isSomeIPPort()).filter(fc -> fc.isOutgoing()).collect(Collectors.toList());
}
// Parse through component to find information about its ports
public void addPortsDesc(Collection<EMAPortInstanceSymbol> ports)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment