LocalReactions.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef LOCALREACTIONS_H_
  2. #define LOCALREACTIONS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'LocalReactions'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. LocalReactions_last_state,
  13. LocalReactions_main_region_A
  14. } LocalReactionsStates;
  15. /*! Type definition of the data structure for the LocalReactionsIface interface scope. */
  16. typedef struct
  17. {
  18. sc_integer x;
  19. } LocalReactionsIface;
  20. /*! Define dimension of the state configuration vector for orthogonal states. */
  21. #define LOCALREACTIONS_MAX_ORTHOGONAL_STATES 1
  22. /*! Define indices of states in the StateConfVector */
  23. #define SCVI_LOCALREACTIONS_MAIN_REGION_A 0
  24. /*!
  25. * Type definition of the data structure for the LocalReactions state machine.
  26. * This data structure has to be allocated by the client code.
  27. */
  28. typedef struct
  29. {
  30. LocalReactionsStates stateConfVector[LOCALREACTIONS_MAX_ORTHOGONAL_STATES];
  31. sc_ushort stateConfVectorPosition;
  32. LocalReactionsIface iface;
  33. } LocalReactions;
  34. /*! Initializes the LocalReactions state machine data structures. Must be called before first usage.*/
  35. extern void localReactions_init(LocalReactions* handle);
  36. /*! Activates the state machine */
  37. extern void localReactions_enter(LocalReactions* handle);
  38. /*! Deactivates the state machine */
  39. extern void localReactions_exit(LocalReactions* handle);
  40. /*! Performs a 'run to completion' step. */
  41. extern void localReactions_runCycle(LocalReactions* handle);
  42. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  43. extern sc_integer localReactionsIface_get_x(const LocalReactions* handle);
  44. /*! Sets the value of the variable 'x' that is defined in the default interface scope. */
  45. extern void localReactionsIface_set_x(LocalReactions* 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 localReactions_isActive(const LocalReactions* 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 localReactions_isFinal(const LocalReactions* 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 localReactions_isStateActive(const LocalReactions* handle, LocalReactionsStates state);
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif /* LOCALREACTIONS_H_ */