XBotInterface  2.4.1
XBotInterface provides a generic API to model and control a robot.
Public Member Functions | Friends | List of all members
XBot::FSM::StateMachine< StateType, SharedDataType > Class Template Reference

Class implementing a finite state machine with states inheriting from the user-defined class StateType, which must provided as the first template parameter. More...

#include <StateMachine.h>

+ Collaboration diagram for XBot::FSM::StateMachine< StateType, SharedDataType >:

Public Member Functions

 StateMachine ()
 
bool init (const std::string &initial_state_name)
 
template<typename MessageType >
bool init (const std::string &initial_state_name, const MessageType &msg)
 
bool register_state (std::shared_ptr< StateType > state)
 
template<typename EventType >
bool send_event (const EventType &event)
 
bool run (double time, double period)
 
std::shared_ptr< const StateType > get_current_state () const
 
SharedDataType & shared_data ()
 

Friends

class State< StateType, SharedDataType >
 

Detailed Description

template<typename StateType, typename SharedDataType = SharedDataBase>
class XBot::FSM::StateMachine< StateType, SharedDataType >

Class implementing a finite state machine with states inheriting from the user-defined class StateType, which must provided as the first template parameter.

The second template parameter (optional) represents a custom class for holding shared data among states.

Constructor & Destructor Documentation

◆ StateMachine()

template<typename StateType , typename SharedDataType = SharedDataBase>
XBot::FSM::StateMachine< StateType, SharedDataType >::StateMachine ( )
inline

Member Function Documentation

◆ get_current_state()

template<typename StateType , typename SharedDataType = SharedDataBase>
std::shared_ptr<const StateType> XBot::FSM::StateMachine< StateType, SharedDataType >::get_current_state ( ) const
inline

◆ init() [1/2]

template<typename StateType , typename SharedDataType = SharedDataBase>
bool XBot::FSM::StateMachine< StateType, SharedDataType >::init ( const std::string &  initial_state_name)
inline

◆ init() [2/2]

template<typename StateType , typename SharedDataType = SharedDataBase>
template<typename MessageType >
bool XBot::FSM::StateMachine< StateType, SharedDataType >::init ( const std::string &  initial_state_name,
const MessageType &  msg 
)
inline

◆ register_state()

template<typename StateType , typename SharedDataType = SharedDataBase>
bool XBot::FSM::StateMachine< StateType, SharedDataType >::register_state ( std::shared_ptr< StateType >  state)
inline

◆ run()

template<typename StateType , typename SharedDataType = SharedDataBase>
bool XBot::FSM::StateMachine< StateType, SharedDataType >::run ( double  time,
double  period 
)
inline

◆ send_event()

template<typename StateType , typename SharedDataType = SharedDataBase>
template<typename EventType >
bool XBot::FSM::StateMachine< StateType, SharedDataType >::send_event ( const EventType &  event)
inline

◆ shared_data()

template<typename StateType , typename SharedDataType = SharedDataBase>
SharedDataType& XBot::FSM::StateMachine< StateType, SharedDataType >::shared_data ( )
inline

Friends And Related Function Documentation

◆ State< StateType, SharedDataType >

template<typename StateType , typename SharedDataType = SharedDataBase>
friend class State< StateType, SharedDataType >
friend

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