Skip to content

Commit

Permalink
Work on eclipse epsilon
Browse files Browse the repository at this point in the history
  • Loading branch information
dziegel committed Dec 26, 2023
1 parent cb8abf7 commit b7ec0d5
Show file tree
Hide file tree
Showing 8 changed files with 271 additions and 173 deletions.
3 changes: 1 addition & 2 deletions experimental_epsilon/src/Declaration.egl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ class [%=sm.name%] : public [%=sm.name%]Base
{
public:
static const StatePtr kInitialState;
[% for (region in sm.regions) {
[%var region = sm.regions.first;
var regionTemplate : Template = TemplateFactory.load("DeclarationRegion.egl");
regionTemplate.populate("region", region);
regionTemplate.populate("sm", sm);
%]
[%=regionTemplate.process()%]
[%}%]
};
22 changes: 18 additions & 4 deletions experimental_epsilon/src/Instance.egl
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()%]
1 change: 1 addition & 0 deletions experimental_epsilon/src/InstanceHandler.egl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!HANDLER! [%=state.name%]
8 changes: 8 additions & 0 deletions experimental_epsilon/src/InstanceRegion.egl
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()%]
[%}%]
53 changes: 53 additions & 0 deletions experimental_epsilon/src/InstanceState.egl
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()%]
[%}%]
1 change: 1 addition & 0 deletions experimental_epsilon/src/InstanceTransition.egl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!TRANSITION! [%=start_transition.target.name%]
106 changes: 53 additions & 53 deletions experimental_epsilon/src/gen/IoArHandlerMainDeclaration.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,54 @@ class IoArHandlerMain : public IoArHandlerMainBase
static const Transition::ActionType kOpenToOpenByS_PNS_CheckModuleDiffActions[];
static const Transition kOpenToOpenByS_PNS_CheckModuleDiff;

// State WaitApplicationReady
static Transition WaitApplicationReadyHandler(ImplPtr impl, Event event);
static const State kWaitApplicationReady;
// Transition SPnpbAppTimeout: WaitApplicationReady -> WaitApplicationReadyCnf
static const Transition::ActionType kWaitApplicationReadyToWaitApplicationReadyCnfBySPnpbAppTimeoutActions[];
static const Transition kWaitApplicationReadyToWaitApplicationReadyCnfBySPnpbAppTimeout;
// Transition SPnpbAppTimeout: WaitApplicationReady -> WaitApplicationReady
static const Transition::ActionType kWaitApplicationReadyToWaitApplicationReadyBySPnpbAppTimeoutActions[];
static const Transition kWaitApplicationReadyToWaitApplicationReadyBySPnpbAppTimeout;

// State Parameterizing
static Transition ParameterizingHandler(ImplPtr impl, Event event);
static const State kParameterizing;
// Transition S_PNS_ParamEndInd: Parameterizing -> WaitApplicationReady
static const Transition::ActionType kParameterizingToWaitApplicationReadyByS_PNS_ParamEndIndActions[];
static const Transition kParameterizingToWaitApplicationReadyByS_PNS_ParamEndInd;
// Transition S_PNS_ParamEndInd: Parameterizing -> WaitApplicationReadyCnf
static const Transition::ActionType kParameterizingToWaitApplicationReadyCnfByS_PNS_ParamEndIndActions[];
static const Transition kParameterizingToWaitApplicationReadyCnfByS_PNS_ParamEndInd;

// State WaitApplicationReadyCnf
static Transition WaitApplicationReadyCnfHandler(ImplPtr impl, Event event);
static const State kWaitApplicationReadyCnf;
// Transition S_PNS_ApplicationReady_cnf: WaitApplicationReadyCnf -> ApplicationReady
static const Transition::ActionType kWaitApplicationReadyCnfToApplicationReadyByS_PNS_ApplicationReady_cnfActions[];
static const Transition kWaitApplicationReadyCnfToApplicationReadyByS_PNS_ApplicationReady_cnf;
// Transition S_PNS_ApplicationReady_cnf: WaitApplicationReadyCnf -> WaitApplicationReadyCnf
static const Transition::ActionType kWaitApplicationReadyCnfToWaitApplicationReadyCnfByS_PNS_ApplicationReady_cnfActions[];
static const Transition kWaitApplicationReadyCnfToWaitApplicationReadyCnfByS_PNS_ApplicationReady_cnf;

// State ApplicationReady
static Transition ApplicationReadyHandler(ImplPtr impl, Event event);
static const State kApplicationReady;

// State Ready
static Transition ReadyHandler(ImplPtr impl, Event event);
static const State kReady;
// Transition S_PNS_DynReconfPull: Ready -> DrWaitPullCnf
static const Transition::ActionType kReadyToDrWaitPullCnfByS_PNS_DynReconfPullActions[];
static const Transition kReadyToDrWaitPullCnfByS_PNS_DynReconfPull;
// Transition S_PNS_DynReconfPlug: Ready -> DrWaitPlugCnf
static const Transition::ActionType kReadyToDrWaitPlugCnfByS_PNS_DynReconfPlugActions[];
static const Transition kReadyToDrWaitPlugCnfByS_PNS_DynReconfPlug;

// State DynamicReconfigurationRunning
static Transition DynamicReconfigurationRunningHandler(ImplPtr impl, Event event);
static const State kDynamicReconfigurationRunning;
// Transition SPnioAppTimeoutDynReconf: DynamicReconfigurationRunning -> DynamicReconfigurationRunning
static const Transition::ActionType kDynamicReconfigurationRunningToDynamicReconfigurationRunningBySPnioAppTimeoutDynReconfActions[];
static const Transition kDynamicReconfigurationRunningToDynamicReconfigurationRunningBySPnioAppTimeoutDynReconf;

// State DrWaitApplicationReadyCnfPlugSubmodule
static Transition DrWaitApplicationReadyCnfPlugSubmoduleHandler(ImplPtr impl, Event event);
static const State kDrWaitApplicationReadyCnfPlugSubmodule;
// Transition S_PNS_PlugApplicationReady_cnf: DrWaitApplicationReadyCnfPlugSubmodule -> Ready
static const Transition::ActionType kDrWaitApplicationReadyCnfPlugSubmoduleToReadyByS_PNS_PlugApplicationReady_cnfActions[];
static const Transition kDrWaitApplicationReadyCnfPlugSubmoduleToReadyByS_PNS_PlugApplicationReady_cnf;

// State DrWaitApplicationReadyPlugSubmodule
static Transition DrWaitApplicationReadyPlugSubmoduleHandler(ImplPtr impl, Event event);
static const State kDrWaitApplicationReadyPlugSubmodule;
Expand All @@ -79,61 +106,34 @@ class IoArHandlerMain : public IoArHandlerMainBase
static const Transition::ActionType kDrWaitApplicationReadyPlugSubmoduleToDrWaitApplicationReadyPlugSubmoduleBySPnpbAppTimeoutActions[];
static const Transition kDrWaitApplicationReadyPlugSubmoduleToDrWaitApplicationReadyPlugSubmoduleBySPnpbAppTimeout;

// State DrWaitPullCnf
static Transition DrWaitPullCnfHandler(ImplPtr impl, Event event);
static const State kDrWaitPullCnf;
// Transition S_PNS_PullSubmodule_cnf: DrWaitPullCnf -> Ready
static const Transition::ActionType kDrWaitPullCnfToReadyByS_PNS_PullSubmodule_cnfActions[];
static const Transition kDrWaitPullCnfToReadyByS_PNS_PullSubmodule_cnf;

// State DrWaitApplicationReadyCnfPlugSubmodule
static Transition DrWaitApplicationReadyCnfPlugSubmoduleHandler(ImplPtr impl, Event event);
static const State kDrWaitApplicationReadyCnfPlugSubmodule;
// Transition S_PNS_PlugApplicationReady_cnf: DrWaitApplicationReadyCnfPlugSubmodule -> Ready
static const Transition::ActionType kDrWaitApplicationReadyCnfPlugSubmoduleToReadyByS_PNS_PlugApplicationReady_cnfActions[];
static const Transition kDrWaitApplicationReadyCnfPlugSubmoduleToReadyByS_PNS_PlugApplicationReady_cnf;

// State DrWaitPlugCnf
static Transition DrWaitPlugCnfHandler(ImplPtr impl, Event event);
static const State kDrWaitPlugCnf;
// Transition S_PNS_PlugSubmodule_cnf: DrWaitPlugCnf -> DrPlugPrmSequence
static const Transition::ActionType kDrWaitPlugCnfToDrPlugPrmSequenceByS_PNS_PlugSubmodule_cnfActions[];
static const Transition kDrWaitPlugCnfToDrPlugPrmSequenceByS_PNS_PlugSubmodule_cnf;

// State DrWaitPullCnf
static Transition DrWaitPullCnfHandler(ImplPtr impl, Event event);
static const State kDrWaitPullCnf;
// Transition S_PNS_PullSubmodule_cnf: DrWaitPullCnf -> Ready
static const Transition::ActionType kDrWaitPullCnfToReadyByS_PNS_PullSubmodule_cnfActions[];
static const Transition kDrWaitPullCnfToReadyByS_PNS_PullSubmodule_cnf;

// State DrPlugPrmSequence
static Transition DrPlugPrmSequenceHandler(ImplPtr impl, Event event);
static const State kDrPlugPrmSequence;
// Transition S_PNS_PlugParamEndInd: DrPlugPrmSequence -> DrWaitApplicationReadyPlugSubmodule
static const Transition::ActionType kDrPlugPrmSequenceToDrWaitApplicationReadyPlugSubmoduleByS_PNS_PlugParamEndIndActions[];
static const Transition kDrPlugPrmSequenceToDrWaitApplicationReadyPlugSubmoduleByS_PNS_PlugParamEndInd;

// State Parameterizing
static Transition ParameterizingHandler(ImplPtr impl, Event event);
static const State kParameterizing;
// Transition S_PNS_ParamEndInd: Parameterizing -> WaitApplicationReady
static const Transition::ActionType kParameterizingToWaitApplicationReadyByS_PNS_ParamEndIndActions[];
static const Transition kParameterizingToWaitApplicationReadyByS_PNS_ParamEndInd;
// Transition S_PNS_ParamEndInd: Parameterizing -> WaitApplicationReadyCnf
static const Transition::ActionType kParameterizingToWaitApplicationReadyCnfByS_PNS_ParamEndIndActions[];
static const Transition kParameterizingToWaitApplicationReadyCnfByS_PNS_ParamEndInd;

// State WaitApplicationReadyCnf
static Transition WaitApplicationReadyCnfHandler(ImplPtr impl, Event event);
static const State kWaitApplicationReadyCnf;
// Transition S_PNS_ApplicationReady_cnf: WaitApplicationReadyCnf -> ApplicationReady
static const Transition::ActionType kWaitApplicationReadyCnfToApplicationReadyByS_PNS_ApplicationReady_cnfActions[];
static const Transition kWaitApplicationReadyCnfToApplicationReadyByS_PNS_ApplicationReady_cnf;
// Transition S_PNS_ApplicationReady_cnf: WaitApplicationReadyCnf -> WaitApplicationReadyCnf
static const Transition::ActionType kWaitApplicationReadyCnfToWaitApplicationReadyCnfByS_PNS_ApplicationReady_cnfActions[];
static const Transition kWaitApplicationReadyCnfToWaitApplicationReadyCnfByS_PNS_ApplicationReady_cnf;

// State WaitApplicationReady
static Transition WaitApplicationReadyHandler(ImplPtr impl, Event event);
static const State kWaitApplicationReady;
// Transition SPnpbAppTimeout: WaitApplicationReady -> WaitApplicationReadyCnf
static const Transition::ActionType kWaitApplicationReadyToWaitApplicationReadyCnfBySPnpbAppTimeoutActions[];
static const Transition kWaitApplicationReadyToWaitApplicationReadyCnfBySPnpbAppTimeout;
// Transition SPnpbAppTimeout: WaitApplicationReady -> WaitApplicationReady
static const Transition::ActionType kWaitApplicationReadyToWaitApplicationReadyBySPnpbAppTimeoutActions[];
static const Transition kWaitApplicationReadyToWaitApplicationReadyBySPnpbAppTimeout;
// State Ready
static Transition ReadyHandler(ImplPtr impl, Event event);
static const State kReady;
// Transition S_PNS_DynReconfPull: Ready -> DrWaitPullCnf
static const Transition::ActionType kReadyToDrWaitPullCnfByS_PNS_DynReconfPullActions[];
static const Transition kReadyToDrWaitPullCnfByS_PNS_DynReconfPull;
// Transition S_PNS_DynReconfPlug: Ready -> DrWaitPlugCnf
static const Transition::ActionType kReadyToDrWaitPlugCnfByS_PNS_DynReconfPlugActions[];
static const Transition kReadyToDrWaitPlugCnfByS_PNS_DynReconfPlug;
};
Loading

0 comments on commit b7ec0d5

Please sign in to comment.