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

io.joynr.generator.cpp.provider.InterfaceRequestInterpreterHTemplate Maven / Gradle / Ivy

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

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

@SuppressWarnings("all")
public class InterfaceRequestInterpreterHTemplate implements InterfaceTemplate {
  @Inject
  @Extension
  private TemplateBase _templateBase;
  
  @Inject
  @Extension
  private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
  
  public CharSequence generate(final FInterface serviceInterface) {
    StringConcatenation _builder = new StringConcatenation();
    final String interfaceName = this._joynrCppGeneratorExtensions.joynrName(serviceInterface);
    _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 + "RequestInterpreter_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 \"joynr/IRequestInterpreter.h\"");
    _builder.newLine();
    _builder.newLine();
    _builder.append("#include \"joynr/joynrlogging.h\"");
    _builder.newLine();
    _builder.newLine();
    _builder.append("#include ");
    _builder.newLine();
    _builder.append("#include ");
    _builder.newLine();
    _builder.newLine();
    String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(serviceInterface);
    _builder.append(_namespaceStarter, "");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("/** @brief RequestInterpreter class for interface ");
    _builder.append(interfaceName, "");
    _builder.append(" */");
    _builder.newLineIfNotEmpty();
    _builder.append("class ");
    String _dllExportMacro = this._joynrCppGeneratorExtensions.getDllExportMacro();
    _builder.append(_dllExportMacro, "");
    _builder.append(" ");
    _builder.append(interfaceName, "");
    _builder.append("RequestInterpreter: public joynr::IRequestInterpreter {");
    _builder.newLineIfNotEmpty();
    _builder.append("public:");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("/** @brief Default constructor */");
    _builder.newLine();
    _builder.append("\t");
    _builder.append(interfaceName, "\t");
    _builder.append("RequestInterpreter();");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("/** @brief Destructor */");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("virtual ~");
    _builder.append(interfaceName, "\t");
    _builder.append("RequestInterpreter(){}");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("/**");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @brief Implements IRequestInterpreter.execute().");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* Executes method methodName with given parameters on the requestCaller object.");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @param requestCaller Object on which the method is to be executed");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @param methodName The name of the method to be executed");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @param paramValues The list of parameter values");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @param paramTypes The list of parameter types");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @param callbackFct A callback function to be called once the asynchronous computation has");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* finished. It must expect the method out parameters.");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("*/");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("void execute(QSharedPointer requestCaller,");
    _builder.newLine();
    _builder.append("\t\t\t\t\t ");
    _builder.append("const QString& methodName,");
    _builder.newLine();
    _builder.append("\t\t\t\t\t ");
    _builder.append("const QList& paramValues,");
    _builder.newLine();
    _builder.append("\t\t\t\t\t ");
    _builder.append("const QList& paramTypes,");
    _builder.newLine();
    _builder.append("\t\t\t\t\t ");
    _builder.append("std::function& outParams)> callbackFct);");
    _builder.newLine();
    _builder.newLine();
    _builder.append("private:");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("DISALLOW_COPY_AND_ASSIGN(");
    _builder.append(interfaceName, "\t");
    _builder.append("RequestInterpreter);");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("static joynr::joynr_logging::Logger* logger;");
    _builder.newLine();
    _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();
    return _builder;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy