Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/org.eclipse.etrice.generator.c.reference/src-gen/MassiveMultiThreading/Supervisor.c')
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src-gen/MassiveMultiThreading/Supervisor.c184
1 files changed, 0 insertions, 184 deletions
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src-gen/MassiveMultiThreading/Supervisor.c b/examples/org.eclipse.etrice.generator.c.reference/src-gen/MassiveMultiThreading/Supervisor.c
deleted file mode 100644
index bfe78a39f..000000000
--- a/examples/org.eclipse.etrice.generator.c.reference/src-gen/MassiveMultiThreading/Supervisor.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- * @author generated by eTrice
- *
- * Source File of ActorClass Supervisor
- *
- */
-
-#include "Supervisor.h"
-
-#include "modelbase/etActor.h"
-#include "debugging/etLogger.h"
-#include "debugging/etMSCLogger.h"
-#include "etUnit/etUnit.h"
-#include "platform/etMemory.h"
-
-#include "SecurityProtocol.h"
-
-
-/* interface item IDs */
-enum interface_items {
- IFITEM_application = 1
-};
-
-/* state IDs */
-enum state_ids {
- NO_STATE = 0,
- STATE_TOP = 1,
- STATE_PingPongActive = 2
-};
-
-/* transition chains */
-enum chain_ids {
- CHAIN_TRANS_INITIAL_TO__PingPongActive = 1,
- CHAIN_TRANS_tr0_FROM_PingPongActive_TO_PingPongActive_BY_pingapplication_tr0 = 2
-};
-
-/* triggers */
-enum triggers {
- POLLING = 0,
- TRIG_application__ping = IFITEM_application + EVT_SHIFT*SecurityProtocol_IN_ping
-};
-
-
-static void setState(Supervisor* self, int new_state) {
- self->state = (etInt16) new_state;
-}
-
-static int getState(Supervisor* self) {
- return self->state;
-}
-
-/* Entry and Exit Codes */
-
-/* Action Codes */
-static void action_TRANS_tr0_FROM_PingPongActive_TO_PingPongActive_BY_pingapplication_tr0(Supervisor* self, const InterfaceItemBase* ifitem) {
- SecurityProtocolPort_pong(&self->constData->application) /* ORIG: application.pong() */;
-}
-
-/**
- * calls exit codes while exiting from the current state to one of its
- * parent states while remembering the history
- * @param current - the current state
- * @param to - the final parent state
- * @param handler - entry and exit codes are called only if not handler (for handler TransitionPoints)
- */
-static void exitTo(Supervisor* self, int current, int to, boolean handler) {
- while (current!=to) {
- switch (current) {
- case STATE_PingPongActive:
- self->history[STATE_TOP] = STATE_PingPongActive;
- current = STATE_TOP;
- break;
- }
- }
-}
-
-/**
- * calls action, entry and exit codes along a transition chain. The generic data are cast to typed data
- * matching the trigger of this chain. The ID of the final state is returned
- * @param chain - the chain ID
- * @param generic_data - the generic data pointer
- * @return the ID of the final state
- */
-static int executeTransitionChain(Supervisor* self, int chain, const InterfaceItemBase* ifitem, void* generic_data) {
- switch (chain) {
- case CHAIN_TRANS_INITIAL_TO__PingPongActive:
- {
- return STATE_PingPongActive;
- }
- case CHAIN_TRANS_tr0_FROM_PingPongActive_TO_PingPongActive_BY_pingapplication_tr0:
- {
- action_TRANS_tr0_FROM_PingPongActive_TO_PingPongActive_BY_pingapplication_tr0(self, ifitem);
- return STATE_PingPongActive;
- }
- }
- return NO_STATE;
-}
-
-/**
- * calls entry codes while entering a state's history. The ID of the final leaf state is returned
- * @param state - the state which is entered
- * @param handler - entry code is executed if not handler
- * @return - the ID of the final leaf state
- */
-static int enterHistory(Supervisor* self, int state, boolean handler, boolean skip_entry) {
- while (TRUE) {
- switch (state) {
- case STATE_PingPongActive:
- // in leaf state: return state id
- return STATE_PingPongActive;
- case STATE_TOP:
- state = self->history[STATE_TOP];
- break;
- }
- skip_entry = FALSE;
- }
- //return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true)
-}
-
-static void Supervisor_executeInitTransition(Supervisor* self) {
- int chain = CHAIN_TRANS_INITIAL_TO__PingPongActive;
- int next = executeTransitionChain(self, chain, NULL, NULL);
- next = enterHistory(self, next, FALSE, FALSE);
- setState(self, next);
-}
-
-/* receiveEvent contains the main implementation of the FSM */
-static void Supervisor_receiveEvent(Supervisor* self, InterfaceItemBase* ifitem, int evt, void* generic_data) {
- int trigger = ifitem->localId + EVT_SHIFT*evt;
- int chain = NOT_CAUGHT;
- int catching_state = NO_STATE;
- boolean is_handler = FALSE;
- boolean skip_entry = FALSE;
-
- if (!handleSystemEvent(ifitem, evt, generic_data)) {
- switch (getState(self)) {
- case STATE_PingPongActive:
- switch(trigger) {
- case TRIG_application__ping:
- {
- chain = CHAIN_TRANS_tr0_FROM_PingPongActive_TO_PingPongActive_BY_pingapplication_tr0;
- catching_state = STATE_TOP;
- }
- break;
- }
- break;
- }
- }
- if (chain != NOT_CAUGHT) {
- exitTo(self, getState(self), catching_state, is_handler);
- int next = executeTransitionChain(self, chain, ifitem, generic_data);
- next = enterHistory(self, next, is_handler, skip_entry);
- setState(self, next);
- }
-}
-
-//******************************************
-// END of generated code for FSM
-//******************************************
-
-void Supervisor_init(Supervisor* self){
- ET_MSC_LOGGER_SYNC_ENTRY("Supervisor", "init")
- self->state = STATE_TOP;
- {
- int i;
- for (i=0; i<SUPERVISOR_HISTORY_SIZE; ++i)
- self->history[i] = NO_STATE;
- }
- Supervisor_executeInitTransition(self);
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-
-void Supervisor_receiveMessage(void* self, void* ifitem, const etMessage* msg){
- ET_MSC_LOGGER_SYNC_ENTRY("Supervisor", "_receiveMessage")
-
- Supervisor_receiveEvent(self, (etPort*)ifitem, msg->evtID, (void*)(((char*)msg)+MEM_CEIL(sizeof(etMessage))));
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-
-/*--------------------- operations ---------------------*/
-

Back to the top