StateIsActive.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef STATEISACTIVE_H_
  2. #define STATEISACTIVE_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'StateIsActive'.
  6. */
  7. class StateIsActive : public StatemachineInterface
  8. {
  9. public:
  10. StateIsActive();
  11. ~StateIsActive();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. R1_R1A,
  16. R1_R1B,
  17. R2_R2A,
  18. R2_R2B,
  19. StateIsActive_last_state
  20. } StateIsActiveStates;
  21. //! Inner class for default interface scope.
  22. class DefaultSCI
  23. {
  24. public:
  25. /*! Raises the in event 'Event1' that is defined in the default interface scope. */
  26. void raise_event1();
  27. private:
  28. friend class StateIsActive;
  29. sc_boolean Event1_raised;
  30. };
  31. /*! Returns an instance of the interface class 'DefaultSCI'. */
  32. DefaultSCI* getDefaultSCI();
  33. /*! Raises the in event 'Event1' that is defined in the default interface scope. */
  34. void raise_event1();
  35. /*
  36. * Functions inherited from StatemachineInterface
  37. */
  38. virtual void init();
  39. virtual void enter();
  40. virtual void exit();
  41. virtual void runCycle();
  42. /*!
  43. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  44. * 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.
  45. */
  46. virtual sc_boolean isActive() const;
  47. /*!
  48. * Checks if all active states are final.
  49. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  50. */
  51. virtual sc_boolean isFinal() const;
  52. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  53. sc_boolean isStateActive(StateIsActiveStates state) const;
  54. private:
  55. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  56. static const sc_integer maxOrthogonalStates = 2;
  57. StateIsActiveStates stateConfVector[maxOrthogonalStates];
  58. sc_ushort stateConfVectorPosition;
  59. DefaultSCI iface;
  60. // prototypes of all internal functions
  61. sc_boolean check_R1_R1A_tr0_tr0();
  62. sc_boolean check_R2_R2A_tr0_tr0();
  63. void effect_R1_R1A_tr0();
  64. void effect_R2_R2A_tr0();
  65. void enseq_R1_R1A_default();
  66. void enseq_R1_R1B_default();
  67. void enseq_R2_R2A_default();
  68. void enseq_R2_R2B_default();
  69. void enseq_R1_default();
  70. void enseq_R2_default();
  71. void exseq_R1_R1A();
  72. void exseq_R1_R1B();
  73. void exseq_R2_R2A();
  74. void exseq_R2_R2B();
  75. void exseq_R1();
  76. void exseq_R2();
  77. void react_R1_R1A();
  78. void react_R1_R1B();
  79. void react_R2_R2A();
  80. void react_R2_R2B();
  81. void react_R1__entry_Default();
  82. void react_R2__entry_Default();
  83. void clearInEvents();
  84. void clearOutEvents();
  85. };
  86. #endif /* STATEISACTIVE_H_ */