Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Cpp
Commits
cd7d6677
Commit
cd7d6677
authored
Sep 28, 2020
by
Malte Heithoff
Browse files
New EMAGenerator interface
parent
a70a702d
Pipeline
#335835
failed with stage
in 57 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/generator/EMAGenerator.java
0 → 100644
View file @
cd7d6677
/* (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
);
}
src/main/java/de/monticore/lang/monticar/generator/Generator.java
View file @
cd7d6677
...
...
@@ -6,6 +6,7 @@ import de.monticore.lang.math._symboltable.MathStatementsSymbol;
import
de.monticore.lang.monticar.generator.cmake.CMakeConfig
;
import
de.monticore.lang.tagging._symboltable.TaggingResolver
;
import
de.monticore.symboltable.Scope
;
import
de.monticore.symboltable.Symbol
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -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
*
*/
public
interface
Generator
{
public
interface
Generator
<
T
extends
Symbol
>
{
// Cmake
CMakeConfig
getCmakeConfig
();
...
...
@@ -28,28 +29,15 @@ public interface Generator {
void
setGenerationTargetPath
(
String
newPath
);
String
generateString
(
TaggingResolver
taggingResolver
,
EMAComponentInstanceSymbol
componentSymbol
,
MathStatementsSymbol
mathStatementsSymbol
);
/**
* This method should generate the source for the EMAComponentInstanceSymbol and
* add MathStatementsSymbols, accordingly. Does also do this for all of its subcomponents.
*/
List
<
FileContent
>
generateStrings
(
TaggingResolver
taggingResolver
,
EMAComponentInstanceSymbol
componentInstanceS
ymbol
,
Scope
symtab
);
List
<
FileContent
>
generateStrings
(
TaggingResolver
taggingResolver
,
T
s
ymbol
,
Scope
symtab
);
/**
* 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
;
boolean
useAlgebraicOptimizations
();
void
setUseAlgebraicOptimizations
(
boolean
useAlgebraicOptimizations
);
boolean
useThreadingOptimizations
();
void
setUseThreadingOptimization
(
boolean
useThreadingOptimizations
);
MathCommandRegister
getMathCommandRegister
();
List
<
File
>
generateFiles
(
TaggingResolver
taggingResolver
,
T
symbol
,
Scope
symtab
)
throws
IOException
;
void
setMathCommandRegister
(
MathCommandRegister
mathCommandRegister
);
}
src/main/java/de/monticore/lang/monticar/generator/cpp/GeneratorCPP.java
View file @
cd7d6677
...
...
@@ -34,7 +34,7 @@ import java.util.*;
/**
*/
public
class
GeneratorCPP
implements
Generator
{
public
class
GeneratorCPP
implements
EMA
Generator
{
public
static
GeneratorCPP
currentInstance
;
private
Path
modelsDirPath
;
private
boolean
isGenerateTests
=
false
;
...
...
@@ -149,7 +149,6 @@ public class GeneratorCPP implements Generator {
this
.
generationTargetPath
=
newPath
;
}
@Override
public
String
generateString
(
TaggingResolver
taggingResolver
,
EMAComponentInstanceSymbol
componentSymbol
,
MathStatementsSymbol
mathStatementsSymbol
)
{
StreamTestGenerator
streamTestGenerator
=
new
StreamTestGenerator
();
//only used when creating streamTestsForAComponent
LanguageUnitCPP
languageUnitCPP
=
new
LanguageUnitCPP
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment