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

By inheriting from the State class, the user of the FSM defines a base class for all custom states. More...

#include <StateMachine.h>

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

Public Member Functions

virtual std::string get_name () const =0
 
virtual void run (double time, double period)
 
virtual void exit ()
 
void react (const Event &e)
 

Protected Member Functions

SharedDataType & shared_data ()
 
XBot::LoggerClassconsole ()
 
template<typename MessageType >
bool transit (const std::string &next_state_name, const MessageType &msg)
 
bool transit (const std::string &next_state_name)
 
std::string get_previous_state_name () const
 
template<typename EventType >
void send_event (const EventType &e)
 

Friends

class StateMachine< StateType, SharedDataType >
 

Detailed Description

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

By inheriting from the State class, the user of the FSM defines a base class for all custom states.

The first template parameter is the base class for user-defined states, according to the Curiously Recurring Template Pattern (CRTP). The second template parameter (optional) is a custom class for holding data which is shared among all states.

Member Function Documentation

◆ console()

template<typename StateType , typename SharedDataType = SharedDataBase>
XBot::LoggerClass& XBot::FSM::State< StateType, SharedDataType >::console ( )
inlineprotected

◆ exit()

template<typename StateType , typename SharedDataType = SharedDataBase>
virtual void XBot::FSM::State< StateType, SharedDataType >::exit ( )
inlinevirtual

◆ get_name()

template<typename StateType , typename SharedDataType = SharedDataBase>
virtual std::string XBot::FSM::State< StateType, SharedDataType >::get_name ( ) const
pure virtual

◆ get_previous_state_name()

template<typename StateType , typename SharedDataType = SharedDataBase>
std::string XBot::FSM::State< StateType, SharedDataType >::get_previous_state_name ( ) const
inlineprotected

◆ react()

template<typename StateType , typename SharedDataType = SharedDataBase>
void XBot::FSM::State< StateType, SharedDataType >::react ( const Event e)
inline

◆ run()

template<typename StateType , typename SharedDataType = SharedDataBase>
virtual void XBot::FSM::State< StateType, SharedDataType >::run ( double  time,
double  period 
)
inlinevirtual

◆ send_event()

template<typename StateType , typename SharedDataType = SharedDataBase>
template<typename EventType >
void XBot::FSM::State< StateType, SharedDataType >::send_event ( const EventType &  e)
inlineprotected

◆ shared_data()

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

◆ transit() [1/2]

template<typename StateType , typename SharedDataType = SharedDataBase>
bool XBot::FSM::State< StateType, SharedDataType >::transit ( const std::string &  next_state_name)
inlineprotected

◆ transit() [2/2]

template<typename StateType , typename SharedDataType = SharedDataBase>
template<typename MessageType >
bool XBot::FSM::State< StateType, SharedDataType >::transit ( const std::string &  next_state_name,
const MessageType &  msg 
)
inlineprotected

Friends And Related Function Documentation

◆ StateMachine< StateType, SharedDataType >

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

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