Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Middleware
Commits
44e99e3e
Commit
44e99e3e
authored
Mar 02, 2018
by
Alexander David Hellwig
Browse files
IAdapter -> IAdapter_${compName} to avoid naming conflicts
parent
45701b56
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/generator/middleware/MiddlewareGenerator.java
View file @
44e99e3e
...
...
@@ -31,8 +31,8 @@ public class MiddlewareGenerator extends CMakeGenerator {
private
FileContent
generateIAdapter
(
ExpandedComponentInstanceSymbol
componentInstanceSymbol
)
{
FileContent
res
=
new
FileContent
();
res
.
setFileName
(
"IAdapter.h"
);
String
name
=
NameHelper
.
getComponentNameTargetLanguage
(
componentInstanceSymbol
.
getFullName
());
res
.
setFileName
(
"IAdapter_"
+
name
+
".h"
);
res
.
setFileContent
(
TemplateHelper
.
iAdapterTemplate
.
replace
(
"${compName}"
,
name
));
return
res
;
}
...
...
src/main/java/de/monticore/lang/monticar/generator/middleware/helpers/TemplateHelper.java
View file @
44e99e3e
...
...
@@ -8,14 +8,14 @@ public class TemplateHelper {
"#include <chrono>\n"
+
"#include <atomic>\n"
+
"#include <list>\n"
+
"#include \"IAdapter.h\"\n"
+
"#include \"IAdapter
_${compName}
.h\"\n"
+
"\n"
+
"${includes}"
+
"\n"
+
"using namespace std;\n"
+
"using namespace chrono;\n"
+
"\n"
+
"void startMiddleware(IAdapter& adapter,${compName}& comp,atomic<bool>& done){\n"
+
"void startMiddleware(IAdapter
_${compName}
& adapter,${compName}& comp,atomic<bool>& done){\n"
+
" adapter.init(&comp);\n"
+
" done = true;\n"
+
"}\n"
+
...
...
@@ -26,7 +26,7 @@ public class TemplateHelper {
" ${compName} comp;\n"
+
" comp.init();\n"
+
"\n"
+
" list<IAdapter*> adapters;\n"
+
" list<IAdapter
_${compName}
*> adapters;\n"
+
"${addAdapters}"
+
"\n"
+
" list<thread*> threads;\n"
+
...
...
@@ -64,9 +64,9 @@ public class TemplateHelper {
public
static
String
iAdapterTemplate
=
"#pragma once\n"
+
"#include \"${compName}.h\"\n"
+
"\n"
+
"class IAdapter{\n"
+
"class IAdapter
_${compName}
{\n"
+
"\tpublic:\n"
+
"\t\tvirtual ~IAdapter(){}\n"
+
"\t\tvirtual ~IAdapter
_${compName}
(){}\n"
+
"\t\tvirtual void init(${compName}* comp) = 0;\n"
+
"\t\tvirtual void tick() = 0;\n"
+
"};"
;
...
...
@@ -98,9 +98,9 @@ public class TemplateHelper {
"#include \"${compName}.h\"\n"
+
"#include <thread>\n"
+
"#include <chrono>\n"
+
"#include \"IAdapter.h\"\n"
+
"#include \"IAdapter
_${compName}
.h\"\n"
+
"\n"
+
"class DummyAdapter_${compName}: public IAdapter{\n"
+
"class DummyAdapter_${compName}: public IAdapter
_${compName}
{\n"
+
"\t${compName}* component;\n"
+
"\n"
+
"public:\n"
+
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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