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.JoynrCppGeneratorExtensions;
import io.joynr.generator.cpp.util.TemplateBase;
import org.eclipse.emf.common.util.EList;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.StringExtensions;
import org.franca.core.franca.FAttribute;
import org.franca.core.franca.FInterface;

@SuppressWarnings("all")
public class InterfaceProxyBaseHTemplate {
  @Inject
  @Extension
  private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
  
  @Inject
  @Extension
  private TemplateBase _templateBase;
  
  public CharSequence generate(final FInterface serviceInterface) {
    CharSequence _xblockexpression = null;
    {
      final String interfaceName = this._joynrCppGeneratorExtensions.joynrName(serviceInterface);
      final String className = (interfaceName + "ProxyBase");
      String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, "_");
      String _plus = ("GENERATED_INTERFACE_" + _packagePathWithJoynrPrefix);
      String _plus_1 = (_plus + "_");
      String _plus_2 = (_plus_1 + interfaceName);
      String _plus_3 = (_plus_2 + "ProxyBase_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();
      _builder.append("#include \"joynr/PrivateCopyAssign.h\"");
      _builder.newLine();
      String _dllExportIncludeStatement = this._joynrCppGeneratorExtensions.getDllExportIncludeStatement();
      _builder.append(_dllExportIncludeStatement, "");
      _builder.newLineIfNotEmpty();
      _builder.append("#include \"joynr/ProxyBase.h\"");
      _builder.newLine();
      _builder.append("#include \"");
      String _packagePathWithJoynrPrefix_1 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, "/");
      _builder.append(_packagePathWithJoynrPrefix_1, "");
      _builder.append("/I");
      _builder.append(interfaceName, "");
      _builder.append("Connector.h\"");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(serviceInterface);
      _builder.append(_namespaceStarter, "");
      _builder.append(" ");
      _builder.newLineIfNotEmpty();
      _builder.append("class ");
      String _dllExportMacro = this._joynrCppGeneratorExtensions.getDllExportMacro();
      _builder.append(_dllExportMacro, "");
      _builder.append(" ");
      _builder.append(className, "");
      _builder.append(": virtual public joynr::ProxyBase, virtual public ");
      String _packagePathWithJoynrPrefix_2 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, "::");
      _builder.append(_packagePathWithJoynrPrefix_2, "");
      _builder.append("::I");
      _builder.append(interfaceName, "");
      _builder.append("Subscription {");
      _builder.newLineIfNotEmpty();
      _builder.append("public:");
      _builder.newLine();
      _builder.append("    ");
      _builder.append(className, "    ");
      _builder.append("(");
      _builder.newLineIfNotEmpty();
      _builder.append("            ");
      _builder.append("QSharedPointer messagingAddress,");
      _builder.newLine();
      _builder.append("            ");
      _builder.append("joynr::ConnectorFactory* connectorFactory,");
      _builder.newLine();
      _builder.append("            ");
      _builder.append("joynr::IClientCache* cache,");
      _builder.newLine();
      _builder.append("            ");
      _builder.append("const QString& domain,");
      _builder.newLine();
      _builder.append("            ");
      _builder.append("const joynr::ProxyQos& proxyQos,");
      _builder.newLine();
      _builder.append("            ");
      _builder.append("const joynr::MessagingQos& qosSettings,");
      _builder.newLine();
      _builder.append("            ");
      _builder.append("bool cached");
      _builder.newLine();
      _builder.append("    ");
      _builder.append(");");
      _builder.newLine();
      _builder.newLine();
      _builder.append("    ");
      _builder.append("~");
      _builder.append(className, "    ");
      _builder.append("();");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("    ");
      _builder.append("void handleArbitrationFinished(");
      _builder.newLine();
      _builder.append("            ");
      _builder.append("const QString &participantId,");
      _builder.newLine();
      _builder.append("            ");
      _builder.append("const joynr::system::CommunicationMiddleware::Enum& connection");
      _builder.newLine();
      _builder.append("    ");
      _builder.append(");");
      _builder.newLine();
      {
        EList _attributes = this._joynrCppGeneratorExtensions.getAttributes(serviceInterface);
        for(final FAttribute attribute : _attributes) {
          _builder.append("\t");
          final String returnType = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
          _builder.newLineIfNotEmpty();
          _builder.append("\t");
          String attributeName = this._joynrCppGeneratorExtensions.joynrName(attribute);
          _builder.newLineIfNotEmpty();
          _builder.append("\t");
          _builder.append("QString subscribeTo");
          String _firstUpper = StringExtensions.toFirstUpper(attributeName);
          _builder.append(_firstUpper, "	");
          _builder.append("(QSharedPointer > subscriptionListener, QSharedPointer subscriptionQos);");
          _builder.newLineIfNotEmpty();
          _builder.append("\t");
          _builder.append("void unsubscribeFrom");
          String _firstUpper_1 = StringExtensions.toFirstUpper(attributeName);
          _builder.append(_firstUpper_1, "	");
          _builder.append("(QString& subscriptionId);");
          _builder.newLineIfNotEmpty();
        }
      }
      _builder.newLine();
      _builder.append("protected:");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("QSharedPointer messagingAddress; ");
      _builder.newLine();
      _builder.append("    ");
      _builder.append("I");
      _builder.append(interfaceName, "    ");
      _builder.append("Connector* connector;");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("private:");
      _builder.newLine();
      _builder.append("    ");
      _builder.append("DISALLOW_COPY_AND_ASSIGN(");
      _builder.append(className, "    ");
      _builder.append(");");
      _builder.newLineIfNotEmpty();
      _builder.append("};");
      _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