StateIsActive.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef STATEISACTIVE_H_
  2. #define STATEISACTIVE_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'StateIsActive'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. StateIsActive_R1_R1A,
  13. StateIsActive_R1_R1B,
  14. StateIsActive_R2_R2A,
  15. StateIsActive_R2_R2B,
  16. StateIsActive_last_state
  17. } StateIsActiveStates;
  18. /*! Type definition of the data structure for the StateIsActiveIface interface scope. */
  19. typedef struct
  20. {
  21. sc_boolean Event1_raised;
  22. } StateIsActiveIface;
  23. /*! Define dimension of the state configuration vector for orthogonal states. */
  24. #define STATEISACTIVE_MAX_ORTHOGONAL_STATES 2
  25. /*!
  26. * Type definition of the data structure for the StateIsActive state machine.
  27. * This data structure has to be allocated by the client code.
  28. */
  29. typedef struct
  30. {
  31. StateIsActiveStates stateConfVector[STATEISACTIVE_MAX_ORTHOGONAL_STATES];
  32. sc_ushort stateConfVectorPosition;
  33. StateIsActiveIface iface;
  34. } StateIsActive;
  35. /*! Initializes the StateIsActive state machine data structures. Must be called before first usage.*/
  36. extern void stateIsActive_init(StateIsActive* handle);
  37. /*! Activates the state machine */
  38. extern void stateIsActive_enter(StateIsActive* handle);
  39. /*! Deactivates the state machine */
  40. extern void stateIsActive_exit(StateIsActive* handle);
  41. /*! Performs a 'run to completion' step. */
  42. extern void stateIsActive_runCycle(StateIsActive* handle);
  43. /*! Raises the in event 'Event1' that is defined in the default interface scope. */
  44. extern void stateIsActiveIface_raise_event1(StateIsActive* handle);
  45. /*!
  46. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  47. * 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.
  48. */
  49. extern sc_boolean stateIsActive_isActive(const StateIsActive* handle);
  50. /*!
  51. * Checks if all active states are final.
  52. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  53. */
  54. extern sc_boolean stateIsActive_isFinal(const StateIsActive* handle);
  55. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  56. extern sc_boolean stateIsActive_isStateActive(const StateIsActive* handle, StateIsActiveStates state);
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif /* STATEISACTIVE_H_ */