Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/statechart/detail/leaf_state.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
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 | |
15 namespace boost | |
16 { | |
17 namespace statechart | |
18 { | |
19 namespace detail | |
20 { | |
21 | |
22 | |
23 | |
24 ////////////////////////////////////////////////////////////////////////////// | |
25 template< class Allocator, class RttiPolicy > | |
26 class 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 |