/usr/include/boost/msm/front/euml
Edit: /usr/include/boost/msm/front/euml/container.hpp (155786B)
// Copyright 2008 Christophe Henry
// henry UNDERSCORE christophe AT hotmail DOT com
// This is an extended version of the state machine available in the boost::mpl library
// Distributed under the same license as the original.
// Copyright for the original version:
// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
// under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MSM_FRONT_EUML_CONTAINER_H
#define BOOST_MSM_FRONT_EUML_CONTAINER_H
#include
#include
#include
#include
#include
#include
#include
#include
BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category)
namespace boost { namespace msm { namespace front { namespace euml
{
template
struct Front_ : euml_action >
{
template
struct state_action_result
{
typedef typename get_reference<
typename ::boost::remove_reference<
typename get_result_type2::type>::type>::type type;
};
template
struct transition_action_result
{
typedef typename get_reference<
typename ::boost::remove_reference<
typename get_result_type::type>::type>::type type;
};
typedef ::boost::mpl::set tag_type;
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename T::tag_type,action_tag>::type,
typename transition_action_result::type >::type
operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
return (T()(evt,fsm,src,tgt)).front();
}
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename T::tag_type,state_action_tag>::type,
typename state_action_result::type >::type
operator()(Event const& evt,FSM& fsm,STATE& state )const
{
return (T()(evt,fsm,state)).front();
}
};
struct front_tag {};
struct Front_Helper: proto::extends< proto::terminal::type, Front_Helper, boost::msm::sm_domain>
{
Front_Helper(){}
template
struct In
{
typedef Front_ type;
};
};
Front_Helper const front_;
template
struct Back_ : euml_action >
{
template
struct state_action_result
{
typedef typename get_reference<
typename ::boost::remove_reference<
typename get_result_type2::type>::type>::type type;
};
template
struct transition_action_result
{
typedef typename get_reference<
typename ::boost::remove_reference<
typename get_result_type::type>::type>::type type;
};
typedef ::boost::mpl::set tag_type;
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename T::tag_type,action_tag>::type,
typename transition_action_result::type >::type
operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
return (T()(evt,fsm,src,tgt)).back();
}
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename T::tag_type,state_action_tag>::type,
typename state_action_result::type >::type
operator()(Event const& evt,FSM& fsm,STATE& state )const
{
return (T()(evt,fsm,state)).back();
}
};
struct back_tag {};
struct Back_Helper: proto::extends< proto::terminal::type, Back_Helper, boost::msm::sm_domain>
{
Back_Helper(){}
template
struct In
{
typedef Back_ type;
};
};
Back_Helper const back_;
template
struct Begin_ : euml_action >
{
template
struct state_action_result
{
typedef typename get_iterator<
typename ::boost::remove_reference<
typename get_result_type2::type>::type>::type type;
};
template
struct transition_action_result
{
typedef typename get_iterator<
typename ::boost::remove_reference<
typename get_result_type::type>::type>::type type;
};
typedef ::boost::mpl::set tag_type;
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename T::tag_type,action_tag>::type,
typename transition_action_result::type >::type
operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
return (T()(evt,fsm,src,tgt)).begin();
}
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename T::tag_type,state_action_tag>::type,
typename state_action_result::type >::type
operator()(Event const& evt,FSM& fsm,STATE& state )const
{
return (T()(evt,fsm,state)).begin();
}
};
struct begin_tag {};
struct Begin_Helper: proto::extends< proto::terminal::type, Begin_Helper, boost::msm::sm_domain>
{
Begin_Helper(){}
template
struct In
{
typedef Begin_ type;
};
};
Begin_Helper const begin_;
template
struct End_ : euml_action >
{
template
struct state_action_result
{
typedef typename get_iterator<
typename ::boost::remove_reference<
typename get_result_type2::type>::type>::type type;
};
template
struct transition_action_result
{
typedef typename get_iterator<
typename ::boost::remove_reference<
typename get_result_type::type>::type>::type type;
};
typedef ::boost::mpl::set tag_type;
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename T::tag_type,action_tag>::type,
typename transition_action_result::type >::type
operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
return (T()(evt,fsm,src,tgt)).end();
}
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename T::tag_type,state_action_tag>::type,
typename state_action_result::type >::type
operator()(Event const& evt,FSM& fsm,STATE& state )const
{
return (T()(evt,fsm,state)).end();
}
};
struct end_tag {};
struct End_Helper: proto::extends< proto::terminal::type, End_Helper, boost::msm::sm_domain>
{
End_Helper(){}
template
struct In
{
typedef End_ type;
};
};
End_Helper const end_;
template
struct RBegin_ : euml_action >
{
template
struct state_action_result
{
typedef typename get_reverse_iterator<
typename ::boost::remove_reference<
typename get_result_type2::type>::type>::type type;
};
template
struct transition_action_result
{
typedef typename get_reverse_iterator<
typename ::boost::remove_reference<
typename get_result_type::type>::type>::type type;
};
typedef ::boost::mpl::set tag_type;
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename T::tag_type,action_tag>::type,
typename transition_action_result::type >::type
operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
return (T()(evt,fsm,src,tgt)).rbegin();
}
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename T::tag_type,state_action_tag>::type,
typename state_action_result::type >::type
operator()(Event const& evt,FSM& fsm,STATE& state )const
{
return (T()(evt,fsm,state)).rbegin();
}
};
struct rbegin_tag {};
struct RBegin_Helper: proto::extends< proto::terminal::type, RBegin_Helper, boost::msm::sm_domain>
{
RBegin_Helper(){}
template
struct In
{
typedef RBegin_ type;
};
};
RBegin_Helper const rbegin_;
template
struct REnd_ : euml_action >
{
template
struct state_action_result
{
typedef typename get_reverse_iterator<
typename ::boost::remove_reference<
typename get_result_type2::type>::type>::type type;
};
template
struct transition_action_result
{
typedef typename get_reverse_iterator<
typename ::boost::remove_reference<
typename get_result_type::type>::type>::type type;
};
typedef ::boost::mpl::set tag_type;
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename T::tag_type,action_tag>::type,
typename transition_action_result::type >::type
operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
return (T()(evt,fsm,src,tgt)).rend();
}
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename T::tag_type,state_action_tag>::type,
typename state_action_result::type >::type
operator()(Event const& evt,FSM& fsm,STATE& state )const
{
return (T()(evt,fsm,state)).rend();
}
};
struct rend_tag {};
struct REnd_Helper: proto::extends< proto::terminal::type, REnd_Helper, boost::msm::sm_domain>
{
REnd_Helper(){}
template
struct In
{
typedef REnd_ type;
};
};
REnd_Helper const rend_;
template
struct Push_Back_ : euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template
void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
(Container()(evt,fsm,src,tgt)).push_back(Element()(evt,fsm,src,tgt));
}
template
void operator()(Event const& evt,FSM& fsm,STATE& state )const
{
(Container()(evt,fsm,state)).push_back(Element()(evt,fsm,state));
}
};
struct push_back_tag {};
struct Push_Back_Helper: proto::extends< proto::terminal::type, Push_Back_Helper, boost::msm::sm_domain>
{
Push_Back_Helper(){}
template
struct In
{
typedef Push_Back_ type;
};
};
Push_Back_Helper const push_back_;
template
struct Pop_Back_ : euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template
void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
(Container()(evt,fsm,src,tgt)).pop_back();
}
template
void operator()(Event const& evt,FSM& fsm,STATE& state )const
{
(Container()(evt,fsm,state)).pop_back();
}
};
struct pop_back_tag {};
struct Pop_Back_Helper: proto::extends< proto::terminal::type, Pop_Back_Helper, boost::msm::sm_domain>
{
Pop_Back_Helper(){}
template
struct In
{
typedef Pop_Back_ type;
};
};
Pop_Back_Helper const pop_back_;
template
struct Push_Front_ : euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template
void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
(Container()(evt,fsm,src,tgt)).push_front(Element()(evt,fsm,src,tgt));
}
template
void operator()(Event const& evt,FSM& fsm,STATE& state )const
{
(Container()(evt,fsm,state)).push_front(Element()(evt,fsm,state));
}
};
struct push_front_tag {};
struct Push_Front_Helper: proto::extends< proto::terminal::type, Push_Front_Helper, boost::msm::sm_domain>
{
Push_Front_Helper(){}
template
struct In
{
typedef Push_Front_ type;
};
};
Push_Front_Helper const push_front_;
template
struct Pop_Front_ : euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template
void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
(Container()(evt,fsm,src,tgt)).pop_front();
}
template
void operator()(Event const& evt,FSM& fsm,STATE& state )const
{
(Container()(evt,fsm,state)).pop_front();
}
};
struct pop_front_tag {};
struct Pop_Front_Helper: proto::extends< proto::terminal::type, Pop_Front_Helper, boost::msm::sm_domain>
{
Pop_Front_Helper(){}
template
struct In
{
typedef Pop_Front_ type;
};
};
Pop_Front_Helper const pop_front_;
template
struct Clear_ : euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template
void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
(Container()(evt,fsm,src,tgt)).clear();
}
template
void operator()(Event const& evt,FSM& fsm,STATE& state )const
{
(Container()(evt,fsm,state)).clear();
}
};
struct clear_tag {};
struct Clear_Helper: proto::extends< proto::terminal::type, Clear_Helper, boost::msm::sm_domain>
{
Clear_Helper(){}
template
struct In
{
typedef Clear_ type;
};
};
Clear_Helper const clear_;
template
struct ListReverse_ : euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template
void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
(Container()(evt,fsm,src,tgt)).reverse();
}
template
void operator()(Event const& evt,FSM& fsm,STATE& state )const
{
(Container()(evt,fsm,state)).reverse();
}
};
struct list_reverse_tag {};
struct ListReverse_Helper: proto::extends< proto::terminal::type, ListReverse_Helper, boost::msm::sm_domain>
{
ListReverse_Helper(){}
template
struct In
{
typedef ListReverse_ type;
};
};
ListReverse_Helper const list_reverse_;
template
struct ListUnique_ : euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template
void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
(Container()(evt,fsm,src,tgt)).unique();
}
template
void operator()(Event const& evt,FSM& fsm,STATE& state )const
{
(Container()(evt,fsm,state)).unique();
}
};
template
struct ListUnique_::type >::type>
: euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template
void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
(Container()(evt,fsm,src,tgt)).unique(Predicate()(evt,fsm,src,tgt));
}
template
void operator()(Event const& evt,FSM& fsm,STATE& state )const
{
(Container()(evt,fsm,state)).unique(Predicate()(evt,fsm,state));
}
};
struct list_unique_tag {};
struct ListUnique_Helper: proto::extends< proto::terminal::type, ListUnique_Helper, boost::msm::sm_domain>
{
ListUnique_Helper(){}
template
struct In
{
typedef ListUnique_ type;
};
};
ListUnique_Helper const list_unique_;
template
struct ListSort_ : euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template
void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
(Container()(evt,fsm,src,tgt)).sort();
}
template
void operator()(Event const& evt,FSM& fsm,STATE& state )const
{
(Container()(evt,fsm,state)).sort();
}
};
template
struct ListSort_::type >::type>
: euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template
void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
(Container()(evt,fsm,src,tgt)).sort(Predicate()(evt,fsm,src,tgt));
}
template
void operator()(Event const& evt,FSM& fsm,STATE& state )const
{
(Container()(evt,fsm,state)).sort(Predicate()(evt,fsm,state));
}
};
struct list_sort_tag {};
struct ListSort_Helper: proto::extends< proto::terminal::type, ListSort_Helper, boost::msm::sm_domain>
{
ListSort_Helper(){}
template
struct In
{
typedef ListSort_ type;
};
};
ListSort_Helper const list_sort_;
template
struct Capacity_ : euml_action >
{
template
struct state_action_result
{
typedef typename get_size_type<
typename ::boost::remove_reference<
typename get_result_type2::type>::type>::type type;
};
template
struct transition_action_result
{
typedef typename get_size_type<
typename ::boost::remove_reference<
typename get_result_type::type>::type>::type type;
};
typedef ::boost::mpl::set tag_type;
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename Container::tag_type,action_tag>::type,
typename transition_action_result::type >::type
operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
return (Container()(evt,fsm,src,tgt)).capacity();
}
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename Container::tag_type,state_action_tag>::type,
typename state_action_result::type >::type
operator()(Event const& evt,FSM& fsm,STATE& state )const
{
return (Container()(evt,fsm,state)).capacity();
}
};
struct capacity_tag {};
struct Capacity_Helper: proto::extends< proto::terminal::type, Capacity_Helper, boost::msm::sm_domain>
{
Capacity_Helper(){}
template
struct In
{
typedef Capacity_ type;
};
};
Capacity_Helper const capacity_;
template
struct Size_ : euml_action >
{
template
struct state_action_result
{
typedef typename get_size_type<
typename ::boost::remove_reference<
typename get_result_type2::type>::type>::type type;
};
template
struct transition_action_result
{
typedef typename get_size_type<
typename ::boost::remove_reference<
typename get_result_type::type>::type>::type type;
};
typedef ::boost::mpl::set tag_type;
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename Container::tag_type,action_tag>::type,
typename transition_action_result::type >::type
operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
return (Container()(evt,fsm,src,tgt)).size();
}
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename Container::tag_type,state_action_tag>::type,
typename state_action_result::type >::type
operator()(Event const& evt,FSM& fsm,STATE& state )const
{
return (Container()(evt,fsm,state)).size();
}
};
struct size_tag {};
struct Size_Helper: proto::extends< proto::terminal::type, Size_Helper, boost::msm::sm_domain>
{
Size_Helper(){}
template
struct In
{
typedef Size_ type;
};
};
Size_Helper const size_;
template
struct Max_Size_ : euml_action >
{
template
struct state_action_result
{
typedef typename get_size_type<
typename ::boost::remove_reference<
typename get_result_type2::type>::type>::type type;
};
template
struct transition_action_result
{
typedef typename get_size_type<
typename ::boost::remove_reference<
typename get_result_type::type>::type>::type type;
};
typedef ::boost::mpl::set tag_type;
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename Container::tag_type,action_tag>::type,
typename transition_action_result::type >::type
operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
return (Container()(evt,fsm,src,tgt)).max_size();
}
template
typename ::boost::enable_if<
typename ::boost::mpl::has_key<
typename Container::tag_type,state_action_tag>::type,
typename state_action_result::type >::type
operator()(Event const& evt,FSM& fsm,STATE& state )const
{
return (Container()(evt,fsm,state)).max_size();
}
};
struct max_size_tag {};
struct Max_Size_Helper: proto::extends< proto::terminal::type, Max_Size_Helper, boost::msm::sm_domain>
{
Max_Size_Helper(){}
template
struct In
{
typedef Max_Size_ type;
};
};
Max_Size_Helper const max_size_;
template
struct Reserve_ : euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template
void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
(Container()(evt,fsm,src,tgt)).reserve(Value()(evt,fsm,src,tgt));
}
template
void operator()(Event const& evt,FSM& fsm,STATE& state )const
{
(Container()(evt,fsm,state)).reserve(Value()(evt,fsm,state));
}
};
struct reserve_tag {};
struct Reserve_Helper: proto::extends< proto::terminal::type, Reserve_Helper, boost::msm::sm_domain>
{
Reserve_Helper(){}
template
struct In
{
typedef Reserve_ type;
};
};
Reserve_Helper const reserve_;
template
struct Resize_ : euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template
void operator()(EVT const& evt, FSM& fsm,SourceState& src,TargetState& tgt)const
{
(Container()(evt,fsm,src,tgt)).resize(Num()(evt,fsm,src,tgt));
}
template
void operator()(Event const& evt,FSM& fsm,STATE& state )const
{
(Container()(evt,fsm,state)).resize(Num()(evt,fsm,state));
}
};
template
struct Resize_::type >::type>
: euml_action >
{
template
struct state_action_result
{
typedef void type;
};
template
struct transition_action_result
{
typedef void type;
};
typedef ::boost::mpl::set tag_type;
template