ExitOnSelfTransition.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #ifndef EXITONSELFTRANSITION_H_
  2. #define EXITONSELFTRANSITION_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'ExitOnSelfTransition'.
  6. */
  7. class ExitOnSelfTransition : public StatemachineInterface
  8. {
  9. public:
  10. ExitOnSelfTransition();
  11. ~ExitOnSelfTransition();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. main_region_A,
  16. main_region_B,
  17. ExitOnSelfTransition_last_state
  18. } ExitOnSelfTransitionStates;
  19. //! Inner class for default interface scope.
  20. class DefaultSCI
  21. {
  22. public:
  23. /*! Raises the in event 'e' that is defined in the default interface scope. */
  24. void raise_e();
  25. /*! Raises the in event 'f' that is defined in the default interface scope. */
  26. void raise_f();
  27. /*! Gets the value of the variable 'entryCount' that is defined in the default interface scope. */
  28. sc_integer get_entryCount() const;
  29. /*! Sets the value of the variable 'entryCount' that is defined in the default interface scope. */
  30. void set_entryCount(sc_integer value);
  31. /*! Gets the value of the variable 'exitCount' that is defined in the default interface scope. */
  32. sc_integer get_exitCount() const;
  33. /*! Sets the value of the variable 'exitCount' that is defined in the default interface scope. */
  34. void set_exitCount(sc_integer value);
  35. private:
  36. friend class ExitOnSelfTransition;
  37. sc_boolean e_raised;
  38. sc_boolean f_raised;
  39. sc_integer entryCount;
  40. sc_integer exitCount;
  41. };
  42. /*! Returns an instance of the interface class 'DefaultSCI'. */
  43. DefaultSCI* getDefaultSCI();
  44. /*! Raises the in event 'e' that is defined in the default interface scope. */
  45. void raise_e();
  46. /*! Raises the in event 'f' that is defined in the default interface scope. */
  47. void raise_f();
  48. /*! Gets the value of the variable 'entryCount' that is defined in the default interface scope. */
  49. sc_integer get_entryCount() const;
  50. /*! Sets the value of the variable 'entryCount' that is defined in the default interface scope. */
  51. void set_entryCount(sc_integer value);
  52. /*! Gets the value of the variable 'exitCount' that is defined in the default interface scope. */
  53. sc_integer get_exitCount() const;
  54. /*! Sets the value of the variable 'exitCount' that is defined in the default interface scope. */
  55. void set_exitCount(sc_integer value);
  56. /*
  57. * Functions inherited from StatemachineInterface
  58. */
  59. virtual void init();
  60. virtual void enter();
  61. virtual void exit();
  62. virtual void runCycle();
  63. /*!
  64. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  65. * 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.
  66. */
  67. virtual sc_boolean isActive() const;
  68. /*!
  69. * Checks if all active states are final.
  70. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  71. */
  72. virtual sc_boolean isFinal() const;
  73. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  74. sc_boolean isStateActive(ExitOnSelfTransitionStates state) const;
  75. private:
  76. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  77. static const sc_integer maxOrthogonalStates = 1;
  78. ExitOnSelfTransitionStates stateConfVector[maxOrthogonalStates];
  79. sc_ushort stateConfVectorPosition;
  80. DefaultSCI iface;
  81. // prototypes of all internal functions
  82. sc_boolean check_main_region_A_tr0_tr0();
  83. sc_boolean check_main_region_A_tr1_tr1();
  84. sc_boolean check_main_region_B_tr0_tr0();
  85. void effect_main_region_A_tr0();
  86. void effect_main_region_A_tr1();
  87. void effect_main_region_B_tr0();
  88. void enact_main_region_A();
  89. void exact_main_region_A();
  90. void enseq_main_region_A_default();
  91. void enseq_main_region_B_default();
  92. void enseq_main_region_default();
  93. void exseq_main_region_A();
  94. void exseq_main_region_B();
  95. void exseq_main_region();
  96. void react_main_region_A();
  97. void react_main_region_B();
  98. void react_main_region__entry_Default();
  99. void clearInEvents();
  100. void clearOutEvents();
  101. };
  102. #endif /* EXITONSELFTRANSITION_H_ */