#ifndef _OVENSTATE_HPP_ #define _OVENSTATE_HPP_ #include "oven.hpp" #include "ovenCtrl.hpp" class OvenState { public: static OvenState* init(Oven& entity); virtual handle(Oven& entity, OvenController::Event e) = 0; protected: virtual void entryAction(Oven& Entity); virtual void exitAction(Oven& Entity); typedef void (Oven::State::*Action)(Oven& entity); OvenState* changeState(Oven& entity, Action pTransitAction, OvenState* pNewState); // transition Actions void emptyAction() {}; }; class IdleState : public OvenState { public: static IdleState* getInstatnce(): virtual OvenState* handle(Oven& entity, OvenControll::Event e); protected: virtual void entryAction(Oven& entity); virtual void exitAction(Oven& entity); private: IdleState() {}; static IdleState instance; }; #endif // _OVENSTATE_HPP_