EntryChoice.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. #include "EntryChoice.h"
  2. #include <string.h>
  3. /*! \file Implementation of the state machine 'EntryChoice'
  4. */
  5. EntryChoice::EntryChoice()
  6. {
  7. stateConfVectorPosition = 0;
  8. }
  9. EntryChoice::~EntryChoice()
  10. {
  11. }
  12. void EntryChoice::init()
  13. {
  14. for (int i = 0; i < maxOrthogonalStates; ++i)
  15. stateConfVector[i] = EntryChoice_last_state;
  16. stateConfVectorPosition = 0;
  17. clearInEvents();
  18. clearOutEvents();
  19. }
  20. void EntryChoice::enter()
  21. {
  22. /* Default enter sequence for statechart EntryChoice */
  23. enseq_main_region_default();
  24. }
  25. void EntryChoice::exit()
  26. {
  27. /* Default exit sequence for statechart EntryChoice */
  28. exseq_main_region();
  29. }
  30. sc_boolean EntryChoice::isActive() const
  31. {
  32. return stateConfVector[0] != EntryChoice_last_state;
  33. }
  34. /*
  35. * Always returns 'false' since this state machine can never become final.
  36. */
  37. sc_boolean EntryChoice::isFinal() const
  38. {
  39. return false;}
  40. void EntryChoice::runCycle()
  41. {
  42. clearOutEvents();
  43. for (stateConfVectorPosition = 0;
  44. stateConfVectorPosition < maxOrthogonalStates;
  45. stateConfVectorPosition++)
  46. {
  47. switch (stateConfVector[stateConfVectorPosition])
  48. {
  49. case main_region_A :
  50. {
  51. react_main_region_A();
  52. break;
  53. }
  54. default:
  55. break;
  56. }
  57. }
  58. clearInEvents();
  59. }
  60. void EntryChoice::clearInEvents()
  61. {
  62. }
  63. void EntryChoice::clearOutEvents()
  64. {
  65. }
  66. sc_boolean EntryChoice::isStateActive(EntryChoiceStates state) const
  67. {
  68. switch (state)
  69. {
  70. case main_region_A :
  71. return (sc_boolean) (stateConfVector[0] == main_region_A
  72. );
  73. default: return false;
  74. }
  75. }
  76. // implementations of all internal functions
  77. sc_boolean EntryChoice::check_main_region__choice_0_tr0_tr0()
  78. {
  79. return true;
  80. }
  81. void EntryChoice::effect_main_region__choice_0_tr0()
  82. {
  83. enseq_main_region_A_default();
  84. }
  85. /* 'default' enter sequence for state A */
  86. void EntryChoice::enseq_main_region_A_default()
  87. {
  88. /* 'default' enter sequence for state A */
  89. stateConfVector[0] = main_region_A;
  90. stateConfVectorPosition = 0;
  91. }
  92. /* 'default' enter sequence for region main region */
  93. void EntryChoice::enseq_main_region_default()
  94. {
  95. /* 'default' enter sequence for region main region */
  96. react_main_region__entry_Default();
  97. }
  98. /* Default exit sequence for state A */
  99. void EntryChoice::exseq_main_region_A()
  100. {
  101. /* Default exit sequence for state A */
  102. stateConfVector[0] = EntryChoice_last_state;
  103. stateConfVectorPosition = 0;
  104. }
  105. /* Default exit sequence for region main region */
  106. void EntryChoice::exseq_main_region()
  107. {
  108. /* Default exit sequence for region main region */
  109. /* Handle exit of all possible states (of EntryChoice.main_region) at position 0... */
  110. switch(stateConfVector[ 0 ])
  111. {
  112. case main_region_A :
  113. {
  114. exseq_main_region_A();
  115. break;
  116. }
  117. default: break;
  118. }
  119. }
  120. /* The reactions of state A. */
  121. void EntryChoice::react_main_region_A()
  122. {
  123. /* The reactions of state A. */
  124. }
  125. /* The reactions of state null. */
  126. void EntryChoice::react_main_region__choice_0()
  127. {
  128. /* The reactions of state null. */
  129. effect_main_region__choice_0_tr0();
  130. }
  131. /* Default react sequence for initial entry */
  132. void EntryChoice::react_main_region__entry_Default()
  133. {
  134. /* Default react sequence for initial entry */
  135. react_main_region__choice_0();
  136. }