Declarations.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. #ifndef DECLARATIONS_H_
  2. #define DECLARATIONS_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'Declarations'.
  6. */
  7. class Declarations : public StatemachineInterface
  8. {
  9. public:
  10. Declarations();
  11. ~Declarations();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. main_region_A,
  16. main_region_B,
  17. Declarations_last_state
  18. } DeclarationsStates;
  19. //! Inner class for default interface scope.
  20. class DefaultSCI
  21. {
  22. public:
  23. /*! Raises the in event 'evA' that is defined in the default interface scope. */
  24. void raise_evA();
  25. /*! Checks if the out event 'evB' that is defined in the default interface scope has been raised. */
  26. sc_boolean isRaised_evB() const;
  27. /*! Raises the in event 'evC' that is defined in the default interface scope. */
  28. void raise_evC(sc_boolean value);
  29. /*! Checks if the out event 'evD' that is defined in the default interface scope has been raised. */
  30. sc_boolean isRaised_evD() const;
  31. /*! Gets the value of the out event 'evD' that is defined in the default interface scope. */
  32. sc_integer get_evD_value() const;
  33. /*! Raises the in event 'evE' that is defined in the default interface scope. */
  34. void raise_evE(sc_real value);
  35. /*! Checks if the out event 'evF' that is defined in the default interface scope has been raised. */
  36. sc_boolean isRaised_evF() const;
  37. /*! Gets the value of the out event 'evF' that is defined in the default interface scope. */
  38. sc_string get_evF_value() const;
  39. /*! Gets the value of the variable 'varA' that is defined in the default interface scope. */
  40. sc_boolean get_varA() const;
  41. /*! Sets the value of the variable 'varA' that is defined in the default interface scope. */
  42. void set_varA(sc_boolean value);
  43. /*! Gets the value of the variable 'varB' that is defined in the default interface scope. */
  44. sc_integer get_varB() const;
  45. /*! Sets the value of the variable 'varB' that is defined in the default interface scope. */
  46. void set_varB(sc_integer value);
  47. /*! Gets the value of the variable 'varC' that is defined in the default interface scope. */
  48. sc_real get_varC() const;
  49. /*! Sets the value of the variable 'varC' that is defined in the default interface scope. */
  50. void set_varC(sc_real value);
  51. /*! Gets the value of the variable 'varD' that is defined in the default interface scope. */
  52. sc_string get_varD() const;
  53. /*! Sets the value of the variable 'varD' that is defined in the default interface scope. */
  54. void set_varD(sc_string value);
  55. /*! Gets the value of the variable 'varE' that is defined in the default interface scope. */
  56. sc_integer get_varE() const;
  57. /*! Sets the value of the variable 'varE' that is defined in the default interface scope. */
  58. void set_varE(sc_integer value);
  59. private:
  60. friend class Declarations;
  61. sc_boolean evA_raised;
  62. sc_boolean evB_raised;
  63. sc_boolean evC_raised;
  64. sc_boolean evC_value;
  65. sc_boolean evD_raised;
  66. sc_integer evD_value;
  67. sc_boolean evE_raised;
  68. sc_real evE_value;
  69. sc_boolean evF_raised;
  70. sc_string evF_value;
  71. sc_boolean varA;
  72. sc_integer varB;
  73. sc_real varC;
  74. sc_string varD;
  75. sc_integer varE;
  76. };
  77. /*! Returns an instance of the interface class 'DefaultSCI'. */
  78. DefaultSCI* getDefaultSCI();
  79. /*! Raises the in event 'evA' that is defined in the default interface scope. */
  80. void raise_evA();
  81. /*! Checks if the out event 'evB' that is defined in the default interface scope has been raised. */
  82. sc_boolean isRaised_evB() const;
  83. /*! Raises the in event 'evC' that is defined in the default interface scope. */
  84. void raise_evC(sc_boolean value);
  85. /*! Checks if the out event 'evD' that is defined in the default interface scope has been raised. */
  86. sc_boolean isRaised_evD() const;
  87. /*! Gets the value of the out event 'evD' that is defined in the default interface scope. */
  88. sc_integer get_evD_value() const;
  89. /*! Raises the in event 'evE' that is defined in the default interface scope. */
  90. void raise_evE(sc_real value);
  91. /*! Checks if the out event 'evF' that is defined in the default interface scope has been raised. */
  92. sc_boolean isRaised_evF() const;
  93. /*! Gets the value of the out event 'evF' that is defined in the default interface scope. */
  94. sc_string get_evF_value() const;
  95. /*! Gets the value of the variable 'varA' that is defined in the default interface scope. */
  96. sc_boolean get_varA() const;
  97. /*! Sets the value of the variable 'varA' that is defined in the default interface scope. */
  98. void set_varA(sc_boolean value);
  99. /*! Gets the value of the variable 'varB' that is defined in the default interface scope. */
  100. sc_integer get_varB() const;
  101. /*! Sets the value of the variable 'varB' that is defined in the default interface scope. */
  102. void set_varB(sc_integer value);
  103. /*! Gets the value of the variable 'varC' that is defined in the default interface scope. */
  104. sc_real get_varC() const;
  105. /*! Sets the value of the variable 'varC' that is defined in the default interface scope. */
  106. void set_varC(sc_real value);
  107. /*! Gets the value of the variable 'varD' that is defined in the default interface scope. */
  108. sc_string get_varD() const;
  109. /*! Sets the value of the variable 'varD' that is defined in the default interface scope. */
  110. void set_varD(sc_string value);
  111. /*! Gets the value of the variable 'varE' that is defined in the default interface scope. */
  112. sc_integer get_varE() const;
  113. /*! Sets the value of the variable 'varE' that is defined in the default interface scope. */
  114. void set_varE(sc_integer value);
  115. //! Inner class for ifA interface scope.
  116. class SCI_IfA
  117. {
  118. public:
  119. /*! Raises the in event 'evA' that is defined in the interface scope 'ifA'. */
  120. void raise_evA();
  121. /*! Checks if the out event 'evB' that is defined in the interface scope 'ifA' has been raised. */
  122. sc_boolean isRaised_evB() const;
  123. /*! Raises the in event 'evC' that is defined in the interface scope 'ifA'. */
  124. void raise_evC(sc_boolean value);
  125. /*! Checks if the out event 'evD' that is defined in the interface scope 'ifA' has been raised. */
  126. sc_boolean isRaised_evD() const;
  127. /*! Gets the value of the out event 'evD' that is defined in the interface scope 'ifA'. */
  128. sc_integer get_evD_value() const;
  129. /*! Raises the in event 'evE' that is defined in the interface scope 'ifA'. */
  130. void raise_evE(sc_real value);
  131. /*! Checks if the out event 'evF' that is defined in the interface scope 'ifA' has been raised. */
  132. sc_boolean isRaised_evF() const;
  133. /*! Gets the value of the out event 'evF' that is defined in the interface scope 'ifA'. */
  134. sc_string get_evF_value() const;
  135. /*! Gets the value of the variable 'varA' that is defined in the interface scope 'ifA'. */
  136. sc_boolean get_varA() const;
  137. /*! Sets the value of the variable 'varA' that is defined in the interface scope 'ifA'. */
  138. void set_varA(sc_boolean value);
  139. /*! Gets the value of the variable 'varB' that is defined in the interface scope 'ifA'. */
  140. sc_integer get_varB() const;
  141. /*! Sets the value of the variable 'varB' that is defined in the interface scope 'ifA'. */
  142. void set_varB(sc_integer value);
  143. /*! Gets the value of the variable 'varC' that is defined in the interface scope 'ifA'. */
  144. sc_real get_varC() const;
  145. /*! Sets the value of the variable 'varC' that is defined in the interface scope 'ifA'. */
  146. void set_varC(sc_real value);
  147. /*! Gets the value of the variable 'varD' that is defined in the interface scope 'ifA'. */
  148. sc_string get_varD() const;
  149. /*! Sets the value of the variable 'varD' that is defined in the interface scope 'ifA'. */
  150. void set_varD(sc_string value);
  151. /*! Gets the value of the variable 'varE' that is defined in the interface scope 'ifA'. */
  152. sc_integer get_varE() const;
  153. /*! Sets the value of the variable 'varE' that is defined in the interface scope 'ifA'. */
  154. void set_varE(sc_integer value);
  155. private:
  156. friend class Declarations;
  157. sc_boolean evA_raised;
  158. sc_boolean evB_raised;
  159. sc_boolean evC_raised;
  160. sc_boolean evC_value;
  161. sc_boolean evD_raised;
  162. sc_integer evD_value;
  163. sc_boolean evE_raised;
  164. sc_real evE_value;
  165. sc_boolean evF_raised;
  166. sc_string evF_value;
  167. sc_boolean varA;
  168. sc_integer varB;
  169. sc_real varC;
  170. sc_string varD;
  171. sc_integer varE;
  172. };
  173. /*! Returns an instance of the interface class 'SCI_IfA'. */
  174. SCI_IfA* getSCI_IfA();
  175. /*
  176. * Functions inherited from StatemachineInterface
  177. */
  178. virtual void init();
  179. virtual void enter();
  180. virtual void exit();
  181. virtual void runCycle();
  182. /*!
  183. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  184. * A state machine is active if it has been entered. It is inactive if it has not been entered at all or if it has been exited.
  185. */
  186. virtual sc_boolean isActive() const;
  187. /*!
  188. * Checks if all active states are final.
  189. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  190. */
  191. virtual sc_boolean isFinal() const;
  192. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  193. sc_boolean isStateActive(DeclarationsStates state) const;
  194. private:
  195. //! Inner class for internal interface scope.
  196. class InternalSCI
  197. {
  198. public:
  199. /*! Raises the in event 'evInA' that is defined in the internal scope. */
  200. void raise_evInA();
  201. /*! Checks if the out event 'evInA' that is defined in the internal scope has been raised. */
  202. sc_boolean isRaised_evInA() const;
  203. /*! Raises the in event 'evInB' that is defined in the internal scope. */
  204. void raise_evInB();
  205. /*! Checks if the out event 'evInB' that is defined in the internal scope has been raised. */
  206. sc_boolean isRaised_evInB() const;
  207. /*! Raises the in event 'evInC' that is defined in the internal scope. */
  208. void raise_evInC(sc_boolean value);
  209. /*! Checks if the out event 'evInC' that is defined in the internal scope has been raised. */
  210. sc_boolean isRaised_evInC() const;
  211. /*! Gets the value of the out event 'evInC' that is defined in the internal scope. */
  212. sc_boolean get_evInC_value() const;
  213. /*! Raises the in event 'evInD' that is defined in the internal scope. */
  214. void raise_evInD(sc_integer value);
  215. /*! Checks if the out event 'evInD' that is defined in the internal scope has been raised. */
  216. sc_boolean isRaised_evInD() const;
  217. /*! Gets the value of the out event 'evInD' that is defined in the internal scope. */
  218. sc_integer get_evInD_value() const;
  219. /*! Raises the in event 'evInE' that is defined in the internal scope. */
  220. void raise_evInE(sc_real value);
  221. /*! Checks if the out event 'evInE' that is defined in the internal scope has been raised. */
  222. sc_boolean isRaised_evInE() const;
  223. /*! Gets the value of the out event 'evInE' that is defined in the internal scope. */
  224. sc_real get_evInE_value() const;
  225. /*! Raises the in event 'evInF' that is defined in the internal scope. */
  226. void raise_evInF(sc_string value);
  227. /*! Checks if the out event 'evInF' that is defined in the internal scope has been raised. */
  228. sc_boolean isRaised_evInF() const;
  229. /*! Gets the value of the out event 'evInF' that is defined in the internal scope. */
  230. sc_string get_evInF_value() const;
  231. /*! Gets the value of the variable 'varInA' that is defined in the internal scope. */
  232. sc_boolean get_varInA() const;
  233. /*! Sets the value of the variable 'varInA' that is defined in the internal scope. */
  234. void set_varInA(sc_boolean value);
  235. /*! Gets the value of the variable 'varInB' that is defined in the internal scope. */
  236. sc_integer get_varInB() const;
  237. /*! Sets the value of the variable 'varInB' that is defined in the internal scope. */
  238. void set_varInB(sc_integer value);
  239. /*! Gets the value of the variable 'varInC' that is defined in the internal scope. */
  240. sc_real get_varInC() const;
  241. /*! Sets the value of the variable 'varInC' that is defined in the internal scope. */
  242. void set_varInC(sc_real value);
  243. /*! Gets the value of the variable 'varInD' that is defined in the internal scope. */
  244. sc_string get_varInD() const;
  245. /*! Sets the value of the variable 'varInD' that is defined in the internal scope. */
  246. void set_varInD(sc_string value);
  247. /*! Gets the value of the variable 'varInE' that is defined in the internal scope. */
  248. sc_integer get_varInE() const;
  249. /*! Sets the value of the variable 'varInE' that is defined in the internal scope. */
  250. void set_varInE(sc_integer value);
  251. private:
  252. friend class Declarations;
  253. sc_boolean evInA_raised;
  254. sc_boolean evInB_raised;
  255. sc_boolean evInC_raised;
  256. sc_boolean evInC_value;
  257. sc_boolean evInD_raised;
  258. sc_integer evInD_value;
  259. sc_boolean evInE_raised;
  260. sc_real evInE_value;
  261. sc_boolean evInF_raised;
  262. sc_string evInF_value;
  263. sc_boolean varInA;
  264. sc_integer varInB;
  265. sc_real varInC;
  266. sc_string varInD;
  267. sc_integer varInE;
  268. };
  269. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  270. static const sc_integer maxOrthogonalStates = 1;
  271. DeclarationsStates stateConfVector[maxOrthogonalStates];
  272. sc_ushort stateConfVectorPosition;
  273. DefaultSCI iface;
  274. SCI_IfA ifaceIfA;
  275. InternalSCI ifaceInternalSCI;
  276. // prototypes of all internal functions
  277. sc_boolean check_main_region_A_tr0_tr0();
  278. sc_boolean check_main_region_A_tr1_tr1();
  279. sc_boolean check_main_region_B_tr0_tr0();
  280. sc_boolean check_main_region_B_tr1_tr1();
  281. sc_boolean check_main_region_B_tr2_tr2();
  282. sc_boolean check_main_region_B_tr3_tr3();
  283. void effect_main_region_A_tr0();
  284. void effect_main_region_A_tr1();
  285. void effect_main_region_B_tr0();
  286. void effect_main_region_B_tr1();
  287. void effect_main_region_B_tr2();
  288. void effect_main_region_B_tr3();
  289. void enact_main_region_A();
  290. void enseq_main_region_A_default();
  291. void enseq_main_region_B_default();
  292. void enseq_main_region_default();
  293. void exseq_main_region_A();
  294. void exseq_main_region_B();
  295. void exseq_main_region();
  296. void react_main_region_A();
  297. void react_main_region_B();
  298. void react_main_region__entry_Default();
  299. void clearInEvents();
  300. void clearOutEvents();
  301. };
  302. #endif /* DECLARATIONS_H_ */