blob: 395f2ee6b8693225c85c29cf5596ded0022f5b83 [file] [log] [blame]
/**
* Copyright (c) 2020-2021 Robert Bosch GmbH.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Robert Bosch GmbH - initial API and implementation
*/
package org.eclipse.app4mc.slg.ros2.generators;
import org.eclipse.app4mc.slg.commons.m2t.generators.TranslationUnit;
import org.eclipse.app4mc.transformation.util.OutputBuffer;
public class RosAmlTranslationUnit extends TranslationUnit {
private OutputBuffer outputBuffer;
public RosAmlTranslationUnit(final OutputBuffer outputBuffer) {
super();
this.outputBuffer = outputBuffer;
genFiles();
}
public String getBasePath() {
return "utils";
}
public String getModuleName() {
return "aml";
}
public String getModulePath() {
return getBasePath() + "/" + getModuleName();
}
@Override
public String getIncFile() {
return getModuleName() + ".h";
}
@Override
public String getSrcFile() {
return getModuleName() + ".cpp";
}
public String getIncPath() {
return getModulePath() + "/inc/" + getIncFile();
}
public String getSrcPath() {
return getModulePath() + "/src/" + getSrcFile();
}
public void genFiles() {
incAppend(RosAmlGenerator.toH());
srcAppend(RosAmlGenerator.toCpp());
}
public void incAppend(final String str) {
outputBuffer.appendTo("INC", getModulePath() + "/_inc/" + getModuleName(), str);
}
public void srcAppend(final String str) {
outputBuffer.appendTo("SRC", getModulePath() + "/_src/" + getModuleName(), str);
}
}