All Downloads are FREE. Search and download functionalities are using the official Maven repository.
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.InterfaceSyncProxyHTemplate Maven / Gradle / Ivy
package io.joynr.generator.cpp.proxy;
import com.google.inject.Inject;
import io.joynr.generator.cpp.util.CppInterfaceUtil;
import io.joynr.generator.cpp.util.CppStdTypeUtil;
import io.joynr.generator.cpp.util.JoynrCppGeneratorExtensions;
import io.joynr.generator.cpp.util.TemplateBase;
import io.joynr.generator.templates.InterfaceTemplate;
import io.joynr.generator.templates.util.NamingUtil;
import java.util.Set;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Extension;
@SuppressWarnings("all")
public class InterfaceSyncProxyHTemplate extends InterfaceTemplate {
@Inject
@Extension
private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
@Inject
@Extension
private TemplateBase _templateBase;
@Inject
@Extension
private CppStdTypeUtil _cppStdTypeUtil;
@Inject
@Extension
private CppInterfaceUtil _cppInterfaceUtil;
@Inject
@Extension
private NamingUtil _namingUtil;
@Override
public CharSequence generate(final boolean generateVersion) {
StringConcatenation _builder = new StringConcatenation();
final String interfaceName = this._namingUtil.joynrName(this.francaIntf);
_builder.newLineIfNotEmpty();
final String className = (interfaceName + "Proxy");
_builder.newLineIfNotEmpty();
final String syncClassName = (interfaceName + "SyncProxy");
_builder.newLineIfNotEmpty();
String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, "_", generateVersion);
String _plus = ("GENERATED_INTERFACE_" + _packagePathWithJoynrPrefix);
String _plus_1 = (_plus +
"_");
String _plus_2 = (_plus_1 + interfaceName);
final String headerGuard = (_plus_2 + "SyncProxy_h").toUpperCase();
_builder.newLineIfNotEmpty();
CharSequence _warning = this._templateBase.warning();
_builder.append(_warning);
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("#ifndef ");
_builder.append(headerGuard);
_builder.newLineIfNotEmpty();
_builder.append("#define ");
_builder.append(headerGuard);
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("#include \"joynr/PrivateCopyAssign.h\"");
_builder.newLine();
_builder.append("#include \"");
String _packagePathWithJoynrPrefix_1 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, "/", generateVersion);
_builder.append(_packagePathWithJoynrPrefix_1);
_builder.append("/");
_builder.append(className);
_builder.append("Base.h\"");
_builder.newLineIfNotEmpty();
{
boolean _hasFireAndForgetMethods = this._cppInterfaceUtil.hasFireAndForgetMethods(this.francaIntf);
if (_hasFireAndForgetMethods) {
_builder.append("#include \"");
String _packagePathWithJoynrPrefix_2 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(this.francaIntf, "/", generateVersion);
_builder.append(_packagePathWithJoynrPrefix_2);
_builder.append("/");
_builder.append(interfaceName);
_builder.append("FireAndForgetProxy.h\"");
_builder.newLineIfNotEmpty();
}
}
_builder.newLine();
{
Set _addElements = this._cppStdTypeUtil.addElements(this._cppStdTypeUtil.getDataTypeIncludesFor(this.francaIntf, generateVersion), this._cppStdTypeUtil.getIncludeForString());
for(final String parameterType : _addElements) {
_builder.append("#include ");
_builder.append(parameterType);
_builder.newLineIfNotEmpty();
}
}
_builder.newLine();
_builder.append("#include ");
_builder.newLine();
_builder.newLine();
String _namespaceStarter = this._joynrCppGeneratorExtensions.getNamespaceStarter(this.francaIntf, generateVersion);
_builder.append(_namespaceStarter);
_builder.newLineIfNotEmpty();
_builder.append("/**");
_builder.newLine();
_builder.append(" ");
_builder.append("* @brief Synchronous proxy for interface ");
_builder.append(interfaceName, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("*");
_builder.newLine();
_builder.append(" ");
_builder.append("* @version ");
_builder.append(this.majorVersion, " ");
_builder.append(".");
_builder.append(this.minorVersion, " ");
_builder.newLineIfNotEmpty();
_builder.append(" ");
_builder.append("*/");
_builder.newLine();
_builder.append("class ");
_builder.append(syncClassName);
_builder.append(" :");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("virtual public ");
_builder.append(className, "\t\t");
_builder.append("Base,");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("virtual public I");
_builder.append(interfaceName, "\t\t");
_builder.append("Sync");
{
boolean _hasFireAndForgetMethods_1 = this._cppInterfaceUtil.hasFireAndForgetMethods(this.francaIntf);
if (_hasFireAndForgetMethods_1) {
_builder.append(",");
_builder.newLineIfNotEmpty();
_builder.append("\t\t");
_builder.append("virtual public ");
_builder.append(interfaceName, "\t\t");
_builder.append("FireAndForgetProxy");
}
}
_builder.newLineIfNotEmpty();
_builder.append("{");
_builder.newLine();
_builder.append("public:");
_builder.newLine();
_builder.append("\t");
_builder.append("/**");
_builder.newLine();
_builder.append("\t ");
_builder.append("* @brief Parameterized constructor");
_builder.newLine();
_builder.append("\t ");
_builder.append("* @param connectorFactory The connector factory");
_builder.newLine();
_builder.append("\t ");
_builder.append("* @param domain The provider domain");
_builder.newLine();
_builder.append("\t ");
_builder.append("* @param qosSettings The quality of service settings");
_builder.newLine();
_builder.append("\t ");
_builder.append("*/");
_builder.newLine();
_builder.append("\t");
_builder.append(syncClassName, "\t");
_builder.append("(");
_builder.newLineIfNotEmpty();
_builder.append("\t\t\t");
_builder.append("std::weak_ptr runtime,");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("std::shared_ptr connectorFactory,");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("const std::string& domain,");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("const joynr::MessagingQos& qosSettings");
_builder.newLine();
_builder.append("\t");
_builder.append(");");
_builder.newLine();
_builder.newLine();
_builder.append("\t");
CharSequence _produceSyncGetterDeclarations = this._cppInterfaceUtil.produceSyncGetterDeclarations(this.francaIntf, false, generateVersion);
_builder.append(_produceSyncGetterDeclarations, "\t");
_builder.newLineIfNotEmpty();
_builder.append("\t");
CharSequence _produceSyncSetterDeclarations = this._cppInterfaceUtil.produceSyncSetterDeclarations(this.francaIntf, false, generateVersion);
_builder.append(_produceSyncSetterDeclarations, "\t");
_builder.newLineIfNotEmpty();
_builder.append("\t");
CharSequence _produceSyncMethodDeclarations = this._cppInterfaceUtil.produceSyncMethodDeclarations(this.francaIntf, false, generateVersion);
_builder.append(_produceSyncMethodDeclarations, "\t");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("\t");
_builder.append("friend class ");
_builder.append(className, "\t");
_builder.append(";");
_builder.newLineIfNotEmpty();
_builder.newLine();
_builder.append("private:");
_builder.newLine();
_builder.append("\t");
_builder.append("DISALLOW_COPY_AND_ASSIGN(");
_builder.append(syncClassName, "\t");
_builder.append(");");
_builder.newLineIfNotEmpty();
_builder.append("};");
_builder.newLine();
String _namespaceEnder = this._joynrCppGeneratorExtensions.getNamespaceEnder(this.francaIntf, generateVersion);
_builder.append(_namespaceEnder);
_builder.newLineIfNotEmpty();
_builder.append("#endif // ");
_builder.append(headerGuard);
_builder.newLineIfNotEmpty();
return _builder;
}
}