Files
FsmEval/AState.hpp
T
2015-01-24 12:07:40 +00:00

57 lines
826 B
C++

/*
* File: AState.hpp
* Author: jens
*
* Created on 21. Januar 2015, 05:12
*/
#ifndef ASTATE_HPP
#define ASTATE_HPP
template <class IdType> class AStateMachine;
template <class IdType>
class AState
{
public:
AState<IdType> *m_pNext;
AState(IdType id)
: m_pNext(0)
, m_pStateMachine(0)
, m_id(id)
{
}
virtual ~AState() {}
IdType id()
{
return m_id;
}
void registerStateMachine(AStateMachine<IdType> *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<IdType> *m_pStateMachine;
IdType m_id;
};
#endif /* ASTATE_HPP */