ReadOnlyVariable.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #ifndef READONLYVARIABLE_H_
  2. #define READONLYVARIABLE_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'ReadOnlyVariable'.
  6. */
  7. class ReadOnlyVariable : public StatemachineInterface
  8. {
  9. public:
  10. ReadOnlyVariable();
  11. ~ReadOnlyVariable();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. main_region_StateB,
  16. main_region_StateA,
  17. ReadOnlyVariable_last_state
  18. } ReadOnlyVariableStates;
  19. //! Inner class for default interface scope.
  20. class DefaultSCI
  21. {
  22. public:
  23. /*! Gets the value of the variable 'myInt' that is defined in the default interface scope. */
  24. sc_integer get_myInt() const;
  25. /*! Gets the value of the variable 'myString' that is defined in the default interface scope. */
  26. sc_string get_myString() const;
  27. /*! Gets the value of the variable 'myBool' that is defined in the default interface scope. */
  28. sc_boolean get_myBool() const;
  29. /*! Gets the value of the variable 'myReal' that is defined in the default interface scope. */
  30. sc_real get_myReal() const;
  31. private:
  32. friend class ReadOnlyVariable;
  33. sc_integer myInt;
  34. sc_string myString;
  35. sc_boolean myBool;
  36. sc_real myReal;
  37. };
  38. /*! Returns an instance of the interface class 'DefaultSCI'. */
  39. DefaultSCI* getDefaultSCI();
  40. /*! Gets the value of the variable 'myInt' that is defined in the default interface scope. */
  41. sc_integer get_myInt() const;
  42. /*! Gets the value of the variable 'myString' that is defined in the default interface scope. */
  43. sc_string get_myString() const;
  44. /*! Gets the value of the variable 'myBool' that is defined in the default interface scope. */
  45. sc_boolean get_myBool() const;
  46. /*! Gets the value of the variable 'myReal' that is defined in the default interface scope. */
  47. sc_real get_myReal() const;
  48. //! Inner class for A interface scope.
  49. class SCI_A
  50. {
  51. public:
  52. /*! Gets the value of the variable 'myInt' that is defined in the interface scope 'A'. */
  53. sc_integer get_myInt() const;
  54. /*! Gets the value of the variable 'myString' that is defined in the interface scope 'A'. */
  55. sc_string get_myString() const;
  56. /*! Gets the value of the variable 'myBool' that is defined in the interface scope 'A'. */
  57. sc_boolean get_myBool() const;
  58. /*! Gets the value of the variable 'myReal' that is defined in the interface scope 'A'. */
  59. sc_real get_myReal() const;
  60. private:
  61. friend class ReadOnlyVariable;
  62. sc_integer myInt;
  63. sc_string myString;
  64. sc_boolean myBool;
  65. sc_real myReal;
  66. };
  67. /*! Returns an instance of the interface class 'SCI_A'. */
  68. SCI_A* getSCI_A();
  69. /*
  70. * Functions inherited from StatemachineInterface
  71. */
  72. virtual void init();
  73. virtual void enter();
  74. virtual void exit();
  75. virtual void runCycle();
  76. /*!
  77. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  78. * A state machine is active if it has been entered. It is inactive if it has not been entered at all or if it has been exited.
  79. */
  80. virtual sc_boolean isActive() const;
  81. /*!
  82. * Checks if all active states are final.
  83. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  84. */
  85. virtual sc_boolean isFinal() const;
  86. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  87. sc_boolean isStateActive(ReadOnlyVariableStates state) const;
  88. private:
  89. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  90. static const sc_integer maxOrthogonalStates = 1;
  91. ReadOnlyVariableStates stateConfVector[maxOrthogonalStates];
  92. sc_ushort stateConfVectorPosition;
  93. DefaultSCI iface;
  94. SCI_A ifaceA;
  95. // prototypes of all internal functions
  96. sc_boolean check_main_region_StateA_tr0_tr0();
  97. void effect_main_region_StateA_tr0();
  98. void enact_main_region_StateB();
  99. void enseq_main_region_StateB_default();
  100. void enseq_main_region_StateA_default();
  101. void enseq_main_region_default();
  102. void exseq_main_region_StateB();
  103. void exseq_main_region_StateA();
  104. void exseq_main_region();
  105. void react_main_region_StateB();
  106. void react_main_region_StateA();
  107. void react_main_region__entry_Default();
  108. void clearInEvents();
  109. void clearOutEvents();
  110. };
  111. #endif /* READONLYVARIABLE_H_ */