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

io.joynr.generator.cpp.proxy.InterfaceAsyncProxyHTemplate 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.CppStdTypeUtil;
import io.joynr.generator.cpp.util.InterfaceUtil;
import io.joynr.generator.cpp.util.JoynrCppGeneratorExtensions;
import io.joynr.generator.cpp.util.TemplateBase;
import io.joynr.generator.util.InterfaceTemplate;
import java.util.Set;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
import org.franca.core.franca.FInterface;

@SuppressWarnings("all")
public class InterfaceAsyncProxyHTemplate implements InterfaceTemplate {
  @Inject
  @Extension
  private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
  
  @Inject
  @Extension
  private TemplateBase _templateBase;
  
  @Inject
  @Extension
  private CppStdTypeUtil _cppStdTypeUtil;
  
  @Inject
  @Extension
  private InterfaceUtil _interfaceUtil;
  
  public CharSequence generate(final FInterface serviceInterface) {
    StringConcatenation _builder = new StringConcatenation();
    final String interfaceName = this._joynrCppGeneratorExtensions.joynrName(serviceInterface);
    _builder.newLineIfNotEmpty();
    final String className = (interfaceName + "Proxy");
    _builder.newLineIfNotEmpty();
    final String asyncClassName = (interfaceName + "AsyncProxy");
    _builder.newLineIfNotEmpty();
    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 + "AsyncProxy_h");
    final String headerGuard = _plus_3.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();
    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("/");
    _builder.append(className, "");
    _builder.append("Base.h\"");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    {
      Set _requiredIncludesFor = this._cppStdTypeUtil.getRequiredIncludesFor(serviceInterface);
      String _includeForString = this._cppStdTypeUtil.getIncludeForString();
      Set _addElements = this._cppStdTypeUtil.addElements(_requiredIncludesFor, _includeForString);
      for(final String parameterType : _addElements) {
        _builder.append("#include ");
        _builder.append(parameterType, "");
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.append("#include ");
    _builder.newLine();
    _builder.newLine();
    String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(serviceInterface);
    _builder.append(_namespaceStarter, "");
    _builder.newLineIfNotEmpty();
    _builder.append("/** @brief proxy class for asynchronous calls of interface ");
    _builder.append(interfaceName, "");
    _builder.append(" */");
    _builder.newLineIfNotEmpty();
    _builder.append("class ");
    String _dllExportMacro = this._joynrCppGeneratorExtensions.getDllExportMacro();
    _builder.append(_dllExportMacro, "");
    _builder.append(" ");
    _builder.append(asyncClassName, "");
    _builder.append(": virtual public ");
    _builder.append(className, "");
    _builder.append("Base, virtual public I");
    _builder.append(interfaceName, "");
    _builder.append("Async {");
    _builder.newLineIfNotEmpty();
    _builder.append("public:");
    _builder.newLine();
    _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 messagingAddress The messaging address");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @param connectorFactory The connector factory");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @param cache The client cache");
    _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("* @param cached True, if cached, false otherwise");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("*/");
    _builder.newLine();
    _builder.append("\t");
    _builder.append(asyncClassName, "\t");
    _builder.append("(");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t\t");
    _builder.append("QSharedPointer messagingAddress,");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("joynr::ConnectorFactory* connectorFactory,");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("joynr::IClientCache* cache,");
    _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\t\t");
    _builder.append("bool cached");
    _builder.newLine();
    _builder.append("\t");
    _builder.append(");");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    CharSequence _produceAsyncGetters = this._interfaceUtil.produceAsyncGetters(serviceInterface, false);
    _builder.append(_produceAsyncGetters, "\t");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    CharSequence _produceAsyncSetters = this._interfaceUtil.produceAsyncSetters(serviceInterface, false);
    _builder.append(_produceAsyncSetters, "\t");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    CharSequence _produceAsyncMethods = this._interfaceUtil.produceAsyncMethods(serviceInterface, false);
    _builder.append(_produceAsyncMethods, "\t");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("friend class ");
    _builder.append(className, "\t");
    _builder.append(";");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("private:");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("DISALLOW_COPY_AND_ASSIGN(");
    _builder.append(asyncClassName, "\t");
    _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();
    _builder.newLine();
    return _builder;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy