HistoryWithExitPoint.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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_mr_A,
  13. HistoryWithExitPoint_mr_A_r_X1,
  14. HistoryWithExitPoint_mr_A_r_X2,
  15. HistoryWithExitPoint_mr_B,
  16. HistoryWithExitPoint_last_state
  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. /*!
  30. * Type definition of the data structure for the HistoryWithExitPoint state machine.
  31. * This data structure has to be allocated by the client code.
  32. */
  33. typedef struct
  34. {
  35. HistoryWithExitPointStates stateConfVector[HISTORYWITHEXITPOINT_MAX_ORTHOGONAL_STATES];
  36. HistoryWithExitPointStates historyVector[HISTORYWITHEXITPOINT_MAX_HISTORY_STATES];
  37. sc_ushort stateConfVectorPosition;
  38. HistoryWithExitPointIface iface;
  39. } HistoryWithExitPoint;
  40. /*! Initializes the HistoryWithExitPoint state machine data structures. Must be called before first usage.*/
  41. extern void historyWithExitPoint_init(HistoryWithExitPoint* handle);
  42. /*! Activates the state machine */
  43. extern void historyWithExitPoint_enter(HistoryWithExitPoint* handle);
  44. /*! Deactivates the state machine */
  45. extern void historyWithExitPoint_exit(HistoryWithExitPoint* handle);
  46. /*! Performs a 'run to completion' step. */
  47. extern void historyWithExitPoint_runCycle(HistoryWithExitPoint* handle);
  48. /*! Raises the in event 'push' that is defined in the default interface scope. */
  49. extern void historyWithExitPointIface_raise_push(HistoryWithExitPoint* handle);
  50. /*! Raises the in event 'back' that is defined in the default interface scope. */
  51. extern void historyWithExitPointIface_raise_back(HistoryWithExitPoint* handle);
  52. /*! Raises the in event 'next' that is defined in the default interface scope. */
  53. extern void historyWithExitPointIface_raise_next(HistoryWithExitPoint* handle);
  54. /*!
  55. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  56. * 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.
  57. */
  58. extern sc_boolean historyWithExitPoint_isActive(const HistoryWithExitPoint* handle);
  59. /*!
  60. * Checks if all active states are final.
  61. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  62. */
  63. extern sc_boolean historyWithExitPoint_isFinal(const HistoryWithExitPoint* handle);
  64. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  65. extern sc_boolean historyWithExitPoint_isStateActive(const HistoryWithExitPoint* handle, HistoryWithExitPointStates state);
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69. #endif /* HISTORYWITHEXITPOINT_H_ */