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.joynrmessaging.InterfaceJoynrMessagingConnectorCppTemplate Maven / Gradle / Ivy
package io.joynr.generator.cpp.joynrmessaging;
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.FArgument;
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 InterfaceJoynrMessagingConnectorCppTemplate {
@Inject
@Extension
private TemplateBase _templateBase;
@Inject
@Extension
private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
public CharSequence produceParameterSetters(final FMethod method) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("joynr::Request internalRequestObject;");
_builder.newLine();
_builder.append("internalRequestObject.setMethodName(QString(\"");
String _joynrName = this._joynrCppGeneratorExtensions.joynrName(method);
_builder.append(_joynrName, "");
_builder.append("\"));");
_builder.newLineIfNotEmpty();
{
Iterable _inputParameters = this._joynrCppGeneratorExtensions.getInputParameters(method);
for(final FArgument param : _inputParameters) {
{
boolean _and = false;
FTypeRef _type = param.getType();
boolean _isEnum = this._joynrCppGeneratorExtensions.isEnum(_type);
if (!_isEnum) {
_and = false;
} else {
boolean _isArray = this._joynrCppGeneratorExtensions.isArray(param);
_and = (_isEnum && _isArray);
}
if (_and) {
_builder.append("internalRequestObject.addParam(joynr::Util::convertListToVariantList(");
String _joynrName_1 = this._joynrCppGeneratorExtensions.joynrName(param);
_builder.append(_joynrName_1, "");
_builder.append("), \"");
String _joynrTypeName = this._joynrCppGeneratorExtensions.getJoynrTypeName(param);
_builder.append(_joynrTypeName, "");
_builder.append("\");");
_builder.newLineIfNotEmpty();
} else {
FTypeRef _type_1 = param.getType();
boolean _isEnum_1 = this._joynrCppGeneratorExtensions.isEnum(_type_1);
if (_isEnum_1) {
_builder.append("internalRequestObject.addParam(QVariant::fromValue(");
String _joynrName_2 = this._joynrCppGeneratorExtensions.joynrName(param);
_builder.append(_joynrName_2, "");
_builder.append("), \"");
String _joynrTypeName_1 = this._joynrCppGeneratorExtensions.getJoynrTypeName(param);
_builder.append(_joynrTypeName_1, "");
_builder.append("\");");
_builder.newLineIfNotEmpty();
} else {
boolean _isArray_1 = this._joynrCppGeneratorExtensions.isArray(param);
if (_isArray_1) {
_builder.append("QList ");
String _joynrName_3 = this._joynrCppGeneratorExtensions.joynrName(param);
_builder.append(_joynrName_3, "");
_builder.append("QVarList = joynr::Util::convertListToVariantList(");
String _joynrName_4 = this._joynrCppGeneratorExtensions.joynrName(param);
_builder.append(_joynrName_4, "");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("internalRequestObject.addParam(QVariant::fromValue(");
String _joynrName_5 = this._joynrCppGeneratorExtensions.joynrName(param);
_builder.append(_joynrName_5, "");
_builder.append("QVarList), \"");
String _joynrTypeName_2 = this._joynrCppGeneratorExtensions.getJoynrTypeName(param);
_builder.append(_joynrTypeName_2, "");
_builder.append("\");");
_builder.newLineIfNotEmpty();
} else {
FTypeRef _type_2 = param.getType();
boolean _isComplex = this._joynrCppGeneratorExtensions.isComplex(_type_2);
if (_isComplex) {
_builder.append("internalRequestObject.addParam(QVariant::fromValue(");
String _joynrName_6 = this._joynrCppGeneratorExtensions.joynrName(param);
_builder.append(_joynrName_6, "");
_builder.append("), \"");
String _joynrTypeName_3 = this._joynrCppGeneratorExtensions.getJoynrTypeName(param);
_builder.append(_joynrTypeName_3, "");
_builder.append("\");");
_builder.newLineIfNotEmpty();
} else {
_builder.append("internalRequestObject.addParam(QVariant(");
String _joynrName_7 = this._joynrCppGeneratorExtensions.joynrName(param);
_builder.append(_joynrName_7, "");
_builder.append("), \"");
String _joynrTypeName_4 = this._joynrCppGeneratorExtensions.getJoynrTypeName(param);
_builder.append(_joynrTypeName_4, "");
_builder.append("\");");
_builder.newLineIfNotEmpty();
}
}
}
}
}
}
}
return _builder;
}
public CharSequence generate(final FInterface serviceInterface) {
CharSequence _xblockexpression = null;
{
final String interfaceName = this._joynrCppGeneratorExtensions.joynrName(serviceInterface);
StringConcatenation _builder = new StringConcatenation();
CharSequence _warning = this._templateBase.warning();
_builder.append(_warning, "");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("#include \"");
String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, "/");
_builder.append(_packagePathWithJoynrPrefix, "");
_builder.append("/");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector.h\"");
_builder.newLineIfNotEmpty();
_builder.append("#include \"joynr/ReplyCaller.h\"");
_builder.newLine();
_builder.append("#include \"joynr/JoynrMessageSender.h\"");
_builder.newLine();
_builder.append("#include \"joynr/joynrlogging.h\"");
_builder.newLine();
_builder.append("#include \"joynr/SubscriptionManager.h\"");
_builder.newLine();
_builder.append("#include \"joynr/SubscriptionCallback.h\"");
_builder.newLine();
_builder.append("#include \"joynr/Util.h\"");
_builder.newLine();
_builder.append("#include \"joynr/SubscriptionStop.h\"");
_builder.newLine();
_builder.append("#include \"joynr/Future.h\"");
_builder.newLine();
_builder.newLine();
_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();
String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(serviceInterface);
_builder.append(_namespaceStarter, "");
_builder.append(" ");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector(");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::IJoynrMessageSender* joynrMessageSender,");
_builder.newLine();
_builder.append(" ");
_builder.append("joynr::SubscriptionManager* subscriptionManager,");
_builder.newLine();
_builder.append(" ");
_builder.append("const QString &domain,");
_builder.newLine();
_builder.append(" ");
_builder.append("const QString proxyParticipantId,");
_builder.newLine();
_builder.append(" ");
_builder.append("const QString& providerParticipantId,");
_builder.newLine();
_builder.append(" ");
_builder.append("const joynr::MessagingQos &qosSettings,");
_builder.newLine();
_builder.append(" ");
_builder.append("joynr::IClientCache *cache,");
_builder.newLine();
_builder.append(" ");
_builder.append("bool cached,");
_builder.newLine();
_builder.append(" ");
_builder.append("qint64 reqCacheDataFreshness_ms)");
_builder.newLine();
_builder.append(" ");
_builder.append(": joynr::AbstractJoynrMessagingConnector(joynrMessageSender, subscriptionManager, domain, getInterfaceName(), proxyParticipantId, providerParticipantId, qosSettings, cache, cached, reqCacheDataFreshness_ms)");
_builder.newLine();
_builder.append("{");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("bool ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::usesClusterController() const{");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("return joynr::AbstractJoynrMessagingConnector::usesClusterController();");
_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();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::get");
String _firstUpper = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper, "");
_builder.append("(joynr::RequestStatus& status, ");
String _mappedDatatypeOrList = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList, "");
_builder.append("& ");
_builder.append(attributeName, "");
_builder.append(") {");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("QSharedPointer > future = QSharedPointer >(new joynr::Future<");
String _mappedDatatypeOrList_3 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_3, " ");
_builder.append(">());");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller<");
String _mappedDatatypeOrList_4 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_4, " ");
_builder.append(">(future));");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.newLine();
_builder.append(" ");
_builder.append("// check cache here");
_builder.newLine();
_builder.append(" ");
_builder.append("attributeRequest<");
String _mappedDatatypeOrList_5 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_5, " ");
_builder.append(">(QString(\"get");
String _firstUpper_1 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_1, " ");
_builder.append("\"), status, replyCaller);");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("status = future->waitForFinished();");
_builder.newLine();
_builder.append(" ");
_builder.append("if (status.successful()) {");
_builder.newLine();
_builder.append(" ");
_builder.append(attributeName, " ");
_builder.append(" = future->getValue();");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("// add result to caching");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::get");
String _firstUpper_2 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_2, "");
_builder.append("(QSharedPointer > future, QSharedPointer< joynr::ICallback<");
String _mappedDatatypeOrList_7 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_7, "");
_builder.append("> > callback) {");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(!future.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("future->setCallback(callback);");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller<");
String _mappedDatatypeOrList_8 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_8, " ");
_builder.append(">(future));");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append(" ");
_builder.append("// check cache here");
_builder.newLine();
_builder.append("\t");
_builder.append("attributeRequest<");
String _mappedDatatypeOrList_9 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_9, " ");
_builder.append(">(QString(\"get");
String _firstUpper_3 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_3, " ");
_builder.append("\"), future->getStatus(), replyCaller);");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::get");
String _firstUpper_4 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_4, "");
_builder.append("(QSharedPointer > future) {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("assert(!future.isNull());");
_builder.newLine();
_builder.append("\t");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller<");
String _mappedDatatypeOrList_11 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_11, " ");
_builder.append(">(future));");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append(" ");
_builder.append("// check cache here");
_builder.newLine();
_builder.append(" ");
_builder.append("attributeRequest<");
String _mappedDatatypeOrList_12 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_12, " ");
_builder.append(">(QString(\"get");
String _firstUpper_5 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_5, " ");
_builder.append("\"), future->getStatus(), replyCaller);");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::get");
String _firstUpper_6 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_6, "");
_builder.append("(QSharedPointer< joynr::ICallback<");
String _mappedDatatypeOrList_13 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_13, "");
_builder.append("> > callback) {");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller<");
String _mappedDatatypeOrList_14 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_14, " ");
_builder.append(">(callback));");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.newLine();
_builder.append(" ");
_builder.append("// check cache here");
_builder.newLine();
_builder.append("\t");
_builder.append("attributeRequest<");
String _mappedDatatypeOrList_15 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_15, " ");
_builder.append(">(QString(\"get");
String _firstUpper_7 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_7, " ");
_builder.append("\"), status, replyCaller);");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::set");
String _firstUpper_8 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_8, "");
_builder.append("(QSharedPointer< joynr::ICallback > callBack, ");
String _mappedDatatypeOrList_16 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_16, "");
_builder.append(" ");
_builder.append(attributeName, "");
_builder.append(") {");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::Request internalRequestObject;");
_builder.newLine();
_builder.append(" ");
_builder.append("internalRequestObject.setMethodName(QString(\"set");
String _firstUpper_9 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_9, " ");
_builder.append("\"));");
_builder.newLineIfNotEmpty();
{
boolean _isArray = this._joynrCppGeneratorExtensions.isArray(attribute);
if (_isArray) {
_builder.append("\t");
_builder.append("QList ");
_builder.append(attributeName, " ");
_builder.append("QVarList = joynr::Util::convertListToVariantList(");
_builder.append(attributeName, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("internalRequestObject.addParam(QVariant::fromValue(");
_builder.append(attributeName, " ");
_builder.append("QVarList), \"");
String _joynrTypeName = this._joynrCppGeneratorExtensions.getJoynrTypeName(attribute);
_builder.append(_joynrTypeName, " ");
_builder.append("\");");
_builder.newLineIfNotEmpty();
} else {
_builder.append("\t");
_builder.append("internalRequestObject.addParam(QVariant::fromValue(");
_builder.append(attributeName, " ");
_builder.append("), \"");
String _joynrTypeName_1 = this._joynrCppGeneratorExtensions.getJoynrTypeName(attribute);
_builder.append(_joynrTypeName_1, " ");
_builder.append("\");");
_builder.newLineIfNotEmpty();
}
}
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller(callBack));");
_builder.newLine();
_builder.append(" ");
_builder.append("joynr::RequestStatus status;");
_builder.newLine();
_builder.newLine();
_builder.append(" ");
_builder.append("operationRequest(status, replyCaller, internalRequestObject);");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::set");
String _firstUpper_10 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_10, "");
_builder.append("(QSharedPointer< joynr::Future > future, QSharedPointer< joynr::ICallback > callBack, ");
String _mappedDatatypeOrList_17 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_17, "");
_builder.append(" ");
_builder.append(attributeName, "");
_builder.append("){");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(!future.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("joynr::Request internalRequestObject;");
_builder.newLine();
_builder.append(" ");
_builder.append("internalRequestObject.setMethodName(QString(\"set");
String _firstUpper_11 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_11, " ");
_builder.append("\"));");
_builder.newLineIfNotEmpty();
{
boolean _isArray_1 = this._joynrCppGeneratorExtensions.isArray(attribute);
if (_isArray_1) {
_builder.append("\t");
_builder.append("QList ");
_builder.append(attributeName, " ");
_builder.append("QVarList = joynr::Util::convertListToVariantList(");
_builder.append(attributeName, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("internalRequestObject.addParam(QVariant::fromValue(");
_builder.append(attributeName, " ");
_builder.append("QVarList), \"");
String _joynrTypeName_2 = this._joynrCppGeneratorExtensions.getJoynrTypeName(attribute);
_builder.append(_joynrTypeName_2, " ");
_builder.append("\");");
_builder.newLineIfNotEmpty();
} else {
_builder.append("\t");
_builder.append("internalRequestObject.addParam(QVariant::fromValue(");
_builder.append(attributeName, " ");
_builder.append("), \"");
String _joynrTypeName_3 = this._joynrCppGeneratorExtensions.getJoynrTypeName(attribute);
_builder.append(_joynrTypeName_3, " ");
_builder.append("\");");
_builder.newLineIfNotEmpty();
}
}
_builder.append(" ");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller(callBack));");
_builder.newLine();
_builder.append(" ");
_builder.append("operationRequest(future->getStatus(), replyCaller, internalRequestObject);");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::set");
String _firstUpper_12 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_12, "");
_builder.append("(QSharedPointer > future, ");
String _mappedDatatypeOrList_18 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_18, "");
_builder.append(" ");
_builder.append(attributeName, "");
_builder.append("){");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("assert(!future.isNull());");
_builder.newLine();
_builder.append(" ");
_builder.append("joynr::Request internalRequestObject;");
_builder.newLine();
_builder.append(" ");
_builder.append("internalRequestObject.setMethodName(QString(\"set");
String _firstUpper_13 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_13, " ");
_builder.append("\"));");
_builder.newLineIfNotEmpty();
{
boolean _isArray_2 = this._joynrCppGeneratorExtensions.isArray(attribute);
if (_isArray_2) {
_builder.append("\t");
_builder.append("QList ");
_builder.append(attributeName, " ");
_builder.append("QVarList = joynr::Util::convertListToVariantList(");
_builder.append(attributeName, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("internalRequestObject.addParam(QVariant::fromValue(");
_builder.append(attributeName, " ");
_builder.append("QVarList), \"");
String _joynrTypeName_4 = this._joynrCppGeneratorExtensions.getJoynrTypeName(attribute);
_builder.append(_joynrTypeName_4, " ");
_builder.append("\");");
_builder.newLineIfNotEmpty();
} else {
_builder.append("\t");
_builder.append("internalRequestObject.addParam(QVariant::fromValue(");
_builder.append(attributeName, " ");
_builder.append("), \"");
String _joynrTypeName_5 = this._joynrCppGeneratorExtensions.getJoynrTypeName(attribute);
_builder.append(_joynrTypeName_5, " ");
_builder.append("\");");
_builder.newLineIfNotEmpty();
}
}
_builder.append(" ");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller(future));");
_builder.newLine();
_builder.append("\t");
_builder.append("operationRequest(future->getStatus(), replyCaller, internalRequestObject);");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::set");
String _firstUpper_14 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_14, "");
_builder.append("(joynr::RequestStatus& status, const ");
String _mappedDatatypeOrList_19 = this._joynrCppGeneratorExtensions.getMappedDatatypeOrList(attribute);
_builder.append(_mappedDatatypeOrList_19, "");
_builder.append("& ");
_builder.append(attributeName, "");
_builder.append(") {");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::Request internalRequestObject;");
_builder.newLine();
_builder.append("\t");
_builder.append("internalRequestObject.setMethodName(QString(\"set");
String _firstUpper_15 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_15, " ");
_builder.append("\"));");
_builder.newLineIfNotEmpty();
{
boolean _isArray_3 = this._joynrCppGeneratorExtensions.isArray(attribute);
if (_isArray_3) {
_builder.append("\t");
_builder.append("QList ");
_builder.append(attributeName, " ");
_builder.append("QVarList = joynr::Util::convertListToVariantList(");
_builder.append(attributeName, " ");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("internalRequestObject.addParam(QVariant::fromValue(");
_builder.append(attributeName, " ");
_builder.append("QVarList), \"");
String _joynrTypeName_6 = this._joynrCppGeneratorExtensions.getJoynrTypeName(attribute);
_builder.append(_joynrTypeName_6, " ");
_builder.append("\");");
_builder.newLineIfNotEmpty();
} else {
_builder.append("\t");
_builder.append("internalRequestObject.addParam(QVariant::fromValue(");
_builder.append(attributeName, " ");
_builder.append("), \"");
String _joynrTypeName_7 = this._joynrCppGeneratorExtensions.getJoynrTypeName(attribute);
_builder.append(_joynrTypeName_7, " ");
_builder.append("\");");
_builder.newLineIfNotEmpty();
}
}
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer > future = QSharedPointer >( new joynr::Future());");
_builder.newLine();
_builder.append(" ");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller(future));");
_builder.newLine();
_builder.append(" ");
_builder.append("operationRequest(status, replyCaller, internalRequestObject);");
_builder.newLine();
_builder.append(" ");
_builder.append("status = future->waitForFinished();");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("QString ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::subscribeTo");
String _firstUpper_16 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_16, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("QSharedPointer > subscriptionListener,");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("QSharedPointer subscriptionQos");
_builder.newLine();
_builder.append(") {");
_builder.newLine();
_builder.append(" ");
_builder.append("LOG_DEBUG(logger, \"Subscribing to ");
_builder.append(attributeName, " ");
_builder.append(".\");");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("QString attributeName = \"");
_builder.append(attributeName, " ");
_builder.append("\";");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("joynr::MessagingQos clonedMessagingQos(qosSettings);");
_builder.newLine();
_builder.append(" ");
_builder.append("if (subscriptionQos->getExpiryDate() == joynr::SubscriptionQos::NO_EXPIRY_DATE()) {");
_builder.newLine();
_builder.append(" ");
_builder.append("clonedMessagingQos.setTtl(joynr::SubscriptionQos::NO_EXPIRY_DATE_TTL());");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append(" ");
_builder.append("else{");
_builder.newLine();
_builder.append(" ");
_builder.append("clonedMessagingQos.setTtl(subscriptionQos->getExpiryDate() - QDateTime::currentMSecsSinceEpoch());");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_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;");
_builder.newLine();
_builder.append(" ");
_builder.append("subscriptionManager->registerSubscription(");
_builder.newLine();
_builder.append(" ");
_builder.append("attributeName,");
_builder.newLine();
_builder.append(" ");
_builder.append("subscriptionCallback,");
_builder.newLine();
_builder.append(" ");
_builder.append("subscriptionQos,");
_builder.newLine();
_builder.append(" ");
_builder.append("subscriptionRequest);");
_builder.newLine();
_builder.append(" ");
_builder.append("LOG_DEBUG(logger, subscriptionRequest.toQString());");
_builder.newLine();
_builder.append(" ");
_builder.append("joynrMessageSender->sendSubscriptionRequest(");
_builder.newLine();
_builder.append(" ");
_builder.append("proxyParticipantId,");
_builder.newLine();
_builder.append(" ");
_builder.append("providerParticipantId,");
_builder.newLine();
_builder.append(" ");
_builder.append("clonedMessagingQos,");
_builder.newLine();
_builder.append(" ");
_builder.append("subscriptionRequest");
_builder.newLine();
_builder.append(" ");
_builder.append(");");
_builder.newLine();
_builder.append(" ");
_builder.append("return subscriptionRequest.getSubscriptionId();");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::unsubscribeFrom");
String _firstUpper_17 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_17, "");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("QString& subscriptionId");
_builder.newLine();
_builder.append(") {");
_builder.newLine();
_builder.append(" ");
_builder.append("joynr::SubscriptionStop subscriptionStop;");
_builder.newLine();
_builder.append(" ");
_builder.append("subscriptionStop.setSubscriptionId(subscriptionId);");
_builder.newLine();
_builder.append(" ");
_builder.newLine();
_builder.append(" ");
_builder.append("subscriptionManager->unregisterSubscription(subscriptionId);");
_builder.newLine();
_builder.append(" ");
_builder.append("joynrMessageSender->sendSubscriptionStop(");
_builder.newLine();
_builder.append(" ");
_builder.append("proxyParticipantId,");
_builder.newLine();
_builder.append(" ");
_builder.append("providerParticipantId,");
_builder.newLine();
_builder.append(" ");
_builder.append("qosSettings,");
_builder.newLine();
_builder.append(" ");
_builder.append("subscriptionStop");
_builder.newLine();
_builder.append(" ");
_builder.append(");");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
}
}
{
EList _methods = this._joynrCppGeneratorExtensions.getMethods(serviceInterface);
for(final FMethod method : _methods) {
_builder.append("\t\t ");
final Iterable outputParameter = this._joynrCppGeneratorExtensions.getMappedOutputParameter(method);
_builder.newLineIfNotEmpty();
_builder.append("\t\t ");
final String methodName = this._joynrCppGeneratorExtensions.joynrName(method);
_builder.newLineIfNotEmpty();
{
String _head = IterableExtensions.head(outputParameter);
boolean _equals = Objects.equal(_head, "void");
if (_equals) {
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::");
_builder.append(methodName, "");
_builder.append("(joynr::RequestStatus& status");
String _commaSeperatedTypedParameterList = this._joynrCppGeneratorExtensions.getCommaSeperatedTypedParameterList(method);
String _prependCommaIfNotEmpty = this._joynrCppGeneratorExtensions.prependCommaIfNotEmpty(_commaSeperatedTypedParameterList);
_builder.append(_prependCommaIfNotEmpty, "");
_builder.append(") {");
_builder.newLineIfNotEmpty();
_builder.append(" ");
CharSequence _produceParameterSetters = this.produceParameterSetters(method);
_builder.append(_produceParameterSetters, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("QSharedPointerhead(outputParameter);
_builder.append(_head_1, " ");
_builder.append("> > future = QSharedPointerhead(outputParameter);
_builder.append(_head_2, " ");
_builder.append("> >(new joynr::Future<");
String _head_3 = IterableExtensions.head(outputParameter);
_builder.append(_head_3, " ");
_builder.append(">());");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller<");
String _head_4 = IterableExtensions.head(outputParameter);
_builder.append(_head_4, " ");
_builder.append(">(future));");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("operationRequest(status, replyCaller, internalRequestObject);");
_builder.newLine();
_builder.append(" ");
_builder.append("status = future->waitForFinished();");
_builder.newLine();
_builder.append("}");
_builder.newLine();
} else {
_builder.append("void ");
_builder.append(interfaceName, "");
_builder.append("JoynrMessagingConnector::");
_builder.append(methodName, "");
_builder.append("(joynr::RequestStatus& status, ");
String _commaSeperatedTypedOutputParameterList = this._joynrCppGeneratorExtensions.getCommaSeperatedTypedOutputParameterList(method);
_builder.append(_commaSeperatedTypedOutputParameterList, "");
String _commaSeperatedTypedParameterList_1 = this._joynrCppGeneratorExtensions.getCommaSeperatedTypedParameterList(method);
String _prependCommaIfNotEmpty_1 = this._joynrCppGeneratorExtensions.prependCommaIfNotEmpty(_commaSeperatedTypedParameterList_1);
_builder.append(_prependCommaIfNotEmpty_1, "");
_builder.append(") {");
_builder.newLineIfNotEmpty();
_builder.append(" ");
CharSequence _produceParameterSetters_1 = this.produceParameterSetters(method);
_builder.append(_produceParameterSetters_1, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("QSharedPointerhead(outputParameter);
_builder.append(_head_5, " ");
_builder.append("> > future = QSharedPointerhead(outputParameter);
_builder.append(_head_6, " ");
_builder.append("> >(new joynr::Future<");
String _head_7 = IterableExtensions.head(outputParameter);
_builder.append(_head_7, " ");
_builder.append(">());");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller<");
String _head_8 = IterableExtensions.head(outputParameter);
_builder.append(_head_8, " ");
_builder.append(">(future));");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("operationRequest(status, replyCaller, internalRequestObject);");
_builder.newLine();
_builder.append(" ");
_builder.append("status = future->waitForFinished();");
_builder.newLine();
_builder.append(" ");
_builder.append("if (status.successful()) {");
_builder.newLine();
_builder.append(" ");
Iterable _outputParameters = this._joynrCppGeneratorExtensions.getOutputParameters(method);
FArgument _head_9 = IterableExtensions.head(_outputParameters);
String _joynrName = this._joynrCppGeneratorExtensions.joynrName(_head_9);
_builder.append(_joynrName, " ");
_builder.append(" = future->getValue();");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
}
}
_builder.newLine();
_builder.append("\t\t ");
_builder.append("void ");
_builder.append(interfaceName, " ");
_builder.append("JoynrMessagingConnector::");
_builder.append(methodName, " ");
_builder.append("(QSharedPointerhead(outputParameter);
_builder.append(_head_10, " ");
_builder.append("> > future, QSharedPointer< joynr::ICallback<");
String _head_11 = IterableExtensions.head(outputParameter);
_builder.append(_head_11, " ");
_builder.append("> > callback ");
String _commaSeperatedTypedParameterList_2 = this._joynrCppGeneratorExtensions.getCommaSeperatedTypedParameterList(method);
String _prependCommaIfNotEmpty_2 = this._joynrCppGeneratorExtensions.prependCommaIfNotEmpty(_commaSeperatedTypedParameterList_2);
_builder.append(_prependCommaIfNotEmpty_2, " ");
_builder.append("){");
_builder.newLineIfNotEmpty();
_builder.append("\t\t ");
CharSequence _produceParameterSetters_2 = this.produceParameterSetters(method);
_builder.append(_produceParameterSetters_2, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t\t ");
_builder.append("assert(!future.isNull());");
_builder.newLine();
_builder.append("\t\t ");
_builder.append("future->setCallback(callback);");
_builder.newLine();
_builder.append("\t\t ");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller<");
String _head_12 = IterableExtensions.head(outputParameter);
_builder.append(_head_12, " ");
_builder.append(">(future));");
_builder.newLineIfNotEmpty();
_builder.append("\t\t ");
_builder.append("operationRequest(future->getStatus(), replyCaller, internalRequestObject);");
_builder.newLine();
_builder.append("\t\t ");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t\t ");
_builder.append("void ");
_builder.append(interfaceName, " ");
_builder.append("JoynrMessagingConnector::");
_builder.append(methodName, " ");
_builder.append("(QSharedPointerhead(outputParameter);
_builder.append(_head_13, " ");
_builder.append("> > future ");
String _commaSeperatedTypedParameterList_3 = this._joynrCppGeneratorExtensions.getCommaSeperatedTypedParameterList(method);
String _prependCommaIfNotEmpty_3 = this._joynrCppGeneratorExtensions.prependCommaIfNotEmpty(_commaSeperatedTypedParameterList_3);
_builder.append(_prependCommaIfNotEmpty_3, " ");
_builder.append(") {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t ");
CharSequence _produceParameterSetters_3 = this.produceParameterSetters(method);
_builder.append(_produceParameterSetters_3, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t\t ");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller<");
String _head_14 = IterableExtensions.head(outputParameter);
_builder.append(_head_14, " ");
_builder.append(">(future));");
_builder.newLineIfNotEmpty();
_builder.append("\t\t ");
_builder.append("operationRequest(future->getStatus(), replyCaller, internalRequestObject);");
_builder.newLine();
_builder.append("\t\t ");
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("\t\t ");
_builder.append("void ");
_builder.append(interfaceName, " ");
_builder.append("JoynrMessagingConnector::");
_builder.append(methodName, " ");
_builder.append("(QSharedPointer< joynr::ICallback<");
String _head_15 = IterableExtensions.head(outputParameter);
_builder.append(_head_15, " ");
_builder.append("> > callback");
String _commaSeperatedTypedParameterList_4 = this._joynrCppGeneratorExtensions.getCommaSeperatedTypedParameterList(method);
String _prependCommaIfNotEmpty_4 = this._joynrCppGeneratorExtensions.prependCommaIfNotEmpty(_commaSeperatedTypedParameterList_4);
_builder.append(_prependCommaIfNotEmpty_4, " ");
_builder.append(") {");
_builder.newLineIfNotEmpty();
_builder.append("\t\t ");
CharSequence _produceParameterSetters_4 = this.produceParameterSetters(method);
_builder.append(_produceParameterSetters_4, " ");
_builder.newLineIfNotEmpty();
_builder.append("\t\t ");
_builder.append("QSharedPointer replyCaller = QSharedPointer(new joynr::ReplyCaller<");
String _head_16 = IterableExtensions.head(outputParameter);
_builder.append(_head_16, " ");
_builder.append(">(callback));");
_builder.newLineIfNotEmpty();
_builder.append("\t\t ");
_builder.append("joynr::RequestStatus status(joynr::RequestStatusCode::NOT_STARTED);");
_builder.newLine();
_builder.append("\t\t ");
_builder.append("operationRequest(status, replyCaller, internalRequestObject);");
_builder.newLine();
_builder.append("\t\t ");
_builder.append("}");
_builder.newLine();
_builder.newLine();
}
}
String _namespaceEnder = this._joynrCppGeneratorExtensions.getNamespaceEnder(serviceInterface);
_builder.append(_namespaceEnder, "");
_builder.newLineIfNotEmpty();
_xblockexpression = (_builder);
}
return _xblockexpression;
}
}