ExitOnSelfTransition.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef EXITONSELFTRANSITION_H_
  2. #define EXITONSELFTRANSITION_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'ExitOnSelfTransition'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. ExitOnSelfTransition_last_state,
  13. ExitOnSelfTransition_main_region_A,
  14. ExitOnSelfTransition_main_region_B
  15. } ExitOnSelfTransitionStates;
  16. /*! Type definition of the data structure for the ExitOnSelfTransitionIface interface scope. */
  17. typedef struct
  18. {
  19. sc_boolean e_raised;
  20. sc_boolean f_raised;
  21. sc_integer entryCount;
  22. sc_integer exitCount;
  23. } ExitOnSelfTransitionIface;
  24. /*! Define dimension of the state configuration vector for orthogonal states. */
  25. #define EXITONSELFTRANSITION_MAX_ORTHOGONAL_STATES 1
  26. /*! Define indices of states in the StateConfVector */
  27. #define SCVI_EXITONSELFTRANSITION_MAIN_REGION_A 0
  28. #define SCVI_EXITONSELFTRANSITION_MAIN_REGION_B 0
  29. /*!
  30. * Type definition of the data structure for the ExitOnSelfTransition state machine.
  31. * This data structure has to be allocated by the client code.
  32. */
  33. typedef struct
  34. {
  35. ExitOnSelfTransitionStates stateConfVector[EXITONSELFTRANSITION_MAX_ORTHOGONAL_STATES];
  36. sc_ushort stateConfVectorPosition;
  37. ExitOnSelfTransitionIface iface;
  38. } ExitOnSelfTransition;
  39. /*! Initializes the ExitOnSelfTransition state machine data structures. Must be called before first usage.*/
  40. extern void exitOnSelfTransition_init(ExitOnSelfTransition* handle);
  41. /*! Activates the state machine */
  42. extern void exitOnSelfTransition_enter(ExitOnSelfTransition* handle);
  43. /*! Deactivates the state machine */
  44. extern void exitOnSelfTransition_exit(ExitOnSelfTransition* handle);
  45. /*! Performs a 'run to completion' step. */
  46. extern void exitOnSelfTransition_runCycle(ExitOnSelfTransition* handle);
  47. /*! Raises the in event 'e' that is defined in the default interface scope. */
  48. extern void exitOnSelfTransitionIface_raise_e(ExitOnSelfTransition* handle);
  49. /*! Raises the in event 'f' that is defined in the default interface scope. */
  50. extern void exitOnSelfTransitionIface_raise_f(ExitOnSelfTransition* handle);
  51. /*! Gets the value of the variable 'entryCount' that is defined in the default interface scope. */
  52. extern sc_integer exitOnSelfTransitionIface_get_entryCount(const ExitOnSelfTransition* handle);
  53. /*! Sets the value of the variable 'entryCount' that is defined in the default interface scope. */
  54. extern void exitOnSelfTransitionIface_set_entryCount(ExitOnSelfTransition* handle, sc_integer value);
  55. /*! Gets the value of the variable 'exitCount' that is defined in the default interface scope. */
  56. extern sc_integer exitOnSelfTransitionIface_get_exitCount(const ExitOnSelfTransition* handle);
  57. /*! Sets the value of the variable 'exitCount' that is defined in the default interface scope. */
  58. extern void exitOnSelfTransitionIface_set_exitCount(ExitOnSelfTransition* handle, sc_integer value);
  59. /*!
  60. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  61. * 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.
  62. */
  63. extern sc_boolean exitOnSelfTransition_isActive(const ExitOnSelfTransition* handle);
  64. /*!
  65. * Checks if all active states are final.
  66. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  67. */
  68. extern sc_boolean exitOnSelfTransition_isFinal(const ExitOnSelfTransition* handle);
  69. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  70. extern sc_boolean exitOnSelfTransition_isStateActive(const ExitOnSelfTransition* handle, ExitOnSelfTransitionStates state);
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74. #endif /* EXITONSELFTRANSITION_H_ */