ConditionalExpressions.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_last_state,
  13. ConditionalExpressions_main_region_A,
  14. ConditionalExpressions_main_region_B
  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. /*! Define indices of states in the StateConfVector */
  26. #define SCVI_CONDITIONALEXPRESSIONS_MAIN_REGION_A 0
  27. #define SCVI_CONDITIONALEXPRESSIONS_MAIN_REGION_B 0
  28. /*!
  29. * Type definition of the data structure for the ConditionalExpressions state machine.
  30. * This data structure has to be allocated by the client code.
  31. */
  32. typedef struct
  33. {
  34. ConditionalExpressionsStates stateConfVector[CONDITIONALEXPRESSIONS_MAX_ORTHOGONAL_STATES];
  35. sc_ushort stateConfVectorPosition;
  36. ConditionalExpressionsIface iface;
  37. } ConditionalExpressions;
  38. /*! Initializes the ConditionalExpressions state machine data structures. Must be called before first usage.*/
  39. extern void conditionalExpressions_init(ConditionalExpressions* handle);
  40. /*! Activates the state machine */
  41. extern void conditionalExpressions_enter(ConditionalExpressions* handle);
  42. /*! Deactivates the state machine */
  43. extern void conditionalExpressions_exit(ConditionalExpressions* handle);
  44. /*! Performs a 'run to completion' step. */
  45. extern void conditionalExpressions_runCycle(ConditionalExpressions* handle);
  46. /*! Raises the in event 'e' that is defined in the default interface scope. */
  47. extern void conditionalExpressionsIface_raise_e(ConditionalExpressions* handle);
  48. /*! Gets the value of the variable 'condition' that is defined in the default interface scope. */
  49. extern sc_integer conditionalExpressionsIface_get_condition(const ConditionalExpressions* handle);
  50. /*! Sets the value of the variable 'condition' that is defined in the default interface scope. */
  51. extern void conditionalExpressionsIface_set_condition(ConditionalExpressions* handle, sc_integer value);
  52. /*! Gets the value of the variable 'boolVar' that is defined in the default interface scope. */
  53. extern sc_boolean conditionalExpressionsIface_get_boolVar(const ConditionalExpressions* handle);
  54. /*! Sets the value of the variable 'boolVar' that is defined in the default interface scope. */
  55. extern void conditionalExpressionsIface_set_boolVar(ConditionalExpressions* handle, sc_boolean 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 conditionalExpressions_isActive(const ConditionalExpressions* 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 conditionalExpressions_isFinal(const ConditionalExpressions* 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 conditionalExpressions_isStateActive(const ConditionalExpressions* handle, ConditionalExpressionsStates state);
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71. #endif /* CONDITIONALEXPRESSIONS_H_ */