From 981e0b94eaa5107126c0584201a4b456f48c37f8 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Thu, 28 Dec 2023 22:57:54 +0100 Subject: [PATCH] Work on eclipse epsilon --- experimental_epsilon/src/DeclarationState.egl | 8 +- experimental_epsilon/src/Model.egl | 10 +- .../src/gen/IoArHandlerMainDeclaration.hxx | 166 +++++++++--------- 3 files changed, 95 insertions(+), 89 deletions(-) diff --git a/experimental_epsilon/src/DeclarationState.egl b/experimental_epsilon/src/DeclarationState.egl index 91ed7f5..2486fa4 100644 --- a/experimental_epsilon/src/DeclarationState.egl +++ b/experimental_epsilon/src/DeclarationState.egl @@ -1,12 +1,12 @@ // State [%=state.name%] -static Transition [%=state.name%]Handler(ImplPtr impl, Event event); -static const State [%=state.variable_name%]; +static [%=statemachine.transition_type%] [%=state.name%]Handler([%=statemachine.impl_ptr_type%] impl, [%=statemachine.event_type%] event); +static const [%=statemachine.state_type%] [%=state.variable_name%]; [% for (transition in state.transitions) { %] // Transition [%=transition.trigger%]: [%=transition.start%] -> [%=transition.target%] -static const Transition::ActionType [%=transition.variable_name%]Actions[]; -static const Transition [%=transition.variable_name%]; +static const [%=statemachine.transition_action_type%] [%=transition.variable_name%]Actions[]; +static const [%=statemachine.transition_type%] [%=transition.variable_name%]; [% } if(state.region.isDefined()) { diff --git a/experimental_epsilon/src/Model.egl b/experimental_epsilon/src/Model.egl index 0ff3193..387ed7c 100644 --- a/experimental_epsilon/src/Model.egl +++ b/experimental_epsilon/src/Model.egl @@ -8,6 +8,12 @@ operation StateMachine getModel() : Tuple { var result = new Tuple(); result.name = self.name; result.region = sm.regions.first.getModel(result); + result.transition_type = "Transition"; + result.transition_action_type = "Transition::Action"; + result.state_type = "State"; + result.event_type = "Event"; + result.impl_type = "Impl"; + result.impl_ptr_type = "ImplPtr"; return result; } @@ -22,7 +28,7 @@ operation Region getModel(sm : Tuple) : Tuple { for (state in self.subvertices.select(s | s.isKindOf(State))) { result.states.add(state.getModel(sm)); } - result.states.sortBy(s | s.name); + result.states = result.states.sortBy(s | s.name); return result; } @@ -52,7 +58,7 @@ operation State getModel(sm : Tuple) : Tuple { for (transition in self.outgoing.sortBy(t | (t.guard = null) or (t.guard.name = "else"))) { transition.getModel(sm, result, result.transitions); } - result.transitions.sortBy(t | t.trigger + t.start + t.target); + result.transitions = result.transitions.sortBy(t | t.trigger + t.start + t.target); return result; } diff --git a/experimental_epsilon/src/gen/IoArHandlerMainDeclaration.hxx b/experimental_epsilon/src/gen/IoArHandlerMainDeclaration.hxx index 8887b8c..03bd9c8 100644 --- a/experimental_epsilon/src/gen/IoArHandlerMainDeclaration.hxx +++ b/experimental_epsilon/src/gen/IoArHandlerMainDeclaration.hxx @@ -11,130 +11,130 @@ class IoArHandlerMain : public IoArHandlerMainBase // State Closed static Transition ClosedHandler(ImplPtr impl, Event event); static const State kClosed; + // Transition S_PNS_ArOpend_ind: Closed -> Open + static const Transition::Action kClosedToOpenByS_PNS_ArOpend_indActions[]; + static const Transition kClosedToOpenByS_PNS_ArOpend_ind; + // Transition S_PNS_ReadReq: Closed -> Closed + static const Transition::Action kClosedToClosedByS_PNS_ReadReqActions[]; + static const Transition kClosedToClosedByS_PNS_ReadReq; // Transition S_PNS_SwitchoverRequestBackup: Closed -> Closed - static const Transition::ActionType kClosedToClosedByS_PNS_SwitchoverRequestBackupActions[]; + static const Transition::Action kClosedToClosedByS_PNS_SwitchoverRequestBackupActions[]; static const Transition kClosedToClosedByS_PNS_SwitchoverRequestBackup; // Transition S_PNS_SwitchoverRequestPrimary: Closed -> Closed - static const Transition::ActionType kClosedToClosedByS_PNS_SwitchoverRequestPrimaryActions[]; + static const Transition::Action kClosedToClosedByS_PNS_SwitchoverRequestPrimaryActions[]; static const Transition kClosedToClosedByS_PNS_SwitchoverRequestPrimary; - // Transition S_PNS_ArOpend_ind: Closed -> Open - static const Transition::ActionType kClosedToOpenByS_PNS_ArOpend_indActions[]; - static const Transition kClosedToOpenByS_PNS_ArOpend_ind; // Transition S_PNS_WriteReq: Closed -> Closed - static const Transition::ActionType kClosedToClosedByS_PNS_WriteReqActions[]; + static const Transition::Action kClosedToClosedByS_PNS_WriteReqActions[]; static const Transition kClosedToClosedByS_PNS_WriteReq; - // Transition S_PNS_ReadReq: Closed -> Closed - static const Transition::ActionType kClosedToClosedByS_PNS_ReadReqActions[]; - static const Transition kClosedToClosedByS_PNS_ReadReq; // State Open static Transition OpenHandler(ImplPtr impl, Event event); static const State kOpen; + // Transition S_PNS_ArClosed_ind: Open -> Closed + static const Transition::Action kOpenToClosedByS_PNS_ArClosed_indActions[]; + static const Transition kOpenToClosedByS_PNS_ArClosed_ind; + // Transition S_PNS_CheckModuleDiff: Open -> Open + static const Transition::Action kOpenToOpenByS_PNS_CheckModuleDiffActions[]; + static const Transition kOpenToOpenByS_PNS_CheckModuleDiff; + // Transition S_PNS_ReadReq: Open -> Open + static const Transition::Action kOpenToOpenByS_PNS_ReadReqActions[]; + static const Transition kOpenToOpenByS_PNS_ReadReq; // Transition S_PNS_SwitchoverRequestBackup: Open -> Open - static const Transition::ActionType kOpenToOpenByS_PNS_SwitchoverRequestBackupActions[]; + static const Transition::Action kOpenToOpenByS_PNS_SwitchoverRequestBackupActions[]; static const Transition kOpenToOpenByS_PNS_SwitchoverRequestBackup; // Transition S_PNS_SwitchoverRequestPrimary: Open -> Open - static const Transition::ActionType kOpenToOpenByS_PNS_SwitchoverRequestPrimaryActions[]; + static const Transition::Action kOpenToOpenByS_PNS_SwitchoverRequestPrimaryActions[]; static const Transition kOpenToOpenByS_PNS_SwitchoverRequestPrimary; - // Transition S_PNS_CheckModuleDiff: Open -> Open - static const Transition::ActionType kOpenToOpenByS_PNS_CheckModuleDiffActions[]; - static const Transition kOpenToOpenByS_PNS_CheckModuleDiff; // Transition S_PNS_WriteReq: Open -> Open - static const Transition::ActionType kOpenToOpenByS_PNS_WriteReqActions[]; + static const Transition::Action kOpenToOpenByS_PNS_WriteReqActions[]; static const Transition kOpenToOpenByS_PNS_WriteReq; - // Transition S_PNS_ReadReq: Open -> Open - static const Transition::ActionType kOpenToOpenByS_PNS_ReadReqActions[]; - static const Transition kOpenToOpenByS_PNS_ReadReq; - // Transition S_PNS_ArClosed_ind: Open -> Closed - static const Transition::ActionType kOpenToClosedByS_PNS_ArClosed_indActions[]; - static const Transition kOpenToClosedByS_PNS_ArClosed_ind; - - // 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 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 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 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::Action kDynamicReconfigurationRunningToDynamicReconfigurationRunningBySPnioAppTimeoutDynReconfActions[]; static const Transition kDynamicReconfigurationRunningToDynamicReconfigurationRunningBySPnioAppTimeoutDynReconf; - // 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::Action kDrPlugPrmSequenceToDrWaitApplicationReadyPlugSubmoduleByS_PNS_PlugParamEndIndActions[]; + static const Transition kDrPlugPrmSequenceToDrWaitApplicationReadyPlugSubmoduleByS_PNS_PlugParamEndInd; + + // State DrWaitApplicationReadyCnfPlugSubmodule + static Transition DrWaitApplicationReadyCnfPlugSubmoduleHandler(ImplPtr impl, Event event); + static const State kDrWaitApplicationReadyCnfPlugSubmodule; + // Transition S_PNS_PlugApplicationReady_cnf: DrWaitApplicationReadyCnfPlugSubmodule -> Ready + static const Transition::Action kDrWaitApplicationReadyCnfPlugSubmoduleToReadyByS_PNS_PlugApplicationReady_cnfActions[]; + static const Transition kDrWaitApplicationReadyCnfPlugSubmoduleToReadyByS_PNS_PlugApplicationReady_cnf; // State DrWaitApplicationReadyPlugSubmodule static Transition DrWaitApplicationReadyPlugSubmoduleHandler(ImplPtr impl, Event event); static const State kDrWaitApplicationReadyPlugSubmodule; // Transition SPnpbAppTimeout: DrWaitApplicationReadyPlugSubmodule -> DrWaitApplicationReadyCnfPlugSubmodule - static const Transition::ActionType kDrWaitApplicationReadyPlugSubmoduleToDrWaitApplicationReadyCnfPlugSubmoduleBySPnpbAppTimeoutActions[]; + static const Transition::Action kDrWaitApplicationReadyPlugSubmoduleToDrWaitApplicationReadyCnfPlugSubmoduleBySPnpbAppTimeoutActions[]; static const Transition kDrWaitApplicationReadyPlugSubmoduleToDrWaitApplicationReadyCnfPlugSubmoduleBySPnpbAppTimeout; // Transition SPnpbAppTimeout: DrWaitApplicationReadyPlugSubmodule -> DrWaitApplicationReadyPlugSubmodule - static const Transition::ActionType kDrWaitApplicationReadyPlugSubmoduleToDrWaitApplicationReadyPlugSubmoduleBySPnpbAppTimeoutActions[]; + static const Transition::Action kDrWaitApplicationReadyPlugSubmoduleToDrWaitApplicationReadyPlugSubmoduleBySPnpbAppTimeoutActions[]; static const Transition kDrWaitApplicationReadyPlugSubmoduleToDrWaitApplicationReadyPlugSubmoduleBySPnpbAppTimeout; // 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::Action kDrWaitPlugCnfToDrPlugPrmSequenceByS_PNS_PlugSubmodule_cnfActions[]; static const Transition kDrWaitPlugCnfToDrPlugPrmSequenceByS_PNS_PlugSubmodule_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 DrWaitPullCnf + static Transition DrWaitPullCnfHandler(ImplPtr impl, Event event); + static const State kDrWaitPullCnf; + // Transition S_PNS_PullSubmodule_cnf: DrWaitPullCnf -> Ready + static const Transition::Action 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 Ready + static Transition ReadyHandler(ImplPtr impl, Event event); + static const State kReady; + // Transition S_PNS_DynReconfPlug: Ready -> DrWaitPlugCnf + static const Transition::Action kReadyToDrWaitPlugCnfByS_PNS_DynReconfPlugActions[]; + static const Transition kReadyToDrWaitPlugCnfByS_PNS_DynReconfPlug; + // Transition S_PNS_DynReconfPull: Ready -> DrWaitPullCnf + static const Transition::Action kReadyToDrWaitPullCnfByS_PNS_DynReconfPullActions[]; + static const Transition kReadyToDrWaitPullCnfByS_PNS_DynReconfPull; + + // State Parameterizing + static Transition ParameterizingHandler(ImplPtr impl, Event event); + static const State kParameterizing; + // Transition S_PNS_ParamEndInd: Parameterizing -> WaitApplicationReady + static const Transition::Action kParameterizingToWaitApplicationReadyByS_PNS_ParamEndIndActions[]; + static const Transition kParameterizingToWaitApplicationReadyByS_PNS_ParamEndInd; + // Transition S_PNS_ParamEndInd: Parameterizing -> WaitApplicationReadyCnf + static const Transition::Action kParameterizingToWaitApplicationReadyCnfByS_PNS_ParamEndIndActions[]; + static const Transition kParameterizingToWaitApplicationReadyCnfByS_PNS_ParamEndInd; + + // State WaitApplicationReady + static Transition WaitApplicationReadyHandler(ImplPtr impl, Event event); + static const State kWaitApplicationReady; + // Transition SPnpbAppTimeout: WaitApplicationReady -> WaitApplicationReady + static const Transition::Action kWaitApplicationReadyToWaitApplicationReadyBySPnpbAppTimeoutActions[]; + static const Transition kWaitApplicationReadyToWaitApplicationReadyBySPnpbAppTimeout; + // Transition SPnpbAppTimeout: WaitApplicationReady -> WaitApplicationReadyCnf + static const Transition::Action kWaitApplicationReadyToWaitApplicationReadyCnfBySPnpbAppTimeoutActions[]; + static const Transition kWaitApplicationReadyToWaitApplicationReadyCnfBySPnpbAppTimeout; + + // State WaitApplicationReadyCnf + static Transition WaitApplicationReadyCnfHandler(ImplPtr impl, Event event); + static const State kWaitApplicationReadyCnf; + // Transition S_PNS_ApplicationReady_cnf: WaitApplicationReadyCnf -> ApplicationReady + static const Transition::Action kWaitApplicationReadyCnfToApplicationReadyByS_PNS_ApplicationReady_cnfActions[]; + static const Transition kWaitApplicationReadyCnfToApplicationReadyByS_PNS_ApplicationReady_cnf; + // Transition S_PNS_ApplicationReady_cnf: WaitApplicationReadyCnf -> WaitApplicationReadyCnf + static const Transition::Action kWaitApplicationReadyCnfToWaitApplicationReadyCnfByS_PNS_ApplicationReady_cnfActions[]; + static const Transition kWaitApplicationReadyCnfToWaitApplicationReadyCnfByS_PNS_ApplicationReady_cnf; };