[msm] How to cause no_transition for cases of guard returning false?

Hi,
I want no_transition() to be called whenever no row matches, even if there
is a row that does not match only because the guard returns false. How can
I achieve this? I want to be strict about the input events. I can probably
workaround this by putting guardless rows at the top whose action is to
call no_transition(), but I'm hoping to find a cleaner solution.
If I get this behavior in msm, then the following code should output "no
transition..." as its last line. Right now, with boost 1.51, it doesn't. It
just prints "entering State1".
Josh
#include <iostream>
#include

Hi,
I want no_transition() to be called whenever no row matches, even if there is a row that does not match only
because the guard returns false. How can I achieve this? I want to be strict about the input events. I can probably
workaround this by putting guardless rows at the top whose action is to call no_transition(),
but I'm hoping to find a cleaner solution.
Hi Josh, no_transition is an error, which defaults to an assert. A guard rejection is not an error and perfectly valid. You can put an action to the transition where the guard rejects the event, or you can compare the return value of process_event with HANDLED_GUARD_REJECT. HTH, Christophe

Thanks. That clarified everything. On Tue, Nov 13, 2012 at 3:36 PM, Christophe Henry < christophe.j.henry@googlemail.com> wrote:
**
Hi,
I want no_transition() to be called whenever no row matches, even if there is a row that does not match only
because the guard returns false. How can I achieve this? I want to be strict about the input events. I can probably
workaround this by putting guardless rows at the top whose action is to call no_transition(),
but I'm hoping to find a cleaner solution.
Hi Josh,
no_transition is an error, which defaults to an assert. A guard rejection is not an error and perfectly valid.
You can put an action to the transition where the guard rejects the event, or you can compare the return value of process_event with
HANDLED_GUARD_REJECT.
HTH,
Christophe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Christophe Henry
-
☂Josh Chia (谢任中)