Просмотр исходного кода

Some additions for entry and exit action handling

jos.itemis@gmail.com 14 лет назад
Родитель
Сommit
de8a7c5895

+ 3 - 4
plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/templates/CustomStatemachineCPP.xpt

@@ -20,7 +20,7 @@ Templates for the main statechart cpp file.
 «ENDDEFINE»
 
 «DEFINE ActionCode FOR Execution»
-// ActionCode for Execution not implemented yet
+	«this.statement.toCppCode()»
 «ENDDEFINE»
 
 «DEFINE ActionCode FOR Call»
@@ -100,9 +100,8 @@ void 
 «ENDDEFINE»
 
 «DEFINE EnterMethodImplement FOR ExecutionState»
-ENTER METHOD IMPLE
 «IF this.entryAction != null»
-void «StName()»::enter_«this.simpleName»()
+void «StName()»::«this.entryAction.entryActionFunctionName()»()
 {
 «EXPAND ActionCode FOR this.entryAction»
 }
@@ -111,7 +110,7 @@ void 
 
 «DEFINE ExitMethodImplement FOR ExecutionState»
 «IF this.exitAction != null»
-void «StName()»::exit_«this.simpleName»()
+void «StName()»::«this.exitAction.exitActionFunctionName()»()
 {
 «EXPAND ActionCode FOR this.exitAction»
 }

+ 3 - 3
plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/templates/CustomStatemachineH.xpt

@@ -55,20 +55,20 @@ protected:
 
 	/* cycles */
 	«FOREACH states AS state -»
-	void cycle_«state.simpleName»();
+	void cycle_«state.simpleName»(const _Event& ev);
 	«ENDFOREACH»
 	
 	/* entrys */
 	«FOREACH states AS state -»
 	«IF state.entryAction != null»
-	void entry_«state.simpleName»();
+	void «state.entryAction.entryActionFunctionName()»();
 	«ENDIF»
 	«ENDFOREACH»
 	
 	/*exits */
 	«FOREACH states AS state -»
 	«IF state.exitAction != null»
-	void exit_«state.simpleName»();
+	void «state.exitAction.exitActionFunctionName()»();
 	«ENDIF»
 	«ENDFOREACH»
 	

+ 2 - 2
plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/templates/Naming.ext

@@ -29,8 +29,8 @@ cached String functionName(Step step) :
  
 String actionFunctionName(Step this) : "actions_" + this.reaction().state().simpleName + "_" + this.reaction().name; 
 String checkFunctionName(Step this) : "condition_" + this.reaction().state().simpleName + "_" + this.reaction().name; 
-String entryActionFunctionName(Step this) : "entryActions_" + this.reaction().state().simpleName + "_" + this.reaction().name; 
-String exitActionFunctionName(Step this) : "exitActions_" + this.reaction().state().simpleName + "_" + this.reaction().name; 
+String entryActionFunctionName(Step this) : "entryActions_" + this.state().simpleName; 
+String exitActionFunctionName(Step this) : "exitActions_" + this.state().simpleName; 
 
 boolean isEffect(Step step) : (! Check.isInstance(step)) && Reaction.isInstance(step.eContainer) ;
 boolean isReactionCheck(Step step) : Reaction.isInstance(step.eContainer) && Check.isInstance(step);