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

New EMAGenerator interface

parent a70a702d
Pipeline #335835 failed with stage
in 57 seconds
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.generator;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.math._symboltable.MathStatementsSymbol;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
public interface EMAGenerator extends Generator<EMAComponentInstanceSymbol> {
boolean useAlgebraicOptimizations();
void setUseAlgebraicOptimizations(boolean useAlgebraicOptimizations);
boolean useThreadingOptimizations();
void setUseThreadingOptimization(boolean useThreadingOptimizations);
MathCommandRegister getMathCommandRegister();
void setMathCommandRegister(MathCommandRegister mathCommandRegister);
}
...@@ -6,6 +6,7 @@ import de.monticore.lang.math._symboltable.MathStatementsSymbol; ...@@ -6,6 +6,7 @@ import de.monticore.lang.math._symboltable.MathStatementsSymbol;
import de.monticore.lang.monticar.generator.cmake.CMakeConfig; import de.monticore.lang.monticar.generator.cmake.CMakeConfig;
import de.monticore.lang.tagging._symboltable.TaggingResolver; import de.monticore.lang.tagging._symboltable.TaggingResolver;
import de.monticore.symboltable.Scope; import de.monticore.symboltable.Scope;
import de.monticore.symboltable.Symbol;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
...@@ -15,7 +16,7 @@ import java.util.List; ...@@ -15,7 +16,7 @@ import java.util.List;
* The Generator interface which defines what functionality has to be supported by a Generator independent from the target language * The Generator interface which defines what functionality has to be supported by a Generator independent from the target language
* *
*/ */
public interface Generator { public interface Generator<T extends Symbol> {
// Cmake // Cmake
CMakeConfig getCmakeConfig(); CMakeConfig getCmakeConfig();
...@@ -28,28 +29,15 @@ public interface Generator { ...@@ -28,28 +29,15 @@ public interface Generator {
void setGenerationTargetPath(String newPath); void setGenerationTargetPath(String newPath);
String generateString(TaggingResolver taggingResolver, EMAComponentInstanceSymbol componentSymbol, MathStatementsSymbol mathStatementsSymbol);
/** /**
* This method should generate the source for the EMAComponentInstanceSymbol and * This method should generate the source for the EMAComponentInstanceSymbol and
* add MathStatementsSymbols, accordingly. Does also do this for all of its subcomponents. * add MathStatementsSymbols, accordingly. Does also do this for all of its subcomponents.
*/ */
List<FileContent> generateStrings(TaggingResolver taggingResolver, EMAComponentInstanceSymbol componentInstanceSymbol, Scope symtab); List<FileContent> generateStrings(TaggingResolver taggingResolver, T symbol, Scope symtab);
/** /**
* This methods writes the resulting code for the ExpandedComponentInstance and its subcomponents to the corresponding files * This methods writes the resulting code for the ExpandedComponentInstance and its subcomponents to the corresponding files
*/ */
List<File> generateFiles(TaggingResolver taggingResolver, EMAComponentInstanceSymbol componentSymbol, Scope symtab) throws IOException; List<File> generateFiles(TaggingResolver taggingResolver, T symbol, Scope symtab) throws IOException;
boolean useAlgebraicOptimizations();
void setUseAlgebraicOptimizations(boolean useAlgebraicOptimizations);
boolean useThreadingOptimizations();
void setUseThreadingOptimization(boolean useThreadingOptimizations);
MathCommandRegister getMathCommandRegister();
void setMathCommandRegister(MathCommandRegister mathCommandRegister);
} }
...@@ -34,7 +34,7 @@ import java.util.*; ...@@ -34,7 +34,7 @@ import java.util.*;
/** /**
*/ */
public class GeneratorCPP implements Generator { public class GeneratorCPP implements EMAGenerator {
public static GeneratorCPP currentInstance; public static GeneratorCPP currentInstance;
private Path modelsDirPath; private Path modelsDirPath;
private boolean isGenerateTests = false; private boolean isGenerateTests = false;
...@@ -149,7 +149,6 @@ public class GeneratorCPP implements Generator { ...@@ -149,7 +149,6 @@ public class GeneratorCPP implements Generator {
this.generationTargetPath = newPath; this.generationTargetPath = newPath;
} }
@Override
public String generateString(TaggingResolver taggingResolver, EMAComponentInstanceSymbol componentSymbol, MathStatementsSymbol mathStatementsSymbol) { public String generateString(TaggingResolver taggingResolver, EMAComponentInstanceSymbol componentSymbol, MathStatementsSymbol mathStatementsSymbol) {
StreamTestGenerator streamTestGenerator = new StreamTestGenerator();//only used when creating streamTestsForAComponent StreamTestGenerator streamTestGenerator = new StreamTestGenerator();//only used when creating streamTestsForAComponent
LanguageUnitCPP languageUnitCPP = new LanguageUnitCPP(); LanguageUnitCPP languageUnitCPP = new LanguageUnitCPP();
......
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