ExitOnSelfTransition.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_main_region_A,
  13. ExitOnSelfTransition_main_region_B,
  14. ExitOnSelfTransition_last_state
  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. /*!
  27. * Type definition of the data structure for the ExitOnSelfTransition state machine.
  28. * This data structure has to be allocated by the client code.
  29. */
  30. typedef struct
  31. {
  32. ExitOnSelfTransitionStates stateConfVector[EXITONSELFTRANSITION_MAX_ORTHOGONAL_STATES];
  33. sc_ushort stateConfVectorPosition;
  34. ExitOnSelfTransitionIface iface;
  35. } ExitOnSelfTransition;
  36. /*! Initializes the ExitOnSelfTransition state machine data structures. Must be called before first usage.*/
  37. extern void exitOnSelfTransition_init(ExitOnSelfTransition* handle);
  38. /*! Activates the state machine */
  39. extern void exitOnSelfTransition_enter(ExitOnSelfTransition* handle);
  40. /*! Deactivates the state machine */
  41. extern void exitOnSelfTransition_exit(ExitOnSelfTransition* handle);
  42. /*! Performs a 'run to completion' step. */
  43. extern void exitOnSelfTransition_runCycle(ExitOnSelfTransition* handle);
  44. /*! Raises the in event 'e' that is defined in the default interface scope. */
  45. extern void exitOnSelfTransitionIface_raise_e(ExitOnSelfTransition* handle);
  46. /*! Raises the in event 'f' that is defined in the default interface scope. */
  47. extern void exitOnSelfTransitionIface_raise_f(ExitOnSelfTransition* handle);
  48. /*! Gets the value of the variable 'entryCount' that is defined in the default interface scope. */
  49. extern sc_integer exitOnSelfTransitionIface_get_entryCount(const ExitOnSelfTransition* handle);
  50. /*! Sets the value of the variable 'entryCount' that is defined in the default interface scope. */
  51. extern void exitOnSelfTransitionIface_set_entryCount(ExitOnSelfTransition* handle, sc_integer value);
  52. /*! Gets the value of the variable 'exitCount' that is defined in the default interface scope. */
  53. extern sc_integer exitOnSelfTransitionIface_get_exitCount(const ExitOnSelfTransition* handle);
  54. /*! Sets the value of the variable 'exitCount' that is defined in the default interface scope. */
  55. extern void exitOnSelfTransitionIface_set_exitCount(ExitOnSelfTransition* handle, sc_integer value);
  56. /*!
  57. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  58. * 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.
  59. */
  60. extern sc_boolean exitOnSelfTransition_isActive(const ExitOnSelfTransition* handle);
  61. /*!
  62. * Checks if all active states are final.
  63. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  64. */
  65. extern sc_boolean exitOnSelfTransition_isFinal(const ExitOnSelfTransition* handle);
  66. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  67. extern sc_boolean exitOnSelfTransition_isStateActive(const ExitOnSelfTransition* handle, ExitOnSelfTransitionStates state);
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71. #endif /* EXITONSELFTRANSITION_H_ */