FW Profile - C1 Implementation
FwSmDesc Struct Reference

Structure representing a state machine descriptor. More...

Data Fields

SmBaseDesc_tsmBase
 pointer to the base descriptor
 
FwSmAction_tsmActions
 the state machine actions (state and transition actions)
 
FwSmGuard_tsmGuards
 the transition guards in the state machine
 
struct FwSmDesc ** esmDesc
 the state machines embedded in the state machine
 
FwSmCounterS1_t nOfActions
 the number of actions (state actions + transition actions) in the state machine
 
FwSmCounterS1_t nOfGuards
 the number of guards in the state machine
 
FwSmCounterS1_t transCnt
 the counter for the number of transitions added to the state machine
 
FwSmCounterS1_t curState
 the current state of the state machine
 
FwSmCounterU3_t smExecCnt
 the state machine execution counter
 
FwSmCounterU3_t stateExecCnt
 the state execution counter
 
FwSmErrCode_t errCode
 either 'success' or the code of the last error encountered by the state machine
 
void * smData
 the pointer to the data manipulated by the state machine actions and guards
 

Detailed Description

Structure representing a state machine descriptor.

Field smBase points to the base descriptor for the state machine which holds the information about the states, choice pseudo-states and the transitions connecting them.

Array smActions holds the list of all actions in the state machine (including both state and transition actions). The first element of the array holds a dummy action which returns without doing anything. Each distinct action only appears once in the action array. If the same action is used several times in a state machine, only one instance is registered in the action array.

Array smGuards holds the list of all transition guards in the state machine. The first element of the array holds a dummy guard which always returns true. Each distinct guard only appears once in the guard array. If the same guard is used several times in a state machine, only one instance is registered in the guard array.

The i-th element of array esmDesc holds the state machine embedded in the i-th state of the state machine (or NULL if no state machine is embedded).

When a new state or choice pseudo-state is added to the state machine, field transCnt holds the position in the transition array where its first out-going transition will be stored.

The identifier of the current state (which can only be a proper state) is stored in curState. If this is equal to zero, then the state machine is stopped.

If during the creation, configuration or execution of the state machine, an error is encountered, the corresponding error code is stored in field errCode. This field is initialized to smSuccess and should nominally remain unchanged throughout the life of the state machine. If the error code has a value other than smSuccess, the behaviour of the state machine is undefined.

There are two types of state machines: base state machines (i.e. state machines which are created from scratch using FwSmCreate or FW_SM_INST) and derived state machines (i.e. state machines which are created by extending a base state machine through calls to FwSmCreateDer or FW_SM_INST_DER). By convention, a derived state machine is characterized by field transCnt being equal to zero.

Two counters are associated to a sttae machine: the State Machine Execution Counter and the State Execution Counter. The State Machine Execution Counter holds the number of execution cycles since the state machine was started and the State Execution Counter holds the number of cycle since the current state was entered.

Definition at line 303 of file FwSmPrivate.h.


The documentation for this struct was generated from the following file:
P&P Software GmbH, Copyright 2011, All Rights Reserved