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/
In article <MPG.26577b03842bd0dd989683@news.gmane.org>, roberts.noah@gmail.com says...
typedef sc::transition<lock_fly,locked> reations;
nevermind. >:\ -- http://crazyeddiecpp.blogspot.com/
participants (1)
-
Noah Roberts