
io.joynr.generator.cpp.communicationmodel.CommunicationModelGenerator Maven / Gradle / Ivy
package io.joynr.generator.cpp.communicationmodel;
import com.google.common.base.Objects;
import com.google.inject.Inject;
import io.joynr.generator.cpp.communicationmodel.EnumHTemplate;
import io.joynr.generator.cpp.communicationmodel.InterfaceCppTemplate;
import io.joynr.generator.cpp.communicationmodel.InterfaceHTemplate;
import io.joynr.generator.cpp.communicationmodel.StdEnumCppTemplate;
import io.joynr.generator.cpp.communicationmodel.StdEnumHTemplate;
import io.joynr.generator.cpp.communicationmodel.StdTypeCppTemplate;
import io.joynr.generator.cpp.communicationmodel.StdTypeHTemplate;
import io.joynr.generator.cpp.communicationmodel.TypeCppTemplate;
import io.joynr.generator.cpp.communicationmodel.TypeHTemplate;
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.FCompoundType;
import org.franca.core.franca.FEnumerationType;
import org.franca.core.franca.FInterface;
import org.franca.core.franca.FModel;
import org.franca.core.franca.FType;
@SuppressWarnings("all")
public class CommunicationModelGenerator {
@Inject
@Extension
private JoynrCppGeneratorExtensions _joynrCppGeneratorExtensions;
@Inject
private InterfaceHTemplate interfaceH;
@Inject
private InterfaceCppTemplate interfaceCpp;
@Inject
private EnumHTemplate enumh;
@Inject
private StdEnumHTemplate stdEnumH;
@Inject
private StdEnumCppTemplate stdEnumCpp;
@Inject
private TypeHTemplate typeH;
@Inject
private TypeCppTemplate typeCpp;
@Inject
private StdTypeHTemplate stdTypeH;
@Inject
private StdTypeCppTemplate stdTypeCpp;
public void doGenerate(final FModel fModel, final IFileSystemAccess sourceFileSystem, final IFileSystemAccess headerFileSystem, final String sourceContainerPath, final String headerContainerPath) {
final String dataTypePath = ((sourceContainerPath + "datatypes") + File.separator);
String _xifexpression = null;
boolean _equals = Objects.equal(sourceFileSystem, headerFileSystem);
if (_equals) {
_xifexpression = ((headerContainerPath + "datatypes") + File.separator);
} else {
_xifexpression = headerContainerPath;
}
final String headerDataTypePath = _xifexpression;
Iterable _complexDataTypes = this._joynrCppGeneratorExtensions.getComplexDataTypes(fModel);
for (final FType type : _complexDataTypes) {
if ((type instanceof FCompoundType)) {
String _packageSourceDirectory = this._joynrCppGeneratorExtensions.getPackageSourceDirectory(type);
String _plus = (dataTypePath + _packageSourceDirectory);
String sourcepath = (_plus + File.separator);
String _packagePathWithJoynrPrefix = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(type, File.separator);
String _plus_1 = (headerDataTypePath + _packagePathWithJoynrPrefix);
String headerpath = (_plus_1 + File.separator);
String _joynrNameQt = this._joynrCppGeneratorExtensions.joynrNameQt(type);
String _plus_2 = (headerpath + _joynrNameQt);
String _plus_3 = (_plus_2 + ".h");
this._joynrCppGeneratorExtensions.generateFile(headerFileSystem, _plus_3,
this.typeH, ((FCompoundType)type));
String _joynrNameQt_1 = this._joynrCppGeneratorExtensions.joynrNameQt(type);
String _plus_4 = (sourcepath + _joynrNameQt_1);
String _plus_5 = (_plus_4 + ".cpp");
this._joynrCppGeneratorExtensions.generateFile(sourceFileSystem, _plus_5,
this.typeCpp, ((FCompoundType)type));
boolean _isPartOfTypeCollection = this._joynrCppGeneratorExtensions.isPartOfTypeCollection(type);
if (_isPartOfTypeCollection) {
String _headerpath = headerpath;
String _typeCollectionName = this._joynrCppGeneratorExtensions.getTypeCollectionName(type);
String _plus_6 = (_typeCollectionName + File.separator);
headerpath = (_headerpath + _plus_6);
String _sourcepath = sourcepath;
String _typeCollectionName_1 = this._joynrCppGeneratorExtensions.getTypeCollectionName(type);
String _plus_7 = (_typeCollectionName_1 + File.separator);
sourcepath = (_sourcepath + _plus_7);
}
String _joynrNameStd = this._joynrCppGeneratorExtensions.joynrNameStd(type);
String _plus_8 = (headerpath + _joynrNameStd);
String _plus_9 = (_plus_8 + ".h");
this._joynrCppGeneratorExtensions.generateFile(headerFileSystem, _plus_9,
this.stdTypeH, ((FCompoundType)type));
String _joynrNameStd_1 = this._joynrCppGeneratorExtensions.joynrNameStd(type);
String _plus_10 = (sourcepath + _joynrNameStd_1);
String _plus_11 = (_plus_10 + ".cpp");
this._joynrCppGeneratorExtensions.generateFile(sourceFileSystem, _plus_11,
this.stdTypeCpp, ((FCompoundType)type));
}
}
Iterable _enumDataTypes = this._joynrCppGeneratorExtensions.getEnumDataTypes(fModel);
for (final FType type_1 : _enumDataTypes) {
{
String _packageSourceDirectory_1 = this._joynrCppGeneratorExtensions.getPackageSourceDirectory(type_1);
String _plus_12 = (dataTypePath + _packageSourceDirectory_1);
String sourcepath_1 = (_plus_12 + File.separator);
String _packagePathWithJoynrPrefix_1 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(type_1, File.separator);
String _plus_13 = (headerDataTypePath + _packagePathWithJoynrPrefix_1);
String headerpath_1 = (_plus_13 + File.separator);
String _joynrNameQt_2 = this._joynrCppGeneratorExtensions.joynrNameQt(type_1);
String _plus_14 = (headerpath_1 + _joynrNameQt_2);
String _plus_15 = (_plus_14 + ".h");
this._joynrCppGeneratorExtensions.generateFile(headerFileSystem, _plus_15,
this.enumh,
((FEnumerationType) type_1));
boolean _isPartOfTypeCollection_1 = this._joynrCppGeneratorExtensions.isPartOfTypeCollection(type_1);
if (_isPartOfTypeCollection_1) {
String _headerpath_1 = headerpath_1;
String _typeCollectionName_2 = this._joynrCppGeneratorExtensions.getTypeCollectionName(type_1);
String _plus_16 = (_typeCollectionName_2 + File.separator);
headerpath_1 = (_headerpath_1 + _plus_16);
String _sourcepath_1 = sourcepath_1;
String _typeCollectionName_3 = this._joynrCppGeneratorExtensions.getTypeCollectionName(type_1);
String _plus_17 = (_typeCollectionName_3 + File.separator);
sourcepath_1 = (_sourcepath_1 + _plus_17);
}
String _joynrNameStd_2 = this._joynrCppGeneratorExtensions.joynrNameStd(type_1);
String _plus_18 = (headerpath_1 + _joynrNameStd_2);
String _plus_19 = (_plus_18 + ".h");
this._joynrCppGeneratorExtensions.generateFile(headerFileSystem, _plus_19,
this.stdEnumH,
((FEnumerationType) type_1));
String _joynrNameStd_3 = this._joynrCppGeneratorExtensions.joynrNameStd(type_1);
String _plus_20 = (sourcepath_1 + _joynrNameStd_3);
String _plus_21 = (_plus_20 + ".cpp");
this._joynrCppGeneratorExtensions.generateFile(sourceFileSystem, _plus_21,
this.stdEnumCpp,
((FEnumerationType) type_1));
}
}
final String interfacePath = ((sourceContainerPath + "interfaces") + File.separator);
String _xifexpression_1 = null;
boolean _equals_1 = Objects.equal(sourceFileSystem, headerFileSystem);
if (_equals_1) {
_xifexpression_1 = ((headerContainerPath + "interfaces") + File.separator);
} else {
_xifexpression_1 = headerContainerPath;
}
final String headerInterfacePath = _xifexpression_1;
EList _interfaces = fModel.getInterfaces();
for (final FInterface serviceInterface : _interfaces) {
{
String _packageSourceDirectory_1 = this._joynrCppGeneratorExtensions.getPackageSourceDirectory(serviceInterface);
String _plus_12 = (interfacePath + _packageSourceDirectory_1);
final String sourcepath_1 = (_plus_12 + File.separator);
String _packagePathWithJoynrPrefix_1 = this._joynrCppGeneratorExtensions.getPackagePathWithJoynrPrefix(serviceInterface, File.separator);
String _plus_13 = (headerInterfacePath + _packagePathWithJoynrPrefix_1);
final String headerpath_1 = (_plus_13 + File.separator);
String _joynrName = this._joynrCppGeneratorExtensions.joynrName(serviceInterface);
String _plus_14 = ((headerpath_1 + "I") + _joynrName);
String _plus_15 = (_plus_14 + ".h");
this._joynrCppGeneratorExtensions.generateFile(headerFileSystem, _plus_15,
this.interfaceH, serviceInterface);
String _joynrName_1 = this._joynrCppGeneratorExtensions.joynrName(serviceInterface);
String _plus_16 = ((sourcepath_1 + "I") + _joynrName_1);
String _plus_17 = (_plus_16 + ".cpp");
this._joynrCppGeneratorExtensions.generateFile(sourceFileSystem, _plus_17,
this.interfaceCpp, serviceInterface);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy