Browse Source

Fixed issue related to function names in CPP framework

Casper Thule 3 years ago
parent
commit
2400c38f2a

+ 1 - 1
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.cg.cpp/src/be/uantwerpen/ansymo/semanticadaptation/cg/cpp/generation/ControlConditionSwitch.xtend

@@ -153,7 +153,7 @@ class ControlConditionSwitch extends RulesConditionSwitch {
 	{
 		var retVal = new ReturnInformation();
 		retVal.type = SVType.Real;
-		retVal.code = '''getNextTimeStep(«object.fmu.name»)''';
+		retVal.code = '''getMextTimeStep(«object.fmu.name»)''';
 		return retVal;
 	}
 }

+ 17 - 0
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.cg.cpp/src/be/uantwerpen/ansymo/semanticadaptation/cg/cpp/generation/Conversions.java

@@ -9,6 +9,23 @@ import be.uantwerpen.ansymo.semanticadaptation.semanticAdaptation.Literal;
 import be.uantwerpen.ansymo.semanticadaptation.semanticAdaptation.RealLiteral;
 
 public class Conversions {
+	
+	public static String fmiTypeToGetValueString(SVType t) throws InvalidConversionException
+	{
+		switch (t) {
+		case Real:
+			return "Double";
+		case Integer:
+			return "Integer";
+		case Boolean:
+			return "Boolean";
+		case String:
+			return "String";
+		default:
+			throw new InvalidConversionException("The value type: " + t + " is invalid.");
+		}
+	}
+	
 	public static String fmiTypeToCppType(SVType t) throws InvalidConversionException {
 		switch (t) {
 		case Real:

+ 1 - 1
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.cg.cpp/src/be/uantwerpen/ansymo/semanticadaptation/cg/cpp/generation/CppGenerator.xtend

@@ -718,7 +718,7 @@ class CppGenerator extends SemanticAdaptationGenerator {
 
 					var ruleCpp = "";
 					if (ioType == IORuleType.Output) {
-						val getValueCpp = '''getValue«Conversions.fmiTypeToCppTypeCapitalized(type)»(«dependency.owner.name»,«define»)''';
+						val getValueCpp = '''getValue«Conversions.fmiTypeToGetValueString(type)»(«dependency.owner.name»,«define»)''';
 						ruleCpp = '''
 							«funcSigCon»{
 								return true;

+ 1 - 1
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.cg.cpp/src/be/uantwerpen/ansymo/semanticadaptation/cg/cpp/generation/OutRulesConditionSwitch.xtend

@@ -37,7 +37,7 @@ public class OutRulesConditionSwitch extends RulesConditionSwitch {
 
 		val type = mSVars.get(this.externalVariableOwner).get(object.name).mappedSv.type;
 		val define = mSVars.get(this.externalVariableOwner).get(object.name).define;
-		retVal.code = '''getValue«Conversions.fmiTypeToCppTypeCapitalized(type)»(«this.externalVariableOwner»,«define»)''';
+		retVal.code = '''getValue«Conversions.fmiTypeToGetValueString(type)»(«this.externalVariableOwner»,«define»)''';
 		retVal.type = type;
 		return retVal;
 	}