All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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.templates.InterfaceTemplate;
import io.joynr.generator.templates.util.InterfaceUtil;
import io.joynr.generator.templates.util.NamingUtil;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;

@SuppressWarnings("all")
public class InterfaceProxyCppTemplate extends InterfaceTemplate {
  @Inject
  @Extension
  private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;

  @Inject
  @Extension
  private TemplateBase _templateBase;

  @Inject
  @Extension
  private NamingUtil _namingUtil;

  @Inject
  @Extension
  private InterfaceUtil _interfaceUtil;

  @Override
  public CharSequence generate(final boolean generateVersion) {
    StringConcatenation _builder = new StringConcatenation();
    final String interfaceName = this._namingUtil.joynrName(this.francaIntf);
    _builder.newLineIfNotEmpty();
    final String className = (interfaceName + "Proxy");
    _builder.newLineIfNotEmpty();
    final String asyncClassName = (interfaceName + "AsyncProxy");
    _builder.newLineIfNotEmpty();
    final String syncClassName = (interfaceName + "SyncProxy");
    _builder.newLineIfNotEmpty();
    final String fireAndForgetClassName = (interfaceName + "FireAndForgetProxy");
    _builder.newLineIfNotEmpty();
    CharSequence _warning = this._templateBase.warning();
    _builder.append(_warning);
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("#include \"");
    String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, "/", generateVersion);
    _builder.append(_packagePathWithJoynrPrefix);
    _builder.append("/");
    _builder.append(className);
    _builder.append(".h\"");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(this.francaIntf, generateVersion);
    _builder.append(_namespaceStarter);
    _builder.newLineIfNotEmpty();
    _builder.append(className);
    _builder.append("::");
    _builder.append(className);
    _builder.append("(");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("std::weak_ptr runtime,");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("std::shared_ptr connectorFactory,");
    _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(") :");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("joynr::ProxyBase(runtime, connectorFactory, domain, qosSettings),");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append(className, "\t\t");
    _builder.append("Base(runtime, connectorFactory, domain, qosSettings),");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    {
      boolean _hasFireAndForgetMethods = this._interfaceUtil.hasFireAndForgetMethods(this.francaIntf);
      if (_hasFireAndForgetMethods) {
        _builder.append(fireAndForgetClassName, "\t\t");
        _builder.append("(runtime, connectorFactory, domain, qosSettings),");
      }
    }
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append(syncClassName, "\t\t");
    _builder.append("(runtime, connectorFactory, domain, qosSettings),");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append(asyncClassName, "\t\t");
    _builder.append("(runtime, connectorFactory, domain, qosSettings)");
    _builder.newLineIfNotEmpty();
    _builder.append("{");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    String _namespaceEnder = this._joynrCppGeneratorExtensions.getNamespaceEnder(this.francaIntf, generateVersion);
    _builder.append(_namespaceEnder);
    _builder.newLineIfNotEmpty();
    return _builder;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy