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

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

package io.joynr.generator.cpp.provider;

import com.google.inject.Inject;
import io.joynr.generator.cpp.util.CppStdTypeUtil;
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.AttributeUtil;
import io.joynr.generator.templates.util.BroadcastUtil;
import io.joynr.generator.templates.util.InterfaceUtil;
import io.joynr.generator.templates.util.MethodUtil;
import io.joynr.generator.templates.util.NamingUtil;
import java.util.HashMap;
import java.util.Set;
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.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.StringExtensions;
import org.franca.core.franca.FArgument;
import org.franca.core.franca.FAttribute;
import org.franca.core.franca.FBroadcast;
import org.franca.core.franca.FEnumerationType;
import org.franca.core.franca.FMethod;

@SuppressWarnings("all")
public class InterfaceProviderHTemplate extends InterfaceTemplate {
  @Inject
  @Extension
  private TemplateBase _templateBase;

  @Inject
  @Extension
  private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;

  @Inject
  @Extension
  private CppStdTypeUtil _cppStdTypeUtil;

  @Inject
  @Extension
  private NamingUtil _namingUtil;

  @Inject
  @Extension
  private AttributeUtil _attributeUtil;

  @Inject
  @Extension
  private BroadcastUtil _broadcastUtil;

  @Inject
  @Extension
  private InterfaceUtil _interfaceUtil;

  @Inject
  @Extension
  private MethodUtil _methodUtil;

  @Override
  public CharSequence generate(final boolean generateVersion) {
    StringConcatenation _builder = new StringConcatenation();
    final String interfaceName = this._namingUtil.joynrName(this.francaIntf);
    _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 + "Provider_h").toUpperCase();
    _builder.newLineIfNotEmpty();
    CharSequence _warning = this._templateBase.warning();
    _builder.append(_warning);
    _builder.newLineIfNotEmpty();
    _builder.append("#ifndef ");
    _builder.append(headerGuard);
    _builder.newLineIfNotEmpty();
    _builder.append("#define ");
    _builder.append(headerGuard);
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("#include ");
    _builder.newLine();
    {
      final Function1 _function = new Function1() {
        @Override
        public Boolean apply(final FBroadcast it) {
          return Boolean.valueOf(it.isSelective());
        }
      };
      boolean _isEmpty = IterableExtensions.isEmpty(IterableExtensions.filter(this.francaIntf.getBroadcasts(), _function));
      boolean _not = (!_isEmpty);
      if (_not) {
        _builder.append("#include ");
        _builder.newLine();
      }
    }
    _builder.newLine();
    _builder.append("#include \"joynr/PrivateCopyAssign.h\"");
    _builder.newLine();
    _builder.newLine();
    _builder.append("#include \"joynr/IJoynrProvider.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(".h\"");
    _builder.newLineIfNotEmpty();
    _builder.append("#include \"joynr/RequestCallerFactory.h\"");
    _builder.newLine();
    _builder.append("#include \"");
    String _packagePathWithJoynrPrefix_2 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, "/", generateVersion);
    _builder.append(_packagePathWithJoynrPrefix_2);
    _builder.append("/");
    _builder.append(interfaceName);
    _builder.append("RequestCaller.h\"");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    {
      Set _dataTypeIncludesFor = this._cppStdTypeUtil.getDataTypeIncludesFor(this.francaIntf, generateVersion);
      for(final String parameterType : _dataTypeIncludesFor) {
        _builder.append("#include ");
        _builder.append(parameterType);
        _builder.newLineIfNotEmpty();
      }
    }
    _builder.newLine();
    _builder.append("#include ");
    _builder.newLine();
    _builder.newLine();
    String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(this.francaIntf, generateVersion);
    _builder.append(_namespaceStarter);
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("/**");
    _builder.newLine();
    _builder.append(" ");
    _builder.append("* @brief Provider 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(interfaceName);
    _builder.append("Provider : public virtual IJoynrProvider");
    _builder.newLineIfNotEmpty();
    _builder.append("{");
    _builder.newLine();
    _builder.newLine();
    _builder.append("public:");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("/** @brief Default constructor */");
    _builder.newLine();
    _builder.append("\t");
    _builder.append(interfaceName, "\t");
    _builder.append("Provider();");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("//for each Attribute the provider needs setters, sync and async getters.");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("//They have default implementation for pushing Providers and can be overwritten by pulling Providers.");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("/** @brief Destructor */");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("~");
    _builder.append(interfaceName, "\t");
    _builder.append("Provider() override;");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static const std::string& INTERFACE_NAME();");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("/**");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @brief MAJOR_VERSION The major version of this provider interface as specified in the");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* Franca model.");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("*/");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static const std::int32_t MAJOR_VERSION;");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("/**");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* @brief MINOR_VERSION The minor version of this provider interface as specified in the");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("* Franca model.");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("*/");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static const std::int32_t MINOR_VERSION;");
    _builder.newLine();
    _builder.newLine();
    {
      boolean _isEmpty_1 = this.francaIntf.getAttributes().isEmpty();
      boolean _not_1 = (!_isEmpty_1);
      if (_not_1) {
        _builder.append("\t");
        _builder.append("// attributes");
        _builder.newLine();
      }
    }
    {
      EList _attributes = this.francaIntf.getAttributes();
      for(final FAttribute attribute : _attributes) {
        _builder.append("\t");
        String attributeName = this._namingUtil.joynrName(attribute);
        _builder.newLineIfNotEmpty();
        {
          boolean _isReadable = this._attributeUtil.isReadable(attribute);
          if (_isReadable) {
            _builder.append("\t");
            _builder.append("/**");
            _builder.newLine();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("* @brief Gets ");
            String _firstUpper = StringExtensions.toFirstUpper(attributeName);
            _builder.append(_firstUpper, "\t ");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("*");
            _builder.newLine();
            _builder.append("\t");
            _builder.append(" ");
            CharSequence _printThreadingDocumentation = this.printThreadingDocumentation();
            _builder.append(_printThreadingDocumentation, "\t ");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("*");
            _builder.newLine();
            _builder.append("\t");
            _builder.append(" ");
            CharSequence _printCallbackDocumentation = this.printCallbackDocumentation("with the attribute value");
            _builder.append(_printCallbackDocumentation, "\t ");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("*/");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("virtual void get");
            String _firstUpper_1 = StringExtensions.toFirstUpper(attributeName);
            _builder.append(_firstUpper_1, "\t");
            _builder.append("(");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("\t\t");
            _builder.append("std::function onSuccess,");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("\t\t");
            _builder.append("std::function onError");
            _builder.newLine();
            _builder.append("\t");
            _builder.append(") = 0;");
            _builder.newLine();
          }
        }
        {
          boolean _isWritable = this._attributeUtil.isWritable(attribute);
          if (_isWritable) {
            _builder.append("\t");
            _builder.append("/**");
            _builder.newLine();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("* @brief Sets ");
            String _firstUpper_2 = StringExtensions.toFirstUpper(attributeName);
            _builder.append(_firstUpper_2, "\t ");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("*");
            _builder.newLine();
            _builder.append("\t");
            _builder.append(" ");
            CharSequence _printThreadingDocumentation_1 = this.printThreadingDocumentation();
            _builder.append(_printThreadingDocumentation_1, "\t ");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("*");
            _builder.newLine();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("* @param ");
            _builder.append(attributeName, "\t ");
            _builder.append(" the new value of the attribute");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(" ");
            CharSequence _printCallbackDocumentation_1 = this.printCallbackDocumentation("");
            _builder.append(_printCallbackDocumentation_1, "\t ");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("*/");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("virtual void set");
            String _firstUpper_3 = StringExtensions.toFirstUpper(attributeName);
            _builder.append(_firstUpper_3, "\t");
            _builder.append("(");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("\t\t");
            _builder.append("const ");
            String _typeName_1 = this._cppStdTypeUtil.getTypeName(attribute, generateVersion);
            _builder.append(_typeName_1, "\t\t\t");
            _builder.append("& ");
            _builder.append(attributeName, "\t\t\t");
            _builder.append(",");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("\t\t");
            _builder.append("std::function onSuccess,");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("\t\t");
            _builder.append("std::function onError");
            _builder.newLine();
            _builder.append("\t");
            _builder.append(") = 0;");
            _builder.newLine();
          }
        }
        {
          boolean _isNotifiable = this._attributeUtil.isNotifiable(attribute);
          if (_isNotifiable) {
            _builder.append("\t");
            _builder.append("/**");
            _builder.newLine();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("* @brief ");
            _builder.append(attributeName, "\t ");
            _builder.append("Changed must be called by a concrete provider");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("* to signal attribute modifications. It is used to implement onchange");
            _builder.newLine();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("* subscriptions.");
            _builder.newLine();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("* @param ");
            _builder.append(attributeName, "\t ");
            _builder.append(" the new attribute value");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("*/");
            _builder.newLine();
            _builder.append("\t");
            _builder.append("virtual void ");
            _builder.append(attributeName, "\t");
            _builder.append("Changed(");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append("\t\t");
            _builder.append("const ");
            String _typeName_2 = this._cppStdTypeUtil.getTypeName(attribute, generateVersion);
            _builder.append(_typeName_2, "\t\t\t");
            _builder.append("& ");
            _builder.append(attributeName, "\t\t\t");
            _builder.newLineIfNotEmpty();
            _builder.append("\t");
            _builder.append(") = 0;");
            _builder.newLine();
          }
        }
        _builder.newLine();
      }
    }
    {
      boolean _isEmpty_2 = this.francaIntf.getMethods().isEmpty();
      boolean _not_2 = (!_isEmpty_2);
      if (_not_2) {
        _builder.append("\t");
        _builder.append("// methods");
        _builder.newLine();
      }
    }
    _builder.append("\t");
    final HashMap methodToErrorEnumName = this._interfaceUtil.methodToErrorEnumName(this.francaIntf);
    _builder.newLineIfNotEmpty();
    {
      EList _methods = this.francaIntf.getMethods();
      for(final FMethod method : _methods) {
        _builder.append("\t");
        final String outputTypedParamList = this._cppStdTypeUtil.getCommaSeperatedTypedConstOutputParameterList(method, generateVersion);
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        final String inputTypedParamList = this._cppStdTypeUtil.getCommaSeperatedTypedConstInputParameterList(method, generateVersion);
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("/**");
        _builder.newLine();
        _builder.append("\t");
        _builder.append(" ");
        _builder.append("* @brief Implementation of the Franca method ");
        String _joynrName = this._namingUtil.joynrName(method);
        _builder.append(_joynrName, "\t ");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append(" ");
        _builder.append("*");
        _builder.newLine();
        _builder.append("\t");
        _builder.append(" ");
        CharSequence _printThreadingDocumentation_2 = this.printThreadingDocumentation();
        _builder.append(_printThreadingDocumentation_2, "\t ");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append(" ");
        _builder.append("*");
        _builder.newLine();
        {
          boolean _isFireAndForget = method.isFireAndForget();
          if (_isFireAndForget) {
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("* This is a fire-and-forget method. Callers do not expect any response.");
            _builder.newLine();
          } else {
            _builder.append("\t");
            _builder.append(" ");
            CharSequence _printCallbackDocumentation_2 = this.printCallbackDocumentation("");
            _builder.append(_printCallbackDocumentation_2, "\t ");
            _builder.newLineIfNotEmpty();
          }
        }
        _builder.append("\t");
        _builder.append(" ");
        _builder.append("*/");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("virtual void ");
        String _joynrName_1 = this._namingUtil.joynrName(method);
        _builder.append(_joynrName_1, "\t");
        _builder.append("(");
        _builder.newLineIfNotEmpty();
        {
          boolean _isEmpty_3 = IterableExtensions.isEmpty(this._methodUtil.getInputParameters(method));
          boolean _not_3 = (!_isEmpty_3);
          if (_not_3) {
            _builder.append("\t");
            _builder.append("\t\t");
            _builder.append(inputTypedParamList, "\t\t\t");
            {
              boolean _isFireAndForget_1 = method.isFireAndForget();
              boolean _not_4 = (!_isFireAndForget_1);
              if (_not_4) {
                _builder.append(",");
              }
            }
            _builder.newLineIfNotEmpty();
          }
        }
        {
          boolean _isFireAndForget_2 = method.isFireAndForget();
          boolean _not_5 = (!_isFireAndForget_2);
          if (_not_5) {
            {
              boolean _isEmpty_4 = IterableExtensions.isEmpty(this._methodUtil.getOutputParameters(method));
              if (_isEmpty_4) {
                _builder.append("\t");
                _builder.append("\t\t");
                _builder.append("std::function onSuccess,");
                _builder.newLine();
              } else {
                _builder.append("\t");
                _builder.append("\t\t");
                _builder.append("std::function onSuccess,");
                _builder.newLine();
              }
            }
            {
              boolean _hasErrorEnum = this._methodUtil.hasErrorEnum(method);
              if (_hasErrorEnum) {
                {
                  FEnumerationType _errors = method.getErrors();
                  boolean _tripleNotEquals = (_errors != null);
                  if (_tripleNotEquals) {
                    _builder.append("\t");
                    _builder.append("\t\t");
                    final String packagePath = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(method.getErrors(), "::", generateVersion);
                    _builder.newLineIfNotEmpty();
                    _builder.append("\t");
                    _builder.append("\t\t");
                    _builder.append("std::function onError");
                    _builder.newLineIfNotEmpty();
                  } else {
                    _builder.append("\t");
                    _builder.append("\t\t");
                    _builder.append("std::function onError");
                    _builder.newLineIfNotEmpty();
                  }
                }
              } else {
                _builder.append("\t");
                _builder.append("\t\t");
                _builder.append("std::function onError");
                _builder.newLine();
              }
            }
          }
        }
        _builder.append("\t");
        _builder.append(") = 0;");
        _builder.newLine();
        _builder.newLine();
      }
    }
    {
      boolean _isEmpty_5 = this.francaIntf.getBroadcasts().isEmpty();
      boolean _not_6 = (!_isEmpty_5);
      if (_not_6) {
        _builder.append("\t");
        _builder.append("// broadcasts");
        _builder.newLine();
      }
    }
    {
      EList _broadcasts = this.francaIntf.getBroadcasts();
      for(final FBroadcast broadcast : _broadcasts) {
        _builder.append("\t");
        String broadcastName = this._namingUtil.joynrName(broadcast);
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append("/**");
        _builder.newLine();
        _builder.append("\t");
        _builder.append(" ");
        _builder.append("* @brief fire");
        String _firstUpper_4 = StringExtensions.toFirstUpper(broadcastName);
        _builder.append(_firstUpper_4, "\t ");
        _builder.append(" must be called by a concrete");
        _builder.newLineIfNotEmpty();
        _builder.append("\t");
        _builder.append(" ");
        _builder.append("* provider to signal an occured event. It is used to implement broadcast");
        _builder.newLine();
        _builder.append("\t");
        _builder.append(" ");
        _builder.append("* publications.");
        _builder.newLine();
        {
          Iterable _outputParameters = this._broadcastUtil.getOutputParameters(broadcast);
          for(final FArgument parameter : _outputParameters) {
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("* @param ");
            String _name = parameter.getName();
            _builder.append(_name, "\t ");
            _builder.append(" the value for the broadcast output parameter ");
            String _name_1 = parameter.getName();
            _builder.append(_name_1, "\t ");
            _builder.newLineIfNotEmpty();
          }
        }
        {
          boolean _isSelective = broadcast.isSelective();
          boolean _not_7 = (!_isSelective);
          if (_not_7) {
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("* @param partitions optional list of partitions for this broadcast. Broadcast notifications");
            _builder.newLine();
            _builder.append("\t");
            _builder.append(" ");
            _builder.append("* are only sent to subscribers for these partitions.");
            _builder.newLine();
          }
        }
        _builder.append("\t");
        _builder.append(" ");
        _builder.append("*/");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("virtual void fire");
        String _firstUpper_5 = StringExtensions.toFirstUpper(broadcastName);
        _builder.append(_firstUpper_5, "\t");
        _builder.append("(");
        _builder.newLineIfNotEmpty();
        {
          boolean _isEmpty_6 = IterableExtensions.isEmpty(this._broadcastUtil.getOutputParameters(broadcast));
          boolean _not_8 = (!_isEmpty_6);
          if (_not_8) {
            _builder.append("\t");
            _builder.append("\t\t");
            String _commaSeperatedTypedConstOutputParameterList = this._cppStdTypeUtil.getCommaSeperatedTypedConstOutputParameterList(broadcast, generateVersion);
            _builder.append(_commaSeperatedTypedConstOutputParameterList, "\t\t\t");
            {
              boolean _isSelective_1 = broadcast.isSelective();
              boolean _not_9 = (!_isSelective_1);
              if (_not_9) {
                _builder.append(",");
              }
            }
            _builder.newLineIfNotEmpty();
          }
        }
        {
          boolean _isSelective_2 = broadcast.isSelective();
          boolean _not_10 = (!_isSelective_2);
          if (_not_10) {
            _builder.append("\t");
            _builder.append("\t\t");
            _builder.append("const std::vector& partitions = std::vector()");
            _builder.newLine();
          }
        }
        _builder.append("\t");
        _builder.append(") = 0;");
        _builder.newLine();
        _builder.newLine();
      }
    }
    _builder.append("private:");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("DISALLOW_COPY_AND_ASSIGN(");
    _builder.append(interfaceName, "\t");
    _builder.append("Provider);");
    _builder.newLineIfNotEmpty();
    _builder.append("};");
    _builder.newLine();
    String _namespaceEnder = this._joynrCppGeneratorExtensions.getNamespaceEnder(this.francaIntf, generateVersion);
    _builder.append(_namespaceEnder);
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    String packagePrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, "::", generateVersion);
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("namespace joynr {");
    _builder.newLine();
    _builder.newLine();
    _builder.append("// specialization of traits class RequestCallerTraits");
    _builder.newLine();
    _builder.append("// this links ");
    _builder.append(interfaceName);
    _builder.append("Provider with ");
    _builder.append(interfaceName);
    _builder.append("RequestCaller");
    _builder.newLineIfNotEmpty();
    _builder.append("template <>");
    _builder.newLine();
    _builder.append("struct RequestCallerTraits<");
    _builder.append(packagePrefix);
    _builder.append("::");
    _builder.append(interfaceName);
    _builder.append("Provider>");
    _builder.newLineIfNotEmpty();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("using RequestCaller = ");
    _builder.append(packagePrefix, "\t");
    _builder.append("::");
    _builder.append(interfaceName, "\t");
    _builder.append("RequestCaller;");
    _builder.newLineIfNotEmpty();
    _builder.append("};");
    _builder.newLine();
    _builder.newLine();
    _builder.append("} // namespace joynr");
    _builder.newLine();
    _builder.newLine();
    _builder.append("#endif // ");
    _builder.append(headerGuard);
    _builder.newLineIfNotEmpty();
    return _builder;
  }

  public CharSequence printThreadingDocumentation() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("* This method is called by a joynr middleware thread. The provider implementation");
    _builder.newLine();
    _builder.append("* must not block this thread; it must be released immediately after the method is");
    _builder.newLine();
    _builder.append("* called. Computations or further blocking calls must be performed asynchronously.");
    _builder.newLine();
    _builder.append("* Return the result of these computations by calling the onSuccess or onError");
    _builder.newLine();
    _builder.append("* callbacks asynchronously. N.B. Internal joynr data structures of joynr messages are");
    _builder.newLine();
    _builder.append("* captured in the callbacks and will be first released after the callback onSuccess");
    _builder.newLine();
    _builder.append("* or onError is called.");
    _builder.newLine();
    return _builder;
  }

  public CharSequence printCallbackDocumentation(final String onSuccessParameter) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("* @param onSuccess A callback function to be called ");
    _builder.append(onSuccessParameter);
    _builder.append(" once the asynchronous computation has");
    _builder.newLineIfNotEmpty();
    _builder.append("* finished with success. It expects a request status object as parameter.");
    _builder.newLine();
    _builder.append("* @param onError A callback function to be called once the asynchronous computation fails. It expects an exception.");
    _builder.newLine();
    return _builder;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy