diff options
author | Stefan Laner <laner@itestra.de> | 2013-08-07 16:37:57 +0200 |
---|---|---|
committer | Stefan Laner <laner@itestra.de> | 2013-08-07 16:37:57 +0200 |
commit | 02be3c395ad998ab8ff7120ed6e7535e18a5e2dc (patch) | |
tree | 724f5b36eaff0eaf476be71c59509c1133d23ff3 | |
parent | 3d83505ded8a2bacd7fe6a52e14991ea78bffd98 (diff) | |
parent | 3171fd80e0d9b37b50160be189d7db6bcbd8d9c4 (diff) | |
download | genivi-common-api-runtime-02be3c395ad998ab8ff7120ed6e7535e18a5e2dc.tar.gz |
Merge remote-tracking branch 'origin/maintain/2.0' into maintain/2.0
12 files changed, 80 insertions, 70 deletions
diff --git a/org.genivi.commonapi.core.feature/category.xml b/org.genivi.commonapi.core.feature/category.xml index 9a92a4a..a2306c6 100644 --- a/org.genivi.commonapi.core.feature/category.xml +++ b/org.genivi.commonapi.core.feature/category.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <site> - <feature url="features/org.genivi.commonapi.core.feature_2.0.1.qualifier.jar" id="org.genivi.commonapi.core.feature" version="2.0.1.qualifier"> + <feature url="features/org.genivi.commonapi.core.feature_2.0.4.qualifier.jar" id="org.genivi.commonapi.core.feature" version="2.0.4.qualifier"> <category name="GENIVI CommonAPI"/> </feature> <category-def name="GENIVI CommonAPI" label="GENIVI CommonAPI Generators"> diff --git a/org.genivi.commonapi.core.feature/feature.xml b/org.genivi.commonapi.core.feature/feature.xml index 832130e..122c1ee 100644 --- a/org.genivi.commonapi.core.feature/feature.xml +++ b/org.genivi.commonapi.core.feature/feature.xml @@ -2,7 +2,7 @@ <feature id="org.genivi.commonapi.core.feature" label="%featureName" - version="2.0.3.qualifier" + version="2.0.4.qualifier" provider-name="%providerName"> <copyright> @@ -16,16 +16,16 @@ <requires> <import plugin="org.eclipse.core.resources" version="3.8.0" match="greaterOrEqual"/> <import plugin="org.eclipse.core.runtime" version="3.8.0" match="greaterOrEqual"/> - <import plugin="org.eclipse.xtend2.lib" version="2.3.1" match="greaterOrEqual"/> - <import plugin="org.eclipse.xtext.generator" version="2.3.1" match="greaterOrEqual"/> - <import plugin="org.eclipse.xtext.util" version="2.3.1" match="greaterOrEqual"/> - <import plugin="org.franca.core.dsl" version="0.8.0" match="greaterOrEqual"/> + <import plugin="org.eclipse.xtend2.lib" version="2.4.0" match="greaterOrEqual"/> + <import plugin="org.eclipse.xtext.generator" version="2.4.0" match="greaterOrEqual"/> + <import plugin="org.eclipse.xtext.util" version="2.4.0" match="greaterOrEqual"/> + <import plugin="org.franca.core.dsl" version="0.8.8" match="greaterOrEqual"/> <import plugin="javax.inject"/> <import plugin="org.eclipse.ui"/> <import plugin="org.eclipse.core.expressions" version="3.4.400" match="greaterOrEqual"/> - <import plugin="org.eclipse.xtext.builder" version="2.3.1" match="greaterOrEqual"/> - <import plugin="org.eclipse.xtext.ui" version="2.3.1" match="greaterOrEqual"/> - <import plugin="org.eclipse.xtext.ui.ecore" version="2.3.1" match="greaterOrEqual"/> + <import plugin="org.eclipse.xtext.builder" version="2.4.0" match="greaterOrEqual"/> + <import plugin="org.eclipse.xtext.ui" version="2.4.0" match="greaterOrEqual"/> + <import plugin="org.eclipse.xtext.ui.ecore" version="2.4.0" match="greaterOrEqual"/> <import plugin="com.google.inject" version="3.0.0" match="greaterOrEqual"/> <import plugin="org.genivi.commonapi.core" version="1.0.0" match="greaterOrEqual"/> </requires> diff --git a/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF b/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF index 2cfd044..c83ed67 100644 --- a/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.core.ui/META-INF/MANIFEST.MF @@ -2,17 +2,17 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI Common API UI Bundle-SymbolicName: org.genivi.commonapi.core.ui;singleton:=true -Bundle-Version: 2.0.3.qualifier +Bundle-Version: 2.0.4.qualifier Bundle-Activator: org.genivi.commonapi.core.ui.CommonApiUiPlugin Bundle-Vendor: BMW AG Require-Bundle: org.eclipse.ui, org.eclipse.core.expressions;bundle-version="3.4.400", org.eclipse.core.resources, org.eclipse.core.runtime, - org.eclipse.xtext.builder;bundle-version="2.3.1", - org.eclipse.xtext.generator;bundle-version="2.3.1", - org.eclipse.xtext.ui;bundle-version="2.3.1", - org.eclipse.xtext.ui.ecore;bundle-version="2.3.1", + org.eclipse.xtext.builder;bundle-version="2.4.0", + org.eclipse.xtext.generator;bundle-version="2.4.0", + org.eclipse.xtext.ui;bundle-version="2.4.0", + org.eclipse.xtext.ui.ecore;bundle-version="2.4.0", com.google.inject;bundle-version="3.0.0", org.genivi.commonapi.core;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/org.genivi.commonapi.core/META-INF/MANIFEST.MF b/org.genivi.commonapi.core/META-INF/MANIFEST.MF index c6c242f..e1a8762 100644 --- a/org.genivi.commonapi.core/META-INF/MANIFEST.MF +++ b/org.genivi.commonapi.core/META-INF/MANIFEST.MF @@ -2,16 +2,16 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GENIVI Common API Generator Bundle-Vendor: BMW AG -Bundle-Version: 2.0.1.qualifier +Bundle-Version: 2.0.4.qualifier Bundle-SymbolicName: org.genivi.commonapi.core;singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.core.resources;bundle-version="3.8.0", org.eclipse.core.runtime;bundle-version="3.8.0", - org.eclipse.xtend2.lib;bundle-version="2.3.1", - org.eclipse.xtext.generator;bundle-version="2.3.1", - org.eclipse.xtext.util;bundle-version="2.3.1", - org.franca.core.dsl;bundle-version="0.8.0", - org.franca.deploymodel.dsl;bundle-version="0.8.0" + org.eclipse.xtend2.lib;bundle-version="2.4.0", + org.eclipse.xtext.generator;bundle-version="2.4.0", + org.eclipse.xtext.util;bundle-version="2.4.0", + org.franca.core.dsl;bundle-version="0.8.8", + org.franca.deploymodel.dsl;bundle-version="0.8.8" Import-Package: javax.inject;version="1.0.0" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: org.genivi.commonapi.core.deployment, diff --git a/org.genivi.commonapi.core/build.properties b/org.genivi.commonapi.core/build.properties index 4ff3d41..aafc3a1 100644 --- a/org.genivi.commonapi.core/build.properties +++ b/org.genivi.commonapi.core/build.properties @@ -2,4 +2,6 @@ source.. = src/,\ src-gen/,\ xtend-gen/ bin.includes = META-INF/,\ - . + .,\ + deployment/ +src.includes = deployment/ diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/deployment/deployment.fdepl b/org.genivi.commonapi.core/deployment/deployment.fdepl index a587bee..a587bee 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/deployment/deployment.fdepl +++ b/org.genivi.commonapi.core/deployment/deployment.fdepl diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend index 396f738..311c3ed 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceGenerator.xtend @@ -54,6 +54,9 @@ class FInterfaceGenerator { «FOR type : fInterface.types» «type.generateFTypeInlineImplementation(fInterface, deploymentAccessor)» «ENDFOR» + «FOR method : fInterface.methods.filter[errors != null]» + «method.errors.generateInlineImplementation(method.errors.errorName, fInterface, fInterface.name, deploymentAccessor)» + «ENDFOR» «fInterface.model.generateNamespaceEndDeclaration» @@ -65,7 +68,13 @@ class FInterfaceGenerator { namespace std { + //hashes for types «fInterface.generateHashers(deploymentAccessor)» + + //hashes for error types + «FOR method : fInterface.methods.filter[errors != null]» + «method.errors.generateHash(method.errors.errorName, fInterface, deploymentAccessor)» + «ENDFOR» } #endif // «fInterface.defineName»_H_ diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend index d54a5d8..5c7e7f7 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceProxyGenerator.xtend @@ -49,10 +49,6 @@ class FInterfaceProxyGenerator { class «fInterface.proxyBaseClassName»: virtual public CommonAPI::Proxy { public: - «FOR method : fInterface.methods.filter[errors != null]» - «method.errors.generateDeclaration(method.errors.errorName, deploymentAccessor)» - - «ENDFOR» «FOR attribute : fInterface.attributes» typedef CommonAPI::«attribute.commonApiBaseClassname»<«attribute.getTypeName(fInterface.model)»> «attribute.className»; «ENDFOR» @@ -87,10 +83,6 @@ class FInterfaceProxyGenerator { «ENDFOR» }; - «FOR method : fInterface.methods.filter[errors != null]» - «method.errors.generateInlineImplementation(method.errors.errorName, fInterface, fInterface.proxyBaseClassName, deploymentAccessor)» - «ENDFOR» - «fInterface.model.generateNamespaceEndDeclaration» #endif // «fInterface.defineName»_PROXY_BASE_H_ @@ -117,12 +109,18 @@ class FInterfaceProxyGenerator { «FOR attribute : fInterface.attributes» /// Returns the wrapper class that provides access to the attribute «attribute.name». - virtual «attribute.generateGetMethodDefinition»; + virtual «attribute.generateGetMethodDefinition» { + return delegate_->get«attribute.className»(); + } + «ENDFOR» «FOR broadcast : fInterface.broadcasts» /// Returns the wrapper class that provides access to the broadcast «broadcast.name». - virtual «broadcast.generateGetMethodDefinition»; + virtual «broadcast.generateGetMethodDefinition» { + return delegate_->get«broadcast.className»(); + } + «ENDFOR» «FOR method : fInterface.methods» @@ -135,9 +133,6 @@ class FInterfaceProxyGenerator { * The CallStatus will be filled when the method returns and indicate either * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus * will be set. - «IF !method.isFireAndForget» - * Synchronous calls are not supported (will block indefinitely) when mainloop integration is used. - «ENDIF» */ virtual «method.generateDefinition»; «IF !method.isFireAndForget» @@ -208,22 +203,6 @@ class FInterfaceProxyGenerator { «fInterface.proxyClassName»<_AttributeExtensions...>::~«fInterface.proxyClassName»() { } - «FOR attribute : fInterface.attributes» - template <typename ... _AttributeExtensions> - typename «attribute.generateGetMethodDefinitionWithin(fInterface.proxyClassName + '<_AttributeExtensions...>')» { - return delegate_->get«attribute.className»(); - } - - «ENDFOR» - - «FOR broadcast : fInterface.broadcasts» - template <typename ... _AttributeExtensions> - typename «broadcast.generateGetMethodDefinitionWithin(fInterface.proxyClassName + '<_AttributeExtensions...>')» { - return delegate_->get«broadcast.className»(); - } - - «ENDFOR» - «FOR method : fInterface.methods» template <typename ... _AttributeExtensions> «method.generateDefinitionWithin(fInterface.proxyClassName + '<_AttributeExtensions...>')» { diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCommonAreaGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCommonAreaGenerator.xtend index 9baa34c..415389b 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCommonAreaGenerator.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCommonAreaGenerator.xtend @@ -201,15 +201,32 @@ class FTypeCommonAreaGenerator { def getFQN(FType type, FTypeCollection fTypes) '''«fTypes.model.namespaceAsList.join("::")»::«type.getClassNamespaceWithName(type.name, fTypes, fTypes.name)»''' + def getFQN(FType type, String name, FTypeCollection fTypes) '''«fTypes.model.namespaceAsList.join("::")»::«type.getClassNamespaceWithName(name, fTypes, fTypes.name)»''' + + def generateHash (FType type, String name, FTypeCollection fTypes, DeploymentInterfacePropertyAccessor deploymentAccessor) ''' + //Hash for «name» + template<> + struct hash<«type.getFQN(name, fTypes)»> { + inline size_t operator()(const «type.getFQN(name, fTypes)»& «name.toFirstLower») const { + return static_cast<«type.getFEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(«name.toFirstLower»); + } + }; + ''' + + def generateHash (FType type, FTypeCollection fTypes, DeploymentInterfacePropertyAccessor deploymentAccessor) ''' + //Hash for «type.name» + template<> + struct hash<«type.getFQN(fTypes)»> { + inline size_t operator()(const «type.getFQN(fTypes)»& «type.name.toFirstLower») const { + return static_cast<«type.getFEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(«type.name.toFirstLower»); + } + }; + ''' + def generateHashers(FTypeCollection fTypes, DeploymentInterfacePropertyAccessor deploymentAccessor) ''' «FOR type: fTypes.types» «IF type.isFEnumerationType» - template<> - struct hash<«type.getFQN(fTypes)»> { - inline size_t operator()(const «type.getFQN(fTypes)»& «type.name.toFirstLower») const { - return static_cast<«type.getFEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(«type.name.toFirstLower»); - } - }; + «type.generateHash(fTypes, deploymentAccessor)» «ENDIF» «ENDFOR» ''' diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend index a7224cd..48bbec9 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend @@ -40,6 +40,11 @@ class FTypeGenerator { «type.generateFTypeDeclaration(deploymentAccessor)» «ENDFOR» + «IF fTypeCollection instanceof FInterface» + «FOR method : (fTypeCollection as FInterface).methods.filter[errors != null]» + «method.errors.generateDeclaration(method.errors.errorName, deploymentAccessor)» + «ENDFOR» + «ENDIF» ''' def private sortTypes(EList<FType> typeList, FTypeCollection containingTypeCollection) { @@ -359,12 +364,12 @@ class FTypeGenerator { } def private generateInlineOperatorWithName(FEnumerationType fEnumerationType, String enumerationName, FEnumerationType base, FModelElement parent, String parentName, String operator, DeploymentInterfacePropertyAccessor deploymentAccessor) ''' - inline bool operator«operator»(const «fEnumerationType.getClassNamespaceWithName(enumerationName, parent, parentName)»& lhs, const «base.getRelativeNameReference(fEnumerationType)»& rhs) { + inline bool operator«operator»(const «fEnumerationType.getClassNamespaceWithName(enumerationName, parent, parentName)»& lhs, const «base.getClassNamespaceWithName(base.name, base.eContainer as FModelElement, (base.eContainer as FModelElement).name)»& rhs) { return static_cast<«fEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(lhs) «operator» static_cast<«fEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(rhs); } - inline bool operator«operator»(const «base.getRelativeNameReference(fEnumerationType)»& lhs, const «fEnumerationType.getClassNamespaceWithName(enumerationName, parent, parentName)»& rhs) { + inline bool operator«operator»(const «base.getClassNamespaceWithName(base.name, base.eContainer as FModelElement, (base.eContainer as FModelElement).name)»& lhs, const «fEnumerationType.getClassNamespaceWithName(enumerationName, parent, parentName)»& rhs) { return static_cast<«fEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(lhs) «operator» static_cast<«fEnumerationType.getBackingType(deploymentAccessor).primitiveTypeName»>(rhs); - } + } ''' def private getBaseList(FEnumerationType fEnumerationType) { diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend index 8678261..6bf8eb0 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGenerator.xtend @@ -11,8 +11,8 @@ import java.util.HashSet import java.util.LinkedList import java.util.List import javax.inject.Inject +import org.eclipse.core.resources.ResourcesPlugin import org.eclipse.core.runtime.Path -import org.eclipse.emf.ecore.plugin.EcorePlugin import org.eclipse.emf.ecore.resource.Resource import org.eclipse.xtext.generator.IFileSystemAccess import org.eclipse.xtext.generator.IGenerator @@ -35,9 +35,7 @@ import org.franca.deploymodel.dsl.fDeploy.FDInterface import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessor import org.genivi.commonapi.core.deployment.DeploymentInterfacePropertyAccessorWrapper -import static extension org.eclipse.emf.ecore.plugin.EcorePlugin.* import static com.google.common.base.Preconditions.* -import org.eclipse.core.resources.ResourcesPlugin class FrancaGenerator implements IGenerator { @Inject private extension FTypeCollectionGenerator @@ -59,7 +57,7 @@ class FrancaGenerator implements IGenerator { deployedInterfaces = new LinkedList<FDInterface>() } else if (input.URI.fileExtension.equals("fdepl" /* fDeployPersistenceManager.fileExtension */)) { - var fDeployedModel = fDeployPersistenceManager.loadModel(input.filePathUrl); + var fDeployedModel = fDeployPersistenceManager.loadModel(input.URI, input.URI); val fModelExtender = new FDModelExtender(fDeployedModel); checkArgument(fModelExtender.getFDInterfaces().size > 0, "No Interfaces were deployed, nothing to generate.") @@ -150,7 +148,7 @@ class FrancaGenerator implements IGenerator { def private getAllReferencedFTypes(FModel fModel) { val referencedFTypes = new HashSet<FType> - fModel.typeCollections.forEach[referencedFTypes.addAll(types)] + fModel.typeCollections.forEach[types.forEach[addFTypeDerivedTree(referencedFTypes)]] fModel.interfaces.forEach[ attributes.forEach[type.addDerivedFTypeTree(referencedFTypes)] @@ -215,4 +213,4 @@ class FrancaGenerator implements IGenerator { fUnionType.elements.forEach[type.addDerivedFTypeTree(fTypeReferences)] } } -}
\ No newline at end of file +} diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend index 224312d..c525092 100644 --- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend +++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FrancaGeneratorExtensions.xtend @@ -296,12 +296,12 @@ class FrancaGeneratorExtensions { def getErrorNameReference(FMethod fMethod, EObject source) { checkArgument(fMethod.hasError, 'FMethod has no error: ' + fMethod) - if (fMethod.errorEnum != null) - return fMethod.errorEnum.getRelativeNameReference(source) + if (fMethod.errorEnum != null) { + return fMethod.errorEnum.getRelativeNameReference((source as FModelElement).model) + } var errorNameReference = fMethod.errors.errorName - if (!fMethod.eContainer.equals(source)) - errorNameReference = (fMethod.eContainer as FInterface).getRelativeNameReference(source) + '::' + errorNameReference + errorNameReference = (fMethod.eContainer as FInterface).getRelativeNameReference(source) + '::' + errorNameReference return errorNameReference } @@ -378,7 +378,7 @@ class FrancaGeneratorExtensions { return element.type.getNameReference(source) } } - + def getNameReference(FTypeRef destination, EObject source) { if (destination.derived != null) return destination.derived.getRelativeNameReference(source) |