- Notifications
You must be signed in to change notification settings - Fork25
Transition Guards
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.
structcondition_a {template<typename FSM,typename State,typename Event >booloperator()(FSMconst&, Stateconst&, Eventconst&) {returnsome_knowledge() ?true :false; }};
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.
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.
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.
- Home
- Tutorial
- Concepts
- State Hierarchy
- Entry/Exit Actions
- Transition Actions
- Transition Guards
- Internal Transitions
- Default Transitions
- Event Deferring
- History
- Orthogonal Regions
- Event Priority
- Common Base
- Thread Safety
- Exception Safety Guarantees
- Under the Hood
- Event Processing
- Performance