-
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
8 changed files
with
271 additions
and
173 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
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,9 +1,23 @@ | ||
// Statemachine [%=sm.name%] instance | ||
|
||
[% for (region in sm.regions) { | ||
var regionTemplate : Template = TemplateFactory.load("DeclarationRegion.egl"); | ||
// Override the following defines according to your needs if you are not using cpp_event_framework: | ||
|
||
#ifndef IoArHandlerMain_GET_INSTANCE_EVENT_ID | ||
#define IoArHandlerMain_GET_INSTANCE_EVENT_ID(event_instance) event_instance->Id() | ||
#endif | ||
|
||
#ifndef IoArHandlerMain_GET_STATIC_EVENT_ID | ||
#define IoArHandlerMain_GET_STATIC_EVENT_ID(event_name) event_name::kId | ||
#endif | ||
|
||
[% | ||
var region = sm.regions.first; | ||
var intitalstate = region.subvertices.select(s|(s.type.name == "Pseudostate") and (s.kind.name == "initial")).first; | ||
|
||
var regionTemplate : Template = TemplateFactory.load("InstanceRegion.egl"); | ||
regionTemplate.populate("region", region); | ||
regionTemplate.populate("sm", sm); | ||
%] | ||
[%=regionTemplate.process()%] | ||
[%}%] | ||
// Initial state | ||
const [%=sm.name%]::StatePtr [%=sm.name%]::kInitialState = &[%=sm.name%]::k[%=intitalstate.outgoing.first.target.name%]; | ||
[%=regionTemplate.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!HANDLER! [%=state.name%] |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[% for (state in region.subvertices.select(s|s.type.name == "State")) { | ||
var stateTemplate : Template = TemplateFactory.load("InstanceState.egl"); | ||
stateTemplate.populate("state", state); | ||
stateTemplate.populate("sm", sm); | ||
%] | ||
|
||
[%=stateTemplate.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[% | ||
var regionTemplate : Template = TemplateFactory.load("InstanceRegion.egl"); | ||
var transitionTemplate : Template = TemplateFactory.load("InstanceTransition.egl"); | ||
var handlerTemplate : Template = TemplateFactory.load("InstanceHandler.egl"); | ||
handlerTemplate.populate("state", state); | ||
handlerTemplate.populate("sm", sm); | ||
|
||
var parent = "nullptr"; | ||
if (state.container.state != null) { | ||
parent = "&k" + state.container.state.name; | ||
} | ||
|
||
var initial = "nullptr"; | ||
if (not state.regions.empty) { | ||
var region = state.regions.first; | ||
var initial_state = region.subvertices.select(s|(s.type.name == "Pseudostate") and ((s.kind.name == "initial") or (s.kind.name == "shallowHistory"))).first; | ||
if (initial_state != null) { | ||
initial = "&k" + initial_state.outgoing.first.target.name; | ||
} | ||
} | ||
|
||
var entry = "nullptr"; | ||
if (state.entry != null) { | ||
entry = "&" + sm.name + "::Impl::" + state.entry.name; | ||
} | ||
|
||
var exit = "nullptr"; | ||
if (state.exit != null) { | ||
entry = "&" + sm.name + "::Impl::" + state.exit.name; | ||
} | ||
%] | ||
// State [%=state.name%] | ||
const [%=sm.name%]::State [%=sm.name%]::k[%=state.name%]("[%=state.name%]", | ||
&[%=state.name%]Handler, // Handler | ||
[%=parent%], // Parent | ||
[%=initial%], // Initial | ||
[%=entry%], // Entry | ||
[%=exit%]); // Exit | ||
[% for (outgoing_transition in state.outgoing) { | ||
transitionTemplate.populate("start_transition", outgoing_transition); | ||
transitionTemplate.populate("transition", outgoing_transition); | ||
transitionTemplate.populate("state", state); | ||
transitionTemplate.populate("sm", sm); | ||
%] | ||
[%=transitionTemplate.process()%] | ||
[%}%] | ||
[%=handlerTemplate.process()%] | ||
[% for (sub_region in state.regions) { | ||
regionTemplate.populate("region", sub_region); | ||
regionTemplate.populate("sm", sm); | ||
%] | ||
[%=regionTemplate.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!TRANSITION! [%=start_transition.target.name%] |
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
Oops, something went wrong.