infinite_state_machine 1.0.0
Infinite State Machine Library
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
infinite::state_machine< Topology > Class Template Reference

A state machine topology navigation class. More...

#include <infinite_state_machine.hpp>

Classes

struct  transition
 A struct representing the states exited and entered during a transition. More...
 

Public Member Functions

virtual ~state_machine ()
 Destructor for the state machine.
 
struct transition go (state< Topology > *to)
 Transition to a new state.
 
state< Topology > * at () const
 Get the current state.
 
bool in (state< Topology > *state) const
 Check if a state is active.
 

Detailed Description

template<typename Topology>
class infinite::state_machine< Topology >

A state machine topology navigation class.

This class provides methods to navigate through the state machine's topology, allowing for transitions between states and querying the current state.

Definition at line 44 of file infinite_state_machine.hpp.

Constructor & Destructor Documentation

◆ ~state_machine()

template<typename Topology >
virtual infinite::state_machine< Topology >::~state_machine ( )
inlinevirtual

Destructor for the state machine.

Cleans up the state machine and releases any resources.

Definition at line 48 of file infinite_state_machine.hpp.

Member Function Documentation

◆ at()

template<typename Topology >
state< Topology > * infinite::state_machine< Topology >::at ( ) const
inline

Get the current state.

Returns
The current state, or nullptr if there is no active state.

Definition at line 119 of file infinite_state_machine.hpp.

◆ go()

template<typename Topology >
struct transition infinite::state_machine< Topology >::go ( state< Topology > *  to)
inline

Transition to a new state.

This function handles the state transition logic, including the management of entry and exit states.

Do not make any assumptions about the topology. Specifically, do not assume that one state does not occupy more than one state machine terrain. If a state does appear in overlapping topologies, then the state will appear in both the exits and enters. Consider this a correct conclusion since the duplicated state re-enters from a different super-state. The nesting differs.

Parameters
toThe new state to transition to.
Returns
A struct containing the states that were exited and entered during the transition.

Definition at line 87 of file infinite_state_machine.hpp.

◆ in()

template<typename Topology >
bool infinite::state_machine< Topology >::in ( state< Topology > *  state) const
inline

Check if a state is active.

Parameters
stateThe state to check.
Returns
Answers true if the state is active, false otherwise.

Definition at line 126 of file infinite_state_machine.hpp.


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