Zth (libzth)
zth::FsmCallback< State_, CallbackArg_, Input_, FsmImpl_ > Class Template Reference

#include <fsm.h>

Inheritance diagram for zth::FsmCallback< State_, CallbackArg_, Input_, FsmImpl_ >:
zth::Fsm< State_, int, choose_type< void, FsmCallback< State_, void, int, void > >::type > zth::UniqueID< Fsm< void, void, void > > zth::UniqueIDBase

Public Types

typedef choose_type< FsmImpl_, FsmCallback< State_, CallbackArg_, Input_, void > >::type FsmImpl
 
typedef Fsm< State_, Input_, FsmImplbase
 
typedef CallbackArg_ CallbackArg
 
typedef void(* Callback) (FsmCallback &, CallbackArg)
 
- Public Types inherited from zth::Fsm< State_, int, choose_type< void, FsmCallback< State_, void, int, void > >::type >
typedef choose_type< choose_type< void, FsmCallback< State_, void, int, void > >::type, Fsm >::type FsmImpl
 
typedef State_ State
 
typedef int Input
 
typedef FsmCompiler< FsmImplCompiler
 
typedef FsmDescription< FsmImplDescription[]
 

Public Member Functions

 FsmCallback (typename base::Compiler const &compiler, Callback callback, CallbackArg callbackArg, char const *name="FSM")
 
 FsmCallback (typename base::Description description, Callback callback, CallbackArg callbackArg, char const *name="FSM")
 
virtual ~FsmCallback ()
 
CallbackArg callbackArg () const
 
- Public Member Functions inherited from zth::Fsm< State_, int, choose_type< void, FsmCallback< State_, void, int, void > >::type >
 Fsm (Compiler const &compiler, char const *name="FSM")
 
 Fsm (Description description, char const *name="FSM")
 
virtual ~Fsm ()
 
State const & state () const
 
Timestamp const & t () const
 
TimeInterval dt () const
 
State const & next () const
 
void reset ()
 
bool entry () const
 
bool exit () const
 
bool lockstep () const
 Check if lockstep mode is enabled. More...
 
void setLockstep (bool enable)
 Enable/disable lockstep mode. More...
 
bool guardLock ()
 Check if a lock was requested while running in lockstep mode. More...
 
bool guardStep ()
 Check if a step was requested while paused in lockstep mode. More...
 
void step ()
 Allow the Fsm to proceed one step, if in lockstep mode. More...
 
void input (Input i)
 
bool clearInput (Input i)
 
void clearInputs ()
 
void setInputsCapacity (size_t capacity)
 
bool hasInput (Input i) const
 
TimeInterval eval (bool alwaysDoCallback=false)
 
void run ()
 
void trigger ()
 
- Public Member Functions inherited from zth::UniqueID< Fsm< void, void, void > >
 UniqueID (UniqueID const &)=delete
 
 UniqueID (UniqueID &&u) noexcept
 
 UniqueID (string const &name)
 
 UniqueID (string &&name)
 
 UniqueID (char const *name=nullptr)
 
UniqueIDoperator= (UniqueID const &)=delete
 
UniqueIDoperator= (UniqueID &&u) noexcept
 
virtual ~UniqueID ()=default
 
void const * normptr () const noexcept
 
uint64_t id () const noexcept
 
string const & name () const noexcept
 
void setName (string const &name)
 
void setName (char const *name)
 
void setName (string &&name)
 
virtual char const * id_str () const override
 

Protected Member Functions

virtual void callback () override
 This function is called when the FSM has to execute the code belonging by the current state. More...
 
- Protected Member Functions inherited from zth::UniqueIDBase
virtual ~UniqueIDBase ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from zth::UniqueID< Fsm< void, void, void > >
static uint64_t getID () noexcept
 
- Public Attributes inherited from zth::Fsm< State_, int, choose_type< void, FsmCallback< State_, void, int, void > >::type >
FsmDescription< FsmImpl > * m_description
 
Compiler const * m_compiler
 
FsmDescription< FsmImpl > const * m_compiledDescription
 
- Protected Types inherited from zth::Fsm< State_, int, choose_type< void, FsmCallback< State_, void, int, void > >::type >
enum  EvalState
 
enum  Lockstep
 
typedef FsmDescription< FsmImpl > const * StateAddr
 

Detailed Description

template<typename State_, typename CallbackArg_ = void, typename Input_ = int, typename FsmImpl_ = void>
class zth::FsmCallback< State_, CallbackArg_, Input_, FsmImpl_ >

Definition at line 727 of file fsm.h.

Member Typedef Documentation

◆ base

template<typename State_ , typename CallbackArg_ = void, typename Input_ = int, typename FsmImpl_ = void>
typedef Fsm<State_, Input_, FsmImpl> zth::FsmCallback< State_, CallbackArg_, Input_, FsmImpl_ >::base

Definition at line 736 of file fsm.h.

◆ Callback

template<typename State_ , typename CallbackArg_ = void, typename Input_ = int, typename FsmImpl_ = void>
typedef void(* zth::FsmCallback< State_, CallbackArg_, Input_, FsmImpl_ >::Callback) (FsmCallback &, CallbackArg)

Definition at line 738 of file fsm.h.

◆ CallbackArg

template<typename State_ , typename CallbackArg_ = void, typename Input_ = int, typename FsmImpl_ = void>
typedef CallbackArg_ zth::FsmCallback< State_, CallbackArg_, Input_, FsmImpl_ >::CallbackArg

Definition at line 737 of file fsm.h.

◆ FsmImpl

template<typename State_ , typename CallbackArg_ = void, typename Input_ = int, typename FsmImpl_ = void>
typedef choose_type< FsmImpl_, FsmCallback<State_, CallbackArg_, Input_, void> >::type zth::FsmCallback< State_, CallbackArg_, Input_, FsmImpl_ >::FsmImpl

Definition at line 735 of file fsm.h.

Constructor & Destructor Documentation

◆ FsmCallback() [1/2]

template<typename State_ , typename CallbackArg_ = void, typename Input_ = int, typename FsmImpl_ = void>
zth::FsmCallback< State_, CallbackArg_, Input_, FsmImpl_ >::FsmCallback ( typename base::Compiler const &  compiler,
Callback  callback,
CallbackArg  callbackArg,
char const *  name = "FSM" 
)
inline

Definition at line 740 of file fsm.h.

◆ FsmCallback() [2/2]

template<typename State_ , typename CallbackArg_ = void, typename Input_ = int, typename FsmImpl_ = void>
zth::FsmCallback< State_, CallbackArg_, Input_, FsmImpl_ >::FsmCallback ( typename base::Description  description,
Callback  callback,
CallbackArg  callbackArg,
char const *  name = "FSM" 
)
inline

Definition at line 749 of file fsm.h.

◆ ~FsmCallback()

template<typename State_ , typename CallbackArg_ = void, typename Input_ = int, typename FsmImpl_ = void>
virtual zth::FsmCallback< State_, CallbackArg_, Input_, FsmImpl_ >::~FsmCallback ( )
inlinevirtual

Definition at line 759 of file fsm.h.

Member Function Documentation

◆ callback()

template<typename State_ , typename CallbackArg_ = void, typename Input_ = int, typename FsmImpl_ = void>
virtual void zth::FsmCallback< State_, CallbackArg_, Input_, FsmImpl_ >::callback ( )
inlineoverrideprotectedvirtual

This function is called when the FSM has to execute the code belonging by the current state.

It is called upon entry and exit of a state, and arbitrary times during a state.

Implements zth::Fsm< State_, int, choose_type< void, FsmCallback< State_, void, int, void > >::type >.

Definition at line 767 of file fsm.h.

◆ callbackArg()

template<typename State_ , typename CallbackArg_ = void, typename Input_ = int, typename FsmImpl_ = void>
CallbackArg zth::FsmCallback< State_, CallbackArg_, Input_, FsmImpl_ >::callbackArg ( ) const
inline

Definition at line 761 of file fsm.h.


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