Embedded Template Library 1.0
Loading...
Searching...
No Matches
etl::fsm Class Reference

The FSM class. More...

#include <fsm.h>

Public Member Functions

 fsm (etl::message_router_id_t id)
 Constructor.
template<typename TSize>
void set_states (etl::ifsm_state **p_states, TSize size)
virtual void start (bool call_on_enter_state=true)
void receive (const etl::imessage &message) ETL_OVERRIDE
 Top level message handler for the FSM.
etl::fsm_state_id_t transition_to (etl::fsm_state_id_t new_state_id)
 Invoke a state transition.
bool accepts (etl::message_id_t) const ETL_OVERRIDE
etl::fsm_state_id_t get_state_id () const
 Gets the current state id.
ifsm_stateget_state ()
 Gets a reference to the current state interface.
const ifsm_stateget_state () const
 Gets a const reference to the current state interface.
bool is_started () const
 Checks if the FSM has been started.
virtual void reset (bool call_on_exit_state=false)
ETL_DEPRECATED bool is_null_router () const ETL_OVERRIDE
bool is_producer () const ETL_OVERRIDE
bool is_consumer () const ETL_OVERRIDE
 fsm (etl::message_router_id_t id)
 Constructor.
template<typename TSize>
void set_states (etl::ifsm_state **p_states, TSize size)
 Set the states for the FSM From a pointer to etl::ifsm_state and size.
virtual void start (bool call_on_enter_state=true)
 Starts the FSM. Can only be called once. Subsequent calls will do nothing.
void receive (const etl::imessage &message) ETL_OVERRIDE
 Top level message handler for the FSM.
etl::fsm_state_id_t transition_to (etl::fsm_state_id_t new_state_id)
 Invoke a state transition.
bool accepts (etl::message_id_t) const ETL_OVERRIDE
 Does this FSM accept the message id? Yes, it accepts everything!
etl::fsm_state_id_t get_state_id () const
 Gets the current state id.
ifsm_stateget_state ()
 Gets a reference to the current state interface.
const ifsm_stateget_state () const
 Gets a const reference to the current state interface.
bool is_started () const
 Checks if the FSM has been started.
virtual void reset (bool call_on_exit_state=false)
 Reset the FSM to pre-started state.
ETL_DEPRECATED bool is_null_router () const ETL_OVERRIDE
bool is_producer () const ETL_OVERRIDE
bool is_consumer () const ETL_OVERRIDE
virtual void receive (etl::message_router_id_t destination_router_id, const etl::imessage &message)
virtual void receive (etl::shared_message shared_msg)
virtual void receive (etl::message_router_id_t destination_router_id, etl::shared_message shared_msg)
bool accepts (const etl::imessage &msg) const
Public Member Functions inherited from etl::imessage_router
bool accepts (const etl::imessage &msg) const
etl::message_router_id_t get_message_router_id () const
bool accepts (const etl::imessage &msg) const
etl::message_router_id_t get_message_router_id () const
Public Member Functions inherited from etl::successor< imessage_router >
 successor ()
 Default constructor.
void set_successor (successor_type &s)
 Set the successor.
void append_successor (TSuccessor &s)
 Append a successor.
void clear_successor ()
 Clear the successor.
void clear_successor_chain ()
 Clear the successor chain.
successor_type & get_successor () const
bool has_successor () const
 Does this have a successor?

Friends

class etl::hfsm

Additional Inherited Members

Public Types inherited from etl::imessage_router
enum  {
  NULL_MESSAGE_ROUTER = 255 , MESSAGE_BUS = 254 , ALL_MESSAGE_ROUTERS = 253 , MESSAGE_BROKER = 252 ,
  MESSAGE_ROUTER = 251 , MAX_MESSAGE_ROUTER = 249
}
enum  {
  NULL_MESSAGE_ROUTER = 255 , MESSAGE_BUS = 254 , ALL_MESSAGE_ROUTERS = 253 , MESSAGE_BROKER = 252 ,
  MESSAGE_ROUTER = 251 , MAX_MESSAGE_ROUTER = 249
}
Public Types inherited from etl::successor< imessage_router >
typedef imessage_router successor_type
Protected Member Functions inherited from etl::imessage_router
 imessage_router (etl::message_router_id_t id_)
 imessage_router (etl::message_router_id_t id_, imessage_router &successor_)
 imessage_router (etl::message_router_id_t id_)
 imessage_router (etl::message_router_id_t id_, imessage_router &successor_)

Detailed Description

The FSM class.

Member Function Documentation

◆ accepts() [1/2]

bool etl::fsm::accepts ( etl::message_id_t ) const
inlinevirtual

Does this FSM accept the message id? Yes, it accepts everything!

Implements etl::imessage_router.

◆ accepts() [2/2]

bool etl::fsm::accepts ( etl::message_id_t ) const
inlinevirtual

Does this FSM accept the message id? Yes, it accepts everything!

Implements etl::imessage_router.

◆ is_consumer() [1/2]

bool etl::fsm::is_consumer ( ) const
inlinevirtual

Implements etl::imessage_router.

◆ is_consumer() [2/2]

bool etl::fsm::is_consumer ( ) const
inlinevirtual

Implements etl::imessage_router.

◆ is_null_router() [1/2]

ETL_DEPRECATED bool etl::fsm::is_null_router ( ) const
inlinevirtual

Implements etl::imessage_router.

◆ is_null_router() [2/2]

ETL_DEPRECATED bool etl::fsm::is_null_router ( ) const
inlinevirtual

Implements etl::imessage_router.

◆ is_producer() [1/2]

bool etl::fsm::is_producer ( ) const
inlinevirtual

Implements etl::imessage_router.

◆ is_producer() [2/2]

bool etl::fsm::is_producer ( ) const
inlinevirtual

Implements etl::imessage_router.

◆ receive() [1/5]

void etl::fsm::receive ( const etl::imessage & message)
inlinevirtual

Top level message handler for the FSM.

Implements etl::imessage_router.

◆ receive() [2/5]

void etl::fsm::receive ( const etl::imessage & message)
inlinevirtual

Top level message handler for the FSM.

Implements etl::imessage_router.

◆ receive() [3/5]

virtual void etl::imessage_router::receive ( etl::message_router_id_t destination_router_id,
const etl::imessage & message )
inlinevirtual

Reimplemented from etl::imessage_router.

◆ receive() [4/5]

virtual void etl::imessage_router::receive ( etl::message_router_id_t destination_router_id,
etl::shared_message shared_msg )
inlinevirtual

Reimplemented from etl::imessage_router.

◆ receive() [5/5]

virtual void etl::imessage_router::receive ( etl::shared_message shared_msg)
inlinevirtual

Reimplemented from etl::imessage_router.

◆ reset() [1/2]

virtual void etl::fsm::reset ( bool call_on_exit_state = false)
inlinevirtual

Reset the FSM to pre-started state.

Parameters
call_on_exit_stateIf true will call on_exit_state() for the current state. Default = false.

Reimplemented in etl::hfsm.

◆ reset() [2/2]

virtual void etl::fsm::reset ( bool call_on_exit_state = false)
inlinevirtual

Reset the FSM to pre-started state.

Parameters
call_on_exit_stateIf true will call on_exit_state() for the current state. Default = false.

Reimplemented in etl::hfsm.

◆ set_states()

template<typename TSize>
void etl::fsm::set_states ( etl::ifsm_state ** p_states,
TSize size )
inline

Set the states for the FSM From a pointer to etl::ifsm_state and size.

◆ start() [1/2]

virtual void etl::fsm::start ( bool call_on_enter_state = true)
inlinevirtual

Starts the FSM. Can only be called once. Subsequent calls will do nothing.

Parameters
call_on_enter_stateIf true will call on_enter_state() for the first state. Default = true.

Reimplemented in etl::hfsm.

◆ start() [2/2]

virtual void etl::fsm::start ( bool call_on_enter_state = true)
inlinevirtual

Starts the FSM. Can only be called once. Subsequent calls will do nothing.

Parameters
call_on_enter_stateIf true will call on_enter_state() for the first state. Default = true.

Reimplemented in etl::hfsm.


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