Zth (libzth)
zth::fsm Namespace Reference

Classes

struct  function_traits
 
struct  invalid_fsm
 Exception thrown when the FSM description is incorrect. More...
 
class  Symbol
 A input/state symbol. More...
 
class  Named
 
class  Named< false >
 
class  Named< true >
 
class  Callback
 
class  Callback< T, R, false, false, true >
 
class  Callback< T, R, true, false, true >
 
class  Callback< T, R, false, true, true >
 
class  GuardPollInterval
 
class  Guard
 
class  TypedGuard
 
class  InputGuard
 
class  Action
 
class  TypedAction
 
class  GuardedActionBase
 
class  GuardedAction
 
class  TransitionStart
 
class  Transition
 
class  TransitionsBase
 
class  Transitions
 
class  BasicFsm
 Basic FSM base class. More...
 
class  Fsm
 FSM base class. More...
 

Typedefs

using State = Symbol
 A state within the FSM. More...
 

Functions

constexpr Symbol operator""_S (char const *s, size_t len) noexcept
 Literal suffix to convert a string literal to zth::fsm::Symbol. More...
 
template<typename T >
constexpr auto guard (T &&g, char const *name=nullptr)
 Create a guard from a function. More...
 
constexpr auto guard (Symbol &&input) noexcept
 Create a guard from a input symbol. More...
 
bool always_guard () noexcept
 
bool never_guard () noexcept
 
template<typename T >
constexpr auto action (T &&a, char const *name=nullptr)
 Create an action from a function. More...
 
void nothing_action ()
 
constexpr auto operator/ (Guard const &g, Action const &a) noexcept
 
constexpr auto operator+ (Symbol &&input) noexcept
 
constexpr auto input (Symbol &&symbol) noexcept
 Create a guard from an input symbol. More...
 
constexpr auto operator+ (GuardedAction &&g) noexcept
 
constexpr auto operator/ (GuardedAction &&ga, Action const &a)
 
constexpr auto operator+ (State &&state, GuardedAction &&action) noexcept
 
constexpr auto operator+ (State &&state, Guard const &guard) noexcept
 
constexpr auto operator+ (State &&state, Symbol &&input) noexcept
 
constexpr auto operator+ (char const *state, Symbol &&input) noexcept
 
constexpr auto operator+ (State &&state, char const *input) noexcept
 
constexpr auto const & operator+ (Guard const &guard) noexcept
 
constexpr auto operator/ (State &&state, Action const &action) noexcept
 
constexpr auto operator+ (State &&state, TransitionStart &&t)
 
constexpr Transition operator>>= (TransitionStart &&from, State &&to) noexcept
 
constexpr Transition operator>>= (State &&from, State &&to) noexcept
 
constexpr Transition operator>>= (char const *from, State &&to) noexcept
 
constexpr Transition operator>>= (Guard const &from, State &&to) noexcept
 
constexpr Transition operator>>= (Action const &from, State &&to) noexcept
 
constexpr Transition operator>>= (GuardedAction &&from, State &&to) noexcept
 
template<typename... T>
constexpr auto compile (T &&... t)
 Compile a transition description. More...
 

Variables

constexpr auto always
 Trivial guard that is always enabled. More...
 
constexpr auto never
 Trivial guard that is never enabled. More...
 
constexpr auto nothing
 Trivial action that does nothing. More...
 
constexpr auto entry
 Guard that is only enabled upon entry of a state. More...
 
constexpr auto push
 Action to push the new state onto the stack. More...
 
constexpr auto pop
 Action to pop the current state from the stack. More...
 
constexpr auto popped
 Guard to indicate that the current state was reached via pop. More...
 
constexpr auto stop
 Action to return from Fsm::run(). More...
 
constexpr auto consume
 Action consume the current input symbol. More...
 
template<time_t s>
constexpr auto timeout_s
 A guard that is enabled after a s seconds after entering the current state. More...
 
template<uint64_t ms>
constexpr auto timeout_ms
 A guard that is enabled after a ms milliseconds after entering the current state. More...
 
template<uint64_t us>
constexpr auto timeout_us
 A guard that is enabled after a us microseconds after entering the current state. More...
 

Function Documentation

◆ always_guard()

bool zth::fsm::always_guard ( )
inlinenoexcept

Definition at line 551 of file fsm14.h.

◆ never_guard()

bool zth::fsm::never_guard ( )
inlinenoexcept

Definition at line 566 of file fsm14.h.

◆ nothing_action()

void zth::fsm::nothing_action ( )
inline

Definition at line 654 of file fsm14.h.

◆ operator+() [1/9]

constexpr auto zth::fsm::operator+ ( char const *  state,
Symbol &&  input 
)
inlineconstexprnoexcept

Definition at line 896 of file fsm14.h.

◆ operator+() [2/9]

constexpr auto const& zth::fsm::operator+ ( Guard const &  guard)
inlineconstexprnoexcept

Definition at line 906 of file fsm14.h.

◆ operator+() [3/9]

constexpr auto zth::fsm::operator+ ( GuardedAction &&  g)
inlineconstexprnoexcept

Definition at line 786 of file fsm14.h.

◆ operator+() [4/9]

constexpr auto zth::fsm::operator+ ( State &&  state,
char const *  input 
)
inlineconstexprnoexcept

Definition at line 901 of file fsm14.h.

◆ operator+() [5/9]

constexpr auto zth::fsm::operator+ ( State &&  state,
Guard const &  guard 
)
inlineconstexprnoexcept

Definition at line 886 of file fsm14.h.

◆ operator+() [6/9]

constexpr auto zth::fsm::operator+ ( State &&  state,
GuardedAction &&  action 
)
inlineconstexprnoexcept

Definition at line 881 of file fsm14.h.

◆ operator+() [7/9]

constexpr auto zth::fsm::operator+ ( State &&  state,
Symbol &&  input 
)
inlineconstexprnoexcept

Definition at line 891 of file fsm14.h.

◆ operator+() [8/9]

constexpr auto zth::fsm::operator+ ( State &&  state,
TransitionStart &&  t 
)
inlineconstexpr

Definition at line 918 of file fsm14.h.

◆ operator+() [9/9]

constexpr auto zth::fsm::operator+ ( Symbol &&  input)
inlineconstexprnoexcept

Definition at line 767 of file fsm14.h.

◆ operator/() [1/3]

constexpr auto zth::fsm::operator/ ( Guard const &  g,
Action const &  a 
)
inlineconstexprnoexcept

Definition at line 762 of file fsm14.h.

◆ operator/() [2/3]

constexpr auto zth::fsm::operator/ ( GuardedAction &&  ga,
Action const &  a 
)
inlineconstexpr

Definition at line 793 of file fsm14.h.

◆ operator/() [3/3]

constexpr auto zth::fsm::operator/ ( State &&  state,
Action const &  action 
)
inlineconstexprnoexcept

Definition at line 911 of file fsm14.h.

◆ operator>>=() [1/6]

constexpr Transition zth::fsm::operator>>= ( Action const &  from,
State &&  to 
)
inlineconstexprnoexcept

Definition at line 1016 of file fsm14.h.

◆ operator>>=() [2/6]

constexpr Transition zth::fsm::operator>>= ( char const *  from,
State &&  to 
)
inlineconstexprnoexcept

Definition at line 1006 of file fsm14.h.

◆ operator>>=() [3/6]

constexpr Transition zth::fsm::operator>>= ( Guard const &  from,
State &&  to 
)
inlineconstexprnoexcept

Definition at line 1011 of file fsm14.h.

◆ operator>>=() [4/6]

constexpr Transition zth::fsm::operator>>= ( GuardedAction &&  from,
State &&  to 
)
inlineconstexprnoexcept

Definition at line 1021 of file fsm14.h.

◆ operator>>=() [5/6]

constexpr Transition zth::fsm::operator>>= ( State &&  from,
State &&  to 
)
inlineconstexprnoexcept

Definition at line 1001 of file fsm14.h.

◆ operator>>=() [6/6]

constexpr Transition zth::fsm::operator>>= ( TransitionStart &&  from,
State &&  to 
)
inlineconstexprnoexcept

Definition at line 996 of file fsm14.h.