Embedded Template Library 1.0
Loading...
Searching...
No Matches
etl::state_chart< TObject, TParameter > Class Template Reference

#include <state_chart.h>

Public Types

typedef TParameter parameter_t
typedef state_chart_traits::state_id_t state_id_t
typedef state_chart_traits::event_id_t event_id_t
typedef state_chart_traits::transition< TObject, parameter_t > transition
typedef state_chart_traits::state< TObject > state
Public Types inherited from etl::istate_chart< void >
typedef void parameter_t
typedef state_chart_traits::state_id_t state_id_t
typedef state_chart_traits::event_id_t event_id_t

Public Member Functions

ETL_CONSTEXPR state_chart (TObject &object_, const transition *transition_table_begin_, const transition *transition_table_end_, const state *state_table_begin_, const state *state_table_end_, const state_id_t state_id_)
void set_transition_table (const transition *transition_table_begin_, const transition *transition_table_end_)
void set_state_table (const state *state_table_begin_, const state *state_table_end_)
TObject & get_object ()
const TObject & get_object () const
virtual void start (bool on_entry_initial=true) ETL_OVERRIDE
 Start the state chart.
void process_event (event_id_t event_id, parameter_t data) ETL_OVERRIDE
Public Member Functions inherited from etl::istate_chart< void >
 istate_chart (state_id_t initial_state_id)
virtual void process_event (event_id_t)=0
state_id_t get_state_id () const

Additional Inherited Members

Protected Attributes inherited from etl::istate_chart< void >
state_id_t current_state_id
 The current state id.

Detailed Description

template<typename TObject, typename TParameter = void>
class etl::state_chart< TObject, TParameter >

Simple Finite State Machine Runtime tables. Event has a parameter.

Constructor & Destructor Documentation

◆ state_chart()

template<typename TObject, typename TParameter = void>
ETL_CONSTEXPR etl::state_chart< TObject, TParameter >::state_chart ( TObject & object_,
const transition * transition_table_begin_,
const transition * transition_table_end_,
const state * state_table_begin_,
const state * state_table_end_,
const state_id_t state_id_ )
inline

Constructor.

Parameters
object_A reference to the implementation object.
transition_table_begin_The start of the table of transitions.
transition_table_end_The end of the table of transitions.
state_table_begin_The start of the state table.
state_table_end_The end of the state table.
state_id_The initial state id.

Member Function Documentation

◆ get_object() [1/2]

template<typename TObject, typename TParameter = void>
TObject & etl::state_chart< TObject, TParameter >::get_object ( )
inline

Gets a reference to the implementation object.

Returns
Reference to the implementation object.

◆ get_object() [2/2]

template<typename TObject, typename TParameter = void>
const TObject & etl::state_chart< TObject, TParameter >::get_object ( ) const
inline

Gets a const reference to the implementation object.

Returns
Const reference to the implementation object.

◆ process_event()

template<typename TObject, typename TParameter = void>
void etl::state_chart< TObject, TParameter >::process_event ( event_id_t event_id,
parameter_t data )
inline

Processes the specified event. The state machine will action the first item in the transition table that satisfies the conditions for executing the action.

Parameters
event_idThe id of the event to process.

◆ set_state_table()

template<typename TObject, typename TParameter = void>
void etl::state_chart< TObject, TParameter >::set_state_table ( const state * state_table_begin_,
const state * state_table_end_ )
inline

Sets the state table.

Parameters
state_table_begin_The start of the state table.
state_table_end_The end of the state table.

◆ set_transition_table()

template<typename TObject, typename TParameter = void>
void etl::state_chart< TObject, TParameter >::set_transition_table ( const transition * transition_table_begin_,
const transition * transition_table_end_ )
inline

Sets the transition table.

Parameters
state_table_begin_The start of the state table.
state_table_end_The end of the state table.

◆ start()

template<typename TObject, typename TParameter = void>
virtual void etl::state_chart< TObject, TParameter >::start ( bool on_entry_initial = true)
inlinevirtual

Start the state chart.

Implements etl::istate_chart< void >.


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