StatechartLocalReactions.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #ifndef STATECHARTLOCALREACTIONS_H_
  2. #define STATECHARTLOCALREACTIONS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'StatechartLocalReactions'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. StatechartLocalReactions_last_state,
  13. StatechartLocalReactions_main_region_S1,
  14. StatechartLocalReactions_main_region_S2,
  15. StatechartLocalReactions_region2_a
  16. } StatechartLocalReactionsStates;
  17. /*! Type definition of the data structure for the StatechartLocalReactionsIface interface scope. */
  18. typedef struct
  19. {
  20. sc_integer myInt;
  21. } StatechartLocalReactionsIface;
  22. /*! Define dimension of the state configuration vector for orthogonal states. */
  23. #define STATECHARTLOCALREACTIONS_MAX_ORTHOGONAL_STATES 2
  24. /*! Define indices of states in the StateConfVector */
  25. #define SCVI_STATECHARTLOCALREACTIONS_MAIN_REGION_S1 0
  26. #define SCVI_STATECHARTLOCALREACTIONS_MAIN_REGION_S2 0
  27. #define SCVI_STATECHARTLOCALREACTIONS_REGION2_A 1
  28. /*!
  29. * Type definition of the data structure for the StatechartLocalReactions state machine.
  30. * This data structure has to be allocated by the client code.
  31. */
  32. typedef struct
  33. {
  34. StatechartLocalReactionsStates stateConfVector[STATECHARTLOCALREACTIONS_MAX_ORTHOGONAL_STATES];
  35. sc_ushort stateConfVectorPosition;
  36. StatechartLocalReactionsIface iface;
  37. } StatechartLocalReactions;
  38. /*! Initializes the StatechartLocalReactions state machine data structures. Must be called before first usage.*/
  39. extern void statechartLocalReactions_init(StatechartLocalReactions* handle);
  40. /*! Activates the state machine */
  41. extern void statechartLocalReactions_enter(StatechartLocalReactions* handle);
  42. /*! Deactivates the state machine */
  43. extern void statechartLocalReactions_exit(StatechartLocalReactions* handle);
  44. /*! Performs a 'run to completion' step. */
  45. extern void statechartLocalReactions_runCycle(StatechartLocalReactions* handle);
  46. /*! Gets the value of the variable 'myInt' that is defined in the default interface scope. */
  47. extern sc_integer statechartLocalReactionsIface_get_myInt(const StatechartLocalReactions* handle);
  48. /*! Sets the value of the variable 'myInt' that is defined in the default interface scope. */
  49. extern void statechartLocalReactionsIface_set_myInt(StatechartLocalReactions* handle, sc_integer value);
  50. /*!
  51. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  52. * 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.
  53. */
  54. extern sc_boolean statechartLocalReactions_isActive(const StatechartLocalReactions* handle);
  55. /*!
  56. * Checks if all active states are final.
  57. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  58. */
  59. extern sc_boolean statechartLocalReactions_isFinal(const StatechartLocalReactions* handle);
  60. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  61. extern sc_boolean statechartLocalReactions_isStateActive(const StatechartLocalReactions* handle, StatechartLocalReactionsStates state);
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif /* STATECHARTLOCALREACTIONS_H_ */