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

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

There is a newer version: 0.9.3
Show newest version
package io.joynr.generator.cpp.proxy;

import com.google.inject.Inject;
import io.joynr.generator.cpp.util.InterfaceSubscriptionUtil;
import io.joynr.generator.cpp.util.JoynrCppGeneratorExtensions;
import io.joynr.generator.cpp.util.TemplateBase;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
import org.franca.core.franca.FInterface;

@SuppressWarnings("all")
public class IInterfaceConnectorHTemplate {
  @Inject
  @Extension
  private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
  
  @Inject
  @Extension
  private TemplateBase _templateBase;
  
  @Inject
  @Extension
  private InterfaceSubscriptionUtil _interfaceSubscriptionUtil;
  
  public CharSequence generate(final FInterface serviceInterface) {
    CharSequence _xblockexpression = null;
    {
      final String interfaceName = this._joynrCppGeneratorExtensions.joynrName(serviceInterface);
      String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, "_");
      String _plus = ("GENERATED_INTERFACE_" + _packagePathWithJoynrPrefix);
      String _plus_1 = (_plus + "_I");
      String _plus_2 = (_plus_1 + interfaceName);
      String _plus_3 = (_plus_2 + "Connector_h");
      final String headerGuard = _plus_3.toUpperCase();
      StringConcatenation _builder = new StringConcatenation();
      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();
      String _dllExportIncludeStatement = this._joynrCppGeneratorExtensions.getDllExportIncludeStatement();
      _builder.append(_dllExportIncludeStatement, "");
      _builder.newLineIfNotEmpty();
      _builder.append("#include \"");
      String _packagePathWithJoynrPrefix_1 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, "/");
      _builder.append(_packagePathWithJoynrPrefix_1, "");
      _builder.append("/I");
      _builder.append(interfaceName, "");
      _builder.append(".h\"");
      _builder.newLineIfNotEmpty();
      _builder.append("#include \"joynr/ISubscriptionListener.h\"");
      _builder.newLine();
      _builder.append("#include \"joynr/IConnector.h\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("namespace joynr {");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("template  class ISubscriptionListener;");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("class ISubscriptionCallback;");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("class SubscriptionQos;");
      _builder.newLine();
      _builder.append("}");
      _builder.newLine();
      _builder.newLine();
      String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(serviceInterface);
      _builder.append(_namespaceStarter, "");
      _builder.newLineIfNotEmpty();
      _builder.append("class ");
      String _dllExportMacro = this._joynrCppGeneratorExtensions.getDllExportMacro();
      _builder.append(_dllExportMacro, "");
      _builder.append(" I");
      _builder.append(interfaceName, "");
      _builder.append("Subscription{");
      _builder.newLineIfNotEmpty();
      _builder.append("    ");
      _builder.append("/**");
      _builder.newLine();
      _builder.append("      ");
      _builder.append("* in  - subscriptionListener      QSharedPointer to a SubscriptionListener which will receive the updates.");
      _builder.newLine();
      _builder.append("      ");
      _builder.append("* in  - subscriptionQos           SubscriptionQos parameters like interval and end date.");
      _builder.newLine();
      _builder.append("      ");
      _builder.append("* out - assignedSubscriptionId    Buffer for the assigned subscriptionId.");
      _builder.newLine();
      _builder.append("      ");
      _builder.append("*/");
      _builder.newLine();
      _builder.append("public:");
      _builder.newLine();
      _builder.append("    ");
      _builder.append("virtual ~I");
      _builder.append(interfaceName, "    ");
      _builder.append("Subscription() {}");
      _builder.newLineIfNotEmpty();
      _builder.append("    ");
      _builder.newLine();
      _builder.append("    ");
      CharSequence _produceSubscribeUnsubscribeMethods = this._interfaceSubscriptionUtil.produceSubscribeUnsubscribeMethods(serviceInterface, true);
      _builder.append(_produceSubscribeUnsubscribeMethods, "    ");
      _builder.newLineIfNotEmpty();
      _builder.append("};");
      _builder.newLine();
      _builder.newLine();
      _builder.append("class ");
      String _dllExportMacro_1 = this._joynrCppGeneratorExtensions.getDllExportMacro();
      _builder.append(_dllExportMacro_1, "");
      _builder.append(" I");
      _builder.append(interfaceName, "");
      _builder.append("Connector: virtual public I");
      _builder.append(interfaceName, "");
      _builder.append(", public joynr::IConnector, virtual public I");
      _builder.append(interfaceName, "");
      _builder.append("Subscription{");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("public:");
      _builder.newLine();
      _builder.append("    ");
      _builder.append("virtual ~I");
      _builder.append(interfaceName, "    ");
      _builder.append("Connector() {}");
      _builder.newLineIfNotEmpty();
      _builder.append("};");
      _builder.newLine();
      _builder.newLine();
      String _namespaceEnder = this._joynrCppGeneratorExtensions.getNamespaceEnder(serviceInterface);
      _builder.append(_namespaceEnder, "");
      _builder.newLineIfNotEmpty();
      _builder.append("#endif // ");
      _builder.append(headerGuard, "");
      _builder.newLineIfNotEmpty();
      _xblockexpression = (_builder);
    }
    return _xblockexpression;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy