Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
io.joynr.generator.cpp.inprocess.InterfaceInProcessConnectorCPPTemplate Maven / Gradle / Ivy
package io.joynr.generator.cpp.inprocess;
import com.google.common.base.Objects;
import com.google.inject.Inject;
import io.joynr.generator.cpp.util.JoynrCppGeneratorExtensions;
import io.joynr.generator.cpp.util.TemplateBase;
import java.util.HashSet;
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.IterableExtensions;
import org.eclipse.xtext.xbase.lib.StringExtensions;
import org.franca.core.franca.FAttribute;
import org.franca.core.franca.FInterface;
import org.franca.core.franca.FMethod;
import org.franca.core.franca.FType;
import org.franca.core.franca.FTypeRef;
@SuppressWarnings("all")
public class InterfaceInProcessConnectorCPPTemplate {
@Inject
@Extension
private TemplateBase _templateBase;
@Inject
@Extension
private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
public CharSequence generate(final FInterface serviceInterface) {
StringConcatenation _builder = new StringConcatenation();
String interfaceName = this._joynrCppGeneratorExtensions.joynrName(serviceInterface);
_builder.newLineIfNotEmpty();
CharSequence _warning = this._templateBase.warning();
_builder.append(_warning, "");
_builder.newLineIfNotEmpty();
_builder.append("#include \"");
String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, "/");
_builder.append(_packagePathWithJoynrPrefix, "");
_builder.append("/");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector.h\"");
_builder.newLineIfNotEmpty();
_builder.append("#include \"");
String _packagePathWithJoynrPrefix_1 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, "/");
_builder.append(_packagePathWithJoynrPrefix_1, "");
_builder.append("/");
_builder.append(interfaceName, "");
_builder.append("RequestCaller.h\"");
_builder.newLineIfNotEmpty();
_builder.append("#include \"joynr/DeclareMetatypeUtil.h\"");
_builder.newLine();
{
HashSet _allComplexAndEnumTypes = this._joynrCppGeneratorExtensions.getAllComplexAndEnumTypes(serviceInterface);
for(final Object datatype : _allComplexAndEnumTypes) {
{
if ((datatype instanceof FType)) {
{
boolean _isComplex = this._joynrCppGeneratorExtensions.isComplex(((FType) datatype));
if (_isComplex) {
_builder.append("#include \"");
String _includeOf = this._joynrCppGeneratorExtensions.getIncludeOf(((FType) datatype));
_builder.append(_includeOf, "");
_builder.append("\"");
_builder.newLineIfNotEmpty();
}
}
}
}
}
}
_builder.newLine();
_builder.append("#include \"joynr/InProcessAddress.h\"");
_builder.newLine();
_builder.append("#include \"joynr/SubscriptionManager.h\"");
_builder.newLine();
_builder.append("#include \"joynr/PublicationManager.h\"");
_builder.newLine();
_builder.append("#include \"joynr/SubscriptionCallback.h\"");
_builder.newLine();
_builder.append("#include \"joynr/Future.h\"");
_builder.newLine();
_builder.newLine();
_builder.newLine();
String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(serviceInterface);
_builder.append(_namespaceStarter, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("using namespace joynr::joynr_logging;");
_builder.newLine();
_builder.append("Logger* ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::logger = Logging::getInstance()->getLogger(\"MSG\", \"");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector\");");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("joynr::SubscriptionManager* subscriptionManager,");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("joynr::PublicationManager* publicationManager,");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("joynr::InProcessPublicationSender* inProcessPublicationSender,");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("const QString& proxyParticipantId,");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("const QString& providerParticipantId,");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("QSharedPointer address");
_builder.newLine();
_builder.append(") :");
_builder.newLine();
_builder.append("\t");
_builder.append("proxyParticipantId(proxyParticipantId),");
_builder.newLine();
_builder.append("\t");
_builder.append("providerParticipantId(providerParticipantId),");
_builder.newLine();
_builder.append(" ");
_builder.append("address(address),");
_builder.newLine();
_builder.append(" ");
_builder.append("subscriptionManager(subscriptionManager),");
_builder.newLine();
_builder.append(" ");
_builder.append("publicationManager(publicationManager),");
_builder.newLine();
_builder.append(" ");
_builder.append("inProcessPublicationSender(inProcessPublicationSender)");
_builder.newLine();
_builder.append("{");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("bool ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::usesClusterController() const{");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("return false;");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
{
EList _attributes = this._joynrCppGeneratorExtensions.getAttributes(serviceInterface);
for(final FAttribute attribute : _attributes) {
final String returnType = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.newLineIfNotEmpty();
final String attributeName = this._joynrCppGeneratorExtensions.joynrName(attribute);
_builder.newLineIfNotEmpty();
String _joynrName = this._joynrCppGeneratorExtensions.joynrName(attribute);
String _firstUpper = StringExtensions.toFirstUpper(_joynrName);
final String getAttributeName = ("get" + _firstUpper);
_builder.newLineIfNotEmpty();
String _joynrName_1 = this._joynrCppGeneratorExtensions.joynrName(attribute);
String _firstUpper_1 = StringExtensions.toFirstUpper(_joynrName_1);
final String setAttributeName = ("set" + _firstUpper_1);
_builder.newLineIfNotEmpty();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::");
_builder.append(getAttributeName, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("joynr::RequestStatus& status,");
_builder.newLine();
_builder.append("\t\t");
_builder.append(returnType, " ");
_builder.append("& result");
_builder.newLineIfNotEmpty();
_builder.append(") {");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(!");
String _interfaceCaller_1 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_1, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("//see header for more information");
_builder.newLine();
_builder.append(" ");
_builder.append("LOG_ERROR(logger,\"#### WARNING ##### ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(getAttributeName, " ");
_builder.append("(Future) is synchronous.\");");
_builder.newLineIfNotEmpty();
_builder.append(" ");
String _interfaceCaller_2 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_2, " ");
_builder.append("->");
_builder.append(getAttributeName, " ");
_builder.append("(status, result);\t\t\t\t");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::");
_builder.append(getAttributeName, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QSharedPointer > future,");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QSharedPointer< joynr::ICallback<");
_builder.append(returnType, " ");
_builder.append("> > callBack");
_builder.newLineIfNotEmpty();
_builder.append(") {");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!future.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_3 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_3, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(!");
String _interfaceCaller_4 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_4, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("//see header for more information");
_builder.newLine();
_builder.append(" ");
_builder.append("LOG_ERROR(logger,\"#### WARNING ##### ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(getAttributeName, " ");
_builder.append("(Future) is synchronous.\");");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.append(" ");
_builder.append(returnType, " ");
_builder.append(" result;");
_builder.newLineIfNotEmpty();
_builder.append(" ");
String _interfaceCaller_5 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_5, " ");
_builder.append("->");
_builder.append(getAttributeName, " ");
_builder.append("(status, result);");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("if (status.getCode()== joynr::RequestStatusCode::OK){");
_builder.newLine();
_builder.append(" ");
_builder.append("future->onSuccess(status, result);");
_builder.newLine();
_builder.append(" ");
_builder.append("callBack->onSuccess(status, result);");
_builder.newLine();
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append(" ");
_builder.append("future->onFailure(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("callBack->onFailure(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("}\t\t\t ");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::");
_builder.append(getAttributeName, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QSharedPointer > future");
_builder.newLineIfNotEmpty();
_builder.append(") {");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!future.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_6 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_6, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(!");
String _interfaceCaller_7 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_7, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("//see header for more information");
_builder.newLine();
_builder.append(" ");
_builder.append("LOG_ERROR(logger,\"#### WARNING ##### ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(getAttributeName, " ");
_builder.append("(Future) is synchronous.\");");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.append(" ");
_builder.append(returnType, " ");
_builder.append(" result;");
_builder.newLineIfNotEmpty();
_builder.append(" ");
String _interfaceCaller_8 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_8, " ");
_builder.append("->");
_builder.append(getAttributeName, " ");
_builder.append("(status, result);");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("if (status.getCode()== joynr::RequestStatusCode::OK){");
_builder.newLine();
_builder.append(" ");
_builder.append("future->onSuccess(status, result);");
_builder.newLine();
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append(" \t");
_builder.append("future->onFailure(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::");
_builder.append(getAttributeName, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QSharedPointer< joynr::ICallback<");
_builder.append(returnType, " ");
_builder.append("> > callBack");
_builder.newLineIfNotEmpty();
_builder.append(") {");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_9 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_9, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(!");
String _interfaceCaller_10 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_10, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("//see header for more information");
_builder.newLine();
_builder.append(" ");
_builder.append("LOG_ERROR(logger,\"#### WARNING ##### ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(getAttributeName, " ");
_builder.append("(Future) is synchronous.\");");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.append(" ");
_builder.append(returnType, " ");
_builder.append(" result;");
_builder.newLineIfNotEmpty();
_builder.append(" ");
String _interfaceCaller_11 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_11, " ");
_builder.append("->");
_builder.append(getAttributeName, " ");
_builder.append("(status, result);");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("if (status.getCode()== joynr::RequestStatusCode::OK){");
_builder.newLine();
_builder.append(" \t");
_builder.append("callBack->onSuccess(status, result);");
_builder.newLine();
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append(" ");
_builder.append("callBack->onFailure(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::");
_builder.append(setAttributeName, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QSharedPointer< joynr::ICallback > callBack,");
_builder.newLine();
_builder.append("\t\t");
_builder.append(returnType, " ");
_builder.append(" input");
_builder.newLineIfNotEmpty();
_builder.append(") {");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_12 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_12, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(!");
String _interfaceCaller_13 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_13, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("//see header for more information");
_builder.newLine();
_builder.append(" ");
_builder.append("LOG_ERROR(logger,\"#### WARNING ##### ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(setAttributeName, " ");
_builder.append("(Future) is synchronous.\");");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.append(" ");
String _interfaceCaller_14 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_14, " ");
_builder.append("->");
_builder.append(setAttributeName, " ");
_builder.append("(status, input);");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("if (status.getCode()== joynr::RequestStatusCode::OK){");
_builder.newLine();
_builder.append(" \t");
_builder.append("callBack->onSuccess(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append(" ");
_builder.append("callBack->onFailure(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::");
_builder.append(setAttributeName, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QSharedPointer< joynr::Future > future,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("QSharedPointer< joynr::ICallback > callBack,");
_builder.newLine();
_builder.append("\t\t");
_builder.append(returnType, " ");
_builder.append(" input");
_builder.newLineIfNotEmpty();
_builder.append(") {");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!future.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_15 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_15, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(!");
String _interfaceCaller_16 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_16, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("//see header for more information");
_builder.newLine();
_builder.append(" ");
_builder.append("LOG_ERROR(logger,\"#### WARNING ##### ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(setAttributeName, " ");
_builder.append("(Future) is synchronous.\");");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.append(" ");
String _interfaceCaller_17 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_17, " ");
_builder.append("->");
_builder.append(setAttributeName, " ");
_builder.append("(status, input);");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("if (status.getCode()== joynr::RequestStatusCode::OK){");
_builder.newLine();
_builder.append(" ");
_builder.append("future->onSuccess(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("callBack->onSuccess(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append(" ");
_builder.append("future->onFailure(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("callBack->onFailure(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("}\t\t\t ");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::");
_builder.append(setAttributeName, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QSharedPointer > future,");
_builder.newLine();
_builder.append("\t\t");
_builder.append(returnType, " ");
_builder.append(" input");
_builder.newLineIfNotEmpty();
_builder.append(") {");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!future.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_18 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_18, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(!");
String _interfaceCaller_19 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_19, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("//see header for more information");
_builder.newLine();
_builder.append(" ");
_builder.append("LOG_ERROR(logger,\"#### WARNING ##### ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(setAttributeName, " ");
_builder.append("(Future) is synchronous.\");");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.append(" ");
String _interfaceCaller_20 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_20, " ");
_builder.append("->");
_builder.append(setAttributeName, " ");
_builder.append("(status, input);");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("if (status.getCode()== joynr::RequestStatusCode::OK){");
_builder.newLine();
_builder.append(" ");
_builder.append("future->onSuccess(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append(" \t");
_builder.append("future->onFailure(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::");
_builder.append(setAttributeName, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("joynr::RequestStatus& status,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("const ");
_builder.append(returnType, " ");
_builder.append("& input");
_builder.newLineIfNotEmpty();
_builder.append(") {");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_21 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_21, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(!");
String _interfaceCaller_22 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_22, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("//see header for more information");
_builder.newLine();
_builder.append(" ");
_builder.append("LOG_ERROR(logger,\"#### WARNING ##### ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(getAttributeName, " ");
_builder.append("(Future) is synchronous.\");");
_builder.newLineIfNotEmpty();
_builder.append(" ");
String _interfaceCaller_23 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_23, " ");
_builder.append("->");
_builder.append(setAttributeName, " ");
_builder.append("(status, input);\t\t\t\t");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("QString ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::subscribeTo");
String _firstUpper_2 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_2, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QSharedPointer > subscriptionListener,");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QSharedPointer subscriptionQos)");
_builder.newLine();
_builder.append("{");
_builder.newLine();
{
FTypeRef _type = attribute.getType();
boolean _isEnum = this._joynrCppGeneratorExtensions.isEnum(_type);
if (_isEnum) {
_builder.append(" ");
_builder.append("Q_UNUSED(subscriptionListener);");
_builder.newLine();
_builder.append(" ");
_builder.append("Q_UNUSED(subscriptionQos);");
_builder.newLine();
_builder.append(" ");
_builder.append("// TODO support enum return values in C++ client");
_builder.newLine();
_builder.append(" ");
_builder.append("LOG_FATAL(logger, \"enum return values are currently not supported in C++ client (attribute name: ");
_builder.append(interfaceName, " ");
_builder.append(".");
_builder.append(attributeName, " ");
_builder.append(")\");");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(false);");
_builder.newLine();
_builder.append(" ");
_builder.append("// Visual C++ requires a return value");
_builder.newLine();
_builder.append(" ");
_builder.append("return QString();");
_builder.newLine();
} else {
_builder.append(" ");
_builder.append("logger->log(DEBUG, \"Subscribing to ");
_builder.append(attributeName, " ");
_builder.append(".\");");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(subscriptionManager != NULL);");
_builder.newLine();
_builder.append(" ");
_builder.append("QString attributeName = \"");
String _firstUpper_3 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_3, " ");
_builder.append("\";");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::SubscriptionCallback<");
_builder.append(returnType, " ");
_builder.append(">* subscriptionCallback = new joynr::SubscriptionCallback<");
_builder.append(returnType, " ");
_builder.append(">(subscriptionListener);");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::SubscriptionRequest* subscriptionRequest = new joynr::SubscriptionRequest();//ownership goes to PublicationManager");
_builder.newLine();
_builder.append(" ");
_builder.append("subscriptionManager->registerSubscription(");
_builder.newLine();
_builder.append(" ");
_builder.append("\t\t\t");
_builder.append("attributeName,");
_builder.newLine();
_builder.append(" ");
_builder.append("\t\t\t");
_builder.append("subscriptionCallback,");
_builder.newLine();
_builder.append(" ");
_builder.append("\t\t\t");
_builder.append("subscriptionQos,");
_builder.newLine();
_builder.append(" ");
_builder.append("\t\t\t");
_builder.append("*subscriptionRequest);");
_builder.newLine();
_builder.append(" ");
_builder.append("logger->log(DEBUG, \"Registered subscription: \" + subscriptionRequest->toQString());");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> requestCaller = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("QString subscriptionId = subscriptionRequest->getSubscriptionId();");
_builder.newLine();
_builder.append(" ");
_builder.newLine();
_builder.append(" ");
_builder.append("if(caller.isNull()) {");
_builder.newLine();
_builder.append(" ");
_builder.append("\t");
_builder.append("assert(publicationManager != NULL);");
_builder.newLine();
_builder.append(" ");
_builder.append("\t");
_builder.append("/**");
_builder.newLine();
_builder.append(" ");
_builder.append("\t");
_builder.append("* Provider not registered yet");
_builder.newLine();
_builder.append(" ");
_builder.append("\t");
_builder.append("* Dispatcher will call publicationManger->restore when a new provider is added to activate");
_builder.newLine();
_builder.append(" ");
_builder.append("\t");
_builder.append("* subscriptions for that provider");
_builder.newLine();
_builder.append(" ");
_builder.append("\t");
_builder.append("*/");
_builder.newLine();
_builder.append(" ");
_builder.append("\t");
_builder.append("publicationManager->add(proxyParticipantId, providerParticipantId, subscriptionRequest);");
_builder.newLine();
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append(" ");
_builder.append("\t");
_builder.append("publicationManager->add(proxyParticipantId, providerParticipantId, caller, subscriptionRequest, inProcessPublicationSender);");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append(" ");
_builder.append("return subscriptionId;");
_builder.newLine();
}
}
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::unsubscribeFrom");
String _firstUpper_4 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_4, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QString& subscriptionId");
_builder.newLine();
_builder.append(") {");
_builder.newLine();
{
FTypeRef _type_1 = attribute.getType();
boolean _isEnum_1 = this._joynrCppGeneratorExtensions.isEnum(_type_1);
if (_isEnum_1) {
_builder.append(" ");
_builder.append("Q_UNUSED(subscriptionId);");
_builder.newLine();
_builder.append(" ");
_builder.append("// TODO support enum return values in C++ client");
_builder.newLine();
_builder.append(" ");
_builder.append("LOG_FATAL(logger, \"enum return values are currently not supported in C++ client (attribute name: ");
_builder.append(interfaceName, " ");
_builder.append(".");
_builder.append(attributeName, " ");
_builder.append(")\");");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(false);");
_builder.newLine();
} else {
_builder.append(" ");
_builder.append("logger->log(DEBUG, \"Unsubscribing. Id=\" +subscriptionId);");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(publicationManager != NULL);");
_builder.newLine();
_builder.append(" ");
_builder.append("logger->log(DEBUG, \"Stopping publications by publication manager.\");");
_builder.newLine();
_builder.append(" ");
_builder.append("publicationManager->stopPublication(subscriptionId);");
_builder.newLine();
_builder.append(" ");
_builder.append("assert(subscriptionManager != NULL);");
_builder.newLine();
_builder.append(" ");
_builder.append("logger->log(DEBUG, \"Unregistering attribute subscription.\");");
_builder.newLine();
_builder.append(" ");
_builder.append("subscriptionManager->unregisterSubscription(subscriptionId);");
_builder.newLine();
}
}
_builder.append("}");
_builder.newLine();
}
}
_builder.newLine();
{
EList _methods = this._joynrCppGeneratorExtensions.getMethods(serviceInterface);
for(final FMethod method : _methods) {
_builder.append("\t");
String methodname = this._joynrCppGeneratorExtensions.joynrName(method);
_builder.newLineIfNotEmpty();
_builder.append("\t");
String _commaSeperatedTypedParameterList = this._joynrCppGeneratorExtensions.getCommaSeperatedTypedParameterList(method);
String parameterList = this._joynrCppGeneratorExtensions.prependCommaIfNotEmpty(_commaSeperatedTypedParameterList);
_builder.newLineIfNotEmpty();
_builder.append("\t");
Iterable outputParameter = this._joynrCppGeneratorExtensions.getMappedOutputParameter(method);
_builder.newLineIfNotEmpty();
_builder.append("\t");
String _commaSeperatedUntypedParameterList = this._joynrCppGeneratorExtensions.getCommaSeperatedUntypedParameterList(method);
String inputParamList = this._joynrCppGeneratorExtensions.prependCommaIfNotEmpty(_commaSeperatedUntypedParameterList);
_builder.newLineIfNotEmpty();
_builder.append("\t");
String _commaSeperatedTypedOutputParameterList = this._joynrCppGeneratorExtensions.getCommaSeperatedTypedOutputParameterList(method);
String outputTypedParamList = this._joynrCppGeneratorExtensions.prependCommaIfNotEmpty(_commaSeperatedTypedOutputParameterList);
_builder.newLineIfNotEmpty();
_builder.append("\t");
String _commaSeperatedUntypedOutputParameterList = this._joynrCppGeneratorExtensions.getCommaSeperatedUntypedOutputParameterList(method);
String outputUntypedParamList = this._joynrCppGeneratorExtensions.prependCommaIfNotEmpty(_commaSeperatedUntypedOutputParameterList);
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.newLine();
_builder.newLine();
{
String _head = IterableExtensions.head(outputParameter);
boolean _equals = Objects.equal(_head, "void");
if (_equals) {
_builder.append("\t");
_builder.append("void ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(methodname, " ");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("joynr::RequestStatus& status");
_builder.append(parameterList, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(") {");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_24 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_24, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!");
String _interfaceCaller_25 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_25, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
String _interfaceCaller_26 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_26, " ");
_builder.append("->");
_builder.append(methodname, " ");
_builder.append("(status ");
_builder.append(inputParamList, " ");
_builder.append(" );\t\t\t\t\t\t\t\t\t");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
} else {
_builder.append("\t");
_builder.append("void ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(methodname, " ");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("joynr::RequestStatus& status");
_builder.append(outputTypedParamList, " ");
_builder.append(parameterList, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(") {");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_27 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_27, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!");
String _interfaceCaller_28 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_28, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
String _interfaceCaller_29 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_29, " ");
_builder.append("->");
_builder.append(methodname, " ");
_builder.append("(status");
_builder.append(outputUntypedParamList, " ");
_builder.append(" ");
_builder.append(inputParamList, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
}
}
_builder.append("\t");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.newLine();
{
String _head_1 = IterableExtensions.head(outputParameter);
boolean _equals_1 = Objects.equal(_head_1, "void");
if (_equals_1) {
_builder.append("\t");
_builder.append("void ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(methodname, " ");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("QSharedPointerhead(outputParameter);
_builder.append(_head_2, " ");
_builder.append("> > future,");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("QSharedPointer< joynr::ICallback<");
String _head_3 = IterableExtensions.head(outputParameter);
_builder.append(_head_3, " ");
_builder.append("> > callBack");
_builder.append(parameterList, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(") {");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_30 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_30, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!");
String _interfaceCaller_31 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_31, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
String _interfaceCaller_32 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_32, " ");
_builder.append("->");
_builder.append(methodname, " ");
_builder.append("(status ");
_builder.append(inputParamList, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("if (status.getCode() == joynr::RequestStatusCode::OK) {");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("future->onSuccess(status);");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("callBack->onSuccess(status);");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("future->onFailure(status);");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("callBack->onFailure(status);");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("}\t");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
} else {
_builder.append("\t");
_builder.append("void ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(methodname, " ");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("QSharedPointerhead(outputParameter);
_builder.append(_head_4, " ");
_builder.append("> > future,");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("QSharedPointer< joynr::ICallback<");
String _head_5 = IterableExtensions.head(outputParameter);
_builder.append(_head_5, " ");
_builder.append("> > callBack");
_builder.append(parameterList, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(") {");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_33 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_33, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!");
String _interfaceCaller_34 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_34, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
String _head_6 = IterableExtensions.head(outputParameter);
_builder.append(_head_6, " ");
_builder.append(" result;");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(" ");
String _interfaceCaller_35 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_35, " ");
_builder.append("->");
_builder.append(methodname, " ");
_builder.append("(status, result ");
_builder.append(inputParamList, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("if (status.getCode() == joynr::RequestStatusCode::OK) {");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("future->onSuccess(status, result);");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("callBack->onSuccess(status, result);");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("future->onFailure(status);");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("callBack->onFailure(status);");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("}\t");
_builder.newLine();
_builder.append("\t");
_builder.append("}\t\t\t");
_builder.newLine();
}
}
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
{
String _head_7 = IterableExtensions.head(outputParameter);
boolean _equals_2 = Objects.equal(_head_7, "void");
if (_equals_2) {
_builder.append("\t");
_builder.append("void ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(methodname, " ");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("QSharedPointerhead(outputParameter);
_builder.append(_head_8, " ");
_builder.append("> > future");
_builder.append(parameterList, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(") {");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_36 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_36, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!");
String _interfaceCaller_37 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_37, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
String _interfaceCaller_38 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_38, " ");
_builder.append("->");
_builder.append(methodname, " ");
_builder.append("(status ");
_builder.append(inputParamList, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("if (status.getCode() == joynr::RequestStatusCode::OK) {");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("future->onSuccess(status);");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("future->onFailure(status);");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("}\t");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
} else {
_builder.append("\t");
_builder.append("void ");
_builder.append(interfaceName, " ");
_builder.append("InProcessConnector::");
_builder.append(methodname, " ");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("QSharedPointerhead(outputParameter);
_builder.append(_head_9, " ");
_builder.append("> > future");
_builder.append(parameterList, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(") {");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_39 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_39, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("assert(!");
String _interfaceCaller_40 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_40, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
String _head_10 = IterableExtensions.head(outputParameter);
_builder.append(_head_10, " ");
_builder.append(" result;");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append(" ");
String _interfaceCaller_41 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_41, " ");
_builder.append("->");
_builder.append(methodname, " ");
_builder.append("(status, result ");
_builder.append(inputParamList, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("if (status.getCode() == joynr::RequestStatusCode::OK) {");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("future->onSuccess(status, result);");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("future->onFailure(status);");
_builder.newLine();
_builder.append("\t");
_builder.append(" ");
_builder.append("}\t");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
}
}
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
{
String _head_11 = IterableExtensions.head(outputParameter);
boolean _equals_3 = Objects.equal(_head_11, "void");
if (_equals_3) {
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::");
_builder.append(methodname, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QSharedPointer< joynr::ICallback<");
String _head_12 = IterableExtensions.head(outputParameter);
_builder.append(_head_12, " ");
_builder.append("> > callBack");
_builder.append(parameterList, " ");
_builder.newLineIfNotEmpty();
_builder.append(") {");
_builder.newLine();
_builder.append("\t");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append("\t");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_42 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_42, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("assert(!");
String _interfaceCaller_43 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_43, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.newLine();
_builder.append(" ");
String _interfaceCaller_44 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_44, " ");
_builder.append("->");
_builder.append(methodname, " ");
_builder.append("(status ");
_builder.append(inputParamList, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append(" ");
_builder.append("if (status.getCode() == joynr::RequestStatusCode::OK) {");
_builder.newLine();
_builder.append(" ");
_builder.append("callBack->onSuccess(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append(" ");
_builder.append("callBack->onFailure(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("}\t");
_builder.newLine();
_builder.append("}");
_builder.newLine();
} else {
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("InProcessConnector::");
_builder.append(methodname, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("QSharedPointer< joynr::ICallback<");
String _head_13 = IterableExtensions.head(outputParameter);
_builder.append(_head_13, " ");
_builder.append("> > callBack");
_builder.append(parameterList, " ");
_builder.newLineIfNotEmpty();
_builder.append(") {");
_builder.newLine();
_builder.append("\t");
_builder.append("assert(!address.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("QSharedPointer caller = address->getRequestCaller();");
_builder.newLine();
_builder.append("\t");
_builder.append("assert(!caller.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("QSharedPointer<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller> ");
String _interfaceCaller_45 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_45, " ");
_builder.append(" = caller.dynamicCast<");
_builder.append(interfaceName, " ");
_builder.append("RequestCaller>();");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("assert(!");
String _interfaceCaller_46 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_46, " ");
_builder.append(".isNull());");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.append("\t");
String _head_14 = IterableExtensions.head(outputParameter);
_builder.append(_head_14, " ");
_builder.append(" result;");
_builder.newLineIfNotEmpty();
_builder.append(" ");
String _interfaceCaller_47 = this.getInterfaceCaller(serviceInterface);
_builder.append(_interfaceCaller_47, " ");
_builder.append("->");
_builder.append(methodname, " ");
_builder.append("(status, result ");
_builder.append(inputParamList, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append(" ");
_builder.append("if (status.getCode() == joynr::RequestStatusCode::OK) {");
_builder.newLine();
_builder.append(" ");
_builder.append("callBack->onSuccess(status, result);");
_builder.newLine();
_builder.append(" ");
_builder.append("} else {");
_builder.newLine();
_builder.append(" ");
_builder.append("callBack->onFailure(status);");
_builder.newLine();
_builder.append(" ");
_builder.append("}\t");
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
}
_builder.append("\t");
_builder.newLine();
}
}
String _namespaceEnder = this._joynrCppGeneratorExtensions.getNamespaceEnder(serviceInterface);
_builder.append(_namespaceEnder, "");
_builder.newLineIfNotEmpty();
return _builder;
}
public String getInterfaceCaller(final FInterface serviceInterface) {
String _joynrName = this._joynrCppGeneratorExtensions.joynrName(serviceInterface);
String _firstLower = StringExtensions.toFirstLower(_joynrName);
String _plus = (_firstLower + "Caller");
return _plus;
}
}