#ifndef _FSM_H_ #define _FSM_H_ #include #include #include "IBehaviouralState.hpp" /// /// /// /// IBehaviouralState is the only accepted /// class. template class FSM { public: template FSM(TPState &... args) { int i = 0; ((void) _states.emplace(i++, args), ...); } /// /// Implement with FSM::act() /// void act(); /// /// Used to check current state. /// /// Current state. std::shared_ptr & get_state() { return _currentState; } /// /// Used to get all states. /// /// Current states. std::map> get_states(); /// /// Sets current state, calls appropiate functions. /// /// State to transition into. void set_state(std::shared_ptr); private: std::map> _states; std::shared_ptr _currentState; }; #endif // _FSM_H_