Constants.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef CONSTANTS_H_
  2. #define CONSTANTS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'Constants'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. Constants_main_region_A,
  13. Constants_main_region_B,
  14. Constants_main_region_C,
  15. Constants_last_state
  16. } ConstantsStates;
  17. /*! Type definition of the data structure for the ConstantsIface interface scope. */
  18. typedef struct
  19. {
  20. sc_boolean e_raised;
  21. sc_boolean e2_raised;
  22. sc_integer e2_value;
  23. sc_integer result;
  24. } ConstantsIface;
  25. /* Declaration of constants for scope ConstantsIface. */
  26. extern const sc_integer CONSTANTS_CONSTANTSIFACE_X;
  27. extern const sc_integer CONSTANTS_CONSTANTSIFACE_Y;
  28. /* Declaration of constants for scope ConstantsIfaceNamed. */
  29. extern const sc_string CONSTANTS_CONSTANTSIFACENAMED_Y;
  30. extern const sc_integer CONSTANTS_CONSTANTSIFACENAMED_TWO;
  31. /*! Define dimension of the state configuration vector for orthogonal states. */
  32. #define CONSTANTS_MAX_ORTHOGONAL_STATES 1
  33. /*!
  34. * Type definition of the data structure for the Constants state machine.
  35. * This data structure has to be allocated by the client code.
  36. */
  37. typedef struct
  38. {
  39. ConstantsStates stateConfVector[CONSTANTS_MAX_ORTHOGONAL_STATES];
  40. sc_ushort stateConfVectorPosition;
  41. ConstantsIface iface;
  42. } Constants;
  43. /*! Initializes the Constants state machine data structures. Must be called before first usage.*/
  44. extern void constants_init(Constants* handle);
  45. /*! Activates the state machine */
  46. extern void constants_enter(Constants* handle);
  47. /*! Deactivates the state machine */
  48. extern void constants_exit(Constants* handle);
  49. /*! Performs a 'run to completion' step. */
  50. extern void constants_runCycle(Constants* handle);
  51. /*! Raises the in event 'e' that is defined in the default interface scope. */
  52. extern void constantsIface_raise_e(Constants* handle);
  53. /*! Raises the in event 'e2' that is defined in the default interface scope. */
  54. extern void constantsIface_raise_e2(Constants* handle, sc_integer value);
  55. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  56. extern const sc_integer constantsIface_get_x(const Constants* handle);
  57. /*! Gets the value of the variable 'y' that is defined in the default interface scope. */
  58. extern const sc_integer constantsIface_get_y(const Constants* handle);
  59. /*! Gets the value of the variable 'result' that is defined in the default interface scope. */
  60. extern sc_integer constantsIface_get_result(const Constants* handle);
  61. /*! Sets the value of the variable 'result' that is defined in the default interface scope. */
  62. extern void constantsIface_set_result(Constants* handle, sc_integer value);
  63. /*! Gets the value of the variable 'y' that is defined in the interface scope 'Named'. */
  64. extern const sc_string constantsIfaceNamed_get_y(const Constants* handle);
  65. /*! Gets the value of the variable 'two' that is defined in the interface scope 'Named'. */
  66. extern const sc_integer constantsIfaceNamed_get_two(const Constants* handle);
  67. /*!
  68. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  69. * 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.
  70. */
  71. extern sc_boolean constants_isActive(const Constants* handle);
  72. /*!
  73. * Checks if all active states are final.
  74. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  75. */
  76. extern sc_boolean constants_isFinal(const Constants* handle);
  77. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  78. extern sc_boolean constants_isStateActive(const Constants* handle, ConstantsStates state);
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif /* CONSTANTS_H_ */