ConditionalExpressions.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef CONDITIONALEXPRESSIONS_H_
  2. #define CONDITIONALEXPRESSIONS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'ConditionalExpressions'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. ConditionalExpressions_main_region_A,
  13. ConditionalExpressions_main_region_B,
  14. ConditionalExpressions_last_state
  15. } ConditionalExpressionsStates;
  16. /*! Type definition of the data structure for the ConditionalExpressionsIface interface scope. */
  17. typedef struct
  18. {
  19. sc_boolean e_raised;
  20. sc_integer condition;
  21. sc_boolean boolVar;
  22. } ConditionalExpressionsIface;
  23. /*! Define dimension of the state configuration vector for orthogonal states. */
  24. #define CONDITIONALEXPRESSIONS_MAX_ORTHOGONAL_STATES 1
  25. /*!
  26. * Type definition of the data structure for the ConditionalExpressions state machine.
  27. * This data structure has to be allocated by the client code.
  28. */
  29. typedef struct
  30. {
  31. ConditionalExpressionsStates stateConfVector[CONDITIONALEXPRESSIONS_MAX_ORTHOGONAL_STATES];
  32. sc_ushort stateConfVectorPosition;
  33. ConditionalExpressionsIface iface;
  34. } ConditionalExpressions;
  35. /*! Initializes the ConditionalExpressions state machine data structures. Must be called before first usage.*/
  36. extern void conditionalExpressions_init(ConditionalExpressions* handle);
  37. /*! Activates the state machine */
  38. extern void conditionalExpressions_enter(ConditionalExpressions* handle);
  39. /*! Deactivates the state machine */
  40. extern void conditionalExpressions_exit(ConditionalExpressions* handle);
  41. /*! Performs a 'run to completion' step. */
  42. extern void conditionalExpressions_runCycle(ConditionalExpressions* handle);
  43. /*! Raises the in event 'e' that is defined in the default interface scope. */
  44. extern void conditionalExpressionsIface_raise_e(ConditionalExpressions* handle);
  45. /*! Gets the value of the variable 'condition' that is defined in the default interface scope. */
  46. extern sc_integer conditionalExpressionsIface_get_condition(const ConditionalExpressions* handle);
  47. /*! Sets the value of the variable 'condition' that is defined in the default interface scope. */
  48. extern void conditionalExpressionsIface_set_condition(ConditionalExpressions* handle, sc_integer value);
  49. /*! Gets the value of the variable 'boolVar' that is defined in the default interface scope. */
  50. extern sc_boolean conditionalExpressionsIface_get_boolVar(const ConditionalExpressions* handle);
  51. /*! Sets the value of the variable 'boolVar' that is defined in the default interface scope. */
  52. extern void conditionalExpressionsIface_set_boolVar(ConditionalExpressions* handle, sc_boolean value);
  53. /*!
  54. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  55. * 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.
  56. */
  57. extern sc_boolean conditionalExpressions_isActive(const ConditionalExpressions* handle);
  58. /*!
  59. * Checks if all active states are final.
  60. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  61. */
  62. extern sc_boolean conditionalExpressions_isFinal(const ConditionalExpressions* handle);
  63. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  64. extern sc_boolean conditionalExpressions_isStateActive(const ConditionalExpressions* handle, ConditionalExpressionsStates state);
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68. #endif /* CONDITIONALEXPRESSIONS_H_ */