$darkmode
engine::State< MachineType, ContextType > Class Template Referenceabstract

Public Member Functions

 State (MachineType *ptr)
 
virtual StateId id () const =0
 
MachineType * state_machine () const
 
virtual StateId run (ContextType &ctx)
 
virtual cloe::Logger logger () const
 

Protected Member Functions

virtual StateId impl (ContextType &ctx)=0
 

Friends

void to_json (cloe::Json &j, const State< MachineType, ContextType > &s)
 

Member Function Documentation

◆ id()

template<typename MachineType , typename ContextType >
virtual StateId engine::State< MachineType, ContextType >::id ( ) const
pure virtual

Return a C-string defining the unique name of this state.

It is important that all states be defined globally and statically, so that the pointer to the C-string is always the same.

◆ impl()

template<typename MachineType , typename ContextType >
virtual StateId engine::State< MachineType, ContextType >::impl ( ContextType &  ctx)
protectedpure virtual

The implementation of this state behavior.

Here is the caller graph for this function:

◆ logger()

template<typename MachineType , typename ContextType >
virtual cloe::Logger engine::State< MachineType, ContextType >::logger ( ) const
inlinevirtual

Return the logger that should be used for this state.

Here is the caller graph for this function:

◆ run()

template<typename MachineType , typename ContextType >
virtual StateId engine::State< MachineType, ContextType >::run ( ContextType &  ctx)
inlinevirtual

Enter into this state and return the next state that should be executed.

If nullptr is returned, then the state machine aborts.

Here is the call graph for this function:

◆ state_machine()

template<typename MachineType , typename ContextType >
MachineType* engine::State< MachineType, ContextType >::state_machine ( ) const
inline

Return a pointer to the state machine.

This is useful to accessing methods on the entire state machine, such as may be used for inserting interrupts.


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