My Project
state.hpp
Go to the documentation of this file.
1 #ifndef BOOST_STATECHART_STATE_HPP_INCLUDED
2 #define BOOST_STATECHART_STATE_HPP_INCLUDED
3 // 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)
8 
9 
10 
12 
13 #include <boost/mpl/list.hpp>
14 
15 
16 
17 namespace boost
18 {
19 namespace statechart
20 {
21 
22 
23 
24 template< class MostDerived,
25  class Context,
26  class InnerInitial = mpl::list<>,
27  history_mode historyMode = has_no_history >
28 class state : public simple_state<
29  MostDerived, Context, InnerInitial, historyMode >
30 {
32  base_type;
33 
34  protected:
36  struct my_context
37  {
38  my_context( typename base_type::context_ptr_type pContext ) :
39  pContext_( pContext )
40  {
41  }
42 
44  };
45 
46  typedef state my_base;
47 
49  {
50  this->set_context( ctx.pContext_ );
51  }
52 
53  ~state() {}
54 
55  public:
57  // The following declarations should be private.
58  // They are only public because many compilers lack template friends.
60  // See base class for documentation
66 
68  outermost_context_base_type & outermostContextBase )
69  {
70  deep_construct( &outermostContextBase, outermostContextBase );
71  }
72 
73  // See base class for documentation
74  static void deep_construct(
75  const context_ptr_type & pContext,
76  outermost_context_base_type & outermostContextBase )
77  {
78  const inner_context_ptr_type pInnerContext(
79  shallow_construct( pContext, outermostContextBase ) );
80  base_type::template deep_construct_inner< inner_initial_list >(
81  pInnerContext, outermostContextBase );
82  }
83 
85  const context_ptr_type & pContext,
86  outermost_context_base_type & outermostContextBase )
87  {
88  const inner_context_ptr_type pInnerContext(
89  new MostDerived( my_context( pContext ) ) );
90  outermostContextBase.add( pInnerContext );
91  return pInnerContext;
92  }
93 };
94 
95 
96 
97 } // namespace statechart
98 } // namespace boost
99 
100 
101 
102 #endif
boost::statechart::has_no_history
@ has_no_history
Definition: simple_state.hpp:178
boost::statechart::state::my_context::pContext_
base_type::context_ptr_type pContext_
Definition: state.hpp:43
boost::statechart::state::shallow_construct
static inner_context_ptr_type shallow_construct(const context_ptr_type &pContext, outermost_context_base_type &outermostContextBase)
Definition: state.hpp:84
boost::statechart::state::outermost_context_base_type
base_type::outermost_context_base_type outermost_context_base_type
Definition: state.hpp:62
boost::statechart::state::initial_deep_construct
static void initial_deep_construct(outermost_context_base_type &outermostContextBase)
Definition: state.hpp:67
boost::statechart::state::deep_construct
static void deep_construct(const context_ptr_type &pContext, outermost_context_base_type &outermostContextBase)
Definition: state.hpp:74
boost::statechart::simple_state::outermost_context_base_type
context_type::outermost_context_base_type outermost_context_base_type
Definition: simple_state.hpp:399
boost::statechart::state::inner_initial_list
base_type::inner_initial_list inner_initial_list
Definition: state.hpp:65
boost
Definition: asynchronous_state_machine.hpp:20
boost::statechart::state::inner_context_ptr_type
base_type::inner_context_ptr_type inner_context_ptr_type
Definition: state.hpp:63
boost::statechart::simple_state::context_ptr_type
context_type::inner_context_ptr_type context_ptr_type
Definition: simple_state.hpp:400
boost::statechart::state::context_ptr_type
base_type::context_ptr_type context_ptr_type
Definition: state.hpp:64
boost::statechart::state::my_context
Definition: state.hpp:37
boost::statechart::simple_state
Definition: simple_state.hpp:193
boost::statechart::state::my_base
state my_base
Definition: state.hpp:46
boost::statechart::simple_state::inner_initial_list
detail::make_list< InnerInitial >::type inner_initial_list
Definition: simple_state.hpp:404
boost::statechart::simple_state< MostDerived, Context, mpl::list<>, has_no_history >::set_context
void set_context(const context_ptr_type &pContext)
Definition: simple_state.hpp:607
boost::statechart::simple_state::inner_context_ptr_type
intrusive_ptr< inner_context_type > inner_context_ptr_type
Definition: simple_state.hpp:402
boost::statechart::history_mode
history_mode
Definition: simple_state.hpp:177
simple_state.hpp
boost::statechart::state::~state
~state()
Definition: state.hpp:53
boost::statechart::state
Definition: state.hpp:30
boost::statechart::state::state
state(my_context ctx)
Definition: state.hpp:48
boost::statechart::state::my_context::my_context
my_context(typename base_type::context_ptr_type pContext)
Definition: state.hpp:38