You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
896 B
49 lines
896 B
#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_
|