BooleanExpressions.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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_main_region_StateA,
  13. BooleanExpressions_main_region_StateB,
  14. BooleanExpressions_last_state
  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. /*!
  31. * Type definition of the data structure for the BooleanExpressions state machine.
  32. * This data structure has to be allocated by the client code.
  33. */
  34. typedef struct
  35. {
  36. BooleanExpressionsStates stateConfVector[BOOLEANEXPRESSIONS_MAX_ORTHOGONAL_STATES];
  37. sc_ushort stateConfVectorPosition;
  38. BooleanExpressionsIface iface;
  39. } BooleanExpressions;
  40. /*! Initializes the BooleanExpressions state machine data structures. Must be called before first usage.*/
  41. extern void booleanExpressions_init(BooleanExpressions* handle);
  42. /*! Activates the state machine */
  43. extern void booleanExpressions_enter(BooleanExpressions* handle);
  44. /*! Deactivates the state machine */
  45. extern void booleanExpressions_exit(BooleanExpressions* handle);
  46. /*! Performs a 'run to completion' step. */
  47. extern void booleanExpressions_runCycle(BooleanExpressions* handle);
  48. /*! Gets the value of the variable 'myBool1' that is defined in the default interface scope. */
  49. extern sc_boolean booleanExpressionsIface_get_myBool1(const BooleanExpressions* handle);
  50. /*! Sets the value of the variable 'myBool1' that is defined in the default interface scope. */
  51. extern void booleanExpressionsIface_set_myBool1(BooleanExpressions* handle, sc_boolean value);
  52. /*! Gets the value of the variable 'myBool2' that is defined in the default interface scope. */
  53. extern sc_boolean booleanExpressionsIface_get_myBool2(const BooleanExpressions* handle);
  54. /*! Sets the value of the variable 'myBool2' that is defined in the default interface scope. */
  55. extern void booleanExpressionsIface_set_myBool2(BooleanExpressions* handle, sc_boolean value);
  56. /*! Gets the value of the variable 'and' that is defined in the default interface scope. */
  57. extern sc_boolean booleanExpressionsIface_get_and(const BooleanExpressions* handle);
  58. /*! Sets the value of the variable 'and' that is defined in the default interface scope. */
  59. extern void booleanExpressionsIface_set_and(BooleanExpressions* handle, sc_boolean value);
  60. /*! Gets the value of the variable 'or' that is defined in the default interface scope. */
  61. extern sc_boolean booleanExpressionsIface_get_or(const BooleanExpressions* handle);
  62. /*! Sets the value of the variable 'or' that is defined in the default interface scope. */
  63. extern void booleanExpressionsIface_set_or(BooleanExpressions* handle, sc_boolean value);
  64. /*! Gets the value of the variable 'not' that is defined in the default interface scope. */
  65. extern sc_boolean booleanExpressionsIface_get_not(const BooleanExpressions* handle);
  66. /*! Sets the value of the variable 'not' that is defined in the default interface scope. */
  67. extern void booleanExpressionsIface_set_not(BooleanExpressions* handle, sc_boolean value);
  68. /*! Gets the value of the variable 'equal' that is defined in the default interface scope. */
  69. extern sc_boolean booleanExpressionsIface_get_equal(const BooleanExpressions* handle);
  70. /*! Sets the value of the variable 'equal' that is defined in the default interface scope. */
  71. extern void booleanExpressionsIface_set_equal(BooleanExpressions* handle, sc_boolean value);
  72. /*! Gets the value of the variable 'notequal' that is defined in the default interface scope. */
  73. extern sc_boolean booleanExpressionsIface_get_notequal(const BooleanExpressions* handle);
  74. /*! Sets the value of the variable 'notequal' that is defined in the default interface scope. */
  75. extern void booleanExpressionsIface_set_notequal(BooleanExpressions* handle, sc_boolean value);
  76. /*! Raises the in event 'e1' that is defined in the default interface scope. */
  77. extern void booleanExpressionsIface_raise_e1(BooleanExpressions* handle);
  78. /*!
  79. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  80. * 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.
  81. */
  82. extern sc_boolean booleanExpressions_isActive(const BooleanExpressions* handle);
  83. /*!
  84. * Checks if all active states are final.
  85. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  86. */
  87. extern sc_boolean booleanExpressions_isFinal(const BooleanExpressions* handle);
  88. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  89. extern sc_boolean booleanExpressions_isStateActive(const BooleanExpressions* handle, BooleanExpressionsStates state);
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. #endif /* BOOLEANEXPRESSIONS_H_ */