Goby3 3.2.3
2025.05.13
Loading...
Searching...
No Matches
state.hpp
Go to the documentation of this file.
1#ifndef BOOST_STATECHART_STATE_HPP_INCLUDED
2#define BOOST_STATECHART_STATE_HPP_INCLUDED
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)
8
9
10
12
13#include <boost/mpl/list.hpp>
14
15
16
17namespace boost
18{
19namespace statechart
20{
21
22
23
24template< class MostDerived,
25 class Context,
26 class InnerInitial = mpl::list<>,
27 history_mode historyMode = has_no_history >
28class state : public simple_state<
29 MostDerived, Context, InnerInitial, historyMode >
30{
33
34 protected:
37 {
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
context_type::outermost_context_base_type outermost_context_base_type
void set_context(const context_ptr_type &pContext)
detail::make_list< InnerInitial >::type inner_initial_list
context_type::inner_context_ptr_type context_ptr_type
intrusive_ptr< inner_context_type > inner_context_ptr_type
base_type::outermost_context_base_type outermost_context_base_type
Definition state.hpp:62
base_type::inner_context_ptr_type inner_context_ptr_type
Definition state.hpp:63
state(my_context ctx)
Definition state.hpp:48
base_type::context_ptr_type context_ptr_type
Definition state.hpp:64
base_type::inner_initial_list inner_initial_list
Definition state.hpp:65
static void initial_deep_construct(outermost_context_base_type &outermostContextBase)
Definition state.hpp:67
static void deep_construct(const context_ptr_type &pContext, outermost_context_base_type &outermostContextBase)
Definition state.hpp:74
static inner_context_ptr_type shallow_construct(const context_ptr_type &pContext, outermost_context_base_type &outermostContextBase)
Definition state.hpp:84
base_type::context_ptr_type pContext_
Definition state.hpp:43
my_context(typename base_type::context_ptr_type pContext)
Definition state.hpp:38