Constants.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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_last_state,
  13. Constants_main_region_A,
  14. Constants_main_region_B,
  15. Constants_main_region_C
  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. /*! Define indices of states in the StateConfVector */
  34. #define SCVI_CONSTANTS_MAIN_REGION_A 0
  35. #define SCVI_CONSTANTS_MAIN_REGION_B 0
  36. #define SCVI_CONSTANTS_MAIN_REGION_C 0
  37. /*!
  38. * Type definition of the data structure for the Constants state machine.
  39. * This data structure has to be allocated by the client code.
  40. */
  41. typedef struct
  42. {
  43. ConstantsStates stateConfVector[CONSTANTS_MAX_ORTHOGONAL_STATES];
  44. sc_ushort stateConfVectorPosition;
  45. ConstantsIface iface;
  46. } Constants;
  47. /*! Initializes the Constants state machine data structures. Must be called before first usage.*/
  48. extern void constants_init(Constants* handle);
  49. /*! Activates the state machine */
  50. extern void constants_enter(Constants* handle);
  51. /*! Deactivates the state machine */
  52. extern void constants_exit(Constants* handle);
  53. /*! Performs a 'run to completion' step. */
  54. extern void constants_runCycle(Constants* handle);
  55. /*! Raises the in event 'e' that is defined in the default interface scope. */
  56. extern void constantsIface_raise_e(Constants* handle);
  57. /*! Raises the in event 'e2' that is defined in the default interface scope. */
  58. extern void constantsIface_raise_e2(Constants* handle, sc_integer value);
  59. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  60. extern const sc_integer constantsIface_get_x(const Constants* handle);
  61. /*! Gets the value of the variable 'y' that is defined in the default interface scope. */
  62. extern const sc_integer constantsIface_get_y(const Constants* handle);
  63. /*! Gets the value of the variable 'result' that is defined in the default interface scope. */
  64. extern sc_integer constantsIface_get_result(const Constants* handle);
  65. /*! Sets the value of the variable 'result' that is defined in the default interface scope. */
  66. extern void constantsIface_set_result(Constants* handle, sc_integer value);
  67. /*! Gets the value of the variable 'y' that is defined in the interface scope 'Named'. */
  68. extern const sc_string constantsIfaceNamed_get_y(const Constants* handle);
  69. /*! Gets the value of the variable 'two' that is defined in the interface scope 'Named'. */
  70. extern const sc_integer constantsIfaceNamed_get_two(const Constants* handle);
  71. /*!
  72. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  73. * 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.
  74. */
  75. extern sc_boolean constants_isActive(const Constants* handle);
  76. /*!
  77. * Checks if all active states are final.
  78. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  79. */
  80. extern sc_boolean constants_isFinal(const Constants* handle);
  81. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  82. extern sc_boolean constants_isStateActive(const Constants* handle, ConstantsStates state);
  83. #ifdef __cplusplus
  84. }
  85. #endif
  86. #endif /* CONSTANTS_H_ */