Renamed Wrapper -> Adapter for clarity

parent b8c100e9
......@@ -19,22 +19,22 @@ public class DummyMiddlewareGenerator implements GeneratorImpl {
List<File> res = new ArrayList<>();
res.add(FileHelper.generateFile(generationTargetPath, generateCMake(componentInstanceSymbol)));
res.add(FileHelper.generateFile(generationTargetPath, generateWrapper(componentInstanceSymbol)));
res.add(FileHelper.generateFile(generationTargetPath, generateAdapter(componentInstanceSymbol)));
return res;
}
private String dummyWrapperTemplate = "#pragma once\n" +
private String dummyAdapterTemplate = "#pragma once\n" +
"#include \"${compName}.h\"\n" +
"#include <thread>\n" +
"#include <chrono>\n" +
"#include \"IAdapter.h\"\n" +
"\n" +
"class ${compName}_DummyWrapper: public IAdapter{\n" +
"class ${compName}_DummyAdapter: public IAdapter{\n" +
"\t${compName}* component;\n" +
"\n" +
"public:\n" +
"\t${compName}_DummyWrapper(){\n" +
"\t${compName}_DummyAdapter(){\n" +
"\n" +
"\t}\n" +
"\n" +
......@@ -53,13 +53,13 @@ public class DummyMiddlewareGenerator implements GeneratorImpl {
"\t\n" +
"};";
private FileContent generateWrapper(ExpandedComponentInstanceSymbol componentInstanceSymbol) {
private FileContent generateAdapter(ExpandedComponentInstanceSymbol componentInstanceSymbol) {
String name = NameHelper.getComponentNameTargetLanguage(componentInstanceSymbol.getFullName());
String content = dummyWrapperTemplate
String content = dummyAdapterTemplate
.replace("${compName}", name);
FileContent res = new FileContent();
res.setFileName(name + "_DummyWrapper.h");
res.setFileName(name + "_DummyAdapter.h");
res.setFileContent(content);
return res;
}
......@@ -72,13 +72,13 @@ public class DummyMiddlewareGenerator implements GeneratorImpl {
private String cmakeTemplate =
"cmake_minimum_required(VERSION 3.5)\n" +
"project (${compName}_DummyWrapper)\n" +
"project (${compName}_DummyAdapter)\n" +
"\n" +
"add_library(${compName}_DummyWrapper ${compName}_DummyWrapper.h)\n" +
"set_target_properties(${compName}_DummyWrapper PROPERTIES LINKER_LANGUAGE CXX)\n" +
"target_link_libraries(${compName}_DummyWrapper ${compName})\n" +
"target_include_directories(${compName}_DummyWrapper PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})\n" +
"export(TARGETS ${compName}_DummyWrapper FILE ${compName}_DummyWrapper.cmake)";
"add_library(${compName}_DummyAdapter ${compName}_DummyAdapter.h)\n" +
"set_target_properties(${compName}_DummyAdapter PROPERTIES LINKER_LANGUAGE CXX)\n" +
"target_link_libraries(${compName}_DummyAdapter ${compName})\n" +
"target_include_directories(${compName}_DummyAdapter PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})\n" +
"export(TARGETS ${compName}_DummyAdapter FILE ${compName}_DummyAdapter.cmake)";
private FileContent generateCMake(ExpandedComponentInstanceSymbol componentInstanceSymbol) {
FileContent res = new FileContent();
......
......@@ -122,7 +122,7 @@ public class MiddlewareMasterGenerator extends CMakeMasterGenerator {
//TODO: DIRTY HACK!
String addAdapters = filesNames.stream()
.filter(fn -> fn.matches(name + "\\w*Wrapper\\.h"))
.filter(fn -> fn.matches(name + "\\w*Adapter\\.h"))
.map(fn -> fn.substring(0, fn.length() - 2))
.map(fn -> " adapters.push_back(new " + fn + "());")
.collect(Collectors.joining("\n"));
......
......@@ -15,7 +15,6 @@ public class RosCppImpl implements GeneratorImpl {
@Override
public List<File> generate(ExpandedComponentInstanceSymbol componentInstanceSymbol, TaggingResolver taggingResolver) throws IOException {
GeneratorRosCpp generatorRosCpp = new GeneratorRosCpp();
generatorRosCpp.setGenerateCpp(false);
generatorRosCpp.setGenerateCMake(true);
generatorRosCpp.setGenerationTargetPath(generationTargetPath);
return TagHelper.generate(generatorRosCpp, taggingResolver, componentInstanceSymbol);
......
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