Operations.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. #ifndef OPERATIONS_H_
  2. #define OPERATIONS_H_
  3. #include "sc_types.h"
  4. #include "StatemachineInterface.h"
  5. /*! \file Header of the state machine 'Operations'.
  6. */
  7. class Operations : public StatemachineInterface
  8. {
  9. public:
  10. Operations();
  11. ~Operations();
  12. /*! Enumeration of all states */
  13. typedef enum
  14. {
  15. main_region_B,
  16. main_region_C,
  17. main_region_D,
  18. main_region_A,
  19. Operations_last_state
  20. } OperationsStates;
  21. //! Inner class for internal interface scope operation callbacks.
  22. class InternalSCI_OCB
  23. {
  24. public:
  25. virtual ~InternalSCI_OCB() = 0;
  26. virtual void internalOperation1() = 0;
  27. virtual sc_boolean InternalOperation2(sc_integer param1) = 0;
  28. virtual sc_real internalOperation3() = 0;
  29. virtual sc_real internalOperation3a(sc_real param1) = 0;
  30. virtual sc_integer internalOperation4() = 0;
  31. virtual sc_integer internalOperation4a(sc_integer param1) = 0;
  32. virtual sc_string internalOperation5() = 0;
  33. virtual sc_string internalOperation5a(sc_string param1) = 0;
  34. };
  35. /*! Set the working instance of the operation callback interface 'InternalSCI_OCB'. */
  36. void setInternalSCI_OCB(InternalSCI_OCB* operationCallback);
  37. //! Inner class for Interface1 interface scope.
  38. class SCI_Interface1
  39. {
  40. public:
  41. private:
  42. friend class Operations;
  43. };
  44. //! Inner class for Interface1 interface scope operation callbacks.
  45. class SCI_Interface1_OCB
  46. {
  47. public:
  48. virtual ~SCI_Interface1_OCB() = 0;
  49. virtual void interfaceOperation1() = 0;
  50. virtual sc_boolean InterfaceOperation2(sc_integer param1) = 0;
  51. virtual sc_real interfaceOperation3() = 0;
  52. virtual sc_real interfaceOperation3a(sc_real param1) = 0;
  53. virtual sc_integer interfaceOperation4() = 0;
  54. virtual sc_integer interfaceOperation4a(sc_integer param1) = 0;
  55. virtual sc_string interfaceOperation5() = 0;
  56. virtual sc_string interfaceOperation5a(sc_string param1) = 0;
  57. };
  58. /*! Set the working instance of the operation callback interface 'SCI_Interface1_OCB'. */
  59. void setSCI_Interface1_OCB(SCI_Interface1_OCB* operationCallback);
  60. /*! Returns an instance of the interface class 'SCI_Interface1'. */
  61. SCI_Interface1* getSCI_Interface1();
  62. //! Inner class for default interface scope.
  63. class DefaultSCI
  64. {
  65. public:
  66. /*! Raises the in event 'ev' that is defined in the default interface scope. */
  67. void raise_ev();
  68. private:
  69. friend class Operations;
  70. sc_boolean ev_raised;
  71. };
  72. //! Inner class for default interface scope operation callbacks.
  73. class DefaultSCI_OCB
  74. {
  75. public:
  76. virtual ~DefaultSCI_OCB() = 0;
  77. virtual void unnamedInterfaceOperation1() = 0;
  78. virtual sc_boolean UnnamedInterfaceOperation2(sc_integer param1) = 0;
  79. virtual sc_real unnamedOperation3() = 0;
  80. virtual sc_real unnamedOperation3a(sc_real param1) = 0;
  81. virtual sc_integer unnamedOperation4() = 0;
  82. virtual sc_integer unnamedOperation4a(sc_integer param1) = 0;
  83. virtual sc_string unnamedOperation5() = 0;
  84. virtual sc_string unnamedOperation5a(sc_string param1) = 0;
  85. virtual sc_boolean alwaysTrue() = 0;
  86. };
  87. /*! Set the working instance of the operation callback interface 'DefaultSCI_OCB'. */
  88. void setDefaultSCI_OCB(DefaultSCI_OCB* operationCallback);
  89. /*! Returns an instance of the interface class 'DefaultSCI'. */
  90. DefaultSCI* getDefaultSCI();
  91. /*! Raises the in event 'ev' that is defined in the default interface scope. */
  92. void raise_ev();
  93. /*
  94. * Functions inherited from StatemachineInterface
  95. */
  96. virtual void init();
  97. virtual void enter();
  98. virtual void exit();
  99. virtual void runCycle();
  100. /*!
  101. * Checks if the state machine is active (until 2.4.1 this method was used for states).
  102. * 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.
  103. */
  104. virtual sc_boolean isActive() const;
  105. /*!
  106. * Checks if all active states are final.
  107. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  108. */
  109. virtual sc_boolean isFinal() const;
  110. /*! Checks if the specified state is active (until 2.4.1 the used method for states was calles isActive()). */
  111. sc_boolean isStateActive(OperationsStates state) const;
  112. private:
  113. //! Inner class for internal interface scope.
  114. class InternalSCI
  115. {
  116. public:
  117. /*! Gets the value of the variable 'myBool' that is defined in the internal scope. */
  118. sc_boolean get_myBool() const;
  119. /*! Sets the value of the variable 'myBool' that is defined in the internal scope. */
  120. void set_myBool(sc_boolean value);
  121. private:
  122. friend class Operations;
  123. sc_boolean myBool;
  124. };
  125. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  126. static const sc_integer maxOrthogonalStates = 1;
  127. OperationsStates stateConfVector[maxOrthogonalStates];
  128. sc_ushort stateConfVectorPosition;
  129. InternalSCI ifaceInternalSCI;
  130. InternalSCI_OCB* ifaceInternalSCI_OCB;
  131. SCI_Interface1 ifaceInterface1;
  132. SCI_Interface1_OCB* ifaceInterface1_OCB;
  133. DefaultSCI iface;
  134. DefaultSCI_OCB* iface_OCB;
  135. // prototypes of all internal functions
  136. sc_boolean check_main_region_B_tr0_tr0();
  137. sc_boolean check_main_region_C_tr0_tr0();
  138. sc_boolean check_main_region_A_tr0_tr0();
  139. void effect_main_region_B_tr0();
  140. void effect_main_region_C_tr0();
  141. void effect_main_region_A_tr0();
  142. void enact_main_region_B();
  143. void enact_main_region_C();
  144. void enact_main_region_D();
  145. void enseq_main_region_B_default();
  146. void enseq_main_region_C_default();
  147. void enseq_main_region_D_default();
  148. void enseq_main_region_A_default();
  149. void enseq_main_region_default();
  150. void exseq_main_region_B();
  151. void exseq_main_region_C();
  152. void exseq_main_region_D();
  153. void exseq_main_region_A();
  154. void exseq_main_region();
  155. void react_main_region_B();
  156. void react_main_region_C();
  157. void react_main_region_D();
  158. void react_main_region_A();
  159. void react_main_region__entry_Default();
  160. void clearInEvents();
  161. void clearOutEvents();
  162. };
  163. inline Operations::InternalSCI_OCB::~InternalSCI_OCB() {}
  164. inline Operations::SCI_Interface1_OCB::~SCI_Interface1_OCB() {}
  165. inline Operations::DefaultSCI_OCB::~DefaultSCI_OCB() {}
  166. #endif /* OPERATIONS_H_ */