io.joynr.generator.cpp.communicationmodel.InterfaceCppTemplate Maven / Gradle / Ivy
package io.joynr.generator.cpp.communicationmodel;
import com.google.inject.Inject;
import io.joynr.generator.cpp.util.JoynrCppGeneratorExtensions;
import io.joynr.generator.cpp.util.TemplateBase;
import java.util.HashSet;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
import org.franca.core.franca.FInterface;
import org.franca.core.franca.FType;
@SuppressWarnings("all")
public class InterfaceCppTemplate {
@Inject
@Extension
private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
@Inject
@Extension
private TemplateBase _templateBase;
public CharSequence generate(final FInterface serviceInterface) {
CharSequence _xblockexpression = null;
{
final String interfaceName = this._joynrCppGeneratorExtensions.joynrName(serviceInterface);
StringConcatenation _builder = new StringConcatenation();
_builder.append("\t");
CharSequence _warning = this._templateBase.warning();
_builder.append(_warning, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("#include \"");
String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, "/");
_builder.append(_packagePathWithJoynrPrefix, " ");
_builder.append("/I");
_builder.append(interfaceName, " ");
_builder.append(".h\"");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("#include \"qjson/serializer.h\"");
_builder.newLine();
_builder.append("\t");
_builder.append("#include \"joynr/MetaTypeRegistrar.h\"");
_builder.newLine();
_builder.newLine();
{
Iterable _requiredIncludesFor = this._joynrCppGeneratorExtensions.getRequiredIncludesFor(serviceInterface);
for(final String parameterType : _requiredIncludesFor) {
_builder.append("\t");
_builder.append("#include \"");
_builder.append(parameterType, " ");
_builder.append("\"");
_builder.newLineIfNotEmpty();
}
}
_builder.newLine();
_builder.append("\t");
_builder.append("#include \"joynr/Future.h\"");
_builder.newLine();
_builder.append("\t");
_builder.append("#include \"joynr/ICallback.h\"");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(serviceInterface);
_builder.append(_namespaceStarter, " ");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append("I");
_builder.append(interfaceName, " ");
_builder.append("Base::I");
_builder.append(interfaceName, " ");
_builder.append("Base()");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("{");
_builder.newLine();
_builder.append("\t\t");
final HashSet
© 2015 - 2025 Weber Informatics LLC | Privacy Policy