-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnullFSM.h
More file actions
44 lines (33 loc) · 1.6 KB
/
nullFSM.h
File metadata and controls
44 lines (33 loc) · 1.6 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
#ifndef NULLFSM_H
#define NULLFSM_H
/*******************************************************************************
* INCLUDE HEADER FILES
******************************************************************************/
#include <iostream>
#include "genericFSM.h"
#include "eventClass.h"
/*******************************************************************************
* ENUMERATIONS AND STRUCTURES AND TYPEDEFS
*******************************************************************************/
#define NX(x) (static_cast<void (genericFSM::*)(genericEvent*)>(&nullFSM::x))
/*******************************************************************************
* CLASS PROTOTYPE
******************************************************************************/
class nullFSM;
class nullFSM : public genericFSM
{
public:
nullFSM() : genericFSM(&nullTable[0][0], 4, 5, S_N, NX(assignValue)) {}
private:
enum nullStates : stateType { S_N, S_U, S_L, S_LL };
typedef enum { EV_U, EV_L, OTHER, END_CHAR, _EOF } nullEvents;
const fsmCell nullTable[4][5] = {
// 'U' 'L' OTHER END_CHAR _EOF
{ {S_U, NX(nothing)}, {ERROR, NX(error)}, {ERROR, NX(error)}, {ERROR, NX(error)}, {ERROR, NX(error)}}, //S_N
{ {ERROR, NX(error)}, {S_L, NX(nothing)}, {ERROR, NX(error)}, {ERROR, NX(error)}, {ERROR, NX(error)}}, //S_U
{ {ERROR, NX(error)}, {S_LL, NX(nothing)}, {ERROR, NX(error)}, {ERROR, NX(error)}, {ERROR, NX(error)}}, //S_L
{ {ERROR, NX(error)}, {ERROR, NX(error)}, {ERROR, NX(error)}, {END, NX(end)}, {END, NX(end)}}, //S_LL
};
void assignValue(genericEvent* ev);
};
#endif // NULLFSM_H