Commit f45bbd06 authored by Malte Heithoff's avatar Malte Heithoff
Browse files

Add Dynamic Instructions to Execute Method

parent e0796915
Pipeline #421034 passed with stage
in 11 minutes and 55 seconds
......@@ -161,9 +161,25 @@ public class ComponentConverter {
bluePrint.addMethod(update);
}
addOthersToExecuteMethod(bluePrint);
return bluePrint;
}
private static void addOthersToExecuteMethod(EMAMBluePrintCPP bluePrint) {
Optional<Method> executeOpt = bluePrint.getMethod("execute");
if (executeOpt.isPresent()) {
Method exMethod = executeOpt.get();
if (bluePrint.getMethod("next").isPresent()) {
exMethod.addInstruction(0, new TargetCodeInstruction("next();\n"));
}
if (bluePrint.getMethod("dynamic").isPresent()) {
exMethod.addInstruction(0, new TargetCodeInstruction("dynamic();\n"));
}
}
}
public static void addVariables(EMAComponentInstanceSymbol componentSymbol, EMAMBluePrintCPP bluePrint) {
//add parameters as variables
for (EMAVariable variable : componentSymbol.getParameters()) {
......
......@@ -90,8 +90,6 @@ public class ComponentConverterMethodGeneration {
generateExecuteMethodInner(exMethod, componentSymbol, bluePrint, mathStatementsSymbol, generatorCPP, includeStrings);
// Add other instructions
fixDynamicInstruction(bluePrint, exMethod);
fixNextInstruction(bluePrint, exMethod);
fixExecuteDynamicConnects(exMethod);
// rearrange execute to be last
......@@ -122,18 +120,6 @@ public class ComponentConverterMethodGeneration {
exMethod.setInstructions(instructions);
}
private static void fixDynamicInstruction(EMAMBluePrintCPP bluePrint, Method exMethod) {
if(bluePrint.getMethod("dynamic").isPresent()){
exMethod.addInstruction(0, new TargetCodeInstruction("dynamic();\n"));
}
}
private static void fixNextInstruction(EMAMBluePrintCPP bluePrint, Method exMethod) {
if(bluePrint.getMethod("next").isPresent()){
exMethod.addInstruction(0, new TargetCodeInstruction("next();\n"));
}
}
private static void generateExecuteForRHSComponent(RHSComponentInstanceSymbol componentSymbol, EMAMBluePrintCPP bluePrint, GeneratorCPP generatorCPP, List<String> includeStrings, Method exMethod) {
SemiExplicitForm semiExplicitForm = componentSymbol.getSemiExplicitForm();
addRHSOutputCalls(componentSymbol, exMethod, bluePrint, generatorCPP);
......
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