/* * File: AState.hpp * Author: jens * * Created on 21. Januar 2015, 05:12 */ #ifndef ASTATE_HPP #define ASTATE_HPP template class AStateMachine; template class AState { public: AState *m_pNext; AState(IdType id) : m_pNext(0) , m_pStateMachine(0) , m_id(id) { } virtual ~AState() {} IdType id() { return m_id; } void registerStateMachine(AStateMachine *pStateMachine) { m_pStateMachine = pStateMachine; } virtual void onTransition() { printf("%s\n", __PRETTY_FUNCTION__); } protected: void setState(IdType state) { if(m_pStateMachine) { m_pStateMachine->setState(state); } } private: AStateMachine *m_pStateMachine; IdType m_id; }; #endif /* ASTATE_HPP */