SimpleHierachy.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #ifndef SIMPLEHIERACHY_H_
  2. #define SIMPLEHIERACHY_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'SimpleHierachy'.
  6. */
  7. class SimpleHierachy : public StatemachineInterface
  8. {
  9. public:
  10. SimpleHierachy();
  11. ~SimpleHierachy();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. main_region_A,
  16. main_region_B,
  17. main_region_B_subregion1_B1,
  18. SimpleHierachy_last_state
  19. } SimpleHierachyStates;
  20. //! Inner class for default interface scope.
  21. class DefaultSCI
  22. {
  23. public:
  24. /*! Raises the in event 'Event1' that is defined in the default interface scope. */
  25. void raise_event1();
  26. private:
  27. friend class SimpleHierachy;
  28. sc_boolean Event1_raised;
  29. };
  30. /*! Returns an instance of the interface class 'DefaultSCI'. */
  31. DefaultSCI* getDefaultSCI();
  32. /*! Raises the in event 'Event1' that is defined in the default interface scope. */
  33. void raise_event1();
  34. /*
  35. * Functions inherited from StatemachineInterface
  36. */
  37. virtual void init();
  38. virtual void enter();
  39. virtual void exit();
  40. virtual void runCycle();
  41. /*!
  42. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  43. * 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.
  44. */
  45. virtual sc_boolean isActive() const;
  46. /*!
  47. * Checks if all active states are final.
  48. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  49. */
  50. virtual sc_boolean isFinal() const;
  51. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  52. sc_boolean isStateActive(SimpleHierachyStates state) const;
  53. private:
  54. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  55. static const sc_integer maxOrthogonalStates = 1;
  56. SimpleHierachyStates stateConfVector[maxOrthogonalStates];
  57. sc_ushort stateConfVectorPosition;
  58. DefaultSCI iface;
  59. // prototypes of all internal functions
  60. sc_boolean check_main_region_A_tr0_tr0();
  61. void effect_main_region_A_tr0();
  62. void enseq_main_region_A_default();
  63. void enseq_main_region_B_default();
  64. void enseq_main_region_B_subregion1_B1_default();
  65. void enseq_main_region_default();
  66. void enseq_main_region_B_subregion1_default();
  67. void exseq_main_region_A();
  68. void exseq_main_region_B_subregion1_B1();
  69. void exseq_main_region();
  70. void exseq_main_region_B_subregion1();
  71. void react_main_region_A();
  72. void react_main_region_B_subregion1_B1();
  73. void react_main_region__entry_Default();
  74. void react_main_region_B_subregion1__entry_Default();
  75. void clearInEvents();
  76. void clearOutEvents();
  77. };
  78. #endif /* SIMPLEHIERACHY_H_ */