File indexing completed on 2025-01-18 09:52:31
0001 #ifndef BOOST_STATECHART_DETAIL_LEAF_STATE_HPP_INCLUDED
0002 #define BOOST_STATECHART_DETAIL_LEAF_STATE_HPP_INCLUDED
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <boost/statechart/detail/state_base.hpp>
0012
0013
0014
0015 namespace boost
0016 {
0017 namespace statechart
0018 {
0019 namespace detail
0020 {
0021
0022
0023
0024
0025 template< class Allocator, class RttiPolicy >
0026 class leaf_state : public state_base< Allocator, RttiPolicy >
0027 {
0028 typedef state_base< Allocator, RttiPolicy > base_type;
0029 protected:
0030
0031 leaf_state( typename RttiPolicy::id_provider_type idProvider ) :
0032 base_type( idProvider )
0033 {
0034 }
0035
0036 ~leaf_state() {}
0037
0038 public:
0039
0040
0041
0042
0043 void set_list_position(
0044 typename base_type::state_list_type::iterator listPosition )
0045 {
0046 listPosition_ = listPosition;
0047 }
0048
0049 typedef typename base_type::leaf_state_ptr_type
0050 direct_state_base_ptr_type;
0051
0052 virtual void remove_from_state_list(
0053 typename base_type::state_list_type::iterator & statesEnd,
0054 typename base_type::node_state_base_ptr_type & pOutermostUnstableState,
0055 bool performFullExit )
0056 {
0057 --statesEnd;
0058 swap( *listPosition_, *statesEnd );
0059 ( *listPosition_ )->set_list_position( listPosition_ );
0060 direct_state_base_ptr_type & pState = *statesEnd;
0061
0062
0063 pState->exit_impl( pState, pOutermostUnstableState, performFullExit );
0064 }
0065
0066 virtual void exit_impl(
0067 direct_state_base_ptr_type & pSelf,
0068 typename base_type::node_state_base_ptr_type & pOutermostUnstableState,
0069 bool performFullExit ) = 0;
0070
0071 private:
0072
0073 typename base_type::state_list_type::iterator listPosition_;
0074 };
0075
0076
0077
0078 }
0079 }
0080 }
0081
0082
0083
0084 #endif