StatechartKeywords.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #ifndef STATECHARTKEYWORDS_H_
  2. #define STATECHARTKEYWORDS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'StatechartKeywords'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. StatechartKeywords_last_state,
  13. StatechartKeywords_main_region_Timer
  14. } StatechartKeywordsStates;
  15. /*! Type definition of the data structure for the StatechartKeywordsIfaceIf interface scope. */
  16. typedef struct
  17. {
  18. sc_integer timer;
  19. sc_integer isActive;
  20. sc_integer init;
  21. sc_integer enter;
  22. sc_integer runCycle;
  23. sc_boolean operationCallback_raised;
  24. sc_boolean listeners_raised;
  25. } StatechartKeywordsIfaceIf;
  26. /*! Type definition of the data structure for the StatechartKeywordsInternal interface scope. */
  27. typedef struct
  28. {
  29. sc_integer timer;
  30. sc_integer isActive;
  31. sc_integer init;
  32. sc_integer enter;
  33. sc_integer runCycle;
  34. sc_integer sCIIf;
  35. sc_boolean operationCallback_raised;
  36. sc_boolean listeners_raised;
  37. } StatechartKeywordsInternal;
  38. /*! Type definition of the data structure for the StatechartKeywordsTimeEvents interface scope. */
  39. typedef struct
  40. {
  41. sc_boolean statechartKeywords_tev0_raised;
  42. } StatechartKeywordsTimeEvents;
  43. /*! Define dimension of the state configuration vector for orthogonal states. */
  44. #define STATECHARTKEYWORDS_MAX_ORTHOGONAL_STATES 1
  45. /*! Define indices of states in the StateConfVector */
  46. #define SCVI_STATECHARTKEYWORDS_MAIN_REGION_TIMER 0
  47. /*!
  48. * Type definition of the data structure for the StatechartKeywords state machine.
  49. * This data structure has to be allocated by the client code.
  50. */
  51. typedef struct
  52. {
  53. StatechartKeywordsStates stateConfVector[STATECHARTKEYWORDS_MAX_ORTHOGONAL_STATES];
  54. sc_ushort stateConfVectorPosition;
  55. StatechartKeywordsIfaceIf ifaceIf;
  56. StatechartKeywordsInternal internal;
  57. StatechartKeywordsTimeEvents timeEvents;
  58. } StatechartKeywords;
  59. /*! Initializes the StatechartKeywords state machine data structures. Must be called before first usage.*/
  60. extern void statechartKeywords_init(StatechartKeywords* handle);
  61. /*! Activates the state machine */
  62. extern void statechartKeywords_enter(StatechartKeywords* handle);
  63. /*! Deactivates the state machine */
  64. extern void statechartKeywords_exit(StatechartKeywords* handle);
  65. /*! Performs a 'run to completion' step. */
  66. extern void statechartKeywords_runCycle(StatechartKeywords* handle);
  67. /*! Raises a time event. */
  68. extern void statechartKeywords_raiseTimeEvent(const StatechartKeywords* handle, sc_eventid evid);
  69. /*! Gets the value of the variable 'timer' that is defined in the interface scope 'if'. */
  70. extern sc_integer statechartKeywordsIfaceIf_get_timer(const StatechartKeywords* handle);
  71. /*! Sets the value of the variable 'timer' that is defined in the interface scope 'if'. */
  72. extern void statechartKeywordsIfaceIf_set_timer(StatechartKeywords* handle, sc_integer value);
  73. /*! Gets the value of the variable 'isActive' that is defined in the interface scope 'if'. */
  74. extern sc_integer statechartKeywordsIfaceIf_get_isActive(const StatechartKeywords* handle);
  75. /*! Sets the value of the variable 'isActive' that is defined in the interface scope 'if'. */
  76. extern void statechartKeywordsIfaceIf_set_isActive(StatechartKeywords* handle, sc_integer value);
  77. /*! Gets the value of the variable 'init' that is defined in the interface scope 'if'. */
  78. extern sc_integer statechartKeywordsIfaceIf_get_init(const StatechartKeywords* handle);
  79. /*! Sets the value of the variable 'init' that is defined in the interface scope 'if'. */
  80. extern void statechartKeywordsIfaceIf_set_init(StatechartKeywords* handle, sc_integer value);
  81. /*! Gets the value of the variable 'enter' that is defined in the interface scope 'if'. */
  82. extern sc_integer statechartKeywordsIfaceIf_get_enter(const StatechartKeywords* handle);
  83. /*! Sets the value of the variable 'enter' that is defined in the interface scope 'if'. */
  84. extern void statechartKeywordsIfaceIf_set_enter(StatechartKeywords* handle, sc_integer value);
  85. /*! Gets the value of the variable 'runCycle' that is defined in the interface scope 'if'. */
  86. extern sc_integer statechartKeywordsIfaceIf_get_runCycle(const StatechartKeywords* handle);
  87. /*! Sets the value of the variable 'runCycle' that is defined in the interface scope 'if'. */
  88. extern void statechartKeywordsIfaceIf_set_runCycle(StatechartKeywords* handle, sc_integer value);
  89. /*! Checks if the out event 'operationCallback' that is defined in the interface scope 'if' has been raised. */
  90. extern sc_boolean statechartKeywordsIfaceIf_israised_operationCallback(const StatechartKeywords* handle);
  91. /*! Checks if the out event 'listeners' that is defined in the interface scope 'if' has been raised. */
  92. extern sc_boolean statechartKeywordsIfaceIf_israised_listeners(const StatechartKeywords* handle);
  93. /*!
  94. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  95. * 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.
  96. */
  97. extern sc_boolean statechartKeywords_isActive(const StatechartKeywords* handle);
  98. /*!
  99. * Checks if all active states are final.
  100. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  101. */
  102. extern sc_boolean statechartKeywords_isFinal(const StatechartKeywords* handle);
  103. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  104. extern sc_boolean statechartKeywords_isStateActive(const StatechartKeywords* handle, StatechartKeywordsStates state);
  105. #ifdef __cplusplus
  106. }
  107. #endif
  108. #endif /* STATECHARTKEYWORDS_H_ */