EmptyTransition.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef EMPTYTRANSITION_H_
  2. #define EMPTYTRANSITION_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'EmptyTransition'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. EmptyTransition_last_state,
  13. EmptyTransition_main_region_A,
  14. EmptyTransition_main_region_B
  15. } EmptyTransitionStates;
  16. /*! Define dimension of the state configuration vector for orthogonal states. */
  17. #define EMPTYTRANSITION_MAX_ORTHOGONAL_STATES 1
  18. /*! Define indices of states in the StateConfVector */
  19. #define SCVI_EMPTYTRANSITION_MAIN_REGION_A 0
  20. #define SCVI_EMPTYTRANSITION_MAIN_REGION_B 0
  21. /*!
  22. * Type definition of the data structure for the EmptyTransition state machine.
  23. * This data structure has to be allocated by the client code.
  24. */
  25. typedef struct
  26. {
  27. EmptyTransitionStates stateConfVector[EMPTYTRANSITION_MAX_ORTHOGONAL_STATES];
  28. sc_ushort stateConfVectorPosition;
  29. } EmptyTransition;
  30. /*! Initializes the EmptyTransition state machine data structures. Must be called before first usage.*/
  31. extern void emptyTransition_init(EmptyTransition* handle);
  32. /*! Activates the state machine */
  33. extern void emptyTransition_enter(EmptyTransition* handle);
  34. /*! Deactivates the state machine */
  35. extern void emptyTransition_exit(EmptyTransition* handle);
  36. /*! Performs a 'run to completion' step. */
  37. extern void emptyTransition_runCycle(EmptyTransition* handle);
  38. /*!
  39. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  40. * 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.
  41. */
  42. extern sc_boolean emptyTransition_isActive(const EmptyTransition* handle);
  43. /*!
  44. * Checks if all active states are final.
  45. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  46. */
  47. extern sc_boolean emptyTransition_isFinal(const EmptyTransition* handle);
  48. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  49. extern sc_boolean emptyTransition_isStateActive(const EmptyTransition* handle, EmptyTransitionStates state);
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif /* EMPTYTRANSITION_H_ */