$darkmode
engine::StateMachine< StateType, ContextType > Class Template Referenceabstract
Inheritance diagram for engine::StateMachine< StateType, ContextType >:

Public Member Functions

const StateMap & states () const
 
StateId previous_state () const
 
template<typename StateImpl = StateType>
std::shared_ptr< StateImpl > get_state (StateId id)
 
StateId run_state (StateId id, ContextType &ctx)
 
void register_state (StateType *s)
 
void register_state (std::shared_ptr< StateType > s)
 
void register_states (std::initializer_list< StateType * > init)
 
void push_interrupt (StateId id)
 
std::optional< StateId > pop_interrupt ()
 
virtual StateId handle_interrupt (StateId nominal, StateId interrupt, ContextType &ctx)=0
 
virtual cloe::Logger logger () const
 

Member Function Documentation

◆ get_state()

template<typename StateType , typename ContextType >
template<typename StateImpl = StateType>
std::shared_ptr<StateImpl> engine::StateMachine< StateType, ContextType >::get_state ( StateId  id)
inline

Return the class that implements the given state ID.

◆ handle_interrupt()

template<typename StateType , typename ContextType >
virtual StateId engine::StateMachine< StateType, ContextType >::handle_interrupt ( StateId  nominal,
StateId  interrupt,
ContextType &  ctx 
)
pure virtual

Handle an interrupt.

This method will be called between states, with the nominal state that would have occurred being passed along.

Implemented in engine::SimulationMachine.

◆ logger()

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

Return the logger that should be used for this state.

Here is the caller graph for this function:

◆ previous_state()

template<typename StateType , typename ContextType >
StateId engine::StateMachine< StateType, ContextType >::previous_state ( ) const
inline

Return the previous state that was run.

◆ push_interrupt()

template<typename StateType , typename ContextType >
void engine::StateMachine< StateType, ContextType >::push_interrupt ( StateId  id)
inline

Interrupt normal state machine traversal with the following StateId.

If one interrupt has already occurred, it is invalid for a further interrupt to occur until the previous one has been processed.

Here is the call graph for this function:

◆ states()

template<typename StateType , typename ContextType >
const StateMap& engine::StateMachine< StateType, ContextType >::states ( ) const
inline

Return the state map.


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