Zth (libzth)
zth::FsmGuard< Fsm > Class Template Reference

A guard is evaluated, and when true, the corresponding transition is taken. More...

#include <fsm.h>

Public Types

typedef TimeInterval(* Function) (Fsm &fsm)
 

Public Member Functions

constexpr FsmGuard (Function function)
 
 FsmGuard (guards::End)
 
TimeInterval operator() (Fsm &fsm) const
 
constexpr bool valid () const
 

Detailed Description

template<typename Fsm>
class zth::FsmGuard< Fsm >

A guard is evaluated, and when true, the corresponding transition is taken.

Use one of the guards in zth::guards, like zth::guards::always(), or define your own. A guard is a function that gets the current Fsm reference as argument and should return a zth::TimeInterval. When the interval has passed (zero or negative duration), the guard is assumed to be taken. A positive duration indicates how much time it will probably take for the guard to become valid, which can be used to suspend the fiber.

Definition at line 175 of file fsm.h.

Member Typedef Documentation

◆ Function

template<typename Fsm >
typedef TimeInterval(* zth::FsmGuard< Fsm >::Function) (Fsm &fsm)

Definition at line 177 of file fsm.h.

Constructor & Destructor Documentation

◆ FsmGuard() [1/2]

template<typename Fsm >
constexpr zth::FsmGuard< Fsm >::FsmGuard ( Function  function)
inlineconstexpr

Definition at line 180 of file fsm.h.

◆ FsmGuard() [2/2]

template<typename Fsm >
zth::FsmGuard< Fsm >::FsmGuard ( guards::End  )
inline

Definition at line 185 of file fsm.h.

Member Function Documentation

◆ operator()()

template<typename Fsm >
TimeInterval zth::FsmGuard< Fsm >::operator() ( Fsm fsm) const
inline

Definition at line 189 of file fsm.h.

◆ valid()

template<typename Fsm >
constexpr bool zth::FsmGuard< Fsm >::valid ( ) const
inlineconstexpr

Definition at line 194 of file fsm.h.


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