Added boost header

This commit is contained in:
Christophe Riccio
2012-01-08 01:26:07 +00:00
parent 9c3faaca40
commit c7d752cdf8
8946 changed files with 1732316 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
// 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_DETAILS_COMMON_STATES_H
#define BOOST_MSM_FRONT_DETAILS_COMMON_STATES_H
#include <boost/mpl/int.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/fusion/container/map.hpp>
#include <boost/fusion/include/at_key.hpp>
#include <boost/type_traits/add_const.hpp>
namespace boost { namespace msm { namespace front {namespace detail
{
template <class Attributes= ::boost::fusion::map<> >
struct inherit_attributes
{
inherit_attributes():m_attributes(){}
inherit_attributes(Attributes const& the_attributes):m_attributes(the_attributes){}
// on the fly attribute creation capability
typedef Attributes attributes_type;
template <class Index>
typename ::boost::fusion::result_of::at_key<attributes_type,
Index>::type
get_attribute(Index const&)
{
return ::boost::fusion::at_key<Index>(m_attributes);
}
template <class Index>
typename ::boost::add_const<
typename ::boost::fusion::result_of::at_key<attributes_type,
Index>::type>::type
get_attribute(Index const&)const
{
return const_cast<
typename ::boost::add_const<
typename ::boost::fusion::result_of::at_key< attributes_type,
Index >::type>::type>
(::boost::fusion::at_key<Index>(m_attributes));
}
private:
// attributes
Attributes m_attributes;
};
// the interface for all states. Defines entry and exit functions. Overwrite to implement for any state needing it.
template<class USERBASE,class Attributes= ::boost::fusion::map<> >
struct state_base : public inherit_attributes<Attributes>, USERBASE
{
typedef USERBASE user_state_base;
typedef Attributes attributes_type;
// empty implementation for the states not wishing to define an entry condition
// will not be called polymorphic way
template <class Event,class FSM>
void on_entry(Event const& ,FSM&){}
template <class Event,class FSM>
void on_exit(Event const&,FSM& ){}
// default (empty) transition table;
typedef ::boost::mpl::vector0<> internal_transition_table;
typedef ::boost::mpl::vector0<> transition_table;
};
}}}}
#endif //BOOST_MSM_FRONT_DETAILS_COMMON_STATES_H

View File

@@ -0,0 +1,71 @@
// 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_ROW2_HELPER_HPP
#define BOOST_MSM_ROW2_HELPER_HPP
#include <boost/mpl/bool.hpp>
#include <boost/fusion/include/at_key.hpp>
namespace boost { namespace msm { namespace front
{
namespace detail
{
template<
typename CalledForAction
, typename Event
, void (CalledForAction::*action)(Event const&)
>
struct row2_action_helper
{
template <class FSM,class Evt,class SourceState,class TargetState, class AllStates>
static void call_helper(FSM&,Evt const& evt,SourceState&,TargetState&,
AllStates& all_states,::boost::mpl::false_ const &)
{
// in this front-end, we don't need to know source and target states
( ::boost::fusion::at_key<CalledForAction>(all_states).*action)(evt);
}
template <class FSM,class Evt,class SourceState,class TargetState, class AllStates>
static void call_helper(FSM& fsm,Evt const& evt,SourceState&,TargetState&,AllStates&,
::boost::mpl::true_ const &)
{
// in this front-end, we don't need to know source and target states
(fsm.*action)(evt);
}
};
template<
typename CalledForGuard
, typename Event
, bool (CalledForGuard::*guard)(Event const&)
>
struct row2_guard_helper
{
template <class FSM,class Evt,class SourceState,class TargetState,class AllStates>
static bool call_helper(FSM&,Evt const& evt,SourceState&,TargetState&,
AllStates& all_states, ::boost::mpl::false_ const &)
{
// in this front-end, we don't need to know source and target states
return ( ::boost::fusion::at_key<CalledForGuard>(all_states).*guard)(evt);
}
template <class FSM,class Evt,class SourceState,class TargetState,class AllStates>
static bool call_helper(FSM& fsm,Evt const& evt,SourceState&,TargetState&,
AllStates&,::boost::mpl::true_ const &)
{
// in this front-end, we don't need to know source and target states
return (fsm.*guard)(evt);
}
};
}
}}}
#endif //BOOST_MSM_ROW2_HELPER_HPP