]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/statechart/include/boost/statechart/detail/leaf_state.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / statechart / include / boost / statechart / detail / leaf_state.hpp
CommitLineData
7c673cae
FG
1#ifndef BOOST_STATECHART_DETAIL_LEAF_STATE_HPP_INCLUDED
2#define BOOST_STATECHART_DETAIL_LEAF_STATE_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
9
10
11#include <boost/statechart/detail/state_base.hpp>
12
13
14
15namespace boost
16{
17namespace statechart
18{
19namespace detail
20{
21
22
23
24//////////////////////////////////////////////////////////////////////////////
25template< class Allocator, class RttiPolicy >
26class leaf_state : public state_base< Allocator, RttiPolicy >
27{
28 typedef state_base< Allocator, RttiPolicy > base_type;
29 protected:
30 //////////////////////////////////////////////////////////////////////////
31 leaf_state( typename RttiPolicy::id_provider_type idProvider ) :
32 base_type( idProvider )
33 {
34 }
35
36 ~leaf_state() {}
37
38 public:
39 //////////////////////////////////////////////////////////////////////////
40 // The following declarations should be private.
41 // They are only public because many compilers lack template friends.
42 //////////////////////////////////////////////////////////////////////////
43 void set_list_position(
44 typename base_type::state_list_type::iterator listPosition )
45 {
46 listPosition_ = listPosition;
47 }
48
49 typedef typename base_type::leaf_state_ptr_type
50 direct_state_base_ptr_type;
51
52 virtual void remove_from_state_list(
53 typename base_type::state_list_type::iterator & statesEnd,
54 typename base_type::node_state_base_ptr_type & pOutermostUnstableState,
55 bool performFullExit )
56 {
57 --statesEnd;
58 swap( *listPosition_, *statesEnd );
59 ( *listPosition_ )->set_list_position( listPosition_ );
60 direct_state_base_ptr_type & pState = *statesEnd;
61 // Because the list owns the leaf_state, this leads to the immediate
62 // termination of this state.
63 pState->exit_impl( pState, pOutermostUnstableState, performFullExit );
64 }
65
66 virtual void exit_impl(
67 direct_state_base_ptr_type & pSelf,
68 typename base_type::node_state_base_ptr_type & pOutermostUnstableState,
69 bool performFullExit ) = 0;
70
71 private:
72 //////////////////////////////////////////////////////////////////////////
73 typename base_type::state_list_type::iterator listPosition_;
74};
75
76
77
78} // namespace detail
79} // namespace statechart
80} // namespace boost
81
82
83
84#endif