|
Boost Users : |
Subject: [Boost-users] statechart not working...
From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2010-05-14 19:22:13
Why isn't this statechart doing anything?
struct mouse_move : sc::event<mouse_move> {};
struct lock_fly : sc::event<lock_fly> {};
struct unlock_fly : sc::event<unlock_fly> {};
struct arrow_outer;
struct arrow_tool : sc::state_machine<arrow_tool,arrow_outer> {};
struct unlocked;
struct arrow_outer : sc::simple_state<arrow_outer, arrow_tool, unlocked>
{};
struct locked : sc::simple_state<locked, arrow_outer>
{
locked() { std::cerr << "locked\n"; }
~locked() { std::cerr << "unlocking\n"; }
typedef sc::transition<unlock_fly, unlocked> reactions;
};
struct unlocked : sc::simple_state<unlocked, arrow_outer>
{
unlocked() { std::cerr << "unlocked\n"; }
~unlocked() { std::cerr << "locking\n"; }
typedef sc::transition<lock_fly,locked> reations;
};
int main()
{
arrow_tool tool;
tool.initiate();
//tool.process_event(mouse_move());
tool.process_event(lock_fly());
//tool.process_event(mouse_move());
tool.process_event(unlock_fly());
//tool.process_event(mouse_move());
std::cin.get();
}
I expect:
unlocked
locking
locked
unlocking
unlocked
locking
I get:
unlocked
locking
My events are obviously not triggering transitions. From what I can
tell it's almost exactly like the stopwatch example with some different
names and no self-transition in the outermost state.
I've stepped through the program and it seems that the event processor
ends up passing everything down as an unrecognized event.
-- http://crazyeddiecpp.blogspot.com/
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net