pizzabox-teensy/lib/StateMachine-1.0.13b/src/StateMachine.h

32 lines
648 B
C++

#include <LinkedList.h>
#include "State.h"
#ifndef _STATEMACHINE_H
#define _STATEMACHINE_H
class StateMachine
{
public:
// Methods
StateMachine();
~StateMachine();
void init();
void run();
// When a stated is added we pass the function that represents
// that state logic
State* addState(void (*functionPointer)());
State* transitionTo(State* s);
int transitionTo(int i);
// Attributes
LinkedList<State*> *stateList;
bool executeOnce = true; //Indicates that a transition to a different state has occurred
int currentState = -1; //Indicates the current state number
};
#endif