-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
60 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
static [%=statemachine.name%]::[%=statemachine.transition_type%] [%=state.scoped_name%]Handler([%=statemachine.name%]::ImplPtr impl, [%=statemachine.name%]::Event event) | ||
{ | ||
(void)impl; // impl parameter is unused when there is no guard function being called in here | ||
(void)impl; // impl parameter is unused when there is no guard function being called in here | ||
|
||
[% | ||
if (not state.all_events.isEmpty()) { | ||
if (not state.all_events.isEmpty()) { | ||
%] | ||
switch([%=statemachine.name%]_GET_INSTANCE_EVENT_ID(event)) | ||
{ | ||
switch([%=statemachine.name%]_GET_INSTANCE_EVENT_ID(event)) | ||
{ | ||
[% | ||
for (trigger in state.all_events) { | ||
%] | ||
case [%=statemachine.name%]_GET_STATIC_EVENT_ID([%=trigger%]): | ||
case [%=statemachine.name%]_GET_STATIC_EVENT_ID([%=trigger%]): | ||
[% | ||
var transition = state.transitions_for_trigger_transformed.get(trigger); | ||
var transition = state.transitions_for_trigger_transformed.get(trigger); | ||
|
||
var transitionRootTemplate : Template = TemplateFactory.load("InstanceHandlerTransitionRoot.egl"); | ||
transitionRootTemplate.populate("state", state); | ||
transitionRootTemplate.populate("statemachine", statemachine); | ||
transitionRootTemplate.populate("transition", transition); | ||
var transitionRootTemplate : Template = TemplateFactory.load("InstanceHandlerTransitionRoot.egl"); | ||
transitionRootTemplate.populate("state", state); | ||
transitionRootTemplate.populate("statemachine", statemachine); | ||
transitionRootTemplate.populate("transition", transition); | ||
%] | ||
[%=transitionRootTemplate.process()%] | ||
break; | ||
break; | ||
|
||
[% | ||
} | ||
%] | ||
default: | ||
break; | ||
} | ||
default: | ||
break; | ||
} | ||
[% | ||
} else { | ||
} else { | ||
%] | ||
(void) event; // No outgoing transitions | ||
(void) event; // No outgoing transitions | ||
[% | ||
} | ||
} | ||
%] | ||
return [%=statemachine.name%]::UnhandledEvent(); | ||
return [%=statemachine.name%]::UnhandledEvent(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
[% | ||
var actions = ""; | ||
if (transition.actions_list != null) { | ||
statemachine.unique_id = statemachine.unique_id + 1; | ||
actions = ", kActions" + statemachine.unique_id; | ||
var actions = ""; | ||
if (transition.actions_list != null) { | ||
statemachine.unique_id = statemachine.unique_id + 1; | ||
actions = ", kActions" + statemachine.unique_id; | ||
%] | ||
static const auto kActions[%=statemachine.unique_id%] = std::to_array<[%=statemachine.name%]::[%=statemachine.transition_action_type%]>({[%=transition.actions_list%]}); | ||
static const auto kActions[%=statemachine.unique_id%] = std::to_array<[%=statemachine.name%]::[%=statemachine.transition_action_type%]>({[%=transition.actions_list%]}); | ||
[% | ||
} | ||
} | ||
%] | ||
[% | ||
if (transition.internal) { | ||
if (transition.internal) { | ||
%] | ||
return [%=statemachine.name%]::TransitionTo([%=statemachine.name%]::kNone[%=actions%]); | ||
return [%=statemachine.name%]::TransitionTo([%=statemachine.name%]::kNone[%=actions%]); | ||
[% | ||
} | ||
if (transition.target_variable_name != null) { | ||
} | ||
if (transition.target_variable_name != null) { | ||
%] | ||
return [%=statemachine.name%]::TransitionTo([%=statemachine.name%]::[%=transition.target_variable_name%][%=actions%]); | ||
return [%=statemachine.name%]::TransitionTo([%=statemachine.name%]::[%=transition.target_variable_name%][%=actions%]); | ||
[% | ||
} | ||
} | ||
|
||
var transitionRootTemplate : Template = TemplateFactory.load("InstanceHandlerTransitionRoot.egl"); | ||
transitionRootTemplate.populate("state", state); | ||
transitionRootTemplate.populate("statemachine", statemachine); | ||
transitionRootTemplate.populate("transition", transition); | ||
var transitionRootTemplate : Template = TemplateFactory.load("InstanceHandlerTransitionRoot.egl"); | ||
transitionRootTemplate.populate("state", state); | ||
transitionRootTemplate.populate("statemachine", statemachine); | ||
transitionRootTemplate.populate("transition", transition); | ||
%] | ||
[%=transitionRootTemplate.process()%] |
24 changes: 12 additions & 12 deletions
24
generator/src/generator/InstanceHandlerTransitionRoot.egl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
[% | ||
var transitionTemplate : Template = TemplateFactory.load("InstanceHandlerTransition.egl"); | ||
transitionTemplate.populate("state", state); | ||
transitionTemplate.populate("statemachine", statemachine); | ||
var transitionTemplate : Template = TemplateFactory.load("InstanceHandlerTransition.egl"); | ||
transitionTemplate.populate("state", state); | ||
transitionTemplate.populate("statemachine", statemachine); | ||
|
||
for (transition in transition.trans_conditional) { | ||
transitionTemplate.populate("transition", transition); | ||
for (transition in transition.trans_conditional) { | ||
transitionTemplate.populate("transition", transition); | ||
%] | ||
if ([%=transition.guards_list%]) | ||
{ | ||
if ([%=transition.guards_list%]) | ||
{ | ||
[%=transitionTemplate.process()%] | ||
} | ||
} | ||
[% | ||
} | ||
} | ||
%] | ||
[% | ||
for (transition in transition.trans_unconditional) { | ||
transitionTemplate.populate("transition", transition); | ||
for (transition in transition.trans_unconditional) { | ||
transitionTemplate.populate("transition", transition); | ||
%] | ||
[%=transitionTemplate.process()%] | ||
[% | ||
} | ||
} | ||
%] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Statemachine ScXmlTest declaration | ||
// Generated: 21.08.24, 21:44 | ||
// Generated: 22.08.24, 11:29 | ||
|
||
#pragma once | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters