OuterOrthogonal.hpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #ifndef BOOST_STATECHART_TEST_OUTER_ORTHOGONAL_HPP_INCLUDED
  2. #define BOOST_STATECHART_TEST_OUTER_ORTHOGONAL_HPP_INCLUDED
  3. //////////////////////////////////////////////////////////////////////////////
  4. // Copyright 2004-2006 Andreas Huber Doenni
  5. // Distributed under the Boost Software License, Version 1.0. (See accompany-
  6. // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. //////////////////////////////////////////////////////////////////////////////
  8. #include <boost/statechart/state.hpp>
  9. #include <boost/mpl/list.hpp>
  10. #include "InnermostDefault.hpp"
  11. namespace sc = boost::statechart;
  12. namespace mpl = boost::mpl;
  13. //////////////////////////////////////////////////////////////////////////////
  14. template< class MostDerived, class Context, class InitialState0 >
  15. struct Orthogonal0 : sc::state< MostDerived, Context,
  16. mpl::list<
  17. InitialState0,
  18. Default1< MostDerived >,
  19. Default2< MostDerived > > >
  20. {
  21. typedef sc::state<
  22. MostDerived, Context, mpl::list< InitialState0,
  23. Default1< MostDerived >, Default2< MostDerived > > > base_type;
  24. typedef typename base_type::my_context my_context;
  25. typedef Orthogonal0 my_base;
  26. Orthogonal0( my_context ctx ) : base_type( ctx )
  27. {
  28. this->outermost_context().template ActualEntry< MostDerived >();
  29. }
  30. ~Orthogonal0()
  31. {
  32. this->outermost_context().template ActualDestructor< MostDerived >();
  33. }
  34. void exit()
  35. {
  36. this->outermost_context().template ActualExitFunction< MostDerived >();
  37. }
  38. };
  39. //////////////////////////////////////////////////////////////////////////////
  40. template< class MostDerived, class Context, class InitialState1 >
  41. struct Orthogonal1 : sc::state< MostDerived, Context,
  42. mpl::list<
  43. Default0< MostDerived >,
  44. InitialState1,
  45. Default2< MostDerived > > >
  46. {
  47. typedef sc::state<
  48. MostDerived, Context, mpl::list< Default0< MostDerived >,
  49. InitialState1, Default2< MostDerived > > > base_type;
  50. typedef typename base_type::my_context my_context;
  51. typedef Orthogonal1 my_base;
  52. Orthogonal1( my_context ctx ) : base_type( ctx )
  53. {
  54. this->outermost_context().template ActualEntry< MostDerived >();
  55. }
  56. ~Orthogonal1()
  57. {
  58. this->outermost_context().template ActualDestructor< MostDerived >();
  59. }
  60. void exit()
  61. {
  62. this->outermost_context().template ActualExitFunction< MostDerived >();
  63. }
  64. };
  65. //////////////////////////////////////////////////////////////////////////////
  66. template< class MostDerived, class Context, class InitialState2 >
  67. struct Orthogonal2 : sc::state< MostDerived, Context,
  68. mpl::list<
  69. Default0< MostDerived >,
  70. Default1< MostDerived >,
  71. InitialState2 > >
  72. {
  73. typedef sc::state<
  74. MostDerived, Context, mpl::list< Default0< MostDerived >,
  75. Default1< MostDerived >, InitialState2 > > base_type;
  76. typedef typename base_type::my_context my_context;
  77. typedef Orthogonal2 my_base;
  78. Orthogonal2( my_context ctx ) : base_type( ctx )
  79. {
  80. this->outermost_context().template ActualEntry< MostDerived >();
  81. }
  82. ~Orthogonal2()
  83. {
  84. this->outermost_context().template ActualDestructor< MostDerived >();
  85. }
  86. void exit()
  87. {
  88. this->outermost_context().template ActualExitFunction< MostDerived >();
  89. }
  90. };
  91. #endif