Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2018-11-02 07:21:09 -0400
committerHenrik Rentz-Reichert2018-11-02 07:21:09 -0400
commit4a4f56a2254b837c625f5170076f9b502a168db9 (patch)
tree3e844013b5363f01641d55b75b5d8492212bb4e9 /plugins/org.eclipse.etrice.generator.cpp
parent87079c0333f8ce2653abc0a1cb475261960eb619 (diff)
downloadorg.eclipse.etrice-4a4f56a2254b837c625f5170076f9b502a168db9.tar.gz
org.eclipse.etrice-4a4f56a2254b837c625f5170076f9b502a168db9.tar.xz
org.eclipse.etrice-4a4f56a2254b837c625f5170076f9b502a168db9.zip
Bug 540707 - introduce switch for transition data generation
* introduced the switch with default false * introduced the switch in the launcher tab * added a preference for the initialization of launcher settings Change-Id: I4ff792e47ada1964fe8b2b16bafe4acbcce3cbd4
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.cpp')
-rw-r--r--plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend
index 4b254627b..e88a2feed 100644
--- a/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend
+++ b/plugins/org.eclipse.etrice.generator.cpp/src/org/eclipse/etrice/generator/cpp/gen/CppExtensions.xtend
@@ -42,6 +42,8 @@ import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
import org.eclipse.xtext.util.Pair
import org.eclipse.xtext.util.Strings
+import org.eclipse.etrice.generator.cpp.Main
+import org.eclipse.etrice.generator.cpp.setup.GeneratorOptionsHelper
@Singleton
class CppExtensions implements ILanguageExtension {
@@ -50,6 +52,7 @@ class CppExtensions implements ILanguageExtension {
@Inject extension TypeHelpers
@Inject extension RoomHelpers
@Inject extension RoomExtensions
+ @Inject protected extension GeneratorOptionsHelper
override String getTypedDataDefinition(EObject msg) {
generateArglistAndTypedData((msg as Message).data).get(TypedDataKind.DECLARATION_AND_INITIALIZATION.ordinal)
@@ -222,9 +225,13 @@ class CppExtensions implements ILanguageExtension {
}
var deRef = if(!data.refType.ref) '*' else ''
- val dataArg = ''', «GENERIC_DATA_NAME»'''
- val typedData = '''«typeExpr» «GENERIC_DATA_NAME» = «deRef»(static_cast<«castExpr»>(generic_data__et));''' + NEWLINE
- val typedArgList = ''', «typeExpr» «GENERIC_DATA_NAME»'''
+ val dataName = if (Main.settings.isOldStyleTransitionData && data.deprecatedName!==null && !data.deprecatedName.trim.empty)
+ data.deprecatedName
+ else
+ GENERIC_DATA_NAME
+ val dataArg = ''', «dataName»'''
+ val typedData = '''«typeExpr» «dataName» = «deRef»(static_cast<«castExpr»>(generic_data__et));''' + NEWLINE
+ val typedArgList = ''', «typeExpr» «dataName»'''
return #[dataArg, typedData, typedArgList]
}

Back to the top