-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfalseFSM.h
More file actions
45 lines (34 loc) · 1.94 KB
/
falseFSM.h
File metadata and controls
45 lines (34 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef FALSEFSM_H
#define FALSEFSM_H
/*******************************************************************************
* INCLUDE HEADER FILES
******************************************************************************/
#include <iostream>
#include "genericFSM.h"
#include "eventClass.h"
/*******************************************************************************
* ENUMERATIONS AND STRUCTURES AND TYPEDEFS
*******************************************************************************/
#define FX(x) (static_cast<void (genericFSM::*)(genericEvent*)>(&falseFSM::x))
/*******************************************************************************
* CLASS PROTOTYPE
******************************************************************************/
class falseFSM;
class falseFSM : public genericFSM
{
public:
falseFSM() : genericFSM(&falseTable[0][0], 5, 7, S_F, FX(assignValue)) {}
private:
enum falseStates : stateType { S_F, S_A, S_L, S_S, S_E};
typedef enum { EV_A, EV_L, EV_S, EV_E, OTHER, END_CHAR, _EOF } falseEvents;
const fsmCell falseTable[5][7] = {
// 'A' 'L' 'S' 'E' OTHER END_CHAR _EOF
{ {S_A, FX(nothing)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}}, //S_F
{ {ERROR, FX(error)}, {S_L, FX(nothing)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}}, //S_A
{ {ERROR, FX(error)}, {ERROR, FX(error)}, {S_S, FX(nothing)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}}, //S_L
{ {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {S_E, FX(nothing)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}}, //S_S
{ {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {ERROR, FX(error)}, {END, FX(end)}, {END, FX(end)}}, //S_E
};
void assignValue(genericEvent* ev);
};
#endif // FALSEFSM_H