[msm] interrupt_state with more then one event that ends interrupt?

Hi, Subj, Is that possible? for example, one event continues processing, the another one finishes the whole state-machine (some clean-up actions etc). I tried struct Interrupt : public msmf::interrupt_state< boost::mpl::vector<Foo, Bar> > {}; and struct Interrupt : public msmf::interrupt_state< msmf::ActionSequence_< boost::mpl::vector<Foo, Bar> > > {}; - has no effect. Is there another way to achieve this?

Hi,
Subj, Is that possible?
At the moment no.
for example, one event continues processing, the another one finishes the whole state-machine (some clean-up actions etc).
I tried
struct Interrupt : public msmf::interrupt_state< boost::mpl::vector<Foo, Bar> > {};
If I had implemented it, it would look like this, not like the second one.
- has no effect.
As the doc states, only one end event is currently supported, but it's been on my list with low prio as nobody had requested it. If you can wait a few days, I can give it a try very soon. HTH, Christophe

On 21.05.2013 23:37, Christophe Henry wrote:
As the doc states, only one end event is currently supported, but it's been on my list with low prio as nobody had requested it. If you can wait a few days, I can give it a try very soon.
Yes, sure. To my mind, this option could be useful in fsm's.

Hi,
Subj, Is that possible? for example, one event continues processing, the another one finishes the whole state-machine (some clean-up actions etc).
I tried
struct Interrupt : public msmf::interrupt_state< boost::mpl::vector<Foo, Bar> > {};
Hi, this should now work (rev 84642 in trunk). Could you give it a try? It's too late for 1.54 so it will make it into 1.55. Cheers, Christophe

On 05.06.2013 1:06, Christophe Henry wrote:
Hi, this should now work (rev 84642 in trunk). Could you give it a try? It's too late for 1.54 so it will make it into 1.55.
I tested it against trunk rev 84986 with vs2012u2. It works perfectly! Looking forward to see it in 1.55 test code: #include <iostream> #include <boost/msm/back/state_machine.hpp> #include <boost/msm/front/state_machine_def.hpp> #include <boost/msm/front/functor_row.hpp> #include <assert.h> namespace msm = boost::msm; namespace mpl = boost::mpl; using msm::front::none; using msm::front::Row; #define ENTRY_EXIT_INFO() \ template <typename Event, typename FSM> \ void on_entry(const Event&, FSM&) { \ std::cout << "entering: " << typeid(*this).name() << std::endl; \ } \ template <typename Event, typename FSM> \ void on_exit(const Event&, FSM&) { \ std::cout << "leaving: " << typeid(*this).name() << std::endl; \ } struct init {}; struct interrupt {}; struct proceed {}; struct finish {}; struct fsm_ : public msm::front::state_machine_def<fsm_> { struct Empty : public msm::front::state<> { ENTRY_EXIT_INFO(); }; struct Proceed : public msm::front::state<> { ENTRY_EXIT_INFO(); }; struct Interrupted : public msm::front::interrupt_state<mpl::vector<proceed, finish> > { ENTRY_EXIT_INFO(); }; struct Finished : public msm::front::terminate_state<> { ENTRY_EXIT_INFO(); }; typedef mpl::vector<Empty> initial_state; struct transition_table : mpl::vector< // Start Event Next Action Guard // +-------------+-------------+------------+---------------------+----------------------+ Row < Empty , init , Proceed , none , none >, Row < Proceed , interrupt , Interrupted , none , none >, Row < Interrupted , proceed , Proceed , none , none >, Row < Interrupted , finish , Finished , none , none > > {}; enum States { STATE_Empty, STATE_Proceed, STATE_Interupted, STATE_Finished }; }; typedef msm::back::state_machine<fsm_> fsm_t; int tmain() { fsm_t fsm; fsm.start(); fsm.process_event(init()); assert(fsm.current_state()[0] == fsm_t::STATE_Proceed); fsm.process_event(interrupt()); assert(fsm.current_state()[0] == fsm_t::STATE_Interupted); fsm.process_event(proceed()); assert(fsm.current_state()[0] == fsm_t::STATE_Proceed); fsm.process_event(interrupt()); assert(fsm.current_state()[0] == fsm_t::STATE_Interupted); fsm.process_event(finish()); assert(fsm.current_state()[0] == fsm_t::STATE_Finished); return 0; }

On 05.06.2013 1:06, Christophe Henry wrote:
Hi, this should now work (rev 84642 in trunk). Could you give it a try? It's too late for 1.54 so it will make it into 1.55.
I tested it against trunk rev 84986 with vs2012u2. It works perfectly! Looking forward to see it in 1.55
Great! Thanks for trying it. Christophe
participants (3)
-
Alexander Mingalev
-
Christophe Henry
-
Sam Fisher