EnterState.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #ifndef ENTERSTATE_H_
  2. #define ENTERSTATE_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'EnterState'.
  6. */
  7. class EnterState : public StatemachineInterface
  8. {
  9. public:
  10. EnterState();
  11. ~EnterState();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. r_A,
  16. r_B,
  17. r_B_r_E,
  18. r_B_r_F,
  19. EnterState_last_state
  20. } EnterStateStates;
  21. //! Inner class for default interface scope.
  22. class DefaultSCI
  23. {
  24. public:
  25. /*! Raises the in event 'e' that is defined in the default interface scope. */
  26. void raise_e();
  27. /*! Raises the in event 'f' that is defined in the default interface scope. */
  28. void raise_f();
  29. /*! Raises the in event 'g' that is defined in the default interface scope. */
  30. void raise_g();
  31. private:
  32. friend class EnterState;
  33. sc_boolean e_raised;
  34. sc_boolean f_raised;
  35. sc_boolean g_raised;
  36. };
  37. /*! Returns an instance of the interface class 'DefaultSCI'. */
  38. DefaultSCI* getDefaultSCI();
  39. /*! Raises the in event 'e' that is defined in the default interface scope. */
  40. void raise_e();
  41. /*! Raises the in event 'f' that is defined in the default interface scope. */
  42. void raise_f();
  43. /*! Raises the in event 'g' that is defined in the default interface scope. */
  44. void raise_g();
  45. /*
  46. * Functions inherited from StatemachineInterface
  47. */
  48. virtual void init();
  49. virtual void enter();
  50. virtual void exit();
  51. virtual void runCycle();
  52. /*!
  53. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  54. * 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.
  55. */
  56. virtual sc_boolean isActive() const;
  57. /*!
  58. * Checks if all active states are final.
  59. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  60. */
  61. virtual sc_boolean isFinal() const;
  62. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  63. sc_boolean isStateActive(EnterStateStates state) const;
  64. private:
  65. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  66. static const sc_integer maxOrthogonalStates = 1;
  67. EnterStateStates stateConfVector[maxOrthogonalStates];
  68. sc_ushort stateConfVectorPosition;
  69. DefaultSCI iface;
  70. // prototypes of all internal functions
  71. sc_boolean check_r_A_tr0_tr0();
  72. sc_boolean check_r_A_tr1_tr1();
  73. sc_boolean check_r_A_tr2_tr2();
  74. void effect_r_A_tr0();
  75. void effect_r_A_tr1();
  76. void effect_r_A_tr2();
  77. void enseq_r_A_default();
  78. void enseq_r_B_default();
  79. void enseq_r_B_f();
  80. void enseq_r_B_g();
  81. void enseq_r_B_r_E_default();
  82. void enseq_r_B_r_F_default();
  83. void enseq_r_default();
  84. void enseq_r_B_r_default();
  85. void enseq_r_B_r_f();
  86. void exseq_r_A();
  87. void exseq_r_B_r_E();
  88. void exseq_r_B_r_F();
  89. void exseq_r();
  90. void exseq_r_B_r();
  91. void react_r_A();
  92. void react_r_B_r_E();
  93. void react_r_B_r_F();
  94. void react_r__entry_Default();
  95. void react_r_B_r__entry_Default();
  96. void react_r_B_r_f();
  97. void clearInEvents();
  98. void clearOutEvents();
  99. };
  100. #endif /* ENTERSTATE_H_ */