Declarations.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. #ifndef DECLARATIONS_H_
  2. #define DECLARATIONS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'Declarations'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. Declarations_main_region_A,
  13. Declarations_main_region_B,
  14. Declarations_last_state
  15. } DeclarationsStates;
  16. /*! Type definition of the data structure for the DeclarationsIface interface scope. */
  17. typedef struct
  18. {
  19. sc_boolean evA_raised;
  20. sc_boolean evB_raised;
  21. sc_boolean evC_raised;
  22. sc_boolean evC_value;
  23. sc_boolean evD_raised;
  24. sc_integer evD_value;
  25. sc_boolean evE_raised;
  26. sc_real evE_value;
  27. sc_boolean evF_raised;
  28. sc_string evF_value;
  29. sc_boolean varA;
  30. sc_integer varB;
  31. sc_real varC;
  32. sc_string varD;
  33. sc_integer varE;
  34. } DeclarationsIface;
  35. /*! Type definition of the data structure for the DeclarationsIfaceIfA interface scope. */
  36. typedef struct
  37. {
  38. sc_boolean evA_raised;
  39. sc_boolean evB_raised;
  40. sc_boolean evC_raised;
  41. sc_boolean evC_value;
  42. sc_boolean evD_raised;
  43. sc_integer evD_value;
  44. sc_boolean evE_raised;
  45. sc_real evE_value;
  46. sc_boolean evF_raised;
  47. sc_string evF_value;
  48. sc_boolean varA;
  49. sc_integer varB;
  50. sc_real varC;
  51. sc_string varD;
  52. sc_integer varE;
  53. } DeclarationsIfaceIfA;
  54. /*! Type definition of the data structure for the DeclarationsInternal interface scope. */
  55. typedef struct
  56. {
  57. sc_boolean evInA_raised;
  58. sc_boolean evInB_raised;
  59. sc_boolean evInC_raised;
  60. sc_boolean evInC_value;
  61. sc_boolean evInD_raised;
  62. sc_integer evInD_value;
  63. sc_boolean evInE_raised;
  64. sc_real evInE_value;
  65. sc_boolean evInF_raised;
  66. sc_string evInF_value;
  67. sc_boolean varInA;
  68. sc_integer varInB;
  69. sc_real varInC;
  70. sc_string varInD;
  71. sc_integer varInE;
  72. } DeclarationsInternal;
  73. /*! Define dimension of the state configuration vector for orthogonal states. */
  74. #define DECLARATIONS_MAX_ORTHOGONAL_STATES 1
  75. /*!
  76. * Type definition of the data structure for the Declarations state machine.
  77. * This data structure has to be allocated by the client code.
  78. */
  79. typedef struct
  80. {
  81. DeclarationsStates stateConfVector[DECLARATIONS_MAX_ORTHOGONAL_STATES];
  82. sc_ushort stateConfVectorPosition;
  83. DeclarationsIface iface;
  84. DeclarationsIfaceIfA ifaceIfA;
  85. DeclarationsInternal internal;
  86. } Declarations;
  87. /*! Initializes the Declarations state machine data structures. Must be called before first usage.*/
  88. extern void declarations_init(Declarations* handle);
  89. /*! Activates the state machine */
  90. extern void declarations_enter(Declarations* handle);
  91. /*! Deactivates the state machine */
  92. extern void declarations_exit(Declarations* handle);
  93. /*! Performs a 'run to completion' step. */
  94. extern void declarations_runCycle(Declarations* handle);
  95. /*! Raises the in event 'evA' that is defined in the default interface scope. */
  96. extern void declarationsIface_raise_evA(Declarations* handle);
  97. /*! Checks if the out event 'evB' that is defined in the default interface scope has been raised. */
  98. extern sc_boolean declarationsIface_israised_evB(const Declarations* handle);
  99. /*! Raises the in event 'evC' that is defined in the default interface scope. */
  100. extern void declarationsIface_raise_evC(Declarations* handle, sc_boolean value);
  101. /*! Checks if the out event 'evD' that is defined in the default interface scope has been raised. */
  102. extern sc_boolean declarationsIface_israised_evD(const Declarations* handle);
  103. /*! Gets the value of the out event 'evD' that is defined in the default interface scope. */
  104. extern sc_integer declarationsIface_get_evD_value(const Declarations* handle);
  105. /*! Raises the in event 'evE' that is defined in the default interface scope. */
  106. extern void declarationsIface_raise_evE(Declarations* handle, sc_real value);
  107. /*! Checks if the out event 'evF' that is defined in the default interface scope has been raised. */
  108. extern sc_boolean declarationsIface_israised_evF(const Declarations* handle);
  109. /*! Gets the value of the out event 'evF' that is defined in the default interface scope. */
  110. extern sc_string declarationsIface_get_evF_value(const Declarations* handle);
  111. /*! Gets the value of the variable 'varA' that is defined in the default interface scope. */
  112. extern sc_boolean declarationsIface_get_varA(const Declarations* handle);
  113. /*! Sets the value of the variable 'varA' that is defined in the default interface scope. */
  114. extern void declarationsIface_set_varA(Declarations* handle, sc_boolean value);
  115. /*! Gets the value of the variable 'varB' that is defined in the default interface scope. */
  116. extern sc_integer declarationsIface_get_varB(const Declarations* handle);
  117. /*! Sets the value of the variable 'varB' that is defined in the default interface scope. */
  118. extern void declarationsIface_set_varB(Declarations* handle, sc_integer value);
  119. /*! Gets the value of the variable 'varC' that is defined in the default interface scope. */
  120. extern sc_real declarationsIface_get_varC(const Declarations* handle);
  121. /*! Sets the value of the variable 'varC' that is defined in the default interface scope. */
  122. extern void declarationsIface_set_varC(Declarations* handle, sc_real value);
  123. /*! Gets the value of the variable 'varD' that is defined in the default interface scope. */
  124. extern sc_string declarationsIface_get_varD(const Declarations* handle);
  125. /*! Sets the value of the variable 'varD' that is defined in the default interface scope. */
  126. extern void declarationsIface_set_varD(Declarations* handle, sc_string value);
  127. /*! Gets the value of the variable 'varE' that is defined in the default interface scope. */
  128. extern sc_integer declarationsIface_get_varE(const Declarations* handle);
  129. /*! Sets the value of the variable 'varE' that is defined in the default interface scope. */
  130. extern void declarationsIface_set_varE(Declarations* handle, sc_integer value);
  131. /*! Raises the in event 'evA' that is defined in the interface scope 'ifA'. */
  132. extern void declarationsIfaceIfA_raise_evA(Declarations* handle);
  133. /*! Checks if the out event 'evB' that is defined in the interface scope 'ifA' has been raised. */
  134. extern sc_boolean declarationsIfaceIfA_israised_evB(const Declarations* handle);
  135. /*! Raises the in event 'evC' that is defined in the interface scope 'ifA'. */
  136. extern void declarationsIfaceIfA_raise_evC(Declarations* handle, sc_boolean value);
  137. /*! Checks if the out event 'evD' that is defined in the interface scope 'ifA' has been raised. */
  138. extern sc_boolean declarationsIfaceIfA_israised_evD(const Declarations* handle);
  139. /*! Gets the value of the out event 'evD' that is defined in the interface scope 'ifA'. */
  140. extern sc_integer declarationsIfaceIfA_get_evD_value(const Declarations* handle);
  141. /*! Raises the in event 'evE' that is defined in the interface scope 'ifA'. */
  142. extern void declarationsIfaceIfA_raise_evE(Declarations* handle, sc_real value);
  143. /*! Checks if the out event 'evF' that is defined in the interface scope 'ifA' has been raised. */
  144. extern sc_boolean declarationsIfaceIfA_israised_evF(const Declarations* handle);
  145. /*! Gets the value of the out event 'evF' that is defined in the interface scope 'ifA'. */
  146. extern sc_string declarationsIfaceIfA_get_evF_value(const Declarations* handle);
  147. /*! Gets the value of the variable 'varA' that is defined in the interface scope 'ifA'. */
  148. extern sc_boolean declarationsIfaceIfA_get_varA(const Declarations* handle);
  149. /*! Sets the value of the variable 'varA' that is defined in the interface scope 'ifA'. */
  150. extern void declarationsIfaceIfA_set_varA(Declarations* handle, sc_boolean value);
  151. /*! Gets the value of the variable 'varB' that is defined in the interface scope 'ifA'. */
  152. extern sc_integer declarationsIfaceIfA_get_varB(const Declarations* handle);
  153. /*! Sets the value of the variable 'varB' that is defined in the interface scope 'ifA'. */
  154. extern void declarationsIfaceIfA_set_varB(Declarations* handle, sc_integer value);
  155. /*! Gets the value of the variable 'varC' that is defined in the interface scope 'ifA'. */
  156. extern sc_real declarationsIfaceIfA_get_varC(const Declarations* handle);
  157. /*! Sets the value of the variable 'varC' that is defined in the interface scope 'ifA'. */
  158. extern void declarationsIfaceIfA_set_varC(Declarations* handle, sc_real value);
  159. /*! Gets the value of the variable 'varD' that is defined in the interface scope 'ifA'. */
  160. extern sc_string declarationsIfaceIfA_get_varD(const Declarations* handle);
  161. /*! Sets the value of the variable 'varD' that is defined in the interface scope 'ifA'. */
  162. extern void declarationsIfaceIfA_set_varD(Declarations* handle, sc_string value);
  163. /*! Gets the value of the variable 'varE' that is defined in the interface scope 'ifA'. */
  164. extern sc_integer declarationsIfaceIfA_get_varE(const Declarations* handle);
  165. /*! Sets the value of the variable 'varE' that is defined in the interface scope 'ifA'. */
  166. extern void declarationsIfaceIfA_set_varE(Declarations* handle, sc_integer value);
  167. /*!
  168. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  169. * 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.
  170. */
  171. extern sc_boolean declarations_isActive(const Declarations* handle);
  172. /*!
  173. * Checks if all active states are final.
  174. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  175. */
  176. extern sc_boolean declarations_isFinal(const Declarations* handle);
  177. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  178. extern sc_boolean declarations_isStateActive(const Declarations* handle, DeclarationsStates state);
  179. #ifdef __cplusplus
  180. }
  181. #endif
  182. #endif /* DECLARATIONS_H_ */