io.joynr.generator.cpp.provider.InterfaceProviderCppTemplate Maven / Gradle / Ivy
package io.joynr.generator.cpp.provider;
import com.google.inject.Inject;
import io.joynr.generator.cpp.util.JoynrCppGeneratorExtensions;
import io.joynr.generator.cpp.util.QtTypeUtil;
import io.joynr.generator.cpp.util.TemplateBase;
import io.joynr.generator.util.InterfaceTemplate;
import java.util.Set;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.franca.core.franca.FInterface;
import org.franca.core.franca.FType;
@SuppressWarnings("all")
public class InterfaceProviderCppTemplate implements InterfaceTemplate {
@Inject
@Extension
private TemplateBase _templateBase;
@Inject
@Extension
private QtTypeUtil _qtTypeUtil;
@Inject
@Extension
private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
public CharSequence generate(final FInterface serviceInterface) {
StringConcatenation _builder = new StringConcatenation();
CharSequence _warning = this._templateBase.warning();
_builder.append(_warning, "");
_builder.newLineIfNotEmpty();
final String interfaceName = this._joynrCppGeneratorExtensions.joynrName(serviceInterface);
_builder.newLineIfNotEmpty();
_builder.append("#include \"");
String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, "/");
_builder.append(_packagePathWithJoynrPrefix, "");
_builder.append("/");
_builder.append(interfaceName, "");
_builder.append("Provider.h\"");
_builder.newLineIfNotEmpty();
_builder.append("#include \"joynr/InterfaceRegistrar.h\"");
_builder.newLine();
_builder.append("#include \"joynr/MetaTypeRegistrar.h\"");
_builder.newLine();
_builder.newLine();
_builder.append("#include \"");
String _packagePathWithJoynrPrefix_1 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, "/");
_builder.append(_packagePathWithJoynrPrefix_1, "");
_builder.append("/");
_builder.append(interfaceName, "");
_builder.append("RequestInterpreter.h\"");
_builder.newLineIfNotEmpty();
_builder.append("#include \"joynr/RequestStatus.h\"");
_builder.newLine();
_builder.append("#include \"joynr/TypeUtil.h\"");
_builder.newLine();
{
Set _requiredIncludesFor = this._qtTypeUtil.getRequiredIncludesFor(serviceInterface);
for(final String parameterType : _requiredIncludesFor) {
_builder.append("#include ");
_builder.append(parameterType, "");
_builder.newLineIfNotEmpty();
}
}
_builder.newLine();
String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(serviceInterface);
_builder.append(_namespaceStarter, "");
_builder.newLineIfNotEmpty();
_builder.append(interfaceName, "");
_builder.append("Provider::");
_builder.append(interfaceName, "");
_builder.append("Provider()");
_builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("// Register a request interpreter to interpret requests to this interface");
_builder.newLine();
_builder.append("\t");
_builder.append("joynr::InterfaceRegistrar::instance().registerRequestInterpreter<");
_builder.append(interfaceName, "\t");
_builder.append("RequestInterpreter>(INTERFACE_NAME());");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
final Iterable
© 2015 - 2025 Weber Informatics LLC | Privacy Policy