Declarations.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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_last_state,
  13. Declarations_main_region_A,
  14. Declarations_main_region_B
  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. /*! Define indices of states in the StateConfVector */
  76. #define SCVI_DECLARATIONS_MAIN_REGION_A 0
  77. #define SCVI_DECLARATIONS_MAIN_REGION_B 0
  78. /*!
  79. * Type definition of the data structure for the Declarations state machine.
  80. * This data structure has to be allocated by the client code.
  81. */
  82. typedef struct
  83. {
  84. DeclarationsStates stateConfVector[DECLARATIONS_MAX_ORTHOGONAL_STATES];
  85. sc_ushort stateConfVectorPosition;
  86. DeclarationsIface iface;
  87. DeclarationsIfaceIfA ifaceIfA;
  88. DeclarationsInternal internal;
  89. } Declarations;
  90. /*! Initializes the Declarations state machine data structures. Must be called before first usage.*/
  91. extern void declarations_init(Declarations* handle);
  92. /*! Activates the state machine */
  93. extern void declarations_enter(Declarations* handle);
  94. /*! Deactivates the state machine */
  95. extern void declarations_exit(Declarations* handle);
  96. /*! Performs a 'run to completion' step. */
  97. extern void declarations_runCycle(Declarations* handle);
  98. /*! Raises the in event 'evA' that is defined in the default interface scope. */
  99. extern void declarationsIface_raise_evA(Declarations* handle);
  100. /*! Checks if the out event 'evB' that is defined in the default interface scope has been raised. */
  101. extern sc_boolean declarationsIface_israised_evB(const Declarations* handle);
  102. /*! Raises the in event 'evC' that is defined in the default interface scope. */
  103. extern void declarationsIface_raise_evC(Declarations* handle, sc_boolean value);
  104. /*! Checks if the out event 'evD' that is defined in the default interface scope has been raised. */
  105. extern sc_boolean declarationsIface_israised_evD(const Declarations* handle);
  106. /*! Gets the value of the out event 'evD' that is defined in the default interface scope. */
  107. extern sc_integer declarationsIface_get_evD_value(const Declarations* handle);
  108. /*! Raises the in event 'evE' that is defined in the default interface scope. */
  109. extern void declarationsIface_raise_evE(Declarations* handle, sc_real value);
  110. /*! Checks if the out event 'evF' that is defined in the default interface scope has been raised. */
  111. extern sc_boolean declarationsIface_israised_evF(const Declarations* handle);
  112. /*! Gets the value of the out event 'evF' that is defined in the default interface scope. */
  113. extern sc_string declarationsIface_get_evF_value(const Declarations* handle);
  114. /*! Gets the value of the variable 'varA' that is defined in the default interface scope. */
  115. extern sc_boolean declarationsIface_get_varA(const Declarations* handle);
  116. /*! Sets the value of the variable 'varA' that is defined in the default interface scope. */
  117. extern void declarationsIface_set_varA(Declarations* handle, sc_boolean value);
  118. /*! Gets the value of the variable 'varB' that is defined in the default interface scope. */
  119. extern sc_integer declarationsIface_get_varB(const Declarations* handle);
  120. /*! Sets the value of the variable 'varB' that is defined in the default interface scope. */
  121. extern void declarationsIface_set_varB(Declarations* handle, sc_integer value);
  122. /*! Gets the value of the variable 'varC' that is defined in the default interface scope. */
  123. extern sc_real declarationsIface_get_varC(const Declarations* handle);
  124. /*! Sets the value of the variable 'varC' that is defined in the default interface scope. */
  125. extern void declarationsIface_set_varC(Declarations* handle, sc_real value);
  126. /*! Gets the value of the variable 'varD' that is defined in the default interface scope. */
  127. extern sc_string declarationsIface_get_varD(const Declarations* handle);
  128. /*! Sets the value of the variable 'varD' that is defined in the default interface scope. */
  129. extern void declarationsIface_set_varD(Declarations* handle, sc_string value);
  130. /*! Gets the value of the variable 'varE' that is defined in the default interface scope. */
  131. extern sc_integer declarationsIface_get_varE(const Declarations* handle);
  132. /*! Sets the value of the variable 'varE' that is defined in the default interface scope. */
  133. extern void declarationsIface_set_varE(Declarations* handle, sc_integer value);
  134. /*! Raises the in event 'evA' that is defined in the interface scope 'ifA'. */
  135. extern void declarationsIfaceIfA_raise_evA(Declarations* handle);
  136. /*! Checks if the out event 'evB' that is defined in the interface scope 'ifA' has been raised. */
  137. extern sc_boolean declarationsIfaceIfA_israised_evB(const Declarations* handle);
  138. /*! Raises the in event 'evC' that is defined in the interface scope 'ifA'. */
  139. extern void declarationsIfaceIfA_raise_evC(Declarations* handle, sc_boolean value);
  140. /*! Checks if the out event 'evD' that is defined in the interface scope 'ifA' has been raised. */
  141. extern sc_boolean declarationsIfaceIfA_israised_evD(const Declarations* handle);
  142. /*! Gets the value of the out event 'evD' that is defined in the interface scope 'ifA'. */
  143. extern sc_integer declarationsIfaceIfA_get_evD_value(const Declarations* handle);
  144. /*! Raises the in event 'evE' that is defined in the interface scope 'ifA'. */
  145. extern void declarationsIfaceIfA_raise_evE(Declarations* handle, sc_real value);
  146. /*! Checks if the out event 'evF' that is defined in the interface scope 'ifA' has been raised. */
  147. extern sc_boolean declarationsIfaceIfA_israised_evF(const Declarations* handle);
  148. /*! Gets the value of the out event 'evF' that is defined in the interface scope 'ifA'. */
  149. extern sc_string declarationsIfaceIfA_get_evF_value(const Declarations* handle);
  150. /*! Gets the value of the variable 'varA' that is defined in the interface scope 'ifA'. */
  151. extern sc_boolean declarationsIfaceIfA_get_varA(const Declarations* handle);
  152. /*! Sets the value of the variable 'varA' that is defined in the interface scope 'ifA'. */
  153. extern void declarationsIfaceIfA_set_varA(Declarations* handle, sc_boolean value);
  154. /*! Gets the value of the variable 'varB' that is defined in the interface scope 'ifA'. */
  155. extern sc_integer declarationsIfaceIfA_get_varB(const Declarations* handle);
  156. /*! Sets the value of the variable 'varB' that is defined in the interface scope 'ifA'. */
  157. extern void declarationsIfaceIfA_set_varB(Declarations* handle, sc_integer value);
  158. /*! Gets the value of the variable 'varC' that is defined in the interface scope 'ifA'. */
  159. extern sc_real declarationsIfaceIfA_get_varC(const Declarations* handle);
  160. /*! Sets the value of the variable 'varC' that is defined in the interface scope 'ifA'. */
  161. extern void declarationsIfaceIfA_set_varC(Declarations* handle, sc_real value);
  162. /*! Gets the value of the variable 'varD' that is defined in the interface scope 'ifA'. */
  163. extern sc_string declarationsIfaceIfA_get_varD(const Declarations* handle);
  164. /*! Sets the value of the variable 'varD' that is defined in the interface scope 'ifA'. */
  165. extern void declarationsIfaceIfA_set_varD(Declarations* handle, sc_string value);
  166. /*! Gets the value of the variable 'varE' that is defined in the interface scope 'ifA'. */
  167. extern sc_integer declarationsIfaceIfA_get_varE(const Declarations* handle);
  168. /*! Sets the value of the variable 'varE' that is defined in the interface scope 'ifA'. */
  169. extern void declarationsIfaceIfA_set_varE(Declarations* handle, sc_integer value);
  170. /*!
  171. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  172. * 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.
  173. */
  174. extern sc_boolean declarations_isActive(const Declarations* handle);
  175. /*!
  176. * Checks if all active states are final.
  177. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  178. */
  179. extern sc_boolean declarations_isFinal(const Declarations* handle);
  180. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  181. extern sc_boolean declarations_isStateActive(const Declarations* handle, DeclarationsStates state);
  182. #ifdef __cplusplus
  183. }
  184. #endif
  185. #endif /* DECLARATIONS_H_ */