StringExpressions.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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_last_state,
  13. StringExpressions_AssignmentChecked,
  14. StringExpressions_Failed,
  15. StringExpressions_VarToVarCompareSucceeded,
  16. StringExpressions_VarToConstCompareSucceeded,
  17. StringExpressions_ConstToVarCompareSucceeded,
  18. StringExpressions_ConstToConstCompareSucceeded
  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. /*! Define indices of states in the StateConfVector */
  37. #define SCVI_STRINGEXPRESSIONS_ASSIGNMENTCHECKED 0
  38. #define SCVI_STRINGEXPRESSIONS_FAILED 0
  39. #define SCVI_STRINGEXPRESSIONS_VARTOVARCOMPARESUCCEEDED 0
  40. #define SCVI_STRINGEXPRESSIONS_VARTOCONSTCOMPARESUCCEEDED 0
  41. #define SCVI_STRINGEXPRESSIONS_CONSTTOVARCOMPARESUCCEEDED 0
  42. #define SCVI_STRINGEXPRESSIONS_CONSTTOCONSTCOMPARESUCCEEDED 0
  43. /*!
  44. * Type definition of the data structure for the StringExpressions state machine.
  45. * This data structure has to be allocated by the client code.
  46. */
  47. typedef struct
  48. {
  49. StringExpressionsStates stateConfVector[STRINGEXPRESSIONS_MAX_ORTHOGONAL_STATES];
  50. sc_ushort stateConfVectorPosition;
  51. StringExpressionsIface iface;
  52. } StringExpressions;
  53. /*! Initializes the StringExpressions state machine data structures. Must be called before first usage.*/
  54. extern void stringExpressions_init(StringExpressions* handle);
  55. /*! Activates the state machine */
  56. extern void stringExpressions_enter(StringExpressions* handle);
  57. /*! Deactivates the state machine */
  58. extern void stringExpressions_exit(StringExpressions* handle);
  59. /*! Performs a 'run to completion' step. */
  60. extern void stringExpressions_runCycle(StringExpressions* handle);
  61. /*! Gets the value of the variable 'stringA' that is defined in the default interface scope. */
  62. extern sc_string stringExpressionsIface_get_stringA(const StringExpressions* handle);
  63. /*! Sets the value of the variable 'stringA' that is defined in the default interface scope. */
  64. extern void stringExpressionsIface_set_stringA(StringExpressions* handle, sc_string value);
  65. /*! Gets the value of the variable 'stringA2' that is defined in the default interface scope. */
  66. extern sc_string stringExpressionsIface_get_stringA2(const StringExpressions* handle);
  67. /*! Sets the value of the variable 'stringA2' that is defined in the default interface scope. */
  68. extern void stringExpressionsIface_set_stringA2(StringExpressions* handle, sc_string value);
  69. /*! Gets the value of the variable 'stringB' that is defined in the default interface scope. */
  70. extern sc_string stringExpressionsIface_get_stringB(const StringExpressions* handle);
  71. /*! Sets the value of the variable 'stringB' that is defined in the default interface scope. */
  72. extern void stringExpressionsIface_set_stringB(StringExpressions* handle, sc_string value);
  73. /*! Gets the value of the variable 'quotedStringX' that is defined in the default interface scope. */
  74. extern sc_string stringExpressionsIface_get_quotedStringX(const StringExpressions* handle);
  75. /*! Sets the value of the variable 'quotedStringX' that is defined in the default interface scope. */
  76. extern void stringExpressionsIface_set_quotedStringX(StringExpressions* handle, sc_string value);
  77. /*! Gets the value of the variable 'quotedStringY' that is defined in the default interface scope. */
  78. extern sc_string stringExpressionsIface_get_quotedStringY(const StringExpressions* handle);
  79. /*! Sets the value of the variable 'quotedStringY' that is defined in the default interface scope. */
  80. extern void stringExpressionsIface_set_quotedStringY(StringExpressions* handle, sc_string value);
  81. /*! Gets the value of the variable 'stringVarEqual' that is defined in the default interface scope. */
  82. extern sc_boolean stringExpressionsIface_get_stringVarEqual(const StringExpressions* handle);
  83. /*! Sets the value of the variable 'stringVarEqual' that is defined in the default interface scope. */
  84. extern void stringExpressionsIface_set_stringVarEqual(StringExpressions* handle, sc_boolean value);
  85. /*! Gets the value of the variable 'stringVarNotEqual' that is defined in the default interface scope. */
  86. extern sc_boolean stringExpressionsIface_get_stringVarNotEqual(const StringExpressions* handle);
  87. /*! Sets the value of the variable 'stringVarNotEqual' that is defined in the default interface scope. */
  88. extern void stringExpressionsIface_set_stringVarNotEqual(StringExpressions* handle, sc_boolean value);
  89. /*! Gets the value of the variable 'guardStringNotEqual' that is defined in the default interface scope. */
  90. extern sc_boolean stringExpressionsIface_get_guardStringNotEqual(const StringExpressions* handle);
  91. /*! Sets the value of the variable 'guardStringNotEqual' that is defined in the default interface scope. */
  92. extern void stringExpressionsIface_set_guardStringNotEqual(StringExpressions* handle, sc_boolean value);
  93. /*! Gets the value of the variable 'guardStringEqual' that is defined in the default interface scope. */
  94. extern sc_boolean stringExpressionsIface_get_guardStringEqual(const StringExpressions* handle);
  95. /*! Sets the value of the variable 'guardStringEqual' that is defined in the default interface scope. */
  96. extern void stringExpressionsIface_set_guardStringEqual(StringExpressions* handle, sc_boolean value);
  97. /*! Raises the in event 'e' that is defined in the default interface scope. */
  98. extern void stringExpressionsIface_raise_e(StringExpressions* handle);
  99. /*!
  100. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  101. * 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.
  102. */
  103. extern sc_boolean stringExpressions_isActive(const StringExpressions* handle);
  104. /*!
  105. * Checks if all active states are final.
  106. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  107. */
  108. extern sc_boolean stringExpressions_isFinal(const StringExpressions* handle);
  109. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  110. extern sc_boolean stringExpressions_isStateActive(const StringExpressions* handle, StringExpressionsStates state);
  111. #ifdef __cplusplus
  112. }
  113. #endif
  114. #endif /* STRINGEXPRESSIONS_H_ */