blob: 9813d5d2224b33cea33f60ad2397cb1db65a3da4 [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.amalthea.model.Label;
import org.eclipse.app4mc.slg.commons.m2t.generators.LabelTranslationUnit;
import org.eclipse.app4mc.transformation.util.OutputBuffer;
public class RosLabelTranslationUnit extends LabelTranslationUnit {
public static final String MODULLIB_NAME = "LABELS_LIB";
public static final String MODULE_NAME = "labels";
public static final String MODULE_PATH = "synthetic_gen/" + MODULE_NAME;
public static final String MAKEFILE_PATH = MODULE_PATH + "/CMakeLists.txt";
public RosLabelTranslationUnit(final OutputBuffer outputBuffer, final Label label) {
super(outputBuffer, label);
}
@Override
public String getModuleName() {
return MODULE_NAME;
}
@Override
public String getIncFile() {
return MODULE_NAME + ".h";
}
@Override
public void genFiles() {
if (isSrcFileEmpty()) {
srcAppend("#include \"" + getIncFile() + "\"\n\n");
srcAppend("#include <stdlib.h>\n");
}
String readCall = readCall("int labelAccessStatistics");
String writeCall = writeCall("int labelAccessStatistics");
incAppend(RosLabelGenerator.toH(getName(), readCall, writeCall));
srcAppend(RosLabelGenerator.toCpp(getName(), "" + getSize(), readCall, writeCall));
}
}