2017-01-04 7 views
0

私は実際にboost :: msmでeUMLを使って作業しています。これは本当に素晴らしいことです。以前はもっと簡単なFSMを作成しました。boost msm euml fusion issue

しかし私は解決できない問題に直面しているので、ここで助けを得ることを望みます。

コードはかなり簡単です(しかし少し長めです - この記事の最後を参照)。問題は、それがsomewho misformedで、遷移表の中に位置しています:

BOOST_MSM_EUML_TRANSITION_TABLE ((

    state_entryPrimary == state_init [ fsm_(FsmNo) == Int_<fsm_primary>() ] , 
    state_entrySecondary == state_init [ fsm_(FsmNo) == Int_<fsm_secondary>() ] , 

    state_1 == state_entryPrimary [ fsm_(uStatus) == Int_<statid_1>() ], 
    state_2 == state_entryPrimary [ fsm_(uStatus) == Int_<statid_3>() ], //!!!!! 
    state_3 == state_entryPrimary [ fsm_(uStatus) == Int_<statid_4>() ], 
    state_6 == state_entryPrimary [ fsm_(uStatus) == Int_<statid_2>() ], 

    state_4 == state_1 + event_1, 
    state_5 == state_4 + event_2, 
    state_1 == state_3 + event_3, 
    state_7 == state_6 + event_4, 
    state_exit == state_5 + event_9, 
    state_exit == state_7 + event_9 

), my_transition_table) 

私はG ++ 5.4.0と非常に長いエラーメッセージを持ってコードをビルドすることができなかったいくつかの融合コードに基づいて1.58を押し上げます。最初のエラー行は次のようである:

/usr/include/boost/fusion/container/set/convert.hpp:27:13: error: invalid use of incomplete type ‘struct boost::fusion::detail::barrier::as_set<11>’ 

場合、私は//でマークされた行をコメントアウト!!!!!、FSMは、いかなる問題なくコンパイルされます。

誰かがそこにいるのですが、誰がこれを助けることができますか?

#include <boost/msm/front/euml/euml.hpp> 
#include <boost/msm/front/euml/state_grammar.hpp> 
#include <boost/msm/back/state_machine.hpp> 
#include <boost/msm/front/euml/operator.hpp> 
#include <iostream> 

namespace msm = boost::msm; 
using namespace boost::msm::front::euml; 
using namespace msm::front::euml; 

enum UStatusType { 
    statid_1, 
    statid_2, 
    statid_3, 
    statid_4 
}; 

enum FsmType { 
    fsm_primary, 
    fsm_secondary 
}; 

BOOST_MSM_EUML_DECLARE_ATTRIBUTE(UStatusType, uStatus) 
BOOST_MSM_EUML_DECLARE_ATTRIBUTE(FsmType, FsmNo) 
BOOST_MSM_EUML_DECLARE_ATTRIBUTE(int, cnt) 

BOOST_MSM_EUML_ACTION(act_do_a) { 
    template <class Evt,class Fsm, class State> void operator()(Evt const& ,Fsm& fsm, State& state) const 
    { std::cout << " -> do a " << std::endl; } 
}; 

BOOST_MSM_EUML_ACTION(act_do_b) { 
    template <class Evt,class Fsm, class State> void operator()(Evt const& ,Fsm& fsm, State& state) const 
    { std::cout << " -> do b " << std::endl; } 
}; 

BOOST_MSM_EUML_STATE((), state_init) 
BOOST_MSM_EUML_STATE((act_do_b), state_exit) 

BOOST_MSM_EUML_STATE((), state_entryPrimary) 
BOOST_MSM_EUML_STATE((act_do_a), state_1) 
BOOST_MSM_EUML_STATE((act_do_a), state_2) 
BOOST_MSM_EUML_STATE((act_do_a), state_3) 
BOOST_MSM_EUML_STATE((act_do_a), state_4) 
BOOST_MSM_EUML_STATE((act_do_a), state_5) 
BOOST_MSM_EUML_STATE((act_do_a), state_6) 
BOOST_MSM_EUML_STATE((act_do_a), state_7) 

BOOST_MSM_EUML_STATE((), state_entrySecondary) 

BOOST_MSM_EUML_EVENT(event_1) 
BOOST_MSM_EUML_EVENT(event_2) 
BOOST_MSM_EUML_EVENT(event_3) 
BOOST_MSM_EUML_EVENT(event_4) 
BOOST_MSM_EUML_EVENT(event_9) 


BOOST_MSM_EUML_TRANSITION_TABLE ((

    state_entryPrimary == state_init [ fsm_(FsmNo) == Int_<fsm_primary>() ] , 
    state_entrySecondary == state_init [ fsm_(FsmNo) == Int_<fsm_secondary>() ] , 

    state_1 == state_entryPrimary [ fsm_(uStatus) == Int_<statid_1>() ], 
    state_2 == state_entryPrimary [ fsm_(uStatus) == Int_<statid_3>() ], //!!!!! 
    state_3 == state_entryPrimary [ fsm_(uStatus) == Int_<statid_4>() ], 
    state_6 == state_entryPrimary [ fsm_(uStatus) == Int_<statid_2>() ], 

    state_4 == state_1 + event_1, 
    state_5 == state_4 + event_2, 
    state_1 == state_3 + event_3, 
    state_7 == state_6 + event_4, 
    state_exit == state_5 + event_9, 
    state_exit == state_7 + event_9 

), my_transition_table) 

BOOST_MSM_EUML_DECLARE_STATE_MACHINE((my_transition_table, init_ << state_init, no_action, no_action, 
    attributes_ << FsmNo << uStatus << cnt), my_fsm) 

int main() 
{ 
    msm::back::state_machine<my_fsm> my; 

    // testing some start conditions 
    my.get_attribute(uStatus) = statid_1; // read from device 
    my.get_attribute(FsmNo) = fsm_primary; 
    my.get_attribute(cnt) = 1; 

    my.start(); 
    my.process_event(event_1); 
    my.process_event(event_2); 
    my.process_event(event_9); 

    std::cout << "\nRestart Statemachine with statid_3\n\n"; 
    my.get_attribute(uStatus) = statid_3; 
    my.start(); 
    my.process_event(event_3); 

    std::cout << "\nRestart Statemachine with statid_2\n\n"; 
    my.get_attribute(uStatus) = statid_2; 
    my.start(); 
    my.process_event(event_4); 
    my.process_event(event_9); 
} 
+0

ので、問題はそれによって解決される:場合には移行テーブル20個のエントリを超える、次の定義が追加されなければなりません。 – Tom

答えて

0

FUSION_MAX_VECTOR_SIZEは、includeセクションの前に必要なものを定義します。 、発行。消えるを1.63を高めるために更新する場合

#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 
#define BOOST_MPL_LIMIT_VECTOR_SIZE 30 //max table size     
#define BOOST_MPL_LIMIT_MAP_SIZE 30 //max table size 

http://www.boost.org/doc/libs/1_63_0/libs/msm/doc/HTML/ch03s02.html#d0e358

関連する問題