Parenthesis.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. #include "Parenthesis.h"
  2. #include <string.h>
  3. /*! \file Implementation of the state machine 'Parenthesis'
  4. */
  5. Parenthesis::Parenthesis()
  6. {
  7. stateConfVectorPosition = 0;
  8. }
  9. Parenthesis::~Parenthesis()
  10. {
  11. }
  12. void Parenthesis::init()
  13. {
  14. for (int i = 0; i < maxOrthogonalStates; ++i)
  15. stateConfVector[i] = Parenthesis_last_state;
  16. stateConfVectorPosition = 0;
  17. clearInEvents();
  18. clearOutEvents();
  19. /* Default init sequence for statechart Parenthesis */
  20. iface.erg = 0;
  21. }
  22. void Parenthesis::enter()
  23. {
  24. /* Default enter sequence for statechart Parenthesis */
  25. enseq_mainRegion_default();
  26. }
  27. void Parenthesis::exit()
  28. {
  29. /* Default exit sequence for statechart Parenthesis */
  30. exseq_mainRegion();
  31. }
  32. sc_boolean Parenthesis::isActive() const
  33. {
  34. return stateConfVector[0] != Parenthesis_last_state;
  35. }
  36. /*
  37. * Always returns 'false' since this state machine can never become final.
  38. */
  39. sc_boolean Parenthesis::isFinal() const
  40. {
  41. return false;}
  42. void Parenthesis::runCycle()
  43. {
  44. clearOutEvents();
  45. for (stateConfVectorPosition = 0;
  46. stateConfVectorPosition < maxOrthogonalStates;
  47. stateConfVectorPosition++)
  48. {
  49. switch (stateConfVector[stateConfVectorPosition])
  50. {
  51. case mainRegion_A :
  52. {
  53. react_mainRegion_A();
  54. break;
  55. }
  56. default:
  57. break;
  58. }
  59. }
  60. clearInEvents();
  61. }
  62. void Parenthesis::clearInEvents()
  63. {
  64. }
  65. void Parenthesis::clearOutEvents()
  66. {
  67. }
  68. sc_boolean Parenthesis::isStateActive(ParenthesisStates state) const
  69. {
  70. switch (state)
  71. {
  72. case mainRegion_A :
  73. return (sc_boolean) (stateConfVector[0] == mainRegion_A
  74. );
  75. default: return false;
  76. }
  77. }
  78. Parenthesis::DefaultSCI* Parenthesis::getDefaultSCI()
  79. {
  80. return &iface;
  81. }
  82. sc_integer Parenthesis::DefaultSCI::get_erg() const
  83. {
  84. return erg;
  85. }
  86. sc_integer Parenthesis::get_erg() const
  87. {
  88. return iface.erg;
  89. }
  90. void Parenthesis::DefaultSCI::set_erg(sc_integer value)
  91. {
  92. erg = value;
  93. }
  94. void Parenthesis::set_erg(sc_integer value)
  95. {
  96. iface.erg = value;
  97. }
  98. // implementations of all internal functions
  99. /* Entry action for state 'A'. */
  100. void Parenthesis::enact_mainRegion_A()
  101. {
  102. /* Entry action for state 'A'. */
  103. iface.erg = 4 * (3 - 1);
  104. }
  105. /* 'default' enter sequence for state A */
  106. void Parenthesis::enseq_mainRegion_A_default()
  107. {
  108. /* 'default' enter sequence for state A */
  109. enact_mainRegion_A();
  110. stateConfVector[0] = mainRegion_A;
  111. stateConfVectorPosition = 0;
  112. }
  113. /* 'default' enter sequence for region mainRegion */
  114. void Parenthesis::enseq_mainRegion_default()
  115. {
  116. /* 'default' enter sequence for region mainRegion */
  117. react_mainRegion__entry_Default();
  118. }
  119. /* Default exit sequence for state A */
  120. void Parenthesis::exseq_mainRegion_A()
  121. {
  122. /* Default exit sequence for state A */
  123. stateConfVector[0] = Parenthesis_last_state;
  124. stateConfVectorPosition = 0;
  125. }
  126. /* Default exit sequence for region mainRegion */
  127. void Parenthesis::exseq_mainRegion()
  128. {
  129. /* Default exit sequence for region mainRegion */
  130. /* Handle exit of all possible states (of Parenthesis.mainRegion) at position 0... */
  131. switch(stateConfVector[ 0 ])
  132. {
  133. case mainRegion_A :
  134. {
  135. exseq_mainRegion_A();
  136. break;
  137. }
  138. default: break;
  139. }
  140. }
  141. /* The reactions of state A. */
  142. void Parenthesis::react_mainRegion_A()
  143. {
  144. /* The reactions of state A. */
  145. }
  146. /* Default react sequence for initial entry */
  147. void Parenthesis::react_mainRegion__entry_Default()
  148. {
  149. /* Default react sequence for initial entry */
  150. enseq_mainRegion_A_default();
  151. }