Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/afsmPublic

Transition Guards

Sergei Fedorov edited this pageNov 20, 2016 ·2 revisions

A transition guard is a predicate that can be used to select a transition based on some condition. A true value enables the transition, false - prohibits it.

Signature accepting event

structcondition_a {template<typename FSM,typename State,typename Event >booloperator()(FSMconst&, Stateconst&, Eventconst&)    {returnsome_knowledge() ?true :false;    }};

Signature not wanting event

structcondition_b {template<typename FSM,typename State >booloperator()(FSMconst&, Stateconst& )    {returnsome_knowledge() ?true :false;    }};

The guard'soperator() is passed const references to the immediate enclosing state machine and current state. Optionally it can accept const reference to the event handled. If there is ambiguity (both signatures are defined and both can be used), the operator accepting more parameters is selected.

Predicate Logical Operations

Negation

The predicates can be negated by::psst::meta::not_ template, e.g.not_<condition_a>. The::psst::meta::not_ has a type aliasnot_ defined inside::afsm::def::state and::afsm::def::state_machine templates.

Conjunction and Disjunction

Predicates can be combined by::psst::meta::and_ and::psst::meta::or_ templates, e.g.and_< condition_a, not_<condition_b> >. Type aliases for those templates inside::afsm::def::state and::afsm::def::state_machine templates areand_ andor_ respectively.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp