PureFSM
pure::state_machine< Table, Logger > Struct Template Reference

State Machine. More...

Public Member Functions

 state_machine (logger_t custom_logger)
 Constructor that allows to initialize a logger. More...
 
template<typename Event , typename... Args>
void event (Args &&... args)
 Pass an event to a State Machine. More...
 
template<typename... Args>
void action (Args &&... args)
 Calls a state action. More...
 
template<class Guard >
void guard ()
 Change current guard. More...
 

Detailed Description

template<class Table, class Logger = empty_logger>
struct pure::state_machine< Table, Logger >

State Machine.

Template Parameters
Tabletransition_table
Loggertype that provides a logger interface

Constructor & Destructor Documentation

◆ state_machine()

template<class Table , class Logger = empty_logger>
pure::state_machine< Table, Logger >::state_machine ( logger_t  custom_logger)
inline

Constructor that allows to initialize a logger.

If the user-defined logger needs some internal data initialization, user can define a template type of State Machine as a reference to a logger and pass a logger by reference; or pass it by value.

Member Function Documentation

◆ action()

template<class Table , class Logger = empty_logger>
template<typename... Args>
void pure::state_machine< Table, Logger >::action ( Args &&...  args)
inline

Calls a state action.

Template Parameters
Args...variadic template type pack of arguments

If the current state type is a functor and it is can be called with the given arguments, it will be called.

◆ event()

template<class Table , class Logger = empty_logger>
template<typename Event , typename... Args>
void pure::state_machine< Table, Logger >::event ( Args &&...  args)
inline

Pass an event to a State Machine.

Template Parameters
Eventevent
Args...variadic template type pack of arguments

Input impact for State Machine. If the there is a transition, for which current state, current guard and an event are matched, the transition will be performed.

If the given event causes a transition, and this transition has an action, it will be called with the arguments Args....

◆ guard()

template<class Table , class Logger = empty_logger>
template<class Guard >
void pure::state_machine< Table, Logger >::guard ( )
inline

Change current guard.

Template Parameters
Guardnext guard

The documentation for this struct was generated from the following file: