deep_history.hpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef BOOST_STATECHART_DEEP_HISTORY_HPP_INCLUDED
  2. #define BOOST_STATECHART_DEEP_HISTORY_HPP_INCLUDED
  3. //////////////////////////////////////////////////////////////////////////////
  4. // Copyright 2002-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/mpl/bool.hpp>
  9. #include <boost/static_assert.hpp>
  10. namespace boost
  11. {
  12. namespace statechart
  13. {
  14. //////////////////////////////////////////////////////////////////////////////
  15. template< class DefaultState >
  16. class deep_history
  17. {
  18. public:
  19. //////////////////////////////////////////////////////////////////////////
  20. // If you receive a
  21. // "use of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>'" or similar
  22. // compiler error here then you forgot to pass either
  23. // statechart::has_deep_history or statechart::has_full_history as the
  24. // last parameter of DefaultState's context.
  25. BOOST_STATIC_ASSERT( DefaultState::context_type::deep_history::value );
  26. //////////////////////////////////////////////////////////////////////////
  27. // The following declarations should be private.
  28. // They are only public because many compilers lack template friends.
  29. //////////////////////////////////////////////////////////////////////////
  30. typedef typename DefaultState::outermost_context_base_type
  31. outermost_context_base_type;
  32. typedef typename DefaultState::context_type context_type;
  33. typedef typename DefaultState::context_ptr_type context_ptr_type;
  34. typedef typename DefaultState::context_type_list context_type_list;
  35. typedef typename DefaultState::orthogonal_position orthogonal_position;
  36. static void deep_construct(
  37. const context_ptr_type & pContext,
  38. outermost_context_base_type & outermostContextBase )
  39. {
  40. outermostContextBase.template construct_with_deep_history<
  41. DefaultState >( pContext );
  42. }
  43. };
  44. } // namespace statechart
  45. } // namespace boost
  46. #endif