FinalState.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_last_state,
  13. FinalState_main_region_myState,
  14. FinalState_main_region__final_
  15. } FinalStateStates;
  16. /*! Define dimension of the state configuration vector for orthogonal states. */
  17. #define FINALSTATE_MAX_ORTHOGONAL_STATES 1
  18. /*! Define indices of states in the StateConfVector */
  19. #define SCVI_FINALSTATE_MAIN_REGION_MYSTATE 0
  20. #define SCVI_FINALSTATE_MAIN_REGION__FINAL_ 0
  21. /*!
  22. * Type definition of the data structure for the FinalState state machine.
  23. * This data structure has to be allocated by the client code.
  24. */
  25. typedef struct
  26. {
  27. FinalStateStates stateConfVector[FINALSTATE_MAX_ORTHOGONAL_STATES];
  28. sc_ushort stateConfVectorPosition;
  29. } FinalState;
  30. /*! Initializes the FinalState state machine data structures. Must be called before first usage.*/
  31. extern void finalState_init(FinalState* handle);
  32. /*! Activates the state machine */
  33. extern void finalState_enter(FinalState* handle);
  34. /*! Deactivates the state machine */
  35. extern void finalState_exit(FinalState* handle);
  36. /*! Performs a 'run to completion' step. */
  37. extern void finalState_runCycle(FinalState* handle);
  38. /*!
  39. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  40. * 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.
  41. */
  42. extern sc_boolean finalState_isActive(const FinalState* handle);
  43. /*!
  44. * Checks if all active states are final.
  45. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  46. */
  47. extern sc_boolean finalState_isFinal(const FinalState* handle);
  48. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  49. extern sc_boolean finalState_isStateActive(const FinalState* handle, FinalStateStates state);
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif /* FINALSTATE_H_ */