StringExpressions.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #ifndef STRINGEXPRESSIONS_H_
  2. #define STRINGEXPRESSIONS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'StringExpressions'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. StringExpressions_AssignmentChecked,
  13. StringExpressions_Failed,
  14. StringExpressions_VarToVarCompareSucceeded,
  15. StringExpressions_VarToConstCompareSucceeded,
  16. StringExpressions_ConstToVarCompareSucceeded,
  17. StringExpressions_ConstToConstCompareSucceeded,
  18. StringExpressions_last_state
  19. } StringExpressionsStates;
  20. /*! Type definition of the data structure for the StringExpressionsIface interface scope. */
  21. typedef struct
  22. {
  23. sc_string stringA;
  24. sc_string stringA2;
  25. sc_string stringB;
  26. sc_string quotedStringX;
  27. sc_string quotedStringY;
  28. sc_boolean stringVarEqual;
  29. sc_boolean stringVarNotEqual;
  30. sc_boolean guardStringNotEqual;
  31. sc_boolean guardStringEqual;
  32. sc_boolean e_raised;
  33. } StringExpressionsIface;
  34. /*! Define dimension of the state configuration vector for orthogonal states. */
  35. #define STRINGEXPRESSIONS_MAX_ORTHOGONAL_STATES 1
  36. /*!
  37. * Type definition of the data structure for the StringExpressions state machine.
  38. * This data structure has to be allocated by the client code.
  39. */
  40. typedef struct
  41. {
  42. StringExpressionsStates stateConfVector[STRINGEXPRESSIONS_MAX_ORTHOGONAL_STATES];
  43. sc_ushort stateConfVectorPosition;
  44. StringExpressionsIface iface;
  45. } StringExpressions;
  46. /*! Initializes the StringExpressions state machine data structures. Must be called before first usage.*/
  47. extern void stringExpressions_init(StringExpressions* handle);
  48. /*! Activates the state machine */
  49. extern void stringExpressions_enter(StringExpressions* handle);
  50. /*! Deactivates the state machine */
  51. extern void stringExpressions_exit(StringExpressions* handle);
  52. /*! Performs a 'run to completion' step. */
  53. extern void stringExpressions_runCycle(StringExpressions* handle);
  54. /*! Gets the value of the variable 'stringA' that is defined in the default interface scope. */
  55. extern sc_string stringExpressionsIface_get_stringA(const StringExpressions* handle);
  56. /*! Sets the value of the variable 'stringA' that is defined in the default interface scope. */
  57. extern void stringExpressionsIface_set_stringA(StringExpressions* handle, sc_string value);
  58. /*! Gets the value of the variable 'stringA2' that is defined in the default interface scope. */
  59. extern sc_string stringExpressionsIface_get_stringA2(const StringExpressions* handle);
  60. /*! Sets the value of the variable 'stringA2' that is defined in the default interface scope. */
  61. extern void stringExpressionsIface_set_stringA2(StringExpressions* handle, sc_string value);
  62. /*! Gets the value of the variable 'stringB' that is defined in the default interface scope. */
  63. extern sc_string stringExpressionsIface_get_stringB(const StringExpressions* handle);
  64. /*! Sets the value of the variable 'stringB' that is defined in the default interface scope. */
  65. extern void stringExpressionsIface_set_stringB(StringExpressions* handle, sc_string value);
  66. /*! Gets the value of the variable 'quotedStringX' that is defined in the default interface scope. */
  67. extern sc_string stringExpressionsIface_get_quotedStringX(const StringExpressions* handle);
  68. /*! Sets the value of the variable 'quotedStringX' that is defined in the default interface scope. */
  69. extern void stringExpressionsIface_set_quotedStringX(StringExpressions* handle, sc_string value);
  70. /*! Gets the value of the variable 'quotedStringY' that is defined in the default interface scope. */
  71. extern sc_string stringExpressionsIface_get_quotedStringY(const StringExpressions* handle);
  72. /*! Sets the value of the variable 'quotedStringY' that is defined in the default interface scope. */
  73. extern void stringExpressionsIface_set_quotedStringY(StringExpressions* handle, sc_string value);
  74. /*! Gets the value of the variable 'stringVarEqual' that is defined in the default interface scope. */
  75. extern sc_boolean stringExpressionsIface_get_stringVarEqual(const StringExpressions* handle);
  76. /*! Sets the value of the variable 'stringVarEqual' that is defined in the default interface scope. */
  77. extern void stringExpressionsIface_set_stringVarEqual(StringExpressions* handle, sc_boolean value);
  78. /*! Gets the value of the variable 'stringVarNotEqual' that is defined in the default interface scope. */
  79. extern sc_boolean stringExpressionsIface_get_stringVarNotEqual(const StringExpressions* handle);
  80. /*! Sets the value of the variable 'stringVarNotEqual' that is defined in the default interface scope. */
  81. extern void stringExpressionsIface_set_stringVarNotEqual(StringExpressions* handle, sc_boolean value);
  82. /*! Gets the value of the variable 'guardStringNotEqual' that is defined in the default interface scope. */
  83. extern sc_boolean stringExpressionsIface_get_guardStringNotEqual(const StringExpressions* handle);
  84. /*! Sets the value of the variable 'guardStringNotEqual' that is defined in the default interface scope. */
  85. extern void stringExpressionsIface_set_guardStringNotEqual(StringExpressions* handle, sc_boolean value);
  86. /*! Gets the value of the variable 'guardStringEqual' that is defined in the default interface scope. */
  87. extern sc_boolean stringExpressionsIface_get_guardStringEqual(const StringExpressions* handle);
  88. /*! Sets the value of the variable 'guardStringEqual' that is defined in the default interface scope. */
  89. extern void stringExpressionsIface_set_guardStringEqual(StringExpressions* handle, sc_boolean value);
  90. /*! Raises the in event 'e' that is defined in the default interface scope. */
  91. extern void stringExpressionsIface_raise_e(StringExpressions* handle);
  92. /*!
  93. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  94. * 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.
  95. */
  96. extern sc_boolean stringExpressions_isActive(const StringExpressions* handle);
  97. /*!
  98. * Checks if all active states are final.
  99. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  100. */
  101. extern sc_boolean stringExpressions_isFinal(const StringExpressions* handle);
  102. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  103. extern sc_boolean stringExpressions_isStateActive(const StringExpressions* handle, StringExpressionsStates state);
  104. #ifdef __cplusplus
  105. }
  106. #endif
  107. #endif /* STRINGEXPRESSIONS_H_ */