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

io.joynr.generator.cpp.proxy.InterfaceProxyBaseHTemplate Maven / Gradle / Ivy

package io.joynr.generator.cpp.proxy;

import com.google.inject.Inject;
import io.joynr.generator.cpp.util.CppStdTypeUtil;
import io.joynr.generator.cpp.util.InterfaceSubscriptionUtil;
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.NamingUtil;
import java.util.Set;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;

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

  @Inject
  @Extension
  private TemplateBase _templateBase;

  @Inject
  @Extension
  private CppStdTypeUtil _cppStdTypeUtil;

  @Inject
  @Extension
  private InterfaceSubscriptionUtil _interfaceSubscriptionUtil;

  @Inject
  @Extension
  private NamingUtil _namingUtil;

  @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 + "ProxyBase");
    _builder.newLineIfNotEmpty();
    String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, "_", generateVersion);
    String _plus = ("GENERATED_INTERFACE_" + _packagePathWithJoynrPrefix);
    String _plus_1 = (_plus + 
      "_");
    String _plus_2 = (_plus_1 + interfaceName);
    final String headerGuard = (_plus_2 + "ProxyBase_h").toUpperCase();
    _builder.newLineIfNotEmpty();
    CharSequence _warning = this._templateBase.warning();
    _builder.append(_warning);
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("#ifndef ");
    _builder.append(headerGuard);
    _builder.newLineIfNotEmpty();
    _builder.append("#define ");
    _builder.append(headerGuard);
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("#include \"joynr/PrivateCopyAssign.h\"");
    _builder.newLine();
    {
      Set _addElements = this._cppStdTypeUtil.addElements(this._cppStdTypeUtil.getDataTypeIncludesFor(this.francaIntf, generateVersion), this._cppStdTypeUtil.getIncludeForString());
      for(final String parameterType : _addElements) {
        _builder.append("#include ");
        _builder.append(parameterType);
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("#include ");
    _builder.newLine();
    _builder.newLine();
    _builder.append("#include \"joynr/ProxyBase.h\"");
    _builder.newLine();
    _builder.append("#include \"");
    String _packagePathWithJoynrPrefix_1 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, "/", generateVersion);
    _builder.append(_packagePathWithJoynrPrefix_1);
    _builder.append("/I");
    _builder.append(interfaceName);
    _builder.append("Connector.h\"");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("namespace joynr");
    _builder.newLine();
    _builder.append("{");
    _builder.newLine();
    _builder.append("namespace types");
    _builder.newLine();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("class DiscoveryEntryWithMetaInfo;");
    _builder.newLine();
    _builder.append("} // namespace types");
    _builder.newLine();
    _builder.append("} // namespace joynr");
    _builder.newLine();
    _builder.newLine();
    String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(this.francaIntf, generateVersion);
    _builder.append(_namespaceStarter);
    _builder.newLineIfNotEmpty();
    _builder.append("/**");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* @brief Proxy base class for interface ");
    _builder.append(interfaceName, " ");
    _builder.newLineIfNotEmpty();
    _builder.append(" ");
    _builder.append("*");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* @version ");
    _builder.append(this.majorVersion, " ");
    _builder.append(".");
    _builder.append(this.minorVersion, " ");
    _builder.newLineIfNotEmpty();
    _builder.append(" ");
    _builder.append("*/");
    _builder.newLine();
    _builder.append("class ");
    _builder.append(className);
    _builder.append(": virtual public joynr::ProxyBase, virtual public ");
    String _packagePathWithJoynrPrefix_2 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, "::", generateVersion);
    _builder.append(_packagePathWithJoynrPrefix_2);
    _builder.append("::I");
    _builder.append(interfaceName);
    _builder.append("Subscription {");
    _builder.newLineIfNotEmpty();
    _builder.append("public:");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("/**");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @brief Parameterized constructor");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @param connectorFactory The connector factory");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @param domain The provider domain");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @param qosSettings The quality of service settings");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("*/");
    _builder.newLine();
    _builder.append("\t");
    _builder.append(className, "\t");
    _builder.append("(");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t");
    _builder.append("std::weak_ptr runtime,");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("std::shared_ptr connectorFactory,");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("const std::string& domain,");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("const joynr::MessagingQos& qosSettings");
    _builder.newLine();
    _builder.append("\t");
    _builder.append(");");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("/**");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @brief Called when arbitration is finished");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @param participantId The id of the participant");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @param connection The kind of connection");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("*/");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("void handleArbitrationFinished(");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("const joynr::types::DiscoveryEntryWithMetaInfo& providerDiscoveryEntry");
    _builder.newLine();
    _builder.append("\t");
    _builder.append(") override;");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    CharSequence _produceSubscribeUnsubscribeMethodDeclarations = this._interfaceSubscriptionUtil.produceSubscribeUnsubscribeMethodDeclarations(this.francaIntf, false, generateVersion);
    _builder.append(_produceSubscribeUnsubscribeMethodDeclarations, "\t");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("protected:");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("/** @brief The kind of connector */");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("std::shared_ptr connector;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("private:");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("DISALLOW_COPY_AND_ASSIGN(");
    _builder.append(className, "\t");
    _builder.append(");");
    _builder.newLineIfNotEmpty();
    _builder.append("};");
    _builder.newLine();
    String _namespaceEnder = this._joynrCppGeneratorExtensions.getNamespaceEnder(this.francaIntf, generateVersion);
    _builder.append(_namespaceEnder);
    _builder.newLineIfNotEmpty();
    _builder.append("#endif // ");
    _builder.append(headerGuard);
    _builder.newLineIfNotEmpty();
    return _builder;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy