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.proxy.InterfaceProxyBaseCppTemplate Maven / Gradle / Ivy
package io.joynr.generator.cpp.proxy;
import com.google.inject.Inject;
import io.joynr.generator.cpp.util.InterfaceSubscriptionUtil;
import io.joynr.generator.cpp.util.JoynrCppGeneratorExtensions;
import io.joynr.generator.cpp.util.TemplateBase;
import io.joynr.generator.templates.InterfaceTemplate;
import io.joynr.generator.templates.util.AttributeUtil;
import io.joynr.generator.templates.util.InterfaceUtil;
import io.joynr.generator.templates.util.NamingUtil;
import org.eclipse.emf.common.util.EList;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.StringExtensions;
import org.franca.core.franca.FAttribute;
import org.franca.core.franca.FBroadcast;
@SuppressWarnings("all")
public class InterfaceProxyBaseCppTemplate extends InterfaceTemplate {
@Inject
@Extension
private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
@Inject
@Extension
private TemplateBase _templateBase;
@Inject
@Extension
private InterfaceSubscriptionUtil _interfaceSubscriptionUtil;
@Inject
@Extension
private NamingUtil _namingUtil;
@Inject
@Extension
private AttributeUtil _attributeUtil;
@Inject
@Extension
private InterfaceUtil _interfaceUtil;
@Override
public CharSequence generate(final boolean generateVersion) {
StringConcatenation _builder = new StringConcatenation();
final String serviceName = this._namingUtil.joynrName(this.francaIntf);
_builder.newLineIfNotEmpty();
final String className = (serviceName + "ProxyBase");
_builder.newLineIfNotEmpty();
CharSequence _warning = this._templateBase.warning();
_builder.append(_warning);
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("#include \"");
String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, "/", generateVersion);
_builder.append(_packagePathWithJoynrPrefix);
_builder.append("/");
_builder.append(className);
_builder.append(".h\"");
_builder.newLineIfNotEmpty();
_builder.append("#include \"joynr/ISubscriptionListener.h\"");
_builder.newLine();
_builder.append("#include \"joynr/types/DiscoveryEntryWithMetaInfo.h\"");
_builder.newLine();
_builder.append("#include \"joynr/JoynrMessagingConnectorFactory.h\"");
_builder.newLine();
_builder.append("#include \"");
String _packagePathWithJoynrPrefix_1 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, "/", generateVersion);
_builder.append(_packagePathWithJoynrPrefix_1);
_builder.append("/");
_builder.append(serviceName);
_builder.append("JoynrMessagingConnector.h\"");
_builder.newLineIfNotEmpty();
_builder.newLine();
String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(this.francaIntf, generateVersion);
_builder.append(_namespaceStarter);
_builder.newLineIfNotEmpty();
_builder.append(className);
_builder.append("::");
_builder.append(className);
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("std::weak_ptr runtime,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("std::shared_ptr connectorFactory,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("const std::string &domain,");
_builder.newLine();
_builder.append("\t\t");
_builder.append("const joynr::MessagingQos &qosSettings");
_builder.newLine();
_builder.append(") :");
_builder.newLine();
_builder.append("\t\t");
_builder.append("joynr::ProxyBase(std::move(runtime), std::move(connectorFactory), domain, qosSettings),");
_builder.newLine();
_builder.append("\t\t");
_builder.append("connector()");
_builder.newLine();
_builder.append("{");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
_builder.append("void ");
_builder.append(className);
_builder.append("::handleArbitrationFinished(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("const joynr::types::DiscoveryEntryWithMetaInfo& providerDiscoveryEntry");
_builder.newLine();
_builder.append(") {");
_builder.newLine();
_builder.append("\t");
_builder.append("connector = _connectorFactory->create<");
String _packagePathWithJoynrPrefix_2 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, "::", generateVersion);
_builder.append(_packagePathWithJoynrPrefix_2, "\t");
_builder.append("::I");
_builder.append(serviceName, "\t");
_builder.append("Connector>(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t");
_builder.append("_domain,");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("_proxyParticipantId,");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("_qosSettings,");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("providerDiscoveryEntry");
_builder.newLine();
_builder.append("\t");
_builder.append(");");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
_builder.append("joynr::ProxyBase::handleArbitrationFinished(providerDiscoveryEntry);");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
{
final Function1 _function = new Function1() {
@Override
public Boolean apply(final FAttribute attribute) {
return Boolean.valueOf(InterfaceProxyBaseCppTemplate.this._attributeUtil.isNotifiable(attribute));
}
};
Iterable _filter = IterableExtensions.filter(this._interfaceUtil.getAttributes(this.francaIntf), _function);
for(final FAttribute attribute : _filter) {
String attributeName = this._namingUtil.joynrName(attribute);
_builder.newLineIfNotEmpty();
CharSequence _produceUnsubscribeFromAttributeSignature = this._interfaceSubscriptionUtil.produceUnsubscribeFromAttributeSignature(attribute, className);
_builder.append(_produceUnsubscribeFromAttributeSignature);
_builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("auto runtimeSharedPtr = _runtime.lock();");
_builder.newLine();
_builder.append("\t");
_builder.append("if (!runtimeSharedPtr || !connector) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("if (!runtimeSharedPtr) {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("JOYNR_LOG_WARN(logger(), \"proxy cannot unsubscribe from ");
_builder.append(className, "\t\t\t");
_builder.append(".");
_builder.append(attributeName, "\t\t\t");
_builder.append(", \"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t\t ");
_builder.append("\"because the required runtime has been already destroyed.\");");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("return;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("} else {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("JOYNR_LOG_WARN(logger(), \"proxy cannot unsubscribe from ");
_builder.append(className, "\t\t\t");
_builder.append(".");
_builder.append(attributeName, "\t\t\t");
_builder.append(", \"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t\t ");
_builder.append("\"because the communication end partner is not (yet) known\");");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("return;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("connector->unsubscribeFrom");
String _firstUpper = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper, "\t");
_builder.append("(subscriptionId);");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
_builder.newLine();
CharSequence _produceUpdateAttributeSubscriptionSignature = this._interfaceSubscriptionUtil.produceUpdateAttributeSubscriptionSignature(attribute, className, generateVersion);
_builder.append(_produceUpdateAttributeSubscriptionSignature);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("auto runtimeSharedPtr = _runtime.lock();");
_builder.newLine();
_builder.append("\t");
_builder.append("if (!runtimeSharedPtr || !connector) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("std::string errorMsg;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("if (!runtimeSharedPtr) {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("errorMsg = \"proxy cannot subscribe to ");
_builder.append(className, "\t\t\t");
_builder.append(".");
_builder.append(attributeName, "\t\t\t");
_builder.append(", \"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t\t");
_builder.append("\"because the required runtime has been already destroyed.\";");
_builder.newLine();
_builder.append("\t\t");
_builder.append("} else {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("errorMsg = \"proxy cannot subscribe to ");
_builder.append(className, "\t\t\t");
_builder.append(".");
_builder.append(attributeName, "\t\t\t");
_builder.append(", \"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t\t");
_builder.append("\"because the communication end partner is not (yet) known\";");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("JOYNR_LOG_WARN(logger(), errorMsg);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("auto error = std::make_shared(errorMsg);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("auto future = std::make_shared>();");
_builder.newLine();
_builder.append("\t\t");
_builder.append("future->onError(error);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("subscriptionListener->onError(*error);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return future;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("return connector->subscribeTo");
String _firstUpper_1 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_1, "\t");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t");
_builder.append("subscriptionListener,");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("subscriptionQos,");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("subscriptionId);");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
CharSequence _produceSubscribeToAttributeSignature = this._interfaceSubscriptionUtil.produceSubscribeToAttributeSignature(attribute, className, generateVersion);
_builder.append(_produceSubscribeToAttributeSignature);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("auto runtimeSharedPtr = _runtime.lock();");
_builder.newLine();
_builder.append("\t");
_builder.append("if (!runtimeSharedPtr || !connector) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("std::string errorMsg;");
_builder.newLine();
_builder.append("\t\t");
_builder.append("if (!runtimeSharedPtr) {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("errorMsg = \"proxy cannot subscribe to ");
_builder.append(className, "\t\t\t");
_builder.append(".");
_builder.append(attributeName, "\t\t\t");
_builder.append(", \"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t\t ");
_builder.append("\"because the required runtime has been already destroyed.\";");
_builder.newLine();
_builder.append("\t\t");
_builder.append("} else {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("errorMsg = \"proxy cannot subscribe to ");
_builder.append(className, "\t\t\t");
_builder.append(".");
_builder.append(attributeName, "\t\t\t");
_builder.append(", \"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t\t ");
_builder.append("\"because the communication end partner is not (yet) known\";");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("JOYNR_LOG_WARN(logger(), errorMsg);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("auto error = std::make_shared(errorMsg);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("auto future = std::make_shared>();");
_builder.newLine();
_builder.append("\t\t");
_builder.append("future->onError(error);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("subscriptionListener->onError(*error);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return future;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("return connector->subscribeTo");
String _firstUpper_2 = StringExtensions.toFirstUpper(attributeName);
_builder.append(_firstUpper_2, "\t");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t");
_builder.append("subscriptionListener,");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("subscriptionQos);");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
}
}
_builder.newLine();
{
EList _broadcasts = this.francaIntf.getBroadcasts();
for(final FBroadcast broadcast : _broadcasts) {
String broadcastName = this._namingUtil.joynrName(broadcast);
_builder.newLineIfNotEmpty();
CharSequence _produceUnsubscribeFromBroadcastSignature = this._interfaceSubscriptionUtil.produceUnsubscribeFromBroadcastSignature(broadcast, className);
_builder.append(_produceUnsubscribeFromBroadcastSignature);
_builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("\t");
_builder.append("auto runtimeSharedPtr = _runtime.lock();");
_builder.newLine();
_builder.append("\t");
_builder.append("if (!runtimeSharedPtr) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("JOYNR_LOG_WARN(logger(), \"proxy cannot unsubscribe from ");
_builder.append(className, "\t\t");
_builder.append(".");
_builder.append(broadcastName, "\t\t");
_builder.append(" broadcast, \"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t ");
_builder.append("\"because the required runtime has been already destroyed.\");");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("if (!connector){");
_builder.newLine();
_builder.append("\t\t");
_builder.append("JOYNR_LOG_WARN(logger(), \"proxy cannot unsubscribe from ");
_builder.append(className, "\t\t");
_builder.append(".");
_builder.append(broadcastName, "\t\t");
_builder.append(" broadcast, \"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t ");
_builder.append("\"because the communication end partner is not (yet) known\");");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("connector->unsubscribeFrom");
String _firstUpper_3 = StringExtensions.toFirstUpper(broadcastName);
_builder.append(_firstUpper_3, "\t");
_builder.append("Broadcast(subscriptionId);");
_builder.newLineIfNotEmpty();
_builder.append("}");
_builder.newLine();
_builder.newLine();
CharSequence _produceSubscribeToBroadcastSignature = this._interfaceSubscriptionUtil.produceSubscribeToBroadcastSignature(broadcast, this.francaIntf, className, generateVersion);
_builder.append(_produceSubscribeToBroadcastSignature);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("std::string errorMsg;");
_builder.newLine();
_builder.append("\t");
_builder.append("auto runtimeSharedPtr = _runtime.lock();");
_builder.newLine();
_builder.append("\t");
_builder.append("if (!runtimeSharedPtr) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("errorMsg = \"proxy cannot subscribe to ");
_builder.append(className, "\t\t");
_builder.append(".");
_builder.append(broadcastName, "\t\t");
_builder.append(" broadcast, \"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t ");
_builder.append("\"because the required runtime has been already destroyed.\";");
_builder.newLine();
_builder.append("\t\t");
_builder.append("JOYNR_LOG_WARN(logger(), errorMsg);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("auto error = std::make_shared(errorMsg);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("auto future = std::make_shared>();");
_builder.newLine();
_builder.append("\t\t");
_builder.append("future->onError(error);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("subscriptionListener->onError(*error);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return future;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("if (!connector){");
_builder.newLine();
_builder.append("\t\t");
_builder.append("errorMsg = \"proxy cannot subscribe to ");
_builder.append(className, "\t\t");
_builder.append(".");
_builder.append(broadcastName, "\t\t");
_builder.append(" broadcast, \"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("\"because the communication end partner is not (yet) known\";");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
{
boolean _isSelective = broadcast.isSelective();
boolean _not = (!_isSelective);
if (_not) {
_builder.append("\t");
_builder.append("try {");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("util::validatePartitions(partitions, true);");
_builder.newLine();
_builder.append("\t");
_builder.append("} catch (const std::invalid_argument& exception) {");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("errorMsg = \"invalid argument:\\n\" + std::string(exception.what());");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
}
}
_builder.newLine();
_builder.append("\t");
_builder.append("if (!errorMsg.empty()) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("JOYNR_LOG_WARN(logger(), errorMsg);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("auto error = std::make_shared(errorMsg);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("auto future = std::make_shared>();");
_builder.newLine();
_builder.append("\t\t");
_builder.append("future->onError(error);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("subscriptionListener->onError(*error);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return future;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
{
boolean _isSelective_1 = broadcast.isSelective();
if (_isSelective_1) {
_builder.append("\t");
_builder.append("return connector->subscribeTo");
String _firstUpper_4 = StringExtensions.toFirstUpper(broadcastName);
_builder.append(_firstUpper_4, "\t");
_builder.append("Broadcast(");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("filterParameters,");
_builder.newLine();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("subscriptionListener,");
_builder.newLine();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("subscriptionQos);");
_builder.newLine();
} else {
_builder.append("\t");
_builder.append("return connector->subscribeTo");
String _firstUpper_5 = StringExtensions.toFirstUpper(broadcastName);
_builder.append(_firstUpper_5, "\t");
_builder.append("Broadcast(");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("subscriptionListener,");
_builder.newLine();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("subscriptionQos,");
_builder.newLine();
_builder.append("\t");
_builder.append("\t\t");
_builder.append("partitions);");
_builder.newLine();
}
}
_builder.append("}");
_builder.newLine();
_builder.newLine();
CharSequence _produceUpdateBroadcastSubscriptionSignature = this._interfaceSubscriptionUtil.produceUpdateBroadcastSubscriptionSignature(broadcast, this.francaIntf, className, generateVersion);
_builder.append(_produceUpdateBroadcastSubscriptionSignature);
_builder.append(" {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("std::string errorMsg;");
_builder.newLine();
_builder.append("\t");
_builder.append("auto runtimeSharedPtr = _runtime.lock();");
_builder.newLine();
_builder.append("\t");
_builder.append("if (!runtimeSharedPtr) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("errorMsg = \"proxy cannot subscribe to ");
_builder.append(className, "\t\t");
_builder.append(".");
_builder.append(broadcastName, "\t\t");
_builder.append(" broadcast, \"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t\t ");
_builder.append("\"because the required runtime has been already destroyed.\";");
_builder.newLine();
_builder.append("\t\t");
_builder.append("JOYNR_LOG_WARN(logger(), errorMsg);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("auto error = std::make_shared(errorMsg);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("auto future = std::make_shared>();");
_builder.newLine();
_builder.append("\t\t");
_builder.append("future->onError(error);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("subscriptionListener->onError(*error);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return future;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("if (!connector){");
_builder.newLine();
_builder.append("\t\t");
_builder.append("errorMsg = \"proxy cannot subscribe to ");
_builder.append(className, "\t\t");
_builder.append(".");
_builder.append(broadcastName, "\t\t");
_builder.append(" broadcast, \"");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("\"because the communication end partner is not (yet) known\";");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
{
boolean _isSelective_2 = broadcast.isSelective();
boolean _not_1 = (!_isSelective_2);
if (_not_1) {
_builder.append("\t");
_builder.append("try {");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("util::validatePartitions(partitions, true);");
_builder.newLine();
_builder.append("\t");
_builder.append("} catch (const std::invalid_argument& exception) {");
_builder.newLine();
_builder.append("\t");
_builder.append("\t");
_builder.append("errorMsg = \"invalid argument:\\n\" + std::string(exception.what());");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
}
}
_builder.append("\t");
_builder.append("if (!errorMsg.empty()) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("JOYNR_LOG_WARN(logger(), errorMsg);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("auto error = std::make_shared(errorMsg);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("auto future = std::make_shared>();");
_builder.newLine();
_builder.append("\t\t");
_builder.append("future->onError(error);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("subscriptionListener->onError(*error);");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return future;");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.newLine();
{
boolean _isSelective_3 = broadcast.isSelective();
if (_isSelective_3) {
_builder.append("\t");
_builder.append("return connector->subscribeTo");
String _firstUpper_6 = StringExtensions.toFirstUpper(broadcastName);
_builder.append(_firstUpper_6, "\t");
_builder.append("Broadcast(");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t\t\t");
_builder.append("subscriptionId,");
_builder.newLine();
_builder.append("\t");
_builder.append("\t\t\t");
_builder.append("filterParameters,");
_builder.newLine();
_builder.append("\t");
_builder.append("\t\t\t");
_builder.append("subscriptionListener,");
_builder.newLine();
_builder.append("\t");
_builder.append("\t\t\t");
_builder.append("subscriptionQos);");
_builder.newLine();
} else {
_builder.append("\t");
_builder.append("return connector->subscribeTo");
String _firstUpper_7 = StringExtensions.toFirstUpper(broadcastName);
_builder.append(_firstUpper_7, "\t");
_builder.append("Broadcast(");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("\t\t\t");
_builder.append("subscriptionId,");
_builder.newLine();
_builder.append("\t");
_builder.append("\t\t\t");
_builder.append("subscriptionListener,");
_builder.newLine();
_builder.append("\t");
_builder.append("\t\t\t");
_builder.append("subscriptionQos,");
_builder.newLine();
_builder.append("\t");
_builder.append("\t\t\t");
_builder.append("partitions);");
_builder.newLine();
}
}
_builder.append("}");
_builder.newLine();
}
}
_builder.newLine();
String _namespaceEnder = this._joynrCppGeneratorExtensions.getNamespaceEnder(this.francaIntf, generateVersion);
_builder.append(_namespaceEnder);
_builder.newLineIfNotEmpty();
return _builder;
}
}