FinalState.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef FINALSTATE_H_
  2. #define FINALSTATE_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'FinalState'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. FinalState_main_region_myState,
  13. FinalState_main_region__final_,
  14. FinalState_last_state
  15. } FinalStateStates;
  16. /*! Define dimension of the state configuration vector for orthogonal states. */
  17. #define FINALSTATE_MAX_ORTHOGONAL_STATES 1
  18. /*!
  19. * Type definition of the data structure for the FinalState state machine.
  20. * This data structure has to be allocated by the client code.
  21. */
  22. typedef struct
  23. {
  24. FinalStateStates stateConfVector[FINALSTATE_MAX_ORTHOGONAL_STATES];
  25. sc_ushort stateConfVectorPosition;
  26. } FinalState;
  27. /*! Initializes the FinalState state machine data structures. Must be called before first usage.*/
  28. extern void finalState_init(FinalState* handle);
  29. /*! Activates the state machine */
  30. extern void finalState_enter(FinalState* handle);
  31. /*! Deactivates the state machine */
  32. extern void finalState_exit(FinalState* handle);
  33. /*! Performs a 'run to completion' step. */
  34. extern void finalState_runCycle(FinalState* handle);
  35. /*!
  36. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  37. * A state machine is active if it was entered. It is inactive if it has not been entered at all or if it has been exited.
  38. */
  39. extern sc_boolean finalState_isActive(const FinalState* handle);
  40. /*!
  41. * Checks if all active states are final.
  42. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  43. */
  44. extern sc_boolean finalState_isFinal(const FinalState* handle);
  45. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  46. extern sc_boolean finalState_isStateActive(const FinalState* handle, FinalStateStates state);
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50. #endif /* FINALSTATE_H_ */