StatechartLocalReactions.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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_main_region_S1,
  13. StatechartLocalReactions_main_region_S2,
  14. StatechartLocalReactions_region2_a,
  15. StatechartLocalReactions_last_state
  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. /*!
  25. * Type definition of the data structure for the StatechartLocalReactions state machine.
  26. * This data structure has to be allocated by the client code.
  27. */
  28. typedef struct
  29. {
  30. StatechartLocalReactionsStates stateConfVector[STATECHARTLOCALREACTIONS_MAX_ORTHOGONAL_STATES];
  31. sc_ushort stateConfVectorPosition;
  32. StatechartLocalReactionsIface iface;
  33. } StatechartLocalReactions;
  34. /*! Initializes the StatechartLocalReactions state machine data structures. Must be called before first usage.*/
  35. extern void statechartLocalReactions_init(StatechartLocalReactions* handle);
  36. /*! Activates the state machine */
  37. extern void statechartLocalReactions_enter(StatechartLocalReactions* handle);
  38. /*! Deactivates the state machine */
  39. extern void statechartLocalReactions_exit(StatechartLocalReactions* handle);
  40. /*! Performs a 'run to completion' step. */
  41. extern void statechartLocalReactions_runCycle(StatechartLocalReactions* handle);
  42. /*! Gets the value of the variable 'myInt' that is defined in the default interface scope. */
  43. extern sc_integer statechartLocalReactionsIface_get_myInt(const StatechartLocalReactions* handle);
  44. /*! Sets the value of the variable 'myInt' that is defined in the default interface scope. */
  45. extern void statechartLocalReactionsIface_set_myInt(StatechartLocalReactions* handle, sc_integer value);
  46. /*!
  47. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  48. * 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.
  49. */
  50. extern sc_boolean statechartLocalReactions_isActive(const StatechartLocalReactions* handle);
  51. /*!
  52. * Checks if all active states are final.
  53. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  54. */
  55. extern sc_boolean statechartLocalReactions_isFinal(const StatechartLocalReactions* handle);
  56. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  57. extern sc_boolean statechartLocalReactions_isStateActive(const StatechartLocalReactions* handle, StatechartLocalReactionsStates state);
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif /* STATECHARTLOCALREACTIONS_H_ */