BooleanExpressions.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #ifndef BOOLEANEXPRESSIONS_H_
  2. #define BOOLEANEXPRESSIONS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'BooleanExpressions'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. BooleanExpressions_last_state,
  13. BooleanExpressions_main_region_StateA,
  14. BooleanExpressions_main_region_StateB
  15. } BooleanExpressionsStates;
  16. /*! Type definition of the data structure for the BooleanExpressionsIface interface scope. */
  17. typedef struct
  18. {
  19. sc_boolean myBool1;
  20. sc_boolean myBool2;
  21. sc_boolean and_ID;
  22. sc_boolean or_ID;
  23. sc_boolean not_ID;
  24. sc_boolean equal;
  25. sc_boolean notequal;
  26. sc_boolean e1_raised;
  27. } BooleanExpressionsIface;
  28. /*! Define dimension of the state configuration vector for orthogonal states. */
  29. #define BOOLEANEXPRESSIONS_MAX_ORTHOGONAL_STATES 1
  30. /*! Define indices of states in the StateConfVector */
  31. #define SCVI_BOOLEANEXPRESSIONS_MAIN_REGION_STATEA 0
  32. #define SCVI_BOOLEANEXPRESSIONS_MAIN_REGION_STATEB 0
  33. /*!
  34. * Type definition of the data structure for the BooleanExpressions state machine.
  35. * This data structure has to be allocated by the client code.
  36. */
  37. typedef struct
  38. {
  39. BooleanExpressionsStates stateConfVector[BOOLEANEXPRESSIONS_MAX_ORTHOGONAL_STATES];
  40. sc_ushort stateConfVectorPosition;
  41. BooleanExpressionsIface iface;
  42. } BooleanExpressions;
  43. /*! Initializes the BooleanExpressions state machine data structures. Must be called before first usage.*/
  44. extern void booleanExpressions_init(BooleanExpressions* handle);
  45. /*! Activates the state machine */
  46. extern void booleanExpressions_enter(BooleanExpressions* handle);
  47. /*! Deactivates the state machine */
  48. extern void booleanExpressions_exit(BooleanExpressions* handle);
  49. /*! Performs a 'run to completion' step. */
  50. extern void booleanExpressions_runCycle(BooleanExpressions* handle);
  51. /*! Gets the value of the variable 'myBool1' that is defined in the default interface scope. */
  52. extern sc_boolean booleanExpressionsIface_get_myBool1(const BooleanExpressions* handle);
  53. /*! Sets the value of the variable 'myBool1' that is defined in the default interface scope. */
  54. extern void booleanExpressionsIface_set_myBool1(BooleanExpressions* handle, sc_boolean value);
  55. /*! Gets the value of the variable 'myBool2' that is defined in the default interface scope. */
  56. extern sc_boolean booleanExpressionsIface_get_myBool2(const BooleanExpressions* handle);
  57. /*! Sets the value of the variable 'myBool2' that is defined in the default interface scope. */
  58. extern void booleanExpressionsIface_set_myBool2(BooleanExpressions* handle, sc_boolean value);
  59. /*! Gets the value of the variable 'and' that is defined in the default interface scope. */
  60. extern sc_boolean booleanExpressionsIface_get_and(const BooleanExpressions* handle);
  61. /*! Sets the value of the variable 'and' that is defined in the default interface scope. */
  62. extern void booleanExpressionsIface_set_and(BooleanExpressions* handle, sc_boolean value);
  63. /*! Gets the value of the variable 'or' that is defined in the default interface scope. */
  64. extern sc_boolean booleanExpressionsIface_get_or(const BooleanExpressions* handle);
  65. /*! Sets the value of the variable 'or' that is defined in the default interface scope. */
  66. extern void booleanExpressionsIface_set_or(BooleanExpressions* handle, sc_boolean value);
  67. /*! Gets the value of the variable 'not' that is defined in the default interface scope. */
  68. extern sc_boolean booleanExpressionsIface_get_not(const BooleanExpressions* handle);
  69. /*! Sets the value of the variable 'not' that is defined in the default interface scope. */
  70. extern void booleanExpressionsIface_set_not(BooleanExpressions* handle, sc_boolean value);
  71. /*! Gets the value of the variable 'equal' that is defined in the default interface scope. */
  72. extern sc_boolean booleanExpressionsIface_get_equal(const BooleanExpressions* handle);
  73. /*! Sets the value of the variable 'equal' that is defined in the default interface scope. */
  74. extern void booleanExpressionsIface_set_equal(BooleanExpressions* handle, sc_boolean value);
  75. /*! Gets the value of the variable 'notequal' that is defined in the default interface scope. */
  76. extern sc_boolean booleanExpressionsIface_get_notequal(const BooleanExpressions* handle);
  77. /*! Sets the value of the variable 'notequal' that is defined in the default interface scope. */
  78. extern void booleanExpressionsIface_set_notequal(BooleanExpressions* handle, sc_boolean value);
  79. /*! Raises the in event 'e1' that is defined in the default interface scope. */
  80. extern void booleanExpressionsIface_raise_e1(BooleanExpressions* handle);
  81. /*!
  82. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  83. * 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.
  84. */
  85. extern sc_boolean booleanExpressions_isActive(const BooleanExpressions* handle);
  86. /*!
  87. * Checks if all active states are final.
  88. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  89. */
  90. extern sc_boolean booleanExpressions_isFinal(const BooleanExpressions* handle);
  91. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  92. extern sc_boolean booleanExpressions_isStateActive(const BooleanExpressions* handle, BooleanExpressionsStates state);
  93. #ifdef __cplusplus
  94. }
  95. #endif
  96. #endif /* BOOLEANEXPRESSIONS_H_ */