InEventLifeCycle.h 3.0 KB

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