-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelfTest.cpp
More file actions
42 lines (34 loc) · 896 Bytes
/
Copy pathSelfTest.cpp
File metadata and controls
42 lines (34 loc) · 896 Bytes
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
#include "SelfTest.h"
#include <iostream>
using namespace std;
SelfTest::SelfTest(INT maxStates) :
StateMachine(maxStates)
{
}
void SelfTest::Cancel()
{
// State machine base classes can't use a transition map, only the
// most-derived state machine class within the hierarchy can. So external
// events like this use the current state and call ExternalEvent()
// to invoke the state machine transition.
if (GetCurrentState() != ST_IDLE)
ExternalEvent(ST_FAILED);
}
STATE_DEFINE(SelfTest, Idle, NoEventData)
{
cout << "SelfTest::ST_Idle" << endl;
}
ENTRY_DEFINE(SelfTest, EntryIdle, NoEventData)
{
cout << "SelfTest::EN_EntryIdle" << endl;
}
STATE_DEFINE(SelfTest, Completed, NoEventData)
{
cout << "SelfTest::ST_Completed" << endl;
InternalEvent(ST_IDLE);
}
STATE_DEFINE(SelfTest, Failed, NoEventData)
{
cout << "SelfTest::ST_Failed" << endl;
InternalEvent(ST_IDLE);
}