IAdapter -> IAdapter_${compName} to avoid naming conflicts

parent 45701b56
......@@ -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;
}
......
......@@ -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" +
......
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