HistoryWithExitPoint.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #ifndef HISTORYWITHEXITPOINT_H_
  2. #define HISTORYWITHEXITPOINT_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'HistoryWithExitPoint'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. HistoryWithExitPoint_last_state,
  13. HistoryWithExitPoint_mr_A,
  14. HistoryWithExitPoint_mr_A_r_X1,
  15. HistoryWithExitPoint_mr_A_r_X2,
  16. HistoryWithExitPoint_mr_B
  17. } HistoryWithExitPointStates;
  18. /*! Type definition of the data structure for the HistoryWithExitPointIface interface scope. */
  19. typedef struct
  20. {
  21. sc_boolean push_raised;
  22. sc_boolean back_raised;
  23. sc_boolean next_raised;
  24. } HistoryWithExitPointIface;
  25. /*! Define dimension of the state configuration vector for orthogonal states. */
  26. #define HISTORYWITHEXITPOINT_MAX_ORTHOGONAL_STATES 1
  27. /*! Define dimension of the state configuration vector for history states. */
  28. #define HISTORYWITHEXITPOINT_MAX_HISTORY_STATES 1
  29. /*! Define indices of states in the StateConfVector */
  30. #define SCVI_HISTORYWITHEXITPOINT_MR_A 0
  31. #define SCVI_HISTORYWITHEXITPOINT_MR_A_R_X1 0
  32. #define SCVI_HISTORYWITHEXITPOINT_MR_A_R_X2 0
  33. #define SCVI_HISTORYWITHEXITPOINT_MR_B 0
  34. /*!
  35. * Type definition of the data structure for the HistoryWithExitPoint state machine.
  36. * This data structure has to be allocated by the client code.
  37. */
  38. typedef struct
  39. {
  40. HistoryWithExitPointStates stateConfVector[HISTORYWITHEXITPOINT_MAX_ORTHOGONAL_STATES];
  41. HistoryWithExitPointStates historyVector[HISTORYWITHEXITPOINT_MAX_HISTORY_STATES];
  42. sc_ushort stateConfVectorPosition;
  43. HistoryWithExitPointIface iface;
  44. } HistoryWithExitPoint;
  45. /*! Initializes the HistoryWithExitPoint state machine data structures. Must be called before first usage.*/
  46. extern void historyWithExitPoint_init(HistoryWithExitPoint* handle);
  47. /*! Activates the state machine */
  48. extern void historyWithExitPoint_enter(HistoryWithExitPoint* handle);
  49. /*! Deactivates the state machine */
  50. extern void historyWithExitPoint_exit(HistoryWithExitPoint* handle);
  51. /*! Performs a 'run to completion' step. */
  52. extern void historyWithExitPoint_runCycle(HistoryWithExitPoint* handle);
  53. /*! Raises the in event 'push' that is defined in the default interface scope. */
  54. extern void historyWithExitPointIface_raise_push(HistoryWithExitPoint* handle);
  55. /*! Raises the in event 'back' that is defined in the default interface scope. */
  56. extern void historyWithExitPointIface_raise_back(HistoryWithExitPoint* handle);
  57. /*! Raises the in event 'next' that is defined in the default interface scope. */
  58. extern void historyWithExitPointIface_raise_next(HistoryWithExitPoint* handle);
  59. /*!
  60. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  61. * 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.
  62. */
  63. extern sc_boolean historyWithExitPoint_isActive(const HistoryWithExitPoint* handle);
  64. /*!
  65. * Checks if all active states are final.
  66. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  67. */
  68. extern sc_boolean historyWithExitPoint_isFinal(const HistoryWithExitPoint* handle);
  69. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  70. extern sc_boolean historyWithExitPoint_isStateActive(const HistoryWithExitPoint* handle, HistoryWithExitPointStates state);
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74. #endif /* HISTORYWITHEXITPOINT_H_ */