summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Rauwolf <rauwolf@itestra.de>2013-02-14 17:59:09 +0100
committerPhilip Rauwolf <rauwolf@itestra.de>2013-02-15 09:39:21 +0100
commitab0179a25ca1b6d724e1e9c87974a74705ee77a9 (patch)
tree83a7a3931299f5ce89e363efbc8a5f99e612b936
parenta4e71600cb8541ac15dcd480c8819255ba57a3f5 (diff)
downloadgenivi-common-api-runtime-ab0179a25ca1b6d724e1e9c87974a74705ee77a9.tar.gz
Fixed generation for enums that are used as key types in maps, added
virtual modifiers to protected methods of generated default stub
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend8
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeCommonAreaGenerator.xtend6
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FTypeGenerator.xtend6
3 files changed, 9 insertions, 11 deletions
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend
index e3a7ddd..9deb94f 100644
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/generator/FInterfaceStubGenerator.xtend
@@ -97,7 +97,7 @@ class FInterfaceStubGenerator {
«FOR attribute : fInterface.attributes»
virtual const «attribute.type.getNameReference(fInterface.model)»& «attribute.stubClassGetMethodName»();
- void «attribute.stubDefaultClassSetMethodName»(«attribute.type.getNameReference(fInterface.model)» value);
+ virtual void «attribute.stubDefaultClassSetMethodName»(«attribute.type.getNameReference(fInterface.model)» value);
«ENDFOR»
@@ -112,9 +112,9 @@ class FInterfaceStubGenerator {
protected:
«FOR attribute : fInterface.attributes»
- void «attribute.stubRemoteEventClassChangedMethodName»();
- bool «attribute.stubDefaultClassTrySetMethodName»(«attribute.type.getNameReference(fInterface.model)» value);
- bool «attribute.stubDefaultClassValidateMethodName»(const «attribute.type.getNameReference(fInterface.model)»& value);
+ virtual void «attribute.stubRemoteEventClassChangedMethodName»();
+ virtual bool «attribute.stubDefaultClassTrySetMethodName»(«attribute.type.getNameReference(fInterface.model)» value);
+ virtual bool «attribute.stubDefaultClassValidateMethodName»(const «attribute.type.getNameReference(fInterface.model)»& value);
«ENDFOR»
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 46b25ed..d94a72c 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
@@ -215,12 +215,14 @@ class FTypeCommonAreaGenerator {
return baseList
}
+ def getFQN(FType type, FTypeCollection fTypes) '''«fTypes.model.namespaceAsList.join("::")»::«type.getClassNamespaceWithName(type.name, fTypes, fTypes.name)»'''
+
def generateHashers(FTypeCollection fTypes) '''
«FOR type: fTypes.types»
«IF type.isFEnumerationType»
template<>
- struct hash<commonapi::tests::DerivedTypeCollection::TestEnum> {
- inline size_t operator()(const «type.getClassNamespaceWithName(type.name, fTypes, fTypes.name)»& «type.name.toFirstLower») const {
+ struct hash<«type.getFQN(fTypes)»> {
+ inline size_t operator()(const «type.getFQN(fTypes)»& «type.name.toFirstLower») const {
return static_cast<«type.getFEnumerationType.backingType.primitiveTypeName»>(«type.name.toFirstLower»);
}
};
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 a2b1036..974a4e3 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
@@ -41,7 +41,7 @@ class FTypeGenerator {
'''
def dispatch generateFTypeDeclaration(FMapType fMap) '''
- typedef std::unordered_map<«fMap.generateKeyType»«fMap.generateValueType»«fMap.generateComparatorType»> «fMap.name»;
+ typedef std::unordered_map<«fMap.generateKeyType»«fMap.generateValueType»> «fMap.name»;
'''
def dispatch generateFTypeDeclaration(FStructType fStructType) '''
@@ -289,12 +289,8 @@ class FTypeGenerator {
}
- def private isFEnumerationType(FMapType fMap) {
- fMap.keyType.derived instanceof FEnumerationType
- }
def private generateKeyType(FMapType fMap) '''«fMap.keyType.getNameReference(fMap.eContainer)»'''
def private generateValueType(FMapType fMap) ''', «fMap.valueType.getNameReference(fMap.eContainer)»'''
- def private generateComparatorType(FMapType fMap) '''«IF fMap.isFEnumerationType», «fMap.generateKeyType»Comparator«ENDIF»'''
def private getBaseStructName(FStructType fStructType) {
if (fStructType.base != null)