/src/contrib/boost/statechart/shallow_history.hpp

http://pythonocc.googlecode.com/ · C++ Header · 63 lines · 30 code · 17 blank · 16 comment · 0 complexity · 777d0d13d3c0fd08bc2cd8350e324140 MD5 · raw file

  1. #ifndef BOOST_STATECHART_SHALLOW_HISTORY_HPP_INCLUDED
  2. #define BOOST_STATECHART_SHALLOW_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 shallow_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::shallow_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_shallow_history<
  41. DefaultState >( pContext );
  42. }
  43. };
  44. } // namespace statechart
  45. } // namespace boost
  46. #endif