EntryReactionAction.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef ENTRYREACTIONACTION_H_
  2. #define ENTRYREACTIONACTION_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'EntryReactionAction'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. EntryReactionAction_EntryReactionAction_r2_B,
  13. EntryReactionAction_EntryReactionAction_r2_B_r_BA,
  14. EntryReactionAction_EntryReactionAction_r2_B_r_BB,
  15. EntryReactionAction_EntryReactionAction_r2_D,
  16. EntryReactionAction_EntryReactionAction_r1_A,
  17. EntryReactionAction_last_state
  18. } EntryReactionActionStates;
  19. /*! Type definition of the data structure for the EntryReactionActionIface interface scope. */
  20. typedef struct
  21. {
  22. sc_boolean enteredR1;
  23. sc_boolean enteredR2;
  24. sc_boolean enteredBdefault;
  25. sc_boolean enteredBother;
  26. sc_boolean b_raised;
  27. sc_boolean d_raised;
  28. } EntryReactionActionIface;
  29. /*! Define dimension of the state configuration vector for orthogonal states. */
  30. #define ENTRYREACTIONACTION_MAX_ORTHOGONAL_STATES 2
  31. /*! Define dimension of the state configuration vector for history states. */
  32. #define ENTRYREACTIONACTION_MAX_HISTORY_STATES 1
  33. /*!
  34. * Type definition of the data structure for the EntryReactionAction state machine.
  35. * This data structure has to be allocated by the client code.
  36. */
  37. typedef struct
  38. {
  39. EntryReactionActionStates stateConfVector[ENTRYREACTIONACTION_MAX_ORTHOGONAL_STATES];
  40. EntryReactionActionStates historyVector[ENTRYREACTIONACTION_MAX_HISTORY_STATES];
  41. sc_ushort stateConfVectorPosition;
  42. EntryReactionActionIface iface;
  43. } EntryReactionAction;
  44. /*! Initializes the EntryReactionAction state machine data structures. Must be called before first usage.*/
  45. extern void entryReactionAction_init(EntryReactionAction* handle);
  46. /*! Activates the state machine */
  47. extern void entryReactionAction_enter(EntryReactionAction* handle);
  48. /*! Deactivates the state machine */
  49. extern void entryReactionAction_exit(EntryReactionAction* handle);
  50. /*! Performs a 'run to completion' step. */
  51. extern void entryReactionAction_runCycle(EntryReactionAction* handle);
  52. /*! Gets the value of the variable 'enteredR1' that is defined in the default interface scope. */
  53. extern sc_boolean entryReactionActionIface_get_enteredR1(const EntryReactionAction* handle);
  54. /*! Sets the value of the variable 'enteredR1' that is defined in the default interface scope. */
  55. extern void entryReactionActionIface_set_enteredR1(EntryReactionAction* handle, sc_boolean value);
  56. /*! Gets the value of the variable 'enteredR2' that is defined in the default interface scope. */
  57. extern sc_boolean entryReactionActionIface_get_enteredR2(const EntryReactionAction* handle);
  58. /*! Sets the value of the variable 'enteredR2' that is defined in the default interface scope. */
  59. extern void entryReactionActionIface_set_enteredR2(EntryReactionAction* handle, sc_boolean value);
  60. /*! Gets the value of the variable 'enteredBdefault' that is defined in the default interface scope. */
  61. extern sc_boolean entryReactionActionIface_get_enteredBdefault(const EntryReactionAction* handle);
  62. /*! Sets the value of the variable 'enteredBdefault' that is defined in the default interface scope. */
  63. extern void entryReactionActionIface_set_enteredBdefault(EntryReactionAction* handle, sc_boolean value);
  64. /*! Gets the value of the variable 'enteredBother' that is defined in the default interface scope. */
  65. extern sc_boolean entryReactionActionIface_get_enteredBother(const EntryReactionAction* handle);
  66. /*! Sets the value of the variable 'enteredBother' that is defined in the default interface scope. */
  67. extern void entryReactionActionIface_set_enteredBother(EntryReactionAction* handle, sc_boolean value);
  68. /*! Raises the in event 'b' that is defined in the default interface scope. */
  69. extern void entryReactionActionIface_raise_b(EntryReactionAction* handle);
  70. /*! Raises the in event 'd' that is defined in the default interface scope. */
  71. extern void entryReactionActionIface_raise_d(EntryReactionAction* handle);
  72. /*!
  73. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  74. * A state machine is active if it was entered. It is inactive if it has not been entered at all or if it has been exited.
  75. */
  76. extern sc_boolean entryReactionAction_isActive(const EntryReactionAction* handle);
  77. /*!
  78. * Checks if all active states are final.
  79. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  80. */
  81. extern sc_boolean entryReactionAction_isFinal(const EntryReactionAction* handle);
  82. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  83. extern sc_boolean entryReactionAction_isStateActive(const EntryReactionAction* handle, EntryReactionActionStates state);
  84. #ifdef __cplusplus
  85. }
  86. #endif
  87. #endif /* ENTRYREACTIONACTION_H_ */