io.joynr.generator.cpp.provider.ProviderGenerator Maven / Gradle / Ivy
package io.joynr.generator.cpp.provider;
import com.google.inject.Inject;
import io.joynr.generator.cpp.provider.InterfaceAbstractProviderCppTemplate;
import io.joynr.generator.cpp.provider.InterfaceAbstractProviderHTemplate;
import io.joynr.generator.cpp.provider.InterfaceProviderCppTemplate;
import io.joynr.generator.cpp.provider.InterfaceProviderHTemplate;
import io.joynr.generator.cpp.provider.InterfaceRequestCallerCppTemplate;
import io.joynr.generator.cpp.provider.InterfaceRequestCallerHTemplate;
import io.joynr.generator.cpp.provider.InterfaceRequestInterpreterCppTemplate;
import io.joynr.generator.cpp.provider.InterfaceRequestInterpreterHTemplate;
import io.joynr.generator.cpp.util.JoynrCppGeneratorExtensions;
import java.io.File;
import org.eclipse.emf.common.util.EList;
import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.xbase.lib.Extension;
import org.franca.core.franca.FInterface;
import org.franca.core.franca.FModel;
@SuppressWarnings("all")
public class ProviderGenerator {
@Inject
@Extension
private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
@Inject
private InterfaceRequestCallerHTemplate interfaceRequestCallerH;
@Inject
private InterfaceRequestCallerCppTemplate interfaceRequestCallerCpp;
@Inject
private InterfaceRequestInterpreterHTemplate interfaceRequestInterpreterH;
@Inject
private InterfaceRequestInterpreterCppTemplate interfaceRequestInterpreterCpp;
@Inject
private InterfaceProviderCppTemplate interfaceProviderCppTemplate;
@Inject
private InterfaceProviderHTemplate interfaceProviderHTemplate;
@Inject
private InterfaceAbstractProviderCppTemplate interfaceAbstractProviderCppTemplate;
@Inject
private InterfaceAbstractProviderHTemplate interfaceAbstractProviderHTemplate;
public void doGenerate(final FModel model, final IFileSystemAccess sourceFileSystem, final IFileSystemAccess headerFileSystem, final String sourceContainerPath, final String headerContainerPath) {
EList _interfaces = model.getInterfaces();
for (final FInterface serviceInterface : _interfaces) {
{
String _packageSourceDirectory = this._joynrCppGeneratorExtensions.getPackageSourceDirectory(serviceInterface);
String _plus = (sourceContainerPath + _packageSourceDirectory);
final String sourcePath = (_plus + File.separator);
String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, File.separator);
String _plus_1 = (headerContainerPath + _packagePathWithJoynrPrefix);
final String headerPath = (_plus_1 + File.separator);
String serviceName = this._joynrCppGeneratorExtensions.joynrName(serviceInterface);
this._joynrCppGeneratorExtensions.generateFile(headerFileSystem,
((headerPath + serviceName) + "RequestInterpreter.h"),
this.interfaceRequestInterpreterH, serviceInterface);
this._joynrCppGeneratorExtensions.generateFile(sourceFileSystem,
((sourcePath + serviceName) + "RequestInterpreter.cpp"),
this.interfaceRequestInterpreterCpp, serviceInterface);
this._joynrCppGeneratorExtensions.generateFile(headerFileSystem,
((headerPath + serviceName) + "RequestCaller.h"),
this.interfaceRequestCallerH, serviceInterface);
this._joynrCppGeneratorExtensions.generateFile(sourceFileSystem,
((sourcePath + serviceName) + "RequestCaller.cpp"),
this.interfaceRequestCallerCpp, serviceInterface);
this._joynrCppGeneratorExtensions.generateFile(sourceFileSystem,
((sourcePath + serviceName) + "Provider.cpp"),
this.interfaceProviderCppTemplate, serviceInterface);
this._joynrCppGeneratorExtensions.generateFile(headerFileSystem,
((headerPath + serviceName) + "Provider.h"),
this.interfaceProviderHTemplate, serviceInterface);
this._joynrCppGeneratorExtensions.generateFile(sourceFileSystem,
((sourcePath + serviceName) + "AbstractProvider.cpp"),
this.interfaceAbstractProviderCppTemplate, serviceInterface);
this._joynrCppGeneratorExtensions.generateFile(headerFileSystem,
((headerPath + serviceName) + "AbstractProvider.h"),
this.interfaceAbstractProviderHTemplate, serviceInterface);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy