StatechartActive.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef STATECHARTACTIVE_H_
  2. #define STATECHARTACTIVE_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'StatechartActive'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. StatechartActive_last_state,
  13. StatechartActive_r_A
  14. } StatechartActiveStates;
  15. /*! Define dimension of the state configuration vector for orthogonal states. */
  16. #define STATECHARTACTIVE_MAX_ORTHOGONAL_STATES 1
  17. /*! Define indices of states in the StateConfVector */
  18. #define SCVI_STATECHARTACTIVE_R_A 0
  19. /*!
  20. * Type definition of the data structure for the StatechartActive state machine.
  21. * This data structure has to be allocated by the client code.
  22. */
  23. typedef struct
  24. {
  25. StatechartActiveStates stateConfVector[STATECHARTACTIVE_MAX_ORTHOGONAL_STATES];
  26. sc_ushort stateConfVectorPosition;
  27. } StatechartActive;
  28. /*! Initializes the StatechartActive state machine data structures. Must be called before first usage.*/
  29. extern void statechartActive_init(StatechartActive* handle);
  30. /*! Activates the state machine */
  31. extern void statechartActive_enter(StatechartActive* handle);
  32. /*! Deactivates the state machine */
  33. extern void statechartActive_exit(StatechartActive* handle);
  34. /*! Performs a 'run to completion' step. */
  35. extern void statechartActive_runCycle(StatechartActive* handle);
  36. /*!
  37. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  38. * 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.
  39. */
  40. extern sc_boolean statechartActive_isActive(const StatechartActive* handle);
  41. /*!
  42. * Checks if all active states are final.
  43. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  44. */
  45. extern sc_boolean statechartActive_isFinal(const StatechartActive* handle);
  46. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  47. extern sc_boolean statechartActive_isStateActive(const StatechartActive* handle, StatechartActiveStates state);
  48. #ifdef __cplusplus
  49. }
  50. #endif
  51. #endif /* STATECHARTACTIVE_H_ */