Maki
Loading...
Searching...
No Matches
maki::transition_table< Impl > Class Template Reference

Represents a transition table. More...

Public Member Functions

constexpr transition_table ()=default
 Default constructor.
constexpr transition_table (const transition_table &)=default
 Copy constructor.
 transition_table (transition_table &&)=delete
 Deleted move constructor.
template<class Source, class Target, class Event = null_t, class ActionOrNull = null_t, class GuardOrNull = null_t>
constexpr auto operator() (const Source &source_state_mold, const Target &target_state_mold, const Event &evt=null, const ActionOrNull &action=null, const GuardOrNull &guard=null)
 Creates a new transition_table with an additional transition.
transition_tableoperator= (const transition_table &)=delete
 Deleted assignment operator.
transition_tableoperator= (transition_table &&)=delete
 Deleted move operator.

Detailed Description

template<class Impl>
class maki::transition_table< Impl >

Represents a transition table.

A transition table lists all the possible transitions from a state (the source state) to another (the target state) in a region of a state machine.

To define a transition table, you have to instantiate an empty maki::transition_table and call maki::transition_table::operator()() for each transition, like so:

//source, target, event, action, guard
(maki::ini, off)
(off, on, maki::event<button_press>, turn_light_on, has_enough_power)
(on, off, maki::event<button_press>, turn_light_off)
;
Represents a transition table.
Definition transition_table.hpp:178
constexpr transition_table()=default
Default constructor.

Member Function Documentation

◆ operator()()

template<class Impl>
template<class Source, class Target, class Event = null_t, class ActionOrNull = null_t, class GuardOrNull = null_t>
auto maki::transition_table< Impl >::operator() ( const Source & source_state_mold,
const Target & target_state_mold,
const Event & evt = null,
const ActionOrNull & action = null,
const GuardOrNull & guard = null )
constexpr

Creates a new transition_table with an additional transition.

Parameters
source_state_moldthe mold of the active state (or states, plural, if it's a state set) from which the transition can occur
target_state_moldthe mold of the state that becomes active after the transition occurs
evtthe event type (or types, plural, if it's an event type set) that can cause the transition to occur
actionthe maki::action invoked when the transition occurs, or maki::null
guardthe maki::guard that must return true for the transition to occur, or maki::null