StatechartKeywords.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. #ifndef STATECHARTKEYWORDS_H_
  2. #define STATECHARTKEYWORDS_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. #include "TimedStatemachineInterface.h"
  6. /*! \file Header of the state machine 'StatechartKeywords'.
  7. */
  8. class StatechartKeywords : public TimedStatemachineInterface, public StatemachineInterface
  9. {
  10. public:
  11. StatechartKeywords();
  12. ~StatechartKeywords();
  13. /*! Enumeration of all states */
  14. typedef enum
  15. {
  16. main_region_Timer,
  17. StatechartKeywords_last_state
  18. } StatechartKeywordsStates;
  19. //! Inner class for if interface scope.
  20. class SCI_If
  21. {
  22. public:
  23. /*! Gets the value of the variable 'timer' that is defined in the interface scope 'if'. */
  24. sc_integer get_timer() const;
  25. /*! Sets the value of the variable 'timer' that is defined in the interface scope 'if'. */
  26. void set_timer(sc_integer value);
  27. /*! Gets the value of the variable 'isActive' that is defined in the interface scope 'if'. */
  28. sc_integer get_isActive() const;
  29. /*! Sets the value of the variable 'isActive' that is defined in the interface scope 'if'. */
  30. void set_isActive(sc_integer value);
  31. /*! Gets the value of the variable 'init' that is defined in the interface scope 'if'. */
  32. sc_integer get_init() const;
  33. /*! Sets the value of the variable 'init' that is defined in the interface scope 'if'. */
  34. void set_init(sc_integer value);
  35. /*! Gets the value of the variable 'enter' that is defined in the interface scope 'if'. */
  36. sc_integer get_enter() const;
  37. /*! Sets the value of the variable 'enter' that is defined in the interface scope 'if'. */
  38. void set_enter(sc_integer value);
  39. /*! Gets the value of the variable 'runCycle' that is defined in the interface scope 'if'. */
  40. sc_integer get_runCycle() const;
  41. /*! Sets the value of the variable 'runCycle' that is defined in the interface scope 'if'. */
  42. void set_runCycle(sc_integer value);
  43. /*! Checks if the out event 'operationCallback' that is defined in the interface scope 'if' has been raised. */
  44. sc_boolean isRaised_operationCallback() const;
  45. /*! Checks if the out event 'listeners' that is defined in the interface scope 'if' has been raised. */
  46. sc_boolean isRaised_listeners() const;
  47. private:
  48. friend class StatechartKeywords;
  49. sc_integer timer;
  50. sc_integer isActive;
  51. sc_integer init;
  52. sc_integer enter_ID;
  53. sc_integer runCycle_ID;
  54. sc_boolean operationCallback_raised;
  55. sc_boolean listeners_raised;
  56. };
  57. //! Inner class for if interface scope operation callbacks.
  58. class SCI_If_OCB
  59. {
  60. public:
  61. virtual ~SCI_If_OCB() = 0;
  62. virtual void myOperation() = 0;
  63. };
  64. /*! Set the working instance of the operation callback interface 'SCI_If_OCB'. */
  65. void setSCI_If_OCB(SCI_If_OCB* operationCallback);
  66. /*! Returns an instance of the interface class 'SCI_If'. */
  67. SCI_If* getSCI_If();
  68. //! Inner class for internal interface scope operation callbacks.
  69. class InternalSCI_OCB
  70. {
  71. public:
  72. virtual ~InternalSCI_OCB() = 0;
  73. virtual void myOperation() = 0;
  74. };
  75. /*! Set the working instance of the operation callback interface 'InternalSCI_OCB'. */
  76. void setInternalSCI_OCB(InternalSCI_OCB* operationCallback);
  77. /*
  78. * Functions inherited from StatemachineInterface
  79. */
  80. virtual void init();
  81. virtual void enter();
  82. virtual void exit();
  83. virtual void runCycle();
  84. /*!
  85. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  86. * 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.
  87. */
  88. virtual sc_boolean isActive() const;
  89. /*!
  90. * Checks if all active states are final.
  91. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  92. */
  93. virtual sc_boolean isFinal() const;
  94. /*
  95. * Functions inherited from TimedStatemachineInterface
  96. */
  97. virtual void setTimer(TimerInterface* timer);
  98. virtual TimerInterface* getTimer();
  99. virtual void raiseTimeEvent(sc_eventid event);
  100. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  101. sc_boolean isStateActive(StatechartKeywordsStates state) const;
  102. private:
  103. //! Inner class for internal interface scope.
  104. class InternalSCI
  105. {
  106. public:
  107. /*! Gets the value of the variable 'timer' that is defined in the internal scope. */
  108. sc_integer get_timer() const;
  109. /*! Sets the value of the variable 'timer' that is defined in the internal scope. */
  110. void set_timer(sc_integer value);
  111. /*! Gets the value of the variable 'isActive' that is defined in the internal scope. */
  112. sc_integer get_isActive() const;
  113. /*! Sets the value of the variable 'isActive' that is defined in the internal scope. */
  114. void set_isActive(sc_integer value);
  115. /*! Gets the value of the variable 'init' that is defined in the internal scope. */
  116. sc_integer get_init() const;
  117. /*! Sets the value of the variable 'init' that is defined in the internal scope. */
  118. void set_init(sc_integer value);
  119. /*! Gets the value of the variable 'enter' that is defined in the internal scope. */
  120. sc_integer get_enter() const;
  121. /*! Sets the value of the variable 'enter' that is defined in the internal scope. */
  122. void set_enter(sc_integer value);
  123. /*! Gets the value of the variable 'runCycle' that is defined in the internal scope. */
  124. sc_integer get_runCycle() const;
  125. /*! Sets the value of the variable 'runCycle' that is defined in the internal scope. */
  126. void set_runCycle(sc_integer value);
  127. /*! Gets the value of the variable 'sCIIf' that is defined in the internal scope. */
  128. sc_integer get_sCIIf() const;
  129. /*! Sets the value of the variable 'sCIIf' that is defined in the internal scope. */
  130. void set_sCIIf(sc_integer value);
  131. /*! Raises the in event 'operationCallback' that is defined in the internal scope. */
  132. void raise_operationCallback();
  133. /*! Checks if the out event 'operationCallback' that is defined in the internal scope has been raised. */
  134. sc_boolean isRaised_operationCallback() const;
  135. /*! Raises the in event 'listeners' that is defined in the internal scope. */
  136. void raise_listeners();
  137. /*! Checks if the out event 'listeners' that is defined in the internal scope has been raised. */
  138. sc_boolean isRaised_listeners() const;
  139. private:
  140. friend class StatechartKeywords;
  141. sc_integer timer;
  142. sc_integer isActive;
  143. sc_integer init;
  144. sc_integer enter_ID;
  145. sc_integer runCycle_ID;
  146. sc_integer sCIIf;
  147. sc_boolean operationCallback_raised;
  148. sc_boolean listeners_raised;
  149. };
  150. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  151. static const sc_integer maxOrthogonalStates = 1;
  152. //! number of time events used by the state machine.
  153. static const sc_integer timeEventsCount = 1;
  154. TimerInterface* timer;
  155. sc_boolean timeEvents[timeEventsCount];
  156. StatechartKeywordsStates stateConfVector[maxOrthogonalStates];
  157. sc_ushort stateConfVectorPosition;
  158. SCI_If ifaceIf;
  159. SCI_If_OCB* ifaceIf_OCB;
  160. InternalSCI ifaceInternalSCI;
  161. InternalSCI_OCB* ifaceInternalSCI_OCB;
  162. // prototypes of all internal functions
  163. sc_boolean check__lr0();
  164. void effect__lr0();
  165. void enact();
  166. void exact();
  167. void enseq_main_region_Timer_default();
  168. void enseq_main_region_default();
  169. void exseq_main_region_Timer();
  170. void exseq_main_region();
  171. void react_main_region_Timer();
  172. void react_main_region__entry_Default();
  173. void clearInEvents();
  174. void clearOutEvents();
  175. };
  176. inline StatechartKeywords::SCI_If_OCB::~SCI_If_OCB() {}
  177. inline StatechartKeywords::InternalSCI_OCB::~InternalSCI_OCB() {}
  178. #endif /* STATECHARTKEYWORDS_H_ */