TimedTransitions.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef TIMEDTRANSITIONS_H_
  2. #define TIMEDTRANSITIONS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'TimedTransitions'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. TimedTransitions_main_region_Start,
  13. TimedTransitions_main_region_End,
  14. TimedTransitions_last_state
  15. } TimedTransitionsStates;
  16. /*! Type definition of the data structure for the TimedTransitionsInternal interface scope. */
  17. typedef struct
  18. {
  19. sc_integer x;
  20. sc_integer y;
  21. } TimedTransitionsInternal;
  22. /*! Type definition of the data structure for the TimedTransitionsTimeEvents interface scope. */
  23. typedef struct
  24. {
  25. sc_boolean timedTransitions_main_region_Start_tev0_raised;
  26. sc_boolean timedTransitions_tev0_raised;
  27. } TimedTransitionsTimeEvents;
  28. /*! Define dimension of the state configuration vector for orthogonal states. */
  29. #define TIMEDTRANSITIONS_MAX_ORTHOGONAL_STATES 1
  30. /*!
  31. * Type definition of the data structure for the TimedTransitions state machine.
  32. * This data structure has to be allocated by the client code.
  33. */
  34. typedef struct
  35. {
  36. TimedTransitionsStates stateConfVector[TIMEDTRANSITIONS_MAX_ORTHOGONAL_STATES];
  37. sc_ushort stateConfVectorPosition;
  38. TimedTransitionsInternal internal;
  39. TimedTransitionsTimeEvents timeEvents;
  40. } TimedTransitions;
  41. /*! Initializes the TimedTransitions state machine data structures. Must be called before first usage.*/
  42. extern void timedTransitions_init(TimedTransitions* handle);
  43. /*! Activates the state machine */
  44. extern void timedTransitions_enter(TimedTransitions* handle);
  45. /*! Deactivates the state machine */
  46. extern void timedTransitions_exit(TimedTransitions* handle);
  47. /*! Performs a 'run to completion' step. */
  48. extern void timedTransitions_runCycle(TimedTransitions* handle);
  49. /*! Raises a time event. */
  50. extern void timedTransitions_raiseTimeEvent(const TimedTransitions* handle, sc_eventid evid);
  51. /*!
  52. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  53. * 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.
  54. */
  55. extern sc_boolean timedTransitions_isActive(const TimedTransitions* handle);
  56. /*!
  57. * Checks if all active states are final.
  58. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  59. */
  60. extern sc_boolean timedTransitions_isFinal(const TimedTransitions* handle);
  61. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  62. extern sc_boolean timedTransitions_isStateActive(const TimedTransitions* handle, TimedTransitionsStates state);
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif /* TIMEDTRANSITIONS_H_ */