
io.joynr.generator.cpp.proxy.InterfaceProxyCppTemplate Maven / Gradle / Ivy
package io.joynr.generator.cpp.proxy;
import com.google.inject.Inject;
import io.joynr.generator.cpp.util.JoynrCppGeneratorExtensions;
import io.joynr.generator.cpp.util.TemplateBase;
import io.joynr.generator.util.InterfaceTemplate;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
import org.franca.core.franca.FInterface;
@SuppressWarnings("all")
public class InterfaceProxyCppTemplate implements InterfaceTemplate {
@Inject
@Extension
private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
@Inject
@Extension
private TemplateBase _templateBase;
public CharSequence generate(final FInterface fInterface) {
StringConcatenation _builder = new StringConcatenation();
final String interfaceName = this._joynrCppGeneratorExtensions.joynrName(fInterface);
_builder.newLineIfNotEmpty();
final String className = (interfaceName + "Proxy");
_builder.newLineIfNotEmpty();
final String asyncClassName = (interfaceName + "AsyncProxy");
_builder.newLineIfNotEmpty();
final String syncClassName = (interfaceName + "SyncProxy");
_builder.newLineIfNotEmpty();
CharSequence _warning = this._templateBase.warning();
_builder.append(_warning, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("#include \"");
String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(fInterface, "/");
_builder.append(_packagePathWithJoynrPrefix, "");
_builder.append("/");
_builder.append(className, "");
_builder.append(".h\"");
_builder.newLineIfNotEmpty();
_builder.newLine();
String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(fInterface);
_builder.append(_namespaceStarter, "");
_builder.newLineIfNotEmpty();
_builder.append(className, "");
_builder.append("::");
_builder.append(className, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QSharedPointer messagingAddress,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("joynr::ConnectorFactory* connectorFactory,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("joynr::IClientCache *cache,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("const std::string &domain,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("const joynr::MessagingQos &qosSettings,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("bool cached");
_builder.newLine();
_builder.append(") :");
_builder.newLine();
_builder.append("\t\t");
_builder.append("joynr::ProxyBase(connectorFactory, cache, domain, INTERFACE_NAME(), qosSettings, cached),");
_builder.newLine();
_builder.append("\t\t");
_builder.append(className, "\t\t");
_builder.append("Base(messagingAddress, connectorFactory, cache, domain, qosSettings, cached),");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append(syncClassName, "\t\t");
_builder.append("(messagingAddress, connectorFactory, cache, domain, qosSettings, cached),");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append(asyncClassName, "\t\t");
_builder.append("(messagingAddress, connectorFactory, cache, domain, qosSettings, cached)");
_builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append(className, "");
_builder.append("::~");
_builder.append(className, "");
_builder.append("()");
_builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("}");
_builder.newLine();
String _namespaceEnder = this._joynrCppGeneratorExtensions.getNamespaceEnder(fInterface);
_builder.append(_namespaceEnder, "");
_builder.newLineIfNotEmpty();
return _builder;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy