StatechartKeywords.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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_main_region_Timer,
  13. StatechartKeywords_last_state
  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. /*!
  46. * Type definition of the data structure for the StatechartKeywords state machine.
  47. * This data structure has to be allocated by the client code.
  48. */
  49. typedef struct
  50. {
  51. StatechartKeywordsStates stateConfVector[STATECHARTKEYWORDS_MAX_ORTHOGONAL_STATES];
  52. sc_ushort stateConfVectorPosition;
  53. StatechartKeywordsIfaceIf ifaceIf;
  54. StatechartKeywordsInternal internal;
  55. StatechartKeywordsTimeEvents timeEvents;
  56. } StatechartKeywords;
  57. /*! Initializes the StatechartKeywords state machine data structures. Must be called before first usage.*/
  58. extern void statechartKeywords_init(StatechartKeywords* handle);
  59. /*! Activates the state machine */
  60. extern void statechartKeywords_enter(StatechartKeywords* handle);
  61. /*! Deactivates the state machine */
  62. extern void statechartKeywords_exit(StatechartKeywords* handle);
  63. /*! Performs a 'run to completion' step. */
  64. extern void statechartKeywords_runCycle(StatechartKeywords* handle);
  65. /*! Raises a time event. */
  66. extern void statechartKeywords_raiseTimeEvent(const StatechartKeywords* handle, sc_eventid evid);
  67. /*! Gets the value of the variable 'timer' that is defined in the interface scope 'if'. */
  68. extern sc_integer statechartKeywordsIfaceIf_get_timer(const StatechartKeywords* handle);
  69. /*! Sets the value of the variable 'timer' that is defined in the interface scope 'if'. */
  70. extern void statechartKeywordsIfaceIf_set_timer(StatechartKeywords* handle, sc_integer value);
  71. /*! Gets the value of the variable 'isActive' that is defined in the interface scope 'if'. */
  72. extern sc_integer statechartKeywordsIfaceIf_get_isActive(const StatechartKeywords* handle);
  73. /*! Sets the value of the variable 'isActive' that is defined in the interface scope 'if'. */
  74. extern void statechartKeywordsIfaceIf_set_isActive(StatechartKeywords* handle, sc_integer value);
  75. /*! Gets the value of the variable 'init' that is defined in the interface scope 'if'. */
  76. extern sc_integer statechartKeywordsIfaceIf_get_init(const StatechartKeywords* handle);
  77. /*! Sets the value of the variable 'init' that is defined in the interface scope 'if'. */
  78. extern void statechartKeywordsIfaceIf_set_init(StatechartKeywords* handle, sc_integer value);
  79. /*! Gets the value of the variable 'enter' that is defined in the interface scope 'if'. */
  80. extern sc_integer statechartKeywordsIfaceIf_get_enter(const StatechartKeywords* handle);
  81. /*! Sets the value of the variable 'enter' that is defined in the interface scope 'if'. */
  82. extern void statechartKeywordsIfaceIf_set_enter(StatechartKeywords* handle, sc_integer value);
  83. /*! Gets the value of the variable 'runCycle' that is defined in the interface scope 'if'. */
  84. extern sc_integer statechartKeywordsIfaceIf_get_runCycle(const StatechartKeywords* handle);
  85. /*! Sets the value of the variable 'runCycle' that is defined in the interface scope 'if'. */
  86. extern void statechartKeywordsIfaceIf_set_runCycle(StatechartKeywords* handle, sc_integer value);
  87. /*! Checks if the out event 'operationCallback' that is defined in the interface scope 'if' has been raised. */
  88. extern sc_boolean statechartKeywordsIfaceIf_israised_operationCallback(const StatechartKeywords* handle);
  89. /*! Checks if the out event 'listeners' that is defined in the interface scope 'if' has been raised. */
  90. extern sc_boolean statechartKeywordsIfaceIf_israised_listeners(const StatechartKeywords* handle);
  91. /*!
  92. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  93. * 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.
  94. */
  95. extern sc_boolean statechartKeywords_isActive(const StatechartKeywords* handle);
  96. /*!
  97. * Checks if all active states are final.
  98. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  99. */
  100. extern sc_boolean statechartKeywords_isFinal(const StatechartKeywords* handle);
  101. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  102. extern sc_boolean statechartKeywords_isStateActive(const StatechartKeywords* handle, StatechartKeywordsStates state);
  103. #ifdef __cplusplus
  104. }
  105. #endif
  106. #endif /* STATECHARTKEYWORDS_H_ */